diff options
25 files changed, 1048 insertions, 296 deletions
diff --git a/build.properties b/build.properties index c81d017315..8beb46ca1f 100644 --- a/build.properties +++ b/build.properties @@ -23,7 +23,7 @@ mc_version=1.7.10 majorUpdate=0 minorUpdate=4 -buildNumber=3 +buildNumber=4 APIVersion=5 ic2.version=2.2.828-experimental gregtech.version=5.09.32.36 diff --git a/src/main/java/com/github/bartimaeusnek/bartworks/client/ClientEventHandler/ClientEventHandler.java b/src/main/java/com/github/bartimaeusnek/bartworks/client/ClientEventHandler/ClientEventHandler.java index b2b152aee9..5888b88ef2 100644 --- a/src/main/java/com/github/bartimaeusnek/bartworks/client/ClientEventHandler/ClientEventHandler.java +++ b/src/main/java/com/github/bartimaeusnek/bartworks/client/ClientEventHandler/ClientEventHandler.java @@ -23,46 +23,85 @@ package com.github.bartimaeusnek.bartworks.client.ClientEventHandler; import com.github.bartimaeusnek.bartworks.API.BioVatLogicAdder; +import com.github.bartimaeusnek.bartworks.MainMod; import com.github.bartimaeusnek.bartworks.common.blocks.BW_Blocks; -import com.github.bartimaeusnek.bartworks.util.BW_Util; +import com.github.bartimaeusnek.bartworks.system.material.OreDictHandler; +import com.github.bartimaeusnek.bartworks.util.BW_ColorUtil; import com.github.bartimaeusnek.bartworks.util.ChatColorHelper; +import com.github.bartimaeusnek.crossmod.BartWorksCrossmod; +import cpw.mods.fml.common.Loader; +import cpw.mods.fml.common.ModContainer; import cpw.mods.fml.common.eventhandler.EventPriority; import cpw.mods.fml.common.eventhandler.SubscribeEvent; +import cpw.mods.fml.common.registry.GameRegistry; import cpw.mods.fml.relauncher.Side; import cpw.mods.fml.relauncher.SideOnly; import gregtech.api.enums.GT_Values; +import gregtech.api.util.GT_Utility; import net.minecraft.block.Block; import net.minecraft.block.material.Material; +import net.minecraft.item.ItemStack; import net.minecraft.util.StatCollector; import net.minecraftforge.event.entity.player.ItemTooltipEvent; +import java.util.ArrayList; import java.util.HashMap; +import java.util.List; @SideOnly(Side.CLIENT) public class ClientEventHandler { + HashMap<ItemStack, List<String>> cache = new HashMap<>(); + @SideOnly(Side.CLIENT) @SubscribeEvent(priority = EventPriority.HIGHEST) public void getTooltip(ItemTooltipEvent event) { - if (event.itemStack == null || event.itemStack.getItem() == null || Block.getBlockFromItem(event.itemStack.getItem()) == null || event.itemStack.getItemDamage() > 127) + if (event.itemStack == null || event.itemStack.getItem() == null || Block.getBlockFromItem(event.itemStack.getItem()) == null) return; - final Block BLOCK = Block.getBlockFromItem(event.itemStack.getItem()); - if (BLOCK instanceof BW_Blocks) { - return; - } - final BioVatLogicAdder.BlockMetaPair PAIR = new BioVatLogicAdder.BlockMetaPair(BLOCK, (byte) event.itemStack.getItemDamage()); - final HashMap<BioVatLogicAdder.BlockMetaPair, Byte> GLASSMAP = BioVatLogicAdder.BioVatGlass.getGlassMap(); - if (GLASSMAP.containsKey(PAIR)) { - int tier = GLASSMAP.get(PAIR); - event.toolTip.add( - StatCollector.translateToLocal("tooltip.glas.0.name") + + if (!cache.containsKey(event.itemStack)) { + List<String> tooAdd = new ArrayList<>(); + + for (ItemStack stack : OreDictHandler.getCache().values()) { + if (GT_Utility.areStacksEqual(event.itemStack, stack)) { + GameRegistry.UniqueIdentifier UI = GameRegistry.findUniqueIdentifierFor(stack.getItem()); + if (UI == null) + UI = GameRegistry.findUniqueIdentifierFor(Block.getBlockFromItem(stack.getItem())); + if (UI != null) { + for (ModContainer modContainer : Loader.instance().getModList()) { + if (UI.modId.equals(MainMod.MOD_ID) || UI.modId.equals(BartWorksCrossmod.MOD_ID) || UI.modId.equals("BWCore")) + break; + if (UI.modId.equals(modContainer.getModId())) { + tooAdd.add("Shared ItemStack between " + ChatColorHelper.DARKGREEN + "BartWorks" + ChatColorHelper.GRAY + " and " + ChatColorHelper.RED + modContainer.getName()); + } + } + } else + tooAdd.add("Shared ItemStack between " + ChatColorHelper.DARKGREEN + "BartWorks" + ChatColorHelper.GRAY + " and another Mod, that doesn't use the ModContainer propperly!"); + } + } + + final Block BLOCK = Block.getBlockFromItem(event.itemStack.getItem()); + if (BLOCK instanceof BW_Blocks) { + cache.put(event.itemStack, tooAdd); + return; + } + final BioVatLogicAdder.BlockMetaPair PAIR = new BioVatLogicAdder.BlockMetaPair(BLOCK, (byte) event.itemStack.getItemDamage()); + final HashMap<BioVatLogicAdder.BlockMetaPair, Byte> GLASSMAP = BioVatLogicAdder.BioVatGlass.getGlassMap(); + if (GLASSMAP.containsKey(PAIR)) { + int tier = GLASSMAP.get(PAIR); + tooAdd.add( + StatCollector.translateToLocal("tooltip.glas.0.name") + + " " + + BW_ColorUtil.getColorForTier(tier) + GT_Values.VN[tier] + ChatColorHelper.RESET); + } else if (BLOCK.getMaterial().equals(Material.glass)) { + tooAdd.add(StatCollector.translateToLocal("tooltip.glas.0.name") + " " - + BW_Util.getColorForTier(tier) + GT_Values.VN[tier] + ChatColorHelper.RESET); - } else if (BLOCK.getMaterial().equals(Material.glass)) { - event.toolTip.add(StatCollector.translateToLocal("tooltip.glas.0.name") + - " " - + BW_Util.getColorForTier(3) + GT_Values.VN[3] + ChatColorHelper.RESET); + + BW_ColorUtil.getColorForTier(3) + GT_Values.VN[3] + ChatColorHelper.RESET); + } + cache.put(event.itemStack, tooAdd); + event.toolTip.addAll(tooAdd); + } else { + event.toolTip.addAll(cache.get(event.itemStack)); } } }
\ No newline at end of file diff --git a/src/main/java/com/github/bartimaeusnek/bartworks/client/gui/GT_GUIContainer_RadioHatch.java b/src/main/java/com/github/bartimaeusnek/bartworks/client/gui/GT_GUIContainer_RadioHatch.java index 3cdaddc85b..2ae5bf6317 100644 --- a/src/main/java/com/github/bartimaeusnek/bartworks/client/gui/GT_GUIContainer_RadioHatch.java +++ b/src/main/java/com/github/bartimaeusnek/bartworks/client/gui/GT_GUIContainer_RadioHatch.java @@ -64,9 +64,9 @@ public class GT_GUIContainer_RadioHatch extends GT_GUIContainerMetaTile_Machine this.drawTexturedModalRect(65, 13, 192, 0, (48 * (((GT_Container_RadioHatch) mContainer).sv)) / (maxSv), 16); -// this.fontRendererObj.drawString("Sv: " + ((GT_Container_RadioHatch) mContainer).sievert, 8, 50, BW_Util.getColorFromArray(new short[]{((GT_Container_RadioHatch) mContainer).r, ((GT_Container_RadioHatch) mContainer).g, ((GT_Container_RadioHatch) mContainer).b})); -// this.fontRendererObj.drawString("Kg: " + ((GT_Container_RadioHatch) mContainer).mass, 8, 68, BW_Util.getColorFromArray(new short[]{((GT_Container_RadioHatch) mContainer).r, ((GT_Container_RadioHatch) mContainer).g, ((GT_Container_RadioHatch) mContainer).b})); -// this.fontRendererObj.drawString("Time: " + timer, 8, 76, BW_Util.getColorFromArray(new short[]{((GT_Container_RadioHatch) mContainer).r, ((GT_Container_RadioHatch) mContainer).g, ((GT_Container_RadioHatch) mContainer).b})); +// this.fontRendererObj.drawString("Sv: " + ((GT_Container_RadioHatch) mContainer).sievert, 8, 50, BW_Util.getColorFromRGBArray(new short[]{((GT_Container_RadioHatch) mContainer).r, ((GT_Container_RadioHatch) mContainer).g, ((GT_Container_RadioHatch) mContainer).b})); +// this.fontRendererObj.drawString("Kg: " + ((GT_Container_RadioHatch) mContainer).mass, 8, 68, BW_Util.getColorFromRGBArray(new short[]{((GT_Container_RadioHatch) mContainer).r, ((GT_Container_RadioHatch) mContainer).g, ((GT_Container_RadioHatch) mContainer).b})); +// this.fontRendererObj.drawString("Time: " + timer, 8, 76, BW_Util.getColorFromRGBArray(new short[]{((GT_Container_RadioHatch) mContainer).r, ((GT_Container_RadioHatch) mContainer).g, ((GT_Container_RadioHatch) mContainer).b})); } diff --git a/src/main/java/com/github/bartimaeusnek/bartworks/common/items/BW_ItemBlocks.java b/src/main/java/com/github/bartimaeusnek/bartworks/common/items/BW_ItemBlocks.java index ea0457dcc6..86ea3198eb 100644 --- a/src/main/java/com/github/bartimaeusnek/bartworks/common/items/BW_ItemBlocks.java +++ b/src/main/java/com/github/bartimaeusnek/bartworks/common/items/BW_ItemBlocks.java @@ -25,6 +25,7 @@ package com.github.bartimaeusnek.bartworks.common.items; import com.github.bartimaeusnek.bartworks.API.ITileAddsInformation; import com.github.bartimaeusnek.bartworks.MainMod; import com.github.bartimaeusnek.bartworks.common.blocks.BW_GlasBlocks; +import com.github.bartimaeusnek.bartworks.util.BW_ColorUtil; import com.github.bartimaeusnek.bartworks.util.BW_Util; import com.github.bartimaeusnek.bartworks.util.ChatColorHelper; import cpw.mods.fml.relauncher.Side; @@ -67,7 +68,7 @@ public class BW_ItemBlocks extends ItemBlock { @SideOnly(Side.CLIENT) public void addInformation(final ItemStack aStack, final EntityPlayer aPlayer, final List aList, final boolean aF3_H) { if (this.field_150939_a instanceof BW_GlasBlocks) - aList.add(StatCollector.translateToLocal("tooltip.glas.0.name") + " " + BW_Util.getColorForTier(BW_Util.getTierFromGlasMeta(aStack.getItemDamage())) + GT_Values.VN[BW_Util.getTierFromGlasMeta(aStack.getItemDamage())]); + aList.add(StatCollector.translateToLocal("tooltip.glas.0.name") + " " + BW_ColorUtil.getColorForTier(BW_Util.getTierFromGlasMeta(aStack.getItemDamage())) + GT_Values.VN[BW_Util.getTierFromGlasMeta(aStack.getItemDamage())]); if (this.field_150939_a instanceof ITileAddsInformation) { for (int i = 0; i < ((ITileAddsInformation) this.field_150939_a).getInfoData().length; i++) { aList.add(((ITileAddsInformation) this.field_150939_a).getInfoData()[i]); diff --git a/src/main/java/com/github/bartimaeusnek/bartworks/common/items/LabParts.java b/src/main/java/com/github/bartimaeusnek/bartworks/common/items/LabParts.java index c04a449103..5aeed95774 100644 --- a/src/main/java/com/github/bartimaeusnek/bartworks/common/items/LabParts.java +++ b/src/main/java/com/github/bartimaeusnek/bartworks/common/items/LabParts.java @@ -23,6 +23,7 @@ package com.github.bartimaeusnek.bartworks.common.items; import com.github.bartimaeusnek.bartworks.MainMod; +import com.github.bartimaeusnek.bartworks.util.BW_ColorUtil; import com.github.bartimaeusnek.bartworks.util.BW_Util; import cpw.mods.fml.relauncher.Side; import cpw.mods.fml.relauncher.SideOnly; @@ -66,7 +67,7 @@ public class LabParts extends SimpleSubItemClass { public int getColorFromItemStack(ItemStack stack, int p_82790_2_) { if (stack.getItemDamage() == 0 && stack.getTagCompound() != null && stack.getTagCompound().getIntArray("Color") != null && stack.getTagCompound().getIntArray("Color").length > 0) { int[] rgb = stack.getTagCompound().getIntArray("Color"); - return BW_Util.getColorFromArray(rgb); + return BW_ColorUtil.getColorFromRGBArray(rgb); } return super.getColorFromItemStack(stack, p_82790_2_); } diff --git a/src/main/java/com/github/bartimaeusnek/bartworks/common/loaders/FluidLoader.java b/src/main/java/com/github/bartimaeusnek/bartworks/common/loaders/FluidLoader.java index f4fc82a7db..1b56e588c5 100644 --- a/src/main/java/com/github/bartimaeusnek/bartworks/common/loaders/FluidLoader.java +++ b/src/main/java/com/github/bartimaeusnek/bartworks/common/loaders/FluidLoader.java @@ -69,7 +69,7 @@ public class FluidLoader implements Runnable { BioLabFluidCells[i] = ItemFluidCell.getUniversalFluidCell(new FluidStack(BioLabFluidMaterials[i], 1000)); } -// BioCulture.BIO_CULTURE_ARRAY_LIST.get(0).setFluid(new GT_Fluid("_NULL", "molten.autogenerated", BW_Util.splitColortoArray(BioCulture.BIO_CULTURE_ARRAY_LIST.get(0).getColorRGB()))); +// BioCulture.BIO_CULTURE_ARRAY_LIST.get(0).setFluid(new GT_Fluid("_NULL", "molten.autogenerated", BW_Util.splitColorToRBGArray(BioCulture.BIO_CULTURE_ARRAY_LIST.get(0).getColorRGB()))); for (BioCulture B : BioCulture.BIO_CULTURE_ARRAY_LIST) { if (B.isBreedable()) { diff --git a/src/main/java/com/github/bartimaeusnek/bartworks/common/loaders/ItemRegistry.java b/src/main/java/com/github/bartimaeusnek/bartworks/common/loaders/ItemRegistry.java index a12e787ada..20911d4361 100644 --- a/src/main/java/com/github/bartimaeusnek/bartworks/common/loaders/ItemRegistry.java +++ b/src/main/java/com/github/bartimaeusnek/bartworks/common/loaders/ItemRegistry.java @@ -38,6 +38,7 @@ import com.github.bartimaeusnek.bartworks.common.tileentities.multis.mega.GT_Til import com.github.bartimaeusnek.bartworks.common.tileentities.tiered.GT_MetaTileEntity_AcidGenerator; import com.github.bartimaeusnek.bartworks.common.tileentities.tiered.GT_MetaTileEntity_Diode; import com.github.bartimaeusnek.bartworks.common.tileentities.tiered.GT_MetaTileEntity_EnergyDistributor; +import com.github.bartimaeusnek.bartworks.system.material.WerkstoffLoader; import cpw.mods.fml.common.registry.GameRegistry; import gregtech.api.enums.GT_Values; import gregtech.api.enums.Materials; @@ -91,8 +92,9 @@ public class ItemRegistry { MainMod.MOD_ID + ":ColoredBoronSilicateGlassBlock4", MainMod.MOD_ID + ":ColoredBoronSilicateGlassBlock5", MainMod.MOD_ID + ":ColoredBoronSilicateGlassBlock6", + MainMod.MOD_ID + ":ThoriumYttriumGlass", }, - new short[][]{Materials.BorosilicateGlass.getRGBA(), Materials.Nickel.getRGBA(), Materials.Tungsten.getRGBA(), Materials.Chrome.getRGBA(), Materials.Iridium.getRGBA(), Materials.Osmium.getRGBA(), new short[]{0xff, 0, 0}, new short[]{0, 0xff, 0}, new short[]{0x80, 0, 0xff}, new short[]{0xff, 0xff, 0}, new short[]{0, 0xff, 0x80}, new short[]{0x80, 0x33, 0}}, + new short[][]{Materials.BorosilicateGlass.getRGBA(), Materials.Nickel.getRGBA(), Materials.Tungsten.getRGBA(), Materials.Chrome.getRGBA(), Materials.Iridium.getRGBA(), Materials.Osmium.getRGBA(), new short[]{0xff, 0, 0}, new short[]{0, 0xff, 0}, new short[]{0x80, 0, 0xff}, new short[]{0xff, 0xff, 0}, new short[]{0, 0xff, 0x80}, new short[]{0x80, 0x33, 0}, WerkstoffLoader.YttriumOxide.getRGBA()}, MainMod.BIO_TAB, true, false ) diff --git a/src/main/java/com/github/bartimaeusnek/bartworks/common/net/RendererPacket.java b/src/main/java/com/github/bartimaeusnek/bartworks/common/net/RendererPacket.java index 71aa50c824..a5f5f4089f 100644 --- a/src/main/java/com/github/bartimaeusnek/bartworks/common/net/RendererPacket.java +++ b/src/main/java/com/github/bartimaeusnek/bartworks/common/net/RendererPacket.java @@ -24,7 +24,7 @@ package com.github.bartimaeusnek.bartworks.common.net; import com.github.bartimaeusnek.bartworks.MainMod; import com.github.bartimaeusnek.bartworks.common.tileentities.multis.GT_TileEntity_BioVat; -import com.github.bartimaeusnek.bartworks.util.BW_Util; +import com.github.bartimaeusnek.bartworks.util.BW_ColorUtil; import com.github.bartimaeusnek.bartworks.util.Coords; import com.google.common.io.ByteArrayDataInput; import cpw.mods.fml.common.FMLCommonHandler; @@ -73,7 +73,7 @@ public class RendererPacket extends GT_Packet { // public void decodetest (byte[] buffer){ // this.coords=new Coords(ByteBuffer.wrap(buffer).getInt(0),ByteBuffer.wrap(buffer).getShort(4),ByteBuffer.wrap(buffer).getInt(6),ByteBuffer.wrap(buffer).getInt(10)); // int[] rgb = {ByteBuffer.wrap(buffer).get(14)-Byte.MIN_VALUE, ByteBuffer.wrap(buffer).get(15)-Byte.MIN_VALUE, ByteBuffer.wrap(buffer).get(16)-Byte.MIN_VALUE}; -// this.integer= BW_Util.getColorFromArray(rgb); +// this.integer= BW_Util.getColorFromRGBArray(rgb); // this.removal=ByteBuffer.wrap(buffer).get(17); // // byte checksum = (byte) (coords.x%25+coords.y%25+coords.z%25+coords.wID%25+integer%25+removal); @@ -87,7 +87,7 @@ public class RendererPacket extends GT_Packet { this.coords = new Coords(ByteBuffer.wrap(buffer).getInt(0), ByteBuffer.wrap(buffer).getShort(4), ByteBuffer.wrap(buffer).getInt(6), ByteBuffer.wrap(buffer).getInt(10)); int[] rgb = {ByteBuffer.wrap(buffer).get(14) - Byte.MIN_VALUE, ByteBuffer.wrap(buffer).get(15) - Byte.MIN_VALUE, ByteBuffer.wrap(buffer).get(16) - Byte.MIN_VALUE}; - this.integer = BW_Util.getColorFromArray(rgb); + this.integer = BW_ColorUtil.getColorFromRGBArray(rgb); this.removal = ByteBuffer.wrap(buffer).get(17); byte checksum = (byte) (coords.x % 25 + coords.y % 25 + coords.z % 25 + coords.wID % 25 + integer % 25 + removal); diff --git a/src/main/java/com/github/bartimaeusnek/bartworks/common/tileentities/multis/GT_TileEntity_BioVat.java b/src/main/java/com/github/bartimaeusnek/bartworks/common/tileentities/multis/GT_TileEntity_BioVat.java index 7042fba1b8..76625e06bc 100644 --- a/src/main/java/com/github/bartimaeusnek/bartworks/common/tileentities/multis/GT_TileEntity_BioVat.java +++ b/src/main/java/com/github/bartimaeusnek/bartworks/common/tileentities/multis/GT_TileEntity_BioVat.java @@ -336,7 +336,7 @@ public class GT_TileEntity_BioVat extends GT_MetaTileEntity_MultiBlockBase { private byte calculateGlassTier(@Nonnull Block block, @Nonnegative Byte meta) { if (block.equals(ItemRegistry.bw_glasses[0])) - return meta > 1 && meta < 6 ? (byte) (meta + 3) : 4; + return meta == 12 ? 5 : meta > 1 && meta < 6 ? (byte) (meta + 3) : 4; if (block.getUnlocalizedName().equals("blockAlloyGlass")) return 4; diff --git a/src/main/java/com/github/bartimaeusnek/bartworks/common/tileentities/tiered/GT_MetaTileEntity_RadioHatch.java b/src/main/java/com/github/bartimaeusnek/bartworks/common/tileentities/tiered/GT_MetaTileEntity_RadioHatch.java index 479681d492..63ba6660a1 100644 --- a/src/main/java/com/github/bartimaeusnek/bartworks/common/tileentities/tiered/GT_MetaTileEntity_RadioHatch.java +++ b/src/main/java/com/github/bartimaeusnek/bartworks/common/tileentities/tiered/GT_MetaTileEntity_RadioHatch.java @@ -26,7 +26,7 @@ import com.github.bartimaeusnek.bartworks.API.BioVatLogicAdder; import com.github.bartimaeusnek.bartworks.MainMod; import com.github.bartimaeusnek.bartworks.client.gui.GT_GUIContainer_RadioHatch; import com.github.bartimaeusnek.bartworks.server.container.GT_Container_RadioHatch; -import com.github.bartimaeusnek.bartworks.util.BW_Util; +import com.github.bartimaeusnek.bartworks.util.BW_ColorUtil; import com.github.bartimaeusnek.bartworks.util.ChatColorHelper; import gregtech.api.enums.ItemList; import gregtech.api.enums.Materials; @@ -295,7 +295,7 @@ public class GT_MetaTileEntity_RadioHatch extends GT_MetaTileEntity_Hatch { aNBT.setByte("mMass", mass); aNBT.setByte("mSv", (byte) (sievert - 100)); aNBT.setByte("mCoverage", coverage); - aNBT.setInteger("mTextColor", BW_Util.getColorFromArray(getColorForGUI())); + aNBT.setInteger("mTextColor", BW_ColorUtil.getColorFromRGBArray(getColorForGUI())); if (material != null && !material.isEmpty()) aNBT.setString("mMaterial", material); aNBT.setLong("timer", timer); @@ -312,7 +312,7 @@ public class GT_MetaTileEntity_RadioHatch extends GT_MetaTileEntity_Hatch { mass = aNBT.getByte("mMass"); sievert = aNBT.getByte("mSv") + 100; coverage = aNBT.getByte("mCoverage"); - colorForGUI = BW_Util.splitColortoArray(aNBT.getInteger("mTextColor")); + colorForGUI = BW_ColorUtil.splitColorToRBGArray(aNBT.getInteger("mTextColor")); material = aNBT.getString("mMaterial"); super.loadNBTData(aNBT); } diff --git a/src/main/java/com/github/bartimaeusnek/bartworks/neiHandler/BW_NEI_OreHandler.java b/src/main/java/com/github/bartimaeusnek/bartworks/neiHandler/BW_NEI_OreHandler.java index 38104bf7f2..5360268200 100644 --- a/src/main/java/com/github/bartimaeusnek/bartworks/neiHandler/BW_NEI_OreHandler.java +++ b/src/main/java/com/github/bartimaeusnek/bartworks/neiHandler/BW_NEI_OreHandler.java @@ -31,13 +31,16 @@ import com.github.bartimaeusnek.bartworks.system.material.BW_MetaGenerated_Ores; import com.github.bartimaeusnek.bartworks.system.material.Werkstoff; import com.github.bartimaeusnek.bartworks.system.material.WerkstoffLoader; import com.github.bartimaeusnek.bartworks.util.ChatColorHelper; +import com.github.bartimaeusnek.crossmod.galacticraft.planets.ross128.world.oregen.BW_OreLayer; import com.github.bartimaeusnek.crossmod.galacticraft.planets.ross128.world.oregen.BW_WorldGenRoss128; import cpw.mods.fml.common.event.FMLInterModComms; import gregtech.api.GregTech_API; -import gregtech.common.GT_Worldgen_GT_Ore_Layer; +import gregtech.api.enums.OrePrefixes; +import gregtech.api.util.GT_Utility; import net.minecraft.block.Block; import net.minecraft.item.ItemStack; +import java.awt.*; import java.util.ArrayList; import java.util.List; @@ -58,15 +61,23 @@ public class BW_NEI_OreHandler extends TemplateRecipeHandler { @Override public void loadTransferRects() { -// transferRects.add(new RecipeTransferRect(new Rectangle(0,40,40,10),"quickanddirtyneihandler")); + transferRects.add(new RecipeTransferRect(new Rectangle(0,40,40,10),"quickanddirtyneihandler")); + } + + @Override + public int recipiesPerPage() { + return 1; } @Override public void loadCraftingRecipes(String outputId, Object... results) { if (outputId.equalsIgnoreCase("quickanddirtyneihandler")) { for (int i = 0; i < Werkstoff.werkstoffHashMap.values().size(); i++) { - ItemStack result = new ItemStack(WerkstoffLoader.BWOres, 1, i); - if (Block.getBlockFromItem(result.getItem()) instanceof BW_MetaGenerated_Ores) { + Werkstoff w = Werkstoff.werkstoffHashMap.get((short)i); + if (w == null || w == Werkstoff.default_null_Werkstoff) + continue; + if (w.getGenerationFeatures().hasOres()) { + ItemStack result = w.get(OrePrefixes.ore); CachedRecipe tmp = new CachedRecipe() { PositionedStack stack = new PositionedStack(result, 0, 0); @@ -79,10 +90,10 @@ public class BW_NEI_OreHandler extends TemplateRecipeHandler { @Override public List<PositionedStack> getOtherStacks() { ArrayList<PositionedStack> ret = new ArrayList<>(); - for (int i = 0; i < GT_Worldgen_GT_Ore_Layer.sList.size(); i++) { - if (BW_WorldGenRoss128.sList.get(i) instanceof BW_WorldGenRoss128) { + for (int i = 0; i < BW_OreLayer.sList.size(); i++) { + if (BW_OreLayer.sList.get(i) instanceof BW_WorldGenRoss128) { int baseMeta = result.getItemDamage(); - BW_WorldGenRoss128 worldGen = ((BW_WorldGenRoss128) BW_WorldGenRoss128.sList.get(i)); + BW_WorldGenRoss128 worldGen = ((BW_WorldGenRoss128) BW_OreLayer.sList.get(i)); if (worldGen.mPrimaryMeta == baseMeta || worldGen.mSecondaryMeta == baseMeta || worldGen.mBetweenMeta == baseMeta || worldGen.mSporadicMeta == baseMeta) { ItemStack other; other = result.copy().setStackDisplayName(result.getDisplayName().replaceAll("Ore", "Vein")); @@ -130,7 +141,15 @@ public class BW_NEI_OreHandler extends TemplateRecipeHandler { return ret; } }; - this.arecipes.add(tmp); + boolean add = true; + for (TemplateRecipeHandler.CachedRecipe recipe: arecipes) { + if (recipe == null || recipe.getOtherStacks() == null || recipe.getOtherStacks().get(0) == null || recipe.getOtherStacks().get(0).item == null) + continue; + if (GT_Utility.areStacksEqual(recipe.getOtherStacks().get(0).item,tmp.getOtherStacks().get(0).item)) + add = false; + } + if (add) + this.arecipes.add(tmp); } } } else super.loadCraftingRecipes(outputId, results); @@ -138,7 +157,7 @@ public class BW_NEI_OreHandler extends TemplateRecipeHandler { @Override public void drawExtras(int recipe) { - + if ((recipe < this.arecipes.size()) && (this.arecipes.get(recipe).getOtherStacks().size() >= 4) ) { GuiDraw.drawString(ChatColorHelper.BOLD + "DIM:" + ChatColorHelper.RESET + " Ross128", 0, 40, 0, false); GuiDraw.drawString(ChatColorHelper.BOLD + "Primary:", 0, 50, 0, false); GuiDraw.drawString(this.arecipes.get(recipe).getOtherStacks().get(0).item.getDisplayName(), 0, 60, 0, false); @@ -148,6 +167,7 @@ public class BW_NEI_OreHandler extends TemplateRecipeHandler { GuiDraw.drawString(this.arecipes.get(recipe).getOtherStacks().get(2).item.getDisplayName(), 0, 100, 0, false); GuiDraw.drawString(ChatColorHelper.BOLD + "Sporadic:", 0, 110, 0, false); GuiDraw.drawString(this.arecipes.get(recipe).getOtherStacks().get(3).item.getDisplayName(), 0, 120, 0, false); + } super.drawExtras(recipe); } @@ -166,10 +186,10 @@ public class BW_NEI_OreHandler extends TemplateRecipeHandler { @Override public List<PositionedStack> getOtherStacks() { ArrayList<PositionedStack> ret = new ArrayList<>(); - for (int i = 0; i < GT_Worldgen_GT_Ore_Layer.sList.size(); i++) { - if (BW_WorldGenRoss128.sList.get(i) instanceof BW_WorldGenRoss128) { + for (int i = 0; i < BW_OreLayer.sList.size(); i++) { + if (BW_OreLayer.sList.get(i) instanceof BW_WorldGenRoss128) { int baseMeta = result.getItemDamage(); - BW_WorldGenRoss128 worldGen = ((BW_WorldGenRoss128) BW_WorldGenRoss128.sList.get(i)); + BW_WorldGenRoss128 worldGen = ((BW_WorldGenRoss128) BW_OreLayer.sList.get(i)); if (worldGen.mPrimaryMeta == baseMeta || worldGen.mSecondaryMeta == baseMeta || worldGen.mBetweenMeta == baseMeta || worldGen.mSporadicMeta == baseMeta) { ItemStack other; other = result.copy().setStackDisplayName(result.getDisplayName().replaceAll("Ore", "Vein")); @@ -228,6 +248,6 @@ public class BW_NEI_OreHandler extends TemplateRecipeHandler { @Override public String getRecipeName() { - return "OreShit"; + return "BartWorks Ores"; } } diff --git a/src/main/java/com/github/bartimaeusnek/bartworks/system/material/BW_MetaGenerated_Items.java b/src/main/java/com/github/bartimaeusnek/bartworks/system/material/BW_MetaGenerated_Items.java index cbdfd9f2d4..72db71e58d 100644 --- a/src/main/java/com/github/bartimaeusnek/bartworks/system/material/BW_MetaGenerated_Items.java +++ b/src/main/java/com/github/bartimaeusnek/bartworks/system/material/BW_MetaGenerated_Items.java @@ -23,6 +23,7 @@ package com.github.bartimaeusnek.bartworks.system.material; import com.github.bartimaeusnek.bartworks.util.ChatColorHelper; +import cpw.mods.fml.common.Loader; import cpw.mods.fml.relauncher.Side; import cpw.mods.fml.relauncher.SideOnly; import gregtech.api.enums.Materials; @@ -41,6 +42,7 @@ import net.minecraft.item.ItemStack; import net.minecraft.util.IIcon; import net.minecraft.util.MathHelper; import net.minecraft.util.StatCollector; +import net.minecraftforge.oredict.OreDictionary; import java.util.List; @@ -65,11 +67,11 @@ public class BW_MetaGenerated_Items extends GT_MetaGenerated_Item { for (int i = 0; i < aNumToGen; i++) { ItemStack tStack = new ItemStack(this, 1, i); Werkstoff w = werkstoffHashMap.get((short) i); - if (w == null || ((w.getGenerationFeatures().toGenerate & orePrefixes.mMaterialGenerationBits) == 0)) + if (w == null || ((w.getGenerationFeatures().toGenerate & orePrefixes.mMaterialGenerationBits) == 0) || ((w.getGenerationFeatures().blacklist & orePrefixes.mMaterialGenerationBits) != 0) ) continue; GT_LanguageManager.addStringLocalization(this.getUnlocalizedName(tStack) + ".name", this.getDefaultLocalization(w)); GT_LanguageManager.addStringLocalization(this.getUnlocalizedName(tStack) + ".tooltip", w.getToolTip()); - GT_OreDictUnificator.registerOre(this.orePrefixes.name() + w.getDefaultName(), tStack); + GT_OreDictUnificator.registerOre(this.orePrefixes.name() + w.getDefaultName().replaceAll(" ",""), tStack); } } @@ -133,7 +135,7 @@ public class BW_MetaGenerated_Items extends GT_MetaGenerated_Item { public final void getSubItems(Item var1, CreativeTabs aCreativeTab, List aList) { for (int i = 0; i < aNumToGen; i++) { Werkstoff werkstoff = werkstoffHashMap.get((short) i); - if (werkstoff != null && ((werkstoff.getGenerationFeatures().toGenerate & orePrefixes.mMaterialGenerationBits) != 0)) { + if (werkstoff != null && ((werkstoff.getGenerationFeatures().toGenerate & orePrefixes.mMaterialGenerationBits) != 0) && ((werkstoff.getGenerationFeatures().blacklist & orePrefixes.mMaterialGenerationBits) == 0)) { ItemStack tStack = new ItemStack(this, 1, i); aList.add(tStack); } diff --git a/src/main/java/com/github/bartimaeusnek/bartworks/system/material/BW_MetaGenerated_Ores.java b/src/main/java/com/github/bartimaeusnek/bartworks/system/material/BW_MetaGenerated_Ores.java index 088f4040fc..862de3cd98 100644 --- a/src/main/java/com/github/bartimaeusnek/bartworks/system/material/BW_MetaGenerated_Ores.java +++ b/src/main/java/com/github/bartimaeusnek/bartworks/system/material/BW_MetaGenerated_Ores.java @@ -58,11 +58,10 @@ public class BW_MetaGenerated_Ores extends BW_TileEntityContainer { this.setCreativeTab(metaTab); for (Werkstoff w : Werkstoff.werkstoffHashSet) { if (w != null) { - if ((w.getGenerationFeatures().toGenerate & 0b1000) == 0) + if ((w.getGenerationFeatures().toGenerate & 0b1000) == 0 || ((w.getGenerationFeatures().blacklist & 0b1000) != 0)) continue; GT_ModHandler.addValuableOre(this, w.getmID(), 1); GT_LanguageManager.addStringLocalization(getUnlocalizedName() + "." + w.getmID() + ".name", w.getDefaultName() + OrePrefixes.ore.mLocalizedMaterialPost); - GT_OreDictUnificator.registerOre(OrePrefixes.ore + w.getDefaultName(), new ItemStack(this, 1, w.getmID())); } } } @@ -160,7 +159,7 @@ public class BW_MetaGenerated_Ores extends BW_TileEntityContainer { public void getSubBlocks(Item aItem, CreativeTabs aTab, List aList) { for (int i = 0; i < Werkstoff.werkstoffHashSet.size(); i++) { Werkstoff tMaterial = Werkstoff.werkstoffHashMap.get((short) i); - if ((tMaterial != null) && ((tMaterial.getGenerationFeatures().toGenerate & 0x8) != 0)) { + if ((tMaterial != null) && ((tMaterial.getGenerationFeatures().toGenerate & 0x8) != 0) && ((tMaterial.getGenerationFeatures().blacklist & 0x8) == 0)) { aList.add(new ItemStack(aItem, 1, i)); } } |
