diff options
author | bartimaeusnek <33183715+bartimaeusnek@users.noreply.github.com> | 2019-04-09 09:10:21 +0200 |
---|---|---|
committer | bartimaeusnek <33183715+bartimaeusnek@users.noreply.github.com> | 2019-04-09 09:10:21 +0200 |
commit | 267a494c3931c31bdcc5a3d11b743cc63e364750 (patch) | |
tree | 705bfbfc1b449a89e91bc787ad8e3ab656a0e1fe /src/main | |
parent | 913a24fa383a5beaad83f0a8f5eb04ea55385d62 (diff) | |
download | GT5-Unofficial-267a494c3931c31bdcc5a3d11b743cc63e364750.tar.gz GT5-Unofficial-267a494c3931c31bdcc5a3d11b743cc63e364750.tar.bz2 GT5-Unofficial-267a494c3931c31bdcc5a3d11b743cc63e364750.zip |
Ore Dict Support
+Added Y/Th Glas
+Added OreDict support for all Materials
+Added an Internal Handler for Colors
+Added Materials and improved Compability to GT and GT++
+Improved Code Quality of the BW Oregen Handler
+Fixed NEI handler
+Version increase
Signed-off-by: bartimaeusnek <33183715+bartimaeusnek@users.noreply.github.com>
Former-commit-id: 5b189e2b4257f523efb5313038a2c25c0ea5d424
Diffstat (limited to 'src/main')
24 files changed, 1047 insertions, 292 deletions
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)); } } diff --git a/src/main/java/com/github/bartimaeusnek/bartworks/system/material/OreDictHandler.java b/src/main/java/com/github/bartimaeusnek/bartworks/system/material/OreDictHandler.java new file mode 100644 index 0000000000..0715d00a90 --- /dev/null +++ b/src/main/java/com/github/bartimaeusnek/bartworks/system/material/OreDictHandler.java @@ -0,0 +1,52 @@ +/* + * Copyright (c) 2019 bartimaeusnek + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to deal + * in the Software without restriction, including without limitation the rights + * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in all + * copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + * SOFTWARE. + */ + +package com.github.bartimaeusnek.bartworks.system.material; + +import gregtech.api.enums.OrePrefixes; +import net.minecraft.item.ItemStack; +import net.minecraftforge.oredict.OreDictionary; + +import java.util.HashMap; + +public class OreDictHandler { + + private static final HashMap<String,ItemStack> cache = new HashMap<>(); + + public static HashMap<String, ItemStack> getCache() { + return OreDictHandler.cache; + } + + public static ItemStack getItemStack(String elementName, OrePrefixes prefixes, int amount){ + if (cache.get(prefixes+elementName.replaceAll(" ","")) != null){ + ItemStack tmp = cache.get(prefixes+elementName.replaceAll(" ","")).copy(); + tmp.stackSize=amount; + return tmp; + } else if (!OreDictionary.getOres(prefixes+elementName.replaceAll(" ","")).isEmpty()){ + ItemStack tmp = OreDictionary.getOres(prefixes+elementName.replaceAll(" ","")).get(0).copy(); + tmp.stackSize=amount; + cache.put(prefixes+elementName.replaceAll(" ",""),tmp); + return tmp; + } + return null; + } +} diff --git a/src/main/java/com/github/bartimaeusnek/bartworks/system/material/Werkstoff.java b/src/main/java/com/github/bartimaeusnek/bartworks/system/material/Werkstoff.java index 65ab699c57..3ade8d123d 100644 --- a/src/main/java/com/github/bartimaeusnek/bartworks/system/material/Werkstoff.java +++ b/src/main/java/com/github/bartimaeusnek/bartworks/system/material/Werkstoff.java @@ -22,6 +22,8 @@ package com.github.bartimaeusnek.bartworks.system.material; +import com.github.bartimaeusnek.bartworks.util.BW_ColorUtil; +import com.github.bartimaeusnek.bartworks.util.BW_Util; import com.github.bartimaeusnek.bartworks.util.MurmurHash3; import com.github.bartimaeusnek.bartworks.util.Pair; import gregtech.api.enums.Materials; @@ -65,12 +67,14 @@ public class Werkstoff implements IColorModulationContainer, ISubTagContainer { default_null_Werkstoff = new Werkstoff(new short[3], "_NULL", "Default null Werkstoff", DEFAULT_NULL_STATS, Werkstoff.Types.UNDEFINED, DEFAULT_NULL_GENERATION_FEATURES, -1, TextureSet.SET_NONE); } - + public Werkstoff(short[] rgba, String defaultName, Werkstoff.Types type, GenerationFeatures generationFeatures, int mID, TextureSet texSet, Pair<ISubTagContainer, Integer>... contents) { + this(rgba, defaultName, Werkstoff.Types.getDefaultStatForType(type), type, generationFeatures, mID, texSet, contents); + } public Werkstoff(short[] rgba, String defaultName, Werkstoff.Types type, GenerationFeatures generationFeatures, int mID, TextureSet texSet, List<ISubTagContainer> oreByProduct, Pair<ISubTagContainer, Integer>... contents) { - this(rgba, defaultName, Types.getDefaultStatForType(type), type, generationFeatures, mID, texSet, oreByProduct, contents); + this(rgba, defaultName, Werkstoff.Types.getDefaultStatForType(type), type, generationFeatures, mID, texSet, oreByProduct, contents); } public Werkstoff(short[] rgba, String toolTip, String defaultName, Werkstoff.Types type, GenerationFeatures generationFeatures, int mID, TextureSet texSet, List<ISubTagContainer> oreByProduct, Pair<ISubTagContainer, Integer>... contents) { - this(rgba, toolTip, defaultName, Types.getDefaultStatForType(type), type, generationFeatures, mID, texSet, oreByProduct, contents); + this(rgba, toolTip, defaultName, Werkstoff.Types.getDefaultStatForType(type), type, generationFeatures, mID, texSet, oreByProduct, contents); } public Werkstoff(short[] rgba, String defaultName, Werkstoff.Stats stats, Werkstoff.Types type, GenerationFeatures generationFeatures, int mID, TextureSet texSet, List<ISubTagContainer> oreByProduct, Pair<ISubTagContainer, Integer>... contents) { @@ -100,7 +104,7 @@ public class Werkstoff implements IColorModulationContainer, ISubTagContainer { this.type = type; this.mID = (short) mID; this.generationFeatures = generationFeatures; - this.setRgb(rgba); + this.setRgb(BW_ColorUtil.correctCorlorArray(rgba)); this.contents.addAll(Arrays.asList(contents)); this.toolTip = ""; if (toolTip.isEmpty()) { @@ -138,6 +142,12 @@ public class Werkstoff implements IColorModulationContainer, ISubTagContainer { werkstoffHashMap.put(this.mID, this); } + + + public Werkstoff.Types getType() { + return this.type; + } + public Pair<Integer, LinkedHashSet<Pair<ISubTagContainer, Integer>>> getContents() { int ret = 0; switch (this.type) { @@ -159,16 +169,29 @@ public class Werkstoff implements IColorModulationContainer, ISubTagContainer { return mOreByProducts.size(); } - public ItemStack getOreByProduct(int aNumber, OrePrefixes prefixes) { + public ISubTagContainer getOreByProductRaw(int aNumber){ if (mOreByProducts.size() == 0) return null; if (aNumber < 0) aNumber = mOreByProducts.size() + aNumber; while (aNumber >= mOreByProducts.size()) aNumber--; - Object o = mOreByProducts.get(aNumber); + ISubTagContainer o = mOreByProducts.get(aNumber); if (o == null || o.equals(default_null_Werkstoff) || o.equals(Materials._NULL)) + return this; + return o; + } + + public ItemStack getOreByProduct(int aNumber, OrePrefixes prefixes) { + if (mOreByProducts.size() == 0) return null; + if (aNumber < 0) + aNumber = mOreByProducts.size() + aNumber; + while (aNumber >= mOreByProducts.size()) + aNumber--; + Object o = mOreByProducts.get(aNumber); + if (o == null||o.equals(default_null_Werkstoff) || o.equals(Materials._NULL)) + return this.get(prefixes); if (o instanceof Werkstoff) return WerkstoffLoader.getCorresopndingItemStack(prefixes, (Werkstoff) o); if (o instanceof Materials) @@ -239,9 +262,9 @@ public class Werkstoff implements IColorModulationContainer, ISubTagContainer { } public enum Types { - MATERIAL, COMPOUND, MIXTURE, BIOLOGICAL, UNDEFINED; + MATERIAL, COMPOUND, MIXTURE, BIOLOGICAL, ELEMENT, UNDEFINED; - public static Stats getDefaultStatForType(Types T) { + public static Stats getDefaultStatForType(Werkstoff.Types T) { switch (T) { case COMPOUND: case BIOLOGICAL: @@ -263,9 +286,63 @@ public class Werkstoff implements IColorModulationContainer, ISubTagContainer { ore 1000 */ public byte toGenerate = 0b0001001; + public byte blacklist = 0b0000000; + public GenerationFeatures setBlacklist(OrePrefixes p){ + if (p == OrePrefixes.dustTiny || p == OrePrefixes.dust || p == OrePrefixes.dustSmall || p == OrePrefixes.crateGtDust){ + blacklist |= 1; + }else + blacklist |= p.mMaterialGenerationBits; + return this; + } + + public boolean hasDusts() { + return (toGenerate & 0b1) != 0; + } public boolean hasGems() { - return (toGenerate & 4) != 0; + return (toGenerate & 0b100) != 0; + } + public boolean hasOres() { + return (toGenerate & 0b1000) != 0; + } + + public GenerationFeatures removeGems(){ + if (hasGems()) + toGenerate = (byte) (toGenerate ^ 0b100); + return this; + } + + public GenerationFeatures removeDusts(){ + if (hasDusts()) + toGenerate = (byte) (toGenerate ^ 0b1); + return this; + } + public GenerationFeatures removeOres(){ + if (hasOres()) + toGenerate = (byte) (toGenerate ^ 0b1000); + return this; + } + /* + * Auto add Chemical Recipes 1 + * Auto add mixer Recipes 10 + * Auto add Sifter Recipe 100 + */ + public byte extraRecipes = 0b0; + + public GenerationFeatures addChemicalRecipes(){ + this.extraRecipes = (byte) (this.extraRecipes | 1); + return this; + } + public boolean hasChemicalRecipes() { + return (extraRecipes & 1) != 0; + } + + public GenerationFeatures addSifterRecipes(){ + this.extraRecipes = (byte) (this.extraRecipes | 100); + return this; + } + public boolean hasSifterRecipes() { + return (extraRecipes & 100) != 0; } public GenerationFeatures onlyDust() { @@ -273,6 +350,12 @@ public class Werkstoff implements IColorModulationContainer, ISubTagContainer { return this; } + + public GenerationFeatures disable() { + toGenerate = (byte) (0); + return this; + } + public GenerationFeatures addGems() { toGenerate = (byte) (toGenerate | 0x4); return this; diff --git a/src/main/java/com/github/bartimaeusnek/bartworks/system/material/WerkstoffLoader.java b/src/main/java/com/github/bartimaeusnek/bartworks/system/material/WerkstoffLoader.java index 948051eff8..043dfd1f7d 100644 --- a/src/main/java/com/github/bartimaeusnek/bartworks/system/material/WerkstoffLoader.java +++ b/src/main/java/com/github/bartimaeusnek/bartworks/system/material/WerkstoffLoader.java @@ -25,14 +25,22 @@ package com.github.bartimaeusnek.bartworks.system.material; import com.github.bartimaeusnek.bartworks.API.WerkstoffAdderRegistry; import com.github.bartimaeusnek.bartworks.MainMod; import com.github.bartimaeusnek.bartworks.client.renderer.BW_Renderer_Block_Ores; +import com.github.bartimaeusnek.bartworks.system.material.processingLoaders.AdditionalRecipes; +import com.github.bartimaeusnek.bartworks.util.BW_ColorUtil; +import com.github.bartimaeusnek.bartworks.util.BW_Util; import com.github.bartimaeusnek.bartworks.util.Pair; import cpw.mods.fml.client.registry.RenderingRegistry; import cpw.mods.fml.common.FMLCommonHandler; +import cpw.mods.fml.common.Loader; import cpw.mods.fml.common.ProgressManager; import cpw.mods.fml.common.registry.GameRegistry; import gregtech.GT_Mod; +import gregtech.api.GregTech_API; import gregtech.api.enums.*; import gregtech.api.interfaces.ISubTagContainer; +import gregtech.api.objects.GT_MultiTexture; +import gregtech.api.objects.GT_RenderedTexture; +import gregtech.api.objects.MaterialStack; import gregtech.api.util.GT_ModHandler; import gregtech.api.util.GT_OreDictUnificator; import gregtech.api.util.GT_Recipe; @@ -40,11 +48,9 @@ import net.minecraft.block.Block; import net.minecraft.block.material.Material; import net.minecraft.item.ItemStack; import net.minecraftforge.fluids.FluidStack; +import net.minecraftforge.oredict.OreDictionary; -import java.util.ArrayList; -import java.util.Arrays; -import java.util.HashMap; -import java.util.List; +import java.util.*; import static gregtech.api.enums.OrePrefixes.*; @@ -54,6 +60,8 @@ public class WerkstoffLoader implements Runnable { public static final WerkstoffLoader INSTANCE = new WerkstoffLoader(); + //TODO: FREE ID RANGE: 19-32766 + public static final Werkstoff Bismutite = new Werkstoff( new short[]{255, 233, 0, 0}, "Bismutite", @@ -77,9 +85,31 @@ public class WerkstoffLoader implements Runnable { new Pair<ISubTagContainer, Integer>(Materials.Bismuth, 2), new Pair<ISubTagContainer, Integer>(Materials.Sulfur, 3) ); + public static final Werkstoff Zirconium = new Werkstoff( + new short[]{175, 175, 175, 0}, + "Zirconium", + "Zr", + new Werkstoff.Stats().setProtons(40), + Werkstoff.Types.ELEMENT, + new Werkstoff.GenerationFeatures().onlyDust(), + 3, + TextureSet.SET_METALLIC, + Arrays.asList() + ); + public static final Werkstoff Zirconia = new Werkstoff( + new short[]{255, 255, 255, 0}, + "Cubic Zirconia", + Werkstoff.Types.COMPOUND, + new Werkstoff.GenerationFeatures().onlyDust().addGems(), + 4, + TextureSet.SET_DIAMOND, + Arrays.asList(WerkstoffLoader.Zirconium), + new Pair<ISubTagContainer, Integer>(WerkstoffLoader.Zirconium, 1), + new Pair<ISubTagContainer, Integer>(Materials.Oxygen, 2) + ); public static final Werkstoff FluorBuergerit = new Werkstoff( new short[]{0x20, 0x20, 0x20, 0}, - "Fluor-Buergerit", + "Fluor-Buergerite", "NaFe3Al6(Si6O18)(BO3)3O3F", Werkstoff.Types.COMPOUND, new Werkstoff.GenerationFeatures().addGems(), @@ -94,6 +124,16 @@ public class WerkstoffLoader implements Runnable { new Pair<ISubTagContainer, Integer>(Materials.Oxygen, 30), new Pair<ISubTagContainer, Integer>(Materials.Fluorine, 1) ); + public static final Werkstoff YttriumOxide = new Werkstoff( + new short[]{255,255,255,0}, + "Yttrium Oxide", + Werkstoff.Types.COMPOUND, + new Werkstoff.GenerationFeatures().onlyDust(), //No autoadd here to gate this material by hand + 6, + TextureSet.SET_DULL, + new Pair<ISubTagContainer, Integer>(Materials.Yttrium, 2), + new Pair<ISubTagContainer, Integer>(Materials.Oxygen, 3) + ); public static final Werkstoff ChromoAluminoPovondrait = new Werkstoff( new short[]{0, 0x79, 0x6A, 0}, "Chromo-Alumino-Povondraite", @@ -130,8 +170,6 @@ public class WerkstoffLoader implements Runnable { new Pair<ISubTagContainer, Integer>(Materials.Oxygen, 31), new Pair<ISubTagContainer, Integer>(Materials.Hydrogen, 3) ); - - //TODO: FREE ID RANGE: 3,4,6,19-32766 public static final Werkstoff Olenit = new Werkstoff( new short[]{210, 210, 210, 0}, "Olenite", @@ -245,15 +283,169 @@ public class WerkstoffLoader implements Runnable { ); public static final Werkstoff Thorianit = new Werkstoff( new short[]{0x30, 0x30, 0x30, 0}, - "Thorianit", + "Thorianite", Werkstoff.Types.COMPOUND, - new Werkstoff.GenerationFeatures(), + new Werkstoff.GenerationFeatures().addChemicalRecipes(), 18, TextureSet.SET_METALLIC, Arrays.asList(Materials.Thorium), new Pair<ISubTagContainer, Integer>(Materials.Thorium, 1), new Pair<ISubTagContainer, Integer>(Materials.Oxygen, 2) ); + public static final Werkstoff RedZircon = new Werkstoff( + new short[]{195, 19, 19, 0}, + "Red Zircon", + new Werkstoff.Stats().setElektrolysis(true), + Werkstoff.Types.COMPOUND, + new Werkstoff.GenerationFeatures().addGems(), + 19, + TextureSet.SET_GEM_VERTICAL, + Arrays.asList(WerkstoffLoader.Zirconium,Materials.Silicon), + new Pair<ISubTagContainer, Integer>(WerkstoffLoader.Zirconium, 1), + new Pair<ISubTagContainer, Integer>(Materials.Silicon, 1), + new Pair<ISubTagContainer, Integer>(Materials.Oxygen, 4) + ); + + //GT Enhancements + public static final Werkstoff Salt = new Werkstoff( + Materials.Salt.mRGBa, + "Salt", + new Werkstoff.Stats(), + Werkstoff.Types.COMPOUND, + new Werkstoff.GenerationFeatures().disable().addGems().addSifterRecipes(), + 20, + TextureSet.SET_FLINT, + Arrays.asList(Materials.RockSalt,Materials.Borax), + new Pair<ISubTagContainer, Integer>(Materials.Salt, 1) + ); + public static final Werkstoff Spodumen = new Werkstoff( + Materials.Spodumene.mRGBa, + "Spodumene", + new Werkstoff.Stats(), + Werkstoff.Types.COMPOUND, + new Werkstoff.GenerationFeatures().disable().addGems().addSifterRecipes(), + 21, + TextureSet.SET_FLINT, + Arrays.asList(Materials.Spodumene), + new Pair<ISubTagContainer, Integer>(Materials.Spodumene, 1) + ); + public static final Werkstoff RockSalt = new Werkstoff( + Materials.RockSalt.mRGBa, + "Rock Salt", + new Werkstoff.Stats(), + Werkstoff.Types.COMPOUND, + new Werkstoff.GenerationFeatures().disable().addGems().addSifterRecipes(), + 22, + TextureSet.SET_FLINT, + Arrays.asList(Materials.RockSalt,Materials.Borax), + new Pair<ISubTagContainer, Integer>(Materials.RockSalt, 1) + ); + public static final Werkstoff Fayalit = new Werkstoff( + new short[]{50,50,50,0}, + "Fayalite", + new Werkstoff.Stats().setElektrolysis(true), + Werkstoff.Types.COMPOUND, + new Werkstoff.GenerationFeatures().addGems(), + 23, + TextureSet.SET_QUARTZ, + Arrays.asList(Materials.Iron,Materials.Silicon), + new Pair<ISubTagContainer, Integer>(Materials.Iron, 2), + new Pair<ISubTagContainer, Integer>(Materials.Silicon, 1), + new Pair<ISubTagContainer, Integer>(Materials.Oxygen, 4) + ); + public static final Werkstoff Forsterit = new Werkstoff( + new short[]{150,150,150,0}, + "Forsterite", + new Werkstoff.Stats().setElektrolysis(true), + Werkstoff.Types.COMPOUND, + new Werkstoff.GenerationFeatures().addGems(), + 24, + TextureSet.SET_QUARTZ, + Arrays.asList(Materials.Magnesium,Materials.Silicon), + new Pair<ISubTagContainer, Integer>(Materials.Magnesium, 2), + new Pair<ISubTagContainer, Integer>(Materials.Silicon, 1), + new Pair<ISubTagContainer, Integer>(Materials.Oxygen, 4) + ); + public static final Werkstoff Hedenbergit = new Werkstoff( + new short[]{100,150,100,0}, + "Hedenbergite", + new Werkstoff.Stats().setElektrolysis(true), + Werkstoff.Types.COMPOUND, + new Werkstoff.GenerationFeatures().addGems(), + 25, + TextureSet.SET_QUARTZ, + Arrays.asList(Materials.Iron,Materials.Calcium,Materials.Silicon), + new Pair<ISubTagContainer, Integer>(Materials.Calcium, 1), + new Pair<ISubTagContainer, Integer>(Materials.Iron, 1), + new Pair<ISubTagContainer, Integer>(Materials.Silicon, 2), + new Pair<ISubTagContainer, Integer>(Materials.Oxygen, 6) + ); + public static final Werkstoff DescolizitZNVO4 = new Werkstoff( + new short[]{100,60,30,0}, + "Descolizite(ZnVO4)",//Pb(Zn,Cu)[OH|VO4 + new Werkstoff.Stats().setElektrolysis(true), + Werkstoff.Types.COMPOUND, + new Werkstoff.GenerationFeatures(), + 26, + TextureSet.SET_METALLIC, + Arrays.asList(Materials.Lead,Materials.Copper,Materials.Vanadium), + new Pair<ISubTagContainer, Integer>(Materials.Lead, 1), + new Pair<ISubTagContainer, Integer>(Materials.Zinc, 1), + new Pair<ISubTagContainer, Integer>(Materials.Vanadium, 1), + new Pair<ISubTagContainer, Integer>(Materials.Oxygen, 4) + ); + public static final Werkstoff DescolizitCUVO4 = new Werkstoff( + new short[]{100,60,30,0}, + "Descolizite(CuVO4)",//Pb(Zn,Cu)[OH|VO4 + new Werkstoff.Stats().setElektrolysis(true), + Werkstoff.Types.COMPOUND, + new Werkstoff.GenerationFeatures(), + 27, + TextureSet.SET_METALLIC, + Arrays.asList(Materials.Lead,Materials.Zinc,Materials.Vanadium), + new Pair<ISubTagContainer, Integer>(Materials.Lead, 1), + new Pair<ISubTagContainer, Integer>(Materials.Copper, 1), + new Pair<ISubTagContainer, Integer>(Materials.Vanadium, 1), + new Pair<ISubTagContainer, Integer>(Materials.Oxygen, 4) + ); + public static final Werkstoff FuchsitAL = new Werkstoff( + new short[]{0x4D,0x7F,0x64,0}, + "Fuchsite(Al)", + "KAl3Si3O10(OH)2", + new Werkstoff.Stats().setElektrolysis(true), + Werkstoff.Types.COMPOUND, + new Werkstoff.GenerationFeatures(), + 28, + TextureSet.SET_METALLIC, + Arrays.asList(Materials.Potassium,Materials.Aluminium,Materials.Silicon), + new Pair<ISubTagContainer, Integer>(Materials.Potassium, 1), + new Pair<ISubTagContainer, Integer>(Materials.Aluminium, 3), + new Pair<ISubTagContainer, Integer>(Materials.Silicon, 3), + new Pair<ISubTagContainer, Integer>(Materials.Oxygen, 12), + new Pair<ISubTagContainer, Integer>(Materials.Hydrogen, 2) + + ); + public static final Werkstoff FuchsitCR = new Werkstoff( + new short[]{128,0,0,0}, + "Fuchsite(Cr)", + "KCr3Si3O10(OH)2", + new Werkstoff.Stats().setElektrolysis(true), + Werkstoff.Types.COMPOUND, + new Werkstoff.GenerationFeatures(), + 29, + TextureSet.SET_METALLIC, + Arrays.asList(Materials.Potassium,Materials.Chrome,Materials.Silicon), + new Pair<ISubTagContainer, Integer>(Materials.Potassium, 1), + new Pair<ISubTagContainer, Integer>(Materials.Chrome, 3), + new Pair<ISubTagContainer, Integer>(Materials.Silicon, 3), + new Pair<ISubTagContainer, Integer>(Materials.Oxygen, 12), + new Pair<ISubTagContainer, Integer>(Materials.Hydrogen, 2) + + ); + + + + public static HashMap<OrePrefixes, BW_MetaGenerated_Items> items = new HashMap<>(); public static Block BWOres; public boolean registered = false; @@ -263,6 +455,9 @@ public class WerkstoffLoader implements Runnable { } public static ItemStack getCorresopndingItemStack(OrePrefixes orePrefixes, Werkstoff werkstoff, int amount) { + ItemStack ret = OreDictHandler.getItemStack(werkstoff.getDefaultName(),orePrefixes,amount); + if (ret != null) + return ret; if (orePrefixes == ore) return new ItemStack(BWOres, amount, werkstoff.getmID()); return new ItemStack(items.get(orePrefixes), amount, werkstoff.getmID()).copy(); @@ -274,9 +469,14 @@ public class WerkstoffLoader implements Runnable { } public void runInit() { + MainMod.LOGGER.info("Making Meta Items for BW Materials"); + long timepre = System.nanoTime(); WerkstoffAdderRegistry.getINSTANCE().run(); addSubTags(); addItemsForGeneration(); + runAdditionalOreDict(); + long timepost = System.nanoTime(); + MainMod.LOGGER.info("Making Meta Items for BW Materials took " + (timepost - timepre) + "ns/" + ((timepost - timepre) / 1000000) + "ms/" + ((timepost - timepre) / 1000000000) + "s!"); } @Override @@ -284,7 +484,7 @@ public class WerkstoffLoader implements Runnable { if (!registered) { MainMod.LOGGER.info("Loading Processing Recipes for BW Materials"); long timepre = System.nanoTime(); - ProgressManager.ProgressBar progressBar = ProgressManager.push("Register BW Materials", Werkstoff.werkstoffHashMap.size()); + ProgressManager.ProgressBar progressBar = ProgressManager.push("Register BW Materials", Werkstoff.werkstoffHashMap.size()+1); for (short i = 0; i < Werkstoff.werkstoffHashMap.size(); i++) { Werkstoff werkstoff = Werkstoff.werkstoffHashMap.get(i); @@ -298,6 +498,8 @@ public class WerkstoffLoader implements Runnable { addCrushedRecipes(werkstoff); progressBar.step(werkstoff.getDefaultName()); } + progressBar.step("Load Additional Recipes"); + new AdditionalRecipes().run(); ProgressManager.pop(progressBar); long timepost = System.nanoTime(); MainMod.LOGGER.info("Loading Processing Recipes for BW Materials took " + (timepost - timepre) + "ns/" + ((timepost - timepre) / 1000000) + "ms/" + ((timepost - timepre) / 1000000000) + "s!"); @@ -325,15 +527,19 @@ public class WerkstoffLoader implements Runnable { W.add(SubTag.CRYSTALLISABLE); } } - - } private void addItemsForGeneration() { int toGenerateGlobal = 0b0000000; - for (Werkstoff werkstoff : Werkstoff.werkstoffHashSet) + for (Werkstoff werkstoff : Werkstoff.werkstoffHashSet) { + for (OrePrefixes p : OrePrefixes.values()) + if ((werkstoff.getGenerationFeatures().toGenerate & p.mMaterialGenerationBits) != 0 && OreDictHandler.getItemStack(werkstoff.getDefaultName(),p,1) != null) { + MainMod.LOGGER.info("Found: "+(p+werkstoff.getDefaultName().replaceAll(" ",""))+" in oreDict, disable and reroute my Items to that, also add a Tooltip."); + werkstoff.getGenerationFeatures().setBlacklist(p); + } toGenerateGlobal = (toGenerateGlobal | werkstoff.getGenerationFeatures().toGenerate); + } if ((toGenerateGlobal & 0b1) != 0) { items.put(dust, new BW_MetaGenerated_Items(dust)); @@ -350,6 +556,7 @@ public class WerkstoffLoader implements Runnable { items.put(gemExquisite, new BW_MetaGenerated_Items(gemExquisite)); items.put(gemFlawed, new BW_MetaGenerated_Items(gemFlawed)); items.put(gemFlawless, new BW_MetaGenerated_Items(gemFlawless)); + items.put(lens,new BW_MetaGenerated_Items(lens)); } if ((toGenerateGlobal & 0b1000) != 0) { if (FMLCommonHandler.instance().getSide().isClient()) @@ -366,31 +573,48 @@ public class WerkstoffLoader implements Runnable { } } + private void runAdditionalOreDict(){ + for (Werkstoff werkstoff : Werkstoff.werkstoffHashSet) { + if (werkstoff.getGenerationFeatures().hasOres()) + GT_OreDictUnificator.registerOre(ore + werkstoff.getDefaultName().replaceAll(" ",""), werkstoff.get(ore)); + if (werkstoff.getGenerationFeatures().hasGems()) + OreDictionary.registerOre("craftingLens" + BW_ColorUtil.getDyeFromColor(werkstoff.getRGBA()).mName.replace(" ", ""), werkstoff.get(lens)); + } + + GT_OreDictUnificator.registerOre("craftingIndustrialDiamond",Zirconia.get(gemExquisite)); + } + private void addGemRecipes(Werkstoff werkstoff) { if (werkstoff.getGenerationFeatures().hasGems()) { - - GT_Values.RA.addSifterRecipe( - getCorresopndingItemStack(crushedPurified, werkstoff), - new ItemStack[]{ - getCorresopndingItemStack(gemExquisite, werkstoff), - getCorresopndingItemStack(gemFlawless, werkstoff), - getCorresopndingItemStack(gem, werkstoff), - getCorresopndingItemStack(gemFlawed, werkstoff), - getCorresopndingItemStack(gemChipped, werkstoff), - getCorresopndingItemStack(dust, werkstoff) - }, - new int[]{ - 100, 400, 1500, 2000, 4000, 5000 - }, - 800, - 16 - ); + if (werkstoff.getGenerationFeatures().hasSifterRecipes() || ((werkstoff.getGenerationFeatures().toGenerate & 0b1000) != 0 && (werkstoff.getGenerationFeatures().toGenerate & 0b1) != 0)) { + GT_Values.RA.addSifterRecipe( + getCorresopndingItemStack(crushedPurified, werkstoff), + new ItemStack[]{ + getCorresopndingItemStack(gemExquisite, werkstoff), + getCorresopndingItemStack(gemFlawless, werkstoff), + getCorresopndingItemStack(gem, werkstoff), + getCorresopndingItemStack(gemFlawed, werkstoff), + getCorresopndingItemStack(gemChipped, werkstoff), + getCorresopndingItemStack(dust, werkstoff) + }, + new int[]{ + 100, 400, 1500, 2000, 4000, 5000 + }, + 800, + 16 + ); + } GT_ModHandler.addPulverisationRecipe(werkstoff.get(gemExquisite), werkstoff.get(dust, 4)); GT_ModHandler.addPulverisationRecipe(werkstoff.get(gemFlawless), werkstoff.get(dust, 2)); GT_ModHandler.addPulverisationRecipe(werkstoff.get(gem), werkstoff.get(dust)); GT_ModHandler.addPulverisationRecipe(werkstoff.get(gemFlawed), werkstoff.get(dustSmall, 1)); GT_ModHandler.addPulverisationRecipe(werkstoff.get(gemChipped), werkstoff.get(dustTiny)); + GT_ModHandler.addCraftingRecipe(werkstoff.get(gemFlawless,2),0,new Object[]{"h ", "W ",'W',werkstoff.get(gemExquisite)}); + GT_ModHandler.addCraftingRecipe(werkstoff.get(gem, 2),0,new Object[]{"h ", "W ",'W',werkstoff.get(gemFlawless)}); + GT_ModHandler.addCraftingRecipe(werkstoff.get(gemFlawed, 2),0,new Object[]{"h ", "W ",'W',werkstoff.get(gem)}); + GT_ModHandler.addCraftingRecipe(werkstoff.get(gemChipped, 2),0,new Object[]{"h ", "W ",'W',werkstoff.get(gemFlawed)}); + GT_Values.RA.addForgeHammerRecipe(werkstoff.get(gemExquisite), werkstoff.get(gemFlawless, 2), 64, 16); GT_Values.RA.addForgeHammerRecipe(werkstoff.get(gemFlawless), werkstoff.get(gem, 2), 64, 16); GT_Values.RA.addForgeHammerRecipe(werkstoff.get(gem), werkstoff.get(gemFlawed, 2), 64, 16); @@ -404,6 +628,22 @@ public class WerkstoffLoader implements Runnable { GT_Values.RA.addImplosionRecipe(werkstoff.get(dust, 4), 24, werkstoff.get(gem, 3), GT_OreDictUnificator.get(OrePrefixes.dustTiny, Materials.DarkAsh, 8)); + if ((werkstoff.getGenerationFeatures().toGenerate & 2) != 0){ + GT_Values.RA.addLatheRecipe(werkstoff.get(plate),werkstoff.get(lens),werkstoff.get(dustSmall), 1200, 120); + } + GT_Values.RA.addLatheRecipe(werkstoff.get(gemExquisite),werkstoff.get(lens),werkstoff.get(dust,2), 2400, 30); + GregTech_API.registerCover(werkstoff.get(lens), new GT_MultiTexture(Textures.BlockIcons.MACHINE_CASINGS[2][0], new GT_RenderedTexture(Textures.BlockIcons.OVERLAY_LENS, werkstoff.getRGBA(), false)), new gregtech.common.covers.GT_Cover_Lens(BW_ColorUtil.getDyeFromColor(werkstoff.getRGBA()).mIndex)); + GT_ModHandler.addPulverisationRecipe(werkstoff.get(lens), werkstoff.get(dustSmall,3)); + // if (MainMod.GTNH) { + //Engraver Recipe adder + for (ItemStack is : OreDictionary.getOres("craftingLens" + BW_ColorUtil.getDyeFromColor(werkstoff.getRGBA()).mName.replace(" ", ""))) { + is.stackSize = 0; + GT_Values.RA.addLaserEngraverRecipe(werkstoff.get(gemChipped, 3), is, werkstoff.get(gemFlawed, 1), 600, 30); + GT_Values.RA.addLaserEngraverRecipe(werkstoff.get(gemFlawed, 3), is, werkstoff.get(gem, 1), 600, 120); + GT_Values.RA.addLaserEngraverRecipe(werkstoff.get(gem, 3), is, werkstoff.get(gemFlawless, 1), 1200, 480); + GT_Values.RA.addLaserEngraverRecipe(werkstoff.get(gemFlawless, 3), is, werkstoff.get(gemExquisite, 1), 2400, 2000); + } +// } } } @@ -415,7 +655,7 @@ public class WerkstoffLoader implements Runnable { HashMap<ISubTagContainer, Pair<Integer, Integer>> tracker = new HashMap<>(); int cells = 0; - if (werkstoff.getStats().isElektrolysis() || werkstoff.getStats().isCentrifuge()) { + if (werkstoff.getStats().isElektrolysis() || werkstoff.getStats().isCentrifuge() || werkstoff.getGenerationFeatures().hasChemicalRecipes()) { for (Pair<ISubTagContainer, Integer> container : werkstoff.getContents().getValue().toArray(new Pair[0])) { if (container.getKey() instanceof Materials) { if (((Materials) container.getKey()).hasCorrespondingGas() || ((Materials) container.getKey()).hasCorrespondingFluid() || ((Materials) container.getKey()).mIconSet == TextureSet.SET_FLUID) { @@ -463,23 +703,19 @@ public class WerkstoffLoader implements Runnable { GT_Recipe.GT_Recipe_Map.sElectrolyzerRecipes.addRecipe(true, new ItemStack[]{input, cells > 0 ? Materials.Empty.getCells(cells) : null}, stOutputs.toArray(new ItemStack[0]), (Object) null, null, new FluidStack[]{null}, new FluidStack[]{flOutputs.size() > 0 ? flOutputs.get(0) : null}, (int) Math.max(1L, Math.abs(werkstoff.getStats().protons * werkstoff.getContents().getValue().size())), Math.min(4, werkstoff.getContents().getValue().size()) * 30, 0); if (werkstoff.getStats().isCentrifuge()) GT_Recipe.GT_Recipe_Map.sCentrifugeRecipes.addRecipe(true, new ItemStack[]{input, cells > 0 ? Materials.Empty.getCells(cells) : null}, stOutputs.toArray(new ItemStack[0]), (Object) null, null, new FluidStack[]{null}, new FluidStack[]{flOutputs.size() > 0 ? flOutputs.get(0) : null}, (int) Math.max(1L, Math.abs(werkstoff.getStats().mass * werkstoff.getContents().getValue().size())), Math.min(4, werkstoff.getContents().getValue().size()) * 5, 0); + if (werkstoff.getGenerationFeatures().hasChemicalRecipes()) { + if (cells > 0) + stOutputs.add(Materials.Empty.getCells(cells)); + GT_Recipe.GT_Recipe_Map.sChemicalRecipes.addRecipe(true, stOutputs.toArray(new ItemStack[0]),new ItemStack[]{input},null,null,new FluidStack[]{flOutputs.size() > 0 ? flOutputs.get(0) : null},null,(int) Math.max(1L, Math.abs(werkstoff.getStats().protons * werkstoff.getContents().getValue().size())), Math.min(4, werkstoff.getContents().getValue().size()) * 30,0); + } } - GT_ModHandler.addShapelessCraftingRecipe(getCorresopndingItemStack(dust, werkstoff), 0, new Object[]{ - getCorresopndingItemStack(dustTiny, werkstoff), - getCorresopndingItemStack(dustTiny, werkstoff), - getCorresopndingItemStack(dustTiny, werkstoff), - getCorresopndingItemStack(dustTiny, werkstoff), - getCorresopndingItemStack(dustTiny, werkstoff), - getCorresopndingItemStack(dustTiny, werkstoff), - getCorresopndingItemStack(dustTiny, werkstoff), - getCorresopndingItemStack(dustTiny, werkstoff), + GT_ModHandler.addCraftingRecipe(getCorresopndingItemStack(dust, werkstoff), new Object[]{ + "TTT","TTT","TTT",'T', getCorresopndingItemStack(dustTiny, werkstoff) }); - GT_ModHandler.addShapelessCraftingRecipe(getCorresopndingItemStack(dust, werkstoff), 0, new Object[]{ - getCorresopndingItemStack(dustSmall, werkstoff), - getCorresopndingItemStack(dustSmall, werkstoff), - getCorresopndingItemStack(dustSmall, werkstoff), + GT_ModHandler.addCraftingRecipe(getCorresopndingItemStack(dust, werkstoff), new Object[]{ + "TT ","TT ",'T', getCorresopndingItemStack(dustSmall, werkstoff) }); GT_ModHandler.addCraftingRecipe(getCorresopndingItemStack(dustSmall, werkstoff, 4), new Object[]{ @@ -493,14 +729,6 @@ public class WerkstoffLoader implements Runnable { GT_ModHandler.addSmeltingRecipe(getCorresopndingItemStack(dust, werkstoff), getCorresopndingItemStack(ingot, werkstoff)); GT_ModHandler.addSmeltingRecipe(getCorresopndingItemStack(dustTiny, werkstoff), getCorresopndingItemStack(nugget, werkstoff)); } - - if (werkstoff.contains(SubTag.CRYSTALLISABLE)) { - GT_Values.RA.addAutoclaveRecipe(werkstoff.get(dustPure), Materials.Water.getFluid(200L), werkstoff.get(gem), 9000, 2000, 24); - GT_Values.RA.addAutoclaveRecipe(werkstoff.get(dustImpure), Materials.Water.getFluid(200L), werkstoff.get(gem), 9000, 2000, 24); - GT_Values.RA.addAutoclaveRecipe(werkstoff.get(dustPure), gregtech.api.util.GT_ModHandler.getDistilledWater(200L), werkstoff.get(gem), 9500, 1500, 24); - GT_Values.RA.addAutoclaveRecipe(werkstoff.get(dustImpure), gregtech.api.util.GT_ModHandler.getDistilledWater(200L), werkstoff.get(gem), 9500, 1500, 24); - } - } } @@ -513,7 +741,7 @@ public class WerkstoffLoader implements Runnable { GT_ModHandler.addPulverisationRecipe( werkstoff.get(ore), werkstoff.get(crushed, 2), - werkstoff.getOreByProduct(0, gem) != null ? werkstoff.getOreByProduct(0, gem) : werkstoff.getOreByProduct(0, dust), + werkstoff.contains(SubTag.CRYSTAL) ? werkstoff.get(gem) : werkstoff.getOreByProduct(0, dust), werkstoff.getNoOfByProducts() > 0 ? 10 : 0, Materials.Stone.getDust(1), 50, @@ -525,6 +753,10 @@ public class WerkstoffLoader implements Runnable { if ((werkstoff.getGenerationFeatures().toGenerate & 0b1000) == 0 || (werkstoff.getGenerationFeatures().toGenerate & 0b1) == 0) return; + GT_ModHandler.addCraftingRecipe(werkstoff.get(dustImpure),new Object[]{"h ", "W ",'W',werkstoff.get(crushed)}); + GT_ModHandler.addCraftingRecipe(werkstoff.get(dustPure),new Object[]{"h ", "W ",'W',werkstoff.get(crushedPurified)}); + GT_ModHandler.addCraftingRecipe(werkstoff.get(dust),new Object[]{"h ", "W ",'W',werkstoff.get(crushedCentrifuged)}); + GT_Values.RA.addForgeHammerRecipe(werkstoff.get(crushed), werkstoff.get(dustImpure), 10, 16); GT_ModHandler.addPulverisationRecipe(werkstoff.get(crushed), werkstoff.get(dustImpure), werkstoff.getOreByProduct(0, dust), 10, false); GT_ModHandler.addOreWasherRecipe(werkstoff.get(crushed), 1000, werkstoff.get(crushedPurified), werkstoff.getOreByProduct(0, dustTiny), GT_OreDictUnificator.get(OrePrefixes.dust, Materials.Stone, 1L)); @@ -540,7 +772,12 @@ public class WerkstoffLoader implements Runnable { GT_Values.RA.addCentrifugeRecipe(werkstoff.get(dustImpure), 0, werkstoff.get(dust), werkstoff.getOreByProduct(0, dustTiny), null, null, null, null, (int) Math.max(1L, werkstoff.getStats().mass * 8L)); GT_Values.RA.addCentrifugeRecipe(werkstoff.get(dustPure), 0, werkstoff.get(dust), werkstoff.getOreByProduct(1, dustTiny), null, null, null, null, (int) Math.max(1L, werkstoff.getStats().mass * 8L)); - + if (werkstoff.contains(SubTag.CRYSTALLISABLE)) { + GT_Values.RA.addAutoclaveRecipe(werkstoff.get(dustPure), Materials.Water.getFluid(200L), werkstoff.get(gem), 9000, 2000, 24); + GT_Values.RA.addAutoclaveRecipe(werkstoff.get(dustImpure), Materials.Water.getFluid(200L), werkstoff.get(gem), 9000, 2000, 24); + GT_Values.RA.addAutoclaveRecipe(werkstoff.get(dustPure), gregtech.api.util.GT_ModHandler.getDistilledWater(200L), werkstoff.get(gem), 9500, 1500, 24); + GT_Values.RA.addAutoclaveRecipe(werkstoff.get(dustImpure), gregtech.api.util.GT_ModHandler.getDistilledWater(200L), werkstoff.get(gem), 9500, 1500, 24); + } if (werkstoff.contains(SubTag.WASHING_MERCURY)) GT_Values.RA.addChemicalBathRecipe(werkstoff.get(crushed), Materials.Mercury.getFluid(1000L), werkstoff.get(crushedPurified), werkstoff.getOreByProduct(1, dust), GT_OreDictUnificator.get(OrePrefixes.dust, Materials.Stone, 1L), new int[]{10000, 7000, 4000}, 800, 8); if (werkstoff.contains(SubTag.WASHING_SODIUMPERSULFATE)) diff --git a/src/main/java/com/github/bartimaeusnek/bartworks/system/material/processingLoaders/AdditionalRecipes.java b/src/main/java/com/github/bartimaeusnek/bartworks/system/material/processingLoaders/AdditionalRecipes.java new file mode 100644 index 0000000000..50190d49a4 --- /dev/null +++ b/src/main/java/com/github/bartimaeusnek/bartworks/system/material/processingLoaders/AdditionalRecipes.java @@ -0,0 +1,44 @@ +/* + * Copyright (c) 2019 bartimaeusnek + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to deal + * in the Software without restriction, including without limitation the rights + * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in all + * copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + * SOFTWARE. + */ + +package com.github.bartimaeusnek.bartworks.system.material.processingLoaders; + +import com.github.bartimaeusnek.bartworks.common.loaders.ItemRegistry; +import com.github.bartimaeusnek.bartworks.system.material.WerkstoffLoader; +import com.github.bartimaeusnek.bartworks.util.BW_Util; +import gregtech.api.enums.GT_Values; +import gregtech.api.enums.Materials; +import gregtech.api.util.GT_Recipe; +import gregtech.api.util.GT_Utility; +import net.minecraft.item.ItemStack; +import net.minecraftforge.fluids.FluidStack; + +import static gregtech.api.enums.OrePrefixes.*; + +public class AdditionalRecipes implements Runnable { + @Override + public void run() { + GT_Values.RA.addChemicalRecipe(Materials.Yttrium.getDust(2), GT_Utility.getIntegratedCircuit(11),Materials.Oxygen.getGas(3000),null, WerkstoffLoader.YttriumOxide.get(dust),64, BW_Util.getMachineVoltageFromTier(4)); + GT_Recipe.GT_Recipe_Map.sBlastRecipes.addRecipe(false, new ItemStack[]{WerkstoffLoader.Zirconium.get(dust,10), WerkstoffLoader.YttriumOxide.get(dust)}, new ItemStack[]{WerkstoffLoader.YttriumOxide.get(dust), WerkstoffLoader.Zirconia.get(gemFlawed, 40)}, (Object) null, (int[]) null, new FluidStack[]{Materials.Oxygen.getGas(20000)}, null, 14400, BW_Util.getMachineVoltageFromTier(4), 2953); + GT_Values.RA.addBlastRecipe(WerkstoffLoader.YttriumOxide.get(dustSmall,2),WerkstoffLoader.Thorianit.get(dustSmall,2),Materials.Glass.getMolten(144),null,new ItemStack(ItemRegistry.bw_glasses[0],1,12),null,800,BW_Util.getMachineVoltageFromTier(5),3663); + } +} diff --git a/src/main/java/com/github/bartimaeusnek/bartworks/util/BW_ColorUtil.java b/src/main/java/com/github/bartimaeusnek/bartworks/util/BW_ColorUtil.java new file mode 100644 index 0000000000..f1ae2667ee --- /dev/null +++ b/src/main/java/com/github/bartimaeusnek/bartworks/util/BW_ColorUtil.java @@ -0,0 +1,284 @@ +/* + * Copyright (c) 2019 bartimaeusnek + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to deal + * in the Software without restriction, including without limitation the rights + * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in all + * copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + * SOFTWARE. + */ + +package com.github.bartimaeusnek.bartworks.util; + +import gregtech.api.enums.Dyes; + +import java.util.Arrays; + +public class BW_ColorUtil { + private BW_ColorUtil(){} + + public static byte getDarknessFromColor (short[] rgba, int index){ + int g = rgba[index]; + if (g >= 0 && g < 64) + return 0; + else if (g >= 64 && g < 160) + return 1; + else if (g >= 160 && g < 223) + return 2; + else if (g >= 233 && g <= 255) + return 3; + return 4; + } + + public static Dyes getDyeFromColor(short[] rgba){ + rgba=correctCorlorArray(rgba); + if (isGrayScale(rgba,2)){ + switch (getDarknessFromColor(rgba,0)) { + case 0: + return Dyes.dyeBlack; + case 1: + return Dyes.dyeGray; + case 2: + return Dyes.dyeLightGray; + case 3: + return Dyes.dyeWhite; + } + } else { + short[] tmp = roundColor(rgba, 2); + if (isRedScale(tmp)){ + if (isPurpleScale(tmp)) { + switch (getDarknessFromColor(rgba, 0)) { + case 0: + case 1: + if (rgba[3] - 50 > rgba[0]) + return Dyes.dyePurple; + else return Dyes.dyeRed; + case 2: + case 3: + if (rgba[3] - 50 > rgba[0]) + return Dyes.dyeMagenta; + else if (rgba[0] > 200 && rgba[2] > 140) + return Dyes.dyePink; + else if (rgba[0] > rgba[1]+rgba[1]/10 && rgba[0] > rgba[2]+rgba[2]/10 && rgba[1]>>4 == rgba[2]>>4 && rgba[1]+50 > rgba[0]) { + return Dyes.dyeBrown; + } + else + return Dyes.dyeRed; + case 4: + return Dyes._NULL; + } + } + if (isYellowScale(tmp)) + switch (getDarknessFromColor(rgba, 0)) { + case 0: + case 1: + return Dyes.dyeBrown; + case 2: + case 3:{ + if (rgba[0]>>5 > rgba[1]>>5) + return Dyes.dyeOrange; + else + return Dyes.dyeYellow; + } + case 4: + return Dyes._NULL; + } + return Dyes.dyePink; + } else if (isGrenScale(tmp)){ + if (isCyanScale(tmp)) { + if (rgba[2]+40 < rgba[1]) + switch (getDarknessFromColor(rgba,0)) { + case 0: + case 1: + return Dyes.dyeGreen; + case 2: + case 3: + return Dyes.dyeLime; + } + return Dyes.dyeCyan; + } + if (isYellowScale(tmp)) + switch (getDarknessFromColor(rgba, 0)) { + case 0: + case 1: + return Dyes.dyeBrown; + case 2: + case 3:{ + if (rgba[0]>>5 > rgba[1]>>5) + return Dyes.dyeOrange; + else + return Dyes.dyeYellow; + } + } + switch (getDarknessFromColor(rgba,0)) { + case 0: + case 1: + return Dyes.dyeGreen; + case 2: + case 3: + return Dyes.dyeLime; + } + } else if (isBlueScale(tmp)){ + if (isPurpleScale(tmp)) { + switch (getDarknessFromColor(rgba, 0)) { + case 0: + case 1: + return Dyes.dyePurple; + case 2: + case 3: + return Dyes.dyeMagenta; + } + } + else if (isCyanScale(tmp)){ + return Dyes.dyeCyan; + } + switch (getDarknessFromColor(rgba,0)) { + case 0: + case 1: + return Dyes.dyeBlue; + case 2: + case 3: + return Dyes.dyeLightBlue; + } + } + } + return Dyes._NULL; + } + + public static boolean isCyanScale(short[] rgba){ + return !isRedScale(rgba); + } + + public static boolean isPurpleScale(short[] rgba){ + return !isGrenScale(rgba); + } + + public static boolean isYellowScale(short[] rgba){ + return !isBlueScale(rgba); + } + + public static boolean isBlueScale(short[] rgba){ + rgba=correctCorlorArray(rgba); + return (rgba[2]*2) >= (rgba[1]+rgba[0]); + } + + public static boolean isGrenScale(short[] rgba){ + rgba=correctCorlorArray(rgba); + return (rgba[1]*2) >= (rgba[0]+rgba[2]); + } + + public static boolean isRedScale(short[] rgba){ + rgba=correctCorlorArray(rgba); + return (rgba[0]*2) >= (rgba[1]+rgba[2]); + } + + public static boolean isGrayScale(short[] rgba, int magin){ + rgba=correctCorlorArray(rgba); + return rgba[0]>>magin==rgba[1]>>magin && rgba[1]>>magin==rgba[2]>>magin; + } + + public static short[] roundColor(short[] rgba, int magin){ + short[]tmp = Arrays.copyOf(rgba,4); + tmp[0] = (short) (rgba[0]>>magin); + tmp[1] = (short) (rgba[1]>>magin); + tmp[2] = (short) (rgba[2]>>magin); + return tmp; + } + + public static boolean isGrayScale(short[] rgba){ + rgba=correctCorlorArray(rgba); + return rgba[0]==rgba[1] && rgba[1] == rgba[2]; + } + + public static short[] correctCorlorArray(short[] rgba){ + if (rgba.length<4) { + short[] tmp = Arrays.copyOf(rgba, 4); + Arrays.fill(tmp,rgba.length-1,4, (short) 0); + rgba = tmp; + } + if (rgba[0] > 255) + rgba[0] = 255; + if (rgba[1] > 255) + rgba[1] = 255; + if (rgba[2] > 255) + rgba[2] = 255; + if (rgba[3] > 255) + rgba[3] = 255; + if (rgba[0] < 0) + rgba[0] = 0; + if (rgba[1] < 0) + rgba[1] = 0; + if (rgba[2] < 0) + rgba[2] = 0; + if (rgba[3] < 0) + rgba[3] = 0; + return rgba; + } + + public static short[] splitColorToRBGArray(int rgb) { + return new short[]{(short) ((rgb >> 16) & 0xFF), (short) ((rgb >> 8) & 0xFF), (short) (rgb & 0xFF)}; + } + + public static int getColorFromRGBArray(short[] color) { + return ((color[0] & 0x0ff) << 16) | ((color[1] & 0x0ff) << 8) | (color[2] & 0x0ff); + } + + public static int getColorFromRGBArray(int[] color) { + return ((color[0] & 0x0ff) << 16) | ((color[1] & 0x0ff) << 8) | (color[2] & 0x0ff); + } + + public static String getColorForTier(int tier) { + String ret; + switch (tier) { + case 0: + ret = ChatColorHelper.RED; + break; + case 1: + ret = ChatColorHelper.GRAY; + break; + case 2: + ret = ChatColorHelper.AQUA; + break; + case 3: + ret = ChatColorHelper.GOLD; + break; + case 4: + ret = ChatColorHelper.DARKPURPLE; + break; + case 5: + ret = ChatColorHelper.DARKBLUE; + break; + case 6: + ret = ChatColorHelper.LIGHT_PURPLE; + break; + case 7: + ret = ChatColorHelper.WHITE; + break; + case 8: + ret = ChatColorHelper.DARKAQUA; + break; + case 9: + ret = ChatColorHelper.DARKRED; + break; + case 10: + ret = ChatColorHelper.GREEN; + break; + default: + ret = ChatColorHelper.OBFUSCATED; + break; + } + return ret; + } +} diff --git a/src/main/java/com/github/bartimaeusnek/bartworks/util/BW_Util.java b/src/main/java/com/github/bartimaeusnek/bartworks/util/BW_Util.java index f839b8b503..c775313f1a 100644 --- a/src/main/java/com/github/bartimaeusnek/bartworks/util/BW_Util.java +++ b/src/main/java/com/github/bartimaeusnek/bartworks/util/BW_Util.java @@ -24,6 +24,7 @@ package com.github.bartimaeusnek.bartworks.util; import com.github.bartimaeusnek.bartworks.API.BioVatLogicAdder; import gregtech.api.enums.Materials; +import gregtech.api.interfaces.ISubTagContainer; import gregtech.api.interfaces.tileentity.IGregTechTileEntity; import gregtech.api.metatileentity.implementations.GT_MetaTileEntity_Hatch_Energy; import gregtech.api.metatileentity.implementations.GT_MetaTileEntity_MultiBlockBase; @@ -36,8 +37,10 @@ import net.minecraftforge.common.util.ForgeDirection; import javax.annotation.Nonnegative; import java.util.ArrayList; +import java.util.Arrays; import java.util.Iterator; import java.util.List; +import java.util.function.UnaryOperator; import static gregtech.api.enums.GT_Values.V; @@ -92,18 +95,6 @@ public class BW_Util { return (int) (30 * Math.pow(4, (tier - 1))); } - public static short[] splitColortoArray(int rgb) { - return new short[]{(short) ((rgb >> 16) & 0xFF), (short) ((rgb >> 8) & 0xFF), (short) (rgb & 0xFF)}; - } - - public static int getColorFromArray(short[] color) { - return ((color[0] & 0x0ff) << 16) | ((color[1] & 0x0ff) << 8) | (color[2] & 0x0ff); - } - - public static int getColorFromArray(int[] color) { - return ((color[0] & 0x0ff) << 16) | ((color[1] & 0x0ff) << 8) | (color[2] & 0x0ff); - } - public static boolean areStacksEqual(ItemStack aStack1, ItemStack aStack2) { return (aStack1 == null && aStack2 == null) || GT_Utility.areStacksEqual(aStack1, aStack2); } @@ -136,51 +127,11 @@ public class BW_Util { case 5: ret = 8; break; - default: - ret = 3; - } - return ret; - } - - public static String getColorForTier(int tier) { - String ret; - switch (tier) { - case 0: - ret = ChatColorHelper.RED; - break; - case 1: - ret = ChatColorHelper.GRAY; - break; - case 2: - ret = ChatColorHelper.AQUA; - break; - case 3: - ret = ChatColorHelper.GOLD; - break; - case 4: - ret = ChatColorHelper.DARKPURPLE; - break; - case 5: - ret = ChatColorHelper.DARKBLUE; - break; - case 6: - ret = ChatColorHelper.LIGHT_PURPLE; - break; - case 7: - ret = ChatColorHelper.WHITE; - break; - case 8: - ret = ChatColorHelper.DARKAQUA; - break; - case 9: - ret = ChatColorHelper.DARKRED; - break; - case 10: - ret = ChatColorHelper.GREEN; + case 12: + ret = 5; break; default: - ret = ChatColorHelper.OBFUSCATED; - break; + ret = 3; } return ret; } diff --git a/src/main/java/com/github/bartimaeusnek/bartworks/util/BioCulture.java b/src/main/java/com/github/bartimaeusnek/bartworks/util/BioCulture.java index a9f3293cbc..001b747be8 100644 --- a/src/main/java/com/github/bartimaeusnek/bartworks/util/BioCulture.java +++ b/src/main/java/com/github/bartimaeusnek/bartworks/util/BioCulture.java @@ -147,7 +147,7 @@ public class BioCulture extends BioData implements IColorModulationContainer { } public int getColorRGB() { - return BW_Util.getColorFromArray(new int[]{this.color.getRed(), this.color.getGreen(), this.color.getBlue()}); + return BW_ColorUtil.getColorFromRGBArray(new int[]{this.color.getRed(), this.color.getGreen(), this.color.getBlue()}); } public Color getColor() { diff --git a/src/main/java/com/github/bartimaeusnek/crossmod/galacticraft/planets/ross128/world/oregen/BW_OreLayer.java b/src/main/java/com/github/bartimaeusnek/crossmod/galacticraft/planets/ross128/world/oregen/BW_OreLayer.java new file mode 100644 index 0000000000..95155b1487 --- /dev/null +++ b/src/main/java/com/github/bartimaeusnek/crossmod/galacticraft/planets/ross128/world/oregen/BW_OreLayer.java @@ -0,0 +1,150 @@ +/* + * Copyright (c) 2019 bartimaeusnek + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to deal + * in the Software without restriction, including without limitation the rights + * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in all + * copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + * SOFTWARE. + */ + +package com.github.bartimaeusnek.crossmod.galacticraft.planets.ross128.world.oregen; + +import com.github.bartimaeusnek.bartworks.MainMod; +import com.github.bartimaeusnek.bartworks.system.material.BW_MetaGenerated_Ores; +import com.github.bartimaeusnek.bartworks.system.material.Werkstoff; +import gregtech.api.enums.Materials; +import gregtech.api.interfaces.ISubTagContainer; +import gregtech.api.world.GT_Worldgen; +import gregtech.common.blocks.GT_TileEntity_Ores; +import net.minecraft.util.MathHelper; +import net.minecraft.world.World; +import net.minecraft.world.chunk.IChunkProvider; + +import java.util.ArrayList; +import java.util.List; +import java.util.Random; + +/** + * Original GT File Stripped and adjusted to work with this mod + */ +public class BW_OreLayer extends GT_Worldgen { + public static final List<BW_OreLayer> sList = new ArrayList<>(); + private static final boolean logOregenRoss128 = false; + public static int sWeight; + public byte bwOres = 0b0000; + public int mMinY, mWeight, mDensity, mSize, mMaxY, mPrimaryMeta, mSecondaryMeta, mBetweenMeta, mSporadicMeta; + + public BW_OreLayer(String aName, boolean aDefault, int aMinY, int aMaxY, int aWeight, int aDensity, int aSize, ISubTagContainer top, ISubTagContainer bottom, ISubTagContainer between, ISubTagContainer sprinkled) { + super(aName, BW_OreLayer.sList, aDefault); + this.mMinY = (short) aMinY; + this.mMaxY = (short) aMaxY; + this.mWeight = (short) aWeight; + this.mDensity = (short) aDensity; + this.mSize = (short) Math.max(1, aSize); + + if (mEnabled) + BW_OreLayer.sWeight += this.mWeight; + + if (top instanceof Werkstoff) + bwOres = (byte) (bwOres | 0b1000); + if (bottom instanceof Werkstoff) + bwOres = (byte) (bwOres | 0b0100); + if (between instanceof Werkstoff) + bwOres = (byte) (bwOres | 0b0010); + if (sprinkled instanceof Werkstoff) + bwOres = (byte) (bwOres | 0b0001); + + short aPrimary = top instanceof Materials ? + (short) ((Materials) top).mMetaItemSubID : + top instanceof Werkstoff ? + (short) ((Werkstoff) top).getmID() : + 0; + short aSecondary = bottom instanceof Materials ? + (short) ((Materials) bottom).mMetaItemSubID : + bottom instanceof Werkstoff ? + (short) ((Werkstoff) bottom).getmID() : + 0; + short aBetween = between instanceof Materials ? + (short) ((Materials) between).mMetaItemSubID : + between instanceof Werkstoff ? + (short) ((Werkstoff) between).getmID() : + 0; + short aSporadic = sprinkled instanceof Materials ? + (short) ((Materials) sprinkled).mMetaItemSubID : + sprinkled instanceof Werkstoff ? + (short) ((Werkstoff) sprinkled).getmID() : + 0; + this.mPrimaryMeta = (short) aPrimary; + this.mSecondaryMeta = (short) aSecondary; + this.mBetweenMeta = (short) aBetween; + this.mSporadicMeta = (short) aSporadic; + + } + + @Override + public boolean executeWorldgen(World aWorld, Random aRandom, String aBiome, int aDimensionType, int aChunkX, int aChunkZ, IChunkProvider aChunkGenerator, IChunkProvider aChunkProvider) { + { + int tMinY = this.mMinY + aRandom.nextInt(this.mMaxY - this.mMinY - 5); + int cX = aChunkX - aRandom.nextInt(this.mSize); + int eX = aChunkX + 16 + aRandom.nextInt(this.mSize); + + for (int tX = cX; tX <= eX; ++tX) { + int cZ = aChunkZ - aRandom.nextInt(this.mSize); + int eZ = aChunkZ + 16 + aRandom.nextInt(this.mSize); + + for (int tZ = cZ; tZ <= eZ; ++tZ) { + int i; + if (this.mSecondaryMeta > 0) { + for (i = tMinY - 1; i < tMinY + 2; ++i) { + if (aRandom.nextInt(Math.max(1, Math.max(MathHelper.abs_int(cZ - tZ), MathHelper.abs_int(eZ - tZ)) / this.mDensity)) == 0 || aRandom.nextInt(Math.max(1, Math.max(MathHelper.abs_int(cX - tX), MathHelper.abs_int(eX - tX)) / this.mDensity)) == 0) { + setOreBlock(aWorld, tX, i, tZ, this.mSecondaryMeta, false); + } + } + } + + if (this.mBetweenMeta > 0 && (aRandom.nextInt(Math.max(1, Math.max(MathHelper.abs_int(cZ - tZ), MathHelper.abs_int(eZ - tZ)) / this.mDensity)) == 0 || aRandom.nextInt(Math.max(1, Math.max(MathHelper.abs_int(cX - tX), MathHelper.abs_int(eX - tX)) / this.mDensity)) == 0)) { + setOreBlock(aWorld, tX, tMinY + 2 + aRandom.nextInt(2), tZ, this.mBetweenMeta, false); + } + + if (this.mPrimaryMeta > 0) { + for (i = tMinY + 3; i < tMinY + 6; ++i) { + if (aRandom.nextInt(Math.max(1, Math.max(MathHelper.abs_int(cZ - tZ), MathHelper.abs_int(eZ - tZ)) / this.mDensity)) == 0 || aRandom.nextInt(Math.max(1, Math.max(MathHelper.abs_int(cX - tX), MathHelper.abs_int(eX - tX)) / this.mDensity)) == 0) { + setOreBlock(aWorld, tX, i, tZ, this.mPrimaryMeta, false); + } + } + } + + if (this.mSporadicMeta > 0 && (aRandom.nextInt(Math.max(1, Math.max(MathHelper.abs_int(cZ - tZ), MathHelper.abs_int(eZ - tZ)) / this.mDensity)) == 0 || aRandom.nextInt(Math.max(1, Math.max(MathHelper.abs_int(cX - tX), MathHelper.abs_int(eX - tX)) / this.mDensity)) == 0)) { + setOreBlock(aWorld, tX, tMinY - 1 + aRandom.nextInt(7), tZ, this.mSporadicMeta, false); + } + } + } + + if (logOregenRoss128) { + MainMod.LOGGER.info("Generated Orevein: " + this.mWorldGenName + " " + aChunkX + " " + aChunkZ); + } + + return true; + } + } + + public boolean setOreBlock(World aWorld, int aX, int aY, int aZ, int aMetaData, boolean isSmallOre) { + if ((aMetaData == mSporadicMeta && (bwOres & 0b0001) != 0) || (aMetaData == mBetweenMeta && (bwOres & 0b0010) != 0) || (aMetaData == mPrimaryMeta && (bwOres & 0b1000) != 0) || (aMetaData == mSecondaryMeta && (bwOres & 0b0100) != 0)) { + return BW_MetaGenerated_Ores.setOreBlock(aWorld, aX, aY, aZ, aMetaData, false); + } + return GT_TileEntity_Ores.setOreBlock(aWorld, aX, aY, aZ, aMetaData, isSmallOre, false); + } +} diff --git a/src/main/java/com/github/bartimaeusnek/crossmod/galacticraft/planets/ross128/world/oregen/BW_WordGenerator.java b/src/main/java/com/github/bartimaeusnek/crossmod/galacticraft/planets/ross128/world/oregen/BW_WordGenerator.java index 5a80b62f75..57dc4ac57d 100644 --- a/src/main/java/com/github/bartimaeusnek/crossmod/galacticraft/planets/ross128/world/oregen/BW_WordGenerator.java +++ b/src/main/java/com/github/bartimaeusnek/crossmod/galacticraft/planets/ross128/world/oregen/BW_WordGenerator.java @@ -97,13 +97,13 @@ public class BW_WordGenerator implements IWorldGenerator { ChunkCoordIntPair centerChunk = new ChunkCoordIntPair(xCenter, zCenter); if (!mGenerated.contains(centerChunk) && surroundingChunksLoaded(xCenter, zCenter)) { mGenerated.add(centerChunk); - if ((BW_WorldGenRoss128.sWeight > 0) && (BW_WorldGenRoss128.sList.size() > 0)) { + if ((BW_OreLayer.sWeight > 0) && (BW_OreLayer.sList.size() > 0)) { boolean temp = true; int tRandomWeight; for (int i = 0; (i < 256) && (temp); i++) { - tRandomWeight = random.nextInt(BW_WorldGenRoss128.sWeight); - for (GT_Worldgen tWorldGen : BW_WorldGenRoss128.sList) { - tRandomWeight -= ((BW_WorldGenRoss128) tWorldGen).mWeight; + tRandomWeight = random.nextInt(BW_OreLayer.sWeight); + for (BW_OreLayer tWorldGen : BW_OreLayer.sList) { + tRandomWeight -= ((BW_OreLayer) tWorldGen).mWeight; if (tRandomWeight <= 0) { try { if (tWorldGen.executeWorldgen(this.mWorld, random, "", this.mDimensionType, xCenter, zCenter, this.mChunkGenerator, this.mChunkProvider)) { diff --git a/src/main/java/com/github/bartimaeusnek/crossmod/galacticraft/planets/ross128/world/oregen/BW_WorldGenRoss128.java b/src/main/java/com/github/bartimaeusnek/crossmod/galacticraft/planets/ross128/world/oregen/BW_WorldGenRoss128.java index 0f49e7ee95..5fa9218ef2 100644 --- a/src/main/java/com/github/bartimaeusnek/crossmod/galacticraft/planets/ross128/world/oregen/BW_WorldGenRoss128.java +++ b/src/main/java/com/github/bartimaeusnek/crossmod/galacticraft/planets/ross128/world/oregen/BW_WorldGenRoss128.java @@ -22,82 +22,25 @@ package com.github.bartimaeusnek.crossmod.galacticraft.planets.ross128.world.oregen; -import com.github.bartimaeusnek.bartworks.MainMod; -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.crossmod.galacticraft.planets.ross128.world.worldprovider.WorldProviderRoss128b; +import com.github.bartimaeusnek.crossmod.galacticraft.solarsystems.Ross128; import gregtech.api.enums.Materials; import gregtech.api.interfaces.ISubTagContainer; import gregtech.api.world.GT_Worldgen; -import gregtech.common.blocks.GT_TileEntity_Ores; -import net.minecraft.util.MathHelper; import net.minecraft.util.StatCollector; import net.minecraft.world.World; -import net.minecraft.world.chunk.IChunkProvider; import net.minecraftforge.fluids.FluidRegistry; -import java.util.ArrayList; -import java.util.List; -import java.util.Random; - import static com.github.bartimaeusnek.crossmod.galacticraft.GalacticraftProxy.uo_dimensionList; -/** - * Original GT File Stripped and adjusted to work with this mod - */ -public class BW_WorldGenRoss128 extends GT_Worldgen { - - public static final List<GT_Worldgen> sList = new ArrayList<>(); - private static final boolean logOregenRoss128 = false; - public static int sWeight; - public byte bwOres = 0b0000; - public int mMinY, mWeight, mDensity, mSize, mMaxY, mPrimaryMeta, mSecondaryMeta, mBetweenMeta, mSporadicMeta; - public BW_WorldGenRoss128(String aName, boolean aDefault, int aMinY, int aMaxY, int aWeight, int aDensity, int aSize, ISubTagContainer top, ISubTagContainer bottom, ISubTagContainer between, ISubTagContainer sprinkled) { - super(aName, sList, aDefault); - this.mMinY = (short) aMinY; - this.mMaxY = (short) aMaxY; - this.mWeight = (short) aWeight; - this.mDensity = (short) aDensity; - this.mSize = (short) Math.max(1, aSize); - - if (mEnabled) - sWeight += this.mWeight; - if (top instanceof Werkstoff) - bwOres = (byte) (bwOres | 0b1000); - if (bottom instanceof Werkstoff) - bwOres = (byte) (bwOres | 0b0100); - if (between instanceof Werkstoff) - bwOres = (byte) (bwOres | 0b0010); - if (sprinkled instanceof Werkstoff) - bwOres = (byte) (bwOres | 0b0001); +public class BW_WorldGenRoss128 extends BW_OreLayer { - short aPrimary = top instanceof Materials ? - (short) ((Materials) top).mMetaItemSubID : - top instanceof Werkstoff ? - (short) ((Werkstoff) top).getmID() : - 0; - short aSecondary = bottom instanceof Materials ? - (short) ((Materials) bottom).mMetaItemSubID : - bottom instanceof Werkstoff ? - (short) ((Werkstoff) bottom).getmID() : - 0; - short aBetween = between instanceof Materials ? - (short) ((Materials) between).mMetaItemSubID : - between instanceof Werkstoff ? - (short) ((Werkstoff) between).getmID() : - 0; - short aSporadic = sprinkled instanceof Materials ? - (short) ((Materials) sprinkled).mMetaItemSubID : - sprinkled instanceof Werkstoff ? - (short) ((Werkstoff) sprinkled).getmID() : - 0; - this.mPrimaryMeta = (short) aPrimary; - this.mSecondaryMeta = (short) aSecondary; - this.mBetweenMeta = (short) aBetween; - this.mSporadicMeta = (short) aSporadic; + public BW_WorldGenRoss128(String aName, boolean aDefault, int aMinY, int aMaxY, int aWeight, int aDensity, int aSize, ISubTagContainer top, ISubTagContainer bottom, ISubTagContainer between, ISubTagContainer sprinkled) { + super(aName, aDefault, aMinY, aMaxY, aWeight, aDensity, aSize, top, bottom, between, sprinkled); } public static void init_OresRoss128() { @@ -108,9 +51,9 @@ public class BW_WorldGenRoss128 extends GT_Worldgen { new BW_WorldGenRoss128("ore.mix.ross128.Roquesit", true, 5, 250, 3, 1, 12, WerkstoffLoader.Arsenopyrite, WerkstoffLoader.Ferberite, WerkstoffLoader.Loellingit, WerkstoffLoader.Roquesit); new BW_WorldGenRoss128("ore.mix.ross128.Tungstate", true, 5, 250, 10, 4, 14, WerkstoffLoader.Ferberite, WerkstoffLoader.Huebnerit, WerkstoffLoader.Loellingit, Materials.Scheelite); new BW_WorldGenRoss128("ore.mix.ross128.CopperSulfits", true, 40, 70, 80, 3, 24, WerkstoffLoader.Djurleit, WerkstoffLoader.Bornite, WerkstoffLoader.Wittichenit, Materials.Tetrahedrite); - new BW_WorldGenRoss128("ore.mix.ross128.magnetite", true, 60, 180, 50, 2, 32, Materials.Magnetite, Materials.Magnetite, Materials.Iron, Materials.VanadiumMagnetite); - new BW_WorldGenRoss128("ore.mix.ross128.gold", true, 30, 60, 50, 2, 32, Materials.Magnetite, Materials.Magnetite, Materials.VanadiumMagnetite, Materials.Gold); - new BW_WorldGenRoss128("ore.mix.ross128.iron", true, 10, 40, 40, 3, 24, Materials.BrownLimonite, Materials.YellowLimonite, Materials.BandedIron, Materials.Malachite); + new BW_WorldGenRoss128("ore.mix.ross128.Forsterit", true, 60, 180, 50, 2, 32, WerkstoffLoader.Forsterit, WerkstoffLoader.Fayalit, WerkstoffLoader.DescolizitCUVO4, WerkstoffLoader.DescolizitZNVO4); + new BW_WorldGenRoss128("ore.mix.ross128.Hedenbergit", true, 30, 60, 50, 2, 32, WerkstoffLoader.Hedenbergit, WerkstoffLoader.Fayalit, WerkstoffLoader.DescolizitZNVO4, WerkstoffLoader.Forsterit); + new BW_WorldGenRoss128("ore.mix.ross128.RedZircon", true, 10, 40, 40, 3, 24, WerkstoffLoader.Fayalit,WerkstoffLoader.FuchsitAL , WerkstoffLoader.RedZircon,WerkstoffLoader.FuchsitCR); } public static void init_undergroundFluidsRoss128() { @@ -123,61 +66,7 @@ public class BW_WorldGenRoss128 extends GT_Worldgen { @Override public boolean isGenerationAllowed(World aWorld, int aDimensionType, int aAllowedDimensionType) { - return aWorld.provider instanceof WorldProviderRoss128b; - } - - @Override - public boolean executeWorldgen(World aWorld, Random aRandom, String aBiome, int aDimensionType, int aChunkX, int aChunkZ, IChunkProvider aChunkGenerator, IChunkProvider aChunkProvider) { - { - int tMinY = this.mMinY + aRandom.nextInt(this.mMaxY - this.mMinY - 5); - int cX = aChunkX - aRandom.nextInt(this.mSize); - int eX = aChunkX + 16 + aRandom.nextInt(this.mSize); - - for (int tX = cX; tX <= eX; ++tX) { - int cZ = aChunkZ - aRandom.nextInt(this.mSize); - int eZ = aChunkZ + 16 + aRandom.nextInt(this.mSize); - - for (int tZ = cZ; tZ <= eZ; ++tZ) { - int i; - if (this.mSecondaryMeta > 0) { - for (i = tMinY - 1; i < tMinY + 2; ++i) { - if (aRandom.nextInt(Math.max(1, Math.max(MathHelper.abs_int(cZ - tZ), MathHelper.abs_int(eZ - tZ)) / this.mDensity)) == 0 || aRandom.nextInt(Math.max(1, Math.max(MathHelper.abs_int(cX - tX), MathHelper.abs_int(eX - tX)) / this.mDensity)) == 0) { - setOreBlock(aWorld, tX, i, tZ, this.mSecondaryMeta, false); - } - } - } - - if (this.mBetweenMeta > 0 && (aRandom.nextInt(Math.max(1, Math.max(MathHelper.abs_int(cZ - tZ), MathHelper.abs_int(eZ - tZ)) / this.mDensity)) == 0 || aRandom.nextInt(Math.max(1, Math.max(MathHelper.abs_int(cX - tX), MathHelper.abs_int(eX - tX)) / this.mDensity)) == 0)) { - setOreBlock(aWorld, tX, tMinY + 2 + aRandom.nextInt(2), tZ, this.mBetweenMeta, false); - } - - if (this.mPrimaryMeta > 0) { - for (i = tMinY + 3; i < tMinY + 6; ++i) { - if (aRandom.nextInt(Math.max(1, Math.max(MathHelper.abs_int(cZ - tZ), MathHelper.abs_int(eZ - tZ)) / this.mDensity)) == 0 || aRandom.nextInt(Math.max(1, Math.max(MathHelper.abs_int(cX - tX), MathHelper.abs_int(eX - tX)) / this.mDensity)) == 0) { - setOreBlock(aWorld, tX, i, tZ, this.mPrimaryMeta, false); - } - } - } - - if (this.mSporadicMeta > 0 && (aRandom.nextInt(Math.max(1, Math.max(MathHelper.abs_int(cZ - tZ), MathHelper.abs_int(eZ - tZ)) / this.mDensity)) == 0 || aRandom.nextInt(Math.max(1, Math.max(MathHelper.abs_int(cX - tX), MathHelper.abs_int(eX - tX)) / this.mDensity)) == 0)) { - setOreBlock(aWorld, tX, tMinY - 1 + aRandom.nextInt(7), tZ, this.mSporadicMeta, false); - } - } - } - - if (logOregenRoss128) { - MainMod.LOGGER.info("Generated Orevein: " + this.mWorldGenName + " " + aChunkX + " " + aChunkZ); - } - - return true; - } - } - - public boolean setOreBlock(World aWorld, int aX, int aY, int aZ, int aMetaData, boolean isSmallOre) { - if ((aMetaData == mSporadicMeta && (bwOres & 0b0001) != 0) || (aMetaData == mBetweenMeta && (bwOres & 0b0010) != 0) || (aMetaData == mPrimaryMeta && (bwOres & 0b1000) != 0) || (aMetaData == mSecondaryMeta && (bwOres & 0b0100) != 0)) { - return BW_MetaGenerated_Ores.setOreBlock(aWorld, aX, aY, aZ, aMetaData, false); - } - return GT_TileEntity_Ores.setOreBlock(aWorld, aX, aY, aZ, aMetaData, isSmallOre, false); + return aWorld.provider.dimensionId == Ross128.ross128ID; } } diff --git a/src/main/resources/assets/bartworks/lang/en_US.lang b/src/main/resources/assets/bartworks/lang/en_US.lang index 773214b1f7..d7976f0caa 100644 --- a/src/main/resources/assets/bartworks/lang/en_US.lang +++ b/src/main/resources/assets/bartworks/lang/en_US.lang @@ -55,6 +55,7 @@ BW_GlasBlocks.8.name=Colored Borosilicate Glass Block (Purple) BW_GlasBlocks.9.name=Colored Borosilicate Glass Block (Yellow) BW_GlasBlocks.10.name=Colored Borosilicate Glass Block (Light Green) BW_GlasBlocks.11.name=Colored Borosilicate Glass Block (Brown) +BW_GlasBlocks.12.name=Thorium Yttrium Glass Block tooltip.glas.0.name=Glass-Tier: tooltip.LESU.0.name=Maximum Capacity! diff --git a/src/main/resources/assets/bartworks/textures/blocks/ThoriumYttriumGlass.png b/src/main/resources/assets/bartworks/textures/blocks/ThoriumYttriumGlass.png Binary files differnew file mode 100644 index 0000000000..5d97902f87 --- /dev/null +++ b/src/main/resources/assets/bartworks/textures/blocks/ThoriumYttriumGlass.png |