diff options
author | Raven Szewczyk <git@eigenraven.me> | 2024-05-24 19:50:35 +0100 |
---|---|---|
committer | Raven Szewczyk <git@eigenraven.me> | 2024-05-24 19:50:35 +0100 |
commit | 6d1b2216464d4dad449ac6fcfec476832224a55e (patch) | |
tree | 526a0c15f7056313c80e6c0386e025e9b3f61781 /gtpp/src/main/java/gtPlusPlus/xmod | |
parent | b5d35f40afa606ed1b07061dad82e0521a59c186 (diff) | |
download | GT5-Unofficial-6d1b2216464d4dad449ac6fcfec476832224a55e.tar.gz GT5-Unofficial-6d1b2216464d4dad449ac6fcfec476832224a55e.tar.bz2 GT5-Unofficial-6d1b2216464d4dad449ac6fcfec476832224a55e.zip |
Merge addon sources
Diffstat (limited to 'gtpp/src/main/java/gtPlusPlus/xmod')
340 files changed, 0 insertions, 71691 deletions
diff --git a/gtpp/src/main/java/gtPlusPlus/xmod/bartcrops/HANDLER_CropsPlusPlus.java b/gtpp/src/main/java/gtPlusPlus/xmod/bartcrops/HANDLER_CropsPlusPlus.java deleted file mode 100644 index 9ca5488280..0000000000 --- a/gtpp/src/main/java/gtPlusPlus/xmod/bartcrops/HANDLER_CropsPlusPlus.java +++ /dev/null @@ -1,16 +0,0 @@ -package gtPlusPlus.xmod.bartcrops; - -import cpw.mods.fml.common.event.FMLPostInitializationEvent; -import cpw.mods.fml.common.event.FMLPreInitializationEvent; - -public class HANDLER_CropsPlusPlus { - - public static void preInit(FMLPreInitializationEvent preinit) { - LoaderOfTheCrops.load(preinit); - } - - public static void postInit(FMLPostInitializationEvent postinit) { - LoaderOfTheCrops.register(); - LoaderOfTheCrops.registerBaseSeed(); - } -} diff --git a/gtpp/src/main/java/gtPlusPlus/xmod/bartcrops/LoaderOfTheCrops.java b/gtpp/src/main/java/gtPlusPlus/xmod/bartcrops/LoaderOfTheCrops.java deleted file mode 100644 index c3c2f0b6cc..0000000000 --- a/gtpp/src/main/java/gtPlusPlus/xmod/bartcrops/LoaderOfTheCrops.java +++ /dev/null @@ -1,109 +0,0 @@ -package gtPlusPlus.xmod.bartcrops; - -import java.util.ArrayList; -import java.util.List; - -import net.minecraft.item.Item; -import net.minecraft.item.ItemStack; - -import cpw.mods.fml.common.event.FMLPreInitializationEvent; -import gtPlusPlus.core.util.minecraft.ItemUtils; -import gtPlusPlus.xmod.bartcrops.crops.Crop_Hemp; -import ic2.api.crops.CropCard; -import ic2.api.crops.Crops; - -/** - * Mostly borrowed from the Crops++ Crop Loader. - * - * @author Alkalus - */ -public class LoaderOfTheCrops { - - private static List<Boolean> mHasCropObj = new ArrayList<>(); - private CropCard mCropObj; - private ItemStack mBaseSeed; - private static List<LoaderOfTheCrops> mCropList = cropLoader(); - - public LoaderOfTheCrops(CropCard cropObj) { - this.mCropObj = cropObj; - } - - public LoaderOfTheCrops(CropCard cropObj, ItemStack baseseed) { - this.mCropObj = cropObj; - this.mBaseSeed = baseseed; - } - - public static CropCard cropUnpackerCC(LoaderOfTheCrops inp) { - return inp.mCropObj; - } - - private static ItemStack cropUnpackerCG(LoaderOfTheCrops inp) { - return inp.mBaseSeed; - } - - private static LoaderOfTheCrops cropHelper(CropCard cropObj) { - return new LoaderOfTheCrops(cropObj, ItemUtils.getItemStackOfAmountFromOreDict("crop" + cropObj.name(), 0)); - } - - public static List<LoaderOfTheCrops> cropLoader() { - List<LoaderOfTheCrops> p = new ArrayList<>(); - - p.add(new LoaderOfTheCrops(new Crop_Hemp(), new ItemStack(Item.getItemById(111), 3))); - - return p; - } - - private static List<CropCard> cropObjs() { - List<CropCard> p = new ArrayList<>(); - - for (LoaderOfTheCrops loaderOfTheCrops : mCropList) { - p.add(cropUnpackerCC((LoaderOfTheCrops) loaderOfTheCrops)); - } - - return p; - } - - private static List<ItemStack> setBaseSeed() { - List<ItemStack> p = new ArrayList<>(); - - for (LoaderOfTheCrops loaderOfTheCrops : mCropList) { - p.add(cropUnpackerCG((LoaderOfTheCrops) loaderOfTheCrops)); - } - - return p; - } - - private static List<String> setnames() { - List<String> s = new ArrayList<>(); - - for (int i = 0; i < mCropList.size(); ++i) { - s.add(((CropCard) cropObjs().get(i)).name()); - } - - return s; - } - - public static void load(FMLPreInitializationEvent preinit) { - for (int i = 0; i < mCropList.size(); ++i) { - mHasCropObj.add(true); - } - } - - public static void register() { - for (int i = 0; i < mCropList.size(); ++i) { - if ((Boolean) mHasCropObj.get(i) && cropObjs().get(i) != null) { - Crops.instance.registerCrop((CropCard) cropObjs().get(i)); - } - } - } - - public static void registerBaseSeed() { - List<ItemStack> baseseed = new ArrayList<>(setBaseSeed()); - - for (int i = 0; i < mCropList.size(); ++i) { - if (baseseed.get(i) != null && cropObjs().get(i) != null) { - Crops.instance.registerBaseSeed((ItemStack) baseseed.get(i), (CropCard) cropObjs().get(i), 1, 1, 1, 1); - } - } - } -} diff --git a/gtpp/src/main/java/gtPlusPlus/xmod/bartcrops/abstracts/BaseAestheticCrop.java b/gtpp/src/main/java/gtPlusPlus/xmod/bartcrops/abstracts/BaseAestheticCrop.java deleted file mode 100644 index c794c40878..0000000000 --- a/gtpp/src/main/java/gtPlusPlus/xmod/bartcrops/abstracts/BaseAestheticCrop.java +++ /dev/null @@ -1,34 +0,0 @@ -package gtPlusPlus.xmod.bartcrops.abstracts; - -import gtPlusPlus.preloader.CORE_Preloader; -import ic2.api.crops.ICropTile; - -public abstract class BaseAestheticCrop extends BaseHarvestableCrop { - - @Override - public int tier() { - return 1; - } - - @Override - public int stat(int n) { - return switch (n) { - case 0 -> 0; - case 1 -> 0; - case 2 -> 0; - case 3 -> 4; - case 4 -> 0; - default -> 0; - }; - } - - @Override - public int growthDuration(ICropTile crop) { - return CORE_Preloader.DEBUG_MODE ? 1 : 225; - } - - @Override - public byte getSizeAfterHarvest(ICropTile crop) { - return 1; - } -} diff --git a/gtpp/src/main/java/gtPlusPlus/xmod/bartcrops/abstracts/BaseCrop.java b/gtpp/src/main/java/gtPlusPlus/xmod/bartcrops/abstracts/BaseCrop.java deleted file mode 100644 index 405c1ef1e1..0000000000 --- a/gtpp/src/main/java/gtPlusPlus/xmod/bartcrops/abstracts/BaseCrop.java +++ /dev/null @@ -1,67 +0,0 @@ -package gtPlusPlus.xmod.bartcrops.abstracts; - -import static gregtech.api.enums.Mods.GTPlusPlus; - -import java.util.ArrayList; -import java.util.Arrays; -import java.util.List; - -import net.minecraft.client.renderer.texture.IIconRegister; -import net.minecraft.item.ItemStack; -import net.minecraft.util.IIcon; - -import cpw.mods.fml.relauncher.Side; -import cpw.mods.fml.relauncher.SideOnly; -import gtPlusPlus.core.util.minecraft.ItemUtils; -import ic2.api.crops.CropCard; -import ic2.api.crops.ICropTile; -import speiger.src.crops.api.ICropCardInfo; - -public abstract class BaseCrop extends CropCard implements ICropCardInfo { - - @Override - @SideOnly(Side.CLIENT) - public void registerSprites(IIconRegister iconRegister) { - this.textures = new IIcon[this.maxSize()]; - for (int i = 1; i <= this.textures.length; ++i) { - this.textures[i - 1] = iconRegister - .registerIcon(GTPlusPlus.ID + ":crop/blockCrop." + this.name() + "." + i); - } - } - - @Override - public float dropGainChance() { - return (float) (Math.pow(0.95D, (double) ((float) this.tier())) * (double) 1f); - } - - @Override - public boolean canCross(ICropTile crop) { - return crop.getSize() == this.maxSize(); - } - - @Override - public int getrootslength(ICropTile crop) { - return 3; - } - - @Override - public String discoveredBy() { - return "Alkalus"; - } - - @Override - public String owner() { - return "Gtplusplus"; - } - - @Override - public List<String> getCropInformation() { - List<String> ret = new ArrayList<>(); - ret.add(Arrays.toString(this.attributes())); - return ret; - } - - public ItemStack getDisplayItem(CropCard card) { - return ItemUtils.getItemStackOfAmountFromOreDict("crop" + this.name(), 0); - } -} diff --git a/gtpp/src/main/java/gtPlusPlus/xmod/bartcrops/abstracts/BaseHarvestableCrop.java b/gtpp/src/main/java/gtPlusPlus/xmod/bartcrops/abstracts/BaseHarvestableCrop.java deleted file mode 100644 index 80325edff0..0000000000 --- a/gtpp/src/main/java/gtPlusPlus/xmod/bartcrops/abstracts/BaseHarvestableCrop.java +++ /dev/null @@ -1,73 +0,0 @@ -package gtPlusPlus.xmod.bartcrops.abstracts; - -import gtPlusPlus.preloader.CORE_Preloader; -import ic2.api.crops.ICropTile; - -public abstract class BaseHarvestableCrop extends BaseCrop { - - @Override - public int tier() { - return 2; - } - - @Override - public int stat(int n) { - return switch (n) { - case 0 -> 0; - case 1 -> 4; - case 2 -> 0; - case 3 -> 4; - case 4 -> 0; - default -> 0; - }; - } - - @Override - public boolean canGrow(ICropTile crop) { - return crop.getSize() < 3; - } - - @Override - public int getOptimalHavestSize(ICropTile crop) { - return 3; - } - - @Override - public boolean canBeHarvested(ICropTile crop) { - return crop.getSize() == 3; - } - - @Override - public int weightInfluences(ICropTile crop, float humidity, float nutrients, float air) { - return (int) ((double) humidity * 1.2D + (double) nutrients * 0.9D + (double) air * 0.9D); - } - - @Override - public int growthDuration(ICropTile crop) { - short r; - if (CORE_Preloader.DEBUG_MODE) { - r = 1; - } else if (crop.getSize() == 2) { - r = 200; - } else { - r = 700; - } - - return r; - } - - @Override - public byte getSizeAfterHarvest(ICropTile crop) { - return 2; - } - - @Override - public int maxSize() { - return 3; - } - - @Override - public String discoveredBy() { - return "Alkalus"; - } -} diff --git a/gtpp/src/main/java/gtPlusPlus/xmod/bartcrops/crops/Crop_Hemp.java b/gtpp/src/main/java/gtPlusPlus/xmod/bartcrops/crops/Crop_Hemp.java deleted file mode 100644 index f5bf252edb..0000000000 --- a/gtpp/src/main/java/gtPlusPlus/xmod/bartcrops/crops/Crop_Hemp.java +++ /dev/null @@ -1,41 +0,0 @@ -package gtPlusPlus.xmod.bartcrops.crops; - -import net.minecraft.init.Items; -import net.minecraft.item.ItemStack; - -import gtPlusPlus.core.util.math.MathUtils; -import gtPlusPlus.xmod.bartcrops.abstracts.BaseAestheticCrop; -import ic2.api.crops.ICropTile; - -public class Crop_Hemp extends BaseAestheticCrop { - - @Override - public int tier() { - return 2; - } - - @Override - public String name() { - return "Hemp"; - } - - @Override - public int growthDuration(ICropTile crop) { - return 550; - } - - @Override - public String[] attributes() { - return new String[] { "Green", "Soil", "Orange" }; - } - - @Override - public ItemStack getGain(ICropTile crop) { - return new ItemStack(Items.string, MathUtils.randInt(1, 3), 0); - } - - @Override - public ItemStack getDisplayItem() { - return new ItemStack(Items.string, 1, 0); - } -} diff --git a/gtpp/src/main/java/gtPlusPlus/xmod/bartworks/BW_Utils.java b/gtpp/src/main/java/gtPlusPlus/xmod/bartworks/BW_Utils.java deleted file mode 100644 index e3fdc9ae0a..0000000000 --- a/gtpp/src/main/java/gtPlusPlus/xmod/bartworks/BW_Utils.java +++ /dev/null @@ -1,17 +0,0 @@ -package gtPlusPlus.xmod.bartworks; - -import net.minecraft.item.ItemStack; - -import com.github.bartimaeusnek.bartworks.system.material.Werkstoff; -import com.github.bartimaeusnek.bartworks.system.material.WerkstoffLoader; - -import gregtech.api.enums.OrePrefixes; - -public class BW_Utils { - - public static ItemStack getCorrespondingItemStack(OrePrefixes orePrefixes, short werkstoffID, int amount) { - Werkstoff werkstoff = Werkstoff.werkstoffHashMap.get(werkstoffID); - if (werkstoff == null) return null; - return WerkstoffLoader.getCorrespondingItemStackUnsafe(orePrefixes, werkstoff, amount); - } -} diff --git a/gtpp/src/main/java/gtPlusPlus/xmod/bop/HANDLER_BiomesOPlenty.java b/gtpp/src/main/java/gtPlusPlus/xmod/bop/HANDLER_BiomesOPlenty.java deleted file mode 100644 index 7727eaef38..0000000000 --- a/gtpp/src/main/java/gtPlusPlus/xmod/bop/HANDLER_BiomesOPlenty.java +++ /dev/null @@ -1,178 +0,0 @@ -package gtPlusPlus.xmod.bop; - -import static gregtech.api.enums.Mods.BiomesOPlenty; - -import java.lang.reflect.Field; - -import net.minecraft.block.Block; -import net.minecraft.item.Item; -import net.minecraft.item.ItemStack; - -import gtPlusPlus.core.util.minecraft.ItemUtils; -import gtPlusPlus.core.util.reflect.ReflectionUtils; -import gtPlusPlus.xmod.bop.blocks.BOP_Block_Registrator; - -public class HANDLER_BiomesOPlenty { - - public static Item mPineCone; - - public static Block logs1; - public static Block logs2; - public static Block logs3; - public static Block logs4; - - public static Block leaves1; - public static Block leaves2; - public static Block leaves3; - public static Block leaves4; - - public static Block colorizedLeaves1; - public static Block colorizedLeaves2; - - public static Block saplings; - public static Block colorizedSaplings; - - public static void preInit() { - BOP_Block_Registrator.run(); - if (BiomesOPlenty.isModLoaded()) { - setFields(); - registerPineconeToOreDict(); - } - } - - public static void postInit() { - BOP_Block_Registrator.recipes(); - } - - private static void registerPineconeToOreDict() { - if (mPineCone != null) { - ItemStack aPinecone = ItemUtils.simpleMetaStack(mPineCone, 13, 1); - if (aPinecone != null) { - ItemUtils.addItemToOreDictionary(aPinecone, "pinecone"); - } - } - } - - public static ItemStack getStack(Block aBlock, int aMeta, int aSize) { - return ItemUtils.simpleMetaStack(aBlock, aMeta, aSize); - } - - // BOPCBlocks.logs4 - 0 - // BOPCBlocks.colorizedLeaves2 - 1 - - private static void setFields() { - Field aBopMiscItem = ReflectionUtils - .getField(ReflectionUtils.getClass("biomesoplenty.api.content.BOPCItems"), "misc"); - - Field aBopBlock1 = ReflectionUtils - .getField(ReflectionUtils.getClass("biomesoplenty.api.content.BOPCBlocks"), "logs1"); - Field aBopBlock2 = ReflectionUtils - .getField(ReflectionUtils.getClass("biomesoplenty.api.content.BOPCBlocks"), "logs2"); - Field aBopBlock3 = ReflectionUtils - .getField(ReflectionUtils.getClass("biomesoplenty.api.content.BOPCBlocks"), "logs3"); - Field aBopBlock4 = ReflectionUtils - .getField(ReflectionUtils.getClass("biomesoplenty.api.content.BOPCBlocks"), "logs4"); - - Field aBopLeaves1 = ReflectionUtils - .getField(ReflectionUtils.getClass("biomesoplenty.api.content.BOPCBlocks"), "leaves1"); - Field aBopLeaves2 = ReflectionUtils - .getField(ReflectionUtils.getClass("biomesoplenty.api.content.BOPCBlocks"), "leaves2"); - Field aBopLeaves3 = ReflectionUtils - .getField(ReflectionUtils.getClass("biomesoplenty.api.content.BOPCBlocks"), "leaves3"); - Field aBopLeaves4 = ReflectionUtils - .getField(ReflectionUtils.getClass("biomesoplenty.api.content.BOPCBlocks"), "leaves4"); - - Field aBopColouredLeaves1 = ReflectionUtils - .getField(ReflectionUtils.getClass("biomesoplenty.api.content.BOPCBlocks"), "colorizedLeaves1"); - Field aBopColouredLeaves2 = ReflectionUtils - .getField(ReflectionUtils.getClass("biomesoplenty.api.content.BOPCBlocks"), "colorizedLeaves2"); - - Field aBopSapling = ReflectionUtils - .getField(ReflectionUtils.getClass("biomesoplenty.api.content.BOPCBlocks"), "saplings"); - Field aBopColouredSapling = ReflectionUtils - .getField(ReflectionUtils.getClass("biomesoplenty.api.content.BOPCBlocks"), "colorizedSaplings"); - - if (aBopMiscItem != null) { - Item aMiscItem = ReflectionUtils.getFieldValue(aBopMiscItem); - if (aMiscItem != null) { - mPineCone = aMiscItem; - } - } - - if (aBopBlock1 != null) { - Block aBlock = ReflectionUtils.getFieldValue(aBopBlock1); - if (aBlock != null) { - logs1 = aBlock; - } - } - if (aBopBlock2 != null) { - Block aBlock = ReflectionUtils.getFieldValue(aBopBlock2); - if (aBlock != null) { - logs2 = aBlock; - } - } - if (aBopBlock3 != null) { - Block aBlock = ReflectionUtils.getFieldValue(aBopBlock3); - if (aBlock != null) { - logs3 = aBlock; - } - } - if (aBopBlock4 != null) { - Block aBlock = ReflectionUtils.getFieldValue(aBopBlock4); - if (aBlock != null) { - logs4 = aBlock; - } - } - - if (aBopLeaves1 != null) { - Block aBlock = ReflectionUtils.getFieldValue(aBopLeaves1); - if (aBlock != null) { - leaves1 = aBlock; - } - } - if (aBopLeaves2 != null) { - Block aBlock = ReflectionUtils.getFieldValue(aBopLeaves2); - if (aBlock != null) { - leaves2 = aBlock; - } - } - if (aBopLeaves3 != null) { - Block aBlock = ReflectionUtils.getFieldValue(aBopLeaves3); - if (aBlock != null) { - leaves3 = aBlock; - } - } - if (aBopLeaves4 != null) { - Block aBlock = ReflectionUtils.getFieldValue(aBopLeaves4); - if (aBlock != null) { - leaves4 = aBlock; - } - } - - if (aBopColouredLeaves1 != null) { - Block aBlock = ReflectionUtils.getFieldValue(aBopColouredLeaves1); - if (aBlock != null) { - colorizedLeaves1 = aBlock; - } - } - if (aBopColouredLeaves2 != null) { - Block aBlock = ReflectionUtils.getFieldValue(aBopColouredLeaves2); - if (aBlock != null) { - colorizedLeaves2 = aBlock; - } - } - - if (aBopSapling != null) { - Block aBlock = ReflectionUtils.getFieldValue(aBopSapling); - if (aBlock != null) { - saplings = aBlock; - } - } - if (aBopColouredSapling != null) { - Block aBlock = ReflectionUtils.getFieldValue(aBopColouredSapling); - if (aBlock != null) { - colorizedSaplings = aBlock; - } - } - } -} diff --git a/gtpp/src/main/java/gtPlusPlus/xmod/bop/blocks/BOP_Block_Registrator.java b/gtpp/src/main/java/gtPlusPlus/xmod/bop/blocks/BOP_Block_Registrator.java deleted file mode 100644 index 4a3c91e9cb..0000000000 --- a/gtpp/src/main/java/gtPlusPlus/xmod/bop/blocks/BOP_Block_Registrator.java +++ /dev/null @@ -1,173 +0,0 @@ -package gtPlusPlus.xmod.bop.blocks; - -import static gregtech.api.recipe.RecipeMaps.cutterRecipes; -import static gregtech.api.util.GT_RecipeBuilder.SECONDS; -import static gregtech.loaders.oreprocessing.ProcessingLog.addPyrolyeOvenRecipes; - -import net.minecraft.block.Block; -import net.minecraft.init.Blocks; -import net.minecraft.init.Items; -import net.minecraft.item.Item; -import net.minecraft.item.ItemStack; - -import gregtech.GT_Mod; -import gregtech.api.enums.GT_Values; -import gregtech.api.enums.Materials; -import gregtech.api.enums.OrePrefixes; -import gregtech.api.util.GT_ModHandler; -import gregtech.api.util.GT_OreDictUnificator; -import gregtech.api.util.GT_Utility; -import gtPlusPlus.core.recipe.common.CI; -import gtPlusPlus.core.util.minecraft.ItemUtils; -import gtPlusPlus.core.util.minecraft.RecipeUtils; -import gtPlusPlus.xmod.bop.blocks.pine.LeavesPineTree; -import gtPlusPlus.xmod.bop.blocks.pine.LogPineTree; -import gtPlusPlus.xmod.bop.blocks.pine.SaplingPineTree; -import gtPlusPlus.xmod.bop.blocks.rainforest.LeavesRainforestTree; -import gtPlusPlus.xmod.bop.blocks.rainforest.LogRainforestTree; -import gtPlusPlus.xmod.bop.blocks.rainforest.SaplingRainforestTree; - -public class BOP_Block_Registrator { - - public static Block log_Rainforest; - public static Block leaves_Rainforest; - public static Block sapling_Rainforest; - public static Block log_Pine; - public static Block leaves_Pine; - public static Block sapling_Pine; - - // Runs Each tree Type separately - public static void run() { - registerTree_Rainforest(); - registerTree_Pine(); - } - - private static void registerTree_Rainforest() { - log_Rainforest = new LogRainforestTree(); - leaves_Rainforest = new LeavesRainforestTree(); - sapling_Rainforest = new SaplingRainforestTree(); - ItemUtils.addItemToOreDictionary(ItemUtils.getSimpleStack(log_Rainforest), "logWood", true); - ItemUtils.addItemToOreDictionary(ItemUtils.getSimpleStack(leaves_Rainforest), "treeLeaves", true); - ItemUtils.addItemToOreDictionary(ItemUtils.getSimpleStack(sapling_Rainforest), "treeSapling", true); - } - - private static void registerTree_Pine() { - log_Pine = new LogPineTree(); - leaves_Pine = new LeavesPineTree(); - sapling_Pine = new SaplingPineTree(); - ItemUtils.addItemToOreDictionary(ItemUtils.getSimpleStack(log_Pine), "logWood", true); - ItemUtils.addItemToOreDictionary(ItemUtils.getSimpleStack(leaves_Pine), "treeLeaves", true); - ItemUtils.addItemToOreDictionary(ItemUtils.getSimpleStack(sapling_Pine), "treeSapling", true); - } - - public static void recipes() { - // Rainforest Oak - addLogRecipes(ItemUtils.getSimpleStack(log_Rainforest)); - // Pine - addLogRecipes(ItemUtils.getSimpleStack(log_Pine)); - } - - public static void addLogRecipes(final ItemStack aStack) { - RecipeUtils.addShapelessGregtechRecipe( - new ItemStack[] { aStack }, - ItemUtils - .getSimpleStack(Item.getItemFromBlock(Blocks.planks), GT_Mod.gregtechproxy.mNerfedWoodPlank ? 2 : 4)); - RecipeUtils.recipeBuilder( - CI.craftingToolSaw, - null, - null, - aStack, - null, - null, - null, - null, - null, - ItemUtils.getSimpleStack(Item.getItemFromBlock(Blocks.planks), 4)); - GT_ModHandler.addCraftingRecipe( - GT_OreDictUnificator.get(OrePrefixes.stickLong, Materials.Wood, 2L), - GT_ModHandler.RecipeBits.DO_NOT_CHECK_FOR_COLLISIONS | GT_ModHandler.RecipeBits.BUFFERED, - new Object[] { "sLf", 'L', GT_Utility.copyAmount(1L, aStack) }); - - final short aMeta = (short) aStack.getItemDamage(); - if (GT_Utility.areStacksEqual( - GT_ModHandler.getSmeltingOutput(GT_Utility.copyAmount(1L, aStack), false, null), - new ItemStack(Items.coal, 1, 1))) { - addPyrolyeOvenRecipes(aStack); - GT_ModHandler.removeFurnaceSmelting(GT_Utility.copyAmount(1L, aStack)); - } - if (aMeta == 32767) { - for (int i = 0; i < 32767; ++i) { - if (GT_Utility.areStacksEqual( - GT_ModHandler.getSmeltingOutput(new ItemStack(aStack.getItem(), 1, i), false, null), - new ItemStack(Items.coal, 1, 1))) { - addPyrolyeOvenRecipes(aStack); - GT_ModHandler.removeFurnaceSmelting(new ItemStack(aStack.getItem(), 1, i)); - } - final ItemStack tStack = GT_ModHandler.getRecipeOutput(new ItemStack(aStack.getItem(), 1, i)); - if (tStack == null) { - if (i >= 16) { - break; - } - } else { - final ItemStack tPlanks = GT_Utility.copy(tStack); - tPlanks.stackSize = tPlanks.stackSize * 3 / 2; - GT_Values.RA.stdBuilder() - .itemInputs(new ItemStack(aStack.getItem(), 1, i)) - .itemOutputs( - GT_Utility.copyAmount( - GT_Mod.gregtechproxy.mNerfedWoodPlank ? ((long) tStack.stackSize) - : (((long) tStack.stackSize) * 5L / 4), - tStack), - GT_OreDictUnificator.get(OrePrefixes.dust, Materials.Wood, 2L)) - .duration(10 * SECONDS) - .eut(8) - .addTo(cutterRecipes); - GT_ModHandler.removeRecipe(new ItemStack(aStack.getItem(), 1, i)); - GT_ModHandler.addCraftingRecipe( - GT_Utility.copyAmount( - GT_Mod.gregtechproxy.mNerfedWoodPlank ? ((long) tStack.stackSize) - : (((long) tStack.stackSize) * 5L / 4), - tStack), - new Object[] { "s", "L", 'L', new ItemStack(aStack.getItem(), 1, i) }); - GT_ModHandler.addShapelessCraftingRecipe( - GT_Utility - .copyAmount(tStack.stackSize / (GT_Mod.gregtechproxy.mNerfedWoodPlank ? 2 : 1), tStack), - new Object[] { new ItemStack(aStack.getItem(), 1, i) }); - } - } - } else { - final ItemStack tStack2 = GT_ModHandler.getRecipeOutput(GT_Utility.copyAmount(1L, aStack)); - if (tStack2 != null) { - final ItemStack tPlanks2 = GT_Utility.copy(tStack2); - tPlanks2.stackSize = tPlanks2.stackSize * 3 / 2; - GT_Values.RA.stdBuilder() - .itemInputs(GT_Utility.copyAmount(1L, aStack)) - .itemOutputs( - GT_Utility.copyAmount( - GT_Mod.gregtechproxy.mNerfedWoodPlank ? ((long) tStack2.stackSize) - : (((long) tStack2.stackSize) * 5L / 4), - tStack2), - GT_OreDictUnificator.get(OrePrefixes.dust, Materials.Wood, 2L)) - .duration(10 * SECONDS) - .eut(8) - .addTo(cutterRecipes); - GT_ModHandler.removeRecipe(GT_Utility.copyAmount(1L, aStack)); - GT_ModHandler.addCraftingRecipe( - GT_Utility.copyAmount( - GT_Mod.gregtechproxy.mNerfedWoodPlank ? ((long) tStack2.stackSize) - : (((long) tStack2.stackSize) * 5L / 4), - tStack2), - new Object[] { "s", "L", 'L', GT_Utility.copyAmount(1L, aStack) }); - GT_ModHandler.addShapelessCraftingRecipe( - GT_Utility.copyAmount(tStack2.stackSize / (GT_Mod.gregtechproxy.mNerfedWoodPlank ? 2 : 1), tStack2), - new Object[] { GT_Utility.copyAmount(1L, aStack) }); - } - } - if (GT_Utility.areStacksEqual( - GT_ModHandler.getSmeltingOutput(GT_Utility.copyAmount(1L, aStack), false, null), - new ItemStack(Items.coal, 1, 1))) { - addPyrolyeOvenRecipes(aStack); - GT_ModHandler.removeFurnaceSmelting(GT_Utility.copyAmount(1L, aStack)); - } - } -} diff --git a/gtpp/src/main/java/gtPlusPlus/xmod/bop/blocks/base/LeavesBase.java b/gtpp/src/main/java/gtPlusPlus/xmod/bop/blocks/base/LeavesBase.java deleted file mode 100644 index 171bb9a58c..0000000000 --- a/gtpp/src/main/java/gtPlusPlus/xmod/bop/blocks/base/LeavesBase.java +++ /dev/null @@ -1,106 +0,0 @@ -package gtPlusPlus.xmod.bop.blocks.base; - -import static gregtech.api.enums.Mods.GTPlusPlus; - -import java.util.List; -import java.util.Random; - -import net.minecraft.block.BlockLeaves; -import net.minecraft.client.renderer.texture.IIconRegister; -import net.minecraft.creativetab.CreativeTabs; -import net.minecraft.init.Blocks; -import net.minecraft.item.Item; -import net.minecraft.item.ItemBlock; -import net.minecraft.item.ItemStack; -import net.minecraft.util.IIcon; -import net.minecraft.world.World; - -import cpw.mods.fml.common.registry.GameRegistry; -import cpw.mods.fml.relauncher.Side; -import cpw.mods.fml.relauncher.SideOnly; -import gtPlusPlus.api.objects.Logger; -import gtPlusPlus.core.creative.AddToCreativeTab; -import gtPlusPlus.core.util.Utils; -import gtPlusPlus.core.util.minecraft.ItemUtils; - -public class LeavesBase extends BlockLeaves { - - protected IIcon[][] leafTextures = new IIcon[2][]; - protected String[][] leafType = new String[][] { {}, {} }; - protected String[] treeType = new String[] {}; - protected ItemStack[] bonusDrops; - - public LeavesBase(String blockNameLocalized, String blockNameUnlocalized, ItemStack[] bonusDrops) { - this.bonusDrops = bonusDrops; - String blockName = "block" + Utils.sanitizeString(blockNameLocalized) + "Leaves"; - GameRegistry.registerBlock(this, ItemBlock.class, blockName); - this.setBlockName(blockName); - ItemUtils.addItemToOreDictionary(ItemUtils.getSimpleStack(this), "treeLeaves", true); - this.setCreativeTab(AddToCreativeTab.tabBOP); - Blocks.fire.setFireInfo(this, 80, 150); - } - - private void setVanillaVariable(Object toSet, Object value) { - toSet = value; - } - - @Override - public int quantityDropped(Random p_149745_1_) { - return p_149745_1_.nextInt(20) == 0 ? 1 : 0; - } - - @Override // Drops when Leaf is broken - protected void func_150124_c(World world, int x, int y, int z, int meta, int randomChance) { - Logger.INFO("Dropping Bonus Drops"); - for (ItemStack bonusDrop : this.bonusDrops) { - if (bonusDrop != null && world.rand.nextInt(randomChance) == 0) { - this.dropBlockAsItem(world, x, y, z, ItemUtils.getSimpleStack(bonusDrop, 1)); - } - } - } - - /** - * returns a list of blocks with the same ID, but different meta (eg: wood returns 4 blocks) - */ - @SuppressWarnings("unchecked") - @Override - @SideOnly(Side.CLIENT) - public void getSubBlocks(Item item, CreativeTabs tab, @SuppressWarnings("rawtypes") List metaList) { - for (int i = 0; i < this.treeType.length; ++i) { - metaList.add(new ItemStack(item, 1, i)); - } - } - - /** - * Gets the block's texture. Args: side, meta - */ - @Override - @SideOnly(Side.CLIENT) - public IIcon getIcon(int ordinalSide, int metaID) { - return (metaID & 3) == 1 ? this.leafTextures[this.field_150127_b][1] - : this.leafTextures[this.field_150127_b][0]; - } - - @Override - public boolean isOpaqueCube() { - return false; - } - - @Override - @SideOnly(Side.CLIENT) - public void registerBlockIcons(IIconRegister iIcon) { - for (int i = 0; i < leafType.length; ++i) { - this.leafTextures[i] = new IIcon[leafType[i].length]; - for (int j = 0; j < leafType[i].length; ++j) { - this.leafTextures[i][j] = iIcon - .registerIcon(GTPlusPlus.ID + ":" + "trees/" + "leaves/" + "leaves_" + leafType[i][j]); - } - } - setVanillaVariable(this.field_150129_M, this.leafTextures); - } - - @Override - public String[] func_150125_e() { - return treeType; - } -} diff --git a/gtpp/src/main/java/gtPlusPlus/xmod/bop/blocks/base/LogBase.java b/gtpp/src/main/java/gtPlusPlus/xmod/bop/blocks/base/LogBase.java deleted file mode 100644 index 2cf8ba1fbc..0000000000 --- a/gtpp/src/main/java/gtPlusPlus/xmod/bop/blocks/base/LogBase.java +++ /dev/null @@ -1,85 +0,0 @@ -package gtPlusPlus.xmod.bop.blocks.base; - -import static gregtech.api.enums.Mods.GTPlusPlus; - -import java.util.List; - -import net.minecraft.block.BlockLog; -import net.minecraft.client.renderer.texture.IIconRegister; -import net.minecraft.creativetab.CreativeTabs; -import net.minecraft.init.Blocks; -import net.minecraft.item.Item; -import net.minecraft.item.ItemBlock; -import net.minecraft.item.ItemStack; -import net.minecraft.util.IIcon; - -import cpw.mods.fml.common.registry.GameRegistry; -import cpw.mods.fml.relauncher.Side; -import cpw.mods.fml.relauncher.SideOnly; -import gtPlusPlus.core.creative.AddToCreativeTab; -import gtPlusPlus.core.util.Utils; -import gtPlusPlus.core.util.minecraft.ItemUtils; - -public abstract class LogBase extends BlockLog { - - public String[] treeType = new String[] {}; - protected IIcon[] textureSide; - protected IIcon[] textureTop; - - public LogBase(String blockNameLocalized, String blockNameUnlocalized, String[] treeTypes) { - this.treeType = treeTypes; - String blockName = "block" + Utils.sanitizeString(blockNameLocalized) + "Log"; - GameRegistry.registerBlock(this, ItemBlock.class, blockName); - this.setBlockName(blockName); - ItemUtils.addItemToOreDictionary( - ItemUtils.getSimpleStack(this), - "log" + Utils.sanitizeString(blockNameLocalized), - true); - ItemUtils.addItemToOreDictionary(ItemUtils.getSimpleStack(this), "logWood", true); - this.setCreativeTab(AddToCreativeTab.tabBOP); - Blocks.fire.setFireInfo(this, 20, 100); - } - - private void setVanillaVariable(Object toSet, Object value) { - toSet = value; - } - - /** - * returns a list of blocks with the same ID, but different meta (eg: wood returns 4 blocks) - */ - @Override - @SideOnly(Side.CLIENT) - public void getSubBlocks(Item item, CreativeTabs tab, List metaList) { - for (int i = 0; i < this.textureSide.length; ++i) { - metaList.add(new ItemStack(item, 1, i)); - } - } - - @Override - @SideOnly(Side.CLIENT) - protected IIcon getTopIcon(int meta) { - return this.textureTop[meta % this.textureTop.length]; - } - - @Override - @SideOnly(Side.CLIENT) - protected IIcon getSideIcon(int metaID) { - return this.textureSide[metaID % this.textureSide.length]; - } - - @Override - @SideOnly(Side.CLIENT) - public void registerBlockIcons(IIconRegister iIcon) { - this.textureSide = new IIcon[treeType.length]; - this.textureTop = new IIcon[treeType.length]; - - for (int i = 0; i < this.textureSide.length; ++i) { - this.textureSide[i] = iIcon.registerIcon(GTPlusPlus.ID + ":" + "trees/" + "logs/" + "log_" + treeType[i]); - this.textureTop[i] = iIcon - .registerIcon(GTPlusPlus.ID + ":" + "trees/" + "logs/" + "log_" + treeType[i] + "_top"); - } - - setVanillaVariable(this.field_150167_a, this.textureSide); - setVanillaVariable(this.field_150166_b, this.textureTop); - } -} diff --git a/gtpp/src/main/java/gtPlusPlus/xmod/bop/blocks/base/SaplingBase.java b/gtpp/src/main/java/gtPlusPlus/xmod/bop/blocks/base/SaplingBase.java deleted file mode 100644 index ff5c8770d4..0000000000 --- a/gtpp/src/main/java/gtPlusPlus/xmod/bop/blocks/base/SaplingBase.java +++ /dev/null @@ -1,166 +0,0 @@ -package gtPlusPlus.xmod.bop.blocks.base; - -import static gregtech.api.enums.Mods.GTPlusPlus; - -import java.util.List; -import java.util.Random; - -import net.minecraft.block.Block; -import net.minecraft.block.BlockSapling; -import net.minecraft.client.renderer.texture.IIconRegister; -import net.minecraft.creativetab.CreativeTabs; -import net.minecraft.init.Blocks; -import net.minecraft.item.Item; -import net.minecraft.item.ItemBlock; -import net.minecraft.item.ItemStack; -import net.minecraft.util.IIcon; -import net.minecraft.util.MathHelper; -import net.minecraft.world.World; -import net.minecraft.world.gen.feature.WorldGenBigTree; -import net.minecraft.world.gen.feature.WorldGenTrees; -import net.minecraft.world.gen.feature.WorldGenerator; - -import cpw.mods.fml.common.registry.GameRegistry; -import cpw.mods.fml.relauncher.Side; -import cpw.mods.fml.relauncher.SideOnly; -import gtPlusPlus.api.objects.Logger; -import gtPlusPlus.core.creative.AddToCreativeTab; -import gtPlusPlus.core.util.Utils; -import gtPlusPlus.core.util.minecraft.ItemUtils; - -public class SaplingBase extends BlockSapling { - - protected String[] saplingTypes = new String[] {}; - protected IIcon[] saplingTextures = new IIcon[] {}; - - // Sapling types - field_149882_a - // Iicons - field_149881_b - - protected SaplingBase(String blockNameLocalized, String blockNameUnlocalized, String[] saplingTypes) { - float f = 0.4F; - this.setBlockBounds(0.5F - f, 0.0F, 0.5F - f, 0.5F + f, f * 2.0F, 0.5F + f); - this.saplingTypes = saplingTypes; - this.saplingTextures = new IIcon[saplingTypes.length]; - String blockName = "block" + Utils.sanitizeString(blockNameLocalized); - GameRegistry.registerBlock(this, ItemBlock.class, blockName); - this.setBlockName(blockName); - ItemUtils.addItemToOreDictionary(ItemUtils.getSimpleStack(this), "treeSapling", true); - this.setCreativeTab(AddToCreativeTab.tabBOP); - } - - private void setVanillaVariable(Object toSet, Object value) { - toSet = value; - } - - /** - * Gets the block's texture. Args: side, meta - */ - @Override - @SideOnly(Side.CLIENT) - public IIcon getIcon(int someInt, int meta) { - /* - * meta &= 7; return saplingTextures[MathHelper.clamp_int(meta, 0, 5)]; - */ - // return this.saplingTextures[meta % this.saplingTextures.length]; - try { - return this.saplingTextures[meta]; - } catch (Throwable T) { - Logger.WARNING("Invalid Sapling meta is " + meta); - return this.saplingTextures[0]; - } - } - - /** - * Ticks the block if it's been scheduled - */ - @Override - public void updateTick(World world, int x, int y, int z, Random rand) { - if (!world.isRemote) { - super.updateTick(world, x, y, z, rand); - if (world.getBlockLightValue(x, y + 1, z) >= 9 && rand.nextInt(7) == 0) { - Logger.WARNING("Update Tick"); - this.updateMeta(world, x, y, z, rand); - } else { - Logger.WARNING("Tried to Tick."); - } - } - } - - // Dunno - Think it is doGrow || doGrowthTick - @Override - public void func_149853_b(World world, Random rand, int x, int y, int z) { - Logger.WARNING("Please find what calls me - func_149853_b"); - this.updateMeta(world, x, y, z, rand); - } - - public void updateMeta(World world, int x, int y, int z, Random rand) { - func_149879_c(world, x, y, z, rand); - } - - @Override - public void func_149879_c(World world, int x, int y, int z, Random rand) { - Logger.WARNING("func_149879_c - 1"); - int l = world.getBlockMetadata(x, y, z); - - if ((l & 8) == 0) { - Logger.WARNING("func_149879_c - 2"); - world.setBlockMetadataWithNotify(x, y, z, l | 8, 4); - } else { - Logger.WARNING("func_149879_c - 3"); - this.func_149878_d(world, x, y, z, rand); - } - } - - @Override - public void func_149878_d(World world, int x, int y, int z, Random rand) { - Logger.WARNING("func_149878_d - 1"); - if (!net.minecraftforge.event.terraingen.TerrainGen.saplingGrowTree(world, rand, x, y, z)) return; - int l = world.getBlockMetadata(x, y, z) & 7; - Object object = rand.nextInt(10) == 0 ? new WorldGenBigTree(true) : new WorldGenTrees(true); - int i1 = 0; - int j1 = 0; - boolean flag = false; - - Block block = Blocks.air; - - world.setBlock(x, y, z, block, 0, 4); - - if (!((WorldGenerator) object).generate(world, rand, x + i1, y, z + j1)) { - world.setBlock(x, y, z, this, l, 4); - } - } - - @Override - public boolean func_149880_a(World world, int p_149880_2_, int p_149880_3_, int p_149880_4_, int p_149880_5_) { - return world.getBlock(p_149880_2_, p_149880_3_, p_149880_4_) == this - && (world.getBlockMetadata(p_149880_2_, p_149880_3_, p_149880_4_) & 7) == p_149880_5_; - } - - /** - * Determines the damage on the item the block drops. Used in cloth and wood. - */ - @Override - public int damageDropped(int meta) { - return MathHelper.clamp_int(meta & 7, 0, 5); - } - - /** - * returns a list of blocks with the same ID, but different meta (eg: wood returns 4 blocks) - */ - @Override - @SideOnly(Side.CLIENT) - public void getSubBlocks(Item item, CreativeTabs tab, List metaList) { - for (int i = 0; i < this.saplingTextures.length; ++i) { - metaList.add(new ItemStack(item, 1, i)); - } - } - - @Override - @SideOnly(Side.CLIENT) - public void registerBlockIcons(IIconRegister iIcon) { - for (int i = 0; i < saplingTextures.length; ++i) { - saplingTextures[i] = iIcon - .registerIcon(GTPlusPlus.ID + ":" + "trees/" + "saplings/" + "sapling_" + saplingTypes[i]); - } - } -} diff --git a/gtpp/src/main/java/gtPlusPlus/xmod/bop/blocks/pine/LeavesPineTree.java b/gtpp/src/main/java/gtPlusPlus/xmod/bop/blocks/pine/LeavesPineTree.java deleted file mode 100644 index 93f7e59a1e..0000000000 --- a/gtpp/src/main/java/gtPlusPlus/xmod/bop/blocks/pine/LeavesPineTree.java +++ /dev/null @@ -1,41 +0,0 @@ -package gtPlusPlus.xmod.bop.blocks.pine; - -import java.util.Random; - -import net.minecraft.item.Item; -import net.minecraft.item.ItemStack; -import net.minecraft.world.World; - -import gtPlusPlus.api.objects.Logger; -import gtPlusPlus.core.item.chemistry.AgriculturalChem; -import gtPlusPlus.core.util.math.MathUtils; -import gtPlusPlus.core.util.minecraft.ItemUtils; -import gtPlusPlus.xmod.bop.blocks.BOP_Block_Registrator; -import gtPlusPlus.xmod.bop.blocks.base.LeavesBase; - -public class LeavesPineTree extends LeavesBase { - - public LeavesPineTree() { - super("Pine", "pine", new ItemStack[] {}); - this.treeType = new String[] { "pine" }; - this.leafType = new String[][] { { "pine" }, { "pine_opaque" } }; - } - - @Override - public Item getItemDropped(int p_149650_1_, Random p_149650_2_, int p_149650_3_) { - return Item.getItemFromBlock(BOP_Block_Registrator.sapling_Pine); - } - - @Override // Drops when Leaf is broken - protected void func_150124_c(World world, int x, int y, int z, int meta, int randomChance) { - Logger.INFO("Dropping Bonus Drops"); - if (MathUtils.randInt(0, 10) >= 9) { - this.dropBlockAsItem( - world, - x, - y, - z, - ItemUtils.getSimpleStack(AgriculturalChem.mPinecone, MathUtils.randInt(1, 4))); - } - } -} diff --git a/gtpp/src/main/java/gtPlusPlus/xmod/bop/blocks/pine/LogPineTree.java b/gtpp/src/main/java/gtPlusPlus/xmod/bop/blocks/pine/LogPineTree.java deleted file mode 100644 index 98e384cd3f..0000000000 --- a/gtpp/src/main/java/gtPlusPlus/xmod/bop/blocks/pine/LogPineTree.java +++ /dev/null @@ -1,21 +0,0 @@ -package gtPlusPlus.xmod.bop.blocks.pine; - -import gtPlusPlus.xmod.bop.blocks.base.LogBase; - -public class LogPineTree extends LogBase { - - public LogPineTree() { - super("Pine Log", "pine", new String[] { "pine" }); - this.treeType = new String[] { "pine" }; - } - - /* - * @Override - * @SideOnly(Side.CLIENT) protected IIcon getSideIcon(int metaID){ return this.textureSide[metaID % - * this.textureSide.length]; } - * @Override - * @SideOnly(Side.CLIENT) protected IIcon getTopIcon(int metaID){ return this.textureTop[metaID % - * this.textureTop.length]; } - */ - -} diff --git a/gtpp/src/main/java/gtPlusPlus/xmod/bop/blocks/pine/SaplingPineTree.java b/gtpp/src/main/java/gtPlusPlus/xmod/bop/blocks/pine/SaplingPineTree.java deleted file mode 100644 index 2c2bb38af6..0000000000 --- a/gtpp/src/main/java/gtPlusPlus/xmod/bop/blocks/pine/SaplingPineTree.java +++ /dev/null @@ -1,52 +0,0 @@ -package gtPlusPlus.xmod.bop.blocks.pine; - -import java.util.Random; - -import net.minecraft.block.Block; -import net.minecraft.init.Blocks; -import net.minecraft.world.World; -import net.minecraft.world.gen.feature.WorldGenBigTree; -import net.minecraft.world.gen.feature.WorldGenTrees; -import net.minecraft.world.gen.feature.WorldGenerator; - -import gtPlusPlus.api.objects.Logger; -import gtPlusPlus.core.lib.CORE; -import gtPlusPlus.xmod.bop.blocks.base.SaplingBase; -import gtPlusPlus.xmod.bop.world.features.trees.WorldGenPineTree; - -public class SaplingPineTree extends SaplingBase { - - public SaplingPineTree() { - super("Pine Sapling", "pine", new String[] { "pine" }); - } - - @Override - public void func_149878_d(World world, int x, int y, int z, Random rand) { - Logger.WARNING("func_149878_d - 1"); - if (!net.minecraftforge.event.terraingen.TerrainGen.saplingGrowTree(world, rand, x, y, z)) return; - rand.nextInt(10); - new WorldGenBigTree(true); - new WorldGenTrees(true); - int i1 = 0; - int j1 = 0; - boolean flag = false; - - Block block = Blocks.air; - - if (flag) { - world.setBlock(x + i1, y, z + j1, block, 0, 4); - world.setBlock(x + i1 + 1, y, z + j1, block, 0, 4); - world.setBlock(x + i1, y, z + j1 + 1, block, 0, 4); - world.setBlock(x + i1 + 1, y, z + j1 + 1, block, 0, 4); - } else { - world.setBlock(x, y, z, block, 0, 4); - } - Object obj = new WorldGenPineTree(); - if (obj != null) { - world.setBlockToAir(x, y, z); - if (!((WorldGenerator) obj).generate(world, CORE.RANDOM, x, y, z)) { - world.setBlock(x, y, z, this, 0, 2); - } - } - } -} diff --git a/gtpp/src/main/java/gtPlusPlus/xmod/bop/blocks/rainforest/LeavesRainforestTree.java b/gtpp/src/main/java/gtPlusPlus/xmod/bop/blocks/rainforest/LeavesRainforestTree.java deleted file mode 100644 index 816b666a40..0000000000 --- a/gtpp/src/main/java/gtPlusPlus/xmod/bop/blocks/rainforest/LeavesRainforestTree.java +++ /dev/null @@ -1,25 +0,0 @@ -package gtPlusPlus.xmod.bop.blocks.rainforest; - -import java.util.Random; - -import net.minecraft.init.Items; -import net.minecraft.item.Item; -import net.minecraft.item.ItemStack; - -import gtPlusPlus.core.util.minecraft.ItemUtils; -import gtPlusPlus.xmod.bop.blocks.BOP_Block_Registrator; -import gtPlusPlus.xmod.bop.blocks.base.LeavesBase; - -public class LeavesRainforestTree extends LeavesBase { - - public LeavesRainforestTree() { - super("Rainforest Oak", "rainforestoak", new ItemStack[] { ItemUtils.getSimpleStack(Items.apple) }); - this.treeType = new String[] { "rainforest" }; - this.leafType = new String[][] { { "rainforest" }, { "rainforest_opaque" } }; - } - - @Override - public Item getItemDropped(int p_149650_1_, Random p_149650_2_, int p_149650_3_) { - return Item.getItemFromBlock(BOP_Block_Registrator.sapling_Rainforest); - } -} diff --git a/gtpp/src/main/java/gtPlusPlus/xmod/bop/blocks/rainforest/LogRainforestTree.java b/gtpp/src/main/java/gtPlusPlus/xmod/bop/blocks/rainforest/LogRainforestTree.java deleted file mode 100644 index 4e769b7c95..0000000000 --- a/gtpp/src/main/java/gtPlusPlus/xmod/bop/blocks/rainforest/LogRainforestTree.java +++ /dev/null @@ -1,12 +0,0 @@ -package gtPlusPlus.xmod.bop.blocks.rainforest; - -import gtPlusPlus.xmod.bop.blocks.base.LogBase; - -public class LogRainforestTree extends LogBase { - - public LogRainforestTree() { - super("Rainforest Oak", "rainforestoak", new String[] { "rainforest" }); - this.treeType = new String[] { "rainforest" }; - } - -} diff --git a/gtpp/src/main/java/gtPlusPlus/xmod/bop/blocks/rainforest/SaplingRainforestTree.java b/gtpp/src/main/java/gtPlusPlus/xmod/bop/blocks/rainforest/SaplingRainforestTree.java deleted file mode 100644 index 362eb2f541..0000000000 --- a/gtpp/src/main/java/gtPlusPlus/xmod/bop/blocks/rainforest/SaplingRainforestTree.java +++ /dev/null @@ -1,65 +0,0 @@ -package gtPlusPlus.xmod.bop.blocks.rainforest; - -import java.util.Random; - -import net.minecraft.block.Block; -import net.minecraft.init.Blocks; -import net.minecraft.world.World; -import net.minecraft.world.gen.feature.WorldGenBigTree; -import net.minecraft.world.gen.feature.WorldGenTrees; -import net.minecraft.world.gen.feature.WorldGenerator; - -import gtPlusPlus.api.objects.Logger; -import gtPlusPlus.xmod.bop.blocks.BOP_Block_Registrator; -import gtPlusPlus.xmod.bop.blocks.base.SaplingBase; -import gtPlusPlus.xmod.bop.world.features.trees.WorldGenRainForestTree_Ex; - -public class SaplingRainforestTree extends SaplingBase { - - public SaplingRainforestTree() { - super("Rainforest Oak Sapling", "rainforestoak", new String[] { "rainforest" }); - } - - @Override - public void func_149878_d(World world, int x, int y, int z, Random rand) { - Logger.WARNING("func_149878_d - 1"); - if (!net.minecraftforge.event.terraingen.TerrainGen.saplingGrowTree(world, rand, x, y, z)) return; - int l = world.getBlockMetadata(x, y, z) & 7; - rand.nextInt(10); - new WorldGenBigTree(true); - new WorldGenTrees(true); - int i1 = 0; - int j1 = 0; - boolean flag = false; - - Block block = Blocks.air; - - if (flag) { - world.setBlock(x + i1, y, z + j1, block, 0, 4); - world.setBlock(x + i1 + 1, y, z + j1, block, 0, 4); - world.setBlock(x + i1, y, z + j1 + 1, block, 0, 4); - world.setBlock(x + i1 + 1, y, z + j1 + 1, block, 0, 4); - } else { - world.setBlock(x, y, z, block, 0, 4); - } - Object o = new WorldGenRainForestTree_Ex( - BOP_Block_Registrator.log_Rainforest, - BOP_Block_Registrator.leaves_Rainforest, - 0, - 0, - true, - 50, - 75); - - if (!((WorldGenerator) o).generate(world, rand, x + i1, y, z + j1)) { - if (flag) { - world.setBlock(x + i1, y, z + j1, this, l, 4); - world.setBlock(x + i1 + 1, y, z + j1, this, l, 4); - world.setBlock(x + i1, y, z + j1 + 1, this, l, 4); - world.setBlock(x + i1 + 1, y, z + j1 + 1, this, l, 4); - } else { - world.setBlock(x, y, z, this, l, 4); - } - } - } -} diff --git a/gtpp/src/main/java/gtPlusPlus/xmod/bop/world/features/trees/WorldGenPineTree.java b/gtpp/src/main/java/gtPlusPlus/xmod/bop/world/features/trees/WorldGenPineTree.java deleted file mode 100644 index bc97042c82..0000000000 --- a/gtpp/src/main/java/gtPlusPlus/xmod/bop/world/features/trees/WorldGenPineTree.java +++ /dev/null @@ -1,172 +0,0 @@ -package gtPlusPlus.xmod.bop.world.features.trees; - -import java.util.Random; - -import net.minecraft.block.Block; -import net.minecraft.block.BlockSapling; -import net.minecraft.init.Blocks; -import net.minecraft.world.World; -import net.minecraft.world.gen.feature.WorldGenAbstractTree; -import net.minecraftforge.common.util.ForgeDirection; - -import gtPlusPlus.core.util.math.MathUtils; -import gtPlusPlus.xmod.bop.blocks.BOP_Block_Registrator; - -public class WorldGenPineTree extends WorldGenAbstractTree { - - public WorldGenPineTree() { - super(true); - } - - @Override - public boolean generate(World world, Random random, int x, int y, int z) { - while (world.isAirBlock(x, y, z) && y > 2) { - --y; - } - - Block aSoilBlock = world.getBlock(x, y, z); - - if (!canBlockSustainSapling(world, aSoilBlock, x, y, z)) { - return false; - } else { - int height; - int branches; - for (height = -2; height <= 2; ++height) { - for (branches = -2; branches <= 2; ++branches) { - if (world.isAirBlock(x + height, y - 1, z + branches) - && world.isAirBlock(x + height, y - 2, z + branches) - && !world.isAirBlock(x + height, y, z + branches)) { - return false; - } - } - } - - height = 2 + MathUtils.randInt(8, 16); - branches = 2 + MathUtils.randInt(6, 18); - int h = 1; - aSoilBlock.onPlantGrow(world, x, y - 1, z, x, y, z); - - int c; - int r = MathUtils.randInt(1, 3); - for (c = 0; c < height; ++c) { - this.buildBlock(world, x, y + h, z, BOP_Block_Registrator.log_Pine, 0); - h++; - if (c >= r && c % 2 == 0) { - this.generateBranch(world, random, x, y + h, z, c); - } - } - - this.generateTop(world, x, y + h, z); - return true; - } - } - - public void generateTop(World world, int x, int y, int z) { - for (int i = -1; i < 2; ++i) { - for (int j = -1; j < 2; ++j) { - this.buildBlock(world, x + i, y, z + j, BOP_Block_Registrator.leaves_Pine, 0); - } - } - - this.buildBlock(world, x, y, z, BOP_Block_Registrator.log_Pine, 0); - this.buildBlock(world, x + 1, y + 1, z, BOP_Block_Registrator.leaves_Pine, 0); - this.buildBlock(world, x, y + 1, z - 1, BOP_Block_Registrator.leaves_Pine, 0); - this.buildBlock(world, x, y + 1, z + 1, BOP_Block_Registrator.leaves_Pine, 0); - this.buildBlock(world, x - 1, y + 1, z, BOP_Block_Registrator.leaves_Pine, 0); - this.buildBlock(world, x, y + 2, z, BOP_Block_Registrator.leaves_Pine, 0); - } - - public void generateBranch(World world, Random rand, int x, int y, int z, int n) { - int var99999; - int var99998; - for (var99999 = -1; var99999 < 2; ++var99999) { - for (var99998 = -1; var99998 < 2; ++var99998) { - this.buildBlock(world, x + var99999, y, z + var99998, BOP_Block_Registrator.leaves_Pine, 0); - } - } - - var99999 = rand.nextInt(2); - var99998 = rand.nextInt(2); - int var99997 = rand.nextInt(2); - int var99996 = rand.nextInt(2); - if (n % 2 == 0) { - if (var99998 == 0) { - this.buildBlock(world, x + 1, y - 1, z - 2, BOP_Block_Registrator.leaves_Pine, 0); - this.buildBlock(world, x + 2, y - 1, z - 1, BOP_Block_Registrator.leaves_Pine, 0); - if (var99999 == 0) { - this.buildBlock(world, x + 2, y - 2, z - 2, BOP_Block_Registrator.leaves_Pine, 0); - } else { - this.buildBlock(world, x + 2, y - 1, z - 2, BOP_Block_Registrator.leaves_Pine, 0); - } - } else { - this.buildBlock(world, x + 1, y, z - 2, BOP_Block_Registrator.leaves_Pine, 0); - this.buildBlock(world, x + 2, y, z - 1, BOP_Block_Registrator.leaves_Pine, 0); - this.buildBlock(world, x + 2, y, z - 2, BOP_Block_Registrator.leaves_Pine, 0); - } - - if (var99997 == 0) { - this.buildBlock(world, x - 2, y - 1, z + 1, BOP_Block_Registrator.leaves_Pine, 0); - this.buildBlock(world, x - 1, y - 1, z + 2, BOP_Block_Registrator.leaves_Pine, 0); - if (var99996 == 0) { - this.buildBlock(world, x - 2, y - 2, z + 2, BOP_Block_Registrator.leaves_Pine, 0); - } else { - this.buildBlock(world, x - 2, y - 1, z + 2, BOP_Block_Registrator.leaves_Pine, 0); - } - } else { - this.buildBlock(world, x - 2, y, z + 1, BOP_Block_Registrator.leaves_Pine, 0); - this.buildBlock(world, x - 1, y, z + 2, BOP_Block_Registrator.leaves_Pine, 0); - this.buildBlock(world, x - 2, y, z + 2, BOP_Block_Registrator.leaves_Pine, 0); - } - } else { - if (var99998 == 0) { - this.buildBlock(world, x + 2, y - 1, z + 1, BOP_Block_Registrator.leaves_Pine, 0); - this.buildBlock(world, x + 1, y - 1, z + 2, BOP_Block_Registrator.leaves_Pine, 0); - if (var99999 == 0) { - this.buildBlock(world, x + 2, y - 2, z + 2, BOP_Block_Registrator.leaves_Pine, 0); - } else { - this.buildBlock(world, x + 2, y - 1, z + 2, BOP_Block_Registrator.leaves_Pine, 0); - } - } else { - this.buildBlock(world, x + 2, y, z + 1, BOP_Block_Registrator.leaves_Pine, 0); - this.buildBlock(world, x + 1, y, z + 2, BOP_Block_Registrator.leaves_Pine, 0); - if (var99999 == 0) { - this.buildBlock(world, x + 2, y - 1, z + 2, BOP_Block_Registrator.leaves_Pine, 0); - } else { - this.buildBlock(world, x + 2, y, z + 2, BOP_Block_Registrator.leaves_Pine, 0); - } - } - - if (var99997 == 0) { - this.buildBlock(world, x - 1, y - 1, z - 2, BOP_Block_Registrator.leaves_Pine, 0); - this.buildBlock(world, x - 2, y - 1, z - 1, BOP_Block_Registrator.leaves_Pine, 0); - if (var99996 == 0) { - this.buildBlock(world, x - 2, y - 2, z - 2, BOP_Block_Registrator.leaves_Pine, 0); - } else { - this.buildBlock(world, x - 2, y - 1, z - 2, BOP_Block_Registrator.leaves_Pine, 0); - } - } else { - this.buildBlock(world, x - 1, y, z - 2, BOP_Block_Registrator.leaves_Pine, 0); - this.buildBlock(world, x - 2, y, z - 1, BOP_Block_Registrator.leaves_Pine, 0); - if (var99996 == 0) { - this.buildBlock(world, x - 2, y - 1, z - 2, BOP_Block_Registrator.leaves_Pine, 0); - } else { - this.buildBlock(world, x - 2, y, z - 2, BOP_Block_Registrator.leaves_Pine, 0); - } - } - } - - this.buildBlock(world, x, y, z, BOP_Block_Registrator.log_Pine, 0); - this.buildBlock(world, x, y + 1, z, BOP_Block_Registrator.log_Pine, 0); - } - - public void buildBlock(World world, int x, int y, int z, Block block, int meta) { - if (world.isAirBlock(x, y, z) || world.getBlock(x, y, z) - .isLeaves(world, x, y, z)) { - world.setBlock(x, y, z, block, meta, 2); - } - } - - public boolean canBlockSustainSapling(World world, Block block, int x, int y, int z) { - return block.canSustainPlant(world, x, y, z, ForgeDirection.UP, (BlockSapling) Blocks.sapling); - } -} diff --git a/gtpp/src/main/java/gtPlusPlus/xmod/bop/world/features/trees/WorldGenRainForestTree_Ex.java b/gtpp/src/main/java/gtPlusPlus/xmod/bop/world/features/trees/WorldGenRainForestTree_Ex.java deleted file mode 100644 index d3ad2efaea..0000000000 --- a/gtpp/src/main/java/gtPlusPlus/xmod/bop/world/features/trees/WorldGenRainForestTree_Ex.java +++ /dev/null @@ -1,310 +0,0 @@ -package gtPlusPlus.xmod.bop.world.features.trees; - -import java.util.Random; - -import net.minecraft.block.Block; -import net.minecraft.block.BlockSapling; -import net.minecraft.init.Blocks; -import net.minecraft.world.World; -import net.minecraft.world.gen.feature.WorldGenAbstractTree; -import net.minecraftforge.common.util.ForgeDirection; - -import gtPlusPlus.api.objects.Logger; - -public class WorldGenRainForestTree_Ex extends WorldGenAbstractTree { - - private final int minTreeHeight; - private final int randomTreeHeight; - private final Block wood; - private final Block leaves; - private final int woodMeta; - private final int leavesMeta; - - // return random.nextInt(5) == 0 ? new WorldGenTrees(false, 4 + random.nextInt(7), 3, 3, true) : new - // WorldGenRainforestTree1(BOPCBlocks.logs4, BOPCBlocks.colorizedLeaves2, 3, 2, false, 8, 8); - - public WorldGenRainForestTree_Ex(Block wood, Block leaves, int woodMeta, int leavesMeta, boolean doBlockNotify, - int minTreeHeight, int randomTreeHeight) { - super(doBlockNotify); - this.wood = wood; - this.leaves = leaves; - this.woodMeta = woodMeta; - this.leavesMeta = leavesMeta; - this.minTreeHeight = minTreeHeight; - this.randomTreeHeight = randomTreeHeight; - } - - @Override - public boolean generate(World world, Random random, int x, int y, int z) { - int treeHeight = random.nextInt(this.randomTreeHeight) + this.minTreeHeight; - boolean flag = true; - if ((y >= 1) && (y + treeHeight + 1 <= 256)) { - for (int i1 = y; i1 <= y + 1 + treeHeight; i1++) { - byte b0 = 1; - if (i1 == y) { - b0 = 0; - } - if (i1 >= y + 1 + treeHeight - 2) { - b0 = 2; - } - for (int j1 = x - b0; (j1 <= x + b0) && (flag); j1++) { - for (int k1 = z - b0; (k1 <= z + b0) && (flag); k1++) { - if ((i1 >= 0) && (i1 < 256)) { - Block block = world.getBlock(j1, i1, k1); - if (!isReplaceable(world, j1, i1, k1)) { - flag = false; - } - } else { - flag = false; - } - } - } - } - if (!flag) { - return false; - } - Block block2 = world.getBlock(x, y - 1, z); - - boolean isSoil = block2 - .canSustainPlant(world, x, y - 1, z, ForgeDirection.UP, (BlockSapling) Blocks.sapling); - if ((isSoil) && (y < 256 - treeHeight - 1)) { - block2.onPlantGrow(world, x, y - 1, z, x, y, z); - byte b0 = 3; - byte b1 = 0; - Logger.WARNING("Sapling located at X:" + x + " | Y:" + y + " | Z:" + z); - for (int k1 = y - b0 + treeHeight; k1 <= y + treeHeight; k1++) { - Logger - .WARNING("[1]| k1 = " + k1 + " | y = " + y + " | b0 = " + b0 + " | l = " + treeHeight + " | "); - int i3 = k1 - (y + treeHeight); - int l1 = b1 + 1 - i3; - for (int i2 = x - l1; i2 <= x + l1; i2++) { - int j2 = i2 - x; - Logger.WARNING("[2]| i2 = " + i2 + " | x = " + x + " | l1 = " + l1 + " | j2 = " + j2 + " | "); - for (int k2 = z - l1; k2 <= z + l1; k2++) { - int l2 = k2 - z; - Logger - .WARNING("[3]| k2 = " + k2 + " | z = " + z + " | l1 = " + l1 + " | l2 = " + l2 + " | "); - if ((Math.abs(j2) != l1) || (Math.abs(l2) != l1) - || ((random.nextInt(2) != 0) && (i3 != 0))) { - Block block1 = world.getBlock(i2, k1, k2); - if ((block1.isAir(world, i2, k1, k2)) || (block1.isLeaves(world, i2, k1, k2))) { - Logger.WARNING("Setting something as leaves?"); - setBlockAndNotifyAdequately(world, i2, k1, k2, this.leaves, this.leavesMeta); - } - } - } - } - } - for (int k1 = 0; k1 < treeHeight; k1++) { - Logger.WARNING("Building tree - Layer " + k1 + " | Max height is " + treeHeight); - Block block = world.getBlock(x, y + k1, z); - if ((block.isAir(world, x, y + k1, z)) || (block.isLeaves(world, x, y + k1, z))) { - setBlockAndNotifyAdequately(world, x, y + k1, z, this.wood, this.woodMeta); - - // Trying this to make trunk - setBlockAndNotifyAdequately(world, x, y + k1, z + 1, this.wood, this.woodMeta); - setBlockAndNotifyAdequately(world, x, y + k1, z - 1, this.wood, this.woodMeta); - setBlockAndNotifyAdequately(world, x + 1, y + k1, z, this.wood, this.woodMeta); - setBlockAndNotifyAdequately(world, x - 1, y + k1, z, this.wood, this.woodMeta); - - if (k1 >= 5) { - if (k1 % 5 == 0) { - // Bottom layer - Block block5 = world.getBlock(x, y + k1, z); - for (int xDir = -5; xDir <= 5; xDir++) { - for (int zDir = -5; zDir <= 5; zDir++) { - if (canRemoveLeafBlockLayer2(-5, 5, xDir, -5, 5, zDir)) { - Logger.WARNING( - "Doing Nothing at " + "x=" + xDir + " | y=" + y + " z=" + zDir); - } else { - Logger.WARNING( - "Trying to place leaves at " + "x=" - + xDir - + " | y=" - + y - + " z=" - + zDir); - block5 = world.getBlock(x + xDir, y + k1, z + zDir); - if (block5.isAir(world, x + xDir, y + k1, x + zDir)) { - setBlockAndNotifyAdequately( - world, - x + xDir, - y + k1, - z + zDir, - this.leaves, - this.leavesMeta); - } - } - } - } - // Next Layer - for (int xDir = -4; xDir <= 4; xDir++) { - for (int zDir = -4; zDir <= 4; zDir++) { - if (canRemoveLeafBlockLayer2(-4, 4, xDir, -4, 4, zDir)) { - Logger.WARNING( - "Doing Nothing at " + "x=" - + xDir - + " | y=" - + y - + k1 - + 1 - + " z=" - + zDir); - } else { - Logger.WARNING( - "Trying to place leaves at " + "x=" - + xDir - + " | y=" - + y - + k1 - + 1 - + " z=" - + zDir); - block5 = world.getBlock(x + xDir, y + k1 + 1, z + zDir); - if (block5.isAir(world, x + xDir, y + k1 + 1, x + zDir)) { - setBlockAndNotifyAdequately( - world, - x + xDir, - y + k1 + 1, - z + zDir, - this.leaves, - this.leavesMeta); - } - } - } - } - - // Third Layer - for (int xDir = -3; xDir <= 3; xDir++) { - for (int zDir = -3; zDir <= 3; zDir++) { - if (canRemoveLeafBlockLayer2(-3, 3, xDir, -3, 3, zDir)) { - Logger.WARNING( - "Doing Nothing at " + "x=" - + xDir - + " | y=" - + y - + k1 - + 2 - + " z=" - + zDir); - } else { - Logger.WARNING( - "Trying to place leaves at " + "x=" - + xDir - + " | y=" - + y - + k1 - + 2 - + " z=" - + zDir); - block5 = world.getBlock(x + xDir, y + k1 + 2, z + zDir); - if (block5.isAir(world, x + xDir, y + k1 + 2, x + zDir)) { - setBlockAndNotifyAdequately( - world, - x + xDir, - y + k1 + 2, - z + zDir, - this.leaves, - this.leavesMeta); - } - } - } - } - - // Fourth Layer - for (int xDir = -2; xDir <= 2; xDir++) { - for (int zDir = -2; zDir <= 2; zDir++) { - if (canRemoveLeafBlockLayer2(-2, 2, xDir, -2, 2, zDir)) { - Logger.WARNING( - "Doing Nothing at " + "x=" - + xDir - + " | y=" - + y - + k1 - + 3 - + " z=" - + zDir); - } else { - Logger.WARNING( - "Trying to place leaves at " + "x=" - + xDir - + " | y=" - + y - + k1 - + 3 - + " z=" - + zDir); - block5 = world.getBlock(x + xDir, y + k1 + 3, z + zDir); - if (block5.isAir(world, x + xDir, y + k1 + 3, x + zDir)) { - setBlockAndNotifyAdequately( - world, - x + xDir, - y + k1 + 3, - z + zDir, - this.leaves, - this.leavesMeta); - } - } - } - } - } else { - - } - } - - setBlockAndNotifyAdequately(world, x - 3, y + (treeHeight - 3), z, this.wood, this.woodMeta); - setBlockAndNotifyAdequately(world, x + 3, y + (treeHeight - 3), z, this.wood, this.woodMeta); - setBlockAndNotifyAdequately(world, x, y + (treeHeight - 3), z - 3, this.wood, this.woodMeta); - setBlockAndNotifyAdequately(world, x, y + (treeHeight - 3), z + 3, this.wood, this.woodMeta); - setBlockAndNotifyAdequately(world, x - 2, y + (treeHeight - 4), z, this.wood, this.woodMeta); - setBlockAndNotifyAdequately(world, x + 2, y + (treeHeight - 4), z, this.wood, this.woodMeta); - setBlockAndNotifyAdequately(world, x, y + (treeHeight - 4), z - 2, this.wood, this.woodMeta); - setBlockAndNotifyAdequately(world, x, y + (treeHeight - 4), z + 2, this.wood, this.woodMeta); - setBlockAndNotifyAdequately(world, x - 2, y + (treeHeight - 5), z, this.wood, this.woodMeta); - setBlockAndNotifyAdequately(world, x + 2, y + (treeHeight - 5), z, this.wood, this.woodMeta); - setBlockAndNotifyAdequately(world, x, y + (treeHeight - 5), z - 2, this.wood, this.woodMeta); - setBlockAndNotifyAdequately(world, x, y + (treeHeight - 5), z + 2, this.wood, this.woodMeta); - setBlockAndNotifyAdequately(world, x - 1, y + (treeHeight - 6), z, this.wood, this.woodMeta); - setBlockAndNotifyAdequately(world, x + 1, y + (treeHeight - 6), z, this.wood, this.woodMeta); - setBlockAndNotifyAdequately(world, x, y + (treeHeight - 6), z - 1, this.wood, this.woodMeta); - setBlockAndNotifyAdequately(world, x, y + (treeHeight - 6), z + 1, this.wood, this.woodMeta); - setBlockAndNotifyAdequately(world, x, y + (treeHeight - 3), z, this.leaves, this.leavesMeta); - setBlockAndNotifyAdequately(world, x, y + (treeHeight - 2), z, this.leaves, this.leavesMeta); - setBlockAndNotifyAdequately(world, x, y + (treeHeight - 1), z, this.leaves, this.leavesMeta); - setBlockAndNotifyAdequately(world, x, y + treeHeight, z, this.leaves, this.leavesMeta); - func_150515_a(world, x, y + (treeHeight - 4), z, Blocks.air); - func_150515_a(world, x, y + (treeHeight - 5), z, Blocks.air); - setBlockAndNotifyAdequately(world, x - 1, y + (treeHeight - 3), z, this.wood, this.woodMeta); - setBlockAndNotifyAdequately(world, x + 1, y + (treeHeight - 3), z, this.wood, this.woodMeta); - setBlockAndNotifyAdequately(world, x, y + (treeHeight - 3), z - 1, this.wood, this.woodMeta); - setBlockAndNotifyAdequately(world, x, y + (treeHeight - 3), z + 1, this.wood, this.woodMeta); - setBlockAndNotifyAdequately(world, x, y + (treeHeight - 2), z, this.wood, this.woodMeta); - } - } - return true; - } - return false; - } - return false; - } - - private boolean canRemoveLeafBlockLayer2(int xDirMin, int xDirMax, int xDir, int zDirMin, int zDirMax, int zDir) { - if (xDir == xDirMin || xDir == xDirMin + 1 || xDir == xDirMax || xDir == xDirMax - 1) { - if (zDir == zDirMin || zDir == zDirMin + 1 || zDir == zDirMax || zDir == zDirMax - 1) { - if (xDir == xDirMin + 1 && zDir == zDirMin + 1) { - return false; - } else if (xDir == xDirMin + 1 && zDir == zDirMax - 1) { - return false; - } else if (xDir == xDirMax - 1 && zDir == zDirMin + 1) { - return false; - } else if (xDir == xDirMax - 1 && zDir == zDirMax - 1) { - return false; - } - return true; - } - return false; - } else { - return false; - } - } -} diff --git a/gtpp/src/main/java/gtPlusPlus/xmod/forestry/HANDLER_FR.java b/gtpp/src/main/java/gtPlusPlus/xmod/forestry/HANDLER_FR.java deleted file mode 100644 index a1b96d0f2f..0000000000 --- a/gtpp/src/main/java/gtPlusPlus/xmod/forestry/HANDLER_FR.java +++ /dev/null @@ -1,23 +0,0 @@ -package gtPlusPlus.xmod.forestry; - -import static gregtech.api.enums.Mods.Forestry; - -import gtPlusPlus.xmod.forestry.bees.items.FR_ItemRegistry; -import gtPlusPlus.xmod.forestry.bees.recipe.FR_Gregtech_Recipes; -import gtPlusPlus.xmod.forestry.bees.registry.GTPP_Bees; - -public class HANDLER_FR { - - public static void preInit() { - if (Forestry.isModLoaded()) { - FR_ItemRegistry.Register(); - } - } - - public static void postInit() { - if (Forestry.isModLoaded()) { - FR_Gregtech_Recipes.registerItems(); - new GTPP_Bees(); - } - } -} diff --git a/gtpp/src/main/java/gtPlusPlus/xmod/forestry/bees/custom/CustomCombs.java b/gtpp/src/main/java/gtPlusPlus/xmod/forestry/bees/custom/CustomCombs.java deleted file mode 100644 index 3c00c79fcb..0000000000 --- a/gtpp/src/main/java/gtPlusPlus/xmod/forestry/bees/custom/CustomCombs.java +++ /dev/null @@ -1,94 +0,0 @@ -package gtPlusPlus.xmod.forestry.bees.custom; - -import gregtech.api.enums.Materials; -import gregtech.api.util.GT_LanguageManager; -import gtPlusPlus.core.util.Utils; - -public enum CustomCombs { - // Custom Bees - - // Rubbers & Silicons - SILICON("silicon", true, Materials.Silicon, 100), - RUBBER("rubber", true, Materials.Rubber, 100), - PLASTIC("polyethylene", true, Materials.Plastic, 75), - PTFE("polytetrafluoroethylene", true, GTPP_Bees.PTFE, 50), - PBS("styrene-butadiene", true, GTPP_Bees.PBS, 25), - - // Fuels - BIOMASS("biomass", true, Materials.Biomass, 100), - ETHANOL("ethanol", true, Materials.Ethanol, 75), - DIESEL("diesel", true, Materials.Fuel, 50), - NITRO("nitro", true, Materials.NitroFuel, 25), - HOOTCH("hootch", true, Materials.Silicon, 50), - ROCKETFUEL("rocket", true, Materials.Silicon, 25), - - // Materials which are hard, if not impossible to obtain. - FLUORINE("fluorine", true, Materials.Fluorine, 25), - COKE("coke", true, Materials._NULL, 50), - FORCE("force", true, Materials.Force, 50), - NIKOLITE("nikolite", true, Materials.Nikolite, 75), - MITHRIL("mithril", true, Materials.Mithril, 10), - ADAMANTIUM("adamantium", true, Materials.Adamantium, 5), - - // Trash - SALT("salt", true, Materials.Salt, 75), - SAND("sand", true, Materials.Sand, 100),; - - private static final int[][] colours = new int[][] { - { Utils.rgbtoHexValue(75, 75, 75), Utils.rgbtoHexValue(125, 125, 125) }, // SILICON - { Utils.rgbtoHexValue(55, 55, 55), Utils.rgbtoHexValue(75, 75, 75) }, // RUBBER - { Utils.rgbtoHexValue(245, 245, 245), Utils.rgbtoHexValue(175, 175, 175) }, // PLASTIC - { Utils.rgbtoHexValue(150, 150, 150), Utils.rgbtoHexValue(75, 75, 75) }, // PTFE - { Utils.rgbtoHexValue(33, 26, 24), Utils.rgbtoHexValue(23, 16, 14) }, // PBS - // Unused - { Utils.rgbtoHexValue(33, 225, 24), Utils.rgbtoHexValue(23, 175, 14) }, // Biofuel - { Utils.rgbtoHexValue(255, 128, 0), Utils.rgbtoHexValue(220, 156, 32) }, // Ethanol - { Utils.rgbtoHexValue(75, 75, 75), Utils.rgbtoHexValue(125, 125, 125) }, // - { Utils.rgbtoHexValue(75, 75, 75), Utils.rgbtoHexValue(125, 125, 125) }, // - { Utils.rgbtoHexValue(75, 75, 75), Utils.rgbtoHexValue(125, 125, 125) }, // - { Utils.rgbtoHexValue(75, 75, 75), Utils.rgbtoHexValue(125, 125, 125) }, // - { Utils.rgbtoHexValue(30, 230, 230), Utils.rgbtoHexValue(10, 150, 150) }, // Fluorine - { Utils.rgbtoHexValue(75, 75, 75), Utils.rgbtoHexValue(125, 125, 125) }, // - { Utils.rgbtoHexValue(250, 250, 20), Utils.rgbtoHexValue(200, 200, 5) }, // Force - { Utils.rgbtoHexValue(60, 180, 200), Utils.rgbtoHexValue(40, 150, 170) }, // Nikolite - { Utils.rgbtoHexValue(75, 75, 75), Utils.rgbtoHexValue(125, 125, 125) }, // - { Utils.rgbtoHexValue(75, 75, 75), Utils.rgbtoHexValue(125, 125, 125) }, // - { Utils.rgbtoHexValue(75, 75, 75), Utils.rgbtoHexValue(125, 125, 125) }, // - { Utils.rgbtoHexValue(75, 75, 75), Utils.rgbtoHexValue(125, 125, 125) }, // - { Utils.rgbtoHexValue(75, 75, 75), Utils.rgbtoHexValue(125, 125, 125) }, { 0x666666, 0x525252 }, - { 0x2E8F5B, 0xDCC289 }, { 0x4C4C4C, 0x333333 }, { 0x808080, 0x999999 }, { 0x57CFFB, 0xBBEEFF }, - { 0x7D0F0F, 0xD11919 }, { 0x1947D1, 0x476CDA }, { 0xE6005C, 0xCC0052 }, { 0x0033CC, 0x00248F }, - { 0xCCFFFF, 0xA3CCCC }, { 0x248F24, 0xCCFFCC }, { 0x248F24, 0x2EB82E }, { 0xD4D4D4, 0x58300B }, - { 0xFF6600, 0xE65C00 }, { 0xD4D4D4, 0xDDDDDD }, { 0x666699, 0xA3A3CC }, { 0xDA9147, 0xDE9C59 }, - { 0x808080, 0x999999 }, { 0x8585AD, 0x9D9DBD }, { 0xF0DEF0, 0xF2E1F2 }, { 0xC2C2D6, 0xCECEDE }, - { 0xE6B800, 0xCFA600 }, { 0x008AB8, 0xD6D6FF }, { 0xD5D5D5, 0xAAAAAA }, { 0xCC99FF, 0xDBB8FF }, - { 0xEBA1EB, 0xF2C3F2 }, { 0x62626D, 0x161620 }, { 0xE6E6E6, 0xFFFFCC }, { 0xDADADA, 0xD1D1E0 }, - { 0x19AF19, 0x169E16 }, { 0x335C33, 0x6B8F00 }, { 0x003300, 0x002400 }, }; - public boolean showInList; - public final Materials material; - public final int chance; - private final String name; - - private CustomCombs(String pName, boolean show, Materials material, int chance) { - this.name = pName; - this.material = material; - this.chance = chance; - this.showInList = show; - } - - public void setHidden() { - this.showInList = false; - } - - public String getName() { - // return "gt.comb."+this.name; - return GT_LanguageManager.addStringLocalization( - "comb." + this.name, - this.name.substring(0, 1) - .toUpperCase() + this.name.substring(1) + " Comb"); - } - - public int[] getColours() { - return colours[this.ordinal()]; - } -} diff --git a/gtpp/src/main/java/gtPlusPlus/xmod/forestry/bees/custom/GTPP_Bee_Definition.java b/gtpp/src/main/java/gtPlusPlus/xmod/forestry/bees/custom/GTPP_Bee_Definition.java deleted file mode 100644 index 0cdb49a9b5..0000000000 --- a/gtpp/src/main/java/gtPlusPlus/xmod/forestry/bees/custom/GTPP_Bee_Definition.java +++ /dev/null @@ -1,604 +0,0 @@ -package gtPlusPlus.xmod.forestry.bees.custom; - -import java.lang.reflect.Field; -import java.util.Arrays; -import java.util.Locale; - -import net.minecraft.item.ItemStack; -import net.minecraftforge.common.BiomeDictionary.Type; - -import org.apache.commons.lang3.reflect.FieldUtils; -import org.apache.commons.lang3.text.WordUtils; - -import forestry.api.apiculture.BeeManager; -import forestry.api.apiculture.EnumBeeChromosome; -import forestry.api.apiculture.EnumBeeType; -import forestry.api.apiculture.IAlleleBeeSpecies; -import forestry.api.apiculture.IAlleleBeeSpeciesCustom; -import forestry.api.apiculture.IBee; -import forestry.api.apiculture.IBeeGenome; -import forestry.api.apiculture.IBeeMutationCustom; -import forestry.api.core.EnumHumidity; -import forestry.api.core.EnumTemperature; -import forestry.api.genetics.AlleleManager; -import forestry.api.genetics.IAllele; -import forestry.apiculture.genetics.Bee; -import forestry.apiculture.genetics.BeeDefinition; -import forestry.apiculture.genetics.BeeVariation; -import forestry.apiculture.genetics.IBeeDefinition; -import forestry.core.genetics.alleles.AlleleHelper; -import gregtech.loaders.misc.GT_BeeDefinition; -import gtPlusPlus.api.objects.Logger; -import gtPlusPlus.core.util.Utils; -import gtPlusPlus.core.util.minecraft.ItemUtils; -import gtPlusPlus.core.util.reflect.ReflectionUtils; - -public enum GTPP_Bee_Definition implements IBeeDefinition { - - SILICON(GTPP_Branch_Definition.ORGANIC, "Silicon", true, Utils.rgbtoHexValue(75, 75, 75), - Utils.rgbtoHexValue(125, 125, 125)) { - - @Override - protected void setSpeciesProperties(IAlleleBeeSpeciesCustom beeSpecies) { - beeSpecies.addProduct(getSlagComb(), 0.10f); - beeSpecies.addProduct(GTPP_Bees.combs.getStackForType(CustomCombs.SILICON), 0.20f); - beeSpecies.setHumidity(EnumHumidity.NORMAL); - beeSpecies.setTemperature(EnumTemperature.NORMAL); - } - - @Override - protected void setAlleles(IAllele[] template) { - template = BeeDefinition.COMMON.getTemplate(); - } - - @Override - protected void registerMutations() { - IBeeMutationCustom tMutation = registerMutation( - getGregtechBeeType("SLIMEBALL"), - getGregtechBeeType("STICKYRESIN"), - 10); - } - }, - - RUBBER(GTPP_Branch_Definition.ORGANIC, "Rubber", true, Utils.rgbtoHexValue(55, 55, 55), - Utils.rgbtoHexValue(75, 75, 75)) { - - @Override - protected void setSpeciesProperties(IAlleleBeeSpeciesCustom beeSpecies) { - beeSpecies.addProduct(getSlagComb(), 0.10f); - beeSpecies.addProduct(GTPP_Bees.combs.getStackForType(CustomCombs.RUBBER), 0.30f); - beeSpecies.setHumidity(EnumHumidity.NORMAL); - beeSpecies.setTemperature(EnumTemperature.NORMAL); - } - - @Override - protected void setAlleles(IAllele[] template) { - template = BeeDefinition.COMMON.getTemplate(); - } - - @Override - protected void registerMutations() { - IBeeMutationCustom tMutation = registerMutation( - getGregtechBeeType("SLIMEBALL"), - getGregtechBeeType("STICKYRESIN"), - 10); - } - }, - - PLASTIC(GTPP_Branch_Definition.ORGANIC, "Plastic", true, Utils.rgbtoHexValue(245, 245, 245), - Utils.rgbtoHexValue(175, 175, 175)) { - - @Override - protected void setSpeciesProperties(IAlleleBeeSpeciesCustom beeSpecies) { - beeSpecies.addProduct(getStoneComb(), 0.30f); - beeSpecies.addProduct(GTPP_Bees.combs.getStackForType(CustomCombs.PLASTIC), 0.15f); - beeSpecies.setHumidity(EnumHumidity.NORMAL); - beeSpecies.setTemperature(EnumTemperature.NORMAL); - } - - @Override - protected void setAlleles(IAllele[] template) { - template = BeeDefinition.COMMON.getTemplate(); - } - - @Override - protected void registerMutations() { - IBeeMutationCustom tMutation = registerMutation(RUBBER.species, getGregtechBeeType("OIL"), 10); - } - }, - - PTFE(GTPP_Branch_Definition.ORGANIC, "Ptfe", true, Utils.rgbtoHexValue(150, 150, 150), - Utils.rgbtoHexValue(75, 75, 75)) { - - @Override - protected void setSpeciesProperties(IAlleleBeeSpeciesCustom beeSpecies) { - beeSpecies.addProduct(getStoneComb(), 0.30f); - beeSpecies.addProduct(GTPP_Bees.combs.getStackForType(CustomCombs.PTFE), 0.10f); - beeSpecies.setHumidity(EnumHumidity.NORMAL); - beeSpecies.setTemperature(EnumTemperature.NORMAL); - } - - @Override - protected void setAlleles(IAllele[] template) { - template = BeeDefinition.COMMON.getTemplate(); - } - - @Override - protected void registerMutations() { - IBeeMutationCustom tMutation = registerMutation(RUBBER.species, PLASTIC.species, 10); - } - }, - - PBS(GTPP_Branch_Definition.ORGANIC, "Pbs", true, Utils.rgbtoHexValue(33, 26, 24), Utils.rgbtoHexValue(23, 16, 14)) { - - @Override - protected void setSpeciesProperties(IAlleleBeeSpeciesCustom beeSpecies) { - beeSpecies.addProduct(getStoneComb(), 0.30f); - beeSpecies.addProduct(GTPP_Bees.combs.getStackForType(CustomCombs.PBS), 0.10f); - beeSpecies.setHumidity(EnumHumidity.NORMAL); - beeSpecies.setTemperature(EnumTemperature.NORMAL); - } - - @Override - protected void setAlleles(IAllele[] template) { - template = BeeDefinition.COMMON.getTemplate(); - } - - @Override - protected void registerMutations() { - IBeeMutationCustom tMutation = registerMutation(PTFE.species, PLASTIC.species, 10); - } - }, - - /** - * Fuels - */ - BIOMASS(GTPP_Branch_Definition.ORGANIC, "Biomass", true, Utils.rgbtoHexValue(33, 225, 24), - Utils.rgbtoHexValue(23, 175, 14)) { - - @Override - protected void setSpeciesProperties(IAlleleBeeSpeciesCustom beeSpecies) { - beeSpecies.addProduct(GTPP_Bees.combs.getStackForType(CustomCombs.SAND), 0.40f); - beeSpecies.addProduct(GTPP_Bees.combs.getStackForType(CustomCombs.BIOMASS), 0.20f); - beeSpecies.setHumidity(EnumHumidity.NORMAL); - beeSpecies.setTemperature(EnumTemperature.NORMAL); - } - - @Override - protected void setAlleles(IAllele[] template) { - template = BeeDefinition.COMMON.getTemplate(); - } - - @Override - protected void registerMutations() { - IBeeMutationCustom tMutation = registerMutation(getSpecies("Industrious"), getSpecies("Rural"), 10); - tMutation.restrictBiomeType(Type.FOREST); - } - }, - - ETHANOL(GTPP_Branch_Definition.ORGANIC, "Ethanol", true, Utils.rgbtoHexValue(255, 128, 0), - Utils.rgbtoHexValue(220, 156, 32)) { - - @Override - protected void setSpeciesProperties(IAlleleBeeSpeciesCustom beeSpecies) { - beeSpecies.addProduct(GTPP_Bees.combs.getStackForType(CustomCombs.SAND), 0.40f); - beeSpecies.addProduct(GTPP_Bees.combs.getStackForType(CustomCombs.ETHANOL), 0.20f); - beeSpecies.setHumidity(EnumHumidity.NORMAL); - beeSpecies.setTemperature(EnumTemperature.NORMAL); - } - - @Override - protected void setAlleles(IAllele[] template) { - template = BeeDefinition.COMMON.getTemplate(); - } - - @Override - protected void registerMutations() { - IBeeMutationCustom tMutation = registerMutation(BIOMASS.species, getSpecies("Farmerly"), 5); - tMutation.restrictBiomeType(Type.FOREST); - } - }, - - /** - * Materials - */ - FLUORINE(GTPP_Branch_Definition.ORGANIC, "Fluorine", true, Utils.rgbtoHexValue(30, 230, 230), - Utils.rgbtoHexValue(10, 150, 150)) { - - @Override - protected void setSpeciesProperties(IAlleleBeeSpeciesCustom beeSpecies) { - beeSpecies.addProduct(getStoneComb(), 0.40f); - beeSpecies.addProduct(GTPP_Bees.combs.getStackForType(CustomCombs.FLUORINE), 0.05f); - beeSpecies.setHumidity(EnumHumidity.NORMAL); - beeSpecies.setTemperature(EnumTemperature.COLD); - } - - @Override - protected void setAlleles(IAllele[] template) { - template = BeeDefinition.COMMON.getTemplate(); - } - - @Override - protected void registerMutations() { - IBeeMutationCustom tMutation = registerMutation( - getGregtechBeeType("LAPIS"), - getGregtechBeeType("SAPPHIRE"), - 5); - tMutation.restrictBiomeType(Type.COLD); - } - }, - - // Coke - - // Force - FORCE(GTPP_Branch_Definition.METAL, "Force", true, Utils.rgbtoHexValue(250, 250, 20), - Utils.rgbtoHexValue(200, 200, 5)) { - - @Override - protected void setSpeciesProperties(IAlleleBeeSpeciesCustom beeSpecies) { - beeSpecies.addProduct(getStoneComb(), 0.30f); - beeSpecies.addProduct(GTPP_Bees.combs.getStackForType(CustomCombs.SAND), 0.25f); - beeSpecies.addProduct(GTPP_Bees.combs.getStackForType(CustomCombs.FORCE), 0.25f); - beeSpecies.addProduct(GTPP_Bees.combs.getStackForType(CustomCombs.SALT), 0.05f); - beeSpecies.setHumidity(EnumHumidity.NORMAL); - beeSpecies.setTemperature(EnumTemperature.HOT); - } - - @Override - protected void setAlleles(IAllele[] template) { - template = BeeDefinition.COMMON.getTemplate(); - } - - @Override - protected void registerMutations() { - IBeeMutationCustom tMutation = registerMutation( - getGregtechBeeType("STEEL"), - getGregtechBeeType("GOLD"), - 10); - tMutation.restrictBiomeType(Type.HOT); - } - }, - - // Nikolite - NIKOLITE(GTPP_Branch_Definition.METAL, "Nikolite", true, Utils.rgbtoHexValue(60, 180, 200), - Utils.rgbtoHexValue(40, 150, 170)) { - - @Override - protected void setSpeciesProperties(IAlleleBeeSpeciesCustom beeSpecies) { - beeSpecies.addProduct(getStoneComb(), 0.30f); - beeSpecies.addProduct(GTPP_Bees.combs.getStackForType(CustomCombs.NIKOLITE), 0.05f); - beeSpecies.setHumidity(EnumHumidity.NORMAL); - beeSpecies.setTemperature(EnumTemperature.HOT); - } - - @Override - protected void setAlleles(IAllele[] template) { - template = BeeDefinition.COMMON.getTemplate(); - } - - @Override - protected void registerMutations() { - IBeeMutationCustom tMutation = registerMutation( - getGregtechBeeType("ALUMINIUM"), - getGregtechBeeType("SILVER"), - 8); - tMutation.restrictBiomeType(Type.HOT); - } - }, - - /* - * CLAY(GTPP_Branch_Definition.ORGANIC, "Clay", true, 0x19d0ec, 0xffdc16) { - * @Override protected void setSpeciesProperties(IAlleleBeeSpeciesCustom beeSpecies) { - * beeSpecies.addProduct(GT_ModHandler.getModItem(GT_Values.MOD_ID_FR, "beeCombs", 1, 0), 0.30f); - * beeSpecies.addProduct(new ItemStack(Items.clay_ball, 1), 0.15f); beeSpecies.setHumidity(EnumHumidity.DAMP); - * beeSpecies.setTemperature(EnumTemperature.NORMAL); } - * @Override protected void setAlleles(IAllele[] template) { template = BeeDefinition.MEADOWS.getTemplate(); } - * @Override protected void registerMutations() { IBeeMutationCustom tMutation = - * registerMutation(getSpecies("Industrious"), getSpecies("Diligent"), 20); } }, - * SLIMEBALL(GTPP_Branch_Definition.ORGANIC, "SlimeBall", true, 0x4E9E55, 0x00FF15) { - * @Override protected void setSpeciesProperties(IAlleleBeeSpeciesCustom beeSpecies) { - * beeSpecies.addProduct(GT_ModHandler.getModItem(GT_Values.MOD_ID_FR, "beeCombs", 1, 15), 0.30f); - * beeSpecies.addProduct(GTPP_Bees.combs.getStackForType(CustomCombs.STICKY), 0.30f); - * beeSpecies.setHumidity(EnumHumidity.DAMP); beeSpecies.setTemperature(EnumTemperature.NORMAL); } - * @Override protected void setAlleles(IAllele[] template) { template = BeeDefinition.MARSHY.getTemplate(); } - * @Override protected void registerMutations() { IBeeMutationCustom tMutation = - * registerMutation(getSpecies("Marshy"), CLAY.species, 15); } }, PEAT(GTPP_Branch_Definition.ORGANIC, "Peat", true, - * 0x906237, 0x58300B) { - * @Override protected void setSpeciesProperties(IAlleleBeeSpeciesCustom beeSpecies) { - * beeSpecies.addProduct(GTPP_Bees.combs.getStackForType(CustomCombs.LIGNIE), 0.30f); - * beeSpecies.addProduct(GT_ModHandler.getModItem(GT_Values.MOD_ID_FR, "beeCombs", 1, 0), 0.15f); - * beeSpecies.setHumidity(EnumHumidity.NORMAL); beeSpecies.setTemperature(EnumTemperature.NORMAL); } - * @Override protected void setAlleles(IAllele[] template) { template = BeeDefinition.RURAL.getTemplate(); } - * @Override protected void registerMutations() { IBeeMutationCustom tMutation = - * registerMutation(getSpecies("Rural"), CLAY.species, 20); } }, STICKYRESIN(GTPP_Branch_Definition.ORGANIC, - * "StickyResin", true, 0x2E8F5B, 0xDCC289) { - * @Override protected void setSpeciesProperties(IAlleleBeeSpeciesCustom beeSpecies) { - * beeSpecies.addProduct(GT_ModHandler.getModItem(GT_Values.MOD_ID_FR, "beeCombs", 1, 0), 0.30f); - * beeSpecies.addProduct(ItemList.IC2_Resin.get(1, new Object[0]), 0.15f); - * beeSpecies.setHumidity(EnumHumidity.NORMAL); beeSpecies.setTemperature(EnumTemperature.NORMAL); } - * @Override protected void setAlleles(IAllele[] template) { template = BeeDefinition.MEADOWS.getTemplate(); } - * @Override protected void registerMutations() { IBeeMutationCustom tMutation = registerMutation(SLIMEBALL.species, - * PEAT.species, 25); } }, COAL(GTPP_Branch_Definition.ORGANIC, "Coal", true, 0x666666, 0x525252) { - * @Override protected void setSpeciesProperties(IAlleleBeeSpeciesCustom beeSpecies) { - * beeSpecies.addProduct(GTPP_Bees.combs.getStackForType(CustomCombs.LIGNIE), 0.30f); - * beeSpecies.addProduct(GTPP_Bees.combs.getStackForType(CustomCombs.COAL), 0.15f); - * beeSpecies.setHumidity(EnumHumidity.NORMAL); beeSpecies.setTemperature(EnumTemperature.NORMAL); } - * @Override protected void setAlleles(IAllele[] template) { template = BeeDefinition.AUSTERE.getTemplate(); } - * @Override protected void registerMutations() { IBeeMutationCustom tMutation = - * registerMutation(getSpecies("Industrious"), PEAT.species, 18); } }, OIL(GTPP_Branch_Definition.ORGANIC, "Oil", - * true, 0x4C4C4C, 0x333333) { - * @Override protected void setSpeciesProperties(IAlleleBeeSpeciesCustom beeSpecies) { - * beeSpecies.addProduct(GT_ModHandler.getModItem(GT_Values.MOD_ID_FR, "beeCombs", 1, 0), 0.30f); - * beeSpecies.addProduct(GTPP_Bees.combs.getStackForType(CustomCombs.OIL), 0.15f); - * beeSpecies.setHumidity(EnumHumidity.DAMP); beeSpecies.setTemperature(EnumTemperature.NORMAL); - * beeSpecies.setNocturnal(); } - * @Override protected void setAlleles(IAllele[] template) { template = BeeDefinition.MEADOWS.getTemplate(); } - * @Override protected void registerMutations() { IBeeMutationCustom tMutation = registerMutation(COAL.species, - * STICKYRESIN.species, 8); } }, REDSTONE(GTPP_Branch_Definition.GEM, "Redstone", true, 0x7D0F0F, 0xD11919) { - * @Override protected void setSpeciesProperties(IAlleleBeeSpeciesCustom beeSpecies) { - * beeSpecies.addProduct(GTPP_Bees.combs.getStackForType(CustomCombs.STONE), 0.30f); - * beeSpecies.addProduct(GTPP_Bees.combs.getStackForType(CustomCombs.REDSTONE), 0.15f); - * beeSpecies.setHumidity(EnumHumidity.NORMAL); beeSpecies.setTemperature(EnumTemperature.NORMAL); } - * @Override protected void setAlleles(IAllele[] template) { template = BeeDefinition.COMMON.getTemplate(); } - * @Override protected void registerMutations() { IBeeMutationCustom tMutation = - * registerMutation(getSpecies("Industrious"), getSpecies("Demonic"), 20); } }, LAPIS(GTPP_Branch_Definition.GEM, - * "Lapis", true, 0x1947D1, 0x476CDA) { - * @Override protected void setSpeciesProperties(IAlleleBeeSpeciesCustom beeSpecies) { - * beeSpecies.addProduct(GTPP_Bees.combs.getStackForType(CustomCombs.STONE), 0.30f); - * beeSpecies.addProduct(GTPP_Bees.combs.getStackForType(CustomCombs.LAPIS), 0.15f); - * beeSpecies.setHumidity(EnumHumidity.NORMAL); beeSpecies.setTemperature(EnumTemperature.NORMAL); } - * @Override protected void setAlleles(IAllele[] template) { template = BeeDefinition.COMMON.getTemplate(); } - * @Override protected void registerMutations() { IBeeMutationCustom tMutation = - * registerMutation(getSpecies("Demonic"), getSpecies("Imperial"), 20); } }, CERTUS(GTPP_Branch_Definition.GEM, - * "CertusQuartz", true, 0x57CFFB, 0xBBEEFF) { - * @Override protected void setSpeciesProperties(IAlleleBeeSpeciesCustom beeSpecies) { - * beeSpecies.addProduct(GTPP_Bees.combs.getStackForType(CustomCombs.STONE), 0.30f); - * beeSpecies.addProduct(GTPP_Bees.combs.getStackForType(CustomCombs.CERTUS), 0.15f); - * beeSpecies.setHumidity(EnumHumidity.NORMAL); beeSpecies.setTemperature(EnumTemperature.NORMAL); } - * @Override protected void setAlleles(IAllele[] template) { template = BeeDefinition.COMMON.getTemplate(); } - * @Override protected void registerMutations() { IBeeMutationCustom tMutation = - * registerMutation(getSpecies("Hermitic"), LAPIS.species, 20); } }, RUBY(GTPP_Branch_Definition.GEM, "Ruby", true, - * 0xE6005C, 0xCC0052) { - * @Override protected void setSpeciesProperties(IAlleleBeeSpeciesCustom beeSpecies) { - * beeSpecies.addProduct(GTPP_Bees.combs.getStackForType(CustomCombs.STONE), 0.30f); - * beeSpecies.addProduct(GTPP_Bees.combs.getStackForType(CustomCombs.RUBY), 0.15f); - * beeSpecies.setHumidity(EnumHumidity.NORMAL); beeSpecies.setTemperature(EnumTemperature.NORMAL); } - * @Override protected void setAlleles(IAllele[] template) { template = BeeDefinition.COMMON.getTemplate(); } - * @Override protected void registerMutations() { IBeeMutationCustom tMutation = registerMutation(REDSTONE.species, - * DIAMOND.species, 10); } }, SAPPHIRE(GTPP_Branch_Definition.GEM, "Sapphire", true, 0x0033CC, 0x00248F) { - * @Override protected void setSpeciesProperties(IAlleleBeeSpeciesCustom beeSpecies) { - * beeSpecies.addProduct(GTPP_Bees.combs.getStackForType(CustomCombs.STONE), 0.30f); - * beeSpecies.addProduct(GTPP_Bees.combs.getStackForType(CustomCombs.SAPPHIRE), 0.15f); - * beeSpecies.setHumidity(EnumHumidity.NORMAL); beeSpecies.setTemperature(EnumTemperature.NORMAL); } - * @Override protected void setAlleles(IAllele[] template) { template = BeeDefinition.COMMON.getTemplate(); } - * @Override protected void registerMutations() { IBeeMutationCustom tMutation = registerMutation(CERTUS.species, - * LAPIS.species, 10); } }, DIAMOND(GTPP_Branch_Definition.GEM, "Diamond", true, 0xCCFFFF, 0xA3CCCC) { - * @Override protected void setSpeciesProperties(IAlleleBeeSpeciesCustom beeSpecies) { - * beeSpecies.addProduct(GTPP_Bees.combs.getStackForType(CustomCombs.STONE), 0.30f); - * beeSpecies.addProduct(GTPP_Bees.combs.getStackForType(CustomCombs.DIAMOND), 0.15f); - * beeSpecies.setHumidity(EnumHumidity.NORMAL); beeSpecies.setTemperature(EnumTemperature.NORMAL); } - * @Override protected void setAlleles(IAllele[] template) { template = BeeDefinition.COMMON.getTemplate(); } - * @Override protected void registerMutations() { IBeeMutationCustom tMutation = registerMutation(CERTUS.species, - * COAL.species, 6); } }, OLIVINE(GTPP_Branch_Definition.GEM, "Olivine", true, 0x248F24, 0xCCFFCC) { - * @Override protected void setSpeciesProperties(IAlleleBeeSpeciesCustom beeSpecies) { - * beeSpecies.addProduct(GTPP_Bees.combs.getStackForType(CustomCombs.STONE), 0.30f); - * beeSpecies.addProduct(GTPP_Bees.combs.getStackForType(CustomCombs.OLIVINE), 0.15f); - * beeSpecies.setHumidity(EnumHumidity.NORMAL); beeSpecies.setTemperature(EnumTemperature.NORMAL); } - * @Override protected void setAlleles(IAllele[] template) { template = BeeDefinition.COMMON.getTemplate(); } - * @Override protected void registerMutations() { IBeeMutationCustom tMutation = registerMutation(CERTUS.species, - * getSpecies("Ended"), 10); } }, EMERALD(GTPP_Branch_Definition.GEM, "Emerald", true, 0x248F24, 0x2EB82E) { - * @Override protected void setSpeciesProperties(IAlleleBeeSpeciesCustom beeSpecies) { - * beeSpecies.addProduct(GTPP_Bees.combs.getStackForType(CustomCombs.STONE), 0.30f); - * beeSpecies.addProduct(GTPP_Bees.combs.getStackForType(CustomCombs.EMERALD), 0.15f); - * beeSpecies.setHumidity(EnumHumidity.NORMAL); beeSpecies.setTemperature(EnumTemperature.COLD); } - * @Override protected void setAlleles(IAllele[] template) { template = BeeDefinition.COMMON.getTemplate(); } - * @Override protected void registerMutations() { IBeeMutationCustom tMutation = registerMutation(OLIVINE.species, - * DIAMOND.species, 8); } }, COPPER(GTPP_Branch_Definition.METAL, "Copper", true, 0xFF6600, 0xE65C00) { - * @Override protected void setSpeciesProperties(IAlleleBeeSpeciesCustom beeSpecies) { - * beeSpecies.addProduct(GTPP_Bees.combs.getStackForType(CustomCombs.SLAG), 0.30f); - * beeSpecies.addProduct(GTPP_Bees.combs.getStackForType(CustomCombs.COPPER), 0.15f); - * beeSpecies.setHumidity(EnumHumidity.NORMAL); beeSpecies.setTemperature(EnumTemperature.NORMAL); } - * @Override protected void setAlleles(IAllele[] template) { template = BeeDefinition.COMMON.getTemplate(); } - * @Override protected void registerMutations() { IBeeMutationCustom tMutation = - * registerMutation(getSpecies("Majestic"), CLAY.species, 25); } }, TIN(GTPP_Branch_Definition.METAL, "Tin", true, - * 0xD4D4D4, 0xDDDDDD) { - * @Override protected void setSpeciesProperties(IAlleleBeeSpeciesCustom beeSpecies) { - * beeSpecies.addProduct(GTPP_Bees.combs.getStackForType(CustomCombs.SLAG), 0.30f); - * beeSpecies.addProduct(GTPP_Bees.combs.getStackForType(CustomCombs.TIN), 0.15f); - * beeSpecies.setHumidity(EnumHumidity.NORMAL); beeSpecies.setTemperature(EnumTemperature.NORMAL); } - * @Override protected void setAlleles(IAllele[] template) { template = BeeDefinition.COMMON.getTemplate(); } - * @Override protected void registerMutations() { IBeeMutationCustom tMutation = registerMutation(CLAY.species, - * getSpecies("Diligent"), 25); } }, LEAD(GTPP_Branch_Definition.METAL, "Lead", true, 0x666699, 0xA3A3CC) { - * @Override protected void setSpeciesProperties(IAlleleBeeSpeciesCustom beeSpecies) { - * beeSpecies.addProduct(GTPP_Bees.combs.getStackForType(CustomCombs.SLAG), 0.30f); - * beeSpecies.addProduct(GTPP_Bees.combs.getStackForType(CustomCombs.LEAD), 0.15f); - * beeSpecies.setHumidity(EnumHumidity.DAMP); beeSpecies.setTemperature(EnumTemperature.WARM); } - * @Override protected void setAlleles(IAllele[] template) { template = BeeDefinition.COMMON.getTemplate(); } - * @Override protected void registerMutations() { IBeeMutationCustom tMutation = registerMutation(COAL.species, - * COPPER.species, 25); } }, IRON(GTPP_Branch_Definition.METAL, "Iron", true, 0xDA9147, 0xDE9C59) { - * @Override protected void setSpeciesProperties(IAlleleBeeSpeciesCustom beeSpecies) { - * beeSpecies.addProduct(GTPP_Bees.combs.getStackForType(CustomCombs.SLAG), 0.30f); - * beeSpecies.addProduct(GTPP_Bees.combs.getStackForType(CustomCombs.IRON), 0.15f); - * beeSpecies.setHumidity(EnumHumidity.NORMAL); beeSpecies.setTemperature(EnumTemperature.NORMAL); } - * @Override protected void setAlleles(IAllele[] template) { template = BeeDefinition.COMMON.getTemplate(); } - * @Override protected void registerMutations() { IBeeMutationCustom tMutation = registerMutation(TIN.species, - * COPPER.species, 25); } }, STEEL(GTPP_Branch_Definition.METAL, "Steel", true, 0x808080, 0x999999) { - * @Override protected void setSpeciesProperties(IAlleleBeeSpeciesCustom beeSpecies) { - * beeSpecies.addProduct(GTPP_Bees.combs.getStackForType(CustomCombs.SLAG), 0.30f); - * beeSpecies.addProduct(GTPP_Bees.combs.getStackForType(CustomCombs.STEEL), 0.15f); - * beeSpecies.setHumidity(EnumHumidity.NORMAL); beeSpecies.setTemperature(EnumTemperature.NORMAL); } - * @Override protected void setAlleles(IAllele[] template) { template = BeeDefinition.COMMON.getTemplate(); } - * @Override protected void registerMutations() { IBeeMutationCustom tMutation = registerMutation(IRON.species, - * COAL.species, 20); } }, NICKEL(GTPP_Branch_Definition.METAL, "Nickel", true, 0x8585AD, 0x8585AD) { - * @Override protected void setSpeciesProperties(IAlleleBeeSpeciesCustom beeSpecies) { - * beeSpecies.addProduct(GTPP_Bees.combs.getStackForType(CustomCombs.SLAG), 0.30f); - * beeSpecies.addProduct(GTPP_Bees.combs.getStackForType(CustomCombs.NICKEL), 0.15f); - * beeSpecies.setHumidity(EnumHumidity.NORMAL); beeSpecies.setTemperature(EnumTemperature.NORMAL); } - * @Override protected void setAlleles(IAllele[] template) { template = BeeDefinition.COMMON.getTemplate(); } - * @Override protected void registerMutations() { IBeeMutationCustom tMutation = registerMutation(IRON.species, - * COPPER.species, 25); } }, ZINC(GTPP_Branch_Definition.METAL, "Zinc", true, 0xF0DEF0, 0xF2E1F2) { - * @Override protected void setSpeciesProperties(IAlleleBeeSpeciesCustom beeSpecies) { - * beeSpecies.addProduct(GTPP_Bees.combs.getStackForType(CustomCombs.SLAG), 0.30f); - * beeSpecies.addProduct(GTPP_Bees.combs.getStackForType(CustomCombs.ZINC), 0.15f); - * beeSpecies.setHumidity(EnumHumidity.NORMAL); beeSpecies.setTemperature(EnumTemperature.NORMAL); } - * @Override protected void setAlleles(IAllele[] template) { template = BeeDefinition.COMMON.getTemplate(); } - * @Override protected void registerMutations() { IBeeMutationCustom tMutation = registerMutation(IRON.species, - * TIN.species, 20); } }, SILVER(GTPP_Branch_Definition.METAL, "Silver", true, 0xC2C2D6, 0xCECEDE) { - * @Override protected void setSpeciesProperties(IAlleleBeeSpeciesCustom beeSpecies) { - * beeSpecies.addProduct(GTPP_Bees.combs.getStackForType(CustomCombs.SLAG), 0.30f); - * beeSpecies.addProduct(GTPP_Bees.combs.getStackForType(CustomCombs.SILVER), 0.15f); - * beeSpecies.setHumidity(EnumHumidity.NORMAL); beeSpecies.setTemperature(EnumTemperature.NORMAL); } - * @Override protected void setAlleles(IAllele[] template) { template = BeeDefinition.COMMON.getTemplate(); } - * @Override protected void registerMutations() { IBeeMutationCustom tMutation = registerMutation(LEAD.species, - * TIN.species, 20); } }, GOLD(GTPP_Branch_Definition.METAL, "Gold", true, 0xEBC633, 0xEDCC47) { - * @Override protected void setSpeciesProperties(IAlleleBeeSpeciesCustom beeSpecies) { - * beeSpecies.addProduct(GTPP_Bees.combs.getStackForType(CustomCombs.SLAG), 0.30f); - * beeSpecies.addProduct(GTPP_Bees.combs.getStackForType(CustomCombs.GOLD), 0.15f); - * beeSpecies.setHumidity(EnumHumidity.NORMAL); beeSpecies.setTemperature(EnumTemperature.NORMAL); } - * @Override protected void setAlleles(IAllele[] template) { template = BeeDefinition.COMMON.getTemplate(); } - * @Override protected void registerMutations() { IBeeMutationCustom tMutation = registerMutation(LEAD.species, - * COPPER.species, 20); } }, ALUMINIUM(GTPP_Branch_Definition.RAREMETAL, "Aluminium", true, 0xB8B8FF, 0xD6D6FF) { - * @Override protected void setSpeciesProperties(IAlleleBeeSpeciesCustom beeSpecies) { - * beeSpecies.addProduct(GTPP_Bees.combs.getStackForType(CustomCombs.SLAG), 0.30f); - * beeSpecies.addProduct(GTPP_Bees.combs.getStackForType(CustomCombs.ALUMINIUM), 0.15f); - * beeSpecies.setHumidity(EnumHumidity.ARID); beeSpecies.setTemperature(EnumTemperature.HOT); } - * @Override protected void setAlleles(IAllele[] template) { template = BeeDefinition.COMMON.getTemplate(); } - * @Override protected void registerMutations() { IBeeMutationCustom tMutation = registerMutation(NICKEL.species, - * ZINC.species, 18); } }, TITANIUM(GTPP_Branch_Definition.RAREMETAL, "Titanium", true, 0xCC99FF, 0xDBB8FF) { - * @Override protected void setSpeciesProperties(IAlleleBeeSpeciesCustom beeSpecies) { - * beeSpecies.addProduct(GTPP_Bees.combs.getStackForType(CustomCombs.SLAG), 0.30f); - * beeSpecies.addProduct(GTPP_Bees.combs.getStackForType(CustomCombs.TITANIUM), 0.15f); - * beeSpecies.setHumidity(EnumHumidity.ARID); beeSpecies.setTemperature(EnumTemperature.HOT); } - * @Override protected void setAlleles(IAllele[] template) { template = BeeDefinition.COMMON.getTemplate(); } - * @Override protected void registerMutations() { IBeeMutationCustom tMutation = registerMutation(REDSTONE.species, - * ALUMINIUM.species, 5); } } - */ - - ; - - private final GTPP_Branch_Definition branch; - private final IAlleleBeeSpeciesCustom species; - - private IAllele[] template; - private IBeeGenome genome; - - GTPP_Bee_Definition(GTPP_Branch_Definition branch, String binomial, boolean dominant, int primary, int secondary) { - String lowercaseName = this.toString() - .toLowerCase(Locale.ENGLISH); - String species = "species" + WordUtils.capitalize(lowercaseName); - - String uid = "forestry." + species; - String description = "for.description." + species; - String name = "for.bees.species." + lowercaseName; - - this.branch = branch; - this.species = BeeManager.beeFactory.createSpecies( - uid, - dominant, - "Sengir", - name, - description, - branch.getBranch(), - binomial, - primary, - secondary); - } - - public static void initBees() { - for (GTPP_Bee_Definition bee : values()) { - bee.init(); - } - for (GTPP_Bee_Definition bee : values()) { - bee.registerMutations(); - } - } - - private static IAlleleBeeSpecies getSpecies(String name) { - return (IAlleleBeeSpecies) AlleleManager.alleleRegistry.getAllele( - (new StringBuilder()).append("forestry.species") - .append(name) - .toString()); - } - - protected abstract void setSpeciesProperties(IAlleleBeeSpeciesCustom beeSpecies); - - protected abstract void setAlleles(IAllele[] template); - - protected abstract void registerMutations(); - - private void init() { - setSpeciesProperties(species); - - template = branch.getTemplate(); - AlleleHelper.instance.set(template, EnumBeeChromosome.SPECIES, species); - setAlleles(template); - - genome = BeeManager.beeRoot.templateAsGenome(template); - - BeeManager.beeRoot.registerTemplate(template); - } - - protected final IBeeMutationCustom registerMutation(IAlleleBeeSpecies parent1, IAlleleBeeSpecies parent2, - int chance) { - IAllele[] template = getTemplate(); - Logger.DEBUG_BEES("parent1: " + (parent1 != null)); - Logger.DEBUG_BEES("parent2: " + (parent2 != null)); - Logger.DEBUG_BEES("chance: " + (chance)); - Logger.DEBUG_BEES("template: " + (template != null)); - return BeeManager.beeMutationFactory.createMutation(parent1, parent2, template, chance); - } - - @Override - public final IAllele[] getTemplate() { - return Arrays.copyOf(template, template.length); - } - - @Override - public final IBeeGenome getGenome() { - return genome; - } - - @Override - public final IBee getIndividual() { - return new Bee(genome); - } - - @Override - public final ItemStack getMemberStack(EnumBeeType beeType) { - IBee bee = getIndividual(); - return BeeManager.beeRoot.getMemberStack(bee, beeType.ordinal()); - } - - public final IBeeDefinition getRainResist() { - return new BeeVariation.RainResist(this); - } - - private static ItemStack getSlagComb() { - return issStackValid(ItemUtils.getSimpleStack(GTPP_Bees.Comb_Slag, 1)); - } - - private static ItemStack getStoneComb() { - return issStackValid(ItemUtils.getSimpleStack(GTPP_Bees.Comb_Stone, 1)); - } - - private static ItemStack issStackValid(ItemStack result) { - if (result == null) { - return ItemUtils.getErrorStack(1); - } - return result; - } - - public static IAlleleBeeSpecies getGregtechBeeType(String name) { - try { - Enum<GT_BeeDefinition> gtBeeEnumObject = Enum.valueOf(GT_BeeDefinition.class, name); - Field gtBeesField = FieldUtils.getDeclaredField(GT_BeeDefinition.class, "species", true); - gtBeesField.setAccessible(true); - ReflectionUtils.makeFieldAccessible(gtBeesField); - Object beeType = gtBeesField.get(gtBeeEnumObject); - return (IAlleleBeeSpecies) beeType; - } catch (IllegalArgumentException | IllegalAccessException e) { - e.printStackTrace(); - } - return null; - } -} diff --git a/gtpp/src/main/java/gtPlusPlus/xmod/forestry/bees/custom/GTPP_Bees.java b/gtpp/src/main/java/gtPlusPlus/xmod/forestry/bees/custom/GTPP_Bees.java deleted file mode 100644 index 4d04e3ad31..0000000000 --- a/gtpp/src/main/java/gtPlusPlus/xmod/forestry/bees/custom/GTPP_Bees.java +++ /dev/null @@ -1,172 +0,0 @@ -package gtPlusPlus.xmod.forestry.bees.custom; - -import static gregtech.api.enums.Mods.Forestry; -import static gregtech.api.recipe.RecipeMaps.fluidExtractionRecipes; -import static gregtech.api.util.GT_RecipeBuilder.SECONDS; -import static gregtech.api.util.GT_RecipeBuilder.TICKS; - -import java.lang.reflect.Field; -import java.lang.reflect.InvocationTargetException; -import java.lang.reflect.Method; - -import net.minecraft.item.Item; -import net.minecraft.item.ItemStack; -import net.minecraftforge.fluids.FluidStack; - -import org.apache.commons.lang3.reflect.FieldUtils; - -import gregtech.GT_Mod; -import gregtech.api.enums.GT_Values; -import gregtech.api.enums.Materials; -import gtPlusPlus.api.objects.Logger; -import gtPlusPlus.core.item.base.ingots.BaseItemIngot_OLD; -import gtPlusPlus.core.item.base.misc.BaseItemMisc; -import gtPlusPlus.core.item.base.misc.BaseItemMisc.MiscTypes; -import gtPlusPlus.core.util.Utils; -import gtPlusPlus.core.util.minecraft.FluidUtils; -import gtPlusPlus.core.util.minecraft.ItemUtils; -import gtPlusPlus.core.util.reflect.ReflectionUtils; - -public class GTPP_Bees { - - // Custom Comb Drop Base Items - public static Item dropForceGem; - public static Item dropBiomassBlob; - public static Item dropEthanolBlob; - public static Item dropNikoliteDust; - public static Item dropFluorineBlob; - - // Base Comb Item - public static ItemCustomComb combs; - - // Combs obtained via reflection - public static ItemStack Comb_Slag; - public static ItemStack Comb_Stone; - - // Materials obtained via reflection - public static Materials PTFE; - public static Materials PBS; - - // public static GTPP_Branch_Definition definition; - - public GTPP_Bees() { - if (Forestry.isModLoaded()) { - - // Set Materials and Comb stacks from GT via Reflection - setMaterials(); - setCustomItems(); - - try { - combs = new ItemCustomComb(); - combs.initCombsRecipes(); - GTPP_Bee_Definition.initBees(); - } catch (Throwable t) { - Logger.BEES("Failed to load bees, probably due to an ancient forestry version"); - t.printStackTrace(); - } - } - } - - private void setCustomItems() { - dropForceGem = new BaseItemMisc("Force", new short[] { 250, 250, 20 }, 64, MiscTypes.GEM, null); - dropBiomassBlob = new BaseItemMisc("Biomass", new short[] { 33, 225, 24 }, 64, MiscTypes.DROP, null); - dropEthanolBlob = new BaseItemMisc("Ethanol", new short[] { 255, 128, 0 }, 64, MiscTypes.DROP, null); - - // Nikolite may not exist, so lets make it. - dropNikoliteDust = ItemUtils - .generateSpecialUseDusts("Nikolite", "Nikolite", Utils.rgbtoHexValue(60, 180, 200))[2]; - - if (ItemUtils.getItemStackOfAmountFromOreDictNoBroken("ingotNikolite", 1) == null) { - new BaseItemIngot_OLD("itemIngotNikolite", "Nikolite", Utils.rgbtoHexValue(60, 180, 200), 0); - } - - dropFluorineBlob = new BaseItemMisc("Fluorine", new short[] { 30, 230, 230 }, 64, MiscTypes.DROP, null); - addRecipes(); - } - - private void addRecipes() { - addExtractorRecipe(ItemUtils.getSimpleStack(dropBiomassBlob), FluidUtils.getFluidStack("biomass", 30)); - addExtractorRecipe(ItemUtils.getSimpleStack(dropEthanolBlob), FluidUtils.getFluidStack("ethanol", 6)); - addExtractorRecipe(ItemUtils.getSimpleStack(dropFluorineBlob), FluidUtils.getFluidStack("fluorine", 4)); - } - - private void addExtractorRecipe(ItemStack input, FluidStack output) { - GT_Values.RA.stdBuilder() - .itemInputs(input) - .fluidOutputs(output) - .duration(1 * SECONDS + 10 * TICKS) - .eut(8) - .addTo(fluidExtractionRecipes); - } - - private static boolean tryGetBeesBoolean() { - try { - Class<?> mProxy = Class.forName("gregtech.GT_Mod.gregtechproxy"); - Field mNerf = FieldUtils.getDeclaredField(mProxy, "mGTBees", true); - boolean returnValue = (boolean) mNerf.get(GT_Mod.gregtechproxy); - return returnValue; - } catch (ClassNotFoundException | IllegalArgumentException | IllegalAccessException e) { - return false; - } - } - - private void setMaterials() { - try { - - Class<?> gtBees = Class.forName("gregtech.loaders.misc.GT_Bees"); - Class<?> gtCombItemClass = Class.forName("gregtech.common.items.ItemComb"); - Class gtCombEnumClass = Class.forName("gregtech.common.items.CombType"); - Field gtCombs = FieldUtils.getDeclaredField(gtBees, "combs", true); - gtCombs.setAccessible(true); - ReflectionUtils.makeFieldAccessible(gtCombs); - Enum gtCombTypeSlag = Enum.valueOf(gtCombEnumClass, "SLAG"); - Enum gtCombTypeStone = Enum.valueOf(gtCombEnumClass, "STONE"); - Object oCombObject = gtCombs.get(null); - - Logger.DEBUG_BEES("Field getModifiers: " + gtCombs.getModifiers()); - Logger.DEBUG_BEES("Field toGenericString: " + gtCombs.toGenericString()); - Logger.DEBUG_BEES("Field getClass: " + gtCombs.getClass()); - Logger.DEBUG_BEES("Field isEnumConstant: " + gtCombs.isEnumConstant()); - Logger.DEBUG_BEES("Field isSynthetic: " + gtCombs.isSynthetic()); - Logger.DEBUG_BEES("Field get(gtBees) != null: " + (gtCombs.get(gtBees) != null)); - Logger.DEBUG_BEES("Field isAccessible: " + gtCombs.isAccessible()); - - Logger.BEES("gtBees: " + (gtBees != null)); - Logger.BEES("gtCombItemClass: " + (gtCombItemClass != null)); - Logger.BEES("gtCombEnumClass: " + (gtCombEnumClass != null)); - Logger.BEES("gtCombs: " + (gtCombs != null)); - Logger.BEES("gtCombTypeSlag: " + (gtCombTypeSlag != null)); - Logger.BEES("gtCombTypeStone: " + (gtCombTypeStone != null)); - Logger.BEES("oCombObject: " + (oCombObject != null)); - - // if (gtCombItemClass.isInstance(oCombObject)){ - Method getStackForType; - getStackForType = gtCombItemClass.getDeclaredMethod("getStackForType", gtCombEnumClass); - - if (getStackForType != null) { - Logger.BEES("Found Method: getStackForType"); - } - if (Comb_Slag == null) { - Comb_Slag = (ItemStack) getStackForType.invoke(gtBees, gtCombTypeSlag); - } - if (Comb_Stone == null) { - Comb_Stone = (ItemStack) getStackForType.invoke(gtBees, gtCombTypeStone); - } - - } catch (NullPointerException | ClassNotFoundException | IllegalArgumentException | IllegalAccessException - | NoSuchMethodException | SecurityException | InvocationTargetException e) { - Logger.BEES("Bad Reflection. setMaterials()"); - } - - PTFE = trySetValue("Polytetrafluoroethylene"); - PBS = trySetValue("StyreneButadieneRubber"); - } - - private Materials trySetValue(String material) { - Materials mTemp = Materials.get(material); - if (mTemp != Materials._NULL) { - return mTemp; - } - return Materials._NULL; - } -} diff --git a/gtpp/src/main/java/gtPlusPlus/xmod/forestry/bees/custom/GTPP_Branch_Definition.java b/gtpp/src/main/java/gtPlusPlus/xmod/forestry/bees/custom/GTPP_Branch_Definition.java deleted file mode 100644 index 94e6078c49..0000000000 --- a/gtpp/src/main/java/gtPlusPlus/xmod/forestry/bees/custom/GTPP_Branch_Definition.java +++ /dev/null @@ -1,76 +0,0 @@ -package gtPlusPlus.xmod.forestry.bees.custom; - -import java.lang.reflect.InvocationTargetException; -import java.lang.reflect.Method; - -import forestry.api.genetics.IAllele; -import forestry.api.genetics.IClassification; -import gtPlusPlus.api.objects.Logger; - -public enum GTPP_Branch_Definition { - - ORGANIC("ORGANIC"), - GEM("GEM"), - METAL("METAL"), - RAREMETAL("RAREMETAL"), - RADIOACTIVE("RADIOACTIVE"); - - final String mFieldName; - final Enum mActualValues; - - GTPP_Branch_Definition(String mValue) { - this.mFieldName = mValue; - this.mActualValues = setEnumVar(mValue); - } - - public final IAllele[] getTemplate() { - Class gtBranchDefClass; - try { - gtBranchDefClass = Class.forName("gregtech.loaders.misc.GT_BranchDefinition"); - Enum enumA = mActualValues; - Method methodMyMethod = gtBranchDefClass.getMethod("getTemplate"); - - Logger.INFO("[Bees] gtBranchDefClass: " + (gtBranchDefClass != null)); - Logger.INFO("[Bees] enumA: " + (enumA != null)); - Logger.INFO("[Bees] methodMyMethod: " + (methodMyMethod != null)); - - return (IAllele[]) methodMyMethod.invoke(enumA); - } catch (ClassNotFoundException | NoSuchMethodException | SecurityException | IllegalAccessException - | IllegalArgumentException | InvocationTargetException e) { - Logger.INFO("[Bees] Bad Reflection. getTemplate()"); - e.printStackTrace(); - // gregtech.loaders.misc.GT_BranchDefinition.getTemplate() - return null; - } - } - - public final IClassification getBranch() { - Class gtBranchDefClass; - try { - gtBranchDefClass = Class.forName("gregtech.loaders.misc.GT_BranchDefinition"); - Enum enum_MY_SAMPLE_ENUM = mActualValues; - Method methodMyMethod = gtBranchDefClass.getMethod("getBranch"); - - Logger.INFO("[Bees] gtBranchDefClass: " + (gtBranchDefClass != null)); - Logger.INFO("[Bees] enum_MY_SAMPLE_ENUM: " + (enum_MY_SAMPLE_ENUM != null)); - Logger.INFO("[Bees] methodMyMethod: " + (methodMyMethod != null)); - - return (IClassification) methodMyMethod.invoke(enum_MY_SAMPLE_ENUM); - } catch (ClassNotFoundException | NoSuchMethodException | SecurityException | IllegalAccessException - | IllegalArgumentException | InvocationTargetException e) { - Logger.INFO("[Bees] Bad Reflection. getBranch()"); - e.printStackTrace(); - return null; - } - } - - private Enum setEnumVar(String value) { - try { - Class gtBranchDefClass = Class.forName("gregtech.loaders.misc.GT_BranchDefinition"); - Enum branchDef = Enum.valueOf(gtBranchDefClass, value); - return branchDef; - } catch (ClassNotFoundException e) { - return null; - } - } -} diff --git a/gtpp/src/main/java/gtPlusPlus/xmod/forestry/bees/custom/ItemCustomComb.java b/gtpp/src/main/java/gtPlusPlus/xmod/forestry/bees/custom/ItemCustomComb.java deleted file mode 100644 index 63c0ae53ec..0000000000 --- a/gtpp/src/main/java/gtPlusPlus/xmod/forestry/bees/custom/ItemCustomComb.java +++ /dev/null @@ -1,142 +0,0 @@ -package gtPlusPlus.xmod.forestry.bees.custom; - -import static gregtech.api.enums.Mods.GTPlusPlus; -import static gregtech.api.recipe.RecipeMaps.centrifugeRecipes; -import static gregtech.api.util.GT_RecipeBuilder.SECONDS; -import static gregtech.api.util.GT_RecipeBuilder.TICKS; - -import java.util.List; - -import net.minecraft.client.renderer.texture.IIconRegister; -import net.minecraft.creativetab.CreativeTabs; -import net.minecraft.item.Item; -import net.minecraft.item.ItemStack; -import net.minecraft.util.IIcon; - -import cpw.mods.fml.common.registry.GameRegistry; -import cpw.mods.fml.relauncher.Side; -import cpw.mods.fml.relauncher.SideOnly; -import forestry.api.core.Tabs; -import gregtech.api.enums.GT_Values; -import gregtech.api.enums.ItemList; -import gregtech.api.enums.Materials; -import gregtech.api.enums.OrePrefixes; -import gregtech.api.util.GT_OreDictUnificator; -import gtPlusPlus.core.util.minecraft.ItemUtils; - -public class ItemCustomComb extends Item { - - @SideOnly(Side.CLIENT) - private IIcon secondIcon; - - public ItemCustomComb() { - super(); - this.setCreativeTab(Tabs.tabApiculture); - this.setHasSubtypes(true); - this.setUnlocalizedName("gtpp.comb"); - GameRegistry.registerItem(this, "gtpp.comb", GTPlusPlus.ID); - } - - public ItemStack getStackForType(CustomCombs type) { - return new ItemStack(this, 1, type.ordinal()); - } - - public ItemStack getStackForType(CustomCombs type, int count) { - return new ItemStack(this, count, type.ordinal()); - } - - @SuppressWarnings({ "unchecked", "rawtypes" }) - @Override - @SideOnly(Side.CLIENT) - public void getSubItems(Item item, CreativeTabs tabs, List list) { - for (CustomCombs type : CustomCombs.values()) { - if (type.showInList) { - list.add(this.getStackForType(type)); - } - } - } - - @Override - @SideOnly(Side.CLIENT) - public boolean requiresMultipleRenderPasses() { - return true; - } - - @Override - public int getRenderPasses(int meta) { - return 2; - } - - @Override - @SideOnly(Side.CLIENT) - public void registerIcons(IIconRegister par1IconRegister) { - this.itemIcon = par1IconRegister.registerIcon("forestry:beeCombs.0"); - this.secondIcon = par1IconRegister.registerIcon("forestry:beeCombs.1"); - } - - @Override - public IIcon getIcon(ItemStack stack, int pass) { - return (pass == 0) ? itemIcon : secondIcon; - } - - @Override - @SideOnly(Side.CLIENT) - public int getColorFromItemStack(ItemStack stack, int pass) { - int meta = Math.max(0, Math.min(CustomCombs.values().length - 1, stack.getItemDamage())); - int colour = CustomCombs.values()[meta].getColours()[0]; - - if (pass >= 1) { - colour = CustomCombs.values()[meta].getColours()[1]; - } - - return colour; - } - - @Override - public String getItemStackDisplayName(ItemStack stack) { - return CustomCombs.values()[stack.getItemDamage()].getName(); - } - - public void initCombsRecipes() { - ItemStack tComb; - - tComb = getStackForType(CustomCombs.SILICON); - addSpecialCent(tComb, GT_OreDictUnificator.get(OrePrefixes.dustTiny, Materials.Silicon, 1), 30); - // addProcess(tComb, Materials.Silver, 100); - // addProcess(tComb, Materials.Galena, 100); - - // Rubbers - tComb = getStackForType(CustomCombs.RUBBER); - addSpecialCent(tComb, GT_OreDictUnificator.get(OrePrefixes.dustTiny, Materials.Rubber, 1), 30); - tComb = getStackForType(CustomCombs.PLASTIC); - addSpecialCent(tComb, GT_OreDictUnificator.get(OrePrefixes.dustTiny, Materials.Plastic, 1), 20); - tComb = getStackForType(CustomCombs.PTFE); - addSpecialCent(tComb, GT_OreDictUnificator.get(OrePrefixes.dustTiny, GTPP_Bees.PTFE, 1), 10); - tComb = getStackForType(CustomCombs.PBS); - addSpecialCent(tComb, GT_OreDictUnificator.get(OrePrefixes.dustTiny, GTPP_Bees.PBS, 1), 5); - - // Fuels - tComb = getStackForType(CustomCombs.BIOMASS); - addSpecialCent(tComb, ItemUtils.getSimpleStack(GTPP_Bees.dropBiomassBlob), 5); - tComb = getStackForType(CustomCombs.PBS); - addSpecialCent(tComb, ItemUtils.getSimpleStack(GTPP_Bees.dropEthanolBlob), 5); - - // Misc Materials - tComb = getStackForType(CustomCombs.FORCE); - addSpecialCent(tComb, ItemUtils.getSimpleStack(GTPP_Bees.dropForceGem), 5); - tComb = getStackForType(CustomCombs.FLUORINE); - addSpecialCent(tComb, ItemUtils.getSimpleStack(GTPP_Bees.dropFluorineBlob), 5); - tComb = getStackForType(CustomCombs.NIKOLITE); - addSpecialCent(tComb, ItemUtils.getSimpleStack(GTPP_Bees.dropNikoliteDust), 5); - } - - public void addSpecialCent(ItemStack tComb, ItemStack aOutput, int chance) { - GT_Values.RA.stdBuilder() - .itemInputs(tComb) - .itemOutputs(aOutput, ItemList.FR_Wax.get(1)) - .outputChances(chance * 100, 3000) - .duration(6 * SECONDS + 8 * TICKS) - .eut(5) - .addTo(centrifugeRecipes); - } -} diff --git a/gtpp/src/main/java/gtPlusPlus/xmod/forestry/bees/handler/GTPP_CombType.java b/gtpp/src/main/java/gtPlusPlus/xmod/forestry/bees/handler/GTPP_CombType.java deleted file mode 100644 index 31b14ed4e6..0000000000 --- a/gtpp/src/main/java/gtPlusPlus/xmod/forestry/bees/handler/GTPP_CombType.java +++ /dev/null @@ -1,62 +0,0 @@ -package gtPlusPlus.xmod.forestry.bees.handler; - -import net.minecraft.item.ItemStack; - -import gregtech.api.util.GT_LanguageManager; -import gtPlusPlus.core.material.Material; -import gtPlusPlus.core.util.Utils; -import gtPlusPlus.xmod.forestry.bees.registry.GTPP_Bees; - -public enum GTPP_CombType { - - DRAGONBLOOD(0, "Dragon Blood", true, 30, Utils.rgbtoHexValue(220, 20, 20), Utils.rgbtoHexValue(20, 20, 20)), - FORCE(1, "Force", true, 30, Utils.rgbtoHexValue(250, 250, 20), Utils.rgbtoHexValue(200, 200, 5)); - - public boolean mShowInList; - public final Material mMaterial; - public final int mChance; - public final int mID; - - private final String mName; - private final String mNameUnlocal; - private final int[] mColour; - - private static void map(int aId, GTPP_CombType aType) { - GTPP_Bees.sCombMappings.put(aId, aType); - } - - public static GTPP_CombType get(int aID) { - return GTPP_Bees.sCombMappings.get(aID); - } - - GTPP_CombType(int aID, String aName, boolean aShow, int aChance, int... aColour) { - this.mID = aID; - this.mName = aName; - this.mNameUnlocal = aName.toLowerCase() - .replaceAll(" ", ""); - this.mChance = aChance; - this.mShowInList = aShow; - this.mColour = aColour; - map(aID, this); - this.mMaterial = GTPP_Bees.sMaterialMappings.get( - aName.toLowerCase() - .replaceAll(" ", "")); - GT_LanguageManager.addStringLocalization("gtplusplus.comb." + this.mNameUnlocal, this.mName + " Comb"); - } - - public void setHidden() { - this.mShowInList = false; - } - - public String getName() { - return GT_LanguageManager.getTranslation("gtplusplus.comb." + this.mNameUnlocal); - } - - public int[] getColours() { - return mColour == null || mColour.length != 2 ? new int[] { 0, 0 } : mColour; - } - - public ItemStack getStackForType(int count) { - return new ItemStack(GTPP_Bees.combs, count, mID); - } -} diff --git a/gtpp/src/main/java/gtPlusPlus/xmod/forestry/bees/handler/GTPP_DropType.java b/gtpp/src/main/java/gtPlusPlus/xmod/forestry/bees/handler/GTPP_DropType.java deleted file mode 100644 index 9819c586cd..0000000000 --- a/gtpp/src/main/java/gtPlusPlus/xmod/forestry/bees/handler/GTPP_DropType.java +++ /dev/null @@ -1,61 +0,0 @@ -package gtPlusPlus.xmod.forestry.bees.handler; - -import net.minecraft.item.ItemStack; - -import gregtech.api.util.GT_LanguageManager; -import gtPlusPlus.core.material.Material; -import gtPlusPlus.core.util.Utils; -import gtPlusPlus.xmod.forestry.bees.registry.GTPP_Bees; - -public enum GTPP_DropType { - - DRAGONBLOOD(0, "Dragon Blood", true, Utils.rgbtoHexValue(220, 20, 20), Utils.rgbtoHexValue(20, 20, 20)), - FORCE(1, "Force", true, Utils.rgbtoHexValue(250, 250, 20), Utils.rgbtoHexValue(200, 200, 5)); - - public boolean mShowInList; - public final Material mMaterial; - public int mChance; - public final int mID; - - private final String mName; - private final String mNameUnlocal; - private final int[] mColour; - - private static void map(int aId, GTPP_DropType aType) { - GTPP_Bees.sDropMappings.put(aId, aType); - } - - public static GTPP_DropType get(int aID) { - return GTPP_Bees.sDropMappings.get(aID); - } - - private GTPP_DropType(int aID, String aName, boolean aShow, int... aColour) { - this.mID = aID; - this.mName = aName; - this.mNameUnlocal = aName.toLowerCase() - .replaceAll(" ", ""); - this.mShowInList = aShow; - this.mColour = aColour; - map(aID, this); - this.mMaterial = GTPP_Bees.sMaterialMappings.get( - aName.toLowerCase() - .replaceAll(" ", "")); - GT_LanguageManager.addStringLocalization("gtplusplus.drop." + this.mNameUnlocal, this.mName + " Drop"); - } - - public void setHidden() { - this.mShowInList = false; - } - - public String getName() { - return GT_LanguageManager.getTranslation("gtplusplus.drop." + this.mNameUnlocal); - } - - public int[] getColours() { - return mColour; - } - - public ItemStack getStackForType(int count) { - return new ItemStack(GTPP_Bees.drop, count, mID); - } -} diff --git a/gtpp/src/main/java/gtPlusPlus/xmod/forestry/bees/handler/GTPP_PollenType.java b/gtpp/src/main/java/gtPlusPlus/xmod/forestry/bees/handler/GTPP_PollenType.java deleted file mode 100644 index 66451c7581..0000000000 --- a/gtpp/src/main/java/gtPlusPlus/xmod/forestry/bees/handler/GTPP_PollenType.java +++ /dev/null @@ -1,60 +0,0 @@ -package gtPlusPlus.xmod.forestry.bees.handler; - -import net.minecraft.item.ItemStack; - -import gregtech.api.util.GT_LanguageManager; -import gtPlusPlus.core.material.Material; -import gtPlusPlus.core.util.Utils; -import gtPlusPlus.xmod.forestry.bees.registry.GTPP_Bees; - -public enum GTPP_PollenType { - - DRAGONBLOOD(0, "Dragon Blood", true, Utils.rgbtoHexValue(220, 20, 20), Utils.rgbtoHexValue(20, 20, 20)); - - public boolean mShowInList; - public final Material mMaterial; - public int mChance; - public final int mID; - - private final String mName; - private final String mNameUnlocal; - private final int[] mColour; - - private static void map(int aId, GTPP_PollenType aType) { - GTPP_Bees.sPollenMappings.put(aId, aType); - } - - public static GTPP_PollenType get(int aID) { - return GTPP_Bees.sPollenMappings.get(aID); - } - - private GTPP_PollenType(int aID, String aName, boolean aShow, int... aColour) { - this.mID = aID; - this.mName = aName; - this.mNameUnlocal = aName.toLowerCase() - .replaceAll(" ", ""); - this.mShowInList = aShow; - this.mColour = aColour; - map(aID, this); - this.mMaterial = GTPP_Bees.sMaterialMappings.get( - aName.toLowerCase() - .replaceAll(" ", "")); - GT_LanguageManager.addStringLocalization("gtplusplus.pollen." + this.mNameUnlocal, this.mName + " Pollen"); - } - - public void setHidden() { - this.mShowInList = false; - } - - public String getName() { - return GT_LanguageManager.getTranslation("gtplusplus.pollen." + this.mNameUnlocal); - } - - public int[] getColours() { - return mColour; - } - - public ItemStack getStackForType(int count) { - return new ItemStack(GTPP_Bees.pollen, count, mID); - } -} diff --git a/gtpp/src/main/java/gtPlusPlus/xmod/forestry/bees/handler/GTPP_PropolisType.java b/gtpp/src/main/java/gtPlusPlus/xmod/forestry/bees/handler/GTPP_PropolisType.java deleted file mode 100644 index eb3b617077..0000000000 --- a/gtpp/src/main/java/gtPlusPlus/xmod/forestry/bees/handler/GTPP_PropolisType.java +++ /dev/null @@ -1,61 +0,0 @@ -package gtPlusPlus.xmod.forestry.bees.handler; - -import net.minecraft.item.ItemStack; - -import gregtech.api.util.GT_LanguageManager; -import gtPlusPlus.core.material.Material; -import gtPlusPlus.core.util.Utils; -import gtPlusPlus.xmod.forestry.bees.registry.GTPP_Bees; - -public enum GTPP_PropolisType { - - DRAGONBLOOD(0, "Dragon Blood", true, Utils.rgbtoHexValue(220, 20, 20)), - FORCE(1, "Force", true, Utils.rgbtoHexValue(250, 250, 20)); - - public boolean mShowInList; - public final Material mMaterial; - public int mChance; - public final int mID; - - private final String mName; - private final String mNameUnlocal; - private final int mColour; - - private static void map(int aId, GTPP_PropolisType aType) { - GTPP_Bees.sPropolisMappings.put(aId, aType); - } - - public static GTPP_PropolisType get(int aID) { - return GTPP_Bees.sPropolisMappings.get(aID); - } - - private GTPP_PropolisType(int aID, String aName, boolean aShow, int aColour) { - this.mID = aID; - this.mName = aName; - this.mNameUnlocal = aName.toLowerCase() - .replaceAll(" ", ""); - this.mShowInList = aShow; - this.mColour = aColour; - map(aID, this); - this.mMaterial = GTPP_Bees.sMaterialMappings.get( - aName.toLowerCase() - .replaceAll(" ", "")); - GT_LanguageManager.addStringLocalization("gtplusplus.propolis." + this.mNameUnlocal, this.mName + " Propolis"); - } - - public void setHidden() { - this.mShowInList = false; - } - - public String getName() { - return GT_LanguageManager.getTranslation("gtplusplus.propolis." + this.mNameUnlocal); - } - - public int getColours() { - return mColour; - } - - public ItemStack getStackForType(int count) { - return new ItemStack(GTPP_Bees.propolis, count, mID); - } -} diff --git a/gtpp/src/main/java/gtPlusPlus/xmod/forestry/bees/items/FR_ItemRegistry.java b/gtpp/src/main/java/gtPlusPlus/xmod/forestry/bees/items/FR_ItemRegistry.java deleted file mode 100644 index b61a91710e..0000000000 --- a/gtpp/src/main/java/gtPlusPlus/xmod/forestry/bees/items/FR_ItemRegistry.java +++ /dev/null @@ -1,120 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2011-2014 SirSengir. All rights reserved. This program and the accompanying materials are made - * available under the terms of the GNU Lesser Public License v3 which accompanies this distribution, and is available - * at http://www.gnu.org/licenses/lgpl-3.0.txt - * - * Various Contributors including, but not limited to: SirSengir (original work), CovertJaguar, Player, Binnie, - * MysteriousAges - ******************************************************************************/ -package gtPlusPlus.xmod.forestry.bees.items; - -import net.minecraft.item.EnumRarity; -import net.minecraft.item.Item; -import net.minecraft.item.ItemStack; -import net.minecraft.util.WeightedRandomChestContent; -import net.minecraftforge.common.ChestGenHooks; - -import cpw.mods.fml.common.Optional; -import cpw.mods.fml.common.registry.GameRegistry; -import forestry.core.utils.StringUtil; -import gregtech.api.enums.Mods; - -public class FR_ItemRegistry { - - // ----- Apiary Frames ---------------------- - - // Magic Bee Frame Items - public static MB_ItemFrame hiveFrameAccelerated; - public static MB_ItemFrame hiveFrameVoid; - public static MB_ItemFrame hiveFrameMutagenic; - public static MB_ItemFrame hiveFrameBusy; - - // Extra Bee Frame Items - public static MB_ItemFrame hiveFrameCocoa; - public static MB_ItemFrame hiveFrameCaged; - public static MB_ItemFrame hiveFrameSoul; - public static MB_ItemFrame hiveFrameClay; - public static MB_ItemFrame hiveFrameNova; - - // Frame Items added by bartimaeusnek - public static MB_ItemFrame hiveFrameDecay; - public static MB_ItemFrame hiveFrameSlow; - public static MB_ItemFrame hiveFrameStalilize; - public static MB_ItemFrame hiveFrameArborist; - - @Optional.Method(modid = Mods.Names.FORESTRY) - public static void Register() { - - // Forestry Frames - // frameUntreated = registerItem(new FR_ItemHiveFrame(80, 0.9f), "frameUntreated"); - // frameImpregnated = registerItem(new FR_ItemHiveFrame(240, 0.4f), "frameImpregnated"); - // frameProven = registerItem(new FR_ItemHiveFrame(720, 0.3f), "frameProven"); - - // Magic Bee like Frames - - hiveFrameVoid = new MB_ItemFrame( - MB_FrameType.USELESS, - EnumRarity.common, - "No more cheaty frames for GTNH players."); - - hiveFrameAccelerated = new MB_ItemFrame( - MB_FrameType.ACCELERATED, - "Longevity for bees isn't very common, especially if they're working harder."); - hiveFrameMutagenic = new MB_ItemFrame( - MB_FrameType.MUTAGENIC, - EnumRarity.epic, - "Evolution of the fittest, finest and fastest."); - hiveFrameBusy = new MB_ItemFrame(MB_FrameType.BUSY, "Your bee will work harder and longer than you expected."); - ChestGenHooks.addItem( - ChestGenHooks.STRONGHOLD_CORRIDOR, - new WeightedRandomChestContent(new ItemStack(hiveFrameVoid), 1, 1, 14)); - ChestGenHooks.addItem( - ChestGenHooks.STRONGHOLD_LIBRARY, - new WeightedRandomChestContent(new ItemStack(hiveFrameVoid), 1, 3, 18)); - ChestGenHooks.addItem( - ChestGenHooks.DUNGEON_CHEST, - new WeightedRandomChestContent(new ItemStack(hiveFrameVoid), 1, 1, 14)); - ChestGenHooks.addItem( - ChestGenHooks.MINESHAFT_CORRIDOR, - new WeightedRandomChestContent(new ItemStack(hiveFrameVoid), 1, 1, 9)); - ChestGenHooks.addItem( - ChestGenHooks.PYRAMID_DESERT_CHEST, - new WeightedRandomChestContent(new ItemStack(hiveFrameMutagenic), 1, 1, 9)); - ChestGenHooks.addItem( - ChestGenHooks.PYRAMID_JUNGLE_CHEST, - new WeightedRandomChestContent(new ItemStack(hiveFrameMutagenic), 1, 3, 12)); - ChestGenHooks.addItem( - ChestGenHooks.MINESHAFT_CORRIDOR, - new WeightedRandomChestContent(new ItemStack(hiveFrameMutagenic), 1, 3, 8)); - ChestGenHooks.addItem( - ChestGenHooks.DUNGEON_CHEST, - new WeightedRandomChestContent(new ItemStack(hiveFrameMutagenic), 1, 3, 12)); - - // Frame Items added by bartimaeusnek - hiveFrameDecay = new MB_ItemFrame( - MB_FrameType.DECAYING, - EnumRarity.uncommon, - "Who really needs stable genetics?"); - hiveFrameSlow = new MB_ItemFrame(MB_FrameType.SLOWING, EnumRarity.common, "The journey is its own reward."); - hiveFrameStalilize = new MB_ItemFrame( - MB_FrameType.STABILIZING, - EnumRarity.rare, - "If you wish your bees to keep their form."); - hiveFrameArborist = new MB_ItemFrame( - MB_FrameType.ARBORISTS, - EnumRarity.common, - "Who need Bees when you can have Trees?"); - ChestGenHooks.addItem( - ChestGenHooks.PYRAMID_JUNGLE_CHEST, - new WeightedRandomChestContent(new ItemStack(hiveFrameArborist), 1, 4, 24)); - ChestGenHooks.addItem( - ChestGenHooks.STRONGHOLD_LIBRARY, - new WeightedRandomChestContent(new ItemStack(hiveFrameSlow), 1, 4, 24)); - } - - protected static <T extends Item> T registerItem(final T item, final String name) { - item.setUnlocalizedName(name); - GameRegistry.registerItem(item, StringUtil.cleanItemName(item)); - return item; - } -} diff --git a/gtpp/src/main/java/gtPlusPlus/xmod/forestry/bees/items/FR_StringUtil.java b/gtpp/src/main/java/gtPlusPlus/xmod/forestry/bees/items/FR_StringUtil.java deleted file mode 100644 index c63401aecf..0000000000 --- a/gtpp/src/main/java/gtPlusPlus/xmod/forestry/bees/items/FR_StringUtil.java +++ /dev/null @@ -1,14 +0,0 @@ -package gtPlusPlus.xmod.forestry.bees.items; - -import net.minecraft.util.StatCollector; - -public class FR_StringUtil { - - public static String getLocalizedString(final String key) { - if (StatCollector.canTranslate(key)) { - return StatCollector.translateToLocal(key); - } - return StatCollector.translateToFallback(key); - } - -} diff --git a/gtpp/src/main/java/gtPlusPlus/xmod/forestry/bees/items/MB_FrameType.java b/gtpp/src/main/java/gtPlusPlus/xmod/forestry/bees/items/MB_FrameType.java deleted file mode 100644 index 418c05587f..0000000000 --- a/gtpp/src/main/java/gtPlusPlus/xmod/forestry/bees/items/MB_FrameType.java +++ /dev/null @@ -1,126 +0,0 @@ -package gtPlusPlus.xmod.forestry.bees.items; - -import forestry.api.apiculture.IBeeGenome; -import forestry.api.apiculture.IBeeModifier; - -public enum MB_FrameType implements IBeeModifier { - - // ExtraBees Clone Frames - // Name, FrameHP, territory (1f), Mutation rate, lifespan rate, production rate, genetic decay (1f) - COCOA("Chocolate", 240, 1.0f, 1.0f, 0.50f, 0.50f, 1f), // production was 1.5x, now +0.5 - CAGE("Restraint", 240, 0.5f, 1.0f, 0.75f, -0.25f, 1f), // production was 0.75x, now -0.25 - SOUL("Soul", 80, 1.0f, 1.5f, 0.75f, -0.75f, 1f), // production was 0.25x, now -0.75 - CLAY("Healing", 240, 1.0f, 0.5f, 1.50f, -0.25f, 1f), // production was 0.75x, now -0.25 - NOVA("Nova", 240, 1.0f, 100.0f, 0.0001f, 0.00f, 1f), // production was 1x, now +0 - - // Name, FrameHP, territory (1f), Mutation rate, lifespan rate, production rate, genetic decay (1f) - ACCELERATED("Accelerated", 175, 1f, 1.2f, 0.9f, 0.8f, 1f), // production was 1.8x, now +0.8 - VOID("Void", 20, 1f, 1f, 0.0001f, 9f, 1f), // production was 10x, now +9 - MUTAGENIC("Mutagenic", 3, 1f, 5f, 0.0001f, 9f, 1f), // production was 10x, now +9 - BUSY("Busy", 2000, 1f, 0f, 3f, 3f, 1f), // production was 4x, now +3 - USELESS("Useless", 100, 1f, 0f, 1f, 0f, 1f), // production was 1x, now +0 - - // Frame Items added by bartimaeusnek - DECAYING("Decaying", 240, 1f, 1f, 1f, 0f, 10f), // enhanches decay to 10x // production was 1x, now +0 - SLOWING("Slowing", 175, 1f, 0.5f, 2f, -0.5f, 1f), // reduces mutation, production rate and enhanches lifespan // - // production was 0.5x, now -0.5 - STABILIZING("Stabilizing", 60, 1f, 0.1f, 1f, -0.9f, 0.5f), // reduces mutation, production and decay // production - // was 0.1x, now -0.9 - ARBORISTS("Arborists", 240, 3f, 0f, 3f, -9001f, 1f); // 3x territory and lifespan, sets mutation and production to - // zero // production was 0x, now -9001 - - private final String frameName; - public final int maxDamage; - - private final float territoryMod; - private final float mutationMod; - private final float lifespanMod; - private final float productionMod; - private final float floweringMod; - private final float geneticDecayMod; - private final boolean isSealed; - private final boolean isLit; - private final boolean isSunlit; - private final boolean isHellish; - - MB_FrameType(final String name, final int damage, final float territory, final float mutation, final float lifespan, - final float production, final float geneticDecay) { - this(name, damage, territory, mutation, lifespan, production, 1f, geneticDecay, false, false, false, false); - } - - MB_FrameType(final String name, final int damage, final float territory, final float mutation, final float lifespan, - final float production, final float flowering, final float geneticDecay, final boolean sealed, - final boolean lit, final boolean sunlit, final boolean hellish) { - this.frameName = name; - this.maxDamage = damage; - - this.territoryMod = territory; - this.mutationMod = mutation; - this.lifespanMod = lifespan; - this.productionMod = production; - this.floweringMod = flowering; - this.geneticDecayMod = geneticDecay; - this.isSealed = sealed; - this.isLit = lit; - this.isSunlit = sunlit; - this.isHellish = hellish; - } - - public String getName() { - return this.frameName; - } - - public String getLocalizedName() { - return FR_StringUtil.getLocalizedString("frame." + this.frameName); - } - - @Override - public float getTerritoryModifier(final IBeeGenome genome, final float currentModifier) { - return this.territoryMod; - } - - @Override - public float getMutationModifier(final IBeeGenome genome, final IBeeGenome mate, final float currentModifier) { - return this.mutationMod; - } - - @Override - public float getLifespanModifier(final IBeeGenome genome, final IBeeGenome mate, final float currentModifier) { - return this.lifespanMod; - } - - @Override - public float getProductionModifier(final IBeeGenome genome, final float currentModifier) { - return this.productionMod; - } - - @Override - public float getFloweringModifier(final IBeeGenome genome, final float currentModifier) { - return this.floweringMod; - } - - @Override - public float getGeneticDecay(final IBeeGenome genome, final float currentModifier) { - return this.geneticDecayMod; - } - - @Override - public boolean isSealed() { - return this.isSealed; - } - - @Override - public boolean isSelfLighted() { - return this.isLit; - } - - @Override - public boolean isSunlightSimulated() { - return this.isSunlit; - } - - @Override - public boolean isHellish() { - return this.isHellish; - } -} diff --git a/gtpp/src/main/java/gtPlusPlus/xmod/forestry/bees/items/MB_ItemFrame.java b/gtpp/src/main/java/gtPlusPlus/xmod/forestry/bees/items/MB_ItemFrame.java deleted file mode 100644 index e5d36d15e8..0000000000 --- a/gtpp/src/main/java/gtPlusPlus/xmod/forestry/bees/items/MB_ItemFrame.java +++ /dev/null @@ -1,142 +0,0 @@ -package gtPlusPlus.xmod.forestry.bees.items; - -import static gregtech.api.enums.Mods.GTPlusPlus; - -import java.util.List; - -import net.minecraft.client.renderer.texture.IIconRegister; -import net.minecraft.entity.player.EntityPlayer; -import net.minecraft.item.EnumRarity; -import net.minecraft.item.Item; -import net.minecraft.item.ItemStack; -import net.minecraft.util.EnumChatFormatting; - -import cpw.mods.fml.common.registry.GameRegistry; -import cpw.mods.fml.relauncher.Side; -import cpw.mods.fml.relauncher.SideOnly; -import forestry.api.apiculture.IBee; -import forestry.api.apiculture.IBeeGenome; -import forestry.api.apiculture.IBeeHousing; -import forestry.api.apiculture.IBeeModifier; -import forestry.api.apiculture.IHiveFrame; -import gtPlusPlus.core.creative.AddToCreativeTab; - -public class MB_ItemFrame extends Item implements IHiveFrame { - - private final MB_FrameType type; - private EnumRarity rarity_value = EnumRarity.uncommon; - private final String toolTip; - - public MB_ItemFrame(final MB_FrameType frameType, final String description) { - this(frameType, EnumRarity.uncommon, description); - } - - public MB_ItemFrame(final MB_FrameType frameType, final EnumRarity rarity, final String description) { - super(); - this.type = frameType; - this.setMaxDamage(this.type.maxDamage); - this.setMaxStackSize(1); - this.setCreativeTab(AddToCreativeTab.tabMisc); - this.setUnlocalizedName("frame" + frameType.getName()); - this.rarity_value = rarity; - this.toolTip = description; - GameRegistry.registerItem(this, "frame" + frameType.getName()); - } - - @Override - public void addInformation(final ItemStack stack, final EntityPlayer aPlayer, final List list, final boolean bool) { - if ((this.toolTip != "") || !this.toolTip.equals("")) { - list.add(EnumChatFormatting.GRAY + this.toolTip); - } - super.addInformation(stack, aPlayer, list, bool); - } - - @Override - @SideOnly(Side.CLIENT) - public void registerIcons(final IIconRegister par1IconRegister) { - this.itemIcon = par1IconRegister.registerIcon(GTPlusPlus.ID + ":frame" + this.type.getName()); - } - - // --------- IHiveFrame functions ----------------------------------------- - - @Override - public ItemStack frameUsed(final IBeeHousing housing, ItemStack frame, final IBee queen, final int wear) { - frame.setItemDamage(frame.getItemDamage() + wear); - - if (frame.getItemDamage() >= frame.getMaxDamage()) { - // Break the frame. - frame = null; - } - - return frame; - } - - @Override - @SideOnly(Side.CLIENT) - public EnumRarity getRarity(final ItemStack par1ItemStack) { - return this.rarity_value; - } - - @Override - public boolean hasEffect(final ItemStack par1ItemStack, final int pass) { - if ((this.rarity_value == EnumRarity.uncommon) || (this.rarity_value == EnumRarity.common)) { - return false; - } - return true; - } - - @Override - public IBeeModifier getBeeModifier() { - return this.type; - } - - @Override - public boolean isBookEnchantable(final ItemStack itemstack1, final ItemStack itemstack2) { - return false; - } - - @Override - public boolean isRepairable() { - return false; - } - - public float getTerritoryModifier(final IBeeGenome genome, final float currentModifier) { - return this.type.getTerritoryModifier(genome, currentModifier); - } - - public float getMutationModifier(final IBeeGenome genome, final IBeeGenome mate, final float currentModifier) { - return this.type.getMutationModifier(genome, mate, currentModifier); - } - - public float getLifespanModifier(final IBeeGenome genome, final IBeeGenome mate, final float currentModifier) { - return this.type.getLifespanModifier(genome, mate, currentModifier); - } - - public float getProductionModifier(final IBeeGenome genome, final float currentModifier) { - return this.type.getProductionModifier(genome, currentModifier); - } - - public float getFloweringModifier(final IBeeGenome genome, final float currentModifier) { - return this.type.getFloweringModifier(genome, currentModifier); - } - - public float getGeneticDecay(final IBeeGenome genome, final float currentModifier) { - return this.type.getGeneticDecay(genome, currentModifier); - } - - public boolean isSealed() { - return this.type.isSealed(); - } - - public boolean isSelfLighted() { - return this.type.isSelfLighted(); - } - - public boolean isSunlightSimulated() { - return this.type.isSunlightSimulated(); - } - - public boolean isHellish() { - return this.type.isHellish(); - } -} diff --git a/gtpp/src/main/java/gtPlusPlus/xmod/forestry/bees/items/output/GTPP_Comb.java b/gtpp/src/main/java/gtPlusPlus/xmod/forestry/bees/items/output/GTPP_Comb.java deleted file mode 100644 index 7c9cc5a990..0000000000 --- a/gtpp/src/main/java/gtPlusPlus/xmod/forestry/bees/items/output/GTPP_Comb.java +++ /dev/null @@ -1,131 +0,0 @@ -package gtPlusPlus.xmod.forestry.bees.items.output; - -import static gregtech.api.enums.Mods.Forestry; -import static gregtech.api.enums.Mods.GTPlusPlus; - -import java.util.List; - -import net.minecraft.client.renderer.texture.IIconRegister; -import net.minecraft.creativetab.CreativeTabs; -import net.minecraft.item.Item; -import net.minecraft.item.ItemStack; -import net.minecraft.util.IIcon; -import net.minecraftforge.fluids.FluidStack; - -import cpw.mods.fml.common.registry.GameRegistry; -import cpw.mods.fml.relauncher.Side; -import cpw.mods.fml.relauncher.SideOnly; -import forestry.api.core.Tabs; -import gregtech.api.util.GT_ModHandler; -import gtPlusPlus.core.lib.CORE; -import gtPlusPlus.core.material.Material; -import gtPlusPlus.xmod.forestry.bees.handler.GTPP_CombType; -import gtPlusPlus.xmod.forestry.bees.handler.GTPP_DropType; -import gtPlusPlus.xmod.forestry.bees.handler.GTPP_PropolisType; -import gtPlusPlus.xmod.forestry.bees.registry.GTPP_Bees; - -public class GTPP_Comb extends Item { - - @SideOnly(Side.CLIENT) - private IIcon secondIcon; - - public GTPP_Comb() { - super(); - this.setCreativeTab(Tabs.tabApiculture); - this.setHasSubtypes(true); - this.setUnlocalizedName("gtpp.comb"); - GameRegistry.registerItem(this, "gtpp.comb", GTPlusPlus.ID); - } - - public ItemStack getStackForType(GTPP_CombType type) { - return new ItemStack(this, 1, type.mID); - } - - public ItemStack getStackForType(GTPP_CombType type, int count) { - return new ItemStack(this, count, type.mID); - } - - @Override - @SideOnly(Side.CLIENT) - public void getSubItems(Item item, CreativeTabs tabs, List list) { - for (GTPP_CombType type : GTPP_CombType.values()) { - if (type.mShowInList) { - list.add(this.getStackForType(type)); - } - } - } - - @Override - @SideOnly(Side.CLIENT) - public boolean requiresMultipleRenderPasses() { - return true; - } - - @Override - public int getRenderPasses(int meta) { - return 2; - } - - @Override - @SideOnly(Side.CLIENT) - public void registerIcons(IIconRegister par1IconRegister) { - this.itemIcon = par1IconRegister.registerIcon("forestry:beeCombs.0"); - this.secondIcon = par1IconRegister.registerIcon("forestry:beeCombs.1"); - } - - @Override - public IIcon getIcon(ItemStack stack, int pass) { - return (pass == 0) ? itemIcon : secondIcon; - } - - @Override - @SideOnly(Side.CLIENT) - public int getColorFromItemStack(ItemStack stack, int pass) { - int colour = GTPP_CombType.get(stack.getItemDamage()) - .getColours()[0]; - - if (pass >= 1) { - colour = GTPP_CombType.get(stack.getItemDamage()) - .getColours()[1]; - } - - return colour; - } - - @Override - public String getItemStackDisplayName(ItemStack stack) { - return GTPP_CombType.get(stack.getItemDamage()) - .getName(); - } - - public static void initCombsRecipes() { - - addChemicalRecipe( - GTPP_CombType.DRAGONBLOOD, - new ItemStack[] { GT_ModHandler.getModItem(Forestry.ID, "refractoryWax", 1L, 0), - GTPP_Bees.propolis.getStackForType(GTPP_PropolisType.DRAGONBLOOD), - GTPP_Bees.drop.getStackForType(GTPP_DropType.DRAGONBLOOD) }, - new int[] { 3000, 1500, 500 }); - addChemicalRecipe( - GTPP_CombType.FORCE, - new ItemStack[] { GT_ModHandler.getModItem(Forestry.ID, "beeswax", 1L, 0), - GTPP_Bees.propolis.getStackForType(GTPP_PropolisType.FORCE), - GTPP_Bees.drop.getStackForType(GTPP_DropType.FORCE) }, - new int[] { 5000, 3000, 1000 }); - } - - public static void addChemicalRecipe(GTPP_CombType aInputStack, ItemStack[] aOutputs, int[] aChances) { - Material aMat = aInputStack.mMaterial; - long aEU = aMat.vVoltageMultiplier; - int aTier = Math.max(aMat.vTier / 2, 1); - CORE.RA.addChemicalPlantRecipe( - new ItemStack[] { aInputStack.getStackForType(aTier), }, - new FluidStack[] {}, - aOutputs, - new FluidStack[] {}, - aChances, - aTier * 20 * 60, - aEU, - aTier); - } -} diff --git a/gtpp/src/main/java/gtPlusPlus/xmod/forestry/bees/items/output/GTPP_Drop.java b/gtpp/src/main/java/gtPlusPlus/xmod/forestry/bees/items/output/GTPP_Drop.java deleted file mode 100644 index a84d11e74c..0000000000 --- a/gtpp/src/main/java/gtPlusPlus/xmod/forestry/bees/items/output/GTPP_Drop.java +++ /dev/null @@ -1,131 +0,0 @@ -package gtPlusPlus.xmod.forestry.bees.items.output; - -import static gregtech.api.enums.Mods.GTPlusPlus; -import static gregtech.api.recipe.RecipeMaps.fluidExtractionRecipes; -import static gregtech.api.util.GT_RecipeBuilder.TICKS; - -import java.util.List; - -import net.minecraft.client.renderer.texture.IIconRegister; -import net.minecraft.creativetab.CreativeTabs; -import net.minecraft.item.Item; -import net.minecraft.item.ItemStack; -import net.minecraft.util.IIcon; -import net.minecraftforge.fluids.FluidStack; - -import cpw.mods.fml.common.registry.GameRegistry; -import cpw.mods.fml.relauncher.Side; -import cpw.mods.fml.relauncher.SideOnly; -import forestry.api.core.Tabs; -import gregtech.api.enums.GT_Values; -import gtPlusPlus.api.objects.Logger; -import gtPlusPlus.xmod.forestry.bees.handler.GTPP_DropType; -import gtPlusPlus.xmod.forestry.bees.registry.GTPP_Bees; - -public class GTPP_Drop extends Item { - - @SideOnly(Side.CLIENT) - private IIcon secondIcon; - - public GTPP_Drop() { - super(); - this.setCreativeTab(Tabs.tabApiculture); - this.setHasSubtypes(true); - this.setUnlocalizedName("gtpp.drop"); - GameRegistry.registerItem(this, "gtpp.drop", GTPlusPlus.ID); - } - - public ItemStack getStackForType(GTPP_DropType type) { - return new ItemStack(this, 1, type.mID); - } - - public ItemStack getStackForType(GTPP_DropType type, int count) { - return new ItemStack(this, count, type.mID); - } - - @Override - @SideOnly(Side.CLIENT) - public void getSubItems(Item item, CreativeTabs tabs, List list) { - for (GTPP_DropType type : GTPP_DropType.values()) { - if (type.mShowInList) { - list.add(this.getStackForType(type)); - } - } - } - - @Override - @SideOnly(Side.CLIENT) - public boolean requiresMultipleRenderPasses() { - return true; - } - - @Override - public int getRenderPasses(int meta) { - return 2; - } - - @Override - @SideOnly(Side.CLIENT) - public void registerIcons(IIconRegister par1IconRegister) { - this.itemIcon = par1IconRegister.registerIcon("forestry:honeyDrop.0"); - this.secondIcon = par1IconRegister.registerIcon("forestry:honeyDrop.1"); - } - - @Override - public IIcon getIcon(ItemStack stack, int pass) { - return (pass == 0) ? itemIcon : secondIcon; - } - - @Override - @SideOnly(Side.CLIENT) - public int getColorFromItemStack(ItemStack stack, int pass) { - int colour = GTPP_DropType.get(stack.getItemDamage()) - .getColours()[0]; - - if (pass >= 1) { - colour = GTPP_DropType.get(stack.getItemDamage()) - .getColours()[1]; - } - - return colour; - } - - @Override - public String getItemStackDisplayName(ItemStack stack) { - return GTPP_DropType.get(stack.getItemDamage()) - .getName(); - } - - private static final int[] sFluidOutputs = new int[] { 144, 136, 128, 120, 112, 104, 96, 88, 80, 72, 64, 48, 32, 16, - 8, 4 }; - - public static void initDropsRecipes() { - ItemStack tDrop; - Logger.BEES("Processing recipes for " + GTPP_Bees.sDropMappings.size() + " Drops."); - for (GTPP_DropType aDrop : GTPP_Bees.sDropMappings.values()) { - tDrop = aDrop.getStackForType(1); - if (addProcess( - tDrop, - new FluidStack(aDrop.mMaterial.getFluid(), sFluidOutputs[aDrop.mMaterial.vTier]), - aDrop.mMaterial.vTier * 20 * 30, - aDrop.mMaterial.vVoltageMultiplier)) { - Logger.BEES("Added Drop extraction recipe for: " + aDrop.getName()); - } else { - Logger.BEES("Failed to add Drop extraction recipe for: " + aDrop.getName()); - } - } - } - - public static boolean addProcess(ItemStack tDrop, FluidStack aOutput, int aDuration, int aEUt) { - if (aOutput == null) { - return false; - } - GT_Values.RA.stdBuilder() - .itemInputs(tDrop) - .fluidOutputs(aOutput) - .duration(aDuration * TICKS) - .eut(aEUt) - .addTo(fluidExtractionRecipes); - return true; - } -} diff --git a/gtpp/src/main/java/gtPlusPlus/xmod/forestry/bees/items/output/GTPP_Pollen.java b/gtpp/src/main/java/gtPlusPlus/xmod/forestry/bees/items/output/GTPP_Pollen.java deleted file mode 100644 index 7e959151a0..0000000000 --- a/gtpp/src/main/java/gtPlusPlus/xmod/forestry/bees/items/output/GTPP_Pollen.java +++ /dev/null @@ -1,92 +0,0 @@ -package gtPlusPlus.xmod.forestry.bees.items.output; - -import static gregtech.api.enums.Mods.GTPlusPlus; - -import java.util.List; - -import net.minecraft.client.renderer.texture.IIconRegister; -import net.minecraft.creativetab.CreativeTabs; -import net.minecraft.item.Item; -import net.minecraft.item.ItemStack; -import net.minecraft.util.IIcon; - -import cpw.mods.fml.common.registry.GameRegistry; -import cpw.mods.fml.relauncher.Side; -import cpw.mods.fml.relauncher.SideOnly; -import forestry.api.core.Tabs; -import gtPlusPlus.xmod.forestry.bees.handler.GTPP_PollenType; - -public class GTPP_Pollen extends Item { - - @SideOnly(Side.CLIENT) - private IIcon secondIcon; - - public GTPP_Pollen() { - super(); - this.setCreativeTab(Tabs.tabApiculture); - this.setHasSubtypes(true); - this.setUnlocalizedName("gtpp.pollen"); - GameRegistry.registerItem(this, "gtpp.pollen", GTPlusPlus.ID); - } - - public ItemStack getStackForType(GTPP_PollenType type) { - return new ItemStack(this, 1, type.mID); - } - - public ItemStack getStackForType(GTPP_PollenType type, int count) { - return new ItemStack(this, count, type.mID); - } - - @Override - @SideOnly(Side.CLIENT) - public void getSubItems(Item item, CreativeTabs tabs, List list) { - for (GTPP_PollenType type : GTPP_PollenType.values()) { - if (type.mShowInList) { - list.add(this.getStackForType(type)); - } - } - } - - @Override - @SideOnly(Side.CLIENT) - public boolean requiresMultipleRenderPasses() { - return true; - } - - @Override - public int getRenderPasses(int meta) { - return 2; - } - - @Override - @SideOnly(Side.CLIENT) - public void registerIcons(IIconRegister par1IconRegister) { - this.itemIcon = par1IconRegister.registerIcon("forestry:pollen.0"); - this.secondIcon = par1IconRegister.registerIcon("forestry:pollen.1"); - } - - @Override - public IIcon getIcon(ItemStack stack, int pass) { - return (pass == 0) ? itemIcon : secondIcon; - } - - @Override - @SideOnly(Side.CLIENT) - public int getColorFromItemStack(ItemStack stack, int pass) { - int colour = GTPP_PollenType.get(stack.getItemDamage()) - .getColours()[0]; - - if (pass >= 1) { - colour = GTPP_PollenType.get(stack.getItemDamage()) - .getColours()[1]; - } - - return colour; - } - - @Override - public String getItemStackDisplayName(ItemStack stack) { - return GTPP_PollenType.get(stack.getItemDamage()) - .getName(); - } -} diff --git a/gtpp/src/main/java/gtPlusPlus/xmod/forestry/bees/items/output/GTPP_Propolis.java b/gtpp/src/main/java/gtPlusPlus/xmod/forestry/bees/items/output/GTPP_Propolis.java deleted file mode 100644 index 1c1bd95d09..0000000000 --- a/gtpp/src/main/java/gtPlusPlus/xmod/forestry/bees/items/output/GTPP_Propolis.java +++ /dev/null @@ -1,110 +0,0 @@ -package gtPlusPlus.xmod.forestry.bees.items.output; - -import static gregtech.api.enums.Mods.GTPlusPlus; -import static gregtech.api.recipe.RecipeMaps.extractorRecipes; -import static gregtech.api.util.GT_RecipeBuilder.TICKS; - -import java.util.List; - -import net.minecraft.client.renderer.texture.IIconRegister; -import net.minecraft.creativetab.CreativeTabs; -import net.minecraft.item.Item; -import net.minecraft.item.ItemStack; -import net.minecraft.util.IIcon; - -import cpw.mods.fml.common.registry.GameRegistry; -import cpw.mods.fml.relauncher.Side; -import cpw.mods.fml.relauncher.SideOnly; -import forestry.api.core.Tabs; -import gregtech.api.enums.GT_Values; -import gtPlusPlus.api.objects.Logger; -import gtPlusPlus.xmod.forestry.bees.handler.GTPP_PropolisType; -import gtPlusPlus.xmod.forestry.bees.registry.GTPP_Bees; - -public class GTPP_Propolis extends Item { - - @SideOnly(Side.CLIENT) - private IIcon secondIcon; - - public GTPP_Propolis() { - super(); - this.setCreativeTab(Tabs.tabApiculture); - this.setHasSubtypes(true); - this.setUnlocalizedName("gtpp.propolis"); - GameRegistry.registerItem(this, "gtpp.propolis", GTPlusPlus.ID); - } - - public ItemStack getStackForType(GTPP_PropolisType type) { - return new ItemStack(this, 1, type.mID); - } - - public ItemStack getStackForType(GTPP_PropolisType type, int count) { - return new ItemStack(this, count, type.mID); - } - - @Override - @SideOnly(Side.CLIENT) - public void getSubItems(Item item, CreativeTabs tabs, List list) { - for (GTPP_PropolisType type : GTPP_PropolisType.values()) { - if (type.mShowInList) { - list.add(this.getStackForType(type)); - } - } - } - - @Override - @SideOnly(Side.CLIENT) - public void registerIcons(IIconRegister par1IconRegister) { - this.itemIcon = par1IconRegister.registerIcon("forestry:propolis.0"); - } - - @Override - public IIcon getIcon(ItemStack stack, int pass) { - return itemIcon; - } - - @Override - @SideOnly(Side.CLIENT) - public int getColorFromItemStack(ItemStack stack, int pass) { - return GTPP_PropolisType.get(stack.getItemDamage()) - .getColours(); - } - - @Override - public String getItemStackDisplayName(ItemStack stack) { - return GTPP_PropolisType.get(stack.getItemDamage()) - .getName(); - } - - public static void initPropolisRecipes() { - ItemStack tDrop; - Logger.BEES("Processing recipes for " + GTPP_Bees.sPropolisMappings.size() + " Propolis."); - for (GTPP_PropolisType aProp : GTPP_Bees.sPropolisMappings.values()) { - tDrop = aProp.getStackForType(1); - if (addProcess( - tDrop, - aProp.mMaterial.getDust(1), - Math.min(Math.max(10000 - (aProp.mMaterial.vTier * 625), 100), 10000), - aProp.mMaterial.vTier * 20 * 15, - aProp.mMaterial.vVoltageMultiplier)) { - Logger.BEES("Added Propolis extraction recipe for: " + aProp.getName()); - } else { - Logger.BEES("Failed to add Propolis extraction recipe for: " + aProp.getName()); - } - } - } - - public static boolean addProcess(ItemStack tDrop, ItemStack aOutput, int aChance, int aDuration, int aEUt) { - if (aOutput == null) { - return false; - } - GT_Values.RA.stdBuilder() - .itemInputs(tDrop) - .itemOutputs(aOutput) - .outputChances(aChance) - .duration(aDuration * TICKS) - .eut(aEUt) - .addTo(extractorRecipes); - return true; - } -} diff --git a/gtpp/src/main/java/gtPlusPlus/xmod/forestry/bees/recipe/FR_Gregtech_Recipes.java b/gtpp/src/main/java/gtPlusPlus/xmod/forestry/bees/recipe/FR_Gregtech_Recipes.java deleted file mode 100644 index ce982cd67e..0000000000 --- a/gtpp/src/main/java/gtPlusPlus/xmod/forestry/bees/recipe/FR_Gregtech_Recipes.java +++ /dev/null @@ -1,134 +0,0 @@ -package gtPlusPlus.xmod.forestry.bees.recipe; - -import static gregtech.api.enums.Mods.MagicBees; - -import net.minecraft.init.Blocks; -import net.minecraft.init.Items; -import net.minecraft.item.ItemStack; - -import gtPlusPlus.core.util.minecraft.ItemUtils; -import gtPlusPlus.core.util.minecraft.RecipeUtils; -import gtPlusPlus.xmod.forestry.bees.items.FR_ItemRegistry; - -public class FR_Gregtech_Recipes { - - private static String rod_Electrum = "stickElectrum"; - private static String rod_LongElectrum = "stickLongElectrum"; - private static String foil_Electrum = "foilElectrum"; - private static String rod_Uranium = "stickUranium"; - private static String rod_LongUranium = "stickLongUranium"; - private static String foil_Uranium235 = "foilUranium235"; - private static ItemStack hiveFrameAccelerated = ItemUtils.getSimpleStack(FR_ItemRegistry.hiveFrameAccelerated); - private static ItemStack hiveFrameMutagenic = ItemUtils.getSimpleStack(FR_ItemRegistry.hiveFrameMutagenic); - private static ItemStack hiveFrameVoid = ItemUtils.getSimpleStack(FR_ItemRegistry.hiveFrameVoid); - private static ItemStack hiveFrameBusy = ItemUtils.getSimpleStack(FR_ItemRegistry.hiveFrameBusy); - - private static ItemStack hiveFrameCocoa = ItemUtils.getSimpleStack(FR_ItemRegistry.hiveFrameCocoa); - private static ItemStack hiveFrameCaged = ItemUtils.getSimpleStack(FR_ItemRegistry.hiveFrameCaged); - private static ItemStack hiveFrameSoul = ItemUtils.getSimpleStack(FR_ItemRegistry.hiveFrameSoul); - private static ItemStack hiveFrameClay = ItemUtils.getSimpleStack(FR_ItemRegistry.hiveFrameClay); - private static ItemStack hiveFrameNova = ItemUtils.getSimpleStack(FR_ItemRegistry.hiveFrameNova); - - private static ItemStack hiveFrameImpregnated = ItemUtils.getItemStackFromFQRN("Forestry:frameImpregnated", 1); - private static ItemStack blockSoulSand = new ItemStack(Blocks.soul_sand, 1); - private static ItemStack blockIronBars = new ItemStack(Blocks.iron_bars, 1); - private static ItemStack itemClayDust = new ItemStack(Items.clay_ball, 1); - private static ItemStack itemCocoaBeans = new ItemStack(Items.dye, 1, 3); - - private static ItemStack hiveFrameDecay = ItemUtils.getSimpleStack(FR_ItemRegistry.hiveFrameDecay); - private static ItemStack hiveFrameSlow = ItemUtils.getSimpleStack(FR_ItemRegistry.hiveFrameSlow); - private static ItemStack hiveFrameStalilize = ItemUtils.getSimpleStack(FR_ItemRegistry.hiveFrameStalilize); - private static ItemStack hiveFrameArborist = ItemUtils.getSimpleStack(FR_ItemRegistry.hiveFrameArborist); - - public static void registerItems() { - // Magic Bee Like Frames - RecipeUtils.addShapedGregtechRecipe( - rod_LongElectrum, - rod_Electrum, - rod_LongElectrum, - rod_LongElectrum, - foil_Electrum, - rod_LongElectrum, - rod_Electrum, - rod_Electrum, - rod_Electrum, - hiveFrameAccelerated); - - RecipeUtils.addShapedGregtechRecipe( - rod_LongUranium, - rod_Uranium, - rod_LongUranium, - rod_LongUranium, - foil_Uranium235, - rod_LongUranium, - rod_Uranium, - rod_Uranium, - rod_Uranium, - hiveFrameMutagenic); - if (MagicBees.isModLoaded()) { - RecipeUtils.addShapelessGregtechRecipe( - new ItemStack[] { hiveFrameVoid }, - ItemUtils.getCorrectStacktype("MagicBees:frameOblivion", 1)); - } - RecipeUtils.addShapedGregtechRecipe( - "stickLongBlueSteel", - "stickBlueSteel", - "stickLongBlueSteel", - "stickLongBlueSteel", - ItemUtils.getSimpleStack(Items.nether_star), - "stickLongBlueSteel", - "stickBlueSteel", - "stickBlueSteel", - "stickBlueSteel", - hiveFrameBusy); - - // Frame Items added by bartimaeusnek - RecipeUtils.addShapedGregtechRecipe( - ItemUtils.getItemStackOfAmountFromOreDict("stickLongTumbaga", 1), - ItemUtils.getItemStackOfAmountFromOreDict("stickTumbaga", 1), - ItemUtils.getItemStackOfAmountFromOreDict("stickLongTumbaga", 1), - ItemUtils.getItemStackOfAmountFromOreDict("stickLongTumbaga", 1), - foil_Electrum, - ItemUtils.getItemStackOfAmountFromOreDict("stickLongTumbaga", 1), - ItemUtils.getItemStackOfAmountFromOreDict("stickTumbaga", 1), - ItemUtils.getItemStackOfAmountFromOreDict("stickTumbaga", 1), - ItemUtils.getItemStackOfAmountFromOreDict("stickTumbaga", 1), - hiveFrameSlow); - - RecipeUtils.addShapedGregtechRecipe( - "stickLongWroughtIron", - "stickWroughtIron", - "stickLongWroughtIron", - "stickLongWroughtIron", - "foilZinc", - "stickLongWroughtIron", - "stickWroughtIron", - "stickWroughtIron", - "stickWroughtIron", - hiveFrameDecay); - - RecipeUtils.addShapedGregtechRecipe( - "stickLongOsmiridium", - "stickOsmiridium", - "stickLongOsmiridium", - "stickLongOsmiridium", - "foilOsmiridium", - "stickLongOsmiridium", - "stickOsmiridium", - "stickOsmiridium", - "stickOsmiridium", - hiveFrameStalilize); - - RecipeUtils.addShapedGregtechRecipe( - "stickLongWoodSealed", - "stickWoodSealed", - "stickLongWoodSealed", - "stickLongWoodSealed", - Items.paper, - "stickLongWoodSealed", - "stickWoodSealed", - "stickWoodSealed", - "stickWoodSealed", - hiveFrameArborist); - } -} diff --git a/gtpp/src/main/java/gtPlusPlus/xmod/forestry/bees/registry/GTPP_AlleleBeeSpecies.java b/gtpp/src/main/java/gtPlusPlus/xmod/forestry/bees/registry/GTPP_AlleleBeeSpecies.java deleted file mode 100644 index 05ce6e56e6..0000000000 --- a/gtpp/src/main/java/gtPlusPlus/xmod/forestry/bees/registry/GTPP_AlleleBeeSpecies.java +++ /dev/null @@ -1,50 +0,0 @@ -package gtPlusPlus.xmod.forestry.bees.registry; - -import net.minecraft.init.Items; -import net.minecraft.item.ItemStack; - -import forestry.api.apiculture.EnumBeeChromosome; -import forestry.api.apiculture.IAlleleBeeSpeciesCustom; -import forestry.api.genetics.AlleleManager; -import forestry.api.genetics.IClassification; -import forestry.apiculture.genetics.alleles.AlleleBeeSpecies; - -public class GTPP_AlleleBeeSpecies extends AlleleBeeSpecies { - - public GTPP_AlleleBeeSpecies(String uid, boolean dominant, String unlocalizedName, String authority, - String unlocalizedDescription, IClassification branch, String binomial, int primaryColor, int secondaryColor) { - super( - uid, - unlocalizedName, - authority, - unlocalizedDescription, - dominant, - branch, - binomial, - primaryColor, - secondaryColor); - AlleleManager.alleleRegistry.registerAllele(this, EnumBeeChromosome.SPECIES); - } - - @Override - public IAlleleBeeSpeciesCustom addProduct(ItemStack product, Float chance) { - if (product == null || product.getItem() == null) { - product = new ItemStack(Items.boat); - } - if (chance <= 0.0f || chance > 1.0f) { - chance = 0.1f; - } - return super.addProduct(product, chance); - } - - @Override - public IAlleleBeeSpeciesCustom addSpecialty(ItemStack specialty, Float chance) { - if (specialty == null || specialty.getItem() == null) { - specialty = new ItemStack(Items.boat); - } - if (chance <= 0.0f || chance > 1.0f) { - chance = 0.1f; - } - return super.addSpecialty(specialty, chance); - } -} diff --git a/gtpp/src/main/java/gtPlusPlus/xmod/forestry/bees/registry/GTPP_BeeDefinition.java b/gtpp/src/main/java/gtPlusPlus/xmod/forestry/bees/registry/GTPP_BeeDefinition.java deleted file mode 100644 index 73418bdab8..0000000000 --- a/gtpp/src/main/java/gtPlusPlus/xmod/forestry/bees/registry/GTPP_BeeDefinition.java +++ /dev/null @@ -1,301 +0,0 @@ -package gtPlusPlus.xmod.forestry.bees.registry; - -import static forestry.api.apiculture.EnumBeeChromosome.EFFECT; -import static forestry.api.apiculture.EnumBeeChromosome.HUMIDITY_TOLERANCE; -import static forestry.api.apiculture.EnumBeeChromosome.LIFESPAN; -import static forestry.api.apiculture.EnumBeeChromosome.SPECIES; -import static forestry.api.apiculture.EnumBeeChromosome.TEMPERATURE_TOLERANCE; -import static forestry.api.core.EnumHumidity.ARID; -import static gregtech.api.enums.Mods.Forestry; - -import java.lang.reflect.Field; -import java.util.Arrays; -import java.util.Locale; -import java.util.function.Consumer; - -import net.minecraft.item.ItemStack; -import net.minecraftforge.common.BiomeDictionary; - -import org.apache.commons.lang3.text.WordUtils; - -import forestry.api.apiculture.BeeManager; -import forestry.api.apiculture.EnumBeeType; -import forestry.api.apiculture.IAlleleBeeEffect; -import forestry.api.apiculture.IAlleleBeeSpecies; -import forestry.api.apiculture.IBee; -import forestry.api.apiculture.IBeeGenome; -import forestry.api.apiculture.IBeeMutationCustom; -import forestry.api.core.EnumHumidity; -import forestry.api.core.EnumTemperature; -import forestry.api.genetics.AlleleManager; -import forestry.api.genetics.IAllele; -import forestry.api.genetics.IAlleleFlowers; -import forestry.apiculture.genetics.Bee; -import forestry.apiculture.genetics.BeeVariation; -import forestry.apiculture.genetics.IBeeDefinition; -import forestry.apiculture.genetics.alleles.AlleleEffect; -import forestry.core.genetics.alleles.AlleleHelper; -import forestry.core.genetics.alleles.EnumAllele.Lifespan; -import forestry.core.genetics.alleles.EnumAllele.Tolerance; -import gregtech.api.enums.Materials; -import gregtech.api.util.GT_LanguageManager; -import gregtech.api.util.GT_ModHandler; -import gregtech.common.items.CombType; -import gregtech.loaders.misc.GT_Bees; -import gtPlusPlus.core.material.ELEMENT.STANDALONE; -import gtPlusPlus.core.material.Material; -import gtPlusPlus.core.util.Utils; -import gtPlusPlus.core.util.minecraft.MaterialUtils; -import gtPlusPlus.core.util.reflect.ReflectionUtils; -import gtPlusPlus.xmod.forestry.bees.handler.GTPP_CombType; - -public enum GTPP_BeeDefinition implements IBeeDefinition { - - DRAGONBLOOD(GTPP_BranchDefinition.LEGENDARY, "Dragon Blood", STANDALONE.DRAGON_METAL, true, - Utils.rgbtoHexValue(220, 20, 20), Utils.rgbtoHexValue(20, 20, 20), beeSpecies -> { - beeSpecies.addProduct(GT_ModHandler.getModItem(Forestry.ID, "beeCombs", 1, 8), 0.30f); - beeSpecies.addSpecialty(GTPP_Bees.combs.getStackForType(GTPP_CombType.DRAGONBLOOD), 0.10f); - beeSpecies.setHumidity(ARID); - beeSpecies.setTemperature(EnumTemperature.NORMAL); - beeSpecies.setHasEffect(); - }, template -> { - AlleleHelper.instance.set(template, LIFESPAN, Lifespan.LONGER); - AlleleHelper.instance.set(template, EFFECT, AlleleEffect.effectAggressive); - AlleleHelper.instance.set(template, TEMPERATURE_TOLERANCE, Tolerance.BOTH_3); - AlleleHelper.instance.set(template, HUMIDITY_TOLERANCE, Tolerance.BOTH_3); - }, dis -> { - IBeeMutationCustom tMutation = dis.registerMutation("DRAGONESSENCE", "NEUTRONIUM", 2); - tMutation.restrictHumidity(ARID); - tMutation.requireResource(STANDALONE.DRAGON_METAL.getBlock(), 1); - tMutation.addMutationCondition(new GT_Bees.DimensionMutationCondition(1, "End")); // End Dim - }), - FORCE(GTPP_BranchDefinition.LEGENDARY, "Force", STANDALONE.FORCE, true, Utils.rgbtoHexValue(250, 250, 20), - Utils.rgbtoHexValue(200, 200, 5), beeSpecies -> { - beeSpecies.addProduct(GT_Bees.combs.getStackForType(CombType.STONE), 0.30f); - beeSpecies.addProduct(GT_Bees.combs.getStackForType(CombType.SALT), 0.15f); - beeSpecies.addSpecialty(GTPP_Bees.combs.getStackForType(GTPP_CombType.FORCE), 0.10f); - beeSpecies.setHumidity(EnumHumidity.NORMAL); - beeSpecies.setTemperature(EnumTemperature.HOT); - beeSpecies.setHasEffect(); - }, template -> { - AlleleHelper.instance.set(template, LIFESPAN, Lifespan.NORMAL); - AlleleHelper.instance.set(template, EFFECT, AlleleEffect.effectAggressive); - AlleleHelper.instance.set(template, TEMPERATURE_TOLERANCE, Tolerance.BOTH_1); - AlleleHelper.instance.set(template, HUMIDITY_TOLERANCE, Tolerance.BOTH_1); - }, dis -> { - IBeeMutationCustom tMutation = dis.registerMutation("STEEL", "GOLD", 10); - tMutation.restrictHumidity(ARID); - tMutation.restrictBiomeType(BiomeDictionary.Type.HOT); - }),; - - private final GTPP_BranchDefinition branch; - private final GTPP_AlleleBeeSpecies species; - private final Consumer<GTPP_AlleleBeeSpecies> mSpeciesProperties; - private final Consumer<IAllele[]> mAlleles; - private final Consumer<GTPP_BeeDefinition> mMutations; - private IAllele[] template; - private IBeeGenome genome; - - GTPP_BeeDefinition(GTPP_BranchDefinition branch, String binomial, Materials aMat, boolean dominant, int primary, - int secondary, Consumer<GTPP_AlleleBeeSpecies> aSpeciesProperties, Consumer<IAllele[]> aAlleles, - Consumer<GTPP_BeeDefinition> aMutations) { - this( - branch, - binomial, - MaterialUtils.generateMaterialFromGtENUM(aMat), - dominant, - primary, - secondary, - aSpeciesProperties, - aAlleles, - aMutations); - } - - GTPP_BeeDefinition(GTPP_BranchDefinition branch, String binomial, Material aMat, boolean dominant, int primary, - int secondary, Consumer<GTPP_AlleleBeeSpecies> aSpeciesProperties, Consumer<IAllele[]> aAlleles, - Consumer<GTPP_BeeDefinition> aMutations) { - this.mAlleles = aAlleles; - this.mMutations = aMutations; - this.mSpeciesProperties = aSpeciesProperties; - String lowercaseName = this.toString() - .toLowerCase(Locale.ENGLISH); - String species = WordUtils.capitalize(binomial); - String uid = "gtpp.bee.species" + species; - String description = "for.description." + species; - String name = "for.bees.species." + lowercaseName; - GT_LanguageManager.addStringLocalization("for.bees.species." + lowercaseName, species, true); - GTPP_Bees.sMaterialMappings.put( - binomial.toLowerCase() - .replaceAll(" ", ""), - aMat); - this.branch = branch; - this.species = new GTPP_AlleleBeeSpecies( - uid, - dominant, - name, - "GT++", - description, - branch.getBranch(), - binomial, - primary, - secondary); - } - - public static void initBees() { - for (GTPP_BeeDefinition bee : values()) { - bee.init(); - } - for (GTPP_BeeDefinition bee : values()) { - bee.registerMutations(); - } - } - - private static IAlleleBeeEffect getEffect(byte modid, String name) { - String s = switch (modid) { - case GTPP_Bees.EXTRABEES -> "extrabees.effect." + name; - case GTPP_Bees.GENDUSTRY -> "gendustry.effect." + name; - case GTPP_Bees.MAGICBEES -> "magicbees.effect" + name; - case GTPP_Bees.GREGTECH -> "gregtech.effect" + name; - default -> "forestry.effect" + name; - }; - return (IAlleleBeeEffect) AlleleManager.alleleRegistry.getAllele(s); - } - - private static IAlleleFlowers getFlowers(byte modid, String name) { - String s = switch (modid) { - case GTPP_Bees.EXTRABEES -> "extrabees.flower." + name; - case GTPP_Bees.GENDUSTRY -> "gendustry.flower." + name; - case GTPP_Bees.MAGICBEES -> "magicbees.flower" + name; - case GTPP_Bees.GREGTECH -> "gregtech.flower" + name; - default -> "forestry.flowers" + name; - }; - return (IAlleleFlowers) AlleleManager.alleleRegistry.getAllele(s); - } - - private static IAlleleBeeSpecies getSpecies(byte modid, String name) { - String s = switch (modid) { - case GTPP_Bees.EXTRABEES -> "extrabees.species." + name; - case GTPP_Bees.GENDUSTRY -> "gendustry.bee." + name; - case GTPP_Bees.MAGICBEES -> "magicbees.species" + name; - case GTPP_Bees.GREGTECH -> "gregtech.species" + name; - default -> "forestry.species" + name; - }; - IAlleleBeeSpecies ret = (IAlleleBeeSpecies) AlleleManager.alleleRegistry.getAllele(s); - return ret; - } - - private final void setSpeciesProperties(GTPP_AlleleBeeSpecies species2) { - this.mSpeciesProperties.accept(species2); - } - - private final void setAlleles(IAllele[] template) { - this.mAlleles.accept(template); - } - - private final void registerMutations() { - this.mMutations.accept(this); - } - - private void init() { - setSpeciesProperties(species); - - template = branch.getTemplate(); - AlleleHelper.instance.set(template, SPECIES, species); - setAlleles(template); - - genome = BeeManager.beeRoot.templateAsGenome(template); - - BeeManager.beeRoot.registerTemplate(template); - } - - private final IBeeMutationCustom registerMutation(IAlleleBeeSpecies parent1, IAlleleBeeSpecies parent2, - int chance) { - return registerMutation(parent1, parent2, chance, 1f); - } - - private final IBeeMutationCustom registerMutation(GTPP_BeeDefinition parent1, IAlleleBeeSpecies parent2, - int chance) { - return registerMutation(parent1, parent2, chance, 1f); - } - - private final IBeeMutationCustom registerMutation(IAlleleBeeSpecies parent1, GTPP_BeeDefinition parent2, - int chance) { - return registerMutation(parent1, parent2, chance, 1f); - } - - private final IBeeMutationCustom registerMutation(GTPP_BeeDefinition parent1, GTPP_BeeDefinition parent2, - int chance) { - return registerMutation(parent1, parent2, chance, 1f); - } - - private final IBeeMutationCustom registerMutation(String parent1, String parent2, int chance) { - return registerMutation(getGregtechBeeType(parent1), getGregtechBeeType(parent2), chance, 1f); - } - - /** - * Diese neue Funtion erlaubt Mutationsraten unter 1%. Setze dazu die Mutationsrate als Bruch mit chance / - * chancedivider This new function allows Mutation percentages under 1%. Set them as a fraction with chance / - * chancedivider - */ - private final IBeeMutationCustom registerMutation(IAlleleBeeSpecies parent1, IAlleleBeeSpecies parent2, int chance, - float chancedivider) { - return new GTPP_Bee_Mutation(parent1, parent2, this.getTemplate(), chance, chancedivider); - } - - private final IBeeMutationCustom registerMutation(GTPP_BeeDefinition parent1, IAlleleBeeSpecies parent2, int chance, - float chancedivider) { - return registerMutation(parent1.species, parent2, chance, chancedivider); - } - - private final IBeeMutationCustom registerMutation(IAlleleBeeSpecies parent1, GTPP_BeeDefinition parent2, int chance, - float chancedivider) { - return registerMutation(parent1, parent2.species, chance, chancedivider); - } - - private final IBeeMutationCustom registerMutation(GTPP_BeeDefinition parent1, GTPP_BeeDefinition parent2, - int chance, float chancedivider) { - return registerMutation(parent1.species, parent2, chance, chancedivider); - } - - private final IBeeMutationCustom registerMutation(String parent1, String parent2, int chance, float chancedivider) { - return registerMutation(getGregtechBeeType(parent1), getGregtechBeeType(parent2), chance, chancedivider); - } - - @Override - public final IAllele[] getTemplate() { - return Arrays.copyOf(template, template.length); - } - - @Override - public final IBeeGenome getGenome() { - return genome; - } - - @Override - public final IBee getIndividual() { - return new Bee(genome); - } - - @Override - public final ItemStack getMemberStack(EnumBeeType beeType) { - return BeeManager.beeRoot.getMemberStack(getIndividual(), beeType.ordinal()); - } - - public final IBeeDefinition getRainResist() { - return new BeeVariation.RainResist(this); - } - - private static final Class sGtBees = ReflectionUtils.getClass("gregtech.loaders.misc.GT_BeeDefinition"); - - public static IAlleleBeeSpecies getGregtechBeeType(String name) { - try { - Enum aBeeObject = ReflectionUtils.getEnum(sGtBees, name); - Field gtBeesField = ReflectionUtils.getField(sGtBees, "species"); - IAlleleBeeSpecies beeType = ReflectionUtils.getFieldValue(gtBeesField, aBeeObject); - return beeType != null ? beeType : null; - } catch (Throwable t) { - t.printStackTrace(); - return null; - } - } -} diff --git a/gtpp/src/main/java/gtPlusPlus/xmod/forestry/bees/registry/GTPP_Bee_Mutation.java b/gtpp/src/main/java/gtPlusPlus/xmod/forestry/bees/registry/GTPP_Bee_Mutation.java deleted file mode 100644 index d20b7ffb73..0000000000 --- a/gtpp/src/main/java/gtPlusPlus/xmod/forestry/bees/registry/GTPP_Bee_Mutation.java +++ /dev/null @@ -1,86 +0,0 @@ -package gtPlusPlus.xmod.forestry.bees.registry; - -import java.lang.reflect.Field; -import java.util.List; - -import net.minecraft.util.ChunkCoordinates; -import net.minecraft.world.World; - -import org.apache.commons.lang3.reflect.FieldUtils; - -import forestry.api.apiculture.BeeManager; -import forestry.api.apiculture.IAlleleBeeSpecies; -import forestry.api.apiculture.IBeeGenome; -import forestry.api.apiculture.IBeeHousing; -import forestry.api.apiculture.IBeeModifier; -import forestry.api.core.IClimateProvider; -import forestry.api.genetics.IAllele; -import forestry.api.genetics.IGenome; -import forestry.api.genetics.IMutationCondition; -import forestry.apiculture.genetics.BeeMutation; -import forestry.core.genetics.mutations.Mutation; - -public class GTPP_Bee_Mutation extends BeeMutation { - - private final float split; - - public GTPP_Bee_Mutation(IAlleleBeeSpecies bee0, IAlleleBeeSpecies bee1, IAllele[] result, int chance, - float split) { - super(bee0, bee1, result, chance); - this.split = split; - BeeManager.beeRoot.registerMutation(this); - } - - @Override - public float getBaseChance() { - return super.getBaseChance() / split; - } - - @Override - public float getChance(IBeeHousing housing, IAlleleBeeSpecies allele0, IAlleleBeeSpecies allele1, - IBeeGenome genome0, IBeeGenome genome1) { - World world = housing != null ? housing.getWorld() : null; - ChunkCoordinates housingCoordinates = housing != null ? housing.getCoordinates() : null; - int x = housingCoordinates != null ? housingCoordinates.posX : 0; - int y = housingCoordinates != null ? housingCoordinates.posY : 0; - int z = housingCoordinates != null ? housingCoordinates.posZ : 0; - - float processedChance = getBasicChance(world, x, y, z, allele0, allele1, genome0, genome1, housing); - - if (processedChance <= 0f) { - return 0f; - } - - IBeeModifier beeHousingModifier = BeeManager.beeRoot.createBeeHousingModifier(housing); - IBeeModifier beeModeModifier = BeeManager.beeRoot.getBeekeepingMode(world) - .getBeeModifier(); - - processedChance *= beeHousingModifier.getMutationModifier(genome0, genome1, processedChance); - processedChance *= beeModeModifier.getMutationModifier(genome0, genome1, processedChance); - - return processedChance; - } - - @SuppressWarnings("unchecked") - private float getBasicChance(World world, int x, int y, int z, IAllele allele0, IAllele allele1, IGenome genome0, - IGenome genome1, IClimateProvider climate) { - float mutationChance = this.getBaseChance(); - List<IMutationCondition> mutationConditions = null; - Field f = FieldUtils.getDeclaredField(Mutation.class, "mutationConditions", true); - if (f == null) f = FieldUtils.getField(Mutation.class, "mutationConditions", true); - if (f == null) return mutationChance; - try { - mutationConditions = f.get(this) instanceof List ? (List<IMutationCondition>) f.get(this) : null; - } catch (IllegalAccessException e) { - e.printStackTrace(); - } - - if (mutationConditions != null) for (IMutationCondition mutationCondition : mutationConditions) { - mutationChance *= mutationCondition.getChance(world, x, y, z, allele0, allele1, genome0, genome1, climate); - if (mutationChance == 0) { - return 0; - } - } - return mutationChance; - } -} diff --git a/gtpp/src/main/java/gtPlusPlus/xmod/forestry/bees/registry/GTPP_Bees.java b/gtpp/src/main/java/gtPlusPlus/xmod/forestry/bees/registry/GTPP_Bees.java deleted file mode 100644 index 77b7d57954..0000000000 --- a/gtpp/src/main/java/gtPlusPlus/xmod/forestry/bees/registry/GTPP_Bees.java +++ /dev/null @@ -1,69 +0,0 @@ -package gtPlusPlus.xmod.forestry.bees.registry; - -import static gregtech.api.enums.Mods.Forestry; - -import java.util.HashMap; - -import gregtech.GT_Mod; -import gtPlusPlus.api.objects.Logger; -import gtPlusPlus.core.material.Material; -import gtPlusPlus.core.util.reflect.ReflectionUtils; -import gtPlusPlus.xmod.forestry.bees.handler.GTPP_CombType; -import gtPlusPlus.xmod.forestry.bees.handler.GTPP_DropType; -import gtPlusPlus.xmod.forestry.bees.handler.GTPP_PollenType; -import gtPlusPlus.xmod.forestry.bees.handler.GTPP_PropolisType; -import gtPlusPlus.xmod.forestry.bees.items.output.GTPP_Comb; -import gtPlusPlus.xmod.forestry.bees.items.output.GTPP_Drop; -import gtPlusPlus.xmod.forestry.bees.items.output.GTPP_Pollen; -import gtPlusPlus.xmod.forestry.bees.items.output.GTPP_Propolis; - -public class GTPP_Bees { - - public static final byte FORESTRY = 0; - public static final byte EXTRABEES = 1; - public static final byte GENDUSTRY = 2; - public static final byte MAGICBEES = 3; - public static final byte GREGTECH = 4; - - public static GTPP_Propolis propolis; - public static GTPP_Pollen pollen; - public static GTPP_Drop drop; - public static GTPP_Comb combs; - - public static HashMap<String, Material> sMaterialMappings = new HashMap<>(); - public static HashMap<Integer, GTPP_PropolisType> sPropolisMappings = new HashMap<>(); - public static HashMap<Integer, GTPP_PollenType> sPollenMappings = new HashMap<>(); - public static HashMap<Integer, GTPP_DropType> sDropMappings = new HashMap<>(); - public static HashMap<Integer, GTPP_CombType> sCombMappings = new HashMap<>(); - - public GTPP_Bees() { - if (Forestry.isModLoaded() && GT_Mod.gregtechproxy.mGTBees) { - Logger.BEES("Creating required items."); - propolis = new GTPP_Propolis(); - pollen = new GTPP_Pollen(); - drop = new GTPP_Drop(); - combs = new GTPP_Comb(); - - Logger.BEES("Loading types."); - initTypes(); - - Logger.BEES("Adding recipes."); - GTPP_Drop.initDropsRecipes(); - GTPP_Propolis.initPropolisRecipes(); - GTPP_Comb.initCombsRecipes(); - - Logger.BEES("Initialising bees."); - GTPP_BeeDefinition.initBees(); - - Logger.BEES("Done!"); - } - } - - private static void initTypes() { - ReflectionUtils.loadClass("gtPlusPlus.xmod.forestry.bees.registry.GTPP_BeeDefinition"); - ReflectionUtils.loadClass("gtPlusPlus.xmod.forestry.bees.handler.GTPP_CombType"); - ReflectionUtils.loadClass("gtPlusPlus.xmod.forestry.bees.handler.GTPP_DropType"); - ReflectionUtils.loadClass("gtPlusPlus.xmod.forestry.bees.handler.GTPP_PollenType"); - ReflectionUtils.loadClass("gtPlusPlus.xmod.forestry.bees.handler.GTPP_PropolisType"); - } -} diff --git a/gtpp/src/main/java/gtPlusPlus/xmod/forestry/bees/registry/GTPP_BranchDefinition.java b/gtpp/src/main/java/gtPlusPlus/xmod/forestry/bees/registry/GTPP_BranchDefinition.java deleted file mode 100644 index 39af813dec..0000000000 --- a/gtpp/src/main/java/gtPlusPlus/xmod/forestry/bees/registry/GTPP_BranchDefinition.java +++ /dev/null @@ -1,89 +0,0 @@ -package gtPlusPlus.xmod.forestry.bees.registry; - -import static forestry.api.apiculture.EnumBeeChromosome.CAVE_DWELLING; -import static forestry.api.apiculture.EnumBeeChromosome.EFFECT; -import static forestry.api.apiculture.EnumBeeChromosome.FERTILITY; -import static forestry.api.apiculture.EnumBeeChromosome.FLOWERING; -import static forestry.api.apiculture.EnumBeeChromosome.FLOWER_PROVIDER; -import static forestry.api.apiculture.EnumBeeChromosome.HUMIDITY_TOLERANCE; -import static forestry.api.apiculture.EnumBeeChromosome.LIFESPAN; -import static forestry.api.apiculture.EnumBeeChromosome.NOCTURNAL; -import static forestry.api.apiculture.EnumBeeChromosome.SPEED; -import static forestry.api.apiculture.EnumBeeChromosome.TEMPERATURE_TOLERANCE; -import static forestry.api.apiculture.EnumBeeChromosome.TERRITORY; -import static forestry.api.apiculture.EnumBeeChromosome.TOLERANT_FLYER; - -import java.util.Arrays; -import java.util.function.Consumer; - -import forestry.api.apiculture.BeeManager; -import forestry.api.apiculture.EnumBeeChromosome; -import forestry.api.genetics.IAllele; -import forestry.api.genetics.IClassification; -import forestry.apiculture.genetics.alleles.AlleleEffect; -import forestry.core.genetics.alleles.AlleleHelper; -import forestry.core.genetics.alleles.EnumAllele.Fertility; -import forestry.core.genetics.alleles.EnumAllele.Flowering; -import forestry.core.genetics.alleles.EnumAllele.Flowers; -import forestry.core.genetics.alleles.EnumAllele.Lifespan; -import forestry.core.genetics.alleles.EnumAllele.Speed; -import forestry.core.genetics.alleles.EnumAllele.Territory; -import forestry.core.genetics.alleles.EnumAllele.Tolerance; - -public enum GTPP_BranchDefinition { - - LEGENDARY("gtpp.legendary", "Summa Potestas", alleles -> { - AlleleHelper.instance.set(alleles, TEMPERATURE_TOLERANCE, Tolerance.BOTH_2); - AlleleHelper.instance.set(alleles, HUMIDITY_TOLERANCE, Tolerance.BOTH_2); - AlleleHelper.instance.set(alleles, TOLERANT_FLYER, true); - AlleleHelper.instance.set(alleles, NOCTURNAL, true); - AlleleHelper.instance.set(alleles, FLOWER_PROVIDER, Flowers.END); - AlleleHelper.instance.set(alleles, LIFESPAN, Lifespan.SHORT); - AlleleHelper.instance.set(alleles, FLOWERING, Flowering.SLOW); - AlleleHelper.instance.set(alleles, SPEED, Speed.FASTEST); - AlleleHelper.instance.set(alleles, TERRITORY, Territory.LARGER); - }); - - private static IAllele[] defaultTemplate; - private final IClassification branch; - private final Consumer<IAllele[]> mBranchProperties; - - GTPP_BranchDefinition(String internal, String scientific, Consumer<IAllele[]> aBranchProperties) { - this.branch = BeeManager.beeFactory.createBranch(internal.toLowerCase(), scientific); - this.mBranchProperties = aBranchProperties; - } - - private static IAllele[] getDefaultTemplate() { - if (defaultTemplate == null) { - defaultTemplate = new IAllele[EnumBeeChromosome.values().length]; - - AlleleHelper.instance.set(defaultTemplate, SPEED, Speed.SLOWEST); - AlleleHelper.instance.set(defaultTemplate, LIFESPAN, Lifespan.SHORTER); - AlleleHelper.instance.set(defaultTemplate, FERTILITY, Fertility.NORMAL); - AlleleHelper.instance.set(defaultTemplate, TEMPERATURE_TOLERANCE, Tolerance.NONE); - AlleleHelper.instance.set(defaultTemplate, NOCTURNAL, false); - AlleleHelper.instance.set(defaultTemplate, HUMIDITY_TOLERANCE, Tolerance.NONE); - AlleleHelper.instance.set(defaultTemplate, TOLERANT_FLYER, false); - AlleleHelper.instance.set(defaultTemplate, CAVE_DWELLING, false); - AlleleHelper.instance.set(defaultTemplate, FLOWER_PROVIDER, Flowers.VANILLA); - AlleleHelper.instance.set(defaultTemplate, FLOWERING, Flowering.SLOWEST); - AlleleHelper.instance.set(defaultTemplate, TERRITORY, Territory.AVERAGE); - AlleleHelper.instance.set(defaultTemplate, EFFECT, AlleleEffect.effectNone); - } - return Arrays.copyOf(defaultTemplate, defaultTemplate.length); - } - - private final void setBranchProperties(IAllele[] template) { - this.mBranchProperties.accept(template); - } - - public final IAllele[] getTemplate() { - IAllele[] template = getDefaultTemplate(); - setBranchProperties(template); - return template; - } - - public final IClassification getBranch() { - return branch; - } -} diff --git a/gtpp/src/main/java/gtPlusPlus/xmod/gregtech/HANDLER_GT.java b/gtpp/src/main/java/gtPlusPlus/xmod/gregtech/HANDLER_GT.java deleted file mode 100644 index e95baf43df..0000000000 --- a/gtpp/src/main/java/gtPlusPlus/xmod/gregtech/HANDLER_GT.java +++ /dev/null @@ -1,98 +0,0 @@ -package gtPlusPlus.xmod.gregtech; - -import static gregtech.api.enums.Mods.AdvancedSolarPanel; - -import java.util.ArrayList; -import java.util.List; - -import cpw.mods.fml.common.event.FMLLoadCompleteEvent; -import gregtech.api.GregTech_API; -import gregtech.api.items.GT_MetaGenerated_Tool; -import gregtech.api.util.GT_Config; -import gtPlusPlus.core.handler.COMPAT_HANDLER; -import gtPlusPlus.core.recipe.common.CI; -import gtPlusPlus.everglades.gen.gt.WorldGen_GT; -import gtPlusPlus.recipes.CokeAndPyrolyseOven; -import gtPlusPlus.xmod.gregtech.api.enums.GregtechItemList; -import gtPlusPlus.xmod.gregtech.api.enums.GregtechOrePrefixes.GT_Materials; -import gtPlusPlus.xmod.gregtech.api.util.GTPP_Config; -import gtPlusPlus.xmod.gregtech.common.Meta_GT_Proxy; -import gtPlusPlus.xmod.gregtech.common.blocks.fluid.GregtechFluidHandler; -import gtPlusPlus.xmod.gregtech.common.items.MetaGeneratedGregtechTools; -import gtPlusPlus.xmod.gregtech.loaders.Gregtech_Blocks; -import gtPlusPlus.xmod.gregtech.loaders.ProcessingAngleGrinder; -import gtPlusPlus.xmod.gregtech.loaders.ProcessingElectricSnips; -import gtPlusPlus.xmod.gregtech.loaders.misc.AddCustomMachineToPA; -import gtPlusPlus.xmod.gregtech.loaders.recipe.RecipeLoader_AlgaeFarm; -import gtPlusPlus.xmod.gregtech.loaders.recipe.RecipeLoader_MolecularTransformer; -import gtPlusPlus.xmod.gregtech.loaders.recipe.RecipeLoader_TreeFarm; -import gtPlusPlus.xmod.gregtech.registration.gregtech.GregtechConduits; - -public class HANDLER_GT { - - public static GT_Config mMaterialProperties = null; - public static GTPP_Config sCustomWorldgenFile = null; - public static final List<WorldGen_GT> sWorldgenListEverglades = new ArrayList<>(); - public static GT_MetaGenerated_Tool sMetaGeneratedToolInstance; - - public static void preInit() { - - if (mMaterialProperties != null) { - GT_Materials.init(mMaterialProperties); - } - - GregtechFluidHandler.run(); - } - - public static void init() { - - // Load General Blocks and set up some Basic Meta Tile Entity states - Gregtech_Blocks.run(); - - // Add Custom Pipes, Wires and Cables. - GregtechConduits.run(); - - // Register Tile Entities - COMPAT_HANDLER.registerGregtechMachines(); - - sMetaGeneratedToolInstance = MetaGeneratedGregtechTools.getInstance(); - } - - public static void postInit() { - - // Only loads if the config option is true (default: true) - new ProcessingAngleGrinder().run(); - new ProcessingElectricSnips().run(); - - // Add recipes - CokeAndPyrolyseOven.postInit(); - - // Register custom singles to the PA - AddCustomMachineToPA.register(); - - // Register some custom recipe maps for any enabled multiblocks. - // MultiblockRecipeMapHandler.run(); - - if (GregtechItemList.Circuit_BioRecipeSelector.hasBeenSet()) { - for (int i = 1; i <= 24; i++) { - GregTech_API.registerConfigurationCircuit(CI.getNumberedBioCircuit(i), 0); - } - } - - if (GregtechItemList.Circuit_T3RecipeSelector.hasBeenSet()) { - for (int i = 1; i <= 24; i++) { - GregTech_API.registerConfigurationCircuit(CI.getNumberedAdvancedCircuit(i), 3); - } - } - } - - public static void onLoadComplete(FMLLoadCompleteEvent event) { - CokeAndPyrolyseOven.onLoadComplete(); - Meta_GT_Proxy.fixIC2FluidNames(); - RecipeLoader_AlgaeFarm.generateRecipes(); - RecipeLoader_TreeFarm.generateRecipes(); - if (AdvancedSolarPanel.isModLoaded()) { - RecipeLoader_MolecularTransformer.run(); - } - } -} diff --git a/gtpp/src/main/java/gtPlusPlus/xmod/gregtech/api/enums/GregtechItemList.java b/gtpp/src/main/java/gtPlusPlus/xmod/gregtech/api/enums/GregtechItemList.java deleted file mode 100644 index 6367d22f77..0000000000 --- a/gtpp/src/main/java/gtPlusPlus/xmod/gregtech/api/enums/GregtechItemList.java +++ /dev/null @@ -1,980 +0,0 @@ -package gtPlusPlus.xmod.gregtech.api.enums; - -import static gregtech.api.enums.GT_Values.W; - -import net.minecraft.block.Block; -import net.minecraft.init.Blocks; -import net.minecraft.item.Item; -import net.minecraft.item.ItemStack; - -import gregtech.api.util.GT_ModHandler; -import gregtech.api.util.GT_OreDictUnificator; -import gregtech.api.util.GT_Utility; -import gtPlusPlus.xmod.gregtech.api.interfaces.GregtechItemContainer; - -/** - * Class containing all non-OreDict Items of GregTech. - */ -public enum GregtechItemList implements GregtechItemContainer { - - /** - * Items - */ - - // Advanced Hazmat Suit - Armour_Hazmat_Advanced_Helmet, - Armour_Hazmat_Advanced_Chest, - Armour_Hazmat_Advanced_Legs, - Armour_Hazmat_Advanced_Boots, - - // Gregtech Machine Parts - Electric_Motor_LuV, - Electric_Motor_ZPM, - Electric_Motor_UV, - Electric_Pump_LuV, - Electric_Pump_ZPM, - Electric_Pump_UV, - Conveyor_Module_LuV, - Conveyor_Module_ZPM, - Conveyor_Module_UV, - Electric_Piston_LuV, - Electric_Piston_ZPM, - Electric_Piston_UV, - Robot_Arm_LuV, - Robot_Arm_ZPM, - Robot_Arm_UV, - Field_Generator_LuV, - Field_Generator_ZPM, - Field_Generator_UV, - Emitter_LuV, - Emitter_ZPM, - Emitter_UV, - Sensor_LuV, - Sensor_ZPM, - Sensor_UV, - - // Mixed Components - TransmissionComponent_LV, - TransmissionComponent_MV, - TransmissionComponent_HV, - TransmissionComponent_EV, - TransmissionComponent_IV, - TransmissionComponent_LuV, - TransmissionComponent_ZPM, - TransmissionComponent_UV, - TransmissionComponent_UHV, - - // Recipe Circuit - Circuit_BioRecipeSelector, - Circuit_T3RecipeSelector, - - // Circuits - Old_Circuit_Primitive, - Old_Circuit_Basic, - Old_Circuit_Good, - Old_Circuit_Advanced, - Old_Circuit_Data, - Old_Circuit_Elite, - Old_Circuit_Master, - Old_Tool_DataOrb, - Old_Circuit_Ultimate, - Old_Tool_DataStick, - Circuit_IV, - Circuit_LuV, - Circuit_ZPM, - - // Circuit Parts - Circuit_Board_IV, - Circuit_Board_LuV, - Circuit_Board_ZPM, - Circuit_Parts_Crystal_Chip_IV, - Circuit_Parts_Crystal_Chip_LuV, - Circuit_Parts_Crystal_Chip_ZPM, - Circuit_Parts_IV, - Circuit_Parts_LuV, - Circuit_Parts_ZPM, - Circuit_Parts_Wiring_IV, - Circuit_Parts_Wiring_LuV, - Circuit_Parts_Wiring_ZPM, - - // Old Style Circuits - Old_Circuit_Board_Basic, - Old_Circuit_Board_Advanced, - Old_Circuit_Board_Elite, - Old_Circuit_Parts_Crystal_Chip_Elite, - Old_Circuit_Parts_Crystal_Chip_Master, - Old_Circuit_Parts_Advanced, - Old_Circuit_Parts_Wiring_Basic, - Old_Circuit_Parts_Wiring_Advanced, - Old_Circuit_Parts_Wiring_Elite, - Old_Empty_Board_Basic, - Old_Empty_Board_Elite, - - // Batteries - Battery_RE_EV_Sodium, - Battery_RE_EV_Cadmium, - Battery_RE_EV_Lithium, - - // Shapes for Extruder - Shape_Extruder_WindmillShaft, - Shape_Extruder_SmallGear, - - // Cooked Raisin Toast for ImQ009 - Food_Baked_Raisin_Bread, - - // Fluid Cells to regulate flows. - Fluid_Cell_1L, - Fluid_Cell_16L, - Fluid_Cell_36L, - Fluid_Cell_144L, - - // Debug - TESTITEM, - - // Larger Volumetric Flasks - VOLUMETRIC_FLASK_8k, - VOLUMETRIC_FLASK_32k, - - // RTG Fuels - Pellet_RTG_PU238, - Pellet_RTG_SR90, - Pellet_RTG_PO210, - Pellet_RTG_AM241, - - // Computer Cube - Gregtech_Computer_Cube, - - // Casings for batteries - Battery_Casing_Gem_1, - Battery_Casing_Gem_2, - Battery_Casing_Gem_3, - Battery_Casing_Gem_4, - - // Custom Batteries - Battery_Gem_1, - Battery_Gem_2, - Battery_Gem_3, - Battery_Gem_4, - - // Compressed Fusion MK3 - Compressed_Fusion_Reactor, - - // Carbon Materials - - // End Game Laser Engraver Lens - Laser_Lens_WoodsGlass, - Laser_Lens_Special, - - // Pellet Mold - Pellet_Mold, - - // Upgrade chip for Distillus - Distillus_Upgrade_Chip, - Maceration_Upgrade_Chip, - - // Milling Balls - Milling_Ball_Alumina, - Milling_Ball_Soapstone, - - // ---------------------------------------------------------------------------- - - /** - * MultiBlocks - */ - - // Tier GT++ Casings - GTPP_Casing_ULV, - GTPP_Casing_LV, - GTPP_Casing_MV, - GTPP_Casing_HV, - GTPP_Casing_EV, - GTPP_Casing_IV, - GTPP_Casing_LuV, - GTPP_Casing_ZPM, - GTPP_Casing_UV, - GTPP_Casing_UHV, - - // IronBlastFurnace Machine_Bronze_BlastFurnace - Casing_IronPlatedBricks, - - // Large Centrifuge - Industrial_Centrifuge, - Casing_Centrifuge1, - - // Large Alloy Smelter - Industrial_AlloySmelter, - - // Coke Oven - Industrial_CokeOven, - Casing_CokeOven, - Casing_CokeOven_Coil1, - Casing_CokeOven_Coil2, - - // Bending Maching // Plate Press // Press - Industrial_PlatePress, - Casing_MaterialPress, - - // Matter Fab - Industrial_MassFab, - Casing_MatterGen, - Casing_MatterFab, - - // ABS - Industrial_AlloyBlastSmelter, - Casing_Coil_BlastSmelter, - Casing_BlastSmelter, - Mega_AlloyBlastSmelter, - - // Quantum Force Transformer - QuantumForceTransformer, - Casing_Coil_QuantumForceTransformer, - NeutronPulseManipulator, - CosmicFabricManipulator, - InfinityInfusedManipulator, - SpaceTimeContinuumRipper, - NeutronShieldingCore, - CosmicFabricShieldingCore, - InfinityInfusedShieldingCore, - SpaceTimeBendingCore, - ForceFieldGlass, - - // Industrial Electrolyzer - Industrial_Electrolyzer, - Casing_Electrolyzer, - - // Industrial Maceration Stack - Industrial_MacerationStack, - Casing_MacerationStack, - - // Industrial Wire Factory - Industrial_WireFactory, - Casing_WireFactory, - - // Power sub-station for mass storage. 3 hatches for input and output, whatever voltages you desire. - PowerSubStation, - Casing_Vanadium_Redox, - Casing_Vanadium_Redox_IV, - Casing_Vanadium_Redox_LuV, - Casing_Vanadium_Redox_ZPM, - Casing_Vanadium_Redox_UV, - Casing_Vanadium_Redox_MAX, - Casing_Power_SubStation, - - // LFTR - ThoriumReactor, - Casing_Reactor_I, - Casing_Reactor_II, - - // Nuclear Salt Processing Plant - Nuclear_Salt_Processing_Plant, - - // Multitank - /* Industrial_MultiTank, */ - Industrial_MultiTankDense, - Casing_MultitankExterior, - - // Fission Fuel Refinery - Industrial_FuelRefinery, - Casing_Refinery_External, - Casing_Refinery_Structural, - Casing_Refinery_Internal, - - // Industrial Sifter - Industrial_Sifter, - Casing_Sifter, - Casing_SifterGrate, - - // Large Thermal Centrifuge - Industrial_ThermalCentrifuge, - Casing_ThermalCentrifuge, - - // Cyclotron - COMET_Cyclotron, - Casing_Cyclotron_Coil, - Casing_Cyclotron_External, - - // Thermal Boiler - GT4_Thermal_Boiler, - Casing_ThermalContainment, - - // Tree Farm - Industrial_TreeFarm, - TreeFarmer_Structural, - Casing_PLACEHOLDER_TreeFarmer, - - // Fish Pond - Industrial_FishingPond, - Casing_FishPond, - - // Algae - AlgaeFarm_Controller, - - // Chemical Plant - ChemicalPlant_Controller, - - // GT4 autoCrafter - GT4_Multi_Crafter, - Casing_Autocrafter, - - // industrial Ore-Washer - Industrial_WashPlant, - Casing_WashPlant, - - // Cutting Factory Controller - Industrial_CuttingFactoryController, - Casing_CuttingFactoryFrame, - - // Large Extruder - Industrial_Extruder, - Casing_Extruder, - - // Multi-Machine - Industrial_MultiMachine, - Casing_Multi_Use, - - // Bedrock Mining Platforms - /* BedrockMiner_MKI, */ - /* BedrockMiner_MKII, */ - /* BedrockMiner_MKIII, */ - Casing_BedrockMiner, - - // Large Packager - Amazon_Warehouse_Controller, - Casing_AmazonWarehouse, - - // Advanced GT vanilla Multis - Machine_Adv_BlastFurnace, - Casing_Adv_BlastFurnace, - Machine_Adv_ImplosionCompressor, - Machine_Adv_DistillationTower, - - // Advanced Vacuum Freezer - Industrial_Cryogenic_Freezer, - Casing_AdvancedVacuum, - - // FusionTek MK IV - FusionComputer_UV2, - Casing_Fusion_External, - Casing_Fusion_Internal, - - // FusionTech MK V - - FusionComputer_UV3, - Casing_Fusion_External2, - Casing_Fusion_Internal2, - - // large mixer - Industrial_Mixer, - - // Naq Reactor - Casing_Naq_Reactor_A, - Casing_Naq_Reactor_B, - Casing_Naq_Reactor_C, - /* Controller_Naq_Reactor, */ - Casing_Containment, - - // Arc Furnace - Industrial_Arc_Furnace, - Casing_Industrial_Arc_Furnace, - - // Solar Tower - Industrial_Solar_Tower, - Casing_SolarTower_Structural, - Casing_SolarTower_SaltContainment, - Casing_SolarTower_HeatContainment, - - // Larger Turbines - Large_Steam_Turbine, - Large_HPSteam_Turbine, - Large_Gas_Turbine, - Large_Plasma_Turbine, - Large_SCSteam_Turbine, - Casing_Turbine_Shaft, - Casing_Turbine_LP, - Casing_Turbine_HP, - Casing_Turbine_Gas, - Casing_Turbine_Plasma, - Casing_Turbine_SC, - XL_HeatExchanger, - Casing_XL_HeatExchanger, - - // Large Engine - Casing_Reinforced_Engine_Casing, - - // Large Vacuum Furnace - Casing_Vacuum_Furnace, - Controller_Vacuum_Furnace, - - // Large Rocket Engine - Casing_RocketEngine, - Controller_RocketEngine, - - // Large Semi-Fluid - Controller_LargeSemifluidGenerator, - - // IsaMill - Controller_IsaMill, - Casing_IsaMill_Casing, - Casing_IsaMill_Gearbox, - Casing_IsaMill_Pipe, - - // Flotation Cell - Controller_Flotation_Cell, - Casing_Flotation_Cell, - - // Sparge Tower - Controller_Sparge_Tower, - Casing_Sparge_Tower_Exterior, - Casing_Sparge_Tower_Interior, - - // Elemental Duplicator - Controller_ElementalDuplicator, - Casing_ElementalDuplicator, - - // Forge Hammer - Controller_IndustrialForgeHammer, - Casing_IndustrialForgeHammer, - - // Molecular Transformer - Controller_MolecularTransformer, - Casing_Molecular_Transformer_1, - Casing_Molecular_Transformer_2, - Casing_Molecular_Transformer_3, - - // Big Steam Macerator - Controller_SteamMaceratorMulti, - // Big Steam Compressor - Controller_SteamCompressorMulti, - - // Industrial Rock Breaker - Controller_IndustrialRockBreaker, - - // Industrial Chisel - Controller_IndustrialAutoChisel, - Casing_IndustrialAutoChisel, - - // Industrial Fluid Heater - Controller_IndustrialFluidHeater, - - // Custom Machine Casings - Casing_Machine_Custom_1, - Casing_Machine_Custom_2, - Casing_Machine_Custom_3, - Casing_Machine_Custom_4, - Casing_Machine_Custom_5, - Casing_Machine_Custom_6, - - // ---------------------------------------------------------------------------- - - /** - * Custom hatches/Busses - */ - - // Buffer Dynamos - Hatch_Buffer_Dynamo_ULV, - Hatch_Buffer_Dynamo_LV, - Hatch_Buffer_Dynamo_MV, - Hatch_Buffer_Dynamo_HV, - Hatch_Buffer_Dynamo_EV, - Hatch_Buffer_Dynamo_IV, - Hatch_Buffer_Dynamo_LuV, - Hatch_Buffer_Dynamo_ZPM, - Hatch_Buffer_Dynamo_UV, - Hatch_Buffer_Dynamo_MAX, - - // Air Intake hatch - Hatch_Air_Intake, - Hatch_Air_Intake_Extreme, - - // Reservoir Hatch - Hatch_Reservoir, - - // XL Turbine Rotor Hatch - Hatch_Turbine_Rotor, - - // Standard Turbine Rotor Hatch - Hatch_Input_TurbineHousing, - - // Milling Ball Bus - Bus_Milling_Balls, - - // Catalyst Bus - Bus_Catalysts, - - // Custom Fluid Hatches - Hatch_Input_Cryotheum, - Hatch_Input_Pyrotheum, - Hatch_Input_Naquadah, - Hatch_Input_Steam, - - // Steam Multi Buses - Hatch_Input_Bus_Steam, - Hatch_Output_Bus_Steam, - - // Elemental Duplicator Data Orb Bus - Hatch_Input_Elemental_Duplicator, - - // RTG Hatch - - // Battery hatches for PSS - Hatch_Input_Battery_MV, - Hatch_Input_Battery_EV, - Hatch_Output_Battery_MV, - Hatch_Output_Battery_EV, - - // Advanced Mufflers - Hatch_Muffler_Adv_LV, - Hatch_Muffler_Adv_MV, - Hatch_Muffler_Adv_HV, - Hatch_Muffler_Adv_EV, - Hatch_Muffler_Adv_IV, - Hatch_Muffler_Adv_LuV, - Hatch_Muffler_Adv_ZPM, - Hatch_Muffler_Adv_UV, - Hatch_Muffler_Adv_MAX, - - // Super Input Busses - Hatch_SuperBus_Input_LV, - Hatch_SuperBus_Input_MV, - Hatch_SuperBus_Input_HV, - Hatch_SuperBus_Input_EV, - Hatch_SuperBus_Input_IV, - Hatch_SuperBus_Input_LuV, - Hatch_SuperBus_Input_ZPM, - Hatch_SuperBus_Input_UV, - Hatch_SuperBus_Input_MAX, - - // Super Output Busses - Hatch_SuperBus_Output_LV, - Hatch_SuperBus_Output_MV, - Hatch_SuperBus_Output_HV, - Hatch_SuperBus_Output_EV, - Hatch_SuperBus_Output_IV, - Hatch_SuperBus_Output_LuV, - Hatch_SuperBus_Output_ZPM, - Hatch_SuperBus_Output_UV, - Hatch_SuperBus_Output_MAX, - - // Chisel Buses for Industrial Chisel - GT_MetaTileEntity_ChiselBus_LV, - GT_MetaTileEntity_ChiselBus_MV, - GT_MetaTileEntity_ChiselBus_HV, - - // Solidifier Hatches for Industrial Multi Machine - GT_MetaTileEntity_Solidifier_I, - GT_MetaTileEntity_Solidifier_II, - GT_MetaTileEntity_Solidifier_III, - GT_MetaTileEntity_Solidifier_IV, - - // ---------------------------------------------------------------------------- - - /** - * Blocks - */ - ResonanceChamber_I, - ResonanceChamber_II, - ResonanceChamber_III, - ResonanceChamber_IV, - - Modulator_I, - Modulator_II, - Modulator_III, - Modulator_IV, - - // ---------------------------------------------------------------------------- - - /** - * Single Block Tile Entities - */ - - // Crate Box - CrateStorage, - - // Auto TC Research Creator - Thaumcraft_Researcher, - - // infinite Items - Infinite_Item_Chest, - - // GT4 automation - GT4_Electric_Auto_Workbench_LV, - GT4_Electric_Auto_Workbench_MV, - GT4_Electric_Auto_Workbench_HV, - GT4_Electric_Auto_Workbench_EV, - GT4_Electric_Auto_Workbench_IV, - GT4_Electric_Auto_Workbench_LuV, - GT4_Electric_Auto_Workbench_ZPM, - GT4_Electric_Auto_Workbench_UV, - GT4_Electric_Inventory_Manager_LV, - GT4_Electric_Inventory_Manager_MV, - GT4_Electric_Inventory_Manager_HV, - GT4_Electric_Inventory_Manager_EV, - GT4_Electric_Inventory_Manager_IV, - GT4_Electric_Inventory_Manager_LuV, - GT4_Electric_Inventory_Manager_ZPM, - GT4_Electric_Inventory_Manager_UV, - - // GT4 Crop Harvester - GT4_Crop_Harvester_LV, - GT4_Crop_Harvester_MV, - GT4_Crop_Harvester_HV, - GT4_Crop_Harvester_EV, - GT4_Crop_Harvester_IV, - GT4_Crop_Harvester_LuV, - GT4_Crop_Harvester_ZPM, - GT4_Crop_Harvester_UV, - - // Geothermal Engines - Geothermal_Engine_EV, - Geothermal_Engine_IV, - Geothermal_Engine_LuV, - - // Tesseracts - GT4_Tesseract_Generator, - GT4_Tesseract_Terminal, - - // Advanced Boilers - Boiler_Advanced_LV, - Boiler_Advanced_MV, - Boiler_Advanced_HV, - - // Fancy Pollution Devices - Pollution_Detector, - Pollution_Cleaner_LV, - Pollution_Cleaner_MV, - Pollution_Cleaner_HV, - Pollution_Cleaner_EV, - Pollution_Cleaner_IV, - Pollution_Cleaner_LuV, - Pollution_Cleaner_ZPM, - Pollution_Cleaner_UV, - Pollution_Cleaner_MAX, - - // Debug machine - Pollution_Creator, - - // Basically is an automatic Cauldron - SimpleDustWasher_ULV, - SimpleDustWasher_MV, - SimpleDustWasher_EV, - SimpleDustWasher_LuV, - SimpleDustWasher_UV, - - // Solar Tower Reflector - Solar_Tower_Reflector, - - // Super Tier Chests - Super_Chest_LV, - Super_Chest_MV, - Super_Chest_HV, - Super_Chest_EV, - Super_Chest_IV, - - // Wireless Chargers - Charger_LV, - Charger_MV, - Charger_HV, - Charger_EV, - Charger_IV, - Charger_LuV, - Charger_ZPM, - Charger_UV, - Charger_UHV, - - // Reactor Processing Unit - ReactorProcessingUnit_IV, - ReactorProcessingUnit_ZPM, - - // Cold Trap - ColdTrap_IV, - ColdTrap_ZPM, - - // Solar Generators - GT_Solar_ULV, - GT_Solar_LV, - GT_Solar_MV, - GT_Solar_HV, - GT_Solar_EV, - GT_Solar_IV, - GT_Solar_LuV, - GT_Solar_ZPM, - GT_Solar_UV, - GT_Solar_MAX, - - // Variable voltage RF convertor - Energy_Buffer_1by1_ULV, - Energy_Buffer_1by1_LV, - Energy_Buffer_1by1_MV, - Energy_Buffer_1by1_HV, - Energy_Buffer_1by1_EV, - Energy_Buffer_1by1_IV, - Energy_Buffer_1by1_LuV, - Energy_Buffer_1by1_ZPM, - Energy_Buffer_1by1_UV, - Energy_Buffer_1by1_MAX, - - // Rocket Engines - Rocket_Engine_EV, - Rocket_Engine_IV, - Rocket_Engine_LuV, - - // Hi Amp Transformers - Transformer_HA_LV_ULV, - Transformer_HA_MV_LV, - Transformer_HA_HV_MV, - Transformer_HA_EV_HV, - Transformer_HA_IV_EV, - Transformer_HA_LuV_IV, - Transformer_HA_ZPM_LuV, - Transformer_HA_UV_ZPM, - Transformer_HA_MAX_UV, - - // Semi-Fluid generators - Generator_SemiFluid_LV, - Generator_SemiFluid_MV, - Generator_SemiFluid_HV, - Generator_SemiFluid_EV, - Generator_SemiFluid_IV, - - // Advanced Mixer 4x4 - Machine_Advanced_LV_Mixer, - Machine_Advanced_MV_Mixer, - Machine_Advanced_HV_Mixer, - Machine_Advanced_EV_Mixer, - Machine_Advanced_IV_Mixer, - Machine_Advanced_LuV_Mixer, - Machine_Advanced_ZPM_Mixer, - Machine_Advanced_UV_Mixer, - - // Block that enables uplink to a superconductor network - SuperConductorInputNode, - - // Heat Pipes - HeatPipe_Tier_1, - HeatPipe_Tier_2, - HeatPipe_Tier_3, - - // Chemical Dehydrators for nuclear fuels - GT_Dehydrator_MV, - GT_Dehydrator_HV, - GT_Dehydrator_EV, - GT_Dehydrator_IV, - GT_Dehydrator_LuV, - GT_Dehydrator_ZPM, - - // Fluid Storage Tanks - GT_FluidTank_ULV, - GT_FluidTank_LV, - GT_FluidTank_MV, - GT_FluidTank_HV, - GT_FluidTank_EV, - GT_FluidTank_IV, - GT_FluidTank_LuV, - GT_FluidTank_ZPM, - GT_FluidTank_UV, - GT_FluidTank_MAX, - - // GT RTG - RTG, - - // Chisel Machines - GT_Chisel_LV, - GT_Chisel_MV, - GT_Chisel_HV, - - // Plasma Tank - /* Plasma_Tank, */ - - // ---------------------------------------------------------------------------- - - /** - * Covers - */ - - // Fluid Void Covers - Cover_Overflow_LV, - Cover_Overflow_MV, - Cover_Overflow_HV, - Cover_Overflow_EV, - Cover_Overflow_IV, - - // Item Void Covers - Cover_Overflow_Item_ULV, - Cover_Overflow_Item_LV, - Cover_Overflow_Item_MV, - Cover_Overflow_Item_HV, - Cover_Overflow_Item_EV, - Cover_Overflow_Item_IV, - - // ---------------------------------------------------------------------------- - // Additional washers - SimpleDustWasher_LV, - SimpleDustWasher_HV, - SimpleDustWasher_IV, - SimpleDustWasher_ZPM, - - ; - - public static final GregtechItemList[] DYE_ONLY_ITEMS = { Energy_Buffer_1by1_EV, Energy_Buffer_1by1_EV }; - private ItemStack mStack; - private boolean mHasNotBeenSet = true; - - @Override - public GregtechItemList set(final Item aItem) { - this.mHasNotBeenSet = false; - if (aItem == null) { - return this; - } - final ItemStack aStack = new ItemStack(aItem, 1, 0); - this.mStack = GT_Utility.copyAmount(1, aStack); - return this; - } - - @Override - public GregtechItemList set(final ItemStack aStack) { - this.mHasNotBeenSet = false; - this.mStack = GT_Utility.copyAmount(1, aStack); - return this; - } - - @Override - public Item getItem() { - if (this.mHasNotBeenSet) { - throw new IllegalAccessError("The Enum '" + this.name() + "' has not been set to an Item at this time!"); - } - if (GT_Utility.isStackInvalid(this.mStack)) { - return null; - } - return this.mStack.getItem(); - } - - @Override - public Block getBlock() { - if (this.mHasNotBeenSet) { - throw new IllegalAccessError("The Enum '" + this.name() + "' has not been set to an Item at this time!"); - } - return getBlockFromStack(this.getItem()); - } - - @Override - public final boolean hasBeenSet() { - return !this.mHasNotBeenSet; - } - - @Override - public boolean isStackEqual(final Object aStack) { - return this.isStackEqual(aStack, false, false); - } - - @Override - public boolean isStackEqual(final Object aStack, final boolean aWildcard, final boolean aIgnoreNBT) { - if (GT_Utility.isStackInvalid(aStack)) { - return false; - } - return GT_Utility - .areUnificationsEqual((ItemStack) aStack, aWildcard ? this.getWildcard(1) : this.get(1), aIgnoreNBT); - } - - public static Block getBlockFromStack(Object aStack) { - if (GT_Utility.isStackInvalid(aStack)) return Blocks.air; - return Block.getBlockFromItem(((ItemStack) aStack).getItem()); - } - - @Override - public ItemStack get(final long aAmount, final Object... aReplacements) { - if (this.mHasNotBeenSet) { - throw new IllegalAccessError("The Enum '" + this.name() + "' has not been set to an Item at this time!"); - } - if (GT_Utility.isStackInvalid(this.mStack)) { - return GT_Utility.copyAmount(aAmount, aReplacements); - } - return GT_Utility.copyAmount(aAmount, GT_OreDictUnificator.get(this.mStack)); - } - - @Override - public ItemStack getWildcard(final long aAmount, final Object... aReplacements) { - if (this.mHasNotBeenSet) { - throw new IllegalAccessError("The Enum '" + this.name() + "' has not been set to an Item at this time!"); - } - if (GT_Utility.isStackInvalid(this.mStack)) { - return GT_Utility.copyAmount(aAmount, aReplacements); - } - return GT_Utility.copyAmountAndMetaData(aAmount, W, GT_OreDictUnificator.get(this.mStack)); - } - - @Override - public ItemStack getUndamaged(final long aAmount, final Object... aReplacements) { - if (this.mHasNotBeenSet) { - throw new IllegalAccessError("The Enum '" + this.name() + "' has not been set to an Item at this time!"); - } - if (GT_Utility.isStackInvalid(this.mStack)) { - return GT_Utility.copyAmount(aAmount, aReplacements); - } - return GT_Utility.copyAmountAndMetaData(aAmount, 0, GT_OreDictUnificator.get(this.mStack)); - } - - @Override - public ItemStack getAlmostBroken(final long aAmount, final Object... aReplacements) { - if (this.mHasNotBeenSet) { - throw new IllegalAccessError("The Enum '" + this.name() + "' has not been set to an Item at this time!"); - } - if (GT_Utility.isStackInvalid(this.mStack)) { - return GT_Utility.copyAmount(aAmount, aReplacements); - } - return GT_Utility - .copyAmountAndMetaData(aAmount, this.mStack.getMaxDamage() - 1, GT_OreDictUnificator.get(this.mStack)); - } - - @Override - public ItemStack getWithName(final long aAmount, final String aDisplayName, final Object... aReplacements) { - final ItemStack rStack = this.get(1, aReplacements); - if (GT_Utility.isStackInvalid(rStack)) { - return null; - } - rStack.setStackDisplayName(aDisplayName); - return GT_Utility.copyAmount(aAmount, rStack); - } - - @Override - public ItemStack getWithCharge(final long aAmount, final int aEnergy, final Object... aReplacements) { - final ItemStack rStack = this.get(1, aReplacements); - if (GT_Utility.isStackInvalid(rStack)) { - return null; - } - GT_ModHandler.chargeElectricItem(rStack, aEnergy, Integer.MAX_VALUE, true, false); - return GT_Utility.copyAmount(aAmount, rStack); - } - - @Override - public ItemStack getWithDamage(final long aAmount, final long aMetaValue, final Object... aReplacements) { - if (this.mHasNotBeenSet) { - throw new IllegalAccessError("The Enum '" + this.name() + "' has not been set to an Item at this time!"); - } - if (GT_Utility.isStackInvalid(this.mStack)) { - return GT_Utility.copyAmount(aAmount, aReplacements); - } - return GT_Utility.copyAmountAndMetaData(aAmount, aMetaValue, GT_OreDictUnificator.get(this.mStack)); - } - - @Override - public GregtechItemList registerOre(final Object... aOreNames) { - if (this.mHasNotBeenSet) { - throw new IllegalAccessError("The Enum '" + this.name() + "' has not been set to an Item at this time!"); - } - for (final Object tOreName : aOreNames) { - GT_OreDictUnificator.registerOre(tOreName, this.get(1)); - } - return this; - } - - @Override - public GregtechItemList registerWildcardAsOre(final Object... aOreNames) { - if (this.mHasNotBeenSet) { - throw new IllegalAccessError("The Enum '" + this.name() + "' has not been set to an Item at this time!"); - } - for (final Object tOreName : aOreNames) { - GT_OreDictUnificator.registerOre(tOreName, this.getWildcard(1)); - } - return this; - } -} diff --git a/gtpp/src/main/java/gtPlusPlus/xmod/gregtech/api/enums/GregtechOreDictNames.java b/gtpp/src/main/java/gtPlusPlus/xmod/gregtech/api/enums/GregtechOreDictNames.java deleted file mode 100644 index 4bd8831098..0000000000 --- a/gtpp/src/main/java/gtPlusPlus/xmod/gregtech/api/enums/GregtechOreDictNames.java +++ /dev/null @@ -1,39 +0,0 @@ -package gtPlusPlus.xmod.gregtech.api.enums; - -/* - * Electric Components. usual Materials for this are: Primitive (Tier 1) Basic (Tier 2) as used by UE as well : IC2 - * Circuit and RE-Battery Good (Tier 3) Advanced (Tier 4) as used by UE as well : Advanced Circuit, Advanced Battery and - * Lithium Battery Data (Tier 5) : Data Storage Circuit Elite (Tier 6) as used by UE as well : Energy Crystal and Data - * Control Circuit Master (Tier 7) : Energy Flow Circuit and Lapotron Crystal Ultimate (Tier 8) : Data Orb and - * Lapotronic Energy Orb Infinite (Cheaty) Circuits Circuit_Primitive, Circuit_Basic, Circuit_Good, Circuit_Advanced, - * Circuit_Data, Circuit_Elite, Circuit_Master, Tool_DataOrb, Circuit_Ultimate, Tool_DataStick, Circuit_IV, Circuit_LuV, - * Circuit_ZPM, Circuit Parts Circuit_Board_IV, Circuit_Board_LuV, Circuit_Board_ZPM, Circuit_Parts_Crystal_Chip_IV, - * Circuit_Parts_Crystal_Chip_LuV, Circuit_Parts_Crystal_Chip_ZPM, Circuit_Parts_IV, Circuit_Parts_LuV, - * Circuit_Parts_ZPM, Circuit_Parts_Wiring_IV, Circuit_Parts_Wiring_LuV, Circuit_Parts_Wiring_ZPM; - */ -public enum GregtechOreDictNames { - - buffer_core, - itemGregConduit, - Circuit_IV, - Circuit_LuV, - Circuit_ZPM, - Circuit_Board_IV, - Circuit_Board_LuV, - Circuit_Board_ZPM, - Circuit_Parts_Crystal_Chip_IV, - Circuit_Parts_Crystal_Chip_LuV, - Circuit_Parts_Crystal_Chip_ZPM, - Circuit_Parts_IV, - Circuit_Parts_LuV, - Circuit_Parts_ZPM, - Circuit_Parts_Wiring_IV, - Circuit_Parts_Wiring_LuV, - Circuit_Parts_Wiring_ZPM; - - public String unlocalisedName; - - private void ModObject() { - this.unlocalisedName = this.name(); - } -} diff --git a/gtpp/src/main/java/gtPlusPlus/xmod/gregtech/api/enums/GregtechOrePrefixes.java b/gtpp/src/main/java/gtPlusPlus/xmod/gregtech/api/enums/GregtechOrePrefixes.java deleted file mode 100644 index 3185810495..0000000000 --- a/gtpp/src/main/java/gtPlusPlus/xmod/gregtech/api/enums/GregtechOrePrefixes.java +++ /dev/null @@ -1,1324 +0,0 @@ -package gtPlusPlus.xmod.gregtech.api.enums; - -import static gregtech.api.enums.GT_Values.B; -import static gregtech.api.enums.GT_Values.D2; -import static gregtech.api.enums.GT_Values.M; -import static gtPlusPlus.core.util.Utils.getTcAspectStack; - -import java.util.ArrayList; -import java.util.Arrays; -import java.util.Collection; -import java.util.HashSet; -import java.util.List; - -import net.minecraft.enchantment.Enchantment; -import net.minecraft.item.ItemStack; -import net.minecraftforge.fluids.Fluid; -import net.minecraftforge.fluids.FluidStack; - -import gregtech.api.enums.ConfigCategories; -import gregtech.api.enums.Dyes; -import gregtech.api.enums.Element; -import gregtech.api.enums.Materials; -import gregtech.api.enums.SubTag; -import gregtech.api.enums.TC_Aspects; -import gregtech.api.enums.TC_Aspects.TC_AspectStack; -import gregtech.api.enums.TextureSet; -import gregtech.api.interfaces.IColorModulationContainer; -import gregtech.api.interfaces.ICondition; -import gregtech.api.interfaces.ISubTagContainer; -import gregtech.api.objects.MaterialStack; -import gregtech.api.util.GT_Config; -import gregtech.api.util.GT_Log; -import gregtech.api.util.GT_Utility; -import gtPlusPlus.core.lib.CORE; -import gtPlusPlus.xmod.gregtech.api.interfaces.internal.Interface_OreRecipeRegistrator; -import gtPlusPlus.xmod.gregtech.api.objects.GregtechItemData; -import gtPlusPlus.xmod.gregtech.api.objects.GregtechMaterialStack; - -public enum GregtechOrePrefixes { - - /* - * Electric Components. usual Materials for this are: Primitive (Tier 1) Basic (Tier 2) as used by UE as well : IC2 - * Circuit and RE-Battery Good (Tier 3) Advanced (Tier 4) as used by UE as well : Advanced Circuit, Advanced Battery - * and Lithium Battery Data (Tier 5) : Data Storage Circuit Elite (Tier 6) as used by UE as well : Energy Crystal - * and Data Control Circuit Master (Tier 7) : Energy Flow Circuit and Lapotron Crystal Ultimate (Tier 8) : Data Orb - * and Lapotronic Energy Orb Infinite (Cheaty) - */ - ingotHot("Hot Ingots", "Hot ", " Ingot", true, true, false, false, false, false, false, true, false, false, B[1], - M * 1, 16, 12), // A hot Ingot, which has to be cooled down by a Vacuum Freezer. - ingot("Ingots", "", " Ingot", true, true, false, false, false, false, false, true, false, false, B[1], M * 1, 64, - 11), // A regular Ingot. Introduced by Eloraam - dustTiny("Tiny Dusts", "Tiny Pile of ", " Dust", true, true, false, false, false, false, false, true, false, false, - B[0] | B[1] | B[2] | B[3], M / 9, 64, 0), // 1/9th of a Dust. - dustSmall("Small Dusts", "Small Pile of ", " Dust", true, true, false, false, false, false, false, true, false, - false, B[0] | B[1] | B[2] | B[3], M / 4, 64, 1), // 1/4th of a Dust. - dustImpure("Impure Dusts", "Impure Pile of ", " Dust", true, true, false, false, false, false, false, true, false, - true, B[3], M * 1, 64, 3), // Dust with impurities. 1 Unit of Main Material and 1/9 - 1/4 Unit of secondary - // Material - dustRefined("Refined Dusts", "Refined Pile of ", " Dust", true, true, false, false, false, false, false, true, - false, true, B[3], M * 1, 64, 2), - dustPure("Purified Dusts", "Purified Pile of ", " Dust", true, true, false, false, false, false, false, true, false, - true, B[3], M * 1, 64, 4), - dust("Dusts", "", " Dust", true, true, false, false, false, false, false, true, false, false, - B[0] | B[1] | B[2] | B[3], M * 1, 64, 2), // Pure Dust worth of one Ingot or Gem. Introduced by Alblaka. - nugget("Nuggets", "", " Nugget", true, true, false, false, false, false, false, true, false, false, B[1], M / 9, 64, - 9), // A Nugget. Introduced by Eloraam - plate("Plates", "", " Plate", true, true, false, false, false, false, true, true, false, false, B[1] | B[2], M * 1, - 64, 17), // Regular Plate made of one Ingot/Dust. Introduced by Calclavia - block("Storage Blocks", "Block of ", "", true, true, false, false, false, true, true, false, false, false, 0, M * 9, - 64, 71), // Storage Block consisting out of 9 Ingots/Gems/Dusts. Introduced by CovertJaguar - gem("Gemstones", "", "", true, true, true, false, false, false, true, true, false, false, B[2], M * 1, 64, 8), // A - // regular - // Gem - // worth - // one - // Dust. - // Introduced - // by - // Eloraam - gemChipped("Chipped Gemstones", "Chipped ", "", true, true, true, false, false, false, true, true, false, false, - B[2], M / 4, 64, 59), // A regular Gem worth one small Dust. Introduced by TerraFirmaCraft - gemFlawed("Flawed Gemstones", "Flawed ", "", true, true, true, false, false, false, true, true, false, false, B[2], - M / 2, 64, 60), // A regular Gem worth two small Dusts. Introduced by TerraFirmaCraft - gemFlawless("Flawless Gemstones", "Flawless ", "", true, true, true, false, false, false, true, true, false, false, - B[2], M * 2, 32, 61), // A regular Gem worth two Dusts. Introduced by TerraFirmaCraft - gemExquisite("Exquisite Gemstones", "Exquisite ", "", true, true, true, false, false, false, true, true, false, - false, B[2], M * 4, 16, 62), // A regular Gem worth four Dusts. Introduced by TerraFirmaCraft - stick("Sticks/Rods", "", " Rod", true, true, false, false, false, false, true, true, false, false, B[1] | B[2], - M / 2, 64, 23), // Stick made of half an Ingot. Introduced by Eloraam - type2("16x Wires", "16x ", " Wire", true, true, false, false, false, false, true, false, false, false, 0, M * 8, 64, - -1), - - toolAngleGrinder("Angle Grinder", "", "Angle Grinder", true, true, false, false, false, false, true, true, false, - false, B[6], M * 6, 16, 37), // consisting out of 6 Ingots. - toolElectricSnips("Electric Snips", "", "Electric Snips", true, true, false, false, false, false, true, true, false, - false, B[6], M * 6, 16, 37), // consisting out of 6 Ingots. - toolElectricLighter("Electric Lighter", "", "Electric Lighter", true, true, false, false, false, false, true, true, - false, false, B[6], M * 6, 16, 37), // consisting out of 6 Ingots. - toolElectricButcherKnife("Electric Butcher Knife", "", "Electric Butcher Knife", true, true, false, false, false, - false, true, true, false, false, B[6], M * 6, 16, 37), // consisting out of 6 Ingots. - - batterySingleuse("Single Use Batteries", "", "", false, true, false, false, false, false, false, false, false, - false, 0, -1, 64, -1), - battery("Reusable Batteries", "", "", false, true, false, false, false, false, false, false, false, false, 0, -1, - 64, -1), // Introduced by Calclavia - circuit("Circuits", "", "", true, true, false, false, false, false, false, false, false, false, 0, -1, 64, -1), // Introduced - // by - // Calclavia - chipset("Chipsets", "", "", true, true, false, false, false, false, false, false, false, false, 0, -1, 64, -1), // Introduced - ; - - public static final int VERSION = 508; - - static { - ingotHot.mHeatDamage = 3.0F; - } - - public final ArrayList<ItemStack> mPrefixedItems = new ArrayList<>(); - public final short mTextureIndex; - public final String mRegularLocalName, mLocalizedMaterialPre, mLocalizedMaterialPost; - public final boolean mIsUsedForOreProcessing, mIsEnchantable, mIsUnificatable, mIsMaterialBased, mIsSelfReferencing, - mIsContainer, mDontUnificateActively, mIsUsedForBlocks, mAllowNormalRecycling, mGenerateDefaultItem; - public final List<TC_AspectStack> mAspects = new ArrayList<>(); - public final Collection<GregtechOrePrefixes> mFamiliarPrefixes = new HashSet<>(); - /** - * Used to determine the amount of Material this Prefix contains. Multiply or Divide GregTech_API.MATERIAL_UNIT to - * get the Amounts in comparision to one Ingot. 0 = Null Negative = Undefined Amount - */ - public final long mMaterialAmount; - - private final Collection<Materials> mNotGeneratedItems = new HashSet<>(), mIgnoredMaterials = new HashSet<>(), - mGeneratedItems = new HashSet<>(); - private final ArrayList<Interface_OreRecipeRegistrator> mOreProcessing = new ArrayList<>(); - private final ArrayList<Interface_OreRecipeRegistrator> mOreProcessingFake = new ArrayList<>(); - public final ItemStack mContainerItem = null; - public final ICondition<ISubTagContainer> mCondition = null; - public byte mDefaultStackSize = 64; - public final GregtechMaterialStack mSecondaryMaterial = null; - public final GregtechOrePrefixes mPrefixInto = this; - public float mHeatDamage = 0.0F; // Negative for Frost Damage - /** - * Yes this Value can be changed to add Bits for the MetaGenerated-Item-Check. - */ - public int mMaterialGenerationBits = 0; - - private GregtechOrePrefixes(final String aRegularLocalName, final String aLocalizedMaterialPre, - final String aLocalizedMaterialPost, final boolean aIsUnificatable, final boolean aIsMaterialBased, - final boolean aIsSelfReferencing, final boolean aIsContainer, final boolean aDontUnificateActively, - final boolean aIsUsedForBlocks, final boolean aAllowNormalRecycling, final boolean aGenerateDefaultItem, - final boolean aIsEnchantable, final boolean aIsUsedForOreProcessing, final int aMaterialGenerationBits, - final long aMaterialAmount, final int aDefaultStackSize, final int aTextureindex) { - this.mIsUnificatable = aIsUnificatable; - this.mIsMaterialBased = aIsMaterialBased; - this.mIsSelfReferencing = aIsSelfReferencing; - this.mIsContainer = aIsContainer; - this.mDontUnificateActively = aDontUnificateActively; - this.mIsUsedForBlocks = aIsUsedForBlocks; - this.mAllowNormalRecycling = aAllowNormalRecycling; - this.mGenerateDefaultItem = aGenerateDefaultItem; - this.mIsEnchantable = aIsEnchantable; - this.mIsUsedForOreProcessing = aIsUsedForOreProcessing; - this.mMaterialGenerationBits = aMaterialGenerationBits; - this.mMaterialAmount = aMaterialAmount; - this.mRegularLocalName = aRegularLocalName; - this.mLocalizedMaterialPre = aLocalizedMaterialPre; - this.mLocalizedMaterialPost = aLocalizedMaterialPost; - this.mDefaultStackSize = (byte) aDefaultStackSize; - this.mTextureIndex = (short) aTextureindex; - - // TODO - Utilise some form of way to check if it's gt 5.9 if so, use string switch. - if (this.name() - .startsWith("ore")) { - getTcAspectStack(TC_Aspects.TERRA.name(), 1).addToAspectList(this.mAspects); - } else if (this.name() - .startsWith("wire") - || this.name() - .startsWith("cable")) { - getTcAspectStack(TC_Aspects.ELECTRUM.name(), 1).addToAspectList(this.mAspects); - } else - if (this.name() - .startsWith("dust")) { - getTcAspectStack(TC_Aspects.PERDITIO.name(), 1).addToAspectList(this.mAspects); - } else if (this.name() - .startsWith("crushed")) { - getTcAspectStack(TC_Aspects.PERFODIO.name(), 1).addToAspectList(this.mAspects); - } else if (this.name() - .startsWith("ingot") - || this.name() - .startsWith("nugget")) { - getTcAspectStack(TC_Aspects.METALLUM.name(), 1).addToAspectList(this.mAspects); - } else - if (this.name() - .startsWith("armor")) { - getTcAspectStack(TC_Aspects.TUTAMEN.name(), 1).addToAspectList(this.mAspects); - } else if (this.name() - .startsWith("stone")) { - getTcAspectStack(TC_Aspects.TERRA.name(), 1).addToAspectList(this.mAspects); - } else if (this.name() - .startsWith("pipe")) { - getTcAspectStack(TC_Aspects.ITER.name(), 1).addToAspectList(this.mAspects); - } else if (this.name() - .startsWith("gear")) { - getTcAspectStack(TC_Aspects.MOTUS.name(), 1).addToAspectList(this.mAspects); - getTcAspectStack(TC_Aspects.MACHINA.name(), 1) - .addToAspectList(this.mAspects); - } else if (this.name() - .startsWith("frame") - || this.name() - .startsWith("plate")) { - getTcAspectStack(TC_Aspects.FABRICO.name(), 1) - .addToAspectList(this.mAspects); - } else - if (this.name() - .startsWith("tool")) { - getTcAspectStack(TC_Aspects.INSTRUMENTUM.name(), 2) - .addToAspectList(this.mAspects); - } else if (this.name() - .startsWith("gem") - || this.name() - .startsWith("crystal") - || this.name() - .startsWith("lens")) { - getTcAspectStack(TC_Aspects.VITREUS.name(), 1) - .addToAspectList(this.mAspects); - } else - if (this.name() - .startsWith("crate")) { - getTcAspectStack(TC_Aspects.ITER.name(), 2) - .addToAspectList(this.mAspects); - } else if (this.name() - .startsWith("circuit")) { - getTcAspectStack("COGNITIO", 1); - } else if (this.name() - .startsWith("battery")) { - getTcAspectStack(TC_Aspects.ELECTRUM.name(), 1) - .addToAspectList(this.mAspects); - } - } - - public static GregtechOrePrefixes getOrePrefix(final String aOre) { - for (final GregtechOrePrefixes tPrefix : values()) { - if (aOre.startsWith(tPrefix.toString())) { - return tPrefix; - } - } - return null; - } - - public static String stripPrefix(final String aOre) { - for (final GregtechOrePrefixes tPrefix : values()) { - if (aOre.startsWith(tPrefix.toString())) { - return aOre.replaceFirst(tPrefix.toString(), ""); - } - } - return aOre; - } - - public static String replacePrefix(final String aOre, final GregtechOrePrefixes aPrefix) { - for (final GregtechOrePrefixes tPrefix : values()) { - if (aOre.startsWith(tPrefix.toString())) { - return aOre.replaceFirst(tPrefix.toString(), aPrefix.toString()); - } - } - return ""; - } - - public static GregtechOrePrefixes getPrefix(final String aPrefixName) { - return getPrefix(aPrefixName, null); - } - - public static GregtechOrePrefixes getPrefix(final String aPrefixName, final GregtechOrePrefixes aReplacement) { - final Object tObject = GT_Utility.getFieldContent(GregtechOrePrefixes.class, aPrefixName, false, false); - if ((tObject != null) && (tObject instanceof GregtechOrePrefixes)) { - return (GregtechOrePrefixes) tObject; - } - return aReplacement; - } - - public static Materials getMaterial(final String aOre) { - return Materials.get(stripPrefix(aOre)); - } - - public static Materials getMaterial(final String aOre, final GregtechOrePrefixes aPrefix) { - return Materials.get(aOre.replaceFirst(aPrefix.toString(), "")); - } - - public static Materials getRealMaterial(final String aOre, final GregtechOrePrefixes aPrefix) { - return Materials.getRealMaterial(aOre.replaceFirst(aPrefix.toString(), "")); - } - - public static boolean isInstanceOf(final String aName, final GregtechOrePrefixes aPrefix) { - return aName == null ? false : aName.startsWith(aPrefix.toString()); - } - - public boolean add(final ItemStack aStack) { - if (aStack == null) { - return false; - } - if (!this.contains(aStack)) { - this.mPrefixedItems.add(aStack); - } - while (this.mPrefixedItems.contains(null)) { - this.mPrefixedItems.remove(null); - } - return true; - } - - public boolean contains(final ItemStack aStack) { - if (aStack == null) { - return false; - } - for (final ItemStack tStack : this.mPrefixedItems) { - if (GT_Utility.areStacksEqual(aStack, tStack, !tStack.hasTagCompound())) { - return true; - } - } - return false; - } - - public boolean doGenerateItem(final Materials aMaterial) { - return (aMaterial != null) && (aMaterial != Materials._NULL) - && (((aMaterial.mTypes & this.mMaterialGenerationBits) != 0) || this.mGeneratedItems.contains(aMaterial)) - && !this.mNotGeneratedItems.contains(aMaterial) - && ((this.mCondition == null) || this.mCondition.isTrue(aMaterial)); - } - - public boolean ignoreMaterials(final Materials... aMaterials) { - for (final Materials tMaterial : aMaterials) { - if (tMaterial != null) { - this.mIgnoredMaterials.add(tMaterial); - } - } - return true; - } - - public boolean addFamiliarPrefix(final GregtechOrePrefixes aPrefix) { - if ((aPrefix == null) || this.mFamiliarPrefixes.contains(aPrefix) || (aPrefix == this)) { - return false; - } - return this.mFamiliarPrefixes.add(aPrefix); - } - - public boolean add(final Interface_OreRecipeRegistrator aRegistrator) { - if (aRegistrator == null) { - return false; - } - return this.mOreProcessing.add(aRegistrator); - } - - public void processOre(final GT_Materials aMaterial, final String aOreDictName, final String aModName, - final ItemStack aStack) { - if ((aMaterial != null) - && ((aMaterial != GT_Materials._NULL) || this.mIsSelfReferencing || !this.mIsMaterialBased) - && GT_Utility.isStackValid(aStack)) { - for (final Interface_OreRecipeRegistrator tRegistrator : this.mOreProcessing) { - if (D2) { - GT_Log.ore.println( - "Processing '" + aOreDictName - + "' with the Prefix '" - + this.name() - + "' and the Material '" - + aMaterial.name() - + "' at " - + GT_Utility.getClassName(tRegistrator)); - } - tRegistrator.registerOre(this, aMaterial, aOreDictName, aModName, GT_Utility.copyAmount(1, aStack)); - } - } - } - - // TODO - public void processOre(final Materials aMaterial, final String aOreDictName, final String aModName, - final ItemStack aStack) { - if ((aMaterial != null) && ((aMaterial != Materials._NULL) || this.mIsSelfReferencing || !this.mIsMaterialBased) - && GT_Utility.isStackValid(aStack)) { - for (final Interface_OreRecipeRegistrator tRegistrator : this.mOreProcessingFake) { - if (D2) { - GT_Log.ore.println( - "Processing '" + aOreDictName - + "' with the Prefix '" - + this.name() - + "' and the Material '" - + aMaterial.mName - + "' at " - + GT_Utility.getClassName(tRegistrator)); - } - tRegistrator.registerOre(this, aMaterial, aOreDictName, aModName, GT_Utility.copyAmount(1, aStack)); - } - } - } - - public Object get(final Object aMaterial) { - if (aMaterial instanceof GT_Materials) { - return new GregtechItemData(this, (GT_Materials) aMaterial); - } - return this.name() + aMaterial; - } - - public String getDefaultLocalNameForItem(final Materials aMaterial) { - - // Use Standard Localization - return this.mLocalizedMaterialPre + aMaterial.mDefaultLocalName + this.mLocalizedMaterialPost; - } - - public enum GT_Materials implements IColorModulationContainer, ISubTagContainer { - - /** - * This is the Default Material returned in case no Material has been found or a NullPointer has been inserted - * at a location where it shouldn't happen. - * <p/> - * Mainly for preventing NullPointer Exceptions and providing Default Values. - * - * Unknown Material Components. Dead End Section. - * - * Alkalus Range 730-799 & 970-998 (aMetaItemSubID, TextureSet, aToolSpeed, aToolDurability, aToolQuality, - * aTypes, R, G, B, Alpha, aLocalName, aFuelType, aFuelPower, aMeltingPoint, aBlastFurnaceTemp, - * aBlastFurnaceRequired, aTransparent, aOreValue, aDensityMultiplier, aDensityDivider, aColor - * this(aMetaItemSubID, aIconSet, aToolSpeed, aToolDurability, aToolQuality, true); - * - */ - _NULL(-1, TextureSet.SET_NONE, 1.0F, 0, 0, 0, 255, 255, 255, 0, "NULL", 0, 0, 0, 0, false, false, 1, 1, 1, - Dyes._NULL, Element._NULL, Arrays.asList(getTcAspectStack(TC_Aspects.VACUOS.name(), 1))), - - // Lapis(526, TextureSet.SET_LAPIS, 1.0F, 0, 1, 1 | 4 | 8, 70, 70, 220, 0, "Lapis", 0, 0, -1, 0, false, false, - // 3, 1, 1, Dyes.dyeBlue, 2, Arrays.asList(new MaterialStack(Materials.Lazurite, 12), new - // MaterialStack(Materials.Sodalite, 2), new MaterialStack(Materials.Pyrite, 1), new - // MaterialStack(Materials.Calcite, 1)), Arrays.asList(getTcAspectStack(TC_Aspects.SENSUS, 1))), - Pyrotheum(20, TextureSet.SET_FLUID, 1.0F, 0, 1, 2 | 16 | 32, 255, 128, 0, 0, "Pyrotheum", 0, 0, -1, 0, false, - false, 2, 3, 1, Dyes.dyeYellow, 2, - Arrays.asList( - new MaterialStack(Materials.Coal, 1), - new MaterialStack(Materials.Redstone, 1), - new MaterialStack(Materials.Blaze, 1), - new MaterialStack(Materials.Sulfur, 1)), - Arrays.asList(getTcAspectStack("PRAECANTATIO", 2), getTcAspectStack(TC_Aspects.IGNIS, 1))), - Cryotheum(21, TextureSet.SET_FLUID, 1.0F, 0, 1, 2 | 16 | 32, 102, 178, 255, 0, "Cryotheum", 0, 0, -1, 0, false, - false, 2, 3, 1, Dyes.dyeLightBlue, 2, - Arrays.asList( - new MaterialStack(Materials.Blizz, 1), - new MaterialStack(Materials.Redstone, 1), - new MaterialStack(Materials.Snow, 1), - new MaterialStack(Materials.Niter, 1)), - Arrays.asList(getTcAspectStack("PRAECANTATIO", 2), getTcAspectStack(TC_Aspects.GELUM, 1))), - Ender(22, TextureSet.SET_FLUID, 1.0F, 0, 2, 1, 255, 255, 255, 0, "Ender", 0, 0, -1, 0, false, false, 3, 1, 1, - Dyes.dyeGreen), - - /** - * Circuitry, Batteries and other Technical things - */ - Symbiotic(-1, TextureSet.SET_NONE, 1.0F, 0, 0, 0, 255, 255, 255, 0, "IV Tier", 0, 0, -1, 0, false, false, 1, 1, - 1, Dyes.dyeLightGray, - Arrays.asList(getTcAspectStack(TC_Aspects.ELECTRUM, 4), getTcAspectStack(TC_Aspects.MACHINA, 4))), - Neutronic(-1, TextureSet.SET_NONE, 1.0F, 0, 0, 0, 255, 255, 255, 0, "LuV Tier", 0, 0, -1, 0, false, false, 1, 1, - 1, Dyes.dyeLightGray, - Arrays.asList(getTcAspectStack(TC_Aspects.ELECTRUM, 6), getTcAspectStack(TC_Aspects.MACHINA, 6))), - Quantum(-1, TextureSet.SET_NONE, 1.0F, 0, 0, 0, 255, 255, 255, 0, "ZPM Tier", 0, 0, -1, 0, false, false, 1, 1, - 1, Dyes.dyeLightGray, - Arrays.asList(getTcAspectStack(TC_Aspects.ELECTRUM, 8), getTcAspectStack(TC_Aspects.MACHINA, 8))), - - Superconductor(-1, TextureSet.SET_NONE, 1.0F, 0, 0, 0, 190, 240, 190, 0, "Superconductor", 0, 0, -1, 0, false, - false, 1, 1, 1, Dyes.dyeGreen, Arrays.asList(getTcAspectStack(TC_Aspects.ELECTRUM, 8))), - - Staballoy(30, TextureSet.SET_ROUGH, 10.0F, 5120, 4, 1 | 2 | 16 | 32 | 64 | 128, 68, 75, 66, 0, "Staballoy", 0, - 0, 1500, 2800, true, false, 1, 3, 1, Dyes.dyeGreen, 2, - Arrays.asList(new MaterialStack(Materials.Titanium, 1), new MaterialStack(Materials.Uranium, 9)), - Arrays.asList(getTcAspectStack(TC_Aspects.METALLUM, 8), getTcAspectStack(TC_Aspects.STRONTIO, 3))), - Bedrockium(31, TextureSet.SET_FINE, 8.0F, 8196, 3, 1 | 2 | 16 | 32 | 64 | 128, 39, 39, 39, 0, "Bedrockium", 0, - 0, -1, 0, false, false, 1, 5, 1, Dyes.dyeLightGray, 2, - Arrays.asList(new MaterialStack(Materials.Carbon, 63), new MaterialStack(Materials.Carbon, 56)), - Arrays.asList(getTcAspectStack(TC_Aspects.VACUOS, 8), getTcAspectStack(TC_Aspects.TUTAMEN, 3))), - BloodSteel(32, TextureSet.SET_METALLIC, 11.0F, 768, 4, 1 | 2 | 16 | 32 | 64 | 128, 142, 28, 0, 0, "Blood Steel", - 0, 0, -1, 0, false, false, 1, 1, 1, Dyes.dyeRed, 2, Arrays.asList(new MaterialStack(Materials.Steel, 3)), - Arrays.asList(getTcAspectStack(TC_Aspects.VICTUS, 8), getTcAspectStack(TC_Aspects.IGNIS, 3))), - Void(33, TextureSet.SET_METALLIC, 6.0F, 1280, 3, 1 | 2 | 16 | 32 | 64 | 128, 82, 17, 82, 0, "Void Metal", 0, 0, - -1, 0, false, false, 3, 1, 1, Dyes.dyeBlack, - Arrays.asList(getTcAspectStack("PRAECANTATIO", 5), getTcAspectStack(TC_Aspects.VACUOS, 7))), - ConductiveIron(34, TextureSet.SET_METALLIC, 5.0F, 256, 2, 1 | 2, 164, 109, 100, 0, "Conductive Iron", 0, 0, -1, - 0, false, false, 3, 1, 1, Dyes.dyeRed, 2, - Arrays.asList(new MaterialStack(Materials.Iron, 6), new MaterialStack(Materials.Redstone, 2)), - Arrays.asList(getTcAspectStack(TC_Aspects.POTENTIA, 2), getTcAspectStack(TC_Aspects.METALLUM, 2))), - ElectricalSteel(35, TextureSet.SET_METALLIC, 7.0F, 768, 3, 1 | 2 | 64 | 128, 194, 194, 194, 0, - "Electrical Steel", 0, 0, 1811, 1000, true, false, 3, 1, 1, Dyes.dyeLightGray, 2, - Arrays.asList( - new MaterialStack(Materials.Iron, 3), - new MaterialStack(Materials.Coal, 2), - new MaterialStack(Materials.Silicon, 2)), - Arrays.asList(getTcAspectStack(TC_Aspects.MAGNETO, 2), getTcAspectStack(TC_Aspects.ELECTRUM, 5))), - EnergeticAlloy(36, TextureSet.SET_SHINY, 5.0F, 512, 3, 1 | 2 | 64 | 128, 252, 152, 45, 0, "Energetic Alloy", 0, - 0, -1, 0, false, false, 3, 1, 1, Dyes.dyeOrange, 2, - Arrays.asList( - new MaterialStack(Materials.Gold, 3), - new MaterialStack(Materials.Glowstone, 2), - new MaterialStack(Materials.Redstone, 2)), - Arrays.asList(getTcAspectStack(TC_Aspects.POTENTIA, 4), getTcAspectStack(TC_Aspects.LUX, 3))), - VibrantAlloy(37, TextureSet.SET_SHINY, 7.0F, 1280, 4, 1 | 2 | 64 | 128, 204, 242, 142, 0, "Vibrant Alloy", 0, 0, - -1, 0, false, false, 3, 1, 1, Dyes.dyeLime, 2, - Arrays.asList(new MaterialStack(Materials.EnergeticAlloy, 1), new MaterialStack(Materials.EnderPearl, 3)), - Arrays.asList(getTcAspectStack(TC_Aspects.MACHINA, 5), getTcAspectStack(TC_Aspects.TELUM, 4))), - PulsatingIron(38, TextureSet.SET_SHINY, 5.0F, 256, 2, 1 | 2 | 64 | 128, 50, 91, 21, 0, "Pulsating Iron", 0, 0, - -1, 0, false, false, 3, 1, 1, Dyes.dyeGreen, 2, - Arrays.asList(new MaterialStack(Materials.Iron, 2), new MaterialStack(Materials.EnderPearl, 2)), - Arrays.asList(getTcAspectStack(TC_Aspects.ALIENIS, 3), getTcAspectStack(TC_Aspects.METALLUM, 3))), - /* TODO */ RedstoneAlloy(39, TextureSet.SET_METALLIC, 1.0F, 256, 2, 1 | 2 | 16 | 32 | 64, 178, 34, 34, 0, - "Redstone Alloy", 0, 0, -1, 0, false, false, 3, 1, 1, Dyes.dyeRed, 2, - Arrays.asList(new MaterialStack(Materials.Iron, 2), new MaterialStack(Materials.Redstone, 4))), - - // Needs more Use, I think. - Tantalloy60(40, TextureSet.SET_DULL, 8.0F, 5120, 3, 1 | 2 | 16 | 32 | 64 | 128, 68, 75, 166, 0, "Tantalloy-60", - 0, 0, 3035, 2200, true, false, 1, 2, 1, Dyes.dyeLightBlue, 2, - Arrays.asList(new MaterialStack(Materials.Tungsten, 1), new MaterialStack(Materials.Tantalum, 9)), - Arrays.asList(getTcAspectStack(TC_Aspects.METALLUM, 8), getTcAspectStack(TC_Aspects.STRONTIO, 3))), - Tantalloy61(41, TextureSet.SET_DULL, 7.0F, 5120, 2, 1 | 2 | 16 | 32 | 64 | 128, 122, 135, 196, 0, - "Tantalloy-61", 0, 0, 3015, 2150, true, false, 1, 2, 1, Dyes.dyeLightBlue, 2, - Arrays.asList( - new MaterialStack(Materials.Tungsten, 1), - new MaterialStack(Materials.Tantalum, 9), - new MaterialStack(Materials.Titanium, 1)), - Arrays.asList(getTcAspectStack(TC_Aspects.METALLUM, 8), getTcAspectStack(TC_Aspects.STRONTIO, 3))), - - Potin(42, TextureSet.SET_METALLIC, 7.0F, 5120, 2, 1 | 2 | 16 | 32 | 64 | 128, 201, 151, 129, 0, "Potin", 0, 0, - 3015, 2150, true, false, 1, 2, 1, Dyes.dyeLightBlue, 2, - Arrays.asList( - new MaterialStack(Materials.Tungsten, 1), - new MaterialStack(Materials.Tantalum, 9), - new MaterialStack(Materials.Titanium, 1)), - Arrays.asList(getTcAspectStack(TC_Aspects.METALLUM, 8), getTcAspectStack(TC_Aspects.STRONTIO, 3))), - Inconel792(43, TextureSet.SET_METALLIC, 7.0F, 5120, 2, 1 | 2 | 16 | 32 | 64 | 128, 108, 240, 118, 0, - "Inconel-792", 0, 0, 3015, 2150, true, false, 1, 2, 1, Dyes.dyeLightBlue, 2, - Arrays.asList( - new MaterialStack(Materials.Tungsten, 1), - new MaterialStack(Materials.Tantalum, 9), - new MaterialStack(Materials.Titanium, 1)), - Arrays.asList(getTcAspectStack(TC_Aspects.METALLUM, 8), getTcAspectStack(TC_Aspects.STRONTIO, 3))), - Inconel690(44, TextureSet.SET_DULL, 7.0F, 5120, 2, 1 | 2 | 16 | 32 | 64 | 128, 118, 220, 138, 0, "Inconel-690", - 0, 0, 3015, 2150, true, false, 1, 2, 1, Dyes.dyeLightBlue, 2, - Arrays.asList( - new MaterialStack(Materials.Tungsten, 1), - new MaterialStack(Materials.Tantalum, 9), - new MaterialStack(Materials.Titanium, 1)), - Arrays.asList(getTcAspectStack(TC_Aspects.METALLUM, 8), getTcAspectStack(TC_Aspects.STRONTIO, 3))), - MaragingSteel300(45, TextureSet.SET_METALLIC, 7.0F, 5120, 2, 1 | 2 | 16 | 32 | 64 | 128, 150, 150, 150, 0, - "Maraging Steel 300", 0, 0, 3015, 2150, true, false, 1, 2, 1, Dyes.dyeLightBlue, 2, - Arrays.asList( - new MaterialStack(Materials.Tungsten, 1), - new MaterialStack(Materials.Tantalum, 9), - new MaterialStack(Materials.Titanium, 1)), - Arrays.asList(getTcAspectStack(TC_Aspects.METALLUM, 8), getTcAspectStack(TC_Aspects.STRONTIO, 3))), - MaragingSteel350(46, TextureSet.SET_METALLIC, 7.0F, 5120, 2, 1 | 2 | 16 | 32 | 64 | 128, 160, 160, 160, 0, - "Maraging Steel 350", 0, 0, 3015, 2150, true, false, 1, 2, 1, Dyes.dyeLightBlue, 2, - Arrays.asList( - new MaterialStack(Materials.Tungsten, 1), - new MaterialStack(Materials.Tantalum, 9), - new MaterialStack(Materials.Titanium, 1)), - Arrays.asList(getTcAspectStack(TC_Aspects.METALLUM, 8), getTcAspectStack(TC_Aspects.STRONTIO, 3))), - HastelloyX(47, TextureSet.SET_SHINY, 7.0F, 5120, 2, 1 | 2 | 16 | 32 | 64 | 128, 255, 193, 37, 0, "Hastelloy-X", - 0, 0, 3015, 2150, true, false, 1, 2, 1, Dyes.dyeLightBlue, 2, - Arrays.asList( - new MaterialStack(Materials.Tungsten, 1), - new MaterialStack(Materials.Tantalum, 9), - new MaterialStack(Materials.Titanium, 1)), - Arrays.asList(getTcAspectStack(TC_Aspects.METALLUM, 8), getTcAspectStack(TC_Aspects.STRONTIO, 3))), - - TriniumNaquadahCarbonite(48, TextureSet.SET_SHINY, 7.0F, 5120, 2, 1 | 2 | 16 | 32 | 64 | 128, 255, 233, 0, 0, - "Trinium Naquadah Carbonite", 0, 0, 3015, 2150, true, false, 1, 2, 1, Dyes.dyeLightBlue, 2, - Arrays.asList( - new MaterialStack(Materials.Tungsten, 1), - new MaterialStack(Materials.Tantalum, 9), - new MaterialStack(Materials.Titanium, 1)), - Arrays.asList(getTcAspectStack(TC_Aspects.METALLUM, 8), getTcAspectStack(TC_Aspects.STRONTIO, 3))), - - // Radioactive Materials - HydrofluoricAcid(-1, TextureSet.SET_FLUID, 1.0F, 0, 1, 2 | 16 | 32, 200, 200, 200, 0, "Hydrofluoric Acid", 0, 0, - -1, 0, false, false, 2, 3, 1, Dyes.dyeWhite, 2, - Arrays.asList( - new MaterialStack(Materials.Coal, 1), - new MaterialStack(Materials.Redstone, 1), - new MaterialStack(Materials.Blaze, 1), - new MaterialStack(Materials.Sulfur, 1))), - UraniumHexaFluoride(-1, TextureSet.SET_FLUID, 1.0F, 0, 1, 2 | 16 | 32, 73, 220, 83, 0, "Uranium Hexafluoride", - 0, 0, -1, 0, false, false, 2, 3, 1, Dyes.dyeLime, 2, - Arrays.asList( - new MaterialStack(Materials.Coal, 1), - new MaterialStack(Materials.Redstone, 1), - new MaterialStack(Materials.Blaze, 1), - new MaterialStack(Materials.Sulfur, 1))), - UraniumTetraFluoride(-1, TextureSet.SET_FLUID, 1.0F, 0, 1, 2 | 16 | 32, 73, 220, 83, 0, "Uranium Tetrafluoride", - 0, 0, -1, 0, false, false, 2, 3, 1, Dyes.dyeLime, 2, - Arrays.asList( - new MaterialStack(Materials.Coal, 1), - new MaterialStack(Materials.Redstone, 1), - new MaterialStack(Materials.Blaze, 1), - new MaterialStack(Materials.Sulfur, 1))), - ThoriumTetraFluoride(-1, TextureSet.SET_FLUID, 1.0F, 0, 1, 2 | 16 | 32, 15, 120, 15, 0, "Thorium Tetrafluoride", - 0, 0, -1, 0, false, false, 2, 3, 1, Dyes.dyeGreen, 2, - Arrays.asList( - new MaterialStack(Materials.Coal, 1), - new MaterialStack(Materials.Redstone, 1), - new MaterialStack(Materials.Blaze, 1), - new MaterialStack(Materials.Sulfur, 1))), - - SulfurousAcid(-1, TextureSet.SET_FLUID, 1.0F, 0, 1, 2 | 16 | 32, 110, 220, 30, 0, "Sulfurous Acid", 0, 0, -1, 0, - false, false, 2, 3, 1, Dyes.dyeWhite, 2, - Arrays.asList( - new MaterialStack(Materials.Coal, 1), - new MaterialStack(Materials.Redstone, 1), - new MaterialStack(Materials.Blaze, 1), - new MaterialStack(Materials.Sulfur, 1))), - SulfurDioxide(-1, TextureSet.SET_FLUID, 1.0F, 0, 1, 2 | 16 | 32, 150, 200, 50, 0, "Sulfur Dioxide", 0, 0, -1, 0, - false, false, 2, 3, 1, Dyes.dyeWhite, 2, - Arrays.asList( - new MaterialStack(Materials.Coal, 1), - new MaterialStack(Materials.Redstone, 1), - new MaterialStack(Materials.Blaze, 1), - new MaterialStack(Materials.Sulfur, 1))), - HydrogenChloride(-1, TextureSet.SET_FLUID, 1.0F, 0, 1, 2 | 16 | 32, 150, 240, 90, 0, "Hydrogen Chloride", 0, 0, - -1, 0, false, false, 2, 3, 1, Dyes.dyeWhite, 2, - Arrays.asList( - new MaterialStack(Materials.Coal, 1), - new MaterialStack(Materials.Redstone, 1), - new MaterialStack(Materials.Blaze, 1), - new MaterialStack(Materials.Sulfur, 1))), - SulfuricApatite(-1, TextureSet.SET_FLUID, 1.0F, 0, 1, 2 | 16 | 32, 0, 105, 105, 0, "Sulfuric Apatite Solution", - 0, 0, -1, 0, false, false, 2, 3, 1, Dyes.dyeWhite, 2, - Arrays.asList( - new MaterialStack(Materials.Coal, 1), - new MaterialStack(Materials.Redstone, 1), - new MaterialStack(Materials.Blaze, 1), - new MaterialStack(Materials.Sulfur, 1))), - - SulfuricLithium(-1, TextureSet.SET_FLUID, 1.0F, 0, 1, 2 | 16 | 32, 0, 105, 105, 0, "Sulfuric Lithium Solution", - 0, 0, -1, 0, false, false, 2, 3, 1, Dyes.dyeWhite, 2, - Arrays.asList( - new MaterialStack(Materials.Coal, 1), - new MaterialStack(Materials.Redstone, 1), - new MaterialStack(Materials.Blaze, 1), - new MaterialStack(Materials.Sulfur, 1))), - LithiumHydroxide(-1, TextureSet.SET_FLUID, 1.0F, 0, 1, 2 | 16 | 32, 0, 105, 105, 0, "Lithium Hydroxide", 0, 0, - -1, 0, false, false, 2, 3, 1, Dyes.dyeWhite, 2, - Arrays.asList( - new MaterialStack(Materials.Coal, 1), - new MaterialStack(Materials.Redstone, 1), - new MaterialStack(Materials.Blaze, 1), - new MaterialStack(Materials.Sulfur, 1))),; - - /** - * List of all Materials. - */ - public static final Collection<GT_Materials> VALUES = new HashSet<>(Arrays.asList(values())); - - static { - /* - * Primitive.add(SubTag.NO_SMASHING, SubTag.NO_SMELTING); Basic.add(SubTag.NO_SMASHING, SubTag.NO_SMELTING); - * Good.add(SubTag.NO_SMASHING, SubTag.NO_SMELTING); Advanced.add(SubTag.NO_SMASHING, SubTag.NO_SMELTING); - * Data.add(SubTag.NO_SMASHING, SubTag.NO_SMELTING); Elite.add(SubTag.NO_SMASHING, SubTag.NO_SMELTING); - * Master.add(SubTag.NO_SMASHING, SubTag.NO_SMELTING); Ultimate.add(SubTag.NO_SMASHING, SubTag.NO_SMELTING); - * Superconductor.add(SubTag.NO_SMASHING, SubTag.NO_SMELTING); Infinite.add(SubTag.NO_SMASHING, - * SubTag.NO_SMELTING); - */ - Symbiotic.add(SubTag.NO_SMASHING, SubTag.NO_SMELTING); - Neutronic.add(SubTag.NO_SMASHING, SubTag.NO_SMELTING); - Quantum.add(SubTag.NO_SMASHING, SubTag.NO_SMELTING); - } - - /** - * This Array can be changed dynamically by a Tick Handler in order to get a glowing Effect on all GT Meta Items - * out of this Material. - */ - public final short[] mRGBa = new short[] { 255, 255, 255, 0 }, mMoltenRGBa = new short[] { 255, 255, 255, 0 }; - - public final TextureSet mIconSet; - public final int mMetaItemSubID; - public final boolean mUnificatable; - public final GT_Materials mMaterialInto; - public final List<MaterialStack> mMaterialList = new ArrayList<>(); - public final List<GT_Materials> mOreByProducts = new ArrayList<>(), mOreReRegistrations = new ArrayList<>(); - public final List<TC_AspectStack> mAspects = new ArrayList<>(); - private final ArrayList<ItemStack> mMaterialItems = new ArrayList<>(); - private final Collection<SubTag> mSubTags = new HashSet<>(); - public Enchantment mEnchantmentTools = null, mEnchantmentArmors = null; - public byte mEnchantmentToolsLevel = 0, mEnchantmentArmorsLevel = 0; - public boolean mBlastFurnaceRequired = false; - public float mToolSpeed = 1.0F, mHeatDamage = 0.0F; - public String mChemicalFormula = "?", mDefaultLocalName = "null"; - public Dyes mColor = Dyes._NULL; - public short mMeltingPoint = 0, mBlastFurnaceTemp = 0; - public int mTypes = 0, mDurability = 16, mFuelPower = 0, mFuelType = 0, mExtraData = 0, mOreValue = 0, - mOreMultiplier = 1, mByProductMultiplier = 1, mSmeltingMultiplier = 1; - public long mDensity = M; - public Element mElement = null; - public GT_Materials mDirectSmelting = this; - public GT_Materials mOreReplacement = this; - public GT_Materials mMacerateInto = this; - public GT_Materials mSmeltInto = this; - public GT_Materials mArcSmeltInto = this; - public final GT_Materials mHandleMaterial = this; - public byte mToolQuality = 0; - public final Fluid mSolid = null; - public Fluid mFluid = null; - public Fluid mGas = null; - public Fluid mPlasma = null; - /** - * This Fluid is used as standard Unit for Molten Materials. 1296 is a Molten Block, what means 144 is one - * Material Unit worth - */ - public final Fluid mStandardMoltenFluid = null; - - private GT_Materials(final int aMetaItemSubID, final TextureSet aIconSet, final float aToolSpeed, - final int aToolDurability, final int aToolQuality, final boolean aUnificatable) { - this.mUnificatable = aUnificatable; - this.mMaterialInto = this; - this.mMetaItemSubID = aMetaItemSubID; - this.mToolQuality = (byte) aToolQuality; - this.mDurability = aToolDurability; - this.mToolSpeed = aToolSpeed; - this.mIconSet = aIconSet; - if (aMetaItemSubID >= 0) { - if (CORE.sMU_GeneratedMaterials[aMetaItemSubID] == null) { - CORE.sMU_GeneratedMaterials[aMetaItemSubID] = this; - } else { - throw new IllegalArgumentException("The Index " + aMetaItemSubID + " is already used!"); - } - } - } - - private GT_Materials(final GT_Materials aMaterialInto, final boolean aReRegisterIntoThis) { - this.mUnificatable = false; - this.mDefaultLocalName = aMaterialInto.mDefaultLocalName; - this.mMaterialInto = aMaterialInto.mMaterialInto; - if (aReRegisterIntoThis) { - this.mMaterialInto.mOreReRegistrations.add(this); - } - this.mChemicalFormula = aMaterialInto.mChemicalFormula; - this.mMetaItemSubID = -1; - this.mIconSet = TextureSet.SET_NONE; - } - - /** - * @param aMetaItemSubID the Sub-ID used in my own MetaItems. Range 0-1000. -1 for no Material - * @param aTypes which kind of Items should be generated. Bitmask as follows: 1 = Dusts of all - * kinds. 2 = Dusts, Ingots, Plates, Rods/Sticks, Machine Components and other - * Metal specific things. 4 = Dusts, Gems, Plates, Lenses (if transparent). 8 = - * Dusts, Impure Dusts, crushed Ores, purified Ores, centrifuged Ores etc. 16 = - * Cells 32 = Plasma Cells 64 = Tool Heads 128 = Gears - * @param aR, aG, aB Color of the Material 0-255 each. - * @param aA transparency of the Material Texture. 0 = fully visible, 255 = Invisible. - * @param aLocalName The Name used as Default for localization. - * @param aFuelType Type of Generator to get Energy from this Material. - * @param aFuelPower EU generated. Will be multiplied by 1000, also additionally multiplied by 2 for - * Gems. - * @param aAmplificationValue Amount of UUM amplifier gotten from this. - * @param aUUMEnergy Amount of EU needed to shape the UUM into this Material. - * @param aMeltingPoint Used to determine the smelting Costs in Furnii. - * @param aBlastFurnaceTemp Used to determine the needed Heat capactiy Costs in Blast Furnii. - * @param aBlastFurnaceRequired If this requires a Blast Furnace. - * @param aColor Vanilla MC Wool Color which comes the closest to this. - */ - private GT_Materials(final int aMetaItemSubID, final TextureSet aIconSet, final float aToolSpeed, - final int aToolDurability, final int aToolQuality, final int aTypes, final int aR, final int aG, - final int aB, final int aA, final String aLocalName, final int aFuelType, final int aFuelPower, - final int aMeltingPoint, final int aBlastFurnaceTemp, final boolean aBlastFurnaceRequired, - final boolean aTransparent, final int aOreValue, final int aDensityMultiplier, final int aDensityDivider, - final Dyes aColor) { - this(aMetaItemSubID, aIconSet, aToolSpeed, aToolDurability, aToolQuality, true); - this.mDefaultLocalName = aLocalName; - this.mMeltingPoint = (short) aMeltingPoint; - this.mBlastFurnaceTemp = (short) aBlastFurnaceTemp; - this.mBlastFurnaceRequired = aBlastFurnaceRequired; - if (aTransparent) { - this.add(SubTag.TRANSPARENT); - } - this.mFuelPower = aFuelPower; - this.mFuelType = aFuelType; - this.mOreValue = aOreValue; - this.mDensity = (M * aDensityMultiplier) / aDensityDivider; - this.mColor = aColor == null ? Dyes._NULL : aColor; - if (this.mColor != null) { - this.add(SubTag.HAS_COLOR); - } - this.mRGBa[0] = this.mMoltenRGBa[0] = (short) aR; - this.mRGBa[1] = this.mMoltenRGBa[1] = (short) aG; - this.mRGBa[2] = this.mMoltenRGBa[2] = (short) aB; - this.mRGBa[3] = this.mMoltenRGBa[3] = (short) aA; - this.mTypes = aTypes; - if ((this.mTypes & 2) != 0) { - this.add(SubTag.SMELTING_TO_FLUID); - } - } - - private GT_Materials(final int aMetaItemSubID, final TextureSet aIconSet, final float aToolSpeed, - final int aToolDurability, final int aToolQuality, final int aTypes, final int aR, final int aG, - final int aB, final int aA, final String aLocalName, final int aFuelType, final int aFuelPower, - final int aMeltingPoint, final int aBlastFurnaceTemp, final boolean aBlastFurnaceRequired, - final boolean aTransparent, final int aOreValue, final int aDensityMultiplier, final int aDensityDivider, - final Dyes aColor, final List<TC_AspectStack> aAspects) { - this( - aMetaItemSubID, - aIconSet, - aToolSpeed, - aToolDurability, - aToolQuality, - aTypes, - aR, - aG, - aB, - aA, - aLocalName, - aFuelType, - aFuelPower, - aMeltingPoint, - aBlastFurnaceTemp, - aBlastFurnaceRequired, - aTransparent, - aOreValue, - aDensityMultiplier, - aDensityDivider, - aColor); - this.mAspects.addAll(aAspects); - } - - /** - * @param aElement The Element Enum represented by this Material - */ - private GT_Materials(final int aMetaItemSubID, final TextureSet aIconSet, final float aToolSpeed, - final int aToolDurability, final int aToolQuality, final int aTypes, final int aR, final int aG, - final int aB, final int aA, final String aLocalName, final int aFuelType, final int aFuelPower, - final int aMeltingPoint, final int aBlastFurnaceTemp, final boolean aBlastFurnaceRequired, - final boolean aTransparent, final int aOreValue, final int aDensityMultiplier, final int aDensityDivider, - final Dyes aColor, final Element aElement, final List<TC_AspectStack> aAspects) { - this( - aMetaItemSubID, - aIconSet, - aToolSpeed, - aToolDurability, - aToolQuality, - aTypes, - aR, - aG, - aB, - aA, - aLocalName, - aFuelType, - aFuelPower, - aMeltingPoint, - aBlastFurnaceTemp, - aBlastFurnaceRequired, - aTransparent, - aOreValue, - aDensityMultiplier, - aDensityDivider, - aColor); - this.mElement = aElement; - // mElement.mLinkedMaterials.add(this); - if (aElement == Element._NULL) { - this.mChemicalFormula = "Empty"; - } else { - this.mChemicalFormula = aElement.toString(); - this.mChemicalFormula = this.mChemicalFormula.replaceAll("_", "-"); - } - this.mAspects.addAll(aAspects); - } - - private GT_Materials(final int aMetaItemSubID, final TextureSet aIconSet, final float aToolSpeed, - final int aToolDurability, final int aToolQuality, final int aTypes, final int aR, final int aG, - final int aB, final int aA, final String aLocalName, final int aFuelType, final int aFuelPower, - final int aMeltingPoint, final int aBlastFurnaceTemp, final boolean aBlastFurnaceRequired, - final boolean aTransparent, final int aOreValue, final int aDensityMultiplier, final int aDensityDivider, - final Dyes aColor, final int aExtraData, final List<MaterialStack> aMaterialList) { - this( - aMetaItemSubID, - aIconSet, - aToolSpeed, - aToolDurability, - aToolQuality, - aTypes, - aR, - aG, - aB, - aA, - aLocalName, - aFuelType, - aFuelPower, - aMeltingPoint, - aBlastFurnaceTemp, - aBlastFurnaceRequired, - aTransparent, - aOreValue, - aDensityMultiplier, - aDensityDivider, - aColor, - aExtraData, - aMaterialList, - null); - } - - private GT_Materials(final int aMetaItemSubID, final TextureSet aIconSet, final float aToolSpeed, - final int aToolDurability, final int aToolQuality, final int aTypes, final int aR, final int aG, - final int aB, final int aA, final String aLocalName, final int aFuelType, final int aFuelPower, - final int aMeltingPoint, final int aBlastFurnaceTemp, final boolean aBlastFurnaceRequired, - final boolean aTransparent, final int aOreValue, final int aDensityMultiplier, final int aDensityDivider, - final Dyes aColor, final int aExtraData, final List<MaterialStack> aMaterialList, - final List<TC_AspectStack> aAspects) { - this( - aMetaItemSubID, - aIconSet, - aToolSpeed, - aToolDurability, - aToolQuality, - aTypes, - aR, - aG, - aB, - aA, - aLocalName, - aFuelType, - aFuelPower, - aMeltingPoint, - aBlastFurnaceTemp, - aBlastFurnaceRequired, - aTransparent, - aOreValue, - aDensityMultiplier, - aDensityDivider, - aColor); - this.mExtraData = aExtraData; - this.mMaterialList.addAll(aMaterialList); - this.mChemicalFormula = ""; - for (final MaterialStack tMaterial : this.mMaterialList) { - this.mChemicalFormula += tMaterial.toString(); - } - this.mChemicalFormula = this.mChemicalFormula.replaceAll("_", "-"); - - int tAmountOfComponents = 0, tMeltingPoint = 0; - for (final MaterialStack tMaterial : this.mMaterialList) { - tAmountOfComponents += tMaterial.mAmount; - if (tMaterial.mMaterial.mMeltingPoint > 0) { - tMeltingPoint += tMaterial.mMaterial.mMeltingPoint * tMaterial.mAmount; - } - if (aAspects == null) { - for (final TC_AspectStack tAspect : tMaterial.mMaterial.mAspects) { - tAspect.addToAspectList(this.mAspects); - } - } - } - - if (this.mMeltingPoint < 0) { - this.mMeltingPoint = (short) (tMeltingPoint / tAmountOfComponents); - } - - tAmountOfComponents *= aDensityMultiplier; - tAmountOfComponents /= aDensityDivider; - if (aAspects == null) { - for (final TC_AspectStack tAspect : this.mAspects) { - tAspect.mAmount = Math.max(1, tAspect.mAmount / Math.max(1, tAmountOfComponents)); - } - } else { - this.mAspects.addAll(aAspects); - } - } - - public static GT_Materials get(final String aMaterialName) { - final Object tObject = GT_Utility.getFieldContent(GT_Materials.class, aMaterialName, false, false); - if ((tObject != null) && (tObject instanceof GT_Materials)) { - return (GT_Materials) tObject; - } - return _NULL; - } - - public static GT_Materials getRealMaterial(final String aMaterialName) { - return get(aMaterialName).mMaterialInto; - } - - /** - * Called in preInit with the Config to set Values. - * - * @param aConfiguration - */ - public static void init(final GT_Config aConfiguration) { - for (final GT_Materials tMaterial : VALUES) { - final String tString = tMaterial.toString() - .toLowerCase(); - tMaterial.mHeatDamage = (float) aConfiguration - .get(ConfigCategories.Materials.heatdamage, tString, tMaterial.mHeatDamage); - if (tMaterial.mBlastFurnaceRequired) { - tMaterial.mBlastFurnaceRequired = aConfiguration - .get(ConfigCategories.Materials.blastfurnacerequirements, tString, true); - } - if (tMaterial.mBlastFurnaceRequired && aConfiguration.get( - ConfigCategories.Materials.blastinductionsmelter, - tString, - tMaterial.mBlastFurnaceTemp < 1500)) {} - } - } - - public boolean isRadioactive() { - if (this.mElement != null) { - return this.mElement.mHalfLifeSeconds >= 0; - } - for (final MaterialStack tMaterial : this.mMaterialList) { - if (tMaterial.mMaterial.isRadioactive()) { - return true; - } - } - return false; - } - - public long getProtons() { - if (this.mElement != null) { - return this.mElement.getProtons(); - } - if (this.mMaterialList.size() <= 0) { - return Element.Tc.getProtons(); - } - long rAmount = 0, tAmount = 0; - for (final MaterialStack tMaterial : this.mMaterialList) { - tAmount += tMaterial.mAmount; - rAmount += tMaterial.mAmount * tMaterial.mMaterial.getProtons(); - } - return (this.getDensity() * rAmount) / (tAmount * M); - } - - public long getNeutrons() { - if (this.mElement != null) { - return this.mElement.getNeutrons(); - } - if (this.mMaterialList.size() <= 0) { - return Element.Tc.getNeutrons(); - } - long rAmount = 0, tAmount = 0; - for (final MaterialStack tMaterial : this.mMaterialList) { - tAmount += tMaterial.mAmount; - rAmount += tMaterial.mAmount * tMaterial.mMaterial.getNeutrons(); - } - return (this.getDensity() * rAmount) / (tAmount * M); - } - - public long getMass() { - if (this.mElement != null) { - return this.mElement.getMass(); - } - if (this.mMaterialList.size() <= 0) { - return Element.Tc.getMass(); - } - long rAmount = 0, tAmount = 0; - for (final MaterialStack tMaterial : this.mMaterialList) { - tAmount += tMaterial.mAmount; - rAmount += tMaterial.mAmount * tMaterial.mMaterial.getMass(); - } - return (this.getDensity() * rAmount) / (tAmount * M); - } - - public long getDensity() { - return this.mDensity; - } - - public String getToolTip() { - return this.getToolTip(1, false); - } - - public String getToolTip(final boolean aShowQuestionMarks) { - return this.getToolTip(1, aShowQuestionMarks); - } - - public String getToolTip(final long aMultiplier) { - return this.getToolTip(aMultiplier, false); - } - - public String getToolTip(final long aMultiplier, final boolean aShowQuestionMarks) { - if (!aShowQuestionMarks && this.mChemicalFormula.equals("?")) { - return ""; - } - if ((aMultiplier >= (M * 2)) && !this.mMaterialList.isEmpty()) { - return (((this.mElement != null) - || ((this.mMaterialList.size() < 2) && (this.mMaterialList.get(0).mAmount == 1))) - ? this.mChemicalFormula - : "(" + this.mChemicalFormula + ")") - + aMultiplier; - } - return this.mChemicalFormula; - } - - /** - * Adds an ItemStack to this Material. - */ - public GT_Materials add(final ItemStack aStack) { - if ((aStack != null) && !this.contains(aStack)) { - this.mMaterialItems.add(aStack); - } - return this; - } - - /** - * This is used to determine if any of the ItemStacks belongs to this Material. - */ - public boolean contains(final ItemStack... aStacks) { - if ((aStacks == null) || (aStacks.length <= 0)) { - return false; - } - for (final ItemStack tStack : this.mMaterialItems) { - for (final ItemStack aStack : aStacks) { - if (GT_Utility.areStacksEqual(aStack, tStack, !tStack.hasTagCompound())) { - return true; - } - } - } - return false; - } - - /** - * This is used to determine if an ItemStack belongs to this Material. - */ - public boolean remove(final ItemStack aStack) { - if (aStack == null) { - return false; - } - boolean temp = false; - for (int i = 0; i < this.mMaterialItems.size(); i++) { - if (GT_Utility.areStacksEqual(aStack, this.mMaterialItems.get(i))) { - this.mMaterialItems.remove(i--); - temp = true; - } - } - return temp; - } - - /** - * Adds a SubTag to this Material - */ - @Override - public ISubTagContainer add(final SubTag... aTags) { - if (aTags != null) { - for (final SubTag aTag : aTags) { - if ((aTag != null) && !this.contains(aTag)) { - aTag.addContainerToList(this); - this.mSubTags.add(aTag); - } - } - } - return this; - } - - /** - * If this Material has this exact SubTag - */ - @Override - public boolean contains(final SubTag aTag) { - return this.mSubTags.contains(aTag); - } - - /** - * Removes a SubTag from this Material - */ - @Override - public boolean remove(final SubTag aTag) { - return this.mSubTags.remove(aTag); - } - - /** - * Sets the Heat Damage for this Material (negative = frost) - */ - public GT_Materials setHeatDamage(final float aHeatDamage) { - this.mHeatDamage = aHeatDamage; - return this; - } - - /** - * Adds a Material to the List of Byproducts when grinding this Ore. Is used for more precise Ore grinding, so - * that it is possible to choose between certain kinds of Materials. - */ - public GT_Materials addOreByProduct(final GT_Materials aMaterial) { - if (!this.mOreByProducts.contains(aMaterial.mMaterialInto)) { - this.mOreByProducts.add(aMaterial.mMaterialInto); - } - return this; - } - - /** - * Adds multiple Materials to the List of Byproducts when grinding this Ore. Is used for more precise Ore - * grinding, so that it is possible to choose between certain kinds of Materials. - */ - public GT_Materials addOreByProducts(final GT_Materials... aMaterials) { - for (final GT_Materials tMaterial : aMaterials) { - if (tMaterial != null) { - this.addOreByProduct(tMaterial); - } - } - return this; - } - - /** - * If this Ore gives multiple drops of its Main Material. Lapis Ore for example gives about 6 drops. - */ - public GT_Materials setOreMultiplier(final int aOreMultiplier) { - if (aOreMultiplier > 0) { - this.mOreMultiplier = aOreMultiplier; - } - return this; - } - - /** - * If this Ore gives multiple drops of its Byproduct Material. - */ - public GT_Materials setByProductMultiplier(final int aByProductMultiplier) { - if (aByProductMultiplier > 0) { - this.mByProductMultiplier = aByProductMultiplier; - } - return this; - } - - /** - * If this Ore gives multiple drops of its Main Material. Lapis Ore for example gives about 6 drops. - */ - public GT_Materials setSmeltingMultiplier(final int aSmeltingMultiplier) { - if (aSmeltingMultiplier > 0) { - this.mSmeltingMultiplier = aSmeltingMultiplier; - } - return this; - } - - /** - * This Ore should be smolten directly into an Ingot of this Material instead of an Ingot of itself. - */ - public GT_Materials setDirectSmelting(final GT_Materials aMaterial) { - if (aMaterial != null) { - this.mDirectSmelting = aMaterial.mMaterialInto.mDirectSmelting; - } - return this; - } - - /** - * This Material should be the Main Material this Ore gets ground into. Example, Chromite giving Chrome or - * Tungstate giving Tungsten. - */ - public GT_Materials setOreReplacement(final GT_Materials aMaterial) { - if (aMaterial != null) { - this.mOreReplacement = aMaterial.mMaterialInto.mOreReplacement; - } - return this; - } - - /** - * This Material smelts always into an instance of aMaterial. Used for Magnets. - */ - public GT_Materials setSmeltingInto(final GT_Materials aMaterial) { - if (aMaterial != null) { - this.mSmeltInto = aMaterial.mMaterialInto.mSmeltInto; - } - return this; - } - - /** - * This Material arc smelts always into an instance of aMaterial. Used for Wrought Iron. - */ - public GT_Materials setArcSmeltingInto(final GT_Materials aMaterial) { - if (aMaterial != null) { - this.mArcSmeltInto = aMaterial.mMaterialInto.mArcSmeltInto; - } - return this; - } - - /** - * This Material macerates always into an instance of aMaterial. - */ - public GT_Materials setMaceratingInto(final GT_Materials aMaterial) { - if (aMaterial != null) { - this.mMacerateInto = aMaterial.mMaterialInto.mMacerateInto; - } - return this; - } - - public GT_Materials setEnchantmentForTools(final Enchantment aEnchantment, final int aEnchantmentLevel) { - this.mEnchantmentTools = aEnchantment; - this.mEnchantmentToolsLevel = (byte) aEnchantmentLevel; - return this; - } - - public GT_Materials setEnchantmentForArmors(final Enchantment aEnchantment, final int aEnchantmentLevel) { - this.mEnchantmentArmors = aEnchantment; - this.mEnchantmentArmorsLevel = (byte) aEnchantmentLevel; - return this; - } - - public FluidStack getSolid(final long aAmount) { - if (this.mSolid == null) { - return null; - } - return new FluidStack(this.mSolid, (int) aAmount); - } - - public FluidStack getFluid(final long aAmount) { - if (this.mFluid == null) { - return null; - } - return new FluidStack(this.mFluid, (int) aAmount); - } - - public FluidStack getGas(final long aAmount) { - if (this.mGas == null) { - return null; - } - return new FluidStack(this.mGas, (int) aAmount); - } - - public FluidStack getPlasma(final long aAmount) { - if (this.mPlasma == null) { - return null; - } - return new FluidStack(this.mPlasma, (int) aAmount); - } - - public FluidStack getMolten(final long aAmount) { - if (this.mStandardMoltenFluid == null) { - return null; - } - return new FluidStack(this.mStandardMoltenFluid, (int) aAmount); - } - - @Override - public short[] getRGBA() { - return this.mRGBa; - } - - public static final int VERSION = 508; - } -} diff --git a/gtpp/src/main/java/gtPlusPlus/xmod/gregtech/api/enums/GregtechToolDictNames.java b/gtpp/src/main/java/gtPlusPlus/xmod/gregtech/api/enums/GregtechToolDictNames.java deleted file mode 100644 index 0a116b1b9f..0000000000 --- a/gtpp/src/main/java/gtPlusPlus/xmod/gregtech/api/enums/GregtechToolDictNames.java +++ /dev/null @@ -1,9 +0,0 @@ -package gtPlusPlus.xmod.gregtech.api.enums; - -public enum GregtechToolDictNames { - craftingToolHandPump, - craftingToolAngleGrinder, - craftingToolElectricSnips, - craftingToolElectricLighter, - craftingToolElectricButcherKnife; -} diff --git a/gtpp/src/main/java/gtPlusPlus/xmod/gregtech/api/gui/GTPP_UITextures.java b/gtpp/src/main/java/gtPlusPlus/xmod/gregtech/api/gui/GTPP_UITextures.java deleted file mode 100644 index e6276713f3..0000000000 --- a/gtpp/src/main/java/gtPlusPlus/xmod/gregtech/api/gui/GTPP_UITextures.java +++ /dev/null @@ -1,139 +0,0 @@ -package gtPlusPlus.xmod.gregtech.api.gui; - -import static gregtech.api.enums.Mods.GTPlusPlus; - -import java.util.stream.Collectors; -import java.util.stream.IntStream; - -import com.gtnewhorizons.modularui.api.drawable.AdaptableUITexture; -import com.gtnewhorizons.modularui.api.drawable.UITexture; - -public class GTPP_UITextures { - - public static final UITexture OVERLAY_SLOT_COAL = UITexture.fullImage(GTPlusPlus.ID, "gui/overlay_slot/coal"); - public static final UITexture OVERLAY_SLOT_CANISTER_DARK = UITexture - .fullImage(GTPlusPlus.ID, "gui/overlay_slot/canister_dark"); - - public static final AdaptableUITexture BACKGROUND_YELLOW = AdaptableUITexture - .of(GTPlusPlus.ID, "gui/background/yellow", 176, 166, 4); - - public static final AdaptableUITexture SLOT_ITEM_YELLOW = AdaptableUITexture - .of(GTPlusPlus.ID, "gui/slot/item_yellow", 18, 18, 1); - public static final AdaptableUITexture[] SLOT_INVENTORY_MANAGER = new AdaptableUITexture[] { - AdaptableUITexture.of(GTPlusPlus.ID, "gui/slot/red", 18, 18, 1), - AdaptableUITexture.of(GTPlusPlus.ID, "gui/slot/green", 18, 18, 1), - AdaptableUITexture.of(GTPlusPlus.ID, "gui/slot/blue", 18, 18, 1), - AdaptableUITexture.of(GTPlusPlus.ID, "gui/slot/cyan", 18, 18, 1), - AdaptableUITexture.of(GTPlusPlus.ID, "gui/slot/magenta", 18, 18, 1), - AdaptableUITexture.of(GTPlusPlus.ID, "gui/slot/yellow", 18, 18, 1), }; - - public static final UITexture BUTTON_STANDARD_BRONZE = UITexture - .fullImage(GTPlusPlus.ID, "gui/button/standard_bronze"); - - public static final UITexture OVERLAY_SLOT_WEED_EX = UITexture.fullImage(GTPlusPlus.ID, "gui/overlay_slot/weed_ex"); - public static final UITexture OVERLAY_SLOT_FERTILIZER = UITexture - .fullImage(GTPlusPlus.ID, "gui/overlay_slot/fertilizer"); - public static final UITexture OVERLAY_SLOT_ELECTRIC_TOOL = UITexture - .fullImage(GTPlusPlus.ID, "gui/overlay_slot/electric_tool"); - public static final UITexture OVERLAY_SLOT_PAGE_PRINTED_BRONZE = UITexture - .fullImage(GTPlusPlus.ID, "gui/overlay_slot/page_printed_bronze"); - public static final UITexture OVERLAY_SLOT_ARROW = UITexture.fullImage(GTPlusPlus.ID, "gui/overlay_slot/arrow"); - public static final UITexture OVERLAY_SLOT_ARROW_BRONZE = UITexture - .fullImage(GTPlusPlus.ID, "gui/overlay_slot/arrow_bronze"); - public static final UITexture OVERLAY_SLOT_CRAFT_OUTPUT = UITexture - .fullImage(GTPlusPlus.ID, "gui/overlay_slot/craft_output"); - public static final UITexture OVERLAY_SLOT_CRAFT_OUTPUT_BRONZE = UITexture - .fullImage(GTPlusPlus.ID, "gui/overlay_slot/craft_output_bronze"); - public static final UITexture OVERLAY_SLOT_PARK = UITexture.fullImage(GTPlusPlus.ID, "gui/overlay_slot/park"); - public static final UITexture OVERLAY_SLOT_PARK_BRONZE = UITexture - .fullImage(GTPlusPlus.ID, "gui/overlay_slot/park_bronze"); - public static final UITexture OVERLAY_SLOT_INGOT = UITexture.fullImage(GTPlusPlus.ID, "gui/overlay_slot/ingot"); - public static final UITexture OVERLAY_SLOT_ARROW_4 = UITexture.fullImage(GTPlusPlus.ID, "gui/overlay_slot/arrow_4"); - public static final UITexture OVERLAY_SLOT_TURBINE = UITexture.fullImage(GTPlusPlus.ID, "gui/overlay_slot/turbine"); - public static final UITexture OVERLAY_SLOT_CHEST = UITexture.fullImage(GTPlusPlus.ID, "gui/overlay_slot/chest"); - public static final UITexture[] OVERLAY_SLOT_INVENTORY_MANAGER_COLOR = new UITexture[] { - UITexture.fullImage(GTPlusPlus.ID, "gui/overlay_slot/red"), - UITexture.fullImage(GTPlusPlus.ID, "gui/overlay_slot/green"), - UITexture.fullImage(GTPlusPlus.ID, "gui/overlay_slot/blue"), - UITexture.fullImage(GTPlusPlus.ID, "gui/overlay_slot/cyan"), - UITexture.fullImage(GTPlusPlus.ID, "gui/overlay_slot/magenta"), - UITexture.fullImage(GTPlusPlus.ID, "gui/overlay_slot/yellow"), }; - public static final UITexture[] OVERLAY_SLOT_INVENTORY_MANAGER_ARROW = new UITexture[] { - UITexture.fullImage(GTPlusPlus.ID, "gui/overlay_slot/arrow_red"), - UITexture.fullImage(GTPlusPlus.ID, "gui/overlay_slot/arrow_green"), - UITexture.fullImage(GTPlusPlus.ID, "gui/overlay_slot/arrow_blue"), - UITexture.fullImage(GTPlusPlus.ID, "gui/overlay_slot/arrow_cyan"), - UITexture.fullImage(GTPlusPlus.ID, "gui/overlay_slot/arrow_magenta"), - UITexture.fullImage(GTPlusPlus.ID, "gui/overlay_slot/arrow_yellow"), }; - - public static final UITexture PROGRESSBAR_FLUID_REACTOR = UITexture - .fullImage(GTPlusPlus.ID, "gui/progressbar/fluid_reactor"); - public static final UITexture PROGRESSBAR_BOILER_EMPTY = UITexture - .fullImage(GTPlusPlus.ID, "gui/progressbar/boiler_empty"); - public static final UITexture PROGRESSBAR_FUEL = UITexture.fullImage(GTPlusPlus.ID, "gui/progressbar/fuel"); - public static final UITexture PROGRESSBAR_ARROW_2 = UITexture.fullImage(GTPlusPlus.ID, "gui/progressbar/arrow_2"); - public static final UITexture PROGRESSBAR_PSS_ENERGY = UITexture - .fullImage(GTPlusPlus.ID, "gui/progressbar/pss_energy"); - - public static final AdaptableUITexture TAB_TITLE_YELLOW = AdaptableUITexture - .of(GTPlusPlus.ID, "gui/tab/title_yellow", 28, 28, 4); - public static final AdaptableUITexture TAB_TITLE_ANGULAR_YELLOW = AdaptableUITexture - .of(GTPlusPlus.ID, "gui/tab/title_angular_yellow", 28, 28, 4); - public static final AdaptableUITexture TAB_TITLE_DARK_YELLOW = AdaptableUITexture - .of(GTPlusPlus.ID, "gui/tab/title_dark_yellow", 28, 28, 4); - - public static final UITexture OVERLAY_BUTTON_HARVESTER_MODE = UITexture - .fullImage(GTPlusPlus.ID, "gui/overlay_button/harvester_mode"); - public static final UITexture OVERLAY_BUTTON_HARVESTER_TOGGLE = UITexture - .fullImage(GTPlusPlus.ID, "gui/overlay_button/harvester_toggle"); - public static final UITexture OVERLAY_BUTTON_FLUSH = UITexture.fullImage(GTPlusPlus.ID, "gui/overlay_button/flush"); - public static final UITexture OVERLAY_BUTTON_FLUSH_BRONZE = UITexture - .fullImage(GTPlusPlus.ID, "gui/overlay_button/flush_bronze"); - public static final UITexture OVERLAY_BUTTON_AUTOMATION = UITexture - .fullImage(GTPlusPlus.ID, "gui/overlay_button/automation"); - public static final UITexture OVERLAY_BUTTON_LOCK = UITexture.fullImage(GTPlusPlus.ID, "gui/overlay_button/lock"); - public static final UITexture[] OVERLAY_BUTTON_THROUGHPUT = IntStream.range(0, 4) // GT_MetaTileEntity_ElectricAutoWorkbench#MAX_THROUGHPUT - .mapToObj(i -> UITexture.fullImage(GTPlusPlus.ID, "gui/overlay_button/throughput_" + i)) - .collect(Collectors.toList()) - .toArray(new UITexture[0]); - public static final UITexture[] OVERLAY_BUTTON_MODE = IntStream.range(0, 10) // GT_MetaTileEntity_ElectricAutoWorkbench#MAX_MODES - .mapToObj(i -> UITexture.fullImage(GTPlusPlus.ID, "gui/overlay_button/mode_" + i)) - .collect(Collectors.toList()) - .toArray(new UITexture[0]); - public static final UITexture[] OVERLAY_BUTTON_DIRECTION = new UITexture[] { - UITexture.fullImage(GTPlusPlus.ID, "gui/overlay_button/bottom"), - UITexture.fullImage(GTPlusPlus.ID, "gui/overlay_button/top"), - UITexture.fullImage(GTPlusPlus.ID, "gui/overlay_button/north"), - UITexture.fullImage(GTPlusPlus.ID, "gui/overlay_button/south"), - UITexture.fullImage(GTPlusPlus.ID, "gui/overlay_button/west"), - UITexture.fullImage(GTPlusPlus.ID, "gui/overlay_button/east"), }; - public static final UITexture[] OVERLAY_BUTTON_DIRECTION_GRAY = new UITexture[] { - UITexture.fullImage(GTPlusPlus.ID, "gui/overlay_button/bottom_gray"), - UITexture.fullImage(GTPlusPlus.ID, "gui/overlay_button/top_gray"), - UITexture.fullImage(GTPlusPlus.ID, "gui/overlay_button/north_gray"), - UITexture.fullImage(GTPlusPlus.ID, "gui/overlay_button/south_gray"), - UITexture.fullImage(GTPlusPlus.ID, "gui/overlay_button/west_gray"), - UITexture.fullImage(GTPlusPlus.ID, "gui/overlay_button/east_gray"), }; - public static final UITexture OVERLAY_BUTTON_TIP_GREEN = UITexture - .fullImage(GTPlusPlus.ID, "gui/overlay_button/tip_green"); - public static final UITexture OVERLAY_BUTTON_TIP_RED = UITexture - .fullImage(GTPlusPlus.ID, "gui/overlay_button/tip_red"); - public static final UITexture OVERLAY_BUTTON_ACTIVE_STATE = UITexture - .fullImage(GTPlusPlus.ID, "gui/overlay_button/active_state"); - public static final UITexture OVERLAY_BUTTON_CHANGE_MODE = UITexture - .fullImage(GTPlusPlus.ID, "gui/overlay_button/change_mode"); - public static final UITexture OVERLAY_BUTTON_PLUS_MINUS = UITexture - .fullImage(GTPlusPlus.ID, "gui/overlay_button/plus_minus"); - - public static final UITexture PICTURE_WORKBENCH_CIRCLE = UITexture - .fullImage(GTPlusPlus.ID, "gui/picture/workbench_circle"); - public static final UITexture PICTURE_ARROW_WHITE_DOWN = UITexture - .fullImage(GTPlusPlus.ID, "gui/picture/arrow_white_down"); - public static final UITexture PICTURE_REDSTONE_CIRCUIT_SCREEN = UITexture - .fullImage(GTPlusPlus.ID, "gui/picture/redstone_circuit_screen"); - public static final UITexture PICTURE_ELECTRICITY_ERROR = UITexture - .fullImage(GTPlusPlus.ID, "gui/picture/electricity_error"); - public static final UITexture PICTURE_ELECTRICITY_FINE = UITexture - .fullImage(GTPlusPlus.ID, "gui/picture/electricity_fine"); - public static final UITexture PICTURE_ENERGY_FRAME = UITexture.fullImage(GTPlusPlus.ID, "gui/picture/energy_frame"); -} diff --git a/gtpp/src/main/java/gtPlusPlus/xmod/gregtech/api/gui/widget/ElectricSlotWidget.java b/gtpp/src/main/java/gtPlusPlus/xmod/gregtech/api/gui/widget/ElectricSlotWidget.java deleted file mode 100644 index e522d41799..0000000000 --- a/gtpp/src/main/java/gtPlusPlus/xmod/gregtech/api/gui/widget/ElectricSlotWidget.java +++ /dev/null @@ -1,40 +0,0 @@ -package gtPlusPlus.xmod.gregtech.api.gui.widget; - -import net.minecraft.item.ItemStack; - -import com.gtnewhorizons.modularui.api.forge.IItemHandlerModifiable; -import com.gtnewhorizons.modularui.common.internal.wrapper.BaseSlot; -import com.gtnewhorizons.modularui.common.widget.SlotWidget; - -import gregtech.api.items.GT_MetaGenerated_Tool; -import ic2.api.info.Info; -import ic2.api.item.ElectricItem; -import ic2.api.item.IElectricItem; - -public class ElectricSlotWidget extends SlotWidget { - - public ElectricSlotWidget(IItemHandlerModifiable handler, int index) { - this(new BaseSlot(handler, index, false) { - - @Override - public int getSlotStackLimit() { - return 1; - } - }); - } - - private ElectricSlotWidget(BaseSlot slot) { - super(slot); - setFilter( - stack -> (accepts(stack)) || (stack.getItem() instanceof GT_MetaGenerated_Tool) - || (stack.getItem() instanceof IElectricItem)); - } - - private boolean accepts(final ItemStack stack) { - if (stack == null) { - return false; - } - return (Info.itemEnergy.getEnergyValue(stack) > 0.0D) - || (ElectricItem.manager.discharge(stack, (1.0D / 0.0D), 4, true, true, true) > 0.0D); - } -} diff --git a/gtpp/src/main/java/gtPlusPlus/xmod/gregtech/api/interfaces/GregtechItemContainer.java b/gtpp/src/main/java/gtPlusPlus/xmod/gregtech/api/interfaces/GregtechItemContainer.java deleted file mode 100644 index 9431739c45..0000000000 --- a/gtpp/src/main/java/gtPlusPlus/xmod/gregtech/api/interfaces/GregtechItemContainer.java +++ /dev/null @@ -1,40 +0,0 @@ -package gtPlusPlus.xmod.gregtech.api.interfaces; - -import net.minecraft.block.Block; -import net.minecraft.item.Item; -import net.minecraft.item.ItemStack; - -public interface GregtechItemContainer { - - public Item getItem(); - - public Block getBlock(); - - public boolean isStackEqual(Object aStack); - - public boolean isStackEqual(Object aStack, boolean aWildcard, boolean aIgnoreNBT); - - public ItemStack get(long aAmount, Object... aReplacements); - - public ItemStack getWildcard(long aAmount, Object... aReplacements); - - public ItemStack getUndamaged(long aAmount, Object... aReplacements); - - public ItemStack getAlmostBroken(long aAmount, Object... aReplacements); - - public ItemStack getWithDamage(long aAmount, long aMetaValue, Object... aReplacements); - - public GregtechItemContainer set(Item aItem); - - public GregtechItemContainer set(ItemStack aStack); - - public GregtechItemContainer registerOre(Object... aOreNames); - - public GregtechItemContainer registerWildcardAsOre(Object... aOreNames); - - public ItemStack getWithCharge(long aAmount, int aEnergy, Object... aReplacements); - - public ItemStack getWithName(long aAmount, String aDisplayName, Object... aReplacements); - - public boolean hasBeenSet(); -} diff --git a/gtpp/src/main/java/gtPlusPlus/xmod/gregtech/api/interfaces/internal/IGregtech_RecipeAdder.java b/gtpp/src/main/java/gtPlusPlus/xmod/gregtech/api/interfaces/internal/IGregtech_RecipeAdder.java deleted file mode 100644 index faa39dadc3..0000000000 --- a/gtpp/src/main/java/gtPlusPlus/xmod/gregtech/api/interfaces/internal/IGregtech_RecipeAdder.java +++ /dev/null @@ -1,380 +0,0 @@ -package gtPlusPlus.xmod.gregtech.api.interfaces.internal; - -import net.minecraft.item.ItemStack; -import net.minecraftforge.fluids.FluidStack; - -import gregtech.api.enums.Materials; -import gtPlusPlus.core.material.Material; - -@SuppressWarnings("UnusedReturnValue") -public interface IGregtech_RecipeAdder { - - /** - * Adds a Coke Oven Recipe - * - * @param aInput1 = first Input (not null, and respects StackSize) - * @param aInput2 = second Input (can be null, and respects StackSize) - * @param aFluidOutput = Output of the Creosote (not null, and respects StackSize) - * @param aFluidInput = fluid Input (can be null, and respects StackSize) - * @param aOutput = Output of the Coal/coke (can be null, and respects StackSize) - * @param aDuration = Duration (must be >= 0) - * @param aEUt = EU needed for heating up (must be >= 0) - * @return true if the Recipe got added, otherwise false. - */ - boolean addCokeOvenRecipe(ItemStack aInput1, ItemStack aInput2, FluidStack aFluidInput, FluidStack aFluidOutput, - ItemStack aOutput, int aDuration, int aEUt); - - boolean addCokeOvenRecipe(int aCircuit, ItemStack aInput2, FluidStack[] aFluidInputs, FluidStack[] aFluidOutputs, - ItemStack[] aOutputs, int aDuration, int aEUt); - - boolean addCokeOvenRecipe(ItemStack aInput1, ItemStack aInput2, FluidStack[] aFluidInputs, - FluidStack[] aFluidOutputs, ItemStack[] aOutputs, int aDuration, int aEUt); - - /** - * Adds a Matter Fabricator Recipe - * - * @param aFluidOutput = Output of the UU-Matter (not null, and respects StackSize) - * @param aFluidInput = fluid Input (can be UU_Amp or null, and respects StackSize) - * @param aDuration = Duration (must be >= 0) - * @param aEUt = EU needed for heating up (must be >= 0) - * @return true if the Recipe got added, otherwise false. - */ - @Deprecated - boolean addMatterFabricatorRecipe(FluidStack aFluidInput, FluidStack aFluidOutput, int aDuration, int aEUt); - - /** - * Adds a Recipe for the Dehydrator. (up to 9 Outputs) - * - * @param aInput = ItemStack[] (not null, and respects StackSize) - * @param aFluidInput = fluid Input (can be UU_Amp or null, and respects StackSize) - * @param aFluidOutput = Output of the UU-Matter (not null, and respects StackSize) - * @param aOutputItems = ItemStack[] (not null, and respects StackSize) - * @param aChances = Output Change (can be == 0) - * @param aDuration = Duration (must be >= 0) - * @param aEUt = EU needed for heating up (must be >= 0) - * @return true if the Recipe got added, otherwise false. - */ - boolean addDehydratorRecipe(ItemStack[] aInput, FluidStack aFluidInput, FluidStack aFluidOutput, - ItemStack[] aOutputItems, int[] aChances, int aDuration, int aEUt); - - /** - * Adds a Recipe for the Alloy Blast Smelter. (up to 9 Inputs) - * - * @param aInput = ItemStack[] (not null, and respects StackSize) - * @param aOutput = Output of the Molten Metal (not null, and respects StackSize) - * @param aChance = Output Chance (can be == 0) - * @param aDuration = Duration (must be >= 0) - * @param aEUt = EU per tick needed for heating up (must be >= 0) - * @return true if the Recipe got added, otherwise false. - */ - - boolean addBlastSmelterRecipe(ItemStack[] aInput, FluidStack aOutput, int aChance, int aDuration, int aEUt); - - /** - * Adds a Recipe for the Alloy Blast Smelter. (up to 9 Inputs) - * - * @param aInput = ItemStack[] (not null, and respects StackSize) - * @param aInputFluid = Input of a fluid (can be null, and respects StackSize) - * @param aOutput = Output of the Molten Metal (not null, and respects StackSize) - * @param aChance = Output Chance (can be == 0) - * @param aDuration = Duration (must be >= 0) - * @param aEUt = EU per tick needed for heating up (must be >= 0) - * @return true if the Recipe got added, otherwise false. - */ - - boolean addBlastSmelterRecipe(ItemStack[] aInput, FluidStack aInputFluid, FluidStack aOutput, int aChance, - int aDuration, int aEUt); - - /** - * Adds a Recipe for the Alloy Blast Smelter. (up to 9 Inputs, More than 1 Fluids) - * - * @param aInput = ItemStack[] (not null, and respects StackSize) - * @param aInputFluid = FluidStack[] (can be null, and respects StackSize) - * @param aOutput = Output of the Molten Metal (not null, and respects StackSize) - * @param aChance = Output Chance (can be == 0) - * @param aDuration = Duration (must be >= 0) - * @param aEUt = EU per tick needed for heating up (must be >= 0) - * @return true if the Recipe got added, otherwise false. - */ - - boolean addBlastSmelterRecipe(ItemStack[] aInput, FluidStack[] aInputFluid, FluidStack aOutput, int aChance, - int aDuration, int aEUt); - - /** - * Adds a Recipe for the Alloy Blast Smelter. (up to 9 Inputs) - * - * @param aInput = ItemStack[] (not null, and respects StackSize) - * @param aInputFluid = Input of a fluid (can be null, and respects StackSize) - * @param aOutput = Output of the Molten Metal (not null, and respects StackSize) - * @param aOutputStack = Item Output (Can be null) - * @param aChance = Output Chance (can be == 0) - * @param aDuration = Duration (must be >= 0) - * @param aEUt = EU per tick needed for heating up (must be >= 0) - * @return true if the Recipe got added, otherwise false. - */ - - boolean addBlastSmelterRecipe(ItemStack[] aInput, FluidStack aInputFluid, FluidStack aOutput, - ItemStack[] aOutputStack, int[] aChance, int aDuration, int aEUt); - - boolean addBlastSmelterRecipe(ItemStack[] aInput, FluidStack aInputFluid, FluidStack aOutput, int aChance, - int aDuration, int aEUt, int aSpecialValue); - - boolean addBlastSmelterRecipe(ItemStack[] aInput, FluidStack aInputFluid, FluidStack aOutput, - ItemStack[] aOutputStack, int[] aChance, int aDuration, int aEUt, int aSpecialValue, boolean aOptimizeRecipe); - - /** - * Adds a Recipe for the Alloy Blast Smelter. (up to 9 Inputs, More than 1 fluids) - * - * @param aInput = ItemStack[] (not null, and respects StackSize) - * @param aInputFluid = FluidStack[] (can be null, and respects StackSize) - * @param aOutput = Output of the Molten Metal (not null, and respects StackSize) - * @param aOutputStack = Item Output (Can be null) - * @param aChance = Output Chance (can be == 0) - * @param aDuration = Duration (must be >= 0) - * @param aEUt = EU per tick needed for heating up (must be >= 0) - * @return true if the Recipe got added, otherwise false. - */ - - boolean addBlastSmelterRecipe(ItemStack[] aInput, FluidStack[] aInputFluid, FluidStack aOutput, - ItemStack[] aOutputStack, int[] aChance, int aDuration, int aEUt); - - boolean addBlastSmelterRecipe(ItemStack[] aInput, FluidStack[] aInputFluid, FluidStack aOutput, int aChance, - int aDuration, int aEUt, int aSpecialValue); - - boolean addBlastSmelterRecipe(ItemStack[] aInput, FluidStack[] aInputFluid, FluidStack aOutput, - ItemStack[] aOutputStack, int[] aChance, int aDuration, int aEUt, int aSpecialValue, boolean aOptimizeRecipe); - - /** - * Adds a Recipe for the LFTRr. (up to 9 Inputs) - * - * @param aInput = ItemStack[] (not null, and respects StackSize) - * @param aInputFluid = Input of a fluid (can be null, and respects StackSize) - * @param aOutput = Output of the Molten Salts (not null, and respects StackSize) - * @param aOutputStack = Item Output (Can be null) - * @param aChance = Output Chance (can be == 0) - * @param aDuration = Duration (must be >= 0) - * @param aEUt = EU per tick needed for heating up (must be >= 0) - * @param aSpecialValue = Power produced in EU/t per dynamo - * @return true if the Recipe got added, otherwise false. - */ - - boolean addBlastSmelterRecipe(ItemStack[] aInput, FluidStack aInputFluid, FluidStack aOutput, - ItemStack[] aOutputStack, int[] aChance, int aDuration, int aEUt, int aSpecialValue); - - /** - * Adds a Recipe for the Quantum Force Smelter (up to 9 Inputs) - * - * - **/ - boolean addQuantumTransformerRecipe(ItemStack[] aInput, FluidStack[] aFluidInput, FluidStack[] aFluidOutput, - ItemStack[] aOutputStack, int[] aChances, int aDuration, int aEUt, int aSpecialValue); - - /** - * Adds a Recipe for the LFTRr. (up to 9 Inputs, More than 1 fluids) - * - * @param aInput = ItemStack[] (not null, and respects StackSize) - * @param aInputFluid = FluidStack[] (can be null, and respects StackSize) - * @param aOutput = Output of the Molten Salts (not null, and respects StackSize) - * @param aOutputStack = Item Output (Can be null) - * @param aChance = Output Chance (can be == 0) - * @param aDuration = Duration (must be >= 0) - * @param aEUt = EU per tick needed for heating up (must be >= 0) - * @param aSpecialValue = Power produced in EU/t per dynamo - * @return true if the Recipe got added, otherwise false. - */ - @Deprecated - boolean addBlastSmelterRecipe(ItemStack[] aInput, FluidStack[] aInputFluid, FluidStack aOutput, - ItemStack[] aOutputStack, int[] aChance, int aDuration, int aEUt, int aSpecialValue); - - /** - * Adds a custom Semifluid fuel for the GT++ SemiFluid Generators. - * - * @param aFuelItem - A Fluidstack to be consumed. - * @param aFuelValue - Fuel value in thousands (1 = 1000) - * @return - Was the Fuel added? - */ - boolean addSemifluidFuel(FluidStack aFuelItem, int aFuelValue); - - /** - * Adds a custom Semifluid fuel for the GT++ SemiFluid Generators. - * - * @param aFuelItem - A Fluidstack to be consumed. - * @param aFuelValue - Fuel value in thousands (1 = 1000) - * @return - Was the Fuel added? - */ - boolean addSemifluidFuel(ItemStack aFuelItem, int aFuelValue); - - boolean addFissionFuel(FluidStack aInput1, FluidStack aInput2, FluidStack aInput3, FluidStack aInput4, - FluidStack aInput5, FluidStack aInput6, FluidStack aInput7, FluidStack aInput8, FluidStack aInput9, - FluidStack aOutput1, FluidStack aOutput2, int aDuration, int aEUt); - - boolean addFissionFuel(boolean aOptimise, FluidStack aInput1, FluidStack aInput2, FluidStack aInput3, - FluidStack aInput4, FluidStack aInput5, FluidStack aInput6, FluidStack aInput7, FluidStack aInput8, - FluidStack aInput9, FluidStack aOutput1, FluidStack aOutput2, int aDuration, int aEUt); - - boolean addCyclotronRecipe(ItemStack aInput, FluidStack aFluidInput, ItemStack[] aOutputs, FluidStack aFluidOutput, - int[] aChances, int aDuration, int aEUt, int aSpecialValue); - - boolean addCyclotronRecipe(ItemStack[] aInputs, FluidStack aFluidInput, ItemStack[] aOutput, - FluidStack aFluidOutput, int[] aChances, int aDuration, int aEUt, int aSpecialValue); - - @Deprecated - boolean addMixerRecipe(ItemStack aInput1, ItemStack aInput2, ItemStack aInput3, ItemStack aInput4, - FluidStack aFluidInput, FluidStack aFluidOutput, ItemStack aOutput1, ItemStack aOutput2, ItemStack aOutput3, - ItemStack aOutput4, int aDuration, int aEUt); - - boolean addMultiblockCentrifugeRecipe(ItemStack[] aInputs, FluidStack[] aFluidInputs, FluidStack[] aFluidOutputs, - ItemStack[] aOutputs, int[] aChances, int aDuration, int aEUtick, int aSpecial); - - boolean addMultiblockElectrolyzerRecipe(ItemStack[] aInputs, FluidStack[] aFluidInputs, FluidStack[] aFluidOutputs, - ItemStack[] aOutputs, int[] aChances, int aDuration, int aEUtick, int aSpecial); - - boolean addAdvancedFreezerRecipe(ItemStack[] aInputs, FluidStack[] aFluidInputs, FluidStack[] aFluidOutputs, - ItemStack[] aOutputs, int[] aChances, int aDuration, int aEUtick, int aSpecial); - - @Deprecated - boolean addSixSlotAssemblingRecipe(ItemStack[] aInputs, FluidStack aInputFluid, ItemStack aOutput1, int aDuration, - int aEUt); - - /** - * Adds an Assemblyline Recipe - * - * @param aInputs must be != null, 4-16 inputs - * @param aFluidInputs 0-4 fluids - * @param aOutput must be != null - * @param aDuration must be > 0 - * @param aEUt should be > 0 - */ - @Deprecated - boolean addAssemblylineRecipe(ItemStack aResearchItem, int aResearchTime, ItemStack[] aInputs, - FluidStack[] aFluidInputs, ItemStack aOutput, int aDuration, int aEUt); - - /** - * Adds a Assemblyline Recipe - * - * @param aInputs elements should be: ItemStack for single item; ItemStack[] for multiple equivalent items; - * {OreDict, amount} for oredict. - */ - @Deprecated - boolean addAssemblylineRecipe(ItemStack aResearchItem, int aResearchTime, Object[] aInputs, - FluidStack[] aFluidInputs, ItemStack aOutput1, int aDuration, int aEUt); - - @Deprecated - boolean addChemicalRecipe(ItemStack input1, ItemStack input2, FluidStack inputFluid, FluidStack outputFluid, - ItemStack output, int time, int eu); - - @Deprecated - boolean addChemicalRecipe(ItemStack input1, ItemStack input2, FluidStack inputFluid, FluidStack outputFluid, - ItemStack output, Object object, int time, int eu); - - @Deprecated - boolean addChemicalRecipe(ItemStack input1, ItemStack input2, FluidStack inputFluid, FluidStack outputFluid, - ItemStack output, ItemStack object, int time); - - @Deprecated - boolean addChemicalRecipe(ItemStack input1, ItemStack input2, int aCircuit, FluidStack inputFluid, - FluidStack outputFluid, ItemStack output, ItemStack output2, int time, int eu); - - @Deprecated - boolean addMultiblockChemicalRecipe(ItemStack[] itemStacks, FluidStack[] fluidStacks, FluidStack[] fluidStacks2, - ItemStack[] outputs, int time, int eu); - - @Deprecated - boolean addCompressorRecipe(ItemStack aInput1, ItemStack aOutput1, int aDuration, int aEUt); - - @Deprecated - boolean addBrewingRecipe(ItemStack aIngredient, FluidStack aInput, FluidStack aOutput, int aTime, int aEu, - boolean aHidden); - - @Deprecated - boolean addBrewingRecipe(int aCircuit, FluidStack aInput, FluidStack aOutput, int aTime, int aEu, boolean aHidden); - - @Deprecated - boolean addSmeltingAndAlloySmeltingRecipe(ItemStack aDust, ItemStack aOutput); - - @Deprecated - boolean addFluidExtractionRecipe(ItemStack input, FluidStack output, int aTime, int aEu); - - @Deprecated - boolean addFluidExtractionRecipe(ItemStack aContainer, ItemStack aFullContainer, FluidStack rFluidOut, int aTime, - int aEu); - - @Deprecated - boolean addFluidCannerRecipe(ItemStack aContainer, ItemStack aFullContainer, FluidStack rFluidIn); - - @Deprecated - boolean addFluidCannerRecipe(ItemStack aContainer, ItemStack aFullContainer, FluidStack rFluidIn, - FluidStack rFluidOut); - - @Deprecated - boolean addFluidCannerRecipe(ItemStack aContainer, ItemStack aFullContainer, FluidStack rFluidIn, - FluidStack rFluidOut, int aTime, int aEu); - - boolean addVacuumFurnaceRecipe(ItemStack aInput1, ItemStack aInput2, FluidStack aFluidInput, - FluidStack aFluidOutput, ItemStack aOutput1, ItemStack aOutput2, int aDuration, int aEUt, int aLevel); - - boolean addVacuumFurnaceRecipe(ItemStack[] aInputs, FluidStack[] aFluidInputs, ItemStack[] aOutputs, - FluidStack[] aFluidOutputs, int aDuration, int aEUt, int aLevel); - - @Deprecated - boolean addUvLaserRecipe(ItemStack aInput1, ItemStack aOutput, int time, long eu); - - boolean addChemicalPlantRecipe(ItemStack[] aInputs, FluidStack[] aInputFluids, ItemStack[] aOutputs, - FluidStack[] aFluidOutputs, int time, long eu, int aTier); - - boolean addChemicalPlantRecipe(ItemStack[] aInputs, FluidStack[] aInputFluids, ItemStack[] aOutputs, - FluidStack[] aFluidOutputs, int[] aChances, int time, long eu, int aTier); - - @Deprecated - boolean addBlastRecipe(ItemStack[] aInputs, FluidStack[] aInputFluids, ItemStack[] aOutputs, - FluidStack[] aFluidOutputs, int time, long eu, int aHeat); - - @Deprecated - boolean addPyrolyseRecipe(ItemStack aInput, FluidStack aFluidInput, int intCircuit, ItemStack aOutput, - FluidStack aFluidOutput, int aDuration, int aEUt); - - @Deprecated - boolean addExtractorRecipe(ItemStack aInput, ItemStack aOutput, int aDuration, int aEUt); - - @Deprecated - boolean addExtractorRecipe(ItemStack aInput, ItemStack aOutput, int aChance, int aDuration, int aEUt); - - @Deprecated - boolean addDistilleryRecipe(ItemStack aCircuit, FluidStack aInput, FluidStack aOutput, ItemStack aSolidOutput, - int aDuration, int aEUt, boolean aHidden); - - @Deprecated - boolean addPulverisationRecipe(final ItemStack aInput, ItemStack aOutput1, ItemStack aOutput2, - final ItemStack aOutput3); - - boolean addMillingRecipe(Materials aMat, int aEU); - - boolean addMillingRecipe(Material aMat, int aEU); - - boolean addFlotationRecipe(Materials aMat, ItemStack aXanthate, FluidStack[] aInputFluids, - FluidStack[] aOutputFluids, int aTime, int aEU); - - boolean addFlotationRecipe(Material aMat, ItemStack aXanthate, FluidStack[] aInputFluids, - FluidStack[] aOutputFluids, int aTime, int aEU); - - @Deprecated - boolean addpackagerRecipe(ItemStack aRecipeType, ItemStack aInput1, ItemStack aInput2, ItemStack aOutputStack1); - - boolean addFuelForRTG(ItemStack aFuelPellet, int aFuelDays, int aVoltage); - - boolean addColdTrapRecipe(int aCircuit, ItemStack aInput, FluidStack aFluidInput, ItemStack[] aOutputs, - int[] aChances, FluidStack aFluidOutput, int aTime, int aEU); - - boolean addReactorProcessingUnitRecipe(ItemStack aInput1, ItemStack aInput2, FluidStack aFluidInput, - ItemStack[] aOutputs, int[] aChances, FluidStack aFluidOutput, int aTime, int aEU); - - @Deprecated - boolean addFluidHeaterRecipe(ItemStack aCircuit, FluidStack aInput, FluidStack aOutput, int aDuration, int aEUt); - - @Deprecated - boolean addVacuumFreezerRecipe(ItemStack aInput, ItemStack aOutput, int aDuration, int aEU); - - boolean addMolecularTransformerRecipe(ItemStack aInput, ItemStack aOutput, int aDuration, int aEU); - - boolean addMolecularTransformerRecipe(ItemStack aInput, ItemStack aOutput, int aDuration, int aEU, int aAmps); -} diff --git a/gtpp/src/main/java/gtPlusPlus/xmod/gregtech/api/interfaces/internal/Interface_ItemBehaviour.java b/gtpp/src/main/java/gtPlusPlus/xmod/gregtech/api/interfaces/internal/Interface_ItemBehaviour.java deleted file mode 100644 index 545a97288f..0000000000 --- a/gtpp/src/main/java/gtPlusPlus/xmod/gregtech/api/interfaces/internal/Interface_ItemBehaviour.java +++ /dev/null @@ -1,46 +0,0 @@ -package gtPlusPlus.xmod.gregtech.api.interfaces.internal; - -import java.util.List; - -import net.minecraft.dispenser.IBlockSource; -import net.minecraft.entity.Entity; -import net.minecraft.entity.EntityLivingBase; -import net.minecraft.entity.player.EntityPlayer; -import net.minecraft.entity.projectile.EntityArrow; -import net.minecraft.item.Item; -import net.minecraft.item.ItemStack; -import net.minecraft.world.World; - -import gregtech.api.enums.SubTag; -import gtPlusPlus.xmod.gregtech.api.items.Gregtech_MetaItem_Base; - -public interface Interface_ItemBehaviour<E extends Item> { - - public boolean onLeftClickEntity(E aItem, ItemStack aStack, EntityPlayer aPlayer, Entity aEntity); - - public boolean onItemUse(E aItem, ItemStack aStack, EntityPlayer aPlayer, World aWorld, int aX, int aY, int aZ, - int aSide, float hitX, float hitY, float hitZ); - - public boolean onItemUseFirst(E aItem, ItemStack aStack, EntityPlayer aPlayer, World aWorld, int aX, int aY, int aZ, - int aSide, float hitX, float hitY, float hitZ); - - public ItemStack onItemRightClick(E aItem, ItemStack aStack, World aWorld, EntityPlayer aPlayer); - - public List<String> getAdditionalToolTips(E aItem, List<String> aList, ItemStack aStack); - - public void onUpdate(E aItem, ItemStack aStack, World aWorld, Entity aPlayer, int aTimer, boolean aIsInHand); - - public boolean isItemStackUsable(E aItem, ItemStack aStack); - - public boolean canDispense(E aItem, IBlockSource aSource, ItemStack aStack); - - public ItemStack onDispense(E aItem, IBlockSource aSource, ItemStack aStack); - - public boolean hasProjectile(Gregtech_MetaItem_Base aItem, SubTag aProjectileType, ItemStack aStack); - - public EntityArrow getProjectile(E aItem, SubTag aProjectileType, ItemStack aStack, World aWorld, double aX, - double aY, double aZ); - - public EntityArrow getProjectile(E aItem, SubTag aProjectileType, ItemStack aStack, World aWorld, - EntityLivingBase aEntity, float aSpeed); -} diff --git a/gtpp/src/main/java/gtPlusPlus/xmod/gregtech/api/interfaces/internal/Interface_OreRecipeRegistrator.java b/gtpp/src/main/java/gtPlusPlus/xmod/gregtech/api/interfaces/internal/Interface_OreRecipeRegistrator.java deleted file mode 100644 index 6ae25525bd..0000000000 --- a/gtpp/src/main/java/gtPlusPlus/xmod/gregtech/api/interfaces/internal/Interface_OreRecipeRegistrator.java +++ /dev/null @@ -1,24 +0,0 @@ -package gtPlusPlus.xmod.gregtech.api.interfaces.internal; - -import net.minecraft.item.ItemStack; - -import gregtech.api.enums.Materials; -import gtPlusPlus.xmod.gregtech.api.enums.GregtechOrePrefixes; -import gtPlusPlus.xmod.gregtech.api.enums.GregtechOrePrefixes.GT_Materials; - -public interface Interface_OreRecipeRegistrator { - - /** - * Contains a Code Fragment, used in the OrePrefix to register Recipes. Better than using a switch/case, like I did - * before. - * - * @param aPrefix always != null - * @param aMaterial always != null, and can be == _NULL if the Prefix is Self Referencing or not Material based! - * @param aStack always != null - */ - public void registerOre(GregtechOrePrefixes aPrefix, GT_Materials aMaterial, String aOreDictName, String aModName, - ItemStack aStack); - - public void registerOre(GregtechOrePrefixes aPrefix, Materials aMaterial, String aOreDictName, String aModName, - ItemStack copyAmount); -} diff --git a/gtpp/src/main/java/gtPlusPlus/xmod/gregtech/api/interfaces/internal/Interface_ToolStats.java b/gtpp/src/main/java/gtPlusPlus/xmod/gregtech/api/interfaces/internal/Interface_ToolStats.java deleted file mode 100644 index 97d952d4a1..0000000000 --- a/gtpp/src/main/java/gtPlusPlus/xmod/gregtech/api/interfaces/internal/Interface_ToolStats.java +++ /dev/null @@ -1,202 +0,0 @@ -package gtPlusPlus.xmod.gregtech.api.interfaces.internal; - -import java.util.List; - -import net.minecraft.block.Block; -import net.minecraft.enchantment.Enchantment; -import net.minecraft.entity.Entity; -import net.minecraft.entity.EntityLivingBase; -import net.minecraft.entity.player.EntityPlayer; -import net.minecraft.item.ItemStack; -import net.minecraft.util.DamageSource; -import net.minecraftforge.event.world.BlockEvent; - -import gregtech.api.interfaces.IIconContainer; -import gregtech.api.interfaces.IToolStats; -import gregtech.api.items.GT_MetaGenerated_Tool; -import gtPlusPlus.xmod.gregtech.api.items.Gregtech_MetaTool; - -/** - * The Stats for GT Tools. Not including any Material Modifiers. - * <p/> - * And this is supposed to not have any ItemStack Parameters as these are generic Stats. - */ -public interface Interface_ToolStats extends IToolStats { - - /** - * Called when aPlayer crafts this Tool - */ - @Override - public void onToolCrafted(ItemStack aStack, EntityPlayer aPlayer); - - /** - * Called when this gets added to a Tool Item - */ - public void onStatsAddedToTool(Gregtech_MetaTool gregtech_MetaTool, int aID); - - /** - * @return Damage the Tool receives when breaking a Block. 100 is one Damage Point (or 100 EU). - */ - @Override - public int getToolDamagePerBlockBreak(); - - /** - * @return Damage the Tool receives when converting the drops of a Block. 100 is one Damage Point (or 100 EU). - */ - @Override - public int getToolDamagePerDropConversion(); - - /** - * @return Damage the Tool receives when being used as Container Item. 100 is one use, however it is usually 8 times - * more than normal. - */ - @Override - public int getToolDamagePerContainerCraft(); - - /** - * @return Damage the Tool receives when being used as Weapon, 200 is the normal Value, 100 for actual Weapons. - */ - @Override - public int getToolDamagePerEntityAttack(); - - /** - * @return Basic Quality of the Tool, 0 is normal. If increased, it will increase the general quality of all Tools - * of this Type. Decreasing is also possible. - */ - @Override - public int getBaseQuality(); - - /** - * @return The Damage Bonus for this Type of Tool against Mobs. 1.0F is normal punch. - */ - @Override - public float getBaseDamage(); - - /** - * @return This gets the Hurt Resistance time for Entities getting hit. (always does 1 as minimum) - */ - @Override - public int getHurtResistanceTime(int aOriginalHurtResistance, Entity aEntity); - - /** - * @return This is a multiplier for the Tool Speed. 1.0F = no special Speed. - */ - @Override - public float getSpeedMultiplier(); - - /** - * @return This is a multiplier for the Tool Speed. 1.0F = no special Durability. - */ - @Override - public float getMaxDurabilityMultiplier(); - - @Override - public DamageSource getDamageSource(EntityLivingBase aPlayer, Entity aEntity); - - @Override - public String getMiningSound(); - - @Override - public String getCraftingSound(); - - @Override - public String getEntityHitSound(); - - @Override - public String getBreakingSound(); - - @Override - public Enchantment[] getEnchantments(ItemStack aStack); - - @Override - public int[] getEnchantmentLevels(ItemStack aStack); - - /** - * @return If this Tool can be used for blocking Damage like a Sword. - */ - @Override - public boolean canBlock(); - - /** - * @return If this Tool can be used as an RC Crowbar. - */ - @Override - public boolean isCrowbar(); - - /** - * @return If this Tool can be used as an BC Wrench. - */ - @Override - public boolean isWrench(); - - /** - * @return If this Tool can be used as Weapon i.e. if that is the main purpose. - */ - @Override - public boolean isWeapon(); - - /** - * @return If this Tool is a Ranged Weapon. Return false at isWeapon unless you have a Blade attached to your - * Bow/Gun or something - */ - @Override - public boolean isRangedWeapon(); - - /** - * @return If this Tool can be used as Weapon i.e. if that is the main purpose. - */ - @Override - public boolean isMiningTool(); - - /** - * aBlock.getHarvestTool(aMetaData) can return the following Values for example. "axe", "pickaxe", "sword", - * "shovel", "hoe", "grafter", "saw", "wrench", "crowbar", "file", "hammer", "plow", "plunger", "scoop", - * "screwdriver", "sense", "scythe", "softhammer", "cutter", "plasmatorch" - * - * @return If this is a minable Block. Tool Quality checks (like Diamond Tier or something) are separate from this - * check. - */ - @Override - public boolean isMinableBlock(Block aBlock, byte aMetaData); - - /** - * This lets you modify the Drop List, when this type of Tool has been used. - * - * @return the Amount of modified Items. - */ - @Override - public int convertBlockDrops(List<ItemStack> aDrops, ItemStack aStack, EntityPlayer aPlayer, Block aBlock, int aX, - int aY, int aZ, byte aMetaData, int aFortune, boolean aSilkTouch, BlockEvent.HarvestDropsEvent aEvent); - - /** - * @return Returns a broken Version of the Item. - */ - @Override - public ItemStack getBrokenItem(ItemStack aStack); - - /** - * @return the Damage actually done to the Mob. - */ - @Override - public float getNormalDamageAgainstEntity(float aOriginalDamage, Entity aEntity, ItemStack aStack, - EntityPlayer aPlayer); - - /** - * @return the Damage actually done to the Mob. - */ - @Override - public float getMagicDamageAgainstEntity(float aOriginalDamage, Entity aEntity, ItemStack aStack, - EntityPlayer aPlayer); - - @Override - public IIconContainer getIcon(boolean aIsToolHead, ItemStack aStack); - - @Override - public short[] getRGBa(boolean aIsToolHead, ItemStack aStack); - - /** - * Called when this gets added to a Tool Item - */ - @Override - public void onStatsAddedToTool(GT_MetaGenerated_Tool aItem, int aID); -} diff --git a/gtpp/src/main/java/gtPlusPlus/xmod/gregtech/api/items/Gregtech_Generic_Item.java b/gtpp/src/main/java/gtPlusPlus/xmod/gregtech/api/items/Gregtech_Generic_Item.java deleted file mode 100644 index 3ad04ab014..0000000000 --- a/gtpp/src/main/java/gtPlusPlus/xmod/gregtech/api/items/Gregtech_Generic_Item.java +++ /dev/null @@ -1,204 +0,0 @@ -package gtPlusPlus.xmod.gregtech.api.items; - -import static gregtech.api.enums.Mods.GTPlusPlus; - -import java.util.List; - -import net.minecraft.block.BlockDispenser; -import net.minecraft.client.renderer.texture.IIconRegister; -import net.minecraft.dispenser.BehaviorDefaultDispenseItem; -import net.minecraft.dispenser.BehaviorProjectileDispense; -import net.minecraft.dispenser.IBlockSource; -import net.minecraft.dispenser.IPosition; -import net.minecraft.entity.EntityLivingBase; -import net.minecraft.entity.IProjectile; -import net.minecraft.entity.player.EntityPlayer; -import net.minecraft.entity.projectile.EntityArrow; -import net.minecraft.item.Item; -import net.minecraft.item.ItemStack; -import net.minecraft.util.EnumFacing; -import net.minecraft.util.IIcon; -import net.minecraft.world.World; - -import cpw.mods.fml.common.registry.GameRegistry; -import cpw.mods.fml.relauncher.Side; -import cpw.mods.fml.relauncher.SideOnly; -import gregtech.api.enums.SubTag; -import gregtech.api.interfaces.IProjectileItem; -import gregtech.api.util.GT_LanguageManager; -import gregtech.api.util.GT_ModHandler; -import gregtech.api.util.GT_Utility; -import gtPlusPlus.core.creative.AddToCreativeTab; -import gtPlusPlus.core.util.Utils; - -/** - * Extended by most Items, also used as a fallback Item, to prevent the accidental deletion when Errors occur. - */ -public class Gregtech_Generic_Item extends Item implements IProjectileItem { - - private final String mName, mTooltip; - protected IIcon mIcon; - - public Gregtech_Generic_Item(final String aUnlocalized, final String aEnglish, final String aEnglishTooltip) { - this(aUnlocalized, aEnglish, aEnglishTooltip, true); - } - - public Gregtech_Generic_Item(final String aUnlocalized, final String aEnglish, final String aEnglishTooltip, - final boolean aWriteToolTipIntoLangFile) { - super(); - this.mName = aUnlocalized; - GT_LanguageManager.addStringLocalization(this.mName + ".name", aEnglish); - if (GT_Utility.isStringValid(aEnglishTooltip)) { - GT_LanguageManager.addStringLocalization( - this.mTooltip = this.mName + ".tooltip_main", - aEnglishTooltip, - aWriteToolTipIntoLangFile); - } else { - this.mTooltip = null; - } - this.setCreativeTab(AddToCreativeTab.tabMachines); - GameRegistry.registerItem(this, this.mName, GTPlusPlus.ID); - BlockDispenser.dispenseBehaviorRegistry.putObject(this, new GT_Item_Dispense()); - } - - @Override - public final Item setUnlocalizedName(final String aName) { - return this; - } - - @Override - public final String getUnlocalizedName() { - return this.mName; - } - - @Override - public String getUnlocalizedName(final ItemStack aStack) { - return this.getHasSubtypes() ? this.mName + "." + this.getDamage(aStack) : this.mName; - } - - @Override - @SideOnly(Side.CLIENT) - public void registerIcons(final IIconRegister aIconRegister) { - this.mIcon = aIconRegister.registerIcon(GTPlusPlus.ID + ":" + this.mName); - } - - @Override - public boolean doesSneakBypassUse(final World aWorld, final int aX, final int aY, final int aZ, - final EntityPlayer aPlayer) { - return true; - } - - @Override - public IIcon getIconFromDamage(final int par1) { - return this.mIcon; - } - - public int getTier(final ItemStack aStack) { - return 0; - } - - @Override - public void addInformation(final ItemStack aStack, final EntityPlayer aPlayer, final List aList, - final boolean aF3_H) { - if ((this.getMaxDamage() > 0) && !this.getHasSubtypes()) { - aList.add((aStack.getMaxDamage() - this.getDamage(aStack)) + " / " + aStack.getMaxDamage()); - } - if (this.mTooltip != null) { - aList.add(GT_LanguageManager.getTranslation(this.mTooltip)); - } - if (GT_ModHandler.isElectricItem(aStack)) { - aList.add("Tier: " + this.getTier(aStack)); - } - this.addAdditionalToolTips(aList, aStack); - } - - protected void addAdditionalToolTips(final List aList, final ItemStack aStack) { - // - } - - @Override - public void onCreated(final ItemStack aStack, final World aWorld, final EntityPlayer aPlayer) { - this.isItemStackUsable(aStack); - } - - public boolean isItemStackUsable(final ItemStack aStack) { - return true; - } - - public ItemStack onDispense(final IBlockSource aSource, final ItemStack aStack) { - final EnumFacing enumfacing = BlockDispenser.func_149937_b(aSource.getBlockMetadata()); - final IPosition iposition = BlockDispenser.func_149939_a(aSource); - final ItemStack itemstack1 = aStack.splitStack(1); - BehaviorDefaultDispenseItem.doDispense(aSource.getWorld(), itemstack1, 6, enumfacing, iposition); - return aStack; - } - - @Override - public EntityArrow getProjectile(final SubTag aProjectileType, final ItemStack aStack, final World aWorld, - final double aX, final double aY, final double aZ) { - return null; - } - - @Override - public EntityArrow getProjectile(final SubTag aProjectileType, final ItemStack aStack, final World aWorld, - final EntityLivingBase aEntity, final float aSpeed) { - return null; - } - - @Override - public boolean hasProjectile(final SubTag aProjectileType, final ItemStack aStack) { - return false; - } - - @Override - public ItemStack getContainerItem(final ItemStack aStack) { - return null; - } - - @Override - public boolean hasContainerItem(final ItemStack aStack) { - return this.getContainerItem(aStack) != null; - } - - public static class GT_Item_Dispense extends BehaviorProjectileDispense { - - @Override - public ItemStack dispenseStack(final IBlockSource aSource, final ItemStack aStack) { - return ((Gregtech_Generic_Item) aStack.getItem()).onDispense(aSource, aStack); - } - - @Override - protected IProjectile getProjectileEntity(final World aWorld, final IPosition aPosition) { - return null; - } - } - - @Override - public int getColorFromItemStack(final ItemStack stack, int HEX_OxFFFFFF) { - if (stack.getDisplayName() - .contains("LuV")) { - HEX_OxFFFFFF = 0xffffcc; - } else if (stack.getDisplayName() - .contains("ZPM")) { - HEX_OxFFFFFF = 0xace600; - } else if (stack.getDisplayName() - .contains("UV")) { - HEX_OxFFFFFF = 0xffff00; - } else if (stack.getDisplayName() - .contains("MAX")) { - HEX_OxFFFFFF = 0xff0000; - } else if (stack.getDisplayName() - .contains("Sodium")) { - HEX_OxFFFFFF = Utils.rgbtoHexValue(0, 0, 150); - } else if (stack.getDisplayName() - .contains("Cadmium")) { - HEX_OxFFFFFF = Utils.rgbtoHexValue(50, 50, 60); - } else if (stack.getDisplayName() - .contains("Lithium")) { - HEX_OxFFFFFF = Utils.rgbtoHexValue(225, 220, 255); - } else { - HEX_OxFFFFFF = 0xffffff; - } - return HEX_OxFFFFFF; - } -} diff --git a/gtpp/src/main/java/gtPlusPlus/xmod/gregtech/api/items/Gregtech_MetaItem.java b/gtpp/src/main/java/gtPlusPlus/xmod/gregtech/api/items/Gregtech_MetaItem.java deleted file mode 100644 index 015ba9d716..0000000000 --- a/gtpp/src/main/java/gtPlusPlus/xmod/gregtech/api/items/Gregtech_MetaItem.java +++ /dev/null @@ -1,357 +0,0 @@ -package gtPlusPlus.xmod.gregtech.api.items; - -import static gregtech.api.enums.GT_Values.D1; -import static gregtech.api.enums.Mods.GTPlusPlus; - -import java.util.ArrayList; -import java.util.Arrays; -import java.util.BitSet; -import java.util.HashMap; -import java.util.List; - -import net.minecraft.client.renderer.texture.IIconRegister; -import net.minecraft.creativetab.CreativeTabs; -import net.minecraft.entity.player.EntityPlayer; -import net.minecraft.item.EnumAction; -import net.minecraft.item.Item; -import net.minecraft.item.ItemStack; -import net.minecraft.util.IIcon; -import net.minecraft.world.World; - -import cpw.mods.fml.relauncher.Side; -import cpw.mods.fml.relauncher.SideOnly; -import gregtech.api.GregTech_API; -import gregtech.api.enums.Materials; -import gregtech.api.enums.SubTag; -import gregtech.api.enums.TC_Aspects.TC_AspectStack; -import gregtech.api.interfaces.IFoodStat; -import gregtech.api.interfaces.IIconContainer; -import gregtech.api.interfaces.IItemContainer; -import gregtech.api.objects.ItemData; -import gregtech.api.util.GT_LanguageManager; -import gregtech.api.util.GT_OreDictUnificator; -import gregtech.api.util.GT_Utility; -import gtPlusPlus.core.creative.AddToCreativeTab; -import gtPlusPlus.xmod.gregtech.api.interfaces.internal.Interface_ItemBehaviour; - -public abstract class Gregtech_MetaItem extends Gregtech_MetaItem_Base { - - /** - * All instances of this Item Class are listed here. This gets used to register the Renderer to all Items of this - * Type, if useStandardMetaItemRenderer() returns true. - * <p/> - * You can also use the unlocalized Name gotten from getUnlocalizedName() as Key if you want to get a specific Item. - */ - public static final HashMap<String, Gregtech_MetaItem> sInstances = new HashMap<>(); - - /* ---------- CONSTRUCTOR AND MEMBER VARIABLES ---------- */ - - public final short mOffset, mItemAmount; - public final BitSet mEnabledItems; - public final BitSet mVisibleItems; - public final IIcon[][] mIconList; - - public final HashMap<Short, IFoodStat> mFoodStats = new HashMap<>(); - public final HashMap<Short, Long[]> mElectricStats = new HashMap<>(); - public final HashMap<Short, Long[]> mFluidContainerStats = new HashMap<>(); - public final HashMap<Short, Short> mBurnValues = new HashMap<>(); - - /** - * Creates the Item using these Parameters. - * - * @param aUnlocalized The Unlocalized Name of this Item. - */ - public Gregtech_MetaItem(final String aUnlocalized, final short aOffset, final short aItemAmount) { - super(aUnlocalized); - this.setCreativeTab(AddToCreativeTab.tabMachines); - this.setHasSubtypes(true); - this.setMaxDamage(0); - this.mEnabledItems = new BitSet(aItemAmount); - this.mVisibleItems = new BitSet(aItemAmount); - - this.mOffset = (short) Math.min(32766, aOffset); - this.mItemAmount = (short) Math.min(aItemAmount, 32766 - this.mOffset); - this.mIconList = new IIcon[aItemAmount][1]; - - sInstances.put(this.getUnlocalizedName(), this); - } - - /** - * This adds a Custom Item to the ending Range. - * - * @param aID The Id of the assigned Item [0 - mItemAmount] (The MetaData gets auto-shifted by +mOffset) - * @param aEnglish The Default Localized Name of the created Item - * @param aToolTip The Default ToolTip of the created Item, you can also insert null for having no ToolTip - * @param aFoodBehavior The Food Value of this Item. Can be null aswell. Just a convenience thing. - * @param aRandomData The OreDict Names you want to give the Item. Also used for TC Aspects and some other things. - * @return An ItemStack containing the newly created Item. - */ - public final ItemStack addItem(final int aID, final String aEnglish, String aToolTip, final Object... aRandomData) { - if (aToolTip == null) { - aToolTip = ""; - } - if ((aID >= 0) && (aID < this.mItemAmount)) { - final ItemStack rStack = new ItemStack(this, 1, this.mOffset + aID); - this.mEnabledItems.set(aID); - this.mVisibleItems.set(aID); - GT_LanguageManager.addStringLocalization(this.getUnlocalizedName(rStack) + ".name", aEnglish); - GT_LanguageManager.addStringLocalization(this.getUnlocalizedName(rStack) + ".tooltip", aToolTip); - final List<TC_AspectStack> tAspects = new ArrayList<>(); - // Important Stuff to do first - for (final Object tRandomData : aRandomData) { - if (tRandomData instanceof SubTag) { - if (tRandomData == SubTag.INVISIBLE) { - this.mVisibleItems.set(aID, false); - continue; - } - if (tRandomData == SubTag.NO_UNIFICATION) { - GT_OreDictUnificator.addToBlacklist(rStack); - continue; - } - } - } - // now check for the rest - for (final Object tRandomData : aRandomData) { - if (tRandomData != null) { - boolean tUseOreDict = true; - - if (tRandomData instanceof Interface_ItemBehaviour) { - this.addItemBehavior( - this.mOffset + aID, - (Interface_ItemBehaviour<Gregtech_MetaItem_Base>) tRandomData); - tUseOreDict = false; - } - if (tRandomData instanceof IItemContainer) { - ((IItemContainer) tRandomData).set(rStack); - tUseOreDict = false; - } - if (tRandomData instanceof SubTag) { - continue; - } - if (tRandomData instanceof TC_AspectStack) { - ((TC_AspectStack) tRandomData).addToAspectList(tAspects); - continue; - } - if (tRandomData instanceof ItemData) { - if (GT_Utility.isStringValid(tRandomData)) { - GT_OreDictUnificator.registerOre(tRandomData, rStack); - } else { - GT_OreDictUnificator.addItemData(rStack, (ItemData) tRandomData); - } - continue; - } - if (tUseOreDict) { - GT_OreDictUnificator.registerOre(tRandomData, rStack); - continue; - } - } - } - if (GregTech_API.sThaumcraftCompat != null) { - GregTech_API.sThaumcraftCompat.registerThaumcraftAspectsToItem(rStack, tAspects, false); - } - return rStack; - } - return null; - } - - /** - * Sets the Furnace Burn Value for the Item. - * - * @param aMetaValue the Meta Value of the Item you want to set it to. [0 - 32765] - * @param aValue 200 = 1 Burn Process = 500 EU, max = 32767 (that is 81917.5 EU) - * @return the Item itself for convenience in constructing. - */ - public final Gregtech_MetaItem setBurnValue(final int aMetaValue, final int aValue) { - if ((aMetaValue < 0) || (aMetaValue >= (this.mOffset + this.mEnabledItems.length())) || (aValue < 0)) { - return this; - } - if (aValue == 0) { - this.mBurnValues.remove((short) aMetaValue); - } else { - this.mBurnValues.put((short) aMetaValue, aValue > Short.MAX_VALUE ? Short.MAX_VALUE : (short) aValue); - } - return this; - } - - /** - * @param aMetaValue the Meta Value of the Item you want to set it to. [0 - 32765] - * @param aMaxCharge Maximum Charge. (if this is == 0 it will remove the Electric Behavior) - * @param aTransferLimit Transfer Limit. - * @param aTier The electric Tier. - * @param aSpecialData If this Item has a Fixed Charge, like a SingleUse Battery (if > 0). Use -1 if you want to - * make this Battery chargeable (the use and canUse Functions will still discharge if you just - * use this) Use -2 if you want to make this Battery dischargeable. Use -3 if you want to make - * this Battery charge/discharge-able. - * @return the Item itself for convenience in constructing. - */ - public final Gregtech_MetaItem setElectricStats(final int aMetaValue, final long aMaxCharge, - final long aTransferLimit, final long aTier, final long aSpecialData, final boolean aUseAnimations) { - if ((aMetaValue < 0) || (aMetaValue >= (this.mOffset + this.mEnabledItems.length()))) { - return this; - } - if (aMaxCharge == 0) { - this.mElectricStats.remove((short) aMetaValue); - } else { - this.mElectricStats.put( - (short) aMetaValue, - new Long[] { aMaxCharge, Math.max(0, aTransferLimit), Math.max(-1, aTier), aSpecialData }); - if ((aMetaValue >= this.mOffset) && aUseAnimations) { - this.mIconList[aMetaValue - this.mOffset] = Arrays.copyOf( - this.mIconList[aMetaValue - this.mOffset], - Math.max(9, this.mIconList[aMetaValue - this.mOffset].length)); - } - } - return this; - } - - /** - * @param aMetaValue the Meta Value of the Item you want to set it to. [0 - 32765] - * @param aMaxCharge Maximum Charge. (if this is == 0 it will remove the Electric Behavior) - * @param aTransferLimit Transfer Limit. - * @param aTier The electric Tier. - * @param aSpecialData If this Item has a Fixed Charge, like a SingleUse Battery (if > 0). Use -1 if you want to - * make this Battery chargeable (the use and canUse Functions will still discharge if you just - * use this) Use -2 if you want to make this Battery dischargeable. Use -3 if you want to make - * this Battery charge/discharge-able. - * @return the Item itself for convenience in constructing. - */ - public final Gregtech_MetaItem setFluidContainerStats(final int aMetaValue, final long aCapacity, - final long aStacksize) { - if ((aMetaValue < 0) || (aMetaValue >= (this.mOffset + this.mEnabledItems.length()))) { - return this; - } - if (aCapacity < 0) { - this.mElectricStats.remove((short) aMetaValue); - } else { - this.mFluidContainerStats.put((short) aMetaValue, new Long[] { aCapacity, Math.max(1, aStacksize) }); - } - return this; - } - - /** - * @return if this MetaGenerated Item should use my Default Renderer System. - */ - public boolean useStandardMetaItemRenderer() { - return true; - } - - /** - * @return the Color Modulation the Material is going to be rendered with. - */ - public short[] getRGBa(final ItemStack aStack) { - return Materials._NULL.getRGBA(); - } - - /** - * @return the Icon the Material is going to be rendered with. - */ - public IIconContainer getIconContainer(final int aMetaData) { - return null; - } - - /* ---------- INTERNAL OVERRIDES ---------- */ - - @Override - public ItemStack onItemRightClick(final ItemStack aStack, final World aWorld, final EntityPlayer aPlayer) { - return super.onItemRightClick(aStack, aWorld, aPlayer); - } - - @Override - public int getMaxItemUseDuration(final ItemStack aStack) { - return this.mFoodStats.get((short) this.getDamage(aStack)) == null ? 0 : 32; - } - - @Override - public EnumAction getItemUseAction(final ItemStack aStack) { - return EnumAction.none; - } - - @Override - public final ItemStack onEaten(final ItemStack aStack, final World aWorld, final EntityPlayer aPlayer) { - final IFoodStat tStat = this.mFoodStats.get((short) this.getDamage(aStack)); - if (tStat != null) {} - - return aStack; - } - - @Override - @SideOnly(Side.CLIENT) - public void getSubItems(final Item var1, final CreativeTabs aCreativeTab, final List aList) { - for (int i = 0, j = this.mEnabledItems.length(); i < j; i++) { - if (this.mVisibleItems.get(i) || (D1 && this.mEnabledItems.get(i))) { - final Long[] tStats = this.mElectricStats.get((short) (this.mOffset + i)); - if ((tStats != null) && (tStats[3] < 0)) { - final ItemStack tStack = new ItemStack(this, 1, this.mOffset + i); - this.setCharge(tStack, Math.abs(tStats[0])); - this.isItemStackUsable(tStack); - aList.add(tStack); - } - if ((tStats == null) || (tStats[3] != -2)) { - final ItemStack tStack = new ItemStack(this, 1, this.mOffset + i); - this.isItemStackUsable(tStack); - aList.add(tStack); - } - } - } - } - - @Override - @SideOnly(Side.CLIENT) - public final void registerIcons(final IIconRegister aIconRegister) { - for (short i = 0, j = (short) this.mEnabledItems.length(); i < j; i++) { - if (this.mEnabledItems.get(i)) { - for (byte k = 1; k < this.mIconList[i].length; k++) { - this.mIconList[i][k] = aIconRegister - .registerIcon(GTPlusPlus.ID + ":" + this.getUnlocalizedName() + "/" + i + "/" + k); - } - this.mIconList[i][0] = aIconRegister - .registerIcon(GTPlusPlus.ID + ":" + this.getUnlocalizedName() + "/" + i); - } - } - } - - @Override - public final Long[] getElectricStats(final ItemStack aStack) { - return this.mElectricStats.get((short) aStack.getItemDamage()); - } - - @Override - public final Long[] getFluidContainerStats(final ItemStack aStack) { - return this.mFluidContainerStats.get((short) aStack.getItemDamage()); - } - - @Override - public int getItemEnchantability() { - return 0; - } - - @Override - public boolean isBookEnchantable(final ItemStack aStack, final ItemStack aBook) { - return false; - } - - @Override - public boolean getIsRepairable(final ItemStack aStack, final ItemStack aMaterial) { - return false; - } - - @Override - public int getColorFromItemStack(final ItemStack stack, int HEX_OxFFFFFF) { - if (stack.getDisplayName() - .contains("LuV")) { - HEX_OxFFFFFF = 0xffffcc; - } else if (stack.getDisplayName() - .contains("ZPM")) { - HEX_OxFFFFFF = 0xace600; - } else if (stack.getDisplayName() - .contains("UV")) { - HEX_OxFFFFFF = 0xffff00; - } else if (stack.getDisplayName() - .contains("MAX")) { - HEX_OxFFFFFF = 0xff0000; - } else { - HEX_OxFFFFFF = 0xffffff; - } - return HEX_OxFFFFFF; - } -} diff --git a/gtpp/src/main/java/gtPlusPlus/xmod/gregtech/api/items/Gregtech_MetaItem_Base.java b/gtpp/src/main/java/gtPlusPlus/xmod/gregtech/api/items/Gregtech_MetaItem_Base.java deleted file mode 100644 index 3c4418c2bf..0000000000 --- a/gtpp/src/main/java/gtPlusPlus/xmod/gregtech/api/items/Gregtech_MetaItem_Base.java +++ /dev/null @@ -1,745 +0,0 @@ -package gtPlusPlus.xmod.gregtech.api.items; - -import static gregtech.api.enums.GT_Values.D1; -import static gregtech.api.enums.GT_Values.V; - -import java.util.ArrayList; -import java.util.HashMap; -import java.util.List; - -import net.minecraft.dispenser.IBlockSource; -import net.minecraft.entity.Entity; -import net.minecraft.entity.EntityLivingBase; -import net.minecraft.entity.player.EntityPlayer; -import net.minecraft.entity.projectile.EntityArrow; -import net.minecraft.inventory.Container; -import net.minecraft.item.Item; -import net.minecraft.item.ItemStack; -import net.minecraft.nbt.NBTTagCompound; -import net.minecraft.util.EnumChatFormatting; -import net.minecraft.world.World; -import net.minecraftforge.fluids.FluidStack; -import net.minecraftforge.fluids.IFluidContainerItem; - -import gregtech.api.enums.SubTag; -import gregtech.api.util.GT_LanguageManager; -import gregtech.api.util.GT_Log; -import gregtech.api.util.GT_ModHandler; -import gregtech.api.util.GT_Utility; -import gtPlusPlus.core.util.Utils; -import gtPlusPlus.xmod.gregtech.api.interfaces.internal.Interface_ItemBehaviour; -import ic2.api.item.ElectricItem; -import ic2.api.item.IElectricItem; -import ic2.api.item.IElectricItemManager; -import ic2.api.item.ISpecialElectricItem; - -public abstract class Gregtech_MetaItem_Base extends Gregtech_Generic_Item - implements ISpecialElectricItem, IElectricItemManager, IFluidContainerItem { - - /* ---------- CONSTRUCTOR AND MEMBER VARIABLES ---------- */ - private final HashMap<Short, ArrayList<Interface_ItemBehaviour<Gregtech_MetaItem_Base>>> mItemBehaviors = new HashMap<>(); - - /** - * Creates the Item using these Parameters. - * - * @param aUnlocalized The Unlocalized Name of this Item. - * @param aGeneratedPrefixList The OreDict Prefixes you want to have generated. - */ - public Gregtech_MetaItem_Base(final String aUnlocalized) { - super(aUnlocalized, "Generated Item", null, false); - this.setHasSubtypes(true); - this.setMaxDamage(0); - } - - /** - * Adds a special Item Behaviour to the Item. - * <p/> - * Note: the boolean Behaviours sometimes won't be executed if another boolean Behaviour returned true before. - * - * @param aMetaValue the Meta Value of the Item you want to add it to. [0 - 32765] - * @param aBehavior the Click Behavior you want to add. - * @return the Item itself for convenience in constructing. - */ - public final Gregtech_MetaItem_Base addItemBehavior(final int aMetaValue, - final Interface_ItemBehaviour<Gregtech_MetaItem_Base> aBehavior) { - if ((aMetaValue < 0) || (aMetaValue >= 32766) || (aBehavior == null)) { - return this; - } - ArrayList<Interface_ItemBehaviour<Gregtech_MetaItem_Base>> tList = this.mItemBehaviors.get((short) aMetaValue); - if (tList == null) { - tList = new ArrayList<>(1); - this.mItemBehaviors.put((short) aMetaValue, tList); - } - tList.add(aBehavior); - return this; - } - - public abstract Long[] getElectricStats(ItemStack aStack); - - public abstract Long[] getFluidContainerStats(ItemStack aStack); - - @Override - public boolean hasProjectile(final SubTag aProjectileType, final ItemStack aStack) { - final ArrayList<Interface_ItemBehaviour<Gregtech_MetaItem_Base>> tList = this.mItemBehaviors - .get((short) this.getDamage(aStack)); - if (tList != null) { - for (final Interface_ItemBehaviour<Gregtech_MetaItem_Base> tBehavior : tList) { - if (tBehavior.hasProjectile(this, aProjectileType, aStack)) { - return true; - } - } - } - return super.hasProjectile(aProjectileType, aStack); - } - - @Override - public EntityArrow getProjectile(final SubTag aProjectileType, final ItemStack aStack, final World aWorld, - final double aX, final double aY, final double aZ) { - final ArrayList<Interface_ItemBehaviour<Gregtech_MetaItem_Base>> tList = this.mItemBehaviors - .get((short) this.getDamage(aStack)); - if (tList != null) { - for (final Interface_ItemBehaviour<Gregtech_MetaItem_Base> tBehavior : tList) { - final EntityArrow rArrow = tBehavior.getProjectile(this, aProjectileType, aStack, aWorld, aX, aY, aZ); - if (rArrow != null) { - return rArrow; - } - } - } - return super.getProjectile(aProjectileType, aStack, aWorld, aX, aY, aZ); - } - - @Override - public EntityArrow getProjectile(final SubTag aProjectileType, final ItemStack aStack, final World aWorld, - final EntityLivingBase aEntity, final float aSpeed) { - final ArrayList<Interface_ItemBehaviour<Gregtech_MetaItem_Base>> tList = this.mItemBehaviors - .get((short) this.getDamage(aStack)); - if (tList != null) { - for (final Interface_ItemBehaviour<Gregtech_MetaItem_Base> tBehavior : tList) { - final EntityArrow rArrow = tBehavior - .getProjectile(this, aProjectileType, aStack, aWorld, aEntity, aSpeed); - if (rArrow != null) { - return rArrow; - } - } - } - return super.getProjectile(aProjectileType, aStack, aWorld, aEntity, aSpeed); - } - - @Override - public ItemStack onDispense(final IBlockSource aSource, final ItemStack aStack) { - final ArrayList<Interface_ItemBehaviour<Gregtech_MetaItem_Base>> tList = this.mItemBehaviors - .get((short) this.getDamage(aStack)); - if (tList != null) { - for (final Interface_ItemBehaviour<Gregtech_MetaItem_Base> tBehavior : tList) { - if (tBehavior.canDispense(this, aSource, aStack)) { - return tBehavior.onDispense(this, aSource, aStack); - } - } - } - return super.onDispense(aSource, aStack); - } - - @Override - public boolean isItemStackUsable(final ItemStack aStack) { - final ArrayList<Interface_ItemBehaviour<Gregtech_MetaItem_Base>> tList = this.mItemBehaviors - .get((short) this.getDamage(aStack)); - if (tList != null) { - for (final Interface_ItemBehaviour<Gregtech_MetaItem_Base> tBehavior : tList) { - if (!tBehavior.isItemStackUsable(this, aStack)) { - return false; - } - } - } - return super.isItemStackUsable(aStack); - } - - @Override - public boolean onLeftClickEntity(final ItemStack aStack, final EntityPlayer aPlayer, final Entity aEntity) { - this.use(aStack, 0, aPlayer); - this.isItemStackUsable(aStack); - final ArrayList<Interface_ItemBehaviour<Gregtech_MetaItem_Base>> tList = this.mItemBehaviors - .get((short) this.getDamage(aStack)); - if (tList != null) { - for (final Interface_ItemBehaviour<Gregtech_MetaItem_Base> tBehavior : tList) { - try { - if (tBehavior.onLeftClickEntity(this, aStack, aPlayer, aEntity)) { - if (aStack.stackSize <= 0) { - aPlayer.destroyCurrentEquippedItem(); - } - return true; - } - if (aStack.stackSize <= 0) { - aPlayer.destroyCurrentEquippedItem(); - return false; - } - } catch (final Throwable e) { - if (D1) { - e.printStackTrace(GT_Log.err); - } - } - } - } - return false; - } - - @Override - public boolean onItemUse(final ItemStack aStack, final EntityPlayer aPlayer, final World aWorld, final int aX, - final int aY, final int aZ, final int ordinalSide, final float hitX, final float hitY, final float hitZ) { - this.use(aStack, 0, aPlayer); - this.isItemStackUsable(aStack); - final ArrayList<Interface_ItemBehaviour<Gregtech_MetaItem_Base>> tList = this.mItemBehaviors - .get((short) this.getDamage(aStack)); - if (tList != null) { - for (final Interface_ItemBehaviour<Gregtech_MetaItem_Base> tBehavior : tList) { - try { - if (tBehavior.onItemUse(this, aStack, aPlayer, aWorld, aX, aY, aZ, ordinalSide, hitX, hitY, hitZ)) { - if (aStack.stackSize <= 0) { - aPlayer.destroyCurrentEquippedItem(); - } - return true; - } - if (aStack.stackSize <= 0) { - aPlayer.destroyCurrentEquippedItem(); - return false; - } - } catch (final Throwable e) { - if (D1) { - e.printStackTrace(GT_Log.err); - } - } - } - } - return false; - } - - @Override - public boolean onItemUseFirst(final ItemStack aStack, final EntityPlayer aPlayer, final World aWorld, final int aX, - final int aY, final int aZ, final int ordinalSide, final float hitX, final float hitY, final float hitZ) { - this.use(aStack, 0, aPlayer); - this.isItemStackUsable(aStack); - final ArrayList<Interface_ItemBehaviour<Gregtech_MetaItem_Base>> tList = this.mItemBehaviors - .get((short) this.getDamage(aStack)); - if (tList != null) { - for (final Interface_ItemBehaviour<Gregtech_MetaItem_Base> tBehavior : tList) { - try { - if (tBehavior - .onItemUseFirst(this, aStack, aPlayer, aWorld, aX, aY, aZ, ordinalSide, hitX, hitY, hitZ)) { - if (aStack.stackSize <= 0) { - aPlayer.destroyCurrentEquippedItem(); - } - return true; - } - if (aStack.stackSize <= 0) { - aPlayer.destroyCurrentEquippedItem(); - return false; - } - } catch (final Throwable e) { - if (D1) { - e.printStackTrace(GT_Log.err); - } - } - } - } - return false; - } - - @Override - public ItemStack onItemRightClick(ItemStack aStack, final World aWorld, final EntityPlayer aPlayer) { - this.use(aStack, 0, aPlayer); - this.isItemStackUsable(aStack); - final ArrayList<Interface_ItemBehaviour<Gregtech_MetaItem_Base>> tList = this.mItemBehaviors - .get((short) this.getDamage(aStack)); - if (tList != null) { - for (final Interface_ItemBehaviour<Gregtech_MetaItem_Base> tBehavior : tList) { - try { - aStack = tBehavior.onItemRightClick(this, aStack, aWorld, aPlayer); - } catch (final Throwable e) { - if (D1) { - e.printStackTrace(GT_Log.err); - } - } - } - } - return aStack; - } - - @Override - public final void addInformation(final ItemStack aStack, final EntityPlayer aPlayer, List aList, - final boolean aF3_H) { - final String tKey = this.getUnlocalizedName(aStack) + ".tooltip", - tString = GT_LanguageManager.getTranslation(tKey); - if (GT_Utility.isStringValid(tString) && !tKey.equals(tString)) { - aList.add(tString); - } - - Long[] tStats = this.getElectricStats(aStack); - if (tStats != null) { - if (tStats[3] > 0) { - aList.add( - EnumChatFormatting.AQUA + "Contains " - + GT_Utility.formatNumbers(tStats[3]) - + " EU Tier: " - + (tStats[2] >= 0 ? tStats[2] : 0) - + EnumChatFormatting.GRAY); - } else { - final long tCharge = this.getRealCharge(aStack); - if ((tStats[3] == -2) && (tCharge <= 0)) { - aList.add( - EnumChatFormatting.AQUA + "Empty. You should recycle it properly." + EnumChatFormatting.GRAY); - } else { - aList.add( - EnumChatFormatting.AQUA + "" - + GT_Utility.formatNumbers(tCharge) - + " / " - + GT_Utility.formatNumbers(Math.abs(tStats[0])) - + " EU - Voltage: " - + GT_Utility.formatNumbers( - V[(int) (tStats[2] >= 0 ? tStats[2] < V.length ? tStats[2] : V.length - 1 : 1)]) - + EnumChatFormatting.GRAY); - } - } - } - - tStats = this.getFluidContainerStats(aStack); - if ((tStats != null) && (tStats[0] > 0)) { - final FluidStack tFluid = this.getFluidContent(aStack); - aList.add( - EnumChatFormatting.BLUE - + ((tFluid == null ? "No Fluids Contained" : GT_Utility.getFluidName(tFluid, true))) - + EnumChatFormatting.GRAY); - aList.add( - EnumChatFormatting.BLUE - + (GT_Utility.formatNumbers(tFluid == null ? 0 : tFluid.amount) + "L / " - + GT_Utility.formatNumbers(tStats[0]) - + "L") - + EnumChatFormatting.GRAY); - } - - final ArrayList<Interface_ItemBehaviour<Gregtech_MetaItem_Base>> tList = this.mItemBehaviors - .get((short) this.getDamage(aStack)); - if (tList != null) { - for (final Interface_ItemBehaviour<Gregtech_MetaItem_Base> tBehavior : tList) { - aList = tBehavior.getAdditionalToolTips(this, aList, aStack); - } - } - - this.addAdditionalToolTips(aList, aStack); - } - - @Override - public void onUpdate(final ItemStack aStack, final World aWorld, final Entity aPlayer, final int aTimer, - final boolean aIsInHand) { - final ArrayList<Interface_ItemBehaviour<Gregtech_MetaItem_Base>> tList = this.mItemBehaviors - .get((short) this.getDamage(aStack)); - if (tList != null) { - for (final Interface_ItemBehaviour<Gregtech_MetaItem_Base> tBehavior : tList) { - tBehavior.onUpdate(this, aStack, aWorld, aPlayer, aTimer, aIsInHand); - } - } - } - - @Override - public final boolean canProvideEnergy(final ItemStack aStack) { - final Long[] tStats = this.getElectricStats(aStack); - if (tStats == null) { - return false; - } - return (tStats[3] > 0) || ((aStack.stackSize == 1) && ((tStats[3] == -2) || (tStats[3] == -3))); - } - - @Override - public final double getMaxCharge(final ItemStack aStack) { - final Long[] tStats = this.getElectricStats(aStack); - if (tStats == null) { - return 0; - } - return Math.abs(tStats[0]); - } - - @Override - public final double getTransferLimit(final ItemStack aStack) { - final Long[] tStats = this.getElectricStats(aStack); - if (tStats == null) { - return 0; - } - return Math.max(tStats[1], tStats[3]); - } - - @Override - public final double charge(final ItemStack aStack, final double aCharge, final int aTier, - final boolean aIgnoreTransferLimit, final boolean aSimulate) { - final Long[] tStats = this.getElectricStats(aStack); - if ((tStats == null) || (tStats[2] > aTier) - || !((tStats[3] == -1) || (tStats[3] == -3) || ((tStats[3] < 0) && (aCharge == Integer.MAX_VALUE))) - || (aStack.stackSize != 1)) { - return 0; - } - final long tChargeBefore = this.getRealCharge(aStack), - tNewCharge = aCharge == Integer.MAX_VALUE ? Long.MAX_VALUE - : Math.min( - Math.abs(tStats[0]), - tChargeBefore + (aIgnoreTransferLimit ? (long) aCharge : Math.min(tStats[1], (long) aCharge))); - if (!aSimulate) { - this.setCharge(aStack, tNewCharge); - } - return tNewCharge - tChargeBefore; - } - - @Override - public final double discharge(final ItemStack aStack, final double aCharge, final int aTier, - final boolean aIgnoreTransferLimit, final boolean aBatteryAlike, final boolean aSimulate) { - final Long[] tStats = this.getElectricStats(aStack); - if ((tStats == null) || (tStats[2] > aTier)) { - return 0; - } - if (aBatteryAlike && !this.canProvideEnergy(aStack)) { - return 0; - } - if (tStats[3] > 0) { - if ((aCharge < tStats[3]) || (aStack.stackSize < 1)) { - return 0; - } - if (!aSimulate) { - aStack.stackSize--; - } - return tStats[3]; - } - final long tChargeBefore = this.getRealCharge(aStack), tNewCharge = Math - .max(0, tChargeBefore - (aIgnoreTransferLimit ? (long) aCharge : Math.min(tStats[1], (long) aCharge))); - if (!aSimulate) { - this.setCharge(aStack, tNewCharge); - } - return tChargeBefore - tNewCharge; - } - - @Override - public final double getCharge(final ItemStack aStack) { - return this.getRealCharge(aStack); - } - - @Override - public final boolean canUse(final ItemStack aStack, final double aAmount) { - return this.getRealCharge(aStack) >= aAmount; - } - - @Override - public final boolean use(final ItemStack aStack, final double aAmount, final EntityLivingBase aPlayer) { - this.chargeFromArmor(aStack, aPlayer); - if ((aPlayer instanceof EntityPlayer) && ((EntityPlayer) aPlayer).capabilities.isCreativeMode) { - return true; - } - final double tTransfer = this.discharge(aStack, aAmount, Integer.MAX_VALUE, true, false, true); - if (tTransfer == aAmount) { - this.discharge(aStack, aAmount, Integer.MAX_VALUE, true, false, false); - this.chargeFromArmor(aStack, aPlayer); - return true; - } - this.discharge(aStack, aAmount, Integer.MAX_VALUE, true, false, false); - this.chargeFromArmor(aStack, aPlayer); - return false; - } - - @Override - public final void chargeFromArmor(final ItemStack aStack, final EntityLivingBase aPlayer) { - if ((aPlayer == null) || aPlayer.worldObj.isRemote) { - return; - } - for (int i = 1; i < 5; i++) { - final ItemStack tArmor = aPlayer.getEquipmentInSlot(i); - if (GT_ModHandler.isElectricItem(tArmor)) { - final IElectricItem tArmorItem = (IElectricItem) tArmor.getItem(); - if (tArmorItem.canProvideEnergy(tArmor) && (tArmorItem.getTier(tArmor) >= this.getTier(aStack))) { - final double tCharge = ElectricItem.manager.discharge( - tArmor, - this.charge(aStack, Integer.MAX_VALUE - 1, Integer.MAX_VALUE, true, true), - Integer.MAX_VALUE, - true, - true, - false); - if (tCharge > 0) { - this.charge(aStack, tCharge, Integer.MAX_VALUE, true, false); - if (aPlayer instanceof EntityPlayer) { - final Container tContainer = ((EntityPlayer) aPlayer).openContainer; - if (tContainer != null) { - tContainer.detectAndSendChanges(); - } - } - } - } - } - } - } - - public final long getRealCharge(final ItemStack aStack) { - final Long[] tStats = this.getElectricStats(aStack); - if (tStats == null) { - return 0; - } - if (tStats[3] > 0) { - return (int) (long) tStats[3]; - } - final NBTTagCompound tNBT = aStack.getTagCompound(); - return tNBT == null ? 0 : tNBT.getLong("GT.ItemCharge"); - } - - public final boolean setCharge(final ItemStack aStack, long aCharge) { - final Long[] tStats = this.getElectricStats(aStack); - if ((tStats == null) || (tStats[3] > 0)) { - return false; - } - NBTTagCompound tNBT = aStack.getTagCompound(); - if (tNBT == null) { - tNBT = new NBTTagCompound(); - } - tNBT.removeTag("GT.ItemCharge"); - aCharge = Math.min(tStats[0] < 0 ? Math.abs(tStats[0] / 2) : aCharge, Math.abs(tStats[0])); - if (aCharge > 0) { - aStack.setItemDamage(this.getChargedMetaData(aStack)); - tNBT.setLong("GT.ItemCharge", aCharge); - } else { - aStack.setItemDamage(this.getEmptyMetaData(aStack)); - } - if (tNBT.hasNoTags()) { - aStack.setTagCompound(null); - } else { - aStack.setTagCompound(tNBT); - } - this.isItemStackUsable(aStack); - return true; - } - - public short getChargedMetaData(final ItemStack aStack) { - return (short) aStack.getItemDamage(); - } - - public short getEmptyMetaData(final ItemStack aStack) { - return (short) aStack.getItemDamage(); - } - - @Override - public FluidStack getFluid(final ItemStack aStack) { - return this.getFluidContent(aStack); - } - - @Override - public int getCapacity(final ItemStack aStack) { - final Long[] tStats = this.getFluidContainerStats(aStack); - return tStats == null ? 0 : (int) Math.max(0, tStats[0]); - } - - @Override - public int fill(final ItemStack aStack, final FluidStack aFluid, final boolean doFill) { - if ((aStack == null) || (aStack.stackSize != 1)) { - return 0; - } - - final ItemStack tStack = GT_Utility.fillFluidContainer(aFluid, aStack, false, false); - if (tStack != null) { - aStack.setItemDamage(tStack.getItemDamage()); - aStack.func_150996_a(tStack.getItem()); - return GT_Utility.getFluidForFilledItem(tStack, false).amount; - } - - final Long[] tStats = this.getFluidContainerStats(aStack); - if ((tStats == null) || (tStats[0] <= 0) - || (aFluid == null) - || (aFluid.getFluid() - .getID() <= 0) - || (aFluid.amount <= 0)) { - return 0; - } - - FluidStack tFluid = this.getFluidContent(aStack); - - if ((tFluid == null) || (tFluid.getFluid() - .getID() <= 0)) { - if (aFluid.amount <= tStats[0]) { - if (doFill) { - this.setFluidContent(aStack, aFluid); - } - return aFluid.amount; - } - if (doFill) { - tFluid = aFluid.copy(); - tFluid.amount = (int) (long) tStats[0]; - this.setFluidContent(aStack, tFluid); - } - return (int) (long) tStats[0]; - } - - if (!tFluid.isFluidEqual(aFluid)) { - return 0; - } - - final int space = (int) (long) tStats[0] - tFluid.amount; - if (aFluid.amount <= space) { - if (doFill) { - tFluid.amount += aFluid.amount; - this.setFluidContent(aStack, tFluid); - } - return aFluid.amount; - } - if (doFill) { - tFluid.amount = (int) (long) tStats[0]; - this.setFluidContent(aStack, tFluid); - } - return space; - } - - @Override - public FluidStack drain(final ItemStack aStack, final int maxDrain, final boolean doDrain) { - if ((aStack == null) || (aStack.stackSize != 1)) { - return null; - } - - FluidStack tFluid = GT_Utility.getFluidForFilledItem(aStack, false); - if ((tFluid != null) && (maxDrain >= tFluid.amount)) { - final ItemStack tStack = GT_Utility.getContainerItem(aStack, false); - if (tStack == null) { - aStack.stackSize = 0; - return tFluid; - } - aStack.setItemDamage(tStack.getItemDamage()); - aStack.func_150996_a(tStack.getItem()); - return tFluid; - } - - final Long[] tStats = this.getFluidContainerStats(aStack); - if ((tStats == null) || (tStats[0] <= 0)) { - return null; - } - - tFluid = this.getFluidContent(aStack); - if (tFluid == null) { - return null; - } - - int used = maxDrain; - if (tFluid.amount < used) { - used = tFluid.amount; - } - if (doDrain) { - tFluid.amount -= used; - this.setFluidContent(aStack, tFluid); - } - - final FluidStack drained = tFluid.copy(); - drained.amount = used; - return drained; - } - - public FluidStack getFluidContent(final ItemStack aStack) { - final Long[] tStats = this.getFluidContainerStats(aStack); - if ((tStats == null) || (tStats[0] <= 0)) { - return GT_Utility.getFluidForFilledItem(aStack, false); - } - final NBTTagCompound tNBT = aStack.getTagCompound(); - return tNBT == null ? null : FluidStack.loadFluidStackFromNBT(tNBT.getCompoundTag("GT.FluidContent")); - } - - public void setFluidContent(final ItemStack aStack, final FluidStack aFluid) { - NBTTagCompound tNBT = aStack.getTagCompound(); - if (tNBT == null) { - tNBT = new NBTTagCompound(); - } else { - tNBT.removeTag("GT.FluidContent"); - } - if ((aFluid != null) && (aFluid.amount > 0)) { - tNBT.setTag("GT.FluidContent", aFluid.writeToNBT(new NBTTagCompound())); - } - if (tNBT.hasNoTags()) { - aStack.setTagCompound(null); - } else { - aStack.setTagCompound(tNBT); - } - this.isItemStackUsable(aStack); - } - - @Override - public int getItemStackLimit(final ItemStack aStack) { - Long[] tStats = this.getElectricStats(aStack); - if ((tStats != null) && ((tStats[3] == -1) || (tStats[3] == -3)) && (this.getRealCharge(aStack) > 0)) { - return 1; - } - tStats = this.getFluidContainerStats(aStack); - if (tStats != null) { - return (int) (long) tStats[1]; - } - return 64; - } - - @Override - public final Item getChargedItem(final ItemStack itemStack) { - return this; - } - - @Override - public final Item getEmptyItem(final ItemStack itemStack) { - return this; - } - - @Override - public final int getTier(final ItemStack aStack) { - final Long[] tStats = this.getElectricStats(aStack); - return (int) (tStats == null ? Integer.MAX_VALUE : tStats[2]); - } - - @Override - public final String getToolTip(final ItemStack aStack) { - return null; - } // This has its own ToolTip Handler, no need to let the IC2 Handler screw us up at this Point - - @Override - public final IElectricItemManager getManager(final ItemStack aStack) { - return this; - } // We are our own Manager - - @Override - public final boolean getShareTag() { - return true; - } // just to be sure. - - @Override - public int getItemEnchantability() { - return 0; - } - - @Override - public boolean isBookEnchantable(final ItemStack aStack, final ItemStack aBook) { - return false; - } - - @Override - public boolean getIsRepairable(final ItemStack aStack, final ItemStack aMaterial) { - return false; - } - - @Override - public int getColorFromItemStack(final ItemStack stack, int HEX_OxFFFFFF) { - if (stack.getDisplayName() - .contains("LuV")) { - HEX_OxFFFFFF = 0xffffcc; - } else if (stack.getDisplayName() - .contains("ZPM")) { - HEX_OxFFFFFF = 0xace600; - } else if (stack.getDisplayName() - .contains("UV")) { - HEX_OxFFFFFF = 0xffff00; - } else if (stack.getDisplayName() - .contains("MAX")) { - HEX_OxFFFFFF = 0xff0000; - } else if (stack.getDisplayName() - .contains("Sodium")) { - HEX_OxFFFFFF = Utils.rgbtoHexValue(0, 0, 150); - } else if (stack.getDisplayName() - .contains("Cadmium")) { - HEX_OxFFFFFF = Utils.rgbtoHexValue(50, 50, 60); - } else if (stack.getDisplayName() - .contains("Lithium")) { - HEX_OxFFFFFF = Utils.rgbtoHexValue(225, 220, 255); - } else { - HEX_OxFFFFFF = 0xffffff; - } - return HEX_OxFFFFFF; - } -} diff --git a/gtpp/src/main/java/gtPlusPlus/xmod/gregtech/api/items/Gregtech_MetaItem_X32.java b/gtpp/src/main/java/gtPlusPlus/xmod/gregtech/api/items/Gregtech_MetaItem_X32.java deleted file mode 100644 index c04acb9537..0000000000 --- a/gtpp/src/main/java/gtPlusPlus/xmod/gregtech/api/items/Gregtech_MetaItem_X32.java +++ /dev/null @@ -1,266 +0,0 @@ -package gtPlusPlus.xmod.gregtech.api.items; - -import java.util.Arrays; -import java.util.List; - -import net.minecraft.creativetab.CreativeTabs; -import net.minecraft.item.Item; -import net.minecraft.item.ItemStack; -import net.minecraft.util.IIcon; - -import cpw.mods.fml.relauncher.Side; -import cpw.mods.fml.relauncher.SideOnly; -import gregtech.api.GregTech_API; -import gregtech.api.enums.GT_Values; -import gregtech.api.enums.Materials; -import gregtech.api.enums.OrePrefixes; -import gregtech.api.interfaces.IIconContainer; -import gregtech.api.util.GT_LanguageManager; -import gregtech.api.util.GT_OreDictUnificator; -import gregtech.api.util.GT_Utility; -import gtPlusPlus.core.util.Utils; -import gtPlusPlus.core.util.math.MathUtils; - -/** - * @author Gregorius Techneticies - * <p/> - * One Item for everything! - * <p/> - * This brilliant Item Class is used for automatically generating all possible variations of Material Items, - * like Dusts, Ingots, Gems, Plates and similar. It saves me a ton of work, when adding Items, because I always - * have to make a new Item SubType for each OreDict Prefix, when adding a new Material. - * <p/> - * As you can see, up to 32766 Items can be generated using this Class. And the last 766 Items can be custom - * defined, just to save space and MetaData. - * <p/> - * These Items can also have special RightClick abilities, electric Charge or even be set to become a Food alike - * Item. - */ -public abstract class Gregtech_MetaItem_X32 extends Gregtech_MetaItem { - - protected final OrePrefixes[] mGeneratedPrefixList; - - /** - * Creates the Item using these Parameters. - * - * @param aUnlocalized The Unlocalized Name of this Item. - * @param aGeneratedPrefixList The OreDict Prefixes you want to have generated. - */ - public Gregtech_MetaItem_X32(final String aUnlocalized, final OrePrefixes... aGeneratedPrefixList) { - super(aUnlocalized, (short) 32000, (short) 766); - this.mGeneratedPrefixList = Arrays.copyOf(aGeneratedPrefixList, 32); - - for (int i = 0; i < 32000; i++) { - final OrePrefixes tPrefix = this.mGeneratedPrefixList[i / 1000]; - if (tPrefix == null) { - continue; - } - final Materials tMaterial = GregTech_API.sGeneratedMaterials[i % 1000]; - if (tMaterial == null) { - continue; - } - if (this.doesMaterialAllowGeneration(tPrefix, tMaterial)) { - final ItemStack tStack = new ItemStack(this, 1, i); - GT_LanguageManager.addStringLocalization( - this.getUnlocalizedName(tStack) + ".name", - this.getDefaultLocalization(tPrefix, tMaterial, i)); - GT_LanguageManager.addStringLocalization( - this.getUnlocalizedName(tStack) + ".tooltip", - tMaterial.getToolTip(tPrefix.mMaterialAmount / GT_Values.M)); - if (tPrefix.mIsUnificatable) { - GT_OreDictUnificator.set(tPrefix, tMaterial, tStack); - } else { - GT_OreDictUnificator.registerOre(tPrefix.get(tMaterial), tStack); - } - if (((tPrefix == OrePrefixes.stick) || (tPrefix == OrePrefixes.wireFine)) - && ((tMaterial == Materials.Lead) || (tMaterial == Materials.Tin) - || (tMaterial == Materials.SolderingAlloy))) { - GregTech_API.sSolderingMetalList.add(tStack); - } - } - } - } - - /* ---------- OVERRIDEABLE FUNCTIONS ---------- */ - - /** - * @return the Color Modulation the Material is going to be rendered with. - */ - @Override - public short[] getRGBa(final ItemStack aStack) { - final Materials tMaterial = GregTech_API.sGeneratedMaterials[this.getDamage(aStack) % 1000]; - return tMaterial == null ? Materials._NULL.mRGBa : tMaterial.mRGBa; - } - - /** - * @param aPrefix this can be null, you have to return false in that case - * @param aMaterial this can be null, you have to return false in that case - * @return if this Item should be generated and visible. - */ - public boolean doesMaterialAllowGeneration(final OrePrefixes aPrefix, final Materials aMaterial) { - // You have to check for at least these Conditions in every Case! So add a super Call like the following for - // this before executing your Code: - // if (!super.doesMaterialAllowGeneration(aPrefix, aMaterial)) return false; - return (aPrefix != null) && (aMaterial != null) && aPrefix.doGenerateItem(aMaterial); - } - - /* ---------- OVERRIDEABLE FUNCTIONS ---------- */ - - /** - * @param aPrefix the OreDict Prefix - * @param aMaterial the Material - * @param aMetaData a Index from [0 - 31999] - * @return the Localized Name when default LangFiles are used. - */ - public String getDefaultLocalization(final OrePrefixes aPrefix, final Materials aMaterial, final int aMetaData) { - return aPrefix.getDefaultLocalNameForItem(aMaterial); - } - - /** - * @param aMetaData a Index from [0 - 31999] - * @param aMaterial the Material - * @return an Icon Container for the Item Display. - */ - public final IIconContainer getIconContainer(final int aMetaData, final Materials aMaterial) { - return (this.mGeneratedPrefixList[aMetaData / 1000] != null) - && (this.mGeneratedPrefixList[aMetaData / 1000].mTextureIndex >= 0) - ? aMaterial.mIconSet.mTextures[this.mGeneratedPrefixList[aMetaData / 1000].mTextureIndex] - : null; - } - - /** - * @param aPrefix always != null - * @param aMaterial always != null - * @param aDoShowAllItems this is the Configuration Setting of the User, if he wants to see all the Stuff like Tiny - * Dusts or Crushed Ores as well. - * @return if this Item should be visible in NEI or Creative - */ - public boolean doesShowInCreative(final OrePrefixes aPrefix, final Materials aMaterial, - final boolean aDoShowAllItems) { - return true; - } - - /* ---------- INTERNAL OVERRIDES ---------- */ - - @Override - public ItemStack getContainerItem(final ItemStack aStack) { - final int aDamage = aStack.getItemDamage(); - if ((aDamage < 32000) && (aDamage >= 0)) { - final Materials aMaterial = GregTech_API.sGeneratedMaterials[aDamage % 1000]; - if ((aMaterial != null) && (aMaterial != Materials.Empty) && (aMaterial != Materials._NULL)) { - final OrePrefixes aPrefix = this.mGeneratedPrefixList[aDamage / 1000]; - if (aPrefix != null) { - return GT_Utility.copyAmount(1, aPrefix.mContainerItem); - } - } - } - return null; - } - - @Override - public final IIconContainer getIconContainer(final int aMetaData) { - return GregTech_API.sGeneratedMaterials[aMetaData % 1000] == null ? null - : this.getIconContainer(aMetaData, GregTech_API.sGeneratedMaterials[aMetaData % 1000]); - } - - @Override - @SideOnly(Side.CLIENT) - public final void getSubItems(final Item var1, final CreativeTabs aCreativeTab, final List aList) { - for (int i = 0; i < 32000; i++) { - if (this.doesMaterialAllowGeneration( - this.mGeneratedPrefixList[i / 1000], - GregTech_API.sGeneratedMaterials[i % 1000]) - && this.doesShowInCreative( - this.mGeneratedPrefixList[i / 1000], - GregTech_API.sGeneratedMaterials[i % 1000], - GregTech_API.sDoShowAllItemsInCreative)) { - final ItemStack tStack = new ItemStack(this, 1, i); - this.isItemStackUsable(tStack); - aList.add(tStack); - } - } - super.getSubItems(var1, aCreativeTab, aList); - } - - @Override - public final IIcon getIconFromDamage(final int aMetaData) { - if (aMetaData < 0) { - return null; - } - if (aMetaData < 32000) { - final Materials tMaterial = GregTech_API.sGeneratedMaterials[aMetaData % 1000]; - if (tMaterial == null) { - return null; - } - final IIconContainer tIcon = this.getIconContainer(aMetaData, tMaterial); - if (tIcon != null) { - return tIcon.getIcon(); - } - return null; - } - return (aMetaData - 32000) < this.mIconList.length ? this.mIconList[aMetaData - 32000][0] : null; - } - - @Override - public int getItemStackLimit(final ItemStack aStack) { - final int tDamage = this.getDamage(aStack); - if ((tDamage < 32000) && (this.mGeneratedPrefixList[tDamage / 1000] != null)) { - return Math - .min(super.getItemStackLimit(aStack), this.mGeneratedPrefixList[tDamage / 1000].mDefaultStackSize); - } - return super.getItemStackLimit(aStack); - } - - @Override - public int getColorFromItemStack(final ItemStack stack, int HEX_OxFFFFFF) { - - int aMeta = stack.getItemDamage(); - if (stack.getDisplayName() - .contains("Sodium")) { - HEX_OxFFFFFF = Utils.rgbtoHexValue(90, 90, 255); - } else if (stack.getDisplayName() - .contains("Cadmium")) { - HEX_OxFFFFFF = Utils.rgbtoHexValue(150, 150, 80); - } else if (stack.getDisplayName() - .contains("Lithium")) { - HEX_OxFFFFFF = Utils.rgbtoHexValue(225, 220, 255); - } else if (stack.getDisplayName() - .contains("Wrought")) { - HEX_OxFFFFFF = Utils.rgbtoHexValue(200, 180, 180); - } else if (stack.getDisplayName() - .contains("Bronze")) { - HEX_OxFFFFFF = Utils.rgbtoHexValue(255, 128, 0); - } else if (stack.getDisplayName() - .contains("Brass")) { - HEX_OxFFFFFF = Utils.rgbtoHexValue(255, 180, 0); - } else if (stack.getDisplayName() - .contains("Invar")) { - HEX_OxFFFFFF = Utils.rgbtoHexValue(180, 180, 120); - } else { - if (aMeta > 50 && aMeta != 150) { - HEX_OxFFFFFF = 0xffffff; - } else if (stack.getDisplayName() - .contains("ULV")) { - HEX_OxFFFFFF = Utils.rgbtoHexValue(200, 180, 180); - } else if (stack.getDisplayName() - .contains("LuV")) { - HEX_OxFFFFFF = 0xffffcc; - } else if (stack.getDisplayName() - .contains("ZPM")) { - HEX_OxFFFFFF = 0xffe600; - } else if (stack.getDisplayName() - .contains("UV")) { - HEX_OxFFFFFF = 0xffb300; - } else if (stack.getDisplayName() - .contains("MAX")) { - HEX_OxFFFFFF = Utils.rgbtoHexValue( - MathUtils.randInt(220, 250), - MathUtils.randInt(221, 251), - MathUtils.randInt(220, 250)); - } else { - HEX_OxFFFFFF = 0xffffff; - } - } - return HEX_OxFFFFFF; - } -} diff --git a/gtpp/src/main/java/gtPlusPlus/xmod/gregtech/api/items/Gregtech_MetaTool.java b/gtpp/src/main/java/gtPlusPlus/xmod/gregtech/api/items/Gregtech_MetaTool.java deleted file mode 100644 index fcfa5fae50..0000000000 --- a/gtpp/src/main/java/gtPlusPlus/xmod/gregtech/api/items/Gregtech_MetaTool.java +++ /dev/null @@ -1,692 +0,0 @@ -package gtPlusPlus.xmod.gregtech.api.items; - -import java.util.ArrayList; -import java.util.HashMap; -import java.util.List; -import java.util.Map.Entry; - -import net.minecraft.block.Block; -import net.minecraft.enchantment.Enchantment; -import net.minecraft.enchantment.EnchantmentHelper; -import net.minecraft.entity.Entity; -import net.minecraft.entity.EntityLivingBase; -import net.minecraft.entity.SharedMonsterAttributes; -import net.minecraft.entity.item.EntityMinecart; -import net.minecraft.entity.player.EntityPlayer; -import net.minecraft.item.ItemStack; -import net.minecraft.nbt.NBTTagCompound; -import net.minecraft.potion.Potion; -import net.minecraft.stats.AchievementList; -import net.minecraft.stats.StatList; -import net.minecraft.util.EnumChatFormatting; -import net.minecraft.util.MathHelper; -import net.minecraft.world.World; -import net.minecraftforge.event.world.BlockEvent; - -import buildcraft.api.tools.IToolWrench; -import cpw.mods.fml.common.Optional; -import gregtech.api.enchants.Enchantment_Radioactivity; -import gregtech.api.enums.Materials; -import gregtech.api.enums.Mods; -import gregtech.api.interfaces.IDamagableItem; -import gregtech.api.interfaces.IToolStats; -import gregtech.api.items.GT_MetaGenerated_Tool; -import gregtech.api.util.GT_ModHandler; -import gregtech.api.util.GT_Utility; -import gtPlusPlus.core.creative.AddToCreativeTab; -import gtPlusPlus.xmod.gregtech.api.interfaces.internal.Interface_ToolStats; -import mods.railcraft.api.core.items.IToolCrowbar; - -/** - * This is an example on how you can create a Tool ItemStack, in this case a Bismuth Wrench: - * GT_MetaGenerated_Tool.sInstances.get("gt.metatool.01").getToolWithStats(16, 1, Materials.Bismuth, Materials.Bismuth, - * null); - */ -@Optional.InterfaceList({ - @Optional.Interface(iface = "forestry.api.arboriculture.IToolGrafter", modid = Mods.Names.FORESTRY), - @Optional.Interface(iface = "mods.railcraft.api.core.items.IToolCrowbar", modid = Mods.Names.RAILCRAFT), - @Optional.Interface(iface = "buildcraft.api.tools.IToolWrench", modid = "BuildCraft"), - @Optional.Interface(iface = "crazypants.enderio.api.tool.ITool", modid = Mods.Names.ENDER_I_O) }) -public abstract class Gregtech_MetaTool extends GT_MetaGenerated_Tool - implements IDamagableItem, IToolCrowbar, IToolWrench { - - /** - * All instances of this Item Class are listed here. This gets used to register the Renderer to all Items of this - * Type, if useStandardMetaItemRenderer() returns true. - * <p/> - * You can also use the unlocalized Name gotten from getUnlocalizedName() as Key if you want to get a specific Item. - */ - public static final HashMap<String, Gregtech_MetaTool> sInstances = new HashMap<>(); - - /* ---------- CONSTRUCTOR AND MEMBER VARIABLES ---------- */ - - public final HashMap<Short, IToolStats> mToolStats = new HashMap<>(); - - /** - * Creates the Item using these Parameters. - * - * @param aUnlocalized The Unlocalized Name of this Item. - */ - public Gregtech_MetaTool(final String aUnlocalized) { - super(aUnlocalized); - GT_ModHandler.registerBoxableItemToToolBox(new ItemStack(this)); - this.setCreativeTab(AddToCreativeTab.tabMachines); - this.setMaxStackSize(1); - sInstances.put(this.getUnlocalizedName(), this); - } - - /** - * Called by the Block Harvesting Event within the GT_Proxy - */ - @Override - public void onHarvestBlockEvent(final ArrayList<ItemStack> aDrops, final ItemStack aStack, - final EntityPlayer aPlayer, final Block aBlock, final int aX, final int aY, final int aZ, final byte aMetaData, - final int aFortune, final boolean aSilkTouch, final BlockEvent.HarvestDropsEvent aEvent) { - final IToolStats tStats = this.getToolStats(aStack); - if (this.isItemStackUsable(aStack) && (this.getDigSpeed(aStack, aBlock, aMetaData) > 0.0F)) { - this.doDamage( - aStack, - tStats.convertBlockDrops( - aDrops, - aStack, - aPlayer, - aBlock, - aX, - aY, - aZ, - aMetaData, - aFortune, - aSilkTouch, - aEvent) * tStats.getToolDamagePerDropConversion()); - } - } - - @Override - public boolean onLeftClickEntity(final ItemStack aStack, final EntityPlayer aPlayer, final Entity aEntity) { - final IToolStats tStats = this.getToolStats(aStack); - if ((tStats == null) || !this.isItemStackUsable(aStack)) { - return true; - } - GT_Utility.doSoundAtClient(tStats.getEntityHitSound(), 1, 1.0F); - if (super.onLeftClickEntity(aStack, aPlayer, aEntity)) { - return true; - } - if (aEntity.canAttackWithItem() && !aEntity.hitByEntity(aPlayer)) { - final float tMagicDamage = tStats.getMagicDamageAgainstEntity( - aEntity instanceof EntityLivingBase - ? EnchantmentHelper.getEnchantmentModifierLiving(aPlayer, (EntityLivingBase) aEntity) - : 0.0F, - aEntity, - aStack, - aPlayer); - float tDamage = tStats.getNormalDamageAgainstEntity( - (float) aPlayer.getEntityAttribute(SharedMonsterAttributes.attackDamage) - .getAttributeValue() + this.getToolCombatDamage(aStack), - aEntity, - aStack, - aPlayer); - if ((tDamage + tMagicDamage) > 0.0F) { - final boolean tCriticalHit = (aPlayer.fallDistance > 0.0F) && !aPlayer.onGround - && !aPlayer.isOnLadder() - && !aPlayer.isInWater() - && !aPlayer.isPotionActive(Potion.blindness) - && (aPlayer.ridingEntity == null) - && (aEntity instanceof EntityLivingBase); - if (tCriticalHit && (tDamage > 0.0F)) { - tDamage *= 1.5F; - } - tDamage += tMagicDamage; - if (aEntity.attackEntityFrom(tStats.getDamageSource(aPlayer, aEntity), tDamage)) { - if (aEntity instanceof EntityLivingBase) { - aEntity.setFire(EnchantmentHelper.getFireAspectModifier(aPlayer) * 4); - } - final int tKnockcack = (aPlayer.isSprinting() ? 1 : 0) + (aEntity instanceof EntityLivingBase - ? EnchantmentHelper.getKnockbackModifier(aPlayer, (EntityLivingBase) aEntity) - : 0); - if (tKnockcack > 0) { - aEntity.addVelocity( - -MathHelper.sin((aPlayer.rotationYaw * (float) Math.PI) / 180.0F) * tKnockcack * 0.5F, - 0.1D, - MathHelper.cos((aPlayer.rotationYaw * (float) Math.PI) / 180.0F) * tKnockcack * 0.5F); - aPlayer.motionX *= 0.6D; - aPlayer.motionZ *= 0.6D; - aPlayer.setSprinting(false); - } - if (tCriticalHit) { - aPlayer.onCriticalHit(aEntity); - } - if (tMagicDamage > 0.0F) { - aPlayer.onEnchantmentCritical(aEntity); - } - if (tDamage >= 18.0F) { - aPlayer.triggerAchievement(AchievementList.overkill); - } - aPlayer.setLastAttacker(aEntity); - if (aEntity instanceof EntityLivingBase) { - EnchantmentHelper.func_151384_a((EntityLivingBase) aEntity, aPlayer); - } - EnchantmentHelper.func_151385_b(aPlayer, aEntity); - if (aEntity instanceof EntityLivingBase) { - aPlayer.addStat(StatList.damageDealtStat, Math.round(tDamage * 10.0F)); - } - aEntity.hurtResistantTime = Math - .max(1, tStats.getHurtResistanceTime(aEntity.hurtResistantTime, aEntity)); - aPlayer.addExhaustion(0.3F); - this.doDamage(aStack, tStats.getToolDamagePerEntityAttack()); - } - } - } - if (aStack.stackSize <= 0) { - aPlayer.destroyCurrentEquippedItem(); - } - return true; - } - - @Override - public ItemStack onItemRightClick(final ItemStack aStack, final World aWorld, final EntityPlayer aPlayer) { - final IToolStats tStats = this.getToolStats(aStack); - if ((tStats != null) && tStats.canBlock()) { - aPlayer.setItemInUse(aStack, 72000); - } - return super.onItemRightClick(aStack, aWorld, aPlayer); - } - - @SuppressWarnings("unchecked") - public void addAdditionalToolTips(final List aList, final ItemStack aStack) { - final long tMaxDamage = getToolMaxDamage(aStack); - final Materials tMaterial = getPrimaryMaterial(aStack); - final IToolStats tStats = this.getToolStats(aStack); - final int tOffset = this.getElectricStats(aStack) != null ? 2 : 1; - if (tStats != null) { - final String name = aStack.getUnlocalizedName(); - if (name.equals("gt.metatool.01.170") || name.equals("gt.metatool.01.172") - || name.equals("gt.metatool.01.174") - || name.equals("gt.metatool.01.176")) { - aList.add( - tOffset + 0, - EnumChatFormatting.WHITE + "Durability: " - + EnumChatFormatting.GREEN - + (tMaxDamage - getToolDamage(aStack)) - + " / " - + tMaxDamage - + EnumChatFormatting.GRAY); - aList.add( - tOffset + 1, - EnumChatFormatting.WHITE + tMaterial.mDefaultLocalName - + EnumChatFormatting.YELLOW - + " lvl " - + this.getHarvestLevel(aStack, "") - + EnumChatFormatting.GRAY); - aList.add( - tOffset + 2, - EnumChatFormatting.WHITE + "Turbine Efficency: " - + EnumChatFormatting.BLUE - + (50.0F + (10.0F * this.getToolCombatDamage(aStack))) - + EnumChatFormatting.GRAY); - aList.add( - tOffset + 3, - EnumChatFormatting.WHITE + "Optimal Steam flow: " - + EnumChatFormatting.LIGHT_PURPLE - + Math.max( - Float.MIN_NORMAL, - tStats.getSpeedMultiplier() * getPrimaryMaterial(aStack).mToolSpeed * 1000) - + EnumChatFormatting.GRAY - + "L/sec"); - aList.add( - tOffset + 3, - EnumChatFormatting.WHITE + "Optimal Gas flow(EU burnvalue per tick): " - + EnumChatFormatting.LIGHT_PURPLE - + Math.max( - Float.MIN_NORMAL, - tStats.getSpeedMultiplier() * getPrimaryMaterial(aStack).mToolSpeed * 25) - + EnumChatFormatting.GRAY - + "EU/t"); - aList.add( - tOffset + 3, - EnumChatFormatting.WHITE + "Optimal Plasma flow(Plasma energyvalue per tick): " - + EnumChatFormatting.LIGHT_PURPLE - + Math.max( - Float.MIN_NORMAL, - tStats.getSpeedMultiplier() * getPrimaryMaterial(aStack).mToolSpeed * 1000) - + EnumChatFormatting.GRAY - + "EU/t"); - - } else { - aList.add( - tOffset + 0, - EnumChatFormatting.WHITE + "Durability: " - + EnumChatFormatting.GREEN - + (tMaxDamage - getToolDamage(aStack)) - + " / " - + tMaxDamage - + EnumChatFormatting.GRAY); - aList.add( - tOffset + 1, - EnumChatFormatting.WHITE + tMaterial.mDefaultLocalName - + EnumChatFormatting.YELLOW - + " lvl " - + this.getHarvestLevel(aStack, "") - + EnumChatFormatting.GRAY); - aList.add( - tOffset + 2, - EnumChatFormatting.WHITE + "Attack Damage: " - + EnumChatFormatting.BLUE - + this.getToolCombatDamage(aStack) - + EnumChatFormatting.GRAY); - aList.add( - tOffset + 3, - EnumChatFormatting.WHITE + "Mining Speed: " - + EnumChatFormatting.LIGHT_PURPLE - + Math - .max(Float.MIN_NORMAL, tStats.getSpeedMultiplier() * getPrimaryMaterial(aStack).mToolSpeed) - + EnumChatFormatting.GRAY); - } - } - } - - @Override - @SuppressWarnings("unchecked") - public void addAdditionalToolTips(final List aList, final ItemStack aStack, final EntityPlayer aPlayer) { - final long tMaxDamage = getToolMaxDamage(aStack); - final Materials tMaterial = getPrimaryMaterial(aStack); - final IToolStats tStats = this.getToolStats(aStack); - final int tOffset = this.getElectricStats(aStack) != null ? 2 : 1; - if (tStats != null) { - final String name = aStack.getUnlocalizedName(); - if (name.equals("gt.metatool.01.170") || name.equals("gt.metatool.01.172") - || name.equals("gt.metatool.01.174") - || name.equals("gt.metatool.01.176")) { - aList.add( - tOffset + 0, - EnumChatFormatting.WHITE + "Durability: " - + EnumChatFormatting.GREEN - + (tMaxDamage - getToolDamage(aStack)) - + " / " - + tMaxDamage - + EnumChatFormatting.GRAY); - aList.add( - tOffset + 1, - EnumChatFormatting.WHITE + tMaterial.mDefaultLocalName - + EnumChatFormatting.YELLOW - + " lvl " - + this.getHarvestLevel(aStack, "") - + EnumChatFormatting.GRAY); - aList.add( - tOffset + 2, - EnumChatFormatting.WHITE + "Turbine Efficency: " - + EnumChatFormatting.BLUE - + (50.0F + (10.0F * this.getToolCombatDamage(aStack))) - + EnumChatFormatting.GRAY); - aList.add( - tOffset + 3, - EnumChatFormatting.WHITE + "Optimal Steam flow: " - + EnumChatFormatting.LIGHT_PURPLE - + Math.max( - Float.MIN_NORMAL, - tStats.getSpeedMultiplier() * getPrimaryMaterial(aStack).mToolSpeed * 1000) - + EnumChatFormatting.GRAY - + "L/sec"); - aList.add( - tOffset + 3, - EnumChatFormatting.WHITE + "Optimal Gas flow(EU burnvalue per tick): " - + EnumChatFormatting.LIGHT_PURPLE - + Math.max( - Float.MIN_NORMAL, - tStats.getSpeedMultiplier() * getPrimaryMaterial(aStack).mToolSpeed * 50) - + EnumChatFormatting.GRAY - + "EU/t"); - aList.add( - tOffset + 3, - EnumChatFormatting.WHITE + "Optimal Plasma flow(Plasma energyvalue per tick): " - + EnumChatFormatting.LIGHT_PURPLE - + Math.max( - Float.MIN_NORMAL, - tStats.getSpeedMultiplier() * getPrimaryMaterial(aStack).mToolSpeed * 1000) - + EnumChatFormatting.GRAY - + "EU/t"); - - } else { - aList.add( - tOffset + 0, - EnumChatFormatting.WHITE + "Durability: " - + EnumChatFormatting.GREEN - + (tMaxDamage - getToolDamage(aStack)) - + " / " - + tMaxDamage - + EnumChatFormatting.GRAY); - aList.add( - tOffset + 1, - EnumChatFormatting.WHITE + tMaterial.mDefaultLocalName - + EnumChatFormatting.YELLOW - + " lvl " - + this.getHarvestLevel(aStack, "") - + EnumChatFormatting.GRAY); - aList.add( - tOffset + 2, - EnumChatFormatting.WHITE + "Attack Damage: " - + EnumChatFormatting.BLUE - + this.getToolCombatDamage(aStack) - + EnumChatFormatting.GRAY); - aList.add( - tOffset + 3, - EnumChatFormatting.WHITE + "Mining Speed: " - + EnumChatFormatting.LIGHT_PURPLE - + Math - .max(Float.MIN_NORMAL, tStats.getSpeedMultiplier() * getPrimaryMaterial(aStack).mToolSpeed) - + EnumChatFormatting.GRAY); - NBTTagCompound aNBT = aStack.getTagCompound(); - if (aNBT != null) { - aNBT = aNBT.getCompoundTag("GT.ToolStats"); - if ((aNBT != null) && aNBT.hasKey("Heat")) { - int tHeat = aNBT.getInteger("Heat"); - final long tWorldTime = aPlayer.getEntityWorld() - .getWorldTime(); - if (aNBT.hasKey("HeatTime")) { - final long tHeatTime = aNBT.getLong("HeatTime"); - if (tWorldTime > (tHeatTime + 10)) { - tHeat = (int) (tHeat - ((tWorldTime - tHeatTime) / 10)); - if ((tHeat < 300) && (tHeat > -10000)) { - tHeat = 300; - } - } - aNBT.setLong("HeatTime", tWorldTime); - if (tHeat > -10000) { - aNBT.setInteger("Heat", tHeat); - } - } - - aList.add( - tOffset + 3, - EnumChatFormatting.RED + "Heat: " - + aNBT.getInteger("Heat") - + " K" - + EnumChatFormatting.GRAY); - } - } - } - } - } - - @Override - public Long[] getFluidContainerStats(final ItemStack aStack) { - return null; - } - - @Override - public Long[] getElectricStats(final ItemStack aStack) { - NBTTagCompound aNBT = aStack.getTagCompound(); - if (aNBT != null) { - aNBT = aNBT.getCompoundTag("GT.ToolStats"); - if ((aNBT != null) && aNBT.getBoolean("Electric")) { - return new Long[] { aNBT.getLong("MaxCharge"), aNBT.getLong("Voltage"), aNBT.getLong("Tier"), - aNBT.getLong("SpecialData") }; - } - } - return new Long[] {}; - } - - @Override - public float getToolCombatDamage(final ItemStack aStack) { - final IToolStats tStats = this.getToolStats(aStack); - if (tStats == null) { - return 0; - } - return tStats.getBaseDamage() + getPrimaryMaterial(aStack).mToolQuality; - } - - @Override - public float getDigSpeed(final ItemStack aStack, final Block aBlock, final int aMetaData) { - if (!this.isItemStackUsable(aStack)) { - return 0.0F; - } - final IToolStats tStats = this.getToolStats(aStack); - if ((tStats == null) || (Math.max(0, this.getHarvestLevel(aStack, "")) < aBlock.getHarvestLevel(aMetaData))) { - return 0.0F; - } - return tStats.isMinableBlock(aBlock, (byte) aMetaData) - ? Math.max(Float.MIN_NORMAL, tStats.getSpeedMultiplier() * getPrimaryMaterial(aStack).mToolSpeed) - : 0.0F; - } - - @Override - public boolean onBlockDestroyed(final ItemStack aStack, final World aWorld, final Block aBlock, final int aX, - final int aY, final int aZ, final EntityLivingBase aPlayer) { - if (!this.isItemStackUsable(aStack)) { - return false; - } - final IToolStats tStats = this.getToolStats(aStack); - if (tStats == null) { - return false; - } - GT_Utility.doSoundAtClient(tStats.getMiningSound(), 1, 1.0F); - this.doDamage( - aStack, - (int) Math.max(1, aBlock.getBlockHardness(aWorld, aX, aY, aZ) * tStats.getToolDamagePerBlockBreak())); - return this.getDigSpeed(aStack, aBlock, aWorld.getBlockMetadata(aX, aY, aZ)) > 0.0F; - } - - private ItemStack getContainerItem(ItemStack aStack, final boolean playSound) { - if (!this.isItemStackUsable(aStack)) { - return null; - } - aStack = GT_Utility.copyAmount(1, aStack); - final IToolStats tStats = this.getToolStats(aStack); - if (tStats == null) { - return null; - } - this.doDamage(aStack, tStats.getToolDamagePerContainerCraft()); - aStack = aStack.stackSize > 0 ? aStack : null; - if (playSound) {} - return aStack; - } - - @Override - public Interface_ToolStats getToolStats(final ItemStack aStack) { - this.isItemStackUsable(aStack); - return this.getToolStatsInternal(aStack); - } - - private Interface_ToolStats getToolStatsInternal(final ItemStack aStack) { - return (Interface_ToolStats) (aStack == null ? null : this.mToolStats.get((short) aStack.getItemDamage())); - } - - @Override - public boolean canWhack(final EntityPlayer aPlayer, final ItemStack aStack, final int aX, final int aY, - final int aZ) { - if (!this.isItemStackUsable(aStack)) { - return false; - } - final IToolStats tStats = this.getToolStats(aStack); - return (tStats != null) && tStats.isCrowbar(); - } - - @Override - public void onWhack(final EntityPlayer aPlayer, final ItemStack aStack, final int aX, final int aY, final int aZ) { - final IToolStats tStats = this.getToolStats(aStack); - if (tStats != null) { - this.doDamage(aStack, tStats.getToolDamagePerEntityAttack()); - } - } - - @Override - public boolean canWrench(final EntityPlayer player, final int x, final int y, final int z) { - // System.out.println("canWrench"); - if (player == null) { - return false; - } - if (player.getCurrentEquippedItem() == null) { - return false; - } - if (!this.isItemStackUsable(player.getCurrentEquippedItem())) { - return false; - } - final Interface_ToolStats tStats = this.getToolStats(player.getCurrentEquippedItem()); - return (tStats != null) && tStats.isWrench(); - } - - @Override - public void wrenchUsed(final EntityPlayer player, final int x, final int y, final int z) { - if (player == null) { - return; - } - if (player.getCurrentEquippedItem() == null) { - return; - } - final IToolStats tStats = this.getToolStats(player.getCurrentEquippedItem()); - if (tStats != null) { - this.doDamage(player.getCurrentEquippedItem(), tStats.getToolDamagePerEntityAttack()); - } - } - - @Override - public boolean canLink(final EntityPlayer aPlayer, final ItemStack aStack, final EntityMinecart cart) { - if (!this.isItemStackUsable(aStack)) { - return false; - } - final IToolStats tStats = this.getToolStats(aStack); - return (tStats != null) && tStats.isCrowbar(); - } - - @Override - public void onLink(final EntityPlayer aPlayer, final ItemStack aStack, final EntityMinecart cart) { - final IToolStats tStats = this.getToolStats(aStack); - if (tStats != null) { - this.doDamage(aStack, tStats.getToolDamagePerEntityAttack()); - } - } - - @Override - public boolean canBoost(final EntityPlayer aPlayer, final ItemStack aStack, final EntityMinecart cart) { - if (!this.isItemStackUsable(aStack)) { - return false; - } - final IToolStats tStats = this.getToolStats(aStack); - return (tStats != null) && tStats.isCrowbar(); - } - - @Override - public void onBoost(final EntityPlayer aPlayer, final ItemStack aStack, final EntityMinecart cart) { - final IToolStats tStats = this.getToolStats(aStack); - if (tStats != null) { - this.doDamage(aStack, tStats.getToolDamagePerEntityAttack()); - } - } - - @Override - public void onCreated(final ItemStack aStack, final World aWorld, final EntityPlayer aPlayer) { - final IToolStats tStats = this.getToolStats(aStack); - if ((tStats != null) && (aPlayer != null)) { - tStats.onToolCrafted(aStack, aPlayer); - } - super.onCreated(aStack, aWorld, aPlayer); - } - - @Override - public boolean isFull3D() { - return true; - } - - @Override - public boolean isItemStackUsable(final ItemStack aStack) { - final IToolStats tStats = this.getToolStatsInternal(aStack); - if (((aStack.getItemDamage() % 2) == 1) || (tStats == null)) { - final NBTTagCompound aNBT = aStack.getTagCompound(); - if (aNBT != null) { - aNBT.removeTag("ench"); - } - return false; - } - final Materials aMaterial = getPrimaryMaterial(aStack); - final HashMap<Integer, Integer> tMap = new HashMap<>(), tResult = new HashMap<>(); - if (aMaterial.mEnchantmentTools != null) { - tMap.put(aMaterial.mEnchantmentTools.effectId, (int) aMaterial.mEnchantmentToolsLevel); - if (aMaterial.mEnchantmentTools == Enchantment.fortune) { - tMap.put(Enchantment.looting.effectId, (int) aMaterial.mEnchantmentToolsLevel); - } - if (aMaterial.mEnchantmentTools == Enchantment.knockback) { - tMap.put(Enchantment.power.effectId, (int) aMaterial.mEnchantmentToolsLevel); - } - if (aMaterial.mEnchantmentTools == Enchantment.fireAspect) { - tMap.put(Enchantment.flame.effectId, (int) aMaterial.mEnchantmentToolsLevel); - } - } - final Enchantment[] tEnchants = tStats.getEnchantments(aStack); - final int[] tLevels = tStats.getEnchantmentLevels(aStack); - for (int i = 0; i < tEnchants.length; i++) { - if (tLevels[i] > 0) { - final Integer tLevel = tMap.get(tEnchants[i].effectId); - tMap.put( - tEnchants[i].effectId, - tLevel == null ? tLevels[i] : tLevel == tLevels[i] ? tLevel + 1 : Math.max(tLevel, tLevels[i])); - } - } - for (final Entry<Integer, Integer> tEntry : tMap.entrySet()) { - if ((tEntry.getKey() == 33) || ((tEntry.getKey() == 20) && (tEntry.getValue() > 2)) - || (tEntry.getKey() == Enchantment_Radioactivity.INSTANCE.effectId)) { - tResult.put(tEntry.getKey(), tEntry.getValue()); - } else { - switch (Enchantment.enchantmentsList[tEntry.getKey()].type) { - case weapon: - if (tStats.isWeapon()) { - tResult.put(tEntry.getKey(), tEntry.getValue()); - } - break; - case all: - tResult.put(tEntry.getKey(), tEntry.getValue()); - break; - case armor: - case armor_feet: - case armor_head: - case armor_legs: - case armor_torso: - break; - case bow: - if (tStats.isRangedWeapon()) { - tResult.put(tEntry.getKey(), tEntry.getValue()); - } - break; - case breakable: - break; - case fishing_rod: - break; - case digger: - if (tStats.isMiningTool()) { - tResult.put(tEntry.getKey(), tEntry.getValue()); - } - break; - } - } - } - EnchantmentHelper.setEnchantments(tResult, aStack); - return true; - } - - @Override - public short getChargedMetaData(final ItemStack aStack) { - return (short) (aStack.getItemDamage() - (aStack.getItemDamage() % 2)); - } - - @Override - public short getEmptyMetaData(final ItemStack aStack) { - final NBTTagCompound aNBT = aStack.getTagCompound(); - if (aNBT != null) { - aNBT.removeTag("ench"); - } - return (short) ((aStack.getItemDamage() + 1) - (aStack.getItemDamage() % 2)); - } - - @Override - public int getItemEnchantability() { - return 0; - } - - @Override - public boolean isBookEnchantable(final ItemStack aStack, final ItemStack aBook) { - return false; - } - - @Override - public boolean getIsRepairable(final ItemStack aStack, final ItemStack aMaterial) { - return false; - } -} diff --git a/gtpp/src/main/java/gtPlusPlus/xmod/gregtech/api/metatileentity/implementations/GT_MetaTileEntity_ChiselBus.java b/gtpp/src/main/java/gtPlusPlus/xmod/gregtech/api/metatileentity/implementations/GT_MetaTileEntity_ChiselBus.java deleted file mode 100644 index 3009c80c80..0000000000 --- a/gtpp/src/main/java/gtPlusPlus/xmod/gregtech/api/metatileentity/implementations/GT_MetaTileEntity_ChiselBus.java +++ /dev/null @@ -1,78 +0,0 @@ -package gtPlusPlus.xmod.gregtech.api.metatileentity.implementations; - -import net.minecraft.util.EnumChatFormatting; - -import com.gtnewhorizons.modularui.api.screen.ModularWindow; -import com.gtnewhorizons.modularui.api.screen.UIBuildContext; -import com.gtnewhorizons.modularui.common.widget.Scrollable; -import com.gtnewhorizons.modularui.common.widget.SlotWidget; - -import gregtech.api.interfaces.ITexture; -import gregtech.api.interfaces.modularui.IAddUIWidgets; -import gregtech.api.interfaces.tileentity.IGregTechTileEntity; -import gregtech.api.metatileentity.MetaTileEntity; -import gregtech.api.metatileentity.implementations.GT_MetaTileEntity_Hatch_InputBus; - -public class GT_MetaTileEntity_ChiselBus extends GT_MetaTileEntity_Hatch_InputBus implements IAddUIWidgets { - - public GT_MetaTileEntity_ChiselBus(int id, String name, String nameRegional, int tier) { - super(id, name, nameRegional, tier); - } - - public GT_MetaTileEntity_ChiselBus(String aName, int aTier, String[] aDescription, ITexture[][][] aTextures) { - super(aName, aTier, getSlots(aTier), aDescription, aTextures); - } - - @Override - public boolean isValidSlot(int aIndex) { - return aIndex < getSlots(this.mTier); - } - - public static int getSlots(int aTier) { - return (1 + aTier) * 16 + 1; - } - - @Override - public MetaTileEntity newMetaEntity(IGregTechTileEntity aTileEntity) { - return new GT_MetaTileEntity_ChiselBus(this.mName, this.mTier, this.mDescriptionArray, this.mTextures); - } - - @Override - public boolean allowSelectCircuit() { - return false; - } - - @Override - public String[] getDescription() { - return new String[] { "Item Input Bus for Industrial Chisel", getSlots(this.mTier) - 1 + " + 1 " + " Slots", - "Added by: " + EnumChatFormatting.AQUA - + "Quetz4l" - + " - " - + EnumChatFormatting.RED - + "[GT++]" - + EnumChatFormatting.RESET }; - } - - @Override - public void addUIWidgets(ModularWindow.Builder builder, UIBuildContext buildContext) { - int slotIndex = 0; - final Scrollable scrollable = new Scrollable().setVerticalScroll(); - for (int row = 0; row * 4 < inventoryHandler.getSlots() - 1; row++) { - int columnsToMake = Math.min(inventoryHandler.getSlots() - row * 4, 4); - for (int column = 0; column < columnsToMake; column++) { - scrollable.widget( - new SlotWidget(inventoryHandler, slotIndex++).setPos(column * 18, row * 18) - .setSize(18, 18)); - - } - } - - builder.widget( - scrollable.setSize(18 * 4 + 4, 18 * 4) - .setPos(52, 7)); // main slots - builder.widget( - new SlotWidget(inventoryHandler, slotIndex).setPos(18, 18) - .setSize(18, 18)); // slot for target - } - -} diff --git a/gtpp/src/main/java/gtPlusPlus/xmod/gregtech/api/metatileentity/implementations/GT_MetaTileEntity_Hatch_AirIntake.java b/gtpp/src/main/java/gtPlusPlus/xmod/gregtech/api/metatileentity/implementations/GT_MetaTileEntity_Hatch_AirIntake.java deleted file mode 100644 index bab504910e..0000000000 --- a/gtpp/src/main/java/gtPlusPlus/xmod/gregtech/api/metatileentity/implementations/GT_MetaTileEntity_Hatch_AirIntake.java +++ /dev/null @@ -1,128 +0,0 @@ -package gtPlusPlus.xmod.gregtech.api.metatileentity.implementations; - -import net.minecraft.world.World; -import net.minecraftforge.common.util.ForgeDirection; -import net.minecraftforge.fluids.Fluid; - -import gregtech.api.interfaces.ITexture; -import gregtech.api.interfaces.tileentity.IGregTechTileEntity; -import gregtech.api.metatileentity.MetaTileEntity; -import gtPlusPlus.core.lib.CORE; -import gtPlusPlus.core.util.minecraft.FluidUtils; - -public class GT_MetaTileEntity_Hatch_AirIntake extends GT_MetaTileEntity_Hatch_FluidGenerator { - - public GT_MetaTileEntity_Hatch_AirIntake(final int aID, final String aName, final String aNameRegional, - final int aTier) { - super(aID, aName, aNameRegional, aTier); - } - - public GT_MetaTileEntity_Hatch_AirIntake(final String aName, final int aTier, final String[] aDescription, - final ITexture[][][] aTextures) { - super(aName, aTier, aDescription, aTextures); - } - - @Override - public MetaTileEntity newMetaEntity(final IGregTechTileEntity aTileEntity) { - return new GT_MetaTileEntity_Hatch_AirIntake(this.mName, this.mTier, this.mDescriptionArray, this.mTextures); - } - - @Override - public String[] getCustomTooltip() { - String[] aTooltip = new String[3]; - aTooltip[0] = "DO NOT OBSTRUCT THE INPUT!"; - aTooltip[1] = "Draws in Air from the surrounding environment"; - aTooltip[2] = "Creates " + getAmountOfFluidToGenerate() + "L of Air every " + getMaxTickTime() + " ticks"; - return aTooltip; - } - - @Override - public Fluid getFluidToGenerate() { - return FluidUtils.getAir(1) - .getFluid(); - } - - @Override - public int getAmountOfFluidToGenerate() { - return 1000; - } - - @Override - public int getMaxTickTime() { - return 4; - } - - @Override - public int getCapacity() { - return 128000; - } - - @Override - public boolean doesHatchMeetConditionsToGenerate() { - return this.getBaseMetaTileEntity() - .getAirAtSide( - this.getBaseMetaTileEntity() - .getFrontFacing()); - } - - @Override - public void generateParticles(World aWorld, String name) { - if (this.getBaseMetaTileEntity() - .isServerSide()) { - return; - } - final float ran1 = GT_MetaTileEntity_Hatch_AirIntake.floatGen.nextFloat(); - float ran2 = 0.0f; - float ran3 = 0.0f; - ran2 = GT_MetaTileEntity_Hatch_AirIntake.floatGen.nextFloat(); - ran3 = GT_MetaTileEntity_Hatch_AirIntake.floatGen.nextFloat(); - - final IGregTechTileEntity aMuffler = this.getBaseMetaTileEntity(); - final ForgeDirection aDir = aMuffler.getFrontFacing(); - final float xPos = aDir.offsetX * 0.76f + aMuffler.getXCoord() + 0.25f; - float yPos = aDir.offsetY * 0.76f + aMuffler.getYCoord() + 0.65f; - final float zPos = aDir.offsetZ * 0.76f + aMuffler.getZCoord() + 0.25f; - float ySpd = aDir.offsetY * 0.1f + 0.2f + 0.1f * GT_MetaTileEntity_Hatch_AirIntake.floatGen.nextFloat(); - float xSpd; - float zSpd; - if (aDir.offsetY == -1) { - // Logger.INFO("Y = -1"); - final float temp = GT_MetaTileEntity_Hatch_AirIntake.floatGen.nextFloat() * 2.0f * CORE.PI; - xSpd = (float) Math.sin(temp) * 0.1f; - zSpd = (float) Math.cos(temp) * 0.1f; - ySpd = -ySpd; - yPos = yPos - 0.8f; - } else { - xSpd = aDir.offsetX * (0.1f + 0.2f * GT_MetaTileEntity_Hatch_AirIntake.floatGen.nextFloat()); - zSpd = aDir.offsetZ * (0.1f + 0.2f * GT_MetaTileEntity_Hatch_AirIntake.floatGen.nextFloat()); - - xSpd = -xSpd; - zSpd = -zSpd; - } - - aWorld.spawnParticle( - name, - (double) (xPos + ran1 * 0.5f), - (double) (yPos + GT_MetaTileEntity_Hatch_AirIntake.floatGen.nextFloat() * 0.5f), - (double) (zPos + GT_MetaTileEntity_Hatch_AirIntake.floatGen.nextFloat() * 0.5f), - (double) xSpd, - (double) -ySpd, - (double) zSpd); - aWorld.spawnParticle( - name, - (double) (xPos + ran2 * 0.5f), - (double) (yPos + GT_MetaTileEntity_Hatch_AirIntake.floatGen.nextFloat() * 0.5f), - (double) (zPos + GT_MetaTileEntity_Hatch_AirIntake.floatGen.nextFloat() * 0.5f), - (double) xSpd, - (double) -ySpd, - (double) zSpd); - aWorld.spawnParticle( - name, - (double) (xPos + ran3 * 0.5f), - (double) (yPos + GT_MetaTileEntity_Hatch_AirIntake.floatGen.nextFloat() * 0.5f), - (double) (zPos + GT_MetaTileEntity_Hatch_AirIntake.floatGen.nextFloat() * 0.5f), - (double) xSpd, - (double) -ySpd, - (double) zSpd); - } -} diff --git a/gtpp/src/main/java/gtPlusPlus/xmod/gregtech/api/metatileentity/implementations/GT_MetaTileEntity_Hatch_AirIntake_Extreme.java b/gtpp/src/main/java/gtPlusPlus/xmod/gregtech/api/metatileentity/implementations/GT_MetaTileEntity_Hatch_AirIntake_Extreme.java deleted file mode 100644 index 007310fc06..0000000000 --- a/gtpp/src/main/java/gtPlusPlus/xmod/gregtech/api/metatileentity/implementations/GT_MetaTileEntity_Hatch_AirIntake_Extreme.java +++ /dev/null @@ -1,37 +0,0 @@ -package gtPlusPlus.xmod.gregtech.api.metatileentity.implementations; - -import gregtech.api.interfaces.ITexture; -import gregtech.api.interfaces.tileentity.IGregTechTileEntity; -import gregtech.api.metatileentity.MetaTileEntity; - -public class GT_MetaTileEntity_Hatch_AirIntake_Extreme extends GT_MetaTileEntity_Hatch_AirIntake { - - public GT_MetaTileEntity_Hatch_AirIntake_Extreme(final int aID, final String aName, final String aNameRegional, - final int aTier) { - super(aID, aName, aNameRegional, aTier); - } - - public GT_MetaTileEntity_Hatch_AirIntake_Extreme(final String aName, final int aTier, final String[] aDescription, - final ITexture[][][] aTextures) { - super(aName, aTier, aDescription, aTextures); - } - - @Override - public MetaTileEntity newMetaEntity(final IGregTechTileEntity aTileEntity) { - return new GT_MetaTileEntity_Hatch_AirIntake_Extreme( - this.mName, - this.mTier, - this.mDescriptionArray, - this.mTextures); - } - - @Override - public int getAmountOfFluidToGenerate() { - return 8000; - } - - @Override - public int getCapacity() { - return 256000; - } -} diff --git a/gtpp/src/main/java/gtPlusPlus/xmod/gregtech/api/metatileentity/implementations/GT_MetaTileEntity_Hatch_DynamoBuffer.java b/gtpp/src/main/java/gtPlusPlus/xmod/gregtech/api/metatileentity/implementations/GT_MetaTileEntity_Hatch_DynamoBuffer.java deleted file mode 100644 index f375900800..0000000000 --- a/gtpp/src/main/java/gtPlusPlus/xmod/gregtech/api/metatileentity/implementations/GT_MetaTileEntity_Hatch_DynamoBuffer.java +++ /dev/null @@ -1,67 +0,0 @@ -package gtPlusPlus.xmod.gregtech.api.metatileentity.implementations; - -import gregtech.api.enums.GT_Values; -import gregtech.api.interfaces.ITexture; -import gregtech.api.interfaces.tileentity.IGregTechTileEntity; -import gregtech.api.metatileentity.MetaTileEntity; -import gregtech.api.metatileentity.implementations.GT_MetaTileEntity_Hatch_Dynamo; -import gtPlusPlus.core.lib.CORE; -import gtPlusPlus.xmod.gregtech.common.blocks.textures.TexturesGtBlock; - -public class GT_MetaTileEntity_Hatch_DynamoBuffer extends GT_MetaTileEntity_Hatch_Dynamo { - - public GT_MetaTileEntity_Hatch_DynamoBuffer(final int aID, final String aName, final String aNameRegional, - final int aTier) { - super(aID, aName, aNameRegional, aTier); - } - - public GT_MetaTileEntity_Hatch_DynamoBuffer(final String aName, final int aTier, final String[] aDescription, - final ITexture[][][] aTextures) { - super(aName, aTier, aDescription, aTextures); - } - - @Override - public ITexture[] getTexturesActive(final ITexture aBaseTexture) { - return new ITexture[] { aBaseTexture, TexturesGtBlock.OVERLAYS_ENERGY_OUT_MULTI_BUFFER[this.mTier] }; - } - - @Override - public ITexture[] getTexturesInactive(final ITexture aBaseTexture) { - return new ITexture[] { aBaseTexture, TexturesGtBlock.OVERLAYS_ENERGY_OUT_MULTI_BUFFER[this.mTier] }; - } - - @Override - public long getMinimumStoredEU() { - return 0L; - } - - @Override - public long maxEUStore() { - return 512L + GT_Values.V[this.mTier + 1] * 2048L; - } - - @Override - public MetaTileEntity newMetaEntity(final IGregTechTileEntity aTileEntity) { - return new GT_MetaTileEntity_Hatch_DynamoBuffer(this.mName, this.mTier, this.mDescriptionArray, this.mTextures); - } - - @Override - public String[] getDescription() { - String[] g; - g = new String[] { "Dynamo with internal storage and additional Amp capacity", - "Does not accept more than " + (this.maxEUOutput() * this.maxAmperesIn()) + "EU/t as input", - CORE.GT_Tooltip.get() }; - - return g; - } - - @Override - public long maxAmperesIn() { - return 4; - } - - @Override - public long maxAmperesOut() { - return 4; - } -} diff --git a/gtpp/src/main/java/gtPlusPlus/xmod/gregtech/api/metatileentity/implementations/GT_MetaTileEntity_Hatch_ElementalDataOrbHolder.java b/gtpp/src/main/java/gtPlusPlus/xmod/gregtech/api/metatileentity/implementations/GT_MetaTileEntity_Hatch_ElementalDataOrbHolder.java deleted file mode 100644 index 336c6eb011..0000000000 --- a/gtpp/src/main/java/gtPlusPlus/xmod/gregtech/api/metatileentity/implementations/GT_MetaTileEntity_Hatch_ElementalDataOrbHolder.java +++ /dev/null @@ -1,229 +0,0 @@ -package gtPlusPlus.xmod.gregtech.api.metatileentity.implementations; - -import java.util.ArrayList; - -import net.minecraft.entity.player.EntityPlayer; -import net.minecraft.item.ItemStack; -import net.minecraft.nbt.NBTTagCompound; -import net.minecraftforge.common.util.ForgeDirection; - -import com.gtnewhorizons.modularui.api.screen.ModularWindow; -import com.gtnewhorizons.modularui.api.screen.UIBuildContext; -import com.gtnewhorizons.modularui.common.widget.SlotGroup; - -import gregtech.api.enums.ItemList; -import gregtech.api.gui.modularui.GT_UIInfos; -import gregtech.api.gui.modularui.GT_UITextures; -import gregtech.api.interfaces.IConfigurationCircuitSupport; -import gregtech.api.interfaces.ITexture; -import gregtech.api.interfaces.tileentity.IGregTechTileEntity; -import gregtech.api.metatileentity.MetaTileEntity; -import gregtech.api.metatileentity.implementations.GT_MetaTileEntity_Hatch; -import gregtech.api.objects.GT_RenderedTexture; -import gtPlusPlus.api.objects.Logger; -import gtPlusPlus.core.lib.CORE; -import gtPlusPlus.core.util.minecraft.ItemUtils; -import gtPlusPlus.xmod.gregtech.common.blocks.textures.TexturesGtBlock; - -public class GT_MetaTileEntity_Hatch_ElementalDataOrbHolder extends GT_MetaTileEntity_Hatch - implements IConfigurationCircuitSupport { - - public GT_MetaTileEntity_Hatch_ElementalDataOrbHolder(int aID, String aName, String aNameRegional, int aTier) { - super( - aID, - aName, - aNameRegional, - aTier, - 17, - new String[] { "Holds Data Orbs for the Elemental Duplicator", "Can insert/extract the circuit slot", - "A circuit must be used to select a slot (1-16)", CORE.GT_Tooltip.get() }); - } - - public GT_MetaTileEntity_Hatch_ElementalDataOrbHolder(String aName, int aTier, String aDescription, - ITexture[][][] aTextures) { - super(aName, aTier, 17, aDescription, aTextures); - } - - public GT_MetaTileEntity_Hatch_ElementalDataOrbHolder(String aName, int aTier, String[] aDescription, - ITexture[][][] aTextures) { - super(aName, aTier, 17, aDescription, aTextures); - } - - @Override - public ITexture[] getTexturesActive(ITexture aBaseTexture) { - return new ITexture[] { aBaseTexture, new GT_RenderedTexture(TexturesGtBlock.Overlay_Hatch_Data_Orb) }; - } - - @Override - public ITexture[] getTexturesInactive(ITexture aBaseTexture) { - return new ITexture[] { aBaseTexture, new GT_RenderedTexture(TexturesGtBlock.Overlay_Hatch_Data_Orb) }; - } - - @Override - public boolean isSimpleMachine() { - return true; - } - - @Override - public boolean isFacingValid(ForgeDirection facing) { - return true; - } - - @Override - public boolean isAccessAllowed(EntityPlayer aPlayer) { - return true; - } - - @Override - public boolean isValidSlot(int aIndex) { - return true; - } - - @Override - public MetaTileEntity newMetaEntity(IGregTechTileEntity aTileEntity) { - return new GT_MetaTileEntity_Hatch_ElementalDataOrbHolder(mName, mTier, mDescriptionArray, mTextures); - } - - @Override - public boolean onRightclick(IGregTechTileEntity aBaseMetaTileEntity, EntityPlayer aPlayer) { - GT_UIInfos.openGTTileEntityUI(aBaseMetaTileEntity, aPlayer); - return true; - } - - @Override - public void onPostTick(IGregTechTileEntity aBaseMetaTileEntity, long aTimer) { - if (aBaseMetaTileEntity.isServerSide() && aBaseMetaTileEntity.hasInventoryBeenModified()) { - fillStacksIntoFirstSlots(); - } - } - - public void updateSlots() { - for (int i = 0; i < mInventory.length - 1; i++) - if (mInventory[i] != null && mInventory[i].stackSize <= 0) mInventory[i] = null; - fillStacksIntoFirstSlots(); - } - - protected void fillStacksIntoFirstSlots() { - for (int i = 0; i < mInventory.length - 1; i++) { - if (mInventory[i] != null && mInventory[i].stackSize <= 0) { - mInventory[i] = null; - } - } - } - - @Override - public void saveNBTData(NBTTagCompound aNBT) { - super.saveNBTData(aNBT); - } - - @Override - public void loadNBTData(NBTTagCompound aNBT) { - super.loadNBTData(aNBT); - } - - @Override - public void onScrewdriverRightClick(ForgeDirection side, EntityPlayer aPlayer, float aX, float aY, float aZ) {} - - @Override - public boolean allowPullStack(IGregTechTileEntity aBaseMetaTileEntity, int aIndex, ForgeDirection side, - ItemStack aStack) { - Logger.INFO("Checking if we can pull " + aStack.getDisplayName() + " from slot " + aIndex); - if (aIndex == mInventory.length - 1 && ItemUtils.isControlCircuit(aStack) - && side == getBaseMetaTileEntity().getFrontFacing()) { - return true; - } - return false; - } - - @Override - public boolean allowPutStack(IGregTechTileEntity aBaseMetaTileEntity, int aIndex, ForgeDirection side, - ItemStack aStack) { - Logger.INFO("Checking if we can put " + aStack.getDisplayName() + " into slot " + aIndex); - if (aIndex == mInventory.length - 1 && ItemUtils.isControlCircuit(aStack) - && side == getBaseMetaTileEntity().getFrontFacing()) { - return true; - } - return false; - } - - public ArrayList<ItemStack> getInventory() { - ArrayList<ItemStack> aContents = new ArrayList<>(); - for (int i = getBaseMetaTileEntity().getSizeInventory() - 2; i >= 0; i--) { - if (getBaseMetaTileEntity().getStackInSlot(i) != null) - aContents.add(getBaseMetaTileEntity().getStackInSlot(i)); - } - return aContents; - } - - public ItemStack getOrbByCircuit() { - ItemStack aCirc = getBaseMetaTileEntity().getStackInSlot(getCircuitSlot()); - if (aCirc != null && ItemUtils.isControlCircuit(aCirc)) { - int slot = aCirc.getItemDamage() - 1; // slots are 0 indexed but there's no 0 circuit - if (slot < getBaseMetaTileEntity().getSizeInventory() - 1) { - return getBaseMetaTileEntity().getStackInSlot(slot); - } else { - return null; - } - } else { - return null; - } - } - - @Override - public boolean canInsertItem(int aIndex, ItemStack aStack, int ordinalSide) { - if (aIndex == mInventory.length - 1 && ItemUtils.isControlCircuit(aStack) - && ordinalSide == getBaseMetaTileEntity().getFrontFacing() - .ordinal()) { - Logger.INFO("Putting " + aStack.getDisplayName() + " into slot " + aIndex); - return true; - } - return false; - } - - @Override - public boolean canExtractItem(int aIndex, ItemStack aStack, int ordinalSide) { - if (aIndex == mInventory.length - 1 && ItemUtils.isControlCircuit(aStack)) { - Logger.INFO("Pulling " + aStack.getDisplayName() + " from slot " + aIndex); - return true; - } - return false; - } - - @Override - public boolean allowSelectCircuit() { - return true; - } - - @Override - public int getCircuitSlot() { - return getSlots(mTier); - } - - @Override - public int getCircuitSlotX() { - return 153; - } - - @Override - public int getCircuitSlotY() { - return 63; - } - - @Override - public boolean useModularUI() { - return true; - } - - @Override - public void addUIWidgets(ModularWindow.Builder builder, UIBuildContext buildContext) { - builder.widget( - SlotGroup.ofItemHandler(inventoryHandler, 4) - .startFromSlot(0) - .endAtSlot(15) - .background(getGUITextureSet().getItemSlot(), GT_UITextures.OVERLAY_SLOT_DATA_ORB) - .applyForWidget( - widget -> widget.setFilter(stack -> ItemList.Tool_DataOrb.isStackEqual(stack, false, true))) - .build() - .setPos(52, 7)); - } -} diff --git a/gtpp/src/main/java/gtPlusPlus/xmod/gregtech/api/metatileentity/implementations/GT_MetaTileEntity_Hatch_FluidGenerator.java b/gtpp/src/main/java/gtPlusPlus/xmod/gregtech/api/metatileentity/implementations/GT_MetaTileEntity_Hatch_FluidGenerator.java deleted file mode 100644 index b4e213e829..0000000000 --- a/gtpp/src/main/java/gtPlusPlus/xmod/gregtech/api/metatileentity/implementations/GT_MetaTileEntity_Hatch_FluidGenerator.java +++ /dev/null @@ -1,255 +0,0 @@ -package gtPlusPlus.xmod.gregtech.api.metatileentity.implementations; - -import net.minecraft.entity.player.EntityPlayer; -import net.minecraft.item.ItemStack; -import net.minecraft.nbt.NBTTagCompound; -import net.minecraft.world.World; -import net.minecraftforge.common.util.ForgeDirection; -import net.minecraftforge.fluids.Fluid; -import net.minecraftforge.fluids.FluidStack; - -import gregtech.api.enums.Textures; -import gregtech.api.interfaces.IIconContainer; -import gregtech.api.interfaces.ITexture; -import gregtech.api.interfaces.tileentity.IGregTechTileEntity; -import gregtech.api.metatileentity.MetaTileEntity; -import gregtech.api.metatileentity.implementations.GT_MetaTileEntity_Hatch_Input; -import gregtech.api.objects.GT_RenderedTexture; -import gregtech.api.objects.XSTR; -import gregtech.api.util.GT_Utility; -import gtPlusPlus.core.lib.CORE; -import gtPlusPlus.core.util.minecraft.FluidUtils; - -public abstract class GT_MetaTileEntity_Hatch_FluidGenerator extends GT_MetaTileEntity_Hatch_Input { - - protected static XSTR floatGen = new XSTR(); - public int mProgresstime = 0, mMaxProgresstime = 0; - - public GT_MetaTileEntity_Hatch_FluidGenerator(final int aID, final String aName, final String aNameRegional, - final int aTier) { - super(aID, aName, aNameRegional, aTier); - } - - public GT_MetaTileEntity_Hatch_FluidGenerator(final String aName, final int aTier, final String[] aDescription, - final ITexture[][][] aTextures) { - super(aName, aTier, aDescription, aTextures); - } - - public abstract String[] getCustomTooltip(); - - public abstract Fluid getFluidToGenerate(); - - public abstract int getAmountOfFluidToGenerate(); - - public abstract int getMaxTickTime(); - - @Override - public synchronized String[] getDescription() { - mDescriptionArray[1] = "Capacity: " + GT_Utility.formatNumbers(getCapacity()) + "L"; - final String[] hatchTierString = new String[] { "Hatch Tier: " + GT_Utility.getColoredTierNameFromTier(mTier) }; - - String[] aCustomTips = getCustomTooltip(); - final String[] desc = new String[mDescriptionArray.length + aCustomTips.length + 2]; - System.arraycopy(mDescriptionArray, 0, desc, 0, mDescriptionArray.length); - System.arraycopy(hatchTierString, 0, desc, mDescriptionArray.length, 1); - System.arraycopy(aCustomTips, 0, desc, mDescriptionArray.length + 1, aCustomTips.length); - desc[mDescriptionArray.length + aCustomTips.length] = CORE.GT_Tooltip.get(); - return desc; - } - - @Override - public ITexture[] getTexturesActive(final ITexture aBaseTexture) { - return new ITexture[] { aBaseTexture, - new GT_RenderedTexture((IIconContainer) Textures.BlockIcons.OVERLAY_MUFFLER) }; - } - - @Override - public ITexture[] getTexturesInactive(final ITexture aBaseTexture) { - return new ITexture[] { aBaseTexture, - new GT_RenderedTexture((IIconContainer) Textures.BlockIcons.OVERLAY_MUFFLER) }; - } - - @Override - public boolean isSimpleMachine() { - return true; - } - - @Override - public boolean isFacingValid(final ForgeDirection facing) { - return true; - } - - @Override - public boolean isAccessAllowed(final EntityPlayer aPlayer) { - return true; - } - - @Override - public boolean isValidSlot(final int aIndex) { - return false; - } - - @Override - public abstract MetaTileEntity newMetaEntity(final IGregTechTileEntity aTileEntity); - - public boolean allowPullStack(final IGregTechTileEntity aBaseMetaTileEntity, final int aIndex, - final ForgeDirection side, final ItemStack aStack) { - return false; - } - - public boolean allowPutStack(final IGregTechTileEntity aBaseMetaTileEntity, final int aIndex, - final ForgeDirection side, final ItemStack aStack) { - return false; - } - - @Override - public void onPostTick(final IGregTechTileEntity aBaseMetaTileEntity, final long aTick) { - super.onPostTick(aBaseMetaTileEntity, aTick); - if (!aBaseMetaTileEntity.isAllowedToWork()) { - aBaseMetaTileEntity.setActive(false); - mProgresstime = 0; - mMaxProgresstime = 0; - } else { - aBaseMetaTileEntity.setActive(true); - mMaxProgresstime = getMaxTickTime(); - if (++mProgresstime >= mMaxProgresstime) { - if (this.canTankBeFilled()) { - addFluidToHatch(aTick); - } - mProgresstime = 0; - } - } - } - - @Override - public int getProgresstime() { - return mProgresstime; - } - - @Override - public int maxProgresstime() { - return mMaxProgresstime; - } - - @Override - public int increaseProgress(int aProgress) { - mProgresstime += aProgress; - return mMaxProgresstime - mProgresstime; - } - - public abstract void generateParticles(final World aWorld, final String name); - - @Override - public int getTankPressure() { - return 100; - } - - @Override - public abstract int getCapacity(); - - @Override - public boolean canTankBeEmptied() { - return true; - } - - public abstract boolean doesHatchMeetConditionsToGenerate(); - - public boolean addFluidToHatch(long aTick) { - if (!doesHatchMeetConditionsToGenerate()) { - return false; - } - int aFillAmount = this.fill(FluidUtils.getFluidStack(getFluidToGenerate(), getAmountOfFluidToGenerate()), true); - if (aFillAmount > 0) { - if (this.getBaseMetaTileEntity() - .isClientSide()) { - generateParticles( - this.getBaseMetaTileEntity() - .getWorld(), - "cloud"); - } - } - return aFillAmount > 0; - } - - @Override - public boolean canTankBeFilled() { - return true; - } - - @Override - public boolean doesEmptyContainers() { - return false; - } - - @Override - public boolean doesFillContainers() { - return true; - } - - @Override - public int fill(FluidStack aFluid, boolean doFill) { - if (aFluid == null || aFluid.getFluid() - .getID() <= 0 || aFluid.amount <= 0 || aFluid.getFluid() != getFluidToGenerate() || !canTankBeFilled()) { - return 0; - } - - if (getFillableStack() == null || getFillableStack().getFluid() - .getID() <= 0) { - if (aFluid.amount <= getCapacity()) { - if (doFill) { - setFillableStack(aFluid.copy()); - getBaseMetaTileEntity().markDirty(); - } - return aFluid.amount; - } - if (doFill) { - setFillableStack(aFluid.copy()); - getFillableStack().amount = getCapacity(); - getBaseMetaTileEntity().markDirty(); - } - return getCapacity(); - } - - if (!getFillableStack().isFluidEqual(aFluid)) return 0; - - int space = getCapacity() - getFillableStack().amount; - if (aFluid.amount <= space) { - if (doFill) { - getFillableStack().amount += aFluid.amount; - getBaseMetaTileEntity().markDirty(); - } - return aFluid.amount; - } - if (doFill) getFillableStack().amount = getCapacity(); - return space; - } - - @Override - public boolean canFill(ForgeDirection aSide, Fluid aFluid) { - return false; - } - - @Override - public int fill(ForgeDirection arg0, FluidStack arg1, boolean arg2) { - return 0; - } - - @Override - public int fill_default(ForgeDirection aSide, FluidStack aFluid, boolean doFill) { - return 0; - } - - @Override - public void saveNBTData(NBTTagCompound aNBT) { - aNBT.setInteger("mProgresstime", mProgresstime); - aNBT.setInteger("mMaxProgresstime", mMaxProgresstime); - super.saveNBTData(aNBT); - } - - @Override - public void loadNBTData(NBTTagCompound aNBT) { - mProgresstime = aNBT.getInteger("mProgresstime"); - mMaxProgresstime = aNBT.getInteger("mMaxProgresstime"); - super.loadNBTData(aNBT); - } -} diff --git a/gtpp/src/main/java/gtPlusPlus/xmod/gregtech/api/metatileentity/implementations/GT_MetaTileEntity_Hatch_InputBattery.java b/gtpp/src/main/java/gtPlusPlus/xmod/gregtech/api/metatileentity/implementations/GT_MetaTileEntity_Hatch_InputBattery.java deleted file mode 100644 index c55ddda47d..0000000000 --- a/gtpp/src/main/java/gtPlusPlus/xmod/gregtech/api/metatileentity/implementations/GT_MetaTileEntity_Hatch_InputBattery.java +++ /dev/null @@ -1,235 +0,0 @@ -package gtPlusPlus.xmod.gregtech.api.metatileentity.implementations; - -import static gregtech.api.enums.GT_Values.V; - -import net.minecraft.entity.player.EntityPlayer; -import net.minecraft.item.ItemStack; -import net.minecraftforge.common.util.ForgeDirection; - -import org.apache.commons.lang3.ArrayUtils; - -import com.gtnewhorizons.modularui.api.screen.ModularWindow; -import com.gtnewhorizons.modularui.api.screen.UIBuildContext; - -import gregtech.api.enums.GT_Values; -import gregtech.api.gui.modularui.GT_UIInfos; -import gregtech.api.interfaces.ITexture; -import gregtech.api.interfaces.tileentity.IGregTechTileEntity; -import gregtech.api.metatileentity.MetaTileEntity; -import gregtech.api.metatileentity.implementations.GT_MetaTileEntity_Hatch; -import gregtech.api.objects.GT_RenderedTexture; -import gregtech.api.recipe.RecipeMap; -import gregtech.api.util.GT_ModHandler; -import gregtech.api.util.GT_Utility; -import gtPlusPlus.core.lib.CORE; -import gtPlusPlus.xmod.gregtech.api.gui.widget.ElectricSlotWidget; -import gtPlusPlus.xmod.gregtech.common.blocks.textures.TexturesGtBlock; - -public class GT_MetaTileEntity_Hatch_InputBattery extends GT_MetaTileEntity_Hatch { - - public final RecipeMap<?> mRecipeMap = null; - - public GT_MetaTileEntity_Hatch_InputBattery(int aID, String aName, String aNameRegional, int aTier) { - super(aID, aName, aNameRegional, aTier, getSlots(aTier), "Chargeable Item Bus for Multiblocks"); - } - - public GT_MetaTileEntity_Hatch_InputBattery(String aName, int aTier, String[] aDescription, - ITexture[][][] aTextures) { - super(aName, aTier, aTier < 1 ? 1 : aTier == 1 ? 4 : aTier == 2 ? 4 : 16, aDescription, aTextures); - } - - @Override - public String[] getDescription() { - int mSlots = 0; - if (this.mTier == 2) { - mSlots = 4; - } else if (this.mTier == 4) { - mSlots = 16; - } else { - mSlots = 16; - } - return ArrayUtils.addAll(this.mDescriptionArray, "Capacity: " + mSlots + " slots", CORE.GT_Tooltip.get()); - } - - @Override - public boolean isEnetInput() { - return true; - } - - @Override - public boolean isInputFacing(ForgeDirection side) { - return side == getBaseMetaTileEntity().getFrontFacing(); - } - - @Override - public long getMinimumStoredEU() { - return 0; - } - - @Override - public long maxEUInput() { - return V[mTier]; - } - - @Override - public long maxEUStore() { - return 512 + V[mTier + 1] * 16; - } - - @Override - public long maxAmperesIn() { - return 4; - } - - @Override - public ITexture[] getTexturesActive(ITexture aBaseTexture) { - return new ITexture[] { aBaseTexture, new GT_RenderedTexture(TexturesGtBlock.Overlay_Hatch_Charger) }; - } - - @Override - public ITexture[] getTexturesInactive(ITexture aBaseTexture) { - return new ITexture[] { aBaseTexture, new GT_RenderedTexture(TexturesGtBlock.Overlay_Hatch_Charger) }; - } - - @Override - public boolean isSimpleMachine() { - return true; - } - - @Override - public boolean isFacingValid(ForgeDirection facing) { - return true; - } - - @Override - public boolean isAccessAllowed(EntityPlayer aPlayer) { - return true; - } - - @Override - public boolean isValidSlot(int aIndex) { - return true; - } - - @Override - public MetaTileEntity newMetaEntity(IGregTechTileEntity aTileEntity) { - return new GT_MetaTileEntity_Hatch_InputBattery(mName, mTier, mDescriptionArray, mTextures); - } - - @Override - public boolean onRightclick(IGregTechTileEntity aBaseMetaTileEntity, EntityPlayer aPlayer) { - GT_UIInfos.openGTTileEntityUI(aBaseMetaTileEntity, aPlayer); - return true; - } - - @Override - public void onPostTick(IGregTechTileEntity aBaseMetaTileEntity, long aTimer) { - if (aBaseMetaTileEntity.isServerSide() && aBaseMetaTileEntity.hasInventoryBeenModified()) { - fillStacksIntoFirstSlots(); - } - if (aBaseMetaTileEntity.isServerSide()) { - if (aBaseMetaTileEntity.getMetaTileEntity() instanceof MetaTileEntity mMetaTileEntity) { - if (mMetaTileEntity.rechargerSlotCount() > 0 && aBaseMetaTileEntity.getStoredEU() > 0) { - for (int i = mMetaTileEntity.rechargerSlotStartIndex(), - k = mMetaTileEntity.rechargerSlotCount() + i; i < k; i++) { - if (aBaseMetaTileEntity.getStoredEU() > 0 && mMetaTileEntity.mInventory[i] != null) { - for (int u = 0; u < 10; u++) { - aBaseMetaTileEntity.decreaseStoredEnergyUnits( - GT_ModHandler.chargeElectricItem( - mMetaTileEntity.mInventory[i], - (int) Math.min(V[this.mTier] * 15, aBaseMetaTileEntity.getStoredEU()), - (int) Math.min(Integer.MAX_VALUE, GT_Values.V[u]), - false, - false), - true); - if (mMetaTileEntity.mInventory[i].stackSize <= 0) { - mMetaTileEntity.mInventory[i] = null; - } - } - } - } - } else {} - } - } - super.onPostTick(aBaseMetaTileEntity, aTimer); - } - - public void updateSlots() { - for (int i = 0; i < mInventory.length; i++) - if (mInventory[i] != null && mInventory[i].stackSize <= 0) mInventory[i] = null; - fillStacksIntoFirstSlots(); - } - - protected void fillStacksIntoFirstSlots() { - for (int i = 0; i < mInventory.length; i++) - for (int j = i + 1; j < mInventory.length; j++) if (mInventory[j] != null - && (mInventory[i] == null || GT_Utility.areStacksEqual(mInventory[i], mInventory[j]))) { - GT_Utility.moveStackFromSlotAToSlotB( - getBaseMetaTileEntity(), - getBaseMetaTileEntity(), - j, - i, - (byte) 64, - (byte) 1, - (byte) 64, - (byte) 1); - } - } - - @Override - public boolean allowPullStack(IGregTechTileEntity aBaseMetaTileEntity, int aIndex, ForgeDirection side, - ItemStack aStack) { - return side == getBaseMetaTileEntity().getFrontFacing() - && (mRecipeMap == null || mRecipeMap.containsInput(aStack)); - } - - @Override - public boolean allowPutStack(IGregTechTileEntity aBaseMetaTileEntity, int aIndex, ForgeDirection side, - ItemStack aStack) { - return side == getBaseMetaTileEntity().getFrontFacing() - && (mRecipeMap == null || mRecipeMap.containsInput(aStack)); - } - - @Override - public int rechargerSlotStartIndex() { - return 0; - } - - @Override - public int rechargerSlotCount() { - return switch (mTier) { - case 2 -> 4; - case 4 -> 16; - default -> 16; - }; - } - - @Override - public int dechargerSlotStartIndex() { - return 0; - } - - @Override - public int dechargerSlotCount() { - return 0; - } - - @Override - public boolean useModularUI() { - return true; - } - - @Override - public void addUIWidgets(ModularWindow.Builder builder, UIBuildContext buildContext) { - if (mTier == 2) { - for (int i = 0; i < 4; i++) { - builder - .widget(new ElectricSlotWidget(inventoryHandler, i).setPos(70 + (i % 2) * 18, 25 + (i / 2) * 18)); - } - } else { - for (int i = 0; i < 16; i++) { - builder.widget(new ElectricSlotWidget(inventoryHandler, i).setPos(52 + (i % 4) * 18, 7 + (i / 4) * 18)); - } - } - } -} diff --git a/gtpp/src/main/java/gtPlusPlus/xmod/gregtech/api/metatileentity/implementations/GT_MetaTileEntity_Hatch_Muffler_Adv.java b/gtpp/src/main/java/gtPlusPlus/xmod/gregtech/api/metatileentity/implementations/GT_MetaTileEntity_Hatch_Muffler_Adv.java deleted file mode 100644 index a3261af6f6..0000000000 --- a/gtpp/src/main/java/gtPlusPlus/xmod/gregtech/api/metatileentity/implementations/GT_MetaTileEntity_Hatch_Muffler_Adv.java +++ /dev/null @@ -1,370 +0,0 @@ -package gtPlusPlus.xmod.gregtech.api.metatileentity.implementations; - -import net.minecraft.entity.player.EntityPlayer; -import net.minecraft.item.ItemStack; -import net.minecraft.util.EnumChatFormatting; -import net.minecraft.world.World; -import net.minecraftforge.common.util.ForgeDirection; - -import com.gtnewhorizons.modularui.api.screen.ModularWindow; -import com.gtnewhorizons.modularui.api.screen.UIBuildContext; -import com.gtnewhorizons.modularui.common.widget.SlotWidget; - -import gregtech.GT_Mod; -import gregtech.api.gui.modularui.GT_UIInfos; -import gregtech.api.gui.modularui.GUITextureSet; -import gregtech.api.interfaces.ITexture; -import gregtech.api.interfaces.modularui.IAddGregtechLogo; -import gregtech.api.interfaces.tileentity.IGregTechTileEntity; -import gregtech.api.metatileentity.MetaTileEntity; -import gregtech.api.metatileentity.implementations.GT_MetaTileEntity_Hatch_Muffler; -import gregtech.api.metatileentity.implementations.GT_MetaTileEntity_MultiBlockBase; -import gregtech.api.objects.GT_RenderedTexture; -import gregtech.api.util.GT_Config; -import gregtech.common.GT_Pollution; -import gtPlusPlus.core.item.general.ItemAirFilter; -import gtPlusPlus.core.lib.CORE; -import gtPlusPlus.core.util.minecraft.gregtech.PollutionUtils; -import gtPlusPlus.xmod.gregtech.api.gui.GTPP_UITextures; -import gtPlusPlus.xmod.gregtech.common.blocks.textures.TexturesGtBlock; - -public class GT_MetaTileEntity_Hatch_Muffler_Adv extends GT_MetaTileEntity_Hatch_Muffler implements IAddGregtechLogo { - - protected int SLOT_FILTER = 0; - - @Override - public void onConfigLoad(GT_Config aConfig) { - super.onConfigLoad(aConfig); - try { - int a1 = GT_Mod.gregtechproxy.mPollutionSmogLimit; - if (a1 > 0) { - mPollutionSmogLimit = a1; - } - } catch (Throwable t) { - mPollutionSmogLimit = 500000; - } - } - - private int mPollutionSmogLimit = 500000; - - public GT_MetaTileEntity_Hatch_Muffler_Adv(int aID, String aName, String aNameRegional, int aTier) { - super(aID, aName, aNameRegional, aTier, 1, new String[] { "" }); - } - - public GT_MetaTileEntity_Hatch_Muffler_Adv(String aName, int aTier, String[] aDescription, - ITexture[][][] aTextures) { - super(aName, aTier, 1, aDescription, aTextures); - } - - final String[] mDescription = new String[] { "Outputs pollution from a multiblock", "DO NOT OBSTRUCT THE OUTPUT!", - "Requires 3 Air Blocks in front of the exhaust face", - mTier < 5 ? "Requires an Air Filter" - : "Requires an Air Filter " + EnumChatFormatting.WHITE + "[Tier 2]" + EnumChatFormatting.GRAY, - "Can take Air Filters from an input bus of the multiblock", - "Reduces Pollution to " + calculatePollutionReduction(100, true) + "%", - "Recovers " + (100 - calculatePollutionReduction(100, true)) + "% of CO2/CO/SO2", CORE.GT_Tooltip.get() }; - - @Override - public String[] getDescription() { - return mDescription; - } - - @Override - public ITexture[] getTexturesActive(ITexture aBaseTexture) { - return new ITexture[] { aBaseTexture, new GT_RenderedTexture(TexturesGtBlock.Overlay_Hatch_Muffler_Adv) }; - } - - @Override - public ITexture[] getTexturesInactive(ITexture aBaseTexture) { - return new ITexture[] { aBaseTexture, new GT_RenderedTexture(TexturesGtBlock.Overlay_Hatch_Muffler_Adv) }; - } - - @Override - public boolean isValidSlot(int aIndex) { - return aIndex == SLOT_FILTER; - } - - @Override - public boolean allowPutStack(IGregTechTileEntity aBaseMetaTileEntity, int aIndex, ForgeDirection side, - ItemStack aStack) { - return (aIndex == this.SLOT_FILTER && isAirFilter(aStack)); - } - - @Override - public MetaTileEntity newMetaEntity(IGregTechTileEntity aTileEntity) { - return new GT_MetaTileEntity_Hatch_Muffler_Adv(this.mName, this.mTier, mDescriptionArray, this.mTextures); - } - - @Override - public boolean onRightclick(IGregTechTileEntity aBaseMetaTileEntity, EntityPlayer aPlayer) { - GT_UIInfos.openGTTileEntityUI(aBaseMetaTileEntity, aPlayer); - return true; - } - - @Override - public boolean polluteEnvironment(MetaTileEntity parentTileEntity) { - if (!airCheck()) return false; // Muffler obstructed. - - int emission = 10000; - if (damageAirFilter(parentTileEntity)) { - // damageAirFilter already checks that we have a valid filter. - emission = calculatePollutionReduction(emission, true); - } else { - // Revert to reduction of the basic muffler. - emission = super.calculatePollutionReduction(emission); - } - GT_Pollution.addPollution(getBaseMetaTileEntity(), emission); - return true; - } - - @Override - public int calculatePollutionReduction(int aPollution) { - // This is called by EBF to calculate exhaust gas amounts, we need to check the filter. - return calculatePollutionReduction(aPollution, false); - } - - /** - * Calculates pollution reduction. - * - * @param aPollution Amount of pollution to be reduced. - * @param ignoreFilter If this is true, assumes that a valid filter is present without checking (for example, to - * build tooltips). - * @return Amount of pollution after reduction. - */ - protected int calculatePollutionReduction(int aPollution, boolean ignoreFilter) { - if (!ignoreFilter && !hasAirFilter()) { - // Without a filter, downgrade to basic muffler reduction. - return super.calculatePollutionReduction(aPollution); - } - - // Special case to be always better than a basic muffler. - if (mTier < 2) return (int) (aPollution * 0.95); - if (mTier > 8) return 0; - - return (int) (aPollution * Math.pow(0.64D, mTier - 1)); - } - - /** - * - * @return True if enough blocks in front of the muffler are air. - */ - private boolean airCheck() { - IGregTechTileEntity bmte = getBaseMetaTileEntity(); - ForgeDirection facing = bmte.getFrontFacing(); - return bmte.getAirAtSide(facing) && bmte.getAirAtSideAndDistance(facing, 1) - && bmte.getAirAtSideAndDistance(facing, 2); - } - - /** - * Try to damage an air filter. Will first try to find a valid filter in the hatch's own inventory, then in the - * input buses of the parent multiblock. If the filter is destroyed, will try to replace it from the parent - * multiblock's input buses again. - * - * @param parentTileEntity Which multiblock this hatch is a part of. If this is null, only checks inventory of the - * muffler. - * @return True if the filter has been successfully damaged. - */ - private boolean damageAirFilter(MetaTileEntity parentTileEntity) { - if (!findAirFilter(parentTileEntity)) return false; // No filter available. - - ItemStack filter = mInventory[SLOT_FILTER]; - if (filter == null) return false; // This should never happen if findAirFilter() above succeeded. - - long currentDamage = ItemAirFilter.getFilterDamage(filter); - if (currentDamage < ItemAirFilter.getFilterMaxDamage(filter) - 1) { - // Damage filter by one step. - ItemAirFilter.setFilterDamage(filter, currentDamage + 1); - return true; - } else { - // Destroy the filter. - mInventory[SLOT_FILTER] = null; - - // Try to find a new one. - findAirFilter(parentTileEntity); - - // Regardless of whether we have a new filter or not, *this* operation succeeded. - return true; - } - } - - /** - * Try to find a valid air filter in the input buses of the parent multiblock. - * - * @param parentTileEntity Which multiblock this hatch is a part of. If this is null, only checks inventory of the - * muffler. - * @return True if the inventory of the muffler already contains an air filter, or if one was retrieved from the - * parent multiblock. - */ - private boolean findAirFilter(MetaTileEntity parentTileEntity) { - if (hasAirFilter()) return true; // Has a filter in inventory. - if (mInventory[SLOT_FILTER] != null) return false; // Has a non-filter item in inventory. - if (parentTileEntity == null) return false; // Unknown parent multiblock. - - if (parentTileEntity instanceof GT_MetaTileEntity_MultiBlockBase GTMultiBase) { - for (var inputBus : GTMultiBase.mInputBusses) { - for (ItemStack stack : inputBus.mInventory) { - if (isAirFilter(stack)) { - ItemStack stackCopy = stack.copy(); - if (GTMultiBase.depleteInput(stack)) { - mInventory[SLOT_FILTER] = stackCopy; - return true; - } - } - } - } - } - - return false; - } - - /** - * - * @return True if the item currently in the inventory is an air filter valid for this tier of muffler hatch. - */ - private boolean hasAirFilter() { - return isAirFilter(mInventory[SLOT_FILTER]); - } - - /** - * - * @param filter - * @return True if the argument is an air filter valid for this tier of muffler hatch. - */ - public boolean isAirFilter(ItemStack filter) { - if (filter == null) return false; - if (filter.getItem() instanceof ItemAirFilter) { - if (mTier < 5) { - // Accept any filter. - return true; - } else { - // Accept only T2 filter. - return filter.getItemDamage() == 1; - } - } - return false; - } - - @Override - public void onPostTick(IGregTechTileEntity aBaseMetaTileEntity, long aTick) { - super.onPostTick(aBaseMetaTileEntity, aTick); - - if (aBaseMetaTileEntity.isClientSide()) { - if (this.getBaseMetaTileEntity() - .isActive()) { - String aParticleName; - if ((aTick % 2) == 0) { - aParticleName = "cloud"; - } else { - aParticleName = "smoke"; - } - this.pollutionParticles( - this.getBaseMetaTileEntity() - .getWorld(), - aParticleName); - } - } - } - - @Override - public void pollutionParticles(World aWorld, String name) { - float ran1 = CORE.RANDOM.nextFloat(); - float ran2 = 0.0F; - float ran3 = 0.0F; - boolean chk1 = ran1 * 100.0F < (float) this.calculatePollutionReduction(100); - boolean chk2; - boolean chk3; - int aPollutionAmount = PollutionUtils.getPollution(getBaseMetaTileEntity()); - if (aPollutionAmount >= mPollutionSmogLimit) { - ran2 = CORE.RANDOM.nextFloat(); - ran3 = CORE.RANDOM.nextFloat(); - chk2 = ran2 * 100.0F < (float) this.calculatePollutionReduction(100); - chk3 = ran3 * 100.0F < (float) this.calculatePollutionReduction(100); - if (!chk1 && !chk2 && !chk3) { - return; - } - } else { - if (!chk1) { - return; - } - - chk3 = false; - chk2 = false; - } - - IGregTechTileEntity aMuffler = this.getBaseMetaTileEntity(); - ForgeDirection aDir = aMuffler.getFrontFacing(); - float xPos = (float) aDir.offsetX * 0.76F + (float) aMuffler.getXCoord() + 0.25F; - float yPos = (float) aDir.offsetY * 0.76F + (float) aMuffler.getYCoord() + 0.25F; - float zPos = (float) aDir.offsetZ * 0.76F + (float) aMuffler.getZCoord() + 0.25F; - float ySpd = (float) aDir.offsetY * 0.1F + 0.2F + 0.1F * CORE.RANDOM.nextFloat(); - float xSpd; - float zSpd; - if (aDir.offsetY == -1) { - float temp = CORE.RANDOM.nextFloat() * 2.0F * CORE.PI; - xSpd = (float) Math.sin((double) temp) * 0.1F; - zSpd = (float) Math.cos((double) temp) * 0.1F; - } else { - xSpd = (float) aDir.offsetX * (0.1F + 0.2F * CORE.RANDOM.nextFloat()); - zSpd = (float) aDir.offsetZ * (0.1F + 0.2F * CORE.RANDOM.nextFloat()); - } - - if (chk1) { - aWorld.spawnParticle( - name, - (double) (xPos + ran1 * 0.5F), - (double) (yPos + CORE.RANDOM.nextFloat() * 0.5F), - (double) (zPos + CORE.RANDOM.nextFloat() * 0.5F), - (double) xSpd, - (double) ySpd, - (double) zSpd); - } - - if (chk2) { - aWorld.spawnParticle( - name, - (double) (xPos + ran2 * 0.5F), - (double) (yPos + CORE.RANDOM.nextFloat() * 0.5F), - (double) (zPos + CORE.RANDOM.nextFloat() * 0.5F), - (double) xSpd, - (double) ySpd, - (double) zSpd); - } - - if (chk3) { - aWorld.spawnParticle( - name, - (double) (xPos + ran3 * 0.5F), - (double) (yPos + CORE.RANDOM.nextFloat() * 0.5F), - (double) (zPos + CORE.RANDOM.nextFloat() * 0.5F), - (double) xSpd, - (double) ySpd, - (double) zSpd); - } - } - - @Override - public boolean useModularUI() { - return true; - } - - @Override - public void addGregTechLogo(ModularWindow.Builder builder) {} - - @Override - public GUITextureSet getGUITextureSet() { - return new GUITextureSet().setMainBackground(GTPP_UITextures.BACKGROUND_YELLOW) - .setItemSlot(GTPP_UITextures.SLOT_ITEM_YELLOW) - .setTitleTab( - GTPP_UITextures.TAB_TITLE_YELLOW, - GTPP_UITextures.TAB_TITLE_DARK_YELLOW, - GTPP_UITextures.TAB_TITLE_ANGULAR_YELLOW); - } - - @Override - public void addUIWidgets(ModularWindow.Builder builder, UIBuildContext buildContext) { - builder.widget( - new SlotWidget(inventoryHandler, 0).setFilter(stack -> stack.getItem() instanceof ItemAirFilter) - .setBackground(getGUITextureSet().getItemSlot()) - .setPos(79, 34)); - } -} diff --git a/gtpp/src/main/java/gtPlusPlus/xmod/gregtech/api/metatileentity/implementations/GT_MetaTileEntity_Hatch_Naquadah.java b/gtpp/src/main/java/gtPlusPlus/xmod/gregtech/api/metatileentity/implementations/GT_MetaTileEntity_Hatch_Naquadah.java deleted file mode 100644 index ad94907d4c..0000000000 --- a/gtpp/src/main/java/gtPlusPlus/xmod/gregtech/api/metatileentity/implementations/GT_MetaTileEntity_Hatch_Naquadah.java +++ /dev/null @@ -1,203 +0,0 @@ -package gtPlusPlus.xmod.gregtech.api.metatileentity.implementations; - -import java.lang.reflect.Field; - -import net.minecraft.item.ItemStack; -import net.minecraft.util.EnumChatFormatting; -import net.minecraftforge.common.util.ForgeDirection; -import net.minecraftforge.fluids.FluidStack; - -import gregtech.api.enums.Materials; -import gregtech.api.enums.Textures; -import gregtech.api.enums.Textures.BlockIcons; -import gregtech.api.interfaces.IIconContainer; -import gregtech.api.interfaces.ITexture; -import gregtech.api.interfaces.tileentity.IGregTechTileEntity; -import gregtech.api.metatileentity.MetaTileEntity; -import gregtech.api.metatileentity.implementations.GT_MetaTileEntity_Hatch_Input; -import gregtech.api.objects.GT_RenderedTexture; -import gregtech.api.util.GT_Utility; -import gtPlusPlus.core.lib.CORE; -import gtPlusPlus.core.util.reflect.ReflectionUtils; - -public class GT_MetaTileEntity_Hatch_Naquadah extends GT_MetaTileEntity_Hatch_Input { - - public final FluidStack[] mFluidsToUse = new FluidStack[3]; - public final int mFluidCapacity; - - public GT_MetaTileEntity_Hatch_Naquadah(final int aID, final String aName, final String aNameRegional) { - super(aID, aName, aNameRegional, 6); - mFluidCapacity = 32000; - initHatch(); - } - - public GT_MetaTileEntity_Hatch_Naquadah(final String aName, final String[] aDescription, - final ITexture[][][] aTextures) { - super(aName, 6, aDescription[0], aTextures); - mFluidCapacity = 32000; - initHatch(); - } - - private void initHatch() { - if (mFluidsToUse[0] == null) { - mFluidsToUse[0] = Materials.Naquadah.getMolten(1); - } - if (mFluidsToUse[1] == null) { - mFluidsToUse[1] = Materials.NaquadahEnriched.getMolten(1); - } - if (mFluidsToUse[2] == null) { - mFluidsToUse[2] = Materials.Naquadria.getMolten(1); - } - } - - @Override - public ITexture[] getTexturesActive(final ITexture aBaseTexture) { - return new ITexture[] { aBaseTexture, - new GT_RenderedTexture((IIconContainer) Textures.BlockIcons.NAQUADAH_REACTOR_FLUID_SIDE_ACTIVE) }; - } - - @Override - public ITexture[] getTexturesInactive(final ITexture aBaseTexture) { - return new ITexture[] { aBaseTexture, - new GT_RenderedTexture((IIconContainer) Textures.BlockIcons.NAQUADAH_REACTOR_FLUID_SIDE) }; - } - - public boolean allowPutStack(final IGregTechTileEntity aBaseMetaTileEntity, final int aIndex, - final ForgeDirection side, final ItemStack aStack) { - if (side == aBaseMetaTileEntity.getFrontFacing() && aIndex == 0) { - for (FluidStack f : mFluidsToUse) { - if (f != null) { - if (GT_Utility.getFluidForFilledItem(aStack, true) - .getFluid() == f.getFluid()) { - return true; - } - } - } - } - return false; - } - - @Override - public boolean isFluidInputAllowed(final FluidStack aFluid) { - for (FluidStack f : mFluidsToUse) { - if (f != null) { - if (aFluid.getFluid() == f.getFluid()) { - return true; - } - } - } - return false; - } - - @Override - public int getCapacity() { - return this.mFluidCapacity; - } - - @Override - public MetaTileEntity newMetaEntity(final IGregTechTileEntity aTileEntity) { - return new GT_MetaTileEntity_Hatch_Naquadah(this.mName, this.mDescriptionArray, this.mTextures); - } - - @Override - public String[] getDescription() { - if (aDescCache[0] == null || aDescCache[0].contains(".name") || aDescCache[0].contains("fluid.")) { - aDescCache[0] = formatFluidString(this.mFluidsToUse[0]); - } - if (aDescCache[1] == null || aDescCache[1].contains(".name") || aDescCache[1].contains("fluid.")) { - aDescCache[1] = formatFluidString(this.mFluidsToUse[1]); - } - if (aDescCache[2] == null || aDescCache[2].contains(".name") || aDescCache[2].contains("fluid.")) { - aDescCache[2] = formatFluidString(this.mFluidsToUse[2]); - } - String aNaq = aDescCache[0]; - String aEnrNaq = aDescCache[1]; - String aNaquad = aDescCache[2]; - String[] s2 = new String[] { "Fluid Input for Multiblocks", "Capacity: " + getCapacity() + "L", - "Accepted Fluid: " + aNaq, "Accepted Fluid: " + aEnrNaq, "Accepted Fluid: " + aNaquad, - CORE.GT_Tooltip.get() }; - return s2; - } - - private static String[] aDescCache = new String[3]; - - private String formatFluidString(FluidStack f) { - FluidStack mLockedStack = f; - Integer mLockedTemp = 0;; - String mTempMod = "" + EnumChatFormatting.RESET; - mLockedTemp = mLockedStack.getFluid() - .getTemperature(); - if (mLockedTemp != null) { - if (mLockedTemp <= -3000) { - mTempMod = "" + EnumChatFormatting.DARK_PURPLE; - } else if (mLockedTemp >= -2999 && mLockedTemp <= -500) { - mTempMod = "" + EnumChatFormatting.DARK_BLUE; - } else if (mLockedTemp >= -499 && mLockedTemp <= -50) { - mTempMod = "" + EnumChatFormatting.BLUE; - } else if (mLockedTemp >= 30 && mLockedTemp <= 300) { - mTempMod = "" + EnumChatFormatting.AQUA; - } else if (mLockedTemp >= 301 && mLockedTemp <= 800) { - mTempMod = "" + EnumChatFormatting.YELLOW; - } else if (mLockedTemp >= 801 && mLockedTemp <= 1500) { - mTempMod = "" + EnumChatFormatting.GOLD; - } else if (mLockedTemp >= 1501) { - mTempMod = "" + EnumChatFormatting.RED; - } - } - return mTempMod + mLockedStack.getLocalizedName(); - } - - @Override - public boolean doesFillContainers() { - return false; - } - - @Override - public ITexture[][][] getTextureSet(ITexture[] aTextures) { - // TODO Auto-generated method stub - return super.getTextureSet(aTextures); - } - - private Field F1, F2; - - @Override - public ITexture[] getTexture(IGregTechTileEntity aBaseMetaTileEntity, ForgeDirection side, ForgeDirection facing, - int aColorIndex, boolean aActive, boolean aRedstone) { - byte a1 = 0, a2 = 0; - try { - if (F1 == null) { - F1 = ReflectionUtils.getField(getClass(), "actualTexture"); - } - if (F2 == null) { - F2 = ReflectionUtils.getField(getClass(), "mTexturePage"); - } - - if (F1 != null) { - a1 = F1.getByte(this); - } - if (F2 != null) { - a2 = F2.getByte(this); - } - } catch (IllegalArgumentException | IllegalAccessException n) {} - - int textureIndex = a1 | a2 << 7; - byte texturePointer = (byte) (a1 & 127); - - if (side == ForgeDirection.UP || side == ForgeDirection.DOWN) { - ITexture g = textureIndex > 0 ? BlockIcons.casingTexturePages[a2][texturePointer] - : BlockIcons.MACHINE_CASINGS[this.mTier][aColorIndex + 1]; - - return new ITexture[] { g, - new GT_RenderedTexture((IIconContainer) Textures.BlockIcons.NAQUADAH_REACTOR_FLUID_TOP_ACTIVE) }; - } - - return side != facing - ? (textureIndex > 0 ? new ITexture[] { BlockIcons.casingTexturePages[a2][texturePointer] } - : new ITexture[] { BlockIcons.MACHINE_CASINGS[this.mTier][aColorIndex + 1] }) - : (textureIndex > 0 - ? (aActive ? this.getTexturesActive(BlockIcons.casingTexturePages[a2][texturePointer]) - : this.getTexturesInactive(BlockIcons.casingTexturePages[a2][texturePointer])) - : (aActive ? this.getTexturesActive(BlockIcons.MACHINE_CASINGS[this.mTier][aColorIndex + 1]) - : this.getTexturesInactive(BlockIcons.MACHINE_CASINGS[this.mTier][aColorIndex + 1]))); - } -} diff --git a/gtpp/src/main/java/gtPlusPlus/xmod/gregtech/api/metatileentity/implementations/GT_MetaTileEntity_Hatch_OutputBattery.java b/gtpp/src/main/java/gtPlusPlus/xmod/gregtech/api/metatileentity/implementations/GT_MetaTileEntity_Hatch_OutputBattery.java deleted file mode 100644 index 58dc7ec380..0000000000 --- a/gtpp/src/main/java/gtPlusPlus/xmod/gregtech/api/metatileentity/implementations/GT_MetaTileEntity_Hatch_OutputBattery.java +++ /dev/null @@ -1,222 +0,0 @@ -package gtPlusPlus.xmod.gregtech.api.metatileentity.implementations; - -import static gregtech.api.enums.GT_Values.V; - -import net.minecraft.entity.player.EntityPlayer; -import net.minecraft.item.ItemStack; -import net.minecraftforge.common.util.ForgeDirection; - -import org.apache.commons.lang3.ArrayUtils; - -import com.gtnewhorizons.modularui.api.screen.ModularWindow; -import com.gtnewhorizons.modularui.api.screen.UIBuildContext; - -import gregtech.api.gui.modularui.GT_UIInfos; -import gregtech.api.interfaces.ITexture; -import gregtech.api.interfaces.tileentity.IGregTechTileEntity; -import gregtech.api.metatileentity.MetaTileEntity; -import gregtech.api.metatileentity.implementations.GT_MetaTileEntity_Hatch; -import gregtech.api.objects.GT_RenderedTexture; -import gregtech.api.util.GT_ModHandler; -import gregtech.api.util.GT_Utility; -import gtPlusPlus.core.lib.CORE; -import gtPlusPlus.xmod.gregtech.api.gui.widget.ElectricSlotWidget; -import gtPlusPlus.xmod.gregtech.common.blocks.textures.TexturesGtBlock; - -public class GT_MetaTileEntity_Hatch_OutputBattery extends GT_MetaTileEntity_Hatch { - - public GT_MetaTileEntity_Hatch_OutputBattery(int aID, String aName, String aNameRegional, int aTier) { - super(aID, aName, aNameRegional, aTier, getSlots(aTier), "Dischargeable Item Bus for Multiblocks"); - } - - public GT_MetaTileEntity_Hatch_OutputBattery(String aName, int aTier, String[] aDescription, - ITexture[][][] aTextures) { - super(aName, aTier, aTier < 1 ? 1 : aTier == 1 ? 4 : aTier == 2 ? 9 : 16, aDescription, aTextures); - } - - @Override - public String[] getDescription() { - int mSlots = 0; - if (this.mTier == 2) { - mSlots = 4; - } else if (this.mTier == 4) { - mSlots = 16; - } else { - mSlots = 16; - } - return ArrayUtils.addAll(this.mDescriptionArray, "Capacity: " + mSlots + " slots", CORE.GT_Tooltip.get()); - } - - @Override - public boolean isEnetOutput() { - return true; - } - - @Override - public boolean isOutputFacing(ForgeDirection side) { - return side == getBaseMetaTileEntity().getFrontFacing(); - } - - @Override - public long getMinimumStoredEU() { - return 0; - } - - @Override - public long maxEUOutput() { - return V[mTier]; - } - - @Override - public long maxEUStore() { - return 512 + V[mTier + 1] * 8; - } - - @Override - public ITexture[] getTexturesActive(ITexture aBaseTexture) { - return new ITexture[] { aBaseTexture, new GT_RenderedTexture(TexturesGtBlock.Overlay_Hatch_Discharger) }; - } - - @Override - public ITexture[] getTexturesInactive(ITexture aBaseTexture) { - return new ITexture[] { aBaseTexture, new GT_RenderedTexture(TexturesGtBlock.Overlay_Hatch_Discharger) }; - } - - @Override - public boolean isSimpleMachine() { - return true; - } - - @Override - public boolean isFacingValid(ForgeDirection facing) { - return true; - } - - @Override - public boolean isAccessAllowed(EntityPlayer aPlayer) { - return true; - } - - @Override - public boolean isValidSlot(int aIndex) { - return true; - } - - @Override - public MetaTileEntity newMetaEntity(IGregTechTileEntity aTileEntity) { - return new GT_MetaTileEntity_Hatch_OutputBattery(mName, mTier, mDescriptionArray, mTextures); - } - - @Override - public boolean onRightclick(IGregTechTileEntity aBaseMetaTileEntity, EntityPlayer aPlayer) { - GT_UIInfos.openGTTileEntityUI(aBaseMetaTileEntity, aPlayer); - return true; - } - - @Override - public boolean allowPullStack(IGregTechTileEntity aBaseMetaTileEntity, int aIndex, ForgeDirection side, - ItemStack aStack) { - return side == aBaseMetaTileEntity.getFrontFacing(); - } - - @Override - public boolean allowPutStack(IGregTechTileEntity aBaseMetaTileEntity, int aIndex, ForgeDirection side, - ItemStack aStack) { - return side == aBaseMetaTileEntity.getFrontFacing(); - } - - public void updateSlots() { - for (int i = 0; i < mInventory.length; i++) - if (mInventory[i] != null && mInventory[i].stackSize <= 0) mInventory[i] = null; - fillStacksIntoFirstSlots(); - } - - protected void fillStacksIntoFirstSlots() { - for (int i = 0; i < mInventory.length; i++) - for (int j = i + 1; j < mInventory.length; j++) if (mInventory[j] != null - && (mInventory[i] == null || GT_Utility.areStacksEqual(mInventory[i], mInventory[j]))) { - GT_Utility.moveStackFromSlotAToSlotB( - getBaseMetaTileEntity(), - getBaseMetaTileEntity(), - j, - i, - (byte) 64, - (byte) 1, - (byte) 64, - (byte) 1); - } - } - - @Override - public int rechargerSlotStartIndex() { - return 0; - } - - @Override - public int rechargerSlotCount() { - return 0; - } - - @Override - public int dechargerSlotStartIndex() { - return 0; - } - - @Override - public int dechargerSlotCount() { - return mTier == 2 ? 4 : 16; - } - - @Override - public void onPostTick(IGregTechTileEntity aBaseMetaTileEntity, long aTimer) { - if (aBaseMetaTileEntity.isServerSide() && aBaseMetaTileEntity.hasInventoryBeenModified()) { - fillStacksIntoFirstSlots(); - } - - if (aBaseMetaTileEntity.isServerSide()) { - if (aBaseMetaTileEntity.getMetaTileEntity() instanceof MetaTileEntity mMetaTileEntity) { - if (mMetaTileEntity.dechargerSlotCount() > 0 - && mMetaTileEntity.getEUVar() < aBaseMetaTileEntity.getEUCapacity()) { - for (int i = mMetaTileEntity.dechargerSlotStartIndex(), - k = mMetaTileEntity.dechargerSlotCount() + i; i < k; i++) { - if (mMetaTileEntity.mInventory[i] != null - && mMetaTileEntity.getEUVar() < aBaseMetaTileEntity.getEUCapacity()) { - aBaseMetaTileEntity.increaseStoredEnergyUnits( - GT_ModHandler.dischargeElectricItem( - mMetaTileEntity.mInventory[i], - (int) Math.min( - V[mTier] * 15, - aBaseMetaTileEntity.getEUCapacity() - aBaseMetaTileEntity.getStoredEU()), - (int) Math.min(Integer.MAX_VALUE, mMetaTileEntity.getInputTier()), - true, - false, - false), - true); - if (mMetaTileEntity.mInventory[i].stackSize <= 0) mMetaTileEntity.mInventory[i] = null; - } - } - } - } - } - super.onPostTick(aBaseMetaTileEntity, aTimer); - } - - @Override - public boolean useModularUI() { - return true; - } - - @Override - public void addUIWidgets(ModularWindow.Builder builder, UIBuildContext buildContext) { - if (mTier == 2) { - for (int i = 0; i < 4; i++) { - builder - .widget(new ElectricSlotWidget(inventoryHandler, i).setPos(70 + (i % 2) * 18, 25 + (i / 2) * 18)); - } - } else { - for (int i = 0; i < 16; i++) { - builder.widget(new ElectricSlotWidget(inventoryHandler, i).setPos(52 + (i % 4) * 18, 7 + (i / 4) * 18)); - } - } - } -} diff --git a/gtpp/src/main/java/gtPlusPlus/xmod/gregtech/api/metatileentity/implementations/GT_MetaTileEntity_Hatch_Reservoir.java b/gtpp/src/main/java/gtPlusPlus/xmod/gregtech/api/metatileentity/implementations/GT_MetaTileEntity_Hatch_Reservoir.java deleted file mode 100644 index bfe8290240..0000000000 --- a/gtpp/src/main/java/gtPlusPlus/xmod/gregtech/api/metatileentity/implementations/GT_MetaTileEntity_Hatch_Reservoir.java +++ /dev/null @@ -1,75 +0,0 @@ -package gtPlusPlus.xmod.gregtech.api.metatileentity.implementations; - -import net.minecraft.world.World; -import net.minecraftforge.fluids.Fluid; -import net.minecraftforge.fluids.FluidRegistry; - -import gregtech.api.interfaces.ITexture; -import gregtech.api.interfaces.tileentity.IGregTechTileEntity; -import gregtech.api.metatileentity.MetaTileEntity; -import gregtech.api.objects.GT_RenderedTexture; -import gtPlusPlus.xmod.gregtech.common.blocks.textures.TexturesGtBlock; - -public class GT_MetaTileEntity_Hatch_Reservoir extends GT_MetaTileEntity_Hatch_FluidGenerator { - - public GT_MetaTileEntity_Hatch_Reservoir(final int aID, final String aName, final String aNameRegional, - final int aTier) { - super(aID, aName, aNameRegional, aTier); - } - - public GT_MetaTileEntity_Hatch_Reservoir(final String aName, final int aTier, final String[] aDescription, - final ITexture[][][] aTextures) { - super(aName, aTier, aDescription, aTextures); - } - - @Override - public MetaTileEntity newMetaEntity(final IGregTechTileEntity aTileEntity) { - return new GT_MetaTileEntity_Hatch_Reservoir(this.mName, this.mTier, this.mDescriptionArray, this.mTextures); - } - - @Override - public String[] getCustomTooltip() { - String[] aTooltip = new String[2]; - aTooltip[0] = "Infinite water supply hatch"; - aTooltip[1] = "Fills to max capacity every 5 seconds"; - return aTooltip; - } - - @Override - public Fluid getFluidToGenerate() { - return FluidRegistry.WATER; - } - - @Override - public int getAmountOfFluidToGenerate() { - return 2_000_000_000; - } - - @Override - public int getMaxTickTime() { - return 100; - } - - @Override - public int getCapacity() { - return 2_000_000_000; - } - - @Override - public boolean doesHatchMeetConditionsToGenerate() { - return true; - } - - @Override - public void generateParticles(World aWorld, String name) {} - - @Override - public ITexture[] getTexturesActive(final ITexture aBaseTexture) { - return new ITexture[] { aBaseTexture, new GT_RenderedTexture(TexturesGtBlock.Overlay_Water) }; - } - - @Override - public ITexture[] getTexturesInactive(final ITexture aBaseTexture) { - return new ITexture[] { aBaseTexture, new GT_RenderedTexture(TexturesGtBlock.Overlay_Water) }; - } -} diff --git a/gtpp/src/main/java/gtPlusPlus/xmod/gregtech/api/metatileentity/implementations/GT_MetaTileEntity_Hatch_Solidifier.java b/gtpp/src/main/java/gtPlusPlus/xmod/gregtech/api/metatileentity/implementations/GT_MetaTileEntity_Hatch_Solidifier.java deleted file mode 100644 index 94c28877d8..0000000000 --- a/gtpp/src/main/java/gtPlusPlus/xmod/gregtech/api/metatileentity/implementations/GT_MetaTileEntity_Hatch_Solidifier.java +++ /dev/null @@ -1,72 +0,0 @@ -package gtPlusPlus.xmod.gregtech.api.metatileentity.implementations; - -import net.minecraft.item.ItemStack; -import net.minecraft.util.EnumChatFormatting; - -import com.gtnewhorizons.modularui.api.screen.ModularWindow; -import com.gtnewhorizons.modularui.api.screen.UIBuildContext; -import com.gtnewhorizons.modularui.common.widget.SlotWidget; - -import gregtech.api.interfaces.ITexture; -import gregtech.api.interfaces.tileentity.IGregTechTileEntity; -import gregtech.api.metatileentity.MetaTileEntity; -import gregtech.api.metatileentity.implementations.GT_MetaTileEntity_Hatch_Input; -import gregtech.api.util.GT_Utility; - -public class GT_MetaTileEntity_Hatch_Solidifier extends GT_MetaTileEntity_Hatch_Input { - - static final int moldSlot = 2; - - public GT_MetaTileEntity_Hatch_Solidifier(int aID, String aName, String aNameRegional, int aTier) { - super(aID, aName, aNameRegional, aTier); - } - - @Override - public String[] getDescription() { - return new String[] { - "Fluid Input with Mold for " + EnumChatFormatting.YELLOW - + "Large Processing Factory" - + EnumChatFormatting.RESET, - "#22 Circuit is imprinted in Hatch", "Capacity: " + GT_Utility.formatNumbers(getCapacity()) + "L", - "Added by: " + EnumChatFormatting.AQUA - + "Quetz4l" - + " - " - + EnumChatFormatting.RED - + "[GT++]" - + EnumChatFormatting.RESET }; - } - - public GT_MetaTileEntity_Hatch_Solidifier(String aName, int aTier, String[] aDescription, - ITexture[][][] aTextures) { - super(aName, getSlots(aTier), aTier, aDescription, aTextures); - } - - @Override - public MetaTileEntity newMetaEntity(IGregTechTileEntity aTileEntity) { - return new GT_MetaTileEntity_Hatch_Solidifier(mName, mTier, mDescriptionArray, mTextures); - } - - public ItemStack getMold() { - return this.getStackInSlot(moldSlot); - } - - @Override - public void addUIWidgets(ModularWindow.Builder builder, UIBuildContext buildContext) { - super.addUIWidgets(builder, buildContext); - builder.widget( - new SlotWidget(inventoryHandler, moldSlot).setPos(125, 35) - .setSize(18, 18)); - } - - @Override - public void onBlockDestroyed() { - super.onBlockDestroyed(); - } - - // for a drop-down form when the hatch is destroyed - @Override - public boolean isValidSlot(int aIndex) { - if (aIndex == moldSlot) return true; - else return super.isValidSlot(aIndex); - } -} diff --git a/gtpp/src/main/java/gtPlusPlus/xmod/gregtech/api/metatileentity/implementations/GT_MetaTileEntity_Hatch_Steam_BusInput.java b/gtpp/src/main/java/gtPlusPlus/xmod/gregtech/api/metatileentity/implementations/GT_MetaTileEntity_Hatch_Steam_BusInput.java deleted file mode 100644 index 5cc1e64d13..0000000000 --- a/gtpp/src/main/java/gtPlusPlus/xmod/gregtech/api/metatileentity/implementations/GT_MetaTileEntity_Hatch_Steam_BusInput.java +++ /dev/null @@ -1,279 +0,0 @@ -package gtPlusPlus.xmod.gregtech.api.metatileentity.implementations; - -import static gregtech.api.enums.Textures.BlockIcons.ITEM_IN_SIGN; -import static gregtech.api.enums.Textures.BlockIcons.OVERLAY_PIPE_IN; - -import net.minecraft.entity.player.EntityPlayer; -import net.minecraft.item.ItemStack; -import net.minecraft.nbt.NBTTagCompound; -import net.minecraftforge.common.util.ForgeDirection; - -import com.gtnewhorizons.modularui.api.screen.ModularWindow; -import com.gtnewhorizons.modularui.api.screen.UIBuildContext; - -import gregtech.GT_Mod; -import gregtech.api.enums.Textures; -import gregtech.api.gui.modularui.GT_UIInfos; -import gregtech.api.interfaces.ITexture; -import gregtech.api.interfaces.tileentity.IGregTechTileEntity; -import gregtech.api.metatileentity.MetaTileEntity; -import gregtech.api.metatileentity.implementations.GT_MetaTileEntity_Hatch; -import gregtech.api.objects.GT_RenderedTexture; -import gregtech.api.recipe.RecipeMap; -import gregtech.api.render.TextureFactory; -import gregtech.api.util.GT_Utility; -import gtPlusPlus.core.lib.CORE; - -public class GT_MetaTileEntity_Hatch_Steam_BusInput extends GT_MetaTileEntity_Hatch { - - public RecipeMap<?> mRecipeMap = null; - public boolean disableSort; - - public GT_MetaTileEntity_Hatch_Steam_BusInput(int aID, String aName, String aNameRegional, int aTier) { - super( - aID, - aName, - aNameRegional, - aTier, - getSlots(aTier), - new String[] { "Item Input for Steam Multiblocks", - "Shift + right click with screwdriver to toggle automatic item shuffling", "Capacity: 4 stacks", - "Does not work with non-steam multiblocks", CORE.GT_Tooltip.get() }); - } - - public GT_MetaTileEntity_Hatch_Steam_BusInput(String aName, int aTier, String aDescription, - ITexture[][][] aTextures) { - super(aName, aTier, 4, aDescription, aTextures); - } - - public GT_MetaTileEntity_Hatch_Steam_BusInput(String aName, int aTier, String[] aDescription, - ITexture[][][] aTextures) { - super(aName, aTier, 4, aDescription, aTextures); - } - - @Override - public ITexture[] getTexturesActive(ITexture aBaseTexture) { - return GT_Mod.gregtechproxy.mRenderIndicatorsOnHatch - ? new ITexture[] { aBaseTexture, TextureFactory.of(OVERLAY_PIPE_IN), TextureFactory.of(ITEM_IN_SIGN) } - : new ITexture[] { aBaseTexture, TextureFactory.of(OVERLAY_PIPE_IN) }; - } - - @Override - public ITexture[] getTexturesInactive(ITexture aBaseTexture) { - return GT_Mod.gregtechproxy.mRenderIndicatorsOnHatch - ? new ITexture[] { aBaseTexture, TextureFactory.of(OVERLAY_PIPE_IN), TextureFactory.of(ITEM_IN_SIGN) } - : new ITexture[] { aBaseTexture, TextureFactory.of(OVERLAY_PIPE_IN) }; - } - - @Override - public boolean isSimpleMachine() { - return true; - } - - @Override - public boolean isFacingValid(ForgeDirection facing) { - return true; - } - - @Override - public boolean isAccessAllowed(EntityPlayer aPlayer) { - return true; - } - - @Override - public boolean isValidSlot(int aIndex) { - return true; - } - - @Override - public MetaTileEntity newMetaEntity(IGregTechTileEntity aTileEntity) { - return new GT_MetaTileEntity_Hatch_Steam_BusInput(mName, mTier, mDescriptionArray, mTextures); - } - - @Override - public boolean onRightclick(IGregTechTileEntity aBaseMetaTileEntity, EntityPlayer aPlayer) { - GT_UIInfos.openGTTileEntityUI(aBaseMetaTileEntity, aPlayer); - return true; - } - - @Override - public void onPostTick(IGregTechTileEntity aBaseMetaTileEntity, long aTimer) { - if (aBaseMetaTileEntity.isServerSide() && aBaseMetaTileEntity.hasInventoryBeenModified()) { - fillStacksIntoFirstSlots(); - } - } - - public void updateSlots() { - for (int i = 0; i < mInventory.length; i++) - if (mInventory[i] != null && mInventory[i].stackSize <= 0) mInventory[i] = null; - fillStacksIntoFirstSlots(); - } - - protected void fillStacksIntoFirstSlots() { - if (disableSort) { - for (int i = 0; i < mInventory.length; i++) - if (mInventory[i] != null && mInventory[i].stackSize <= 0) mInventory[i] = null; - } else { - for (int i = 0; i < mInventory.length; i++) - for (int j = i + 1; j < mInventory.length; j++) if (mInventory[j] != null - && (mInventory[i] == null || GT_Utility.areStacksEqual(mInventory[i], mInventory[j]))) - GT_Utility.moveStackFromSlotAToSlotB( - getBaseMetaTileEntity(), - getBaseMetaTileEntity(), - j, - i, - (byte) 64, - (byte) 1, - (byte) 64, - (byte) 1); - } - } - - @Override - public void saveNBTData(NBTTagCompound aNBT) { - super.saveNBTData(aNBT); - aNBT.setBoolean("disableSort", disableSort); - } - - @Override - public void loadNBTData(NBTTagCompound aNBT) { - super.loadNBTData(aNBT); - disableSort = aNBT.getBoolean("disableSort"); - } - - @Override - public void onScrewdriverRightClick(ForgeDirection side, EntityPlayer aPlayer, float aX, float aY, float aZ) { - if (aPlayer.isSneaking()) { - disableSort = !disableSort; - GT_Utility.sendChatToPlayer( - aPlayer, - GT_Utility.trans("200.1", "Automatic Item Shuffling: ") - + (disableSort ? GT_Utility.trans("087", "Disabled") : GT_Utility.trans("088", "Enabled"))); - } - } - - @Override - public boolean allowPullStack(IGregTechTileEntity aBaseMetaTileEntity, int aIndex, ForgeDirection side, - ItemStack aStack) { - return false; - } - - @Override - public boolean allowPutStack(IGregTechTileEntity aBaseMetaTileEntity, int aIndex, ForgeDirection side, - ItemStack aStack) { - return side == getBaseMetaTileEntity().getFrontFacing() - && (mRecipeMap == null || mRecipeMap.containsInput(aStack)); - } - - @Override - public ITexture[][][] getTextureSet(ITexture[] aTextures) { - ITexture[][][] rTextures = new ITexture[14][17][]; - for (byte c = -1; c < 16; c++) { - if (rTextures[0][c + 1] == null) rTextures[0][c + 1] = getSideFacingActive(c); - if (rTextures[1][c + 1] == null) rTextures[1][c + 1] = getSideFacingInactive(c); - if (rTextures[2][c + 1] == null) rTextures[2][c + 1] = getFrontFacingActive(c); - if (rTextures[3][c + 1] == null) rTextures[3][c + 1] = getFrontFacingInactive(c); - if (rTextures[4][c + 1] == null) rTextures[4][c + 1] = getTopFacingActive(c); - if (rTextures[5][c + 1] == null) rTextures[5][c + 1] = getTopFacingInactive(c); - if (rTextures[6][c + 1] == null) rTextures[6][c + 1] = getBottomFacingActive(c); - if (rTextures[7][c + 1] == null) rTextures[7][c + 1] = getBottomFacingInactive(c); - if (rTextures[8][c + 1] == null) rTextures[8][c + 1] = getBottomFacingPipeActive(c); - if (rTextures[9][c + 1] == null) rTextures[9][c + 1] = getBottomFacingPipeInactive(c); - if (rTextures[10][c + 1] == null) rTextures[10][c + 1] = getTopFacingPipeActive(c); - if (rTextures[11][c + 1] == null) rTextures[11][c + 1] = getTopFacingPipeInactive(c); - if (rTextures[12][c + 1] == null) rTextures[12][c + 1] = getSideFacingPipeActive(c); - if (rTextures[13][c + 1] == null) rTextures[13][c + 1] = getSideFacingPipeInactive(c); - } - return rTextures; - } - - public ITexture[] getSideFacingActive(byte aColor) { - return new ITexture[] { new GT_RenderedTexture( - mTier == 1 ? Textures.BlockIcons.MACHINE_BRONZEBRICKS_SIDE : Textures.BlockIcons.MACHINE_BRONZE_SIDE) }; - } - - public ITexture[] getSideFacingInactive(byte aColor) { - return new ITexture[] { new GT_RenderedTexture( - mTier == 1 ? Textures.BlockIcons.MACHINE_BRONZEBRICKS_SIDE : Textures.BlockIcons.MACHINE_BRONZE_SIDE) }; - } - - public ITexture[] getFrontFacingActive(byte aColor) { - return new ITexture[] { new GT_RenderedTexture( - mTier == 1 ? Textures.BlockIcons.MACHINE_BRONZEBRICKS_SIDE : Textures.BlockIcons.MACHINE_BRONZE_SIDE) }; - } - - public ITexture[] getFrontFacingInactive(byte aColor) { - return new ITexture[] { new GT_RenderedTexture( - mTier == 1 ? Textures.BlockIcons.MACHINE_BRONZEBRICKS_SIDE : Textures.BlockIcons.MACHINE_BRONZE_SIDE) }; - } - - public ITexture[] getTopFacingActive(byte aColor) { - return new ITexture[] { new GT_RenderedTexture( - mTier == 1 ? Textures.BlockIcons.MACHINE_BRONZEBRICKS_TOP : Textures.BlockIcons.MACHINE_BRONZE_TOP) }; - } - - public ITexture[] getTopFacingInactive(byte aColor) { - return new ITexture[] { new GT_RenderedTexture( - mTier == 1 ? Textures.BlockIcons.MACHINE_BRONZEBRICKS_TOP : Textures.BlockIcons.MACHINE_BRONZE_TOP) }; - } - - public ITexture[] getBottomFacingActive(byte aColor) { - return new ITexture[] { new GT_RenderedTexture( - mTier == 1 ? Textures.BlockIcons.MACHINE_BRONZEBRICKS_BOTTOM : Textures.BlockIcons.MACHINE_BRONZE_BOTTOM) }; - } - - public ITexture[] getBottomFacingInactive(byte aColor) { - return new ITexture[] { new GT_RenderedTexture( - mTier == 1 ? Textures.BlockIcons.MACHINE_BRONZEBRICKS_BOTTOM : Textures.BlockIcons.MACHINE_BRONZE_BOTTOM) }; - } - - public ITexture[] getBottomFacingPipeActive(byte aColor) { - return new ITexture[] { new GT_RenderedTexture( - mTier == 1 ? Textures.BlockIcons.MACHINE_BRONZEBRICKS_BOTTOM : Textures.BlockIcons.MACHINE_BRONZE_BOTTOM), - new GT_RenderedTexture(Textures.BlockIcons.OVERLAY_PIPE_OUT) }; - } - - public ITexture[] getBottomFacingPipeInactive(byte aColor) { - return new ITexture[] { new GT_RenderedTexture( - mTier == 1 ? Textures.BlockIcons.MACHINE_BRONZEBRICKS_BOTTOM : Textures.BlockIcons.MACHINE_BRONZE_BOTTOM), - new GT_RenderedTexture(Textures.BlockIcons.OVERLAY_PIPE_OUT) }; - } - - public ITexture[] getTopFacingPipeActive(byte aColor) { - return new ITexture[] { - new GT_RenderedTexture( - mTier == 1 ? Textures.BlockIcons.MACHINE_BRONZEBRICKS_TOP : Textures.BlockIcons.MACHINE_BRONZE_TOP), - new GT_RenderedTexture(Textures.BlockIcons.OVERLAY_PIPE_OUT) }; - } - - public ITexture[] getTopFacingPipeInactive(byte aColor) { - return new ITexture[] { - new GT_RenderedTexture( - mTier == 1 ? Textures.BlockIcons.MACHINE_BRONZEBRICKS_TOP : Textures.BlockIcons.MACHINE_BRONZE_TOP), - new GT_RenderedTexture(Textures.BlockIcons.OVERLAY_PIPE_OUT) }; - } - - public ITexture[] getSideFacingPipeActive(byte aColor) { - return new ITexture[] { - new GT_RenderedTexture( - mTier == 1 ? Textures.BlockIcons.MACHINE_BRONZEBRICKS_SIDE : Textures.BlockIcons.MACHINE_BRONZE_SIDE), - new GT_RenderedTexture(Textures.BlockIcons.OVERLAY_PIPE_OUT) }; - } - - public ITexture[] getSideFacingPipeInactive(byte aColor) { - return new ITexture[] { - new GT_RenderedTexture( - mTier == 1 ? Textures.BlockIcons.MACHINE_BRONZEBRICKS_SIDE : Textures.BlockIcons.MACHINE_BRONZE_SIDE), - new GT_RenderedTexture(Textures.BlockIcons.OVERLAY_PIPE_OUT) }; - } - - @Override - public boolean useModularUI() { - return true; - } - - @Override - public void addUIWidgets(ModularWindow.Builder builder, UIBuildContext buildContext) { - getBaseMetaTileEntity().add2by2Slots(builder); - } -} diff --git a/gtpp/src/main/java/gtPlusPlus/xmod/gregtech/api/metatileentity/implementations/GT_MetaTileEntity_Hatch_Steam_BusOutput.java b/gtpp/src/main/java/gtPlusPlus/xmod/gregtech/api/metatileentity/implementations/GT_MetaTileEntity_Hatch_Steam_BusOutput.java deleted file mode 100644 index 1d4dbc8987..0000000000 --- a/gtpp/src/main/java/gtPlusPlus/xmod/gregtech/api/metatileentity/implementations/GT_MetaTileEntity_Hatch_Steam_BusOutput.java +++ /dev/null @@ -1,215 +0,0 @@ -package gtPlusPlus.xmod.gregtech.api.metatileentity.implementations; - -import static gregtech.api.enums.Textures.BlockIcons.ITEM_OUT_SIGN; -import static gregtech.api.enums.Textures.BlockIcons.OVERLAY_PIPE_OUT; - -import net.minecraft.entity.player.EntityPlayer; -import net.minecraft.item.ItemStack; -import net.minecraftforge.common.util.ForgeDirection; - -import com.gtnewhorizons.modularui.api.screen.ModularWindow; -import com.gtnewhorizons.modularui.api.screen.UIBuildContext; - -import gregtech.GT_Mod; -import gregtech.api.enums.Textures; -import gregtech.api.gui.modularui.GT_UIInfos; -import gregtech.api.interfaces.ITexture; -import gregtech.api.interfaces.tileentity.IGregTechTileEntity; -import gregtech.api.metatileentity.MetaTileEntity; -import gregtech.api.metatileentity.implementations.GT_MetaTileEntity_Hatch; -import gregtech.api.objects.GT_RenderedTexture; -import gregtech.api.render.TextureFactory; -import gtPlusPlus.core.lib.CORE; - -public class GT_MetaTileEntity_Hatch_Steam_BusOutput extends GT_MetaTileEntity_Hatch { - - public GT_MetaTileEntity_Hatch_Steam_BusOutput(int aID, String aName, String aNameRegional, int aTier) { - super( - aID, - aName, - aNameRegional, - aTier, - 4, - new String[] { "Item Output for Steam Multiblocks", "Does not automatically export items", - "Capacity: 4 stacks", "Does not work with non-steam multiblocks", CORE.GT_Tooltip.get() }); - } - - public GT_MetaTileEntity_Hatch_Steam_BusOutput(String aName, int aTier, String aDescription, - ITexture[][][] aTextures) { - super(aName, aTier, 4, aDescription, aTextures); - } - - public GT_MetaTileEntity_Hatch_Steam_BusOutput(String aName, int aTier, String[] aDescription, - ITexture[][][] aTextures) { - super(aName, aTier, 4, aDescription, aTextures); - } - - @Override - public ITexture[] getTexturesActive(ITexture aBaseTexture) { - return GT_Mod.gregtechproxy.mRenderIndicatorsOnHatch - ? new ITexture[] { aBaseTexture, TextureFactory.of(OVERLAY_PIPE_OUT), TextureFactory.of(ITEM_OUT_SIGN) } - : new ITexture[] { aBaseTexture, TextureFactory.of(OVERLAY_PIPE_OUT) }; - } - - @Override - public ITexture[] getTexturesInactive(ITexture aBaseTexture) { - return GT_Mod.gregtechproxy.mRenderIndicatorsOnHatch - ? new ITexture[] { aBaseTexture, TextureFactory.of(OVERLAY_PIPE_OUT), TextureFactory.of(ITEM_OUT_SIGN) } - : new ITexture[] { aBaseTexture, TextureFactory.of(OVERLAY_PIPE_OUT) }; - } - - @Override - public boolean isSimpleMachine() { - return true; - } - - @Override - public boolean isFacingValid(ForgeDirection facing) { - return true; - } - - @Override - public boolean isAccessAllowed(EntityPlayer aPlayer) { - return true; - } - - @Override - public boolean isValidSlot(int aIndex) { - return true; - } - - @Override - public MetaTileEntity newMetaEntity(IGregTechTileEntity aTileEntity) { - return new GT_MetaTileEntity_Hatch_Steam_BusOutput(mName, mTier, mDescriptionArray, mTextures); - } - - @Override - public boolean onRightclick(IGregTechTileEntity aBaseMetaTileEntity, EntityPlayer aPlayer) { - GT_UIInfos.openGTTileEntityUI(aBaseMetaTileEntity, aPlayer); - return true; - } - - @Override - public boolean allowPullStack(IGregTechTileEntity aBaseMetaTileEntity, int aIndex, ForgeDirection side, - ItemStack aStack) { - return side == aBaseMetaTileEntity.getFrontFacing(); - } - - @Override - public boolean allowPutStack(IGregTechTileEntity aBaseMetaTileEntity, int aIndex, ForgeDirection side, - ItemStack aStack) { - return false; - } - - @Override - public ITexture[][][] getTextureSet(ITexture[] aTextures) { - ITexture[][][] rTextures = new ITexture[14][17][]; - for (byte c = -1; c < 16; c++) { - if (rTextures[0][c + 1] == null) rTextures[0][c + 1] = getSideFacingActive(c); - if (rTextures[1][c + 1] == null) rTextures[1][c + 1] = getSideFacingInactive(c); - if (rTextures[2][c + 1] == null) rTextures[2][c + 1] = getFrontFacingActive(c); - if (rTextures[3][c + 1] == null) rTextures[3][c + 1] = getFrontFacingInactive(c); - if (rTextures[4][c + 1] == null) rTextures[4][c + 1] = getTopFacingActive(c); - if (rTextures[5][c + 1] == null) rTextures[5][c + 1] = getTopFacingInactive(c); - if (rTextures[6][c + 1] == null) rTextures[6][c + 1] = getBottomFacingActive(c); - if (rTextures[7][c + 1] == null) rTextures[7][c + 1] = getBottomFacingInactive(c); - if (rTextures[8][c + 1] == null) rTextures[8][c + 1] = getBottomFacingPipeActive(c); - if (rTextures[9][c + 1] == null) rTextures[9][c + 1] = getBottomFacingPipeInactive(c); - if (rTextures[10][c + 1] == null) rTextures[10][c + 1] = getTopFacingPipeActive(c); - if (rTextures[11][c + 1] == null) rTextures[11][c + 1] = getTopFacingPipeInactive(c); - if (rTextures[12][c + 1] == null) rTextures[12][c + 1] = getSideFacingPipeActive(c); - if (rTextures[13][c + 1] == null) rTextures[13][c + 1] = getSideFacingPipeInactive(c); - } - return rTextures; - } - - public ITexture[] getSideFacingActive(byte aColor) { - return new ITexture[] { new GT_RenderedTexture( - mTier == 1 ? Textures.BlockIcons.MACHINE_BRONZEBRICKS_SIDE : Textures.BlockIcons.MACHINE_BRONZE_SIDE) }; - } - - public ITexture[] getSideFacingInactive(byte aColor) { - return new ITexture[] { new GT_RenderedTexture( - mTier == 1 ? Textures.BlockIcons.MACHINE_BRONZEBRICKS_SIDE : Textures.BlockIcons.MACHINE_BRONZE_SIDE) }; - } - - public ITexture[] getFrontFacingActive(byte aColor) { - return new ITexture[] { new GT_RenderedTexture( - mTier == 1 ? Textures.BlockIcons.MACHINE_BRONZEBRICKS_SIDE : Textures.BlockIcons.MACHINE_BRONZE_SIDE) }; - } - - public ITexture[] getFrontFacingInactive(byte aColor) { - return new ITexture[] { new GT_RenderedTexture( - mTier == 1 ? Textures.BlockIcons.MACHINE_BRONZEBRICKS_SIDE : Textures.BlockIcons.MACHINE_BRONZE_SIDE) }; - } - - public ITexture[] getTopFacingActive(byte aColor) { - return new ITexture[] { new GT_RenderedTexture( - mTier == 1 ? Textures.BlockIcons.MACHINE_BRONZEBRICKS_TOP : Textures.BlockIcons.MACHINE_BRONZE_TOP) }; - } - - public ITexture[] getTopFacingInactive(byte aColor) { - return new ITexture[] { new GT_RenderedTexture( - mTier == 1 ? Textures.BlockIcons.MACHINE_BRONZEBRICKS_TOP : Textures.BlockIcons.MACHINE_BRONZE_TOP) }; - } - - public ITexture[] getBottomFacingActive(byte aColor) { - return new ITexture[] { new GT_RenderedTexture( - mTier == 1 ? Textures.BlockIcons.MACHINE_BRONZEBRICKS_BOTTOM : Textures.BlockIcons.MACHINE_BRONZE_BOTTOM) }; - } - - public ITexture[] getBottomFacingInactive(byte aColor) { - return new ITexture[] { new GT_RenderedTexture( - mTier == 1 ? Textures.BlockIcons.MACHINE_BRONZEBRICKS_BOTTOM : Textures.BlockIcons.MACHINE_BRONZE_BOTTOM) }; - } - - public ITexture[] getBottomFacingPipeActive(byte aColor) { - return new ITexture[] { new GT_RenderedTexture( - mTier == 1 ? Textures.BlockIcons.MACHINE_BRONZEBRICKS_BOTTOM : Textures.BlockIcons.MACHINE_BRONZE_BOTTOM), - new GT_RenderedTexture(Textures.BlockIcons.OVERLAY_PIPE_OUT) }; - } - - public ITexture[] getBottomFacingPipeInactive(byte aColor) { - return new ITexture[] { new GT_RenderedTexture( - mTier == 1 ? Textures.BlockIcons.MACHINE_BRONZEBRICKS_BOTTOM : Textures.BlockIcons.MACHINE_BRONZE_BOTTOM), - new GT_RenderedTexture(Textures.BlockIcons.OVERLAY_PIPE_OUT) }; - } - - public ITexture[] getTopFacingPipeActive(byte aColor) { - return new ITexture[] { - new GT_RenderedTexture( - mTier == 1 ? Textures.BlockIcons.MACHINE_BRONZEBRICKS_TOP : Textures.BlockIcons.MACHINE_BRONZE_TOP), - new GT_RenderedTexture(Textures.BlockIcons.OVERLAY_PIPE_OUT) }; - } - - public ITexture[] getTopFacingPipeInactive(byte aColor) { - return new ITexture[] { - new GT_RenderedTexture( - mTier == 1 ? Textures.BlockIcons.MACHINE_BRONZEBRICKS_TOP : Textures.BlockIcons.MACHINE_BRONZE_TOP), - new GT_RenderedTexture(Textures.BlockIcons.OVERLAY_PIPE_OUT) }; - } - - public ITexture[] getSideFacingPipeActive(byte aColor) { - return new ITexture[] { - new GT_RenderedTexture( - mTier == 1 ? Textures.BlockIcons.MACHINE_BRONZEBRICKS_SIDE : Textures.BlockIcons.MACHINE_BRONZE_SIDE), - new GT_RenderedTexture(Textures.BlockIcons.OVERLAY_PIPE_OUT) }; - } - - public ITexture[] getSideFacingPipeInactive(byte aColor) { - return new ITexture[] { - new GT_RenderedTexture( - mTier == 1 ? Textures.BlockIcons.MACHINE_BRONZEBRICKS_SIDE : Textures.BlockIcons.MACHINE_BRONZE_SIDE), - new GT_RenderedTexture(Textures.BlockIcons.OVERLAY_PIPE_OUT) }; - } - - @Override - public boolean useModularUI() { - return true; - } - - @Override - public void addUIWidgets(ModularWindow.Builder builder, UIBuildContext buildContext) { - getBaseMetaTileEntity().add2by2Slots(builder); - } -} diff --git a/gtpp/src/main/java/gtPlusPlus/xmod/gregtech/api/metatileentity/implementations/GT_MetaTileEntity_Hatch_Turbine.java b/gtpp/src/main/java/gtPlusPlus/xmod/gregtech/api/metatileentity/implementations/GT_MetaTileEntity_Hatch_Turbine.java deleted file mode 100644 index ed3101f309..0000000000 --- a/gtpp/src/main/java/gtPlusPlus/xmod/gregtech/api/metatileentity/implementations/GT_MetaTileEntity_Hatch_Turbine.java +++ /dev/null @@ -1,435 +0,0 @@ -package gtPlusPlus.xmod.gregtech.api.metatileentity.implementations; - -import static gregtech.api.enums.Textures.BlockIcons.LARGETURBINE_ST5; -import static gregtech.api.enums.Textures.BlockIcons.LARGETURBINE_ST_ACTIVE5; - -import net.minecraft.entity.player.EntityPlayer; -import net.minecraft.item.ItemStack; -import net.minecraft.nbt.NBTTagCompound; -import net.minecraftforge.common.util.ForgeDirection; - -import org.apache.commons.lang3.ArrayUtils; - -import com.gtnewhorizons.modularui.api.screen.ModularWindow; -import com.gtnewhorizons.modularui.api.screen.UIBuildContext; -import com.gtnewhorizons.modularui.common.widget.SlotWidget; - -import gregtech.api.GregTech_API; -import gregtech.api.enums.Materials; -import gregtech.api.enums.SoundResource; -import gregtech.api.gui.modularui.GT_UIInfos; -import gregtech.api.interfaces.ITexture; -import gregtech.api.interfaces.tileentity.IGregTechTileEntity; -import gregtech.api.items.GT_MetaGenerated_Tool; -import gregtech.api.metatileentity.MetaTileEntity; -import gregtech.api.metatileentity.implementations.GT_MetaTileEntity_Hatch; -import gregtech.api.objects.GT_ItemStack; -import gregtech.api.objects.GT_RenderedTexture; -import gregtech.api.util.GT_ModHandler; -import gregtech.api.util.GT_Utility; -import gtPlusPlus.api.objects.Logger; -import gtPlusPlus.api.objects.minecraft.BlockPos; -import gtPlusPlus.core.lib.CORE; -import gtPlusPlus.core.util.math.MathUtils; -import gtPlusPlus.core.util.minecraft.PlayerUtils; -import gtPlusPlus.xmod.gregtech.common.tileentities.machines.multi.production.turbines.GregtechMetaTileEntity_LargerTurbineBase; - -@SuppressWarnings("deprecation") -public class GT_MetaTileEntity_Hatch_Turbine extends GT_MetaTileEntity_Hatch { - - public boolean mHasController = false; - public boolean mUsingAnimation = true; - private String mControllerLocation; - public int mEUt = 0; - - public GT_MetaTileEntity_Hatch_Turbine(int aID, String aName, String aNameRegional, int aTier) { - super(aID, aName, aNameRegional, aTier, 16, "Turbine Rotor holder for XL Turbines"); - } - - public GT_MetaTileEntity_Hatch_Turbine(String aName, int aTier, String aDescription, ITexture[][][] aTextures) { - super(aName, aTier, 1, aDescription, aTextures); - } - - public GT_MetaTileEntity_Hatch_Turbine(String aName, int aTier, String[] aDescription, ITexture[][][] aTextures) { - super(aName, aTier, 1, aDescription[0], aTextures); - } - - @Override - public String[] getDescription() { - return ArrayUtils.addAll( - this.mDescriptionArray, - "Right Click with a soldering iron to reset controller link", - "Right Click with a wrench to remove turbine", - "Right Click with a screwdriver for technical information", - "Sneak + Right Click with a wrench to rotate", - "Sneak + Right Click with a screwdriver to disable animations", - CORE.GT_Tooltip.get()); - } - - @Override - public ITexture[] getTexturesActive(ITexture aBaseTexture) { - return new ITexture[] { aBaseTexture, getFrontFacingTurbineTexture() }; - } - - @Override - public ITexture[] getTexturesInactive(ITexture aBaseTexture) { - return new ITexture[] { aBaseTexture, getFrontFacingTurbineTexture() }; - } - - public int getEU() { - return this.mEUt; - } - - public void setEU(int aEU) { - this.mEUt = aEU; - } - - @Override - public boolean isSimpleMachine() { - return true; - } - - @Override - public boolean isFacingValid(ForgeDirection facing) { - return facing.offsetY == 0; - } - - @Override - public boolean isAccessAllowed(EntityPlayer aPlayer) { - return true; - } - - @Override - public boolean isValidSlot(int aIndex) { - return false; - } - - public boolean hasTurbine() { - ItemStack aStack = this.mInventory[0]; - boolean aIsValid = GregtechMetaTileEntity_LargerTurbineBase.isValidTurbine(aStack); - return aIsValid; - } - - public ItemStack getTurbine() { - if (hasTurbine()) { - return this.mInventory[0]; - } - return null; - } - - public boolean canWork() { - return hasTurbine(); - } - - public boolean insertTurbine(ItemStack aTurbine) { - if (GregtechMetaTileEntity_LargerTurbineBase.isValidTurbine(aTurbine)) { - this.mInventory[0] = aTurbine; - return true; - } - return false; - } - - @Override - public MetaTileEntity newMetaEntity(IGregTechTileEntity aTileEntity) { - return new GT_MetaTileEntity_Hatch_Turbine(mName, mTier, mDescriptionArray, mTextures); - } - - @Override - public boolean onRightclick(IGregTechTileEntity aBaseMetaTileEntity, EntityPlayer aPlayer) { - GT_UIInfos.openGTTileEntityUI(aBaseMetaTileEntity, aPlayer); - return true; - } - - @Override - public boolean allowPullStack(IGregTechTileEntity aBaseMetaTileEntity, int aIndex, ForgeDirection side, - ItemStack aStack) { - return false; - } - - @Override - public boolean allowPutStack(IGregTechTileEntity aBaseMetaTileEntity, int aIndex, ForgeDirection side, - ItemStack aStack) { - return false; - } - - @Override - public int getInventoryStackLimit() { - return 1; - } - - public void damageTurbine(int aEUt, int damageFactorLow, float damageFactorHigh) { - damageTurbine((long) aEUt, damageFactorLow, damageFactorHigh); - } - - public void damageTurbine(long aEUt, int damageFactorLow, float damageFactorHigh) { - if (hasTurbine() && MathUtils.randInt(0, 1) == 0) { - ItemStack aTurbine = getTurbine(); - ((GT_MetaGenerated_Tool) aTurbine.getItem()).doDamage( - aTurbine, - (long) getDamageToComponent(aTurbine) - * (long) Math.min((float) aEUt / (float) damageFactorLow, Math.pow(aEUt, damageFactorHigh))); - } - } - - private int getDamageToComponent(ItemStack aStack) { - return 1; - } - - @Override - public void saveNBTData(NBTTagCompound aNBT) { - super.saveNBTData(aNBT); - aNBT.setBoolean("mHasController", mHasController); - aNBT.setBoolean("mUsingAnimation", mUsingAnimation); - } - - @Override - public void loadNBTData(NBTTagCompound aNBT) { - super.loadNBTData(aNBT); - mHasController = aNBT.getBoolean("mHasController"); - mUsingAnimation = aNBT.getBoolean("mUsingAnimation"); - } - - @Override - public void onPostTick(IGregTechTileEntity aBaseMetaTileEntity, long aTick) { - super.onPostTick(aBaseMetaTileEntity, aTick); - if (this.mHasController) { - if (aTick % 20 == 0) { - if (isControllerActive()) { - this.getBaseMetaTileEntity() - .setActive(true); - } else { - this.getBaseMetaTileEntity() - .setActive(false); - } - } - } else if (!this.mHasController && this.mControllerLocation != null) { - // Weird Invalid State - if (setController(BlockPos.generateBlockPos(mControllerLocation))) { - // Valid - } - } else { - // No Controller - } - if (this.mInventory[0] != null && this.mInventory[0].stackSize <= 0) this.mInventory[0] = null; - } - - public boolean isControllerActive() { - GregtechMetaTileEntity_LargerTurbineBase x = getController(); - if (x != null) { - // Logger.INFO("Checking Status of Controller. Running? "+(x.mEUt > 0)); - return x.lEUt > 0; - } - // Logger.INFO("Status of Controller failed, controller is null."); - return false; - } - - public GregtechMetaTileEntity_LargerTurbineBase getController() { - if (this.mHasController && this.mControllerLocation != null && this.mControllerLocation.length() > 0) { - BlockPos p = BlockPos.generateBlockPos(mControllerLocation); - if (p != null) { - // Logger.INFO(p.getLocationString()); - IGregTechTileEntity tTileEntity = getBaseMetaTileEntity() - .getIGregTechTileEntity(p.xPos, p.yPos, p.zPos); - if (tTileEntity != null - && tTileEntity.getMetaTileEntity() instanceof GregtechMetaTileEntity_LargerTurbineBase) { - return (GregtechMetaTileEntity_LargerTurbineBase) tTileEntity.getMetaTileEntity(); - } else { - if (tTileEntity == null) { - Logger.INFO("Controller MTE is null, somehow?"); - } else { - Logger.INFO("Controller is a different MTE to expected"); - } - } - } - } - // Logger.INFO("Failed to Get Controller."); - return null; - } - - public boolean canSetNewController() { - if ((mControllerLocation != null && mControllerLocation.length() > 0) || this.mHasController) { - return false; - } - return true; - } - - public boolean setController(BlockPos aPos) { - clearController(); - if (canSetNewController()) { - mControllerLocation = aPos.getUniqueIdentifier(); - mHasController = true; - Logger.INFO("Successfully injected controller into this Turbine Assembly Hatch."); - } - return mHasController; - } - - public void clearController() { - this.mControllerLocation = null; - this.mHasController = false; - } - - public boolean usingAnimations() { - return mUsingAnimation; - } - - private ITexture getFrontFacingTurbineTexture() { - if (!mHasController) { - return this.getBaseMetaTileEntity() - .isActive() ? new GT_RenderedTexture(LARGETURBINE_ST_ACTIVE5) - : new GT_RenderedTexture(LARGETURBINE_ST5); - } else { - if (usingAnimations()) { - if (isControllerActive()) { - return getController().frontFaceActive; - } - } - return getController().frontFace; - } - } - - @Override - public long getMinimumStoredEU() { - return 0; - } - - @Override - public boolean isItemValidForSlot(int aIndex, ItemStack aStack) { - return false; - } - - @Override - public int[] getAccessibleSlotsFromSide(int ordinalSide) { - return new int[] {}; - } - - @Override - public boolean canInsertItem(int aIndex, ItemStack aStack, int ordinalSide) { - return false; - } - - public void setActive(boolean b) { - this.getBaseMetaTileEntity() - .setActive(b); - } - - @Override - public boolean allowCoverOnSide(ForgeDirection side, GT_ItemStack aStack) { - return false; - } - - @Override - public void onScrewdriverRightClick(ForgeDirection side, EntityPlayer aPlayer, float aX, float aY, float aZ) { - if (!aPlayer.isSneaking()) { - PlayerUtils.messagePlayer(aPlayer, "Using Animations? " + usingAnimations()); - PlayerUtils.messagePlayer(aPlayer, "Has Controller? " + this.mHasController); - if (mHasController) { - PlayerUtils.messagePlayer( - aPlayer, - "Controller Location: " + BlockPos.generateBlockPos(mControllerLocation) - .getLocationString()); - PlayerUtils.messagePlayer(aPlayer, "Controller Active? " + this.isControllerActive()); - } - PlayerUtils.messagePlayer( - aPlayer, - "Active? " + this.getBaseMetaTileEntity() - .isActive()); - PlayerUtils.messagePlayer(aPlayer, "Has Turbine inserted? " + this.hasTurbine()); - if (this.hasTurbine()) { - Materials aMat = GT_MetaGenerated_Tool.getPrimaryMaterial(getTurbine()); - String aSize = GregtechMetaTileEntity_LargerTurbineBase - .getTurbineSizeString(GregtechMetaTileEntity_LargerTurbineBase.getTurbineSize(getTurbine())); - PlayerUtils.messagePlayer(aPlayer, "Using: " + aMat.mLocalizedName + " " + aSize); - } - } else { - this.mUsingAnimation = !mUsingAnimation; - if (this.mUsingAnimation) { - PlayerUtils.messagePlayer(aPlayer, "Using Animated Turbine Texture."); - } else { - PlayerUtils.messagePlayer(aPlayer, "Using Static Turbine Texture."); - } - } - } - - @Override - public boolean onWrenchRightClick(ForgeDirection side, ForgeDirection wrenchingSide, EntityPlayer aPlayer, float aX, - float aY, float aZ) { - if (this.getBaseMetaTileEntity() - .isServerSide() && !aPlayer.isSneaking()) { - ItemStack tCurrentItem = aPlayer.inventory.getCurrentItem(); - if (tCurrentItem != null) { - if (tCurrentItem.getItem() instanceof GT_MetaGenerated_Tool) { - return onToolClick(tCurrentItem, aPlayer, wrenchingSide); - } - } - } - return super.onWrenchRightClick(side, wrenchingSide, aPlayer, aX, aY, aZ); - } - - @Override - public boolean onSolderingToolRightClick(ForgeDirection side, ForgeDirection wrenchingSide, EntityPlayer aPlayer, - float aX, float aY, float aZ) { - if (this.getBaseMetaTileEntity() - .isServerSide()) { - ItemStack tCurrentItem = aPlayer.inventory.getCurrentItem(); - if (tCurrentItem != null) { - if (tCurrentItem.getItem() instanceof GT_MetaGenerated_Tool) { - return onToolClick(tCurrentItem, aPlayer, wrenchingSide); - } - } - } - return false; - } - - public boolean onToolClick(ItemStack tCurrentItem, EntityPlayer aPlayer, ForgeDirection side) { - if (GT_Utility.isStackInList(tCurrentItem, GregTech_API.sWrenchList)) { - boolean aHasTurbine = this.hasTurbine(); - if (aPlayer.inventory.getFirstEmptyStack() >= 0 && aHasTurbine) { - if (PlayerUtils.isCreative(aPlayer) - || GT_ModHandler.damageOrDechargeItem(tCurrentItem, 1, 1000, aPlayer)) { - aPlayer.inventory.addItemStackToInventory((this.getTurbine())); - this.mInventory[0] = null; - GT_Utility.sendChatToPlayer(aPlayer, "Removed turbine with wrench."); - return true; - } - } else { - GT_Utility.sendChatToPlayer( - aPlayer, - aHasTurbine ? "Cannot remove turbine, no free inventory space." : "No turbine to remove."); - } - } else if (GT_Utility.isStackInList(tCurrentItem, GregTech_API.sSolderingToolList)) { - if (mControllerLocation != null && mControllerLocation.length() > 0) { - if (setController(BlockPos.generateBlockPos(mControllerLocation))) { - if (PlayerUtils.isCreative(aPlayer) - || GT_ModHandler.damageOrDechargeItem(tCurrentItem, 1, 1000, aPlayer)) { - String tChat = "Trying to Reset linked Controller"; - IGregTechTileEntity g = this.getBaseMetaTileEntity(); - GT_Utility.sendChatToPlayer(aPlayer, tChat); - GT_Utility.sendSoundToPlayers( - g.getWorld(), - SoundResource.IC2_TOOLS_RUBBER_TRAMPOLINE, - 1.0F, - -1, - g.getXCoord(), - g.getYCoord(), - g.getZCoord()); - return true; - } - } - } - } - return false; - } - - @Override - public boolean useModularUI() { - return true; - } - - @Override - public void addUIWidgets(ModularWindow.Builder builder, UIBuildContext buildContext) { - builder.widget( - new SlotWidget(inventoryHandler, 0).setFilter(GregtechMetaTileEntity_LargerTurbineBase::isValidTurbine) - .setAccess(false, true) - .setPos(79, 34)); - } -} diff --git a/gtpp/src/main/java/gtPlusPlus/xmod/gregtech/api/metatileentity/implementations/GT_MetaTileEntity_Hatch_TurbineProvider.java b/gtpp/src/main/java/gtPlusPlus/xmod/gregtech/api/metatileentity/implementations/GT_MetaTileEntity_Hatch_TurbineProvider.java deleted file mode 100644 index e9626a310c..0000000000 --- a/gtpp/src/main/java/gtPlusPlus/xmod/gregtech/api/metatileentity/implementations/GT_MetaTileEntity_Hatch_TurbineProvider.java +++ /dev/null @@ -1,221 +0,0 @@ -package gtPlusPlus.xmod.gregtech.api.metatileentity.implementations; - -import net.minecraft.entity.player.EntityPlayer; -import net.minecraft.item.ItemStack; -import net.minecraft.nbt.NBTTagCompound; -import net.minecraft.world.World; -import net.minecraft.world.chunk.Chunk; -import net.minecraftforge.common.util.ForgeDirection; - -import com.gtnewhorizons.modularui.api.screen.ModularWindow; -import com.gtnewhorizons.modularui.api.screen.UIBuildContext; -import com.gtnewhorizons.modularui.common.widget.SlotWidget; - -import gregtech.api.interfaces.ITexture; -import gregtech.api.interfaces.metatileentity.IMetaTileEntity; -import gregtech.api.interfaces.tileentity.IGregTechTileEntity; -import gregtech.api.items.GT_MetaGenerated_Tool; -import gregtech.api.metatileentity.MetaTileEntity; -import gregtech.api.metatileentity.implementations.GT_MetaTileEntity_Hatch_InputBus; -import gregtech.common.tileentities.machines.multi.GT_MetaTileEntity_LargeTurbine; -import gtPlusPlus.api.objects.Logger; -import gtPlusPlus.core.lib.CORE; -import gtPlusPlus.core.util.minecraft.PlayerUtils; -import gtPlusPlus.core.util.sys.KeyboardUtils; -import gtPlusPlus.xmod.gregtech.common.tileentities.machines.multi.production.turbines.GregtechMetaTileEntity_LargerTurbineBase; - -public class GT_MetaTileEntity_Hatch_TurbineProvider extends GT_MetaTileEntity_Hatch_InputBus { - - public GT_MetaTileEntity_Hatch_TurbineProvider(int aID, String aName, String aNameRegional, int aTier) { - super(aID, aName, aNameRegional, aTier); - } - - public GT_MetaTileEntity_Hatch_TurbineProvider(String aName, int aTier, String[] aDescription, - ITexture[][][] aTextures) { - super(aName, aTier, aDescription, aTextures); - } - - @Override - public MetaTileEntity newMetaEntity(IGregTechTileEntity aTileEntity) { - return new GT_MetaTileEntity_Hatch_TurbineProvider( - this.mName, - this.mTier, - this.mDescriptionArray, - this.mTextures); - } - - @Override - public String[] getDescription() { - return new String[] { "An automation port for Large Turbines", - "Will attempt once per 1200 ticks to fill the turbine slot of it's parent turbine", - "You may adjust this with a screwdriver", "Hold shift to adjust in finer amounts", - "Hold control to adjust direction", "Left Click with Screwdriver to reset", - "This module assumes the entire turbine is in the same Chunk", CORE.GT_Tooltip.get() }; - } - - private GT_MetaTileEntity_LargeTurbine mParent = null; - - @Override - public void onPostTick(IGregTechTileEntity aBaseMetaTileEntity, long aTimer) { - super.onPostTick(aBaseMetaTileEntity, aTimer); - if (aTimer % mRefreshTime == 0 && this.getBaseMetaTileEntity() - .isServerSide()) { - tryRefillTurbine(); - } - } - - private void tryFindParentTurbine() { - Logger.INFO("This turbine housing has no parent, searching world."); - IGregTechTileEntity T = this.getBaseMetaTileEntity(); - World W = T.getWorld(); - Chunk C = W.getChunkFromBlockCoords(T.getXCoord(), T.getZCoord()); - for (Object o : C.chunkTileEntityMap.values()) { - if (o instanceof IGregTechTileEntity G) { - final IMetaTileEntity aMetaTileEntity = G.getMetaTileEntity(); - if (aMetaTileEntity == null) { - continue; - } - if (aMetaTileEntity instanceof GT_MetaTileEntity_LargeTurbine aTurb) { - for (GT_MetaTileEntity_Hatch_InputBus ee : aTurb.mInputBusses) { - if (ee.equals(this)) { - mParent = aTurb; - Logger.INFO("Found a Parent to attach to this housing."); - return; - } - } - } - } - } - } - - private void tryRefillTurbine() { - if (mParent == null) { - tryFindParentTurbine(); - } - if (mParent != null && mParent.mInventory[1] == null) { - for (ItemStack aStack : this.mInventory) { - if (isItemStackTurbine(aStack)) { - setGUIItemStack(aStack); - } - } - } - } - - protected boolean setGUIItemStack(ItemStack aNewGuiSlotContents) { - boolean result = false; - if (mParent.mInventory[1] == null) { - mParent.mInventory[1] = aNewGuiSlotContents != null ? aNewGuiSlotContents.copy() : null; - mParent.depleteInput(aNewGuiSlotContents); - mParent.updateSlots(); - this.updateSlots(); - result = true; - } - return result; - } - - public boolean isItemStackTurbine(ItemStack aStack) { - if (aStack.getItem() instanceof GT_MetaGenerated_Tool) { - if (aStack.getItemDamage() >= 170 && aStack.getItemDamage() <= 176) { - return true; - } - } - return false; - } - - public boolean isItemStackScrewdriver(ItemStack aStack) { - if (aStack.getItem() instanceof GT_MetaGenerated_Tool) { - if (aStack.getItemDamage() == 22 || aStack.getItemDamage() == 150) { - return true; - } - } - return false; - } - - @Override - public boolean allowPullStack(IGregTechTileEntity aBaseMetaTileEntity, int aIndex, ForgeDirection side, - ItemStack aStack) { - return false; - } - - @Override - public boolean allowPutStack(IGregTechTileEntity aBaseMetaTileEntity, int aIndex, ForgeDirection side, - ItemStack aStack) { - return isItemStackTurbine(aStack); - } - - private int mRefreshTime = 1200; - private boolean mDescending = true; - - @Override - public void saveNBTData(NBTTagCompound aNBT) { - super.saveNBTData(aNBT); - aNBT.setInteger("mRefreshTime", mRefreshTime); - aNBT.setBoolean("mDescending", mDescending); - } - - @Override - public void loadNBTData(NBTTagCompound aNBT) { - super.loadNBTData(aNBT); - mRefreshTime = aNBT.getInteger("mRefreshTime"); - mDescending = aNBT.getBoolean("mDescending"); - } - - @Override - public void onScrewdriverRightClick(ForgeDirection side, EntityPlayer aPlayer, float aX, float aY, float aZ) { - if (aPlayer != null) { - if (KeyboardUtils.isCtrlKeyDown()) { - mDescending = !mDescending; - PlayerUtils.messagePlayer(aPlayer, "Direction: " + (mDescending ? "DOWN" : "UP")); - } else { - int aAmount = 0; - if (KeyboardUtils.isShiftKeyDown()) { - aAmount = 10; - } else { - aAmount = 100; - } - if (mDescending) { - mRefreshTime -= aAmount; - if (mRefreshTime < 0) { - mRefreshTime = 1200; - } - } else { - mRefreshTime += aAmount; - if (mRefreshTime > 1200) { - mRefreshTime = 0; - } - } - PlayerUtils.messagePlayer(aPlayer, "Set check time to be every " + mRefreshTime + " ticks."); - } - } - } - - @Override - public void onLeftclick(IGregTechTileEntity aBaseMetaTileEntity, EntityPlayer aPlayer) { - boolean aDidScrewdriver = false; - if (aPlayer != null) { - if (aPlayer.getHeldItem() != null) { - if (isItemStackScrewdriver(aPlayer.getHeldItem())) { - aDidScrewdriver = true; - mRefreshTime = 1200; - PlayerUtils.messagePlayer(aPlayer, "Reset check time to " + mRefreshTime + " ticks."); - } - } - } - if (!aDidScrewdriver) { - super.onLeftclick(aBaseMetaTileEntity, aPlayer); - } - } - - @Override - public boolean allowSelectCircuit() { - return false; - } - - @Override - public void addUIWidgets(ModularWindow.Builder builder, UIBuildContext buildContext) { - builder.widget( - new SlotWidget(inventoryHandler, 0).setFilter(GregtechMetaTileEntity_LargerTurbineBase::isValidTurbine) - .setAccess(false, true) - .setPos(79, 34)); - } -} diff --git a/gtpp/src/main/java/gtPlusPlus/xmod/gregtech/api/metatileentity/implementations/GT_MetaTileEntity_SuperBus_Input.java b/gtpp/src/main/java/gtPlusPlus/xmod/gregtech/api/metatileentity/implementations/GT_MetaTileEntity_SuperBus_Input.java deleted file mode 100644 index 5794e6adf8..0000000000 --- a/gtpp/src/main/java/gtPlusPlus/xmod/gregtech/api/metatileentity/implementations/GT_MetaTileEntity_SuperBus_Input.java +++ /dev/null @@ -1,65 +0,0 @@ -package gtPlusPlus.xmod.gregtech.api.metatileentity.implementations; - -import com.gtnewhorizons.modularui.api.screen.ModularWindow.Builder; -import com.gtnewhorizons.modularui.api.screen.UIBuildContext; -import com.gtnewhorizons.modularui.common.widget.Scrollable; -import com.gtnewhorizons.modularui.common.widget.SlotWidget; - -import gregtech.api.interfaces.ITexture; -import gregtech.api.interfaces.tileentity.IGregTechTileEntity; -import gregtech.api.metatileentity.MetaTileEntity; -import gregtech.api.metatileentity.implementations.GT_MetaTileEntity_Hatch_InputBus; -import gtPlusPlus.core.lib.CORE; - -public class GT_MetaTileEntity_SuperBus_Input extends GT_MetaTileEntity_Hatch_InputBus { - - public GT_MetaTileEntity_SuperBus_Input(int aID, String aName, String aNameRegional, int aTier) { - super(aID, aName, aNameRegional, aTier, getSlots(aTier) + 1); - } - - public GT_MetaTileEntity_SuperBus_Input(String aName, int aTier, String[] aDescription, ITexture[][][] aTextures) { - super(aName, aTier, getSlots(aTier) + 1, aDescription, aTextures); - } - - /** - * Returns a factor of 16 based on tier. - * - * @param aTier The tier of this bus. - * @return (1 + aTier) * 16 - */ - public static int getSlots(int aTier) { - return (1 + aTier) * 16; - } - - @Override - public MetaTileEntity newMetaEntity(IGregTechTileEntity aTileEntity) { - return new GT_MetaTileEntity_SuperBus_Input(this.mName, this.mTier, mDescriptionArray, this.mTextures); - } - - @Override - public String[] getDescription() { - return new String[] { "Item Input for Multiblocks", "" + getSlots(this.mTier) + " Slots", - CORE.GT_Tooltip.get() }; - } - - @Override - public int getCircuitSlot() { - return getSlots(mTier); - } - - @Override - public void addUIWidgets(Builder builder, UIBuildContext buildContext) { - final Scrollable scrollable = new Scrollable().setVerticalScroll(); - for (int row = 0; row * 4 < inventoryHandler.getSlots() - 1; row++) { - int columnsToMake = Math.min(inventoryHandler.getSlots() - row * 4, 4); - for (int column = 0; column < columnsToMake; column++) { - scrollable.widget( - new SlotWidget(inventoryHandler, row * 4 + column).setPos(column * 18, row * 18) - .setSize(18, 18)); - } - } - builder.widget( - scrollable.setSize(18 * 4 + 4, 18 * 4) - .setPos(52, 7)); - } -} diff --git a/gtpp/src/main/java/gtPlusPlus/xmod/gregtech/api/metatileentity/implementations/GT_MetaTileEntity_SuperBus_Output.java b/gtpp/src/main/java/gtPlusPlus/xmod/gregtech/api/metatileentity/implementations/GT_MetaTileEntity_SuperBus_Output.java deleted file mode 100644 index aee6235ab9..0000000000 --- a/gtpp/src/main/java/gtPlusPlus/xmod/gregtech/api/metatileentity/implementations/GT_MetaTileEntity_SuperBus_Output.java +++ /dev/null @@ -1,105 +0,0 @@ -package gtPlusPlus.xmod.gregtech.api.metatileentity.implementations; - -import net.minecraft.inventory.IInventory; - -import com.gtnewhorizons.modularui.api.screen.ModularWindow.Builder; -import com.gtnewhorizons.modularui.api.screen.UIBuildContext; -import com.gtnewhorizons.modularui.common.widget.Scrollable; -import com.gtnewhorizons.modularui.common.widget.SlotWidget; - -import gregtech.api.interfaces.ITexture; -import gregtech.api.interfaces.tileentity.IGregTechTileEntity; -import gregtech.api.metatileentity.MetaTileEntity; -import gregtech.api.metatileentity.implementations.GT_MetaTileEntity_Hatch_OutputBus; -import gregtech.api.util.GT_Utility; -import gtPlusPlus.core.lib.CORE; - -public class GT_MetaTileEntity_SuperBus_Output extends GT_MetaTileEntity_Hatch_OutputBus { - - public GT_MetaTileEntity_SuperBus_Output(int id, String name, String nameRegional, int tier) { - super(id, name, nameRegional, tier, getSlots(tier)); - } - - public GT_MetaTileEntity_SuperBus_Output(String name, int tier, String[] description, ITexture[][][] textures) { - super(name, tier, getSlots(tier), description, textures); - } - - /** - * Returns a factor of 16 based on tier. - * - * @param aTier The tier of this bus. - * @return (1 + aTier) * 16 - */ - public static int getSlots(int aTier) { - return (1 + aTier) * 16; - } - - @Override - public boolean isValidSlot(int aIndex) { - return true; - } - - @Override - public MetaTileEntity newMetaEntity(IGregTechTileEntity aTileEntity) { - return new GT_MetaTileEntity_SuperBus_Output(this.mName, this.mTier, mDescriptionArray, this.mTextures); - } - - @Override - public void onPostTick(IGregTechTileEntity aBaseMetaTileEntity, long aTimer) { - if (aBaseMetaTileEntity.isServerSide() && aBaseMetaTileEntity.hasInventoryBeenModified()) { - this.fillStacksIntoFirstSlots(); - } - super.onPostTick(aBaseMetaTileEntity, aTimer); - } - - public void updateSlots() { - for (int i = 0; i < this.mInventory.length; ++i) { - if (this.mInventory[i] != null && this.mInventory[i].stackSize <= 0) { - this.mInventory[i] = null; - } - } - this.fillStacksIntoFirstSlots(); - } - - protected void fillStacksIntoFirstSlots() { - for (int i = 0; i < this.mInventory.length; ++i) { - for (int j = i + 1; j < this.mInventory.length; ++j) { - if (this.mInventory[j] != null && (this.mInventory[i] == null - || GT_Utility.areStacksEqual(this.mInventory[i], this.mInventory[j]))) { - GT_Utility.moveStackFromSlotAToSlotB( - (IInventory) this.getBaseMetaTileEntity(), - (IInventory) this.getBaseMetaTileEntity(), - j, - i, - (byte) 64, - (byte) 1, - (byte) 64, - (byte) 1); - } - } - } - } - - @Override - public String[] getDescription() { - String[] aDesc = new String[] { "Item Output for Multiblocks", "" + getSlots(this.mTier) + " Slots", - CORE.GT_Tooltip.get() }; - return aDesc; - } - - @Override - public void addUIWidgets(Builder builder, UIBuildContext buildContext) { - final Scrollable scrollable = new Scrollable().setVerticalScroll(); - for (int row = 0; row * 4 < inventoryHandler.getSlots() - 1; row++) { - int columnsToMake = Math.min(inventoryHandler.getSlots() - row * 4, 4); - for (int column = 0; column < columnsToMake; column++) { - scrollable.widget( - new SlotWidget(inventoryHandler, row * 4 + column).setPos(column * 18, row * 18) - .setSize(18, 18)); - } - } - builder.widget( - scrollable.setSize(18 * 4 + 4, 18 * 4) - .setPos(52, 7)); - } -} diff --git a/gtpp/src/main/java/gtPlusPlus/xmod/gregtech/api/metatileentity/implementations/GregtechMetaPipeEntityFluid.java b/gtpp/src/main/java/gtPlusPlus/xmod/gregtech/api/metatileentity/implementations/GregtechMetaPipeEntityFluid.java deleted file mode 100644 index e9f9a2dda4..0000000000 --- a/gtpp/src/main/java/gtPlusPlus/xmod/gregtech/api/metatileentity/implementations/GregtechMetaPipeEntityFluid.java +++ /dev/null @@ -1,117 +0,0 @@ -package gtPlusPlus.xmod.gregtech.api.metatileentity.implementations; - -import net.minecraftforge.common.util.ForgeDirection; - -import gregtech.api.enums.Dyes; -import gregtech.api.enums.OrePrefixes; -import gregtech.api.enums.SubTag; -import gregtech.api.interfaces.ITexture; -import gregtech.api.interfaces.metatileentity.IMetaTileEntity; -import gregtech.api.interfaces.tileentity.IGregTechTileEntity; -import gregtech.api.metatileentity.implementations.GT_MetaPipeEntity_Fluid; -import gregtech.api.render.TextureFactory; -import gtPlusPlus.xmod.gregtech.api.enums.GregtechOrePrefixes.GT_Materials; - -public class GregtechMetaPipeEntityFluid extends GT_MetaPipeEntity_Fluid { - - public final GT_Materials mMaterial; - - public GregtechMetaPipeEntityFluid(int aID, String aName, String aNameRegional, float aThickNess, - GT_Materials aMaterial, int aCapacity, int aHeatResistance, boolean aGasProof) { - this(aID, aName, aNameRegional, aThickNess, aMaterial, aCapacity, aHeatResistance, aGasProof, 1); - } - - public GregtechMetaPipeEntityFluid(final String aName, final float aThickNess, final GT_Materials aMaterial, - final int aCapacity, final int aHeatResistance, final boolean aGasProof) { - this(aName, aThickNess, aMaterial, aCapacity, aHeatResistance, aGasProof, 1); - } - - public GregtechMetaPipeEntityFluid(int aID, String aName, String aNameRegional, float aThickNess, - GT_Materials aMaterial, int aCapacity, int aHeatResistance, boolean aGasProof, int aFluidTypes) { - super(aID, aName, aNameRegional, aThickNess, null, aCapacity, aHeatResistance, aGasProof, aFluidTypes); - this.mLastReceivedFrom = 0; - this.oLastReceivedFrom = 0; - this.mMaterial = aMaterial; - } - - public GregtechMetaPipeEntityFluid(String aName, float aThickNess, GT_Materials aMaterial, int aCapacity, - int aHeatResistance, boolean aGasProof, int aFluidTypes) { - super(aName, aThickNess, null, aCapacity, aHeatResistance, aGasProof, aFluidTypes); - this.mLastReceivedFrom = 0; - this.oLastReceivedFrom = 0; - this.mMaterial = aMaterial; - } - - @Override - public byte getTileEntityBaseType() { - return this.mMaterial == null ? 4 - : (byte) ((this.mMaterial.contains(SubTag.WOOD) ? 12 : 4) - + Math.max(0, Math.min(3, this.mMaterial.mToolQuality))); - } - - @Override - public IMetaTileEntity newMetaEntity(final IGregTechTileEntity aTileEntity) { - return new GregtechMetaPipeEntityFluid( - this.mName, - this.mThickNess, - this.mMaterial, - this.mCapacity, - this.mHeatResistance, - this.mGasProof); - } - - @Override - public ITexture[] getTexture(IGregTechTileEntity aBaseMetaTileEntity, ForgeDirection side, int aConnections, - int aColorIndex, boolean aConnected, boolean aRedstone) { - float tThickNess = getThickNess(); - if (mDisableInput == 0) - return new ITexture[] { aConnected ? getBaseTexture(tThickNess, mPipeAmount, mMaterial, aColorIndex) - : TextureFactory.of( - mMaterial.mIconSet.mTextures[OrePrefixes.pipe.mTextureIndex], - Dyes.getModulation(aColorIndex, mMaterial.mRGBa)) }; - int tMask = 0; - int[][] sRestrictionArray = { { 2, 3, 5, 4 }, { 2, 3, 5, 4 }, { 1, 0, 5, 4 }, { 1, 0, 4, 5 }, { 1, 0, 2, 3 }, - { 1, 0, 2, 3 } }; - if (side != ForgeDirection.UNKNOWN) { - for (int i = 0; i < 4; i++) - if (isInputDisabledAtSide(ForgeDirection.getOrientation(sRestrictionArray[side.ordinal()][i]))) - tMask |= 1 << i; - // Full block size renderer flips side 5 and 2 textures, flip restrictor textures to compensate - if (side == ForgeDirection.EAST || side == ForgeDirection.UP) - if (tMask > 3 && tMask < 12) tMask = (tMask ^ 12); - } - return new ITexture[] { aConnected ? getBaseTexture(tThickNess, mPipeAmount, mMaterial, aColorIndex) - : TextureFactory.of( - mMaterial.mIconSet.mTextures[OrePrefixes.pipe.mTextureIndex], - Dyes.getModulation(aColorIndex, mMaterial.mRGBa)), - getRestrictorTexture(tMask) }; - } - - protected static ITexture getBaseTexture(float aThickNess, int aPipeAmount, GT_Materials aMaterial, - int aColorIndex) { - if (aPipeAmount >= 9) return TextureFactory.of( - aMaterial.mIconSet.mTextures[OrePrefixes.pipeNonuple.mTextureIndex], - Dyes.getModulation(aColorIndex, aMaterial.mRGBa)); - if (aPipeAmount >= 4) return TextureFactory.of( - aMaterial.mIconSet.mTextures[OrePrefixes.pipeQuadruple.mTextureIndex], - Dyes.getModulation(aColorIndex, aMaterial.mRGBa)); - if (aThickNess < 0.124F) return TextureFactory.of( - aMaterial.mIconSet.mTextures[OrePrefixes.pipe.mTextureIndex], - Dyes.getModulation(aColorIndex, aMaterial.mRGBa)); - if (aThickNess < 0.374F) return TextureFactory.of( - aMaterial.mIconSet.mTextures[OrePrefixes.pipeTiny.mTextureIndex], - Dyes.getModulation(aColorIndex, aMaterial.mRGBa)); - if (aThickNess < 0.499F) return TextureFactory.of( - aMaterial.mIconSet.mTextures[OrePrefixes.pipeSmall.mTextureIndex], - Dyes.getModulation(aColorIndex, aMaterial.mRGBa)); - if (aThickNess < 0.749F) return TextureFactory.of( - aMaterial.mIconSet.mTextures[OrePrefixes.pipeMedium.mTextureIndex], - Dyes.getModulation(aColorIndex, aMaterial.mRGBa)); - if (aThickNess < 0.874F) return TextureFactory.of( - aMaterial.mIconSet.mTextures[OrePrefixes.pipeLarge.mTextureIndex], - Dyes.getModulation(aColorIndex, aMaterial.mRGBa)); - return TextureFactory.of( - aMaterial.mIconSet.mTextures[OrePrefixes.pipeHuge.mTextureIndex], - Dyes.getModulation(aColorIndex, aMaterial.mRGBa)); - } -} diff --git a/gtpp/src/main/java/gtPlusPlus/xmod/gregtech/api/metatileentity/implementations/GregtechMetaPipeEntity_Cable.java b/gtpp/src/main/java/gtPlusPlus/xmod/gregtech/api/metatileentity/implementations/GregtechMetaPipeEntity_Cable.java deleted file mode 100644 index 9b1408ba51..0000000000 --- a/gtpp/src/main/java/gtPlusPlus/xmod/gregtech/api/metatileentity/implementations/GregtechMetaPipeEntity_Cable.java +++ /dev/null @@ -1,156 +0,0 @@ -package gtPlusPlus.xmod.gregtech.api.metatileentity.implementations; - -import net.minecraftforge.common.util.ForgeDirection; - -import gregtech.api.enums.Dyes; -import gregtech.api.enums.Materials; -import gregtech.api.enums.TextureSet; -import gregtech.api.enums.Textures; -import gregtech.api.interfaces.ITexture; -import gregtech.api.interfaces.metatileentity.IMetaTileEntity; -import gregtech.api.interfaces.metatileentity.IMetaTileEntityCable; -import gregtech.api.interfaces.tileentity.IGregTechTileEntity; -import gregtech.api.metatileentity.implementations.GT_MetaPipeEntity_Cable; -import gregtech.api.objects.GT_RenderedTexture; -import gregtech.api.util.GT_Utility; - -public class GregtechMetaPipeEntity_Cable extends GT_MetaPipeEntity_Cable implements IMetaTileEntityCable { - - private static Textures.BlockIcons INSULATION_MEDIUM_PLUS; - - static { - try { - INSULATION_MEDIUM_PLUS = (Textures.BlockIcons) GT_Utility - .getField(Textures.BlockIcons.class, "INSULATION_MEDIUM_PLUS") - .get(null); - } catch (IllegalAccessException | NullPointerException e) { - throw new Error(e); - } - } - - private short[] vRGB = null; - - public GregtechMetaPipeEntity_Cable(final int aID, final String aName, final String aNameRegional, - final float aThickNess, final Materials aMaterial, final long aCableLossPerMeter, final long aAmperage, - final long aVoltage, final boolean aInsulated, final boolean aCanShock, final short[] aRGB) { - super( - aID, - aName, - aNameRegional, - aThickNess, - aMaterial, - aCableLossPerMeter, - aAmperage, - aVoltage, - aInsulated, - aCanShock); - this.vRGB = aRGB == null || aRGB.length != 4 ? Materials.Iron.mRGBa : aRGB; - } - - public GregtechMetaPipeEntity_Cable(final String aName, final float aThickNess, final Materials aMaterial, - final long aCableLossPerMeter, final long aAmperage, final long aVoltage, final boolean aInsulated, - final boolean aCanShock, final short[] aRGB) { - super(aName, aThickNess, aMaterial, aCableLossPerMeter, aAmperage, aVoltage, aInsulated, aCanShock); - this.vRGB = aRGB == null || aRGB.length != 4 ? Materials.Iron.mRGBa : aRGB; - } - - public GregtechMetaPipeEntity_Cable(final int aID, final String aName, final String aNameRegional, - final float aThickNess, final long aCableLossPerMeter, final long aAmperage, final long aVoltage, - final boolean aInsulated, final boolean aCanShock, final short[] aRGB) { - this( - aID, - aName, - aNameRegional, - aThickNess, - null, - aCableLossPerMeter, - aAmperage, - aVoltage, - aInsulated, - aCanShock, - aRGB); - } - - public GregtechMetaPipeEntity_Cable(final String aName, final float aThickNess, final long aCableLossPerMeter, - final long aAmperage, final long aVoltage, final boolean aInsulated, final boolean aCanShock, - final short[] aRGB) { - this(aName, aThickNess, null, aCableLossPerMeter, aAmperage, aVoltage, aInsulated, aCanShock, aRGB); - } - - @Override - public IMetaTileEntity newMetaEntity(final IGregTechTileEntity aTileEntity) { - return new GregtechMetaPipeEntity_Cable( - this.mName, - this.mThickNess, - this.mMaterial, - this.mCableLossPerMeter, - this.mAmperage, - this.mVoltage, - this.mInsulated, - this.mCanShock, - this.vRGB); - } - - @Override - public ITexture[] getTexture(IGregTechTileEntity aBaseMetaTileEntity, ForgeDirection side, int aConnections, - int aColorIndex, boolean aConnected, boolean aRedstone) { - return getTextureGTNH(aBaseMetaTileEntity, side, aConnections, aColorIndex, aConnected, aRedstone); - } - - private ITexture[] getTextureGTNH(IGregTechTileEntity aBaseMetaTileEntity, ForgeDirection aSide, int aConnections, - int aColorIndex, boolean aConnected, boolean aRedstone) { - - Materials wireMaterial = mMaterial; - if (wireMaterial == null) { - wireMaterial = Materials.Iron; - } - - if (!mInsulated) return new ITexture[] { new GT_RenderedTexture( - wireMaterial.mIconSet.mTextures[TextureSet.INDEX_wire], - Dyes.getModulation(aColorIndex, vRGB)) }; - if (aConnected) { - float tThickNess = getThickNess(); - if (tThickNess < 0.124F) return new ITexture[] { new GT_RenderedTexture( - Textures.BlockIcons.INSULATION_FULL, - Dyes.getModulation(aColorIndex, Dyes.CABLE_INSULATION.mRGBa)) }; - if (tThickNess < 0.374F) // 0.375 x1 - return new ITexture[] { - new GT_RenderedTexture(wireMaterial.mIconSet.mTextures[TextureSet.INDEX_wire], vRGB), - new GT_RenderedTexture( - Textures.BlockIcons.INSULATION_TINY, - Dyes.getModulation(aColorIndex, Dyes.CABLE_INSULATION.mRGBa)) }; - if (tThickNess < 0.499F) // 0.500 x2 - return new ITexture[] { - new GT_RenderedTexture(wireMaterial.mIconSet.mTextures[TextureSet.INDEX_wire], vRGB), - new GT_RenderedTexture( - Textures.BlockIcons.INSULATION_SMALL, - Dyes.getModulation(aColorIndex, Dyes.CABLE_INSULATION.mRGBa)) }; - if (tThickNess < 0.624F) // 0.625 x4 - return new ITexture[] { - new GT_RenderedTexture(wireMaterial.mIconSet.mTextures[TextureSet.INDEX_wire], vRGB), - new GT_RenderedTexture( - Textures.BlockIcons.INSULATION_MEDIUM, - Dyes.getModulation(aColorIndex, Dyes.CABLE_INSULATION.mRGBa)) }; - if (tThickNess < 0.749F) // 0.750 x8 - return new ITexture[] { - new GT_RenderedTexture(wireMaterial.mIconSet.mTextures[TextureSet.INDEX_wire], vRGB), - new GT_RenderedTexture( - INSULATION_MEDIUM_PLUS, - Dyes.getModulation(aColorIndex, Dyes.CABLE_INSULATION.mRGBa)) }; - if (tThickNess < 0.874F) // 0.825 x12 - return new ITexture[] { - new GT_RenderedTexture(wireMaterial.mIconSet.mTextures[TextureSet.INDEX_wire], vRGB), - new GT_RenderedTexture( - Textures.BlockIcons.INSULATION_LARGE, - Dyes.getModulation(aColorIndex, Dyes.CABLE_INSULATION.mRGBa)) }; - return new ITexture[] { - new GT_RenderedTexture(wireMaterial.mIconSet.mTextures[TextureSet.INDEX_wire], vRGB), - new GT_RenderedTexture( - Textures.BlockIcons.INSULATION_HUGE, - Dyes.getModulation(aColorIndex, Dyes.CABLE_INSULATION.mRGBa)) }; - } - return new ITexture[] { new GT_RenderedTexture( - Textures.BlockIcons.INSULATION_FULL, - Dyes.getModulation(aColorIndex, Dyes.CABLE_INSULATION.mRGBa)) }; - } -} diff --git a/gtpp/src/main/java/gtPlusPlus/xmod/gregtech/api/metatileentity/implementations/GregtechMetaTreeFarmerStructural.java b/gtpp/src/main/java/gtPlusPlus/xmod/gregtech/api/metatileentity/implementations/GregtechMetaTreeFarmerStructural.java deleted file mode 100644 index 0aaaa75584..0000000000 --- a/gtpp/src/main/java/gtPlusPlus/xmod/gregtech/api/metatileentity/implementations/GregtechMetaTreeFarmerStructural.java +++ /dev/null @@ -1,49 +0,0 @@ -package gtPlusPlus.xmod.gregtech.api.metatileentity.implementations; - -import net.minecraft.nbt.NBTTagCompound; - -import gregtech.api.enums.Textures; -import gregtech.api.interfaces.ITexture; -import gregtech.api.interfaces.metatileentity.IMetaTileEntity; -import gregtech.api.interfaces.tileentity.IGregTechTileEntity; -import gregtech.api.objects.GT_RenderedTexture; -import gtPlusPlus.xmod.gregtech.api.metatileentity.implementations.base.machines.GregtechMetaTreeFarmerBase; - -public class GregtechMetaTreeFarmerStructural extends GregtechMetaTreeFarmerBase { - - public GregtechMetaTreeFarmerStructural(final int aID, final String aName, final String aNameRegional, - final int aTier) { - super(aID, aName, aNameRegional, aTier, 0, "Structural Blocks for the Tree Farmer."); - } - - public GregtechMetaTreeFarmerStructural(final String aName, final int aTier, final int aInvSlotCount, - final String[] aDescription, final ITexture[][][] aTextures) { - super(aName, aTier, aInvSlotCount, aDescription, aTextures); - } - - @Override - public IMetaTileEntity newMetaEntity(final IGregTechTileEntity aTileEntity) { - return new GregtechMetaTreeFarmerStructural( - this.mName, - this.mTier, - this.mInventory.length, - this.mDescriptionArray, - this.mTextures); - } - - @Override - public ITexture getOverlayIcon() { - return new GT_RenderedTexture(Textures.BlockIcons.VOID); - } - - @Override - public boolean isValidSlot(final int aIndex) { - return false; - } - - @Override - public void saveNBTData(final NBTTagCompound paramNBTTagCompound) {} - - @Override - public void loadNBTData(final NBTTagCompound paramNBTTagCompound) {} -} diff --git a/gtpp/src/main/java/gtPlusPlus/xmod/gregtech/api/metatileentity/implementations/base/GT_MetaTileEntity_Hatch_CustomFluidBase.java b/gtpp/src/main/java/gtPlusPlus/xmod/gregtech/api/metatileentity/implementations/base/GT_MetaTileEntity_Hatch_CustomFluidBase.java deleted file mode 100644 index 6a85c06c1b..0000000000 --- a/gtpp/src/main/java/gtPlusPlus/xmod/gregtech/api/metatileentity/implementations/base/GT_MetaTileEntity_Hatch_CustomFluidBase.java +++ /dev/null @@ -1,214 +0,0 @@ -package gtPlusPlus.xmod.gregtech.api.metatileentity.implementations.base; - -import static gregtech.api.enums.Textures.BlockIcons.FLUID_IN_SIGN; -import static gregtech.api.enums.Textures.BlockIcons.OVERLAY_PIPE_IN; - -import net.minecraft.entity.player.EntityPlayer; -import net.minecraft.item.ItemStack; -import net.minecraft.util.EnumChatFormatting; -import net.minecraftforge.common.util.ForgeDirection; -import net.minecraftforge.fluids.Fluid; -import net.minecraftforge.fluids.FluidStack; - -import com.gtnewhorizons.modularui.common.widget.FluidSlotWidget; - -import gregtech.GT_Mod; -import gregtech.api.gui.modularui.GT_UIInfos; -import gregtech.api.interfaces.ITexture; -import gregtech.api.interfaces.tileentity.IGregTechTileEntity; -import gregtech.api.metatileentity.MetaTileEntity; -import gregtech.api.metatileentity.implementations.GT_MetaTileEntity_Hatch; -import gregtech.api.render.TextureFactory; -import gregtech.api.util.GT_Utility; -import gtPlusPlus.core.lib.CORE; -import gtPlusPlus.core.util.minecraft.FluidUtils; - -public class GT_MetaTileEntity_Hatch_CustomFluidBase extends GT_MetaTileEntity_Hatch { - - public final Fluid mLockedFluid; - public final int mFluidCapacity; - protected FluidStack mLockedStack = null; - protected String mTempMod = null; - - public GT_MetaTileEntity_Hatch_CustomFluidBase(Fluid aFluid, int aAmount, final int aID, final String aName, - final String aNameRegional) { - super( - aID, - aName, - aNameRegional, - 6, - 3, - new String[] { "Fluid Input for Multiblocks", "Capacity: " + GT_Utility.formatNumbers(aAmount) + "L" }); - this.mLockedFluid = aFluid; - this.mFluidCapacity = aAmount; - } - - public GT_MetaTileEntity_Hatch_CustomFluidBase(Fluid aFluid, int aAmount, final String aName, - final String[] aDescription, final ITexture[][][] aTextures) { - super(aName, 6, 3, aDescription[0], aTextures); - this.mLockedFluid = aFluid; - this.mFluidCapacity = aAmount; - } - - public boolean allowPutStack(final IGregTechTileEntity aBaseMetaTileEntity, final int aIndex, - final ForgeDirection side, final ItemStack aStack) { - if (side == aBaseMetaTileEntity.getFrontFacing() && aIndex == 0) { - FluidStack fs = GT_Utility.getFluidForFilledItem(aStack, true); - return fs != null && fs.getFluid() == this.mLockedFluid; - } - return false; - } - - @Override - public boolean allowPullStack(IGregTechTileEntity aBaseMetaTileEntity, int aIndex, ForgeDirection side, - ItemStack aStack) { - return side == aBaseMetaTileEntity.getFrontFacing() && aIndex == 1; - } - - @Override - public ITexture[] getTexturesActive(ITexture aBaseTexture) { - return GT_Mod.gregtechproxy.mRenderIndicatorsOnHatch - ? new ITexture[] { aBaseTexture, TextureFactory.of(OVERLAY_PIPE_IN), TextureFactory.of(FLUID_IN_SIGN) } - : new ITexture[] { aBaseTexture, TextureFactory.of(OVERLAY_PIPE_IN) }; - } - - @Override - public ITexture[] getTexturesInactive(ITexture aBaseTexture) { - return GT_Mod.gregtechproxy.mRenderIndicatorsOnHatch - ? new ITexture[] { aBaseTexture, TextureFactory.of(OVERLAY_PIPE_IN), TextureFactory.of(FLUID_IN_SIGN) } - : new ITexture[] { aBaseTexture, TextureFactory.of(OVERLAY_PIPE_IN) }; - } - - @Override - public boolean isSimpleMachine() { - return true; - } - - @Override - public boolean isFacingValid(ForgeDirection facing) { - return true; - } - - @Override - public boolean isAccessAllowed(EntityPlayer aPlayer) { - return true; - } - - @Override - public boolean onRightclick(IGregTechTileEntity aBaseMetaTileEntity, EntityPlayer aPlayer) { - GT_UIInfos.openGTTileEntityUI(aBaseMetaTileEntity, aPlayer); - return true; - } - - @Override - public boolean doesFillContainers() { - // return true; - return false; - } - - @Override - public boolean doesEmptyContainers() { - return true; - } - - @Override - public boolean canTankBeFilled() { - return true; - } - - @Override - public boolean canTankBeEmptied() { - return true; - } - - @Override - public boolean displaysItemStack() { - return true; - } - - @Override - public boolean displaysStackSize() { - return false; - } - - public void updateSlots() { - if (mInventory[getInputSlot()] != null && mInventory[getInputSlot()].stackSize <= 0) - mInventory[getInputSlot()] = null; - } - - @Override - public int getTankPressure() { - return -100; - } - - @Override - public int getCapacity() { - return this.mFluidCapacity; - } - - @Override - public String[] getDescription() { - if (mLockedStack == null) { - mLockedStack = FluidUtils.getFluidStack(mLockedFluid, 1); - } - int aFluidTemp = 0; - boolean isSteam = false; - if (mLockedFluid != null) { - aFluidTemp = mLockedFluid.getTemperature(); - mTempMod = mLockedFluid.getName(); - } - if (mTempMod.equalsIgnoreCase("steam")) { - isSteam = true; - } - - EnumChatFormatting aColour = EnumChatFormatting.BLUE; - if (aFluidTemp <= -3000) { - aColour = EnumChatFormatting.DARK_PURPLE; - } else if (aFluidTemp >= -2999 && aFluidTemp <= -500) { - aColour = EnumChatFormatting.DARK_BLUE; - } else if (aFluidTemp >= -499 && aFluidTemp <= -50) { - aColour = EnumChatFormatting.BLUE; - } else if (aFluidTemp >= 30 && aFluidTemp <= 300) { - aColour = EnumChatFormatting.AQUA; - } else if (aFluidTemp >= 301 && aFluidTemp <= 800) { - aColour = EnumChatFormatting.YELLOW; - } else if (aFluidTemp >= 801 && aFluidTemp <= 1500) { - aColour = EnumChatFormatting.GOLD; - } else if (aFluidTemp >= 1501) { - aColour = EnumChatFormatting.RED; - } - String aFluidName = "Accepted Fluid: " + aColour - + (mLockedStack != null ? mLockedStack.getLocalizedName() : "Empty") - + EnumChatFormatting.RESET; - return new String[] { "Fluid Input for " + (isSteam ? "Steam " : "") + "Multiblocks", - "Capacity: " + getCapacity() + "L", aFluidName, CORE.GT_Tooltip.get() }; - } - - @Override - public boolean isFluidInputAllowed(final FluidStack aFluid) { - return this.mLockedFluid.getName() - .equals( - aFluid.getFluid() - .getName()); - } - - @Override - public MetaTileEntity newMetaEntity(final IGregTechTileEntity aTileEntity) { - return new GT_MetaTileEntity_Hatch_CustomFluidBase( - this.mLockedFluid, - this.mFluidCapacity, - this.mName, - this.mDescriptionArray, - this.mTextures); - } - - @Override - public boolean useModularUI() { - return true; - } - - @Override - protected FluidSlotWidget createFluidSlot() { - return super.createFluidSlot().setFilter(f -> f == mLockedFluid); - } -} diff --git a/gtpp/src/main/java/gtPlusPlus/xmod/gregtech/api/metatileentity/implementations/base/GregtechMetaTileEntity.java b/gtpp/src/main/java/gtPlusPlus/xmod/gregtech/api/metatileentity/implementations/base/GregtechMetaTileEntity.java deleted file mode 100644 index e260347ca5..0000000000 --- a/gtpp/src/main/java/gtPlusPlus/xmod/gregtech/api/metatileentity/implementations/base/GregtechMetaTileEntity.java +++ /dev/null @@ -1,74 +0,0 @@ -package gtPlusPlus.xmod.gregtech.api.metatileentity.implementations.base; - -import static gregtech.api.enums.GT_Values.GT; - -import gregtech.api.interfaces.ITexture; -import gregtech.api.metatileentity.MetaTileEntity; - -public abstract class GregtechMetaTileEntity extends MetaTileEntity { - - /** - * Value between [0 - 9] to describe the Tier of this Machine. - */ - protected byte mTier; - - /** - * A simple Description. - */ - protected final String mDescription; - - /** - * Contains all Textures used by this Block. - */ - public final ITexture[][][] mTextures; - - public GregtechMetaTileEntity(final int aID, final String aName, final String aNameRegional, final int aTier, - final int aInvSlotCount, final String aDescription, final ITexture... aTextures) { - super(aID, aName, aNameRegional, aInvSlotCount); - this.mTier = (byte) Math.max(0, Math.min(aTier, 9)); - this.mDescription = aDescription; - - // must always be the last call! - if (GT.isClientSide()) { - this.mTextures = this.getTextureSet(aTextures); - } else { - this.mTextures = null; - } - } - - public GregtechMetaTileEntity(final String aName, final int aTier, final int aInvSlotCount, - final String aDescription, final ITexture[][][] aTextures) { - super(aName, aInvSlotCount); - this.mTier = (byte) aTier; - this.mDescription = aDescription; - this.mTextures = aTextures; - } - - @Override - public byte getTileEntityBaseType() { - return (byte) (Math.min(3, this.mTier <= 0 ? 0 : 1 + ((this.mTier - 1) / 4))); - } - - @Override - public long getInputTier() { - return this.mTier; - } - - @Override - public long getOutputTier() { - return this.mTier; - } - - @Override - public String[] getDescription() { - return new String[] { this.mDescription }; - } - - /** - * Used Client Side to get a Texture Set for this Block. Called after setting the Tier and the Description so that - * those two are accessible. - * - * @param aTextures is the optional Array you can give to the Constructor. - */ - public abstract ITexture[][][] getTextureSet(ITexture[] aTextures); -} diff --git a/gtpp/src/main/java/gtPlusPlus/xmod/gregtech/api/metatileentity/implementations/base/GregtechMetaTransformerHiAmp.java b/gtpp/src/main/java/gtPlusPlus/xmod/gregtech/api/metatileentity/implementations/base/GregtechMetaTransformerHiAmp.java deleted file mode 100644 index c6a088fb1c..0000000000 --- a/gtpp/src/main/java/gtPlusPlus/xmod/gregtech/api/metatileentity/implementations/base/GregtechMetaTransformerHiAmp.java +++ /dev/null @@ -1,117 +0,0 @@ -package gtPlusPlus.xmod.gregtech.api.metatileentity.implementations.base; - -import net.minecraft.entity.player.EntityPlayer; -import net.minecraft.nbt.NBTTagCompound; -import net.minecraftforge.common.util.ForgeDirection; - -import org.apache.commons.lang3.ArrayUtils; - -import gregtech.api.enums.Textures; -import gregtech.api.interfaces.ITexture; -import gregtech.api.interfaces.metatileentity.IMetaTileEntity; -import gregtech.api.interfaces.tileentity.IGregTechTileEntity; -import gregtech.api.metatileentity.implementations.GT_MetaTileEntity_Transformer; -import gtPlusPlus.core.lib.CORE; -import gtPlusPlus.core.util.minecraft.PlayerUtils; - -public class GregtechMetaTransformerHiAmp extends GT_MetaTileEntity_Transformer { - - private boolean mHalfMode = false; - - public GregtechMetaTransformerHiAmp(int aID, String aName, String aNameRegional, int aTier, String aDescription) { - super(aID, aName, aNameRegional, aTier, aDescription); - } - - public GregtechMetaTransformerHiAmp(String aName, int aTier, String[] aDescription, ITexture[][][] aTextures) { - super(aName, aTier, aDescription, aTextures); - } - - @Override - public long maxEUStore() { - return ((512L + gregtech.api.enums.GT_Values.V[(this.mTier + 1)] * 2L) * 8); - } - - @Override - public long maxAmperesOut() { - if (this.mHalfMode) { - return ((getBaseMetaTileEntity().isAllowedToWork()) ? 8L : 2L); - } - return ((getBaseMetaTileEntity().isAllowedToWork()) ? 16L : 4L); - } - - @Override - public long maxAmperesIn() { - if (this.mHalfMode) { - return ((getBaseMetaTileEntity().isAllowedToWork()) ? 2L : 8L); - } - return ((getBaseMetaTileEntity().isAllowedToWork()) ? 4L : 16L); - } - - @Override - public ITexture[][][] getTextureSet(ITexture[] aTextures) { - ITexture[][][] rTextures = new ITexture[12][17][]; - for (byte i = -1; i < 16; i++) { - rTextures[0][i + 1] = new ITexture[] { Textures.BlockIcons.MACHINE_CASINGS[mTier][i + 1], - Textures.BlockIcons.OVERLAYS_ENERGY_OUT[mTier] }; - rTextures[1][i + 1] = new ITexture[] { Textures.BlockIcons.MACHINE_CASINGS[mTier][i + 1], - Textures.BlockIcons.OVERLAYS_ENERGY_OUT[mTier] }; - rTextures[2][i + 1] = new ITexture[] { Textures.BlockIcons.MACHINE_CASINGS[mTier][i + 1], - Textures.BlockIcons.OVERLAYS_ENERGY_OUT[mTier] }; - rTextures[3][i + 1] = new ITexture[] { Textures.BlockIcons.MACHINE_CASINGS[mTier][i + 1], - Textures.BlockIcons.OVERLAYS_ENERGY_IN_MULTI[mTier + 1] }; - rTextures[4][i + 1] = new ITexture[] { Textures.BlockIcons.MACHINE_CASINGS[mTier][i + 1], - Textures.BlockIcons.OVERLAYS_ENERGY_IN_MULTI[mTier + 1] }; - rTextures[5][i + 1] = new ITexture[] { Textures.BlockIcons.MACHINE_CASINGS[mTier][i + 1], - Textures.BlockIcons.OVERLAYS_ENERGY_IN_MULTI[mTier + 1] }; - rTextures[6][i + 1] = new ITexture[] { Textures.BlockIcons.MACHINE_CASINGS[mTier][i + 1], - Textures.BlockIcons.OVERLAYS_ENERGY_IN[mTier] }; - rTextures[7][i + 1] = new ITexture[] { Textures.BlockIcons.MACHINE_CASINGS[mTier][i + 1], - Textures.BlockIcons.OVERLAYS_ENERGY_IN[mTier] }; - rTextures[8][i + 1] = new ITexture[] { Textures.BlockIcons.MACHINE_CASINGS[mTier][i + 1], - Textures.BlockIcons.OVERLAYS_ENERGY_IN[mTier] }; - rTextures[9][i + 1] = new ITexture[] { Textures.BlockIcons.MACHINE_CASINGS[mTier][i + 1], - Textures.BlockIcons.OVERLAYS_ENERGY_OUT_MULTI[mTier + 1] }; - rTextures[10][i + 1] = new ITexture[] { Textures.BlockIcons.MACHINE_CASINGS[mTier][i + 1], - Textures.BlockIcons.OVERLAYS_ENERGY_OUT_MULTI[mTier + 1] }; - rTextures[11][i + 1] = new ITexture[] { Textures.BlockIcons.MACHINE_CASINGS[mTier][i + 1], - Textures.BlockIcons.OVERLAYS_ENERGY_OUT_MULTI[mTier + 1] }; - } - return rTextures; - } - - @Override - public IMetaTileEntity newMetaEntity(IGregTechTileEntity aTileEntity) { - return new GregtechMetaTransformerHiAmp(this.mName, this.mTier, this.mDescriptionArray, this.mTextures); - } - - @Override - public String[] getDescription() { - return ArrayUtils.addAll( - this.mDescriptionArray, - "Accepts 4A and outputs 16A", - "Toggle 2A/8A half-mode with Screwdriver", - CORE.GT_Tooltip.get()); - } - - @Override - public void saveNBTData(NBTTagCompound aNBT) { - aNBT.setBoolean("mHalfMode", this.mHalfMode); - super.saveNBTData(aNBT); - } - - @Override - public void loadNBTData(NBTTagCompound aNBT) { - this.mHalfMode = aNBT.getBoolean("mHalfMode"); - super.loadNBTData(aNBT); - } - - @Override - public void onScrewdriverRightClick(ForgeDirection side, EntityPlayer aPlayer, float aX, float aY, float aZ) { - this.mHalfMode = !mHalfMode; - if (this.mHalfMode) { - PlayerUtils.messagePlayer(aPlayer, "Transformer is now running at 2A:8A in/out Ratio."); - } else { - PlayerUtils.messagePlayer(aPlayer, "Transformer is now running at 4A:16A in/out Ratio."); - } - } -} diff --git a/gtpp/src/main/java/gtPlusPlus/xmod/gregtech/api/metatileentity/implementations/base/GregtechMeta_MultiBlockBase.java b/gtpp/src/main/java/gtPlusPlus/xmod/gregtech/api/metatileentity/implementations/base/GregtechMeta_MultiBlockBase.java deleted file mode 100644 index e756a92343..0000000000 --- a/gtpp/src/main/java/gtPlusPlus/xmod/gregtech/api/metatileentity/implementations/base/GregtechMeta_MultiBlockBase.java +++ /dev/null @@ -1,1799 +0,0 @@ -package gtPlusPlus.xmod.gregtech.api.metatileentity.implementations.base; - -import static gregtech.api.enums.Mods.TecTech; -import static gregtech.api.util.GT_Utility.filterValidMTEs; - -import java.lang.reflect.InvocationTargetException; -import java.lang.reflect.Method; -import java.util.ArrayList; -import java.util.Arrays; -import java.util.Collection; -import java.util.Iterator; -import java.util.List; -import java.util.Map.Entry; -import java.util.Objects; -import java.util.Set; -import java.util.concurrent.ConcurrentHashMap; -import java.util.concurrent.TimeUnit; -import java.util.function.BiConsumer; -import java.util.function.BiPredicate; -import java.util.function.Function; -import java.util.stream.Collectors; - -import javax.annotation.Nullable; - -import net.minecraft.block.Block; -import net.minecraft.entity.player.EntityPlayer; -import net.minecraft.item.Item; -import net.minecraft.item.ItemStack; -import net.minecraft.nbt.NBTTagCompound; -import net.minecraft.util.EnumChatFormatting; -import net.minecraft.util.StatCollector; -import net.minecraft.world.World; -import net.minecraftforge.common.util.ForgeDirection; -import net.minecraftforge.fluids.FluidStack; -import net.minecraftforge.oredict.OreDictionary; - -import com.gtnewhorizon.structurelib.StructureLibAPI; -import com.gtnewhorizon.structurelib.structure.AutoPlaceEnvironment; -import com.gtnewhorizon.structurelib.structure.IStructureElement; -import com.gtnewhorizon.structurelib.structure.StructureUtility; -import com.gtnewhorizons.modularui.api.drawable.ItemDrawable; -import com.gtnewhorizons.modularui.api.screen.ModularWindow; -import com.gtnewhorizons.modularui.api.screen.UIBuildContext; -import com.gtnewhorizons.modularui.common.widget.DrawableWidget; -import com.gtnewhorizons.modularui.common.widget.DynamicPositionedColumn; -import com.gtnewhorizons.modularui.common.widget.FakeSyncWidget; -import com.gtnewhorizons.modularui.common.widget.TextWidget; - -import gregtech.api.enums.GT_Values; -import gregtech.api.enums.Materials; -import gregtech.api.enums.Textures; -import gregtech.api.enums.VoidingMode; -import gregtech.api.gui.modularui.GT_UITextures; -import gregtech.api.interfaces.IHatchElement; -import gregtech.api.interfaces.IIconContainer; -import gregtech.api.interfaces.ITexture; -import gregtech.api.interfaces.metatileentity.IMetaTileEntity; -import gregtech.api.interfaces.tileentity.IGregTechTileEntity; -import gregtech.api.items.GT_MetaGenerated_Tool; -import gregtech.api.logic.ProcessingLogic; -import gregtech.api.metatileentity.MetaTileEntity; -import gregtech.api.metatileentity.implementations.GT_MetaTileEntity_ExtendedPowerMultiBlockBase; -import gregtech.api.metatileentity.implementations.GT_MetaTileEntity_Hatch; -import gregtech.api.metatileentity.implementations.GT_MetaTileEntity_Hatch_Dynamo; -import gregtech.api.metatileentity.implementations.GT_MetaTileEntity_Hatch_Energy; -import gregtech.api.metatileentity.implementations.GT_MetaTileEntity_Hatch_Input; -import gregtech.api.metatileentity.implementations.GT_MetaTileEntity_Hatch_InputBus; -import gregtech.api.metatileentity.implementations.GT_MetaTileEntity_Hatch_Maintenance; -import gregtech.api.metatileentity.implementations.GT_MetaTileEntity_Hatch_Muffler; -import gregtech.api.metatileentity.implementations.GT_MetaTileEntity_Hatch_Output; -import gregtech.api.metatileentity.implementations.GT_MetaTileEntity_Hatch_OutputBus; -import gregtech.api.recipe.RecipeMap; -import gregtech.api.render.TextureFactory; -import gregtech.api.util.GT_Recipe; -import gregtech.api.util.GT_Utility; -import gregtech.api.util.IGT_HatchAdder; -import gregtech.common.items.GT_MetaGenerated_Tool_01; -import gregtech.common.tileentities.machines.IDualInputHatch; -import gtPlusPlus.GTplusplus; -import gtPlusPlus.GTplusplus.INIT_PHASE; -import gtPlusPlus.api.objects.Logger; -import gtPlusPlus.api.objects.minecraft.BlockPos; -import gtPlusPlus.core.util.minecraft.ItemUtils; -import gtPlusPlus.core.util.minecraft.PlayerUtils; -import gtPlusPlus.core.util.reflect.ReflectionUtils; -import gtPlusPlus.preloader.CORE_Preloader; -import gtPlusPlus.preloader.asm.AsmConfig; -import gtPlusPlus.xmod.gregtech.api.metatileentity.implementations.GT_MetaTileEntity_Hatch_AirIntake; -import gtPlusPlus.xmod.gregtech.api.metatileentity.implementations.GT_MetaTileEntity_Hatch_InputBattery; -import gtPlusPlus.xmod.gregtech.api.metatileentity.implementations.GT_MetaTileEntity_Hatch_OutputBattery; -import gtPlusPlus.xmod.gregtech.api.metatileentity.implementations.GT_MetaTileEntity_Hatch_Steam_BusInput; - -// Glee8e - 11/12/21 - 2:15pm -// Yeah, now I see what's wrong. Someone inherited from GregtechMeta_MultiBlockBase instead of -// GregtechMeta_MultiBlockBase<GregtechMetaTileEntity_IndustrialDehydrator> as it should have been -// so any method in GregtechMetaTileEntity_IndustrialDehydrator would see generic field declared in -// GregtechMeta_MultiBlockBase without generic parameter - -public abstract class GregtechMeta_MultiBlockBase<T extends GT_MetaTileEntity_ExtendedPowerMultiBlockBase<T>> - extends GT_MetaTileEntity_ExtendedPowerMultiBlockBase<T> { - - public static final boolean DEBUG_DISABLE_CORES_TEMPORARILY = true; - - public GT_Recipe mLastRecipe; - protected long mTotalRunTime = 0; - - /** - * Don't use this for recipe input check, otherwise you'll get duplicated fluids - */ - public ArrayList<GT_MetaTileEntity_Hatch_AirIntake> mAirIntakes = new ArrayList<>(); - - public ArrayList<GT_MetaTileEntity_Hatch_InputBattery> mChargeHatches = new ArrayList<>(); - public ArrayList<GT_MetaTileEntity_Hatch_OutputBattery> mDischargeHatches = new ArrayList<>(); - public ArrayList<GT_MetaTileEntity_Hatch> mAllEnergyHatches = new ArrayList<>(); - public ArrayList<GT_MetaTileEntity_Hatch> mAllDynamoHatches = new ArrayList<>(); - - public GregtechMeta_MultiBlockBase(final int aID, final String aName, final String aNameRegional) { - super(aID, aName, aNameRegional); - } - - public GregtechMeta_MultiBlockBase(final String aName) { - super(aName); - } - - private static int toStackCount(Entry<ItemStack, Integer> e) { - int tMaxStackSize = e.getKey() - .getMaxStackSize(); - int tStackSize = e.getValue(); - return (tStackSize + tMaxStackSize - 1) / tMaxStackSize; - } - - public long getTotalRuntimeInTicks() { - return this.mTotalRunTime; - } - - public abstract String getMachineType(); - - public String getMachineTooltip() { - return "Machine Type: " + EnumChatFormatting.YELLOW + getMachineType() + EnumChatFormatting.RESET; - } - - public String[] getExtraInfoData() { - return new String[0]; - } - - @Override - public String[] getInfoData() { - ArrayList<String> mInfo = new ArrayList<>(); - if (!this.getMetaName() - .equals("")) { - mInfo.add(this.getMetaName()); - } - - String[] extra = getExtraInfoData(); - - if (extra == null) { - extra = new String[0]; - } - if (extra.length > 0) { - for (String s : extra) { - mInfo.add(s); - } - } - - long seconds = (this.mTotalRunTime / 20); - int weeks = (int) (TimeUnit.SECONDS.toDays(seconds) / 7); - int days = (int) (TimeUnit.SECONDS.toDays(seconds) - 7 * weeks); - long hours = TimeUnit.SECONDS.toHours(seconds) - TimeUnit.DAYS.toHours(days) - - TimeUnit.DAYS.toHours(7L * weeks); - long minutes = TimeUnit.SECONDS.toMinutes(seconds) - (TimeUnit.SECONDS.toHours(seconds) * 60); - long second = TimeUnit.SECONDS.toSeconds(seconds) - (TimeUnit.SECONDS.toMinutes(seconds) * 60); - - mInfo.add(getMachineTooltip()); - - // Lets borrow the GTNH handling - - mInfo.add( - StatCollector.translateToLocal("GTPP.multiblock.progress") + ": " - + EnumChatFormatting.GREEN - + mProgresstime / 20 - + EnumChatFormatting.RESET - + " s / " - + EnumChatFormatting.YELLOW - + mMaxProgresstime / 20 - + EnumChatFormatting.RESET - + " s"); - - if (!this.mAllEnergyHatches.isEmpty()) { - long storedEnergy = getStoredEnergyInAllEnergyHatches(); - long maxEnergy = getMaxEnergyStorageOfAllEnergyHatches(); - mInfo.add(StatCollector.translateToLocal("GTPP.multiblock.energy") + ":"); - mInfo.add( - StatCollector.translateToLocal( - "" + EnumChatFormatting.GREEN - + Long.toString(storedEnergy) - + EnumChatFormatting.RESET - + " EU / " - + EnumChatFormatting.YELLOW - + Long.toString(maxEnergy) - + EnumChatFormatting.RESET - + " EU")); - - mInfo.add(StatCollector.translateToLocal("GTPP.multiblock.mei") + ":"); - mInfo.add( - StatCollector.translateToLocal( - "" + EnumChatFormatting.YELLOW - + Long.toString(getMaxInputVoltage()) - + EnumChatFormatting.RESET - + " EU/t(*2A) " - + StatCollector.translateToLocal("GTPP.machines.tier") - + ": " - + EnumChatFormatting.YELLOW - + GT_Values.VN[GT_Utility.getTier(getMaxInputVoltage())] - + EnumChatFormatting.RESET));; - } - if (!this.mAllDynamoHatches.isEmpty()) { - long storedEnergy = getStoredEnergyInAllDynamoHatches(); - long maxEnergy = getMaxEnergyStorageOfAllDynamoHatches(); - mInfo.add(StatCollector.translateToLocal("GTPP.multiblock.energy") + " In Dynamos:"); - mInfo.add( - StatCollector.translateToLocal( - "" + EnumChatFormatting.GREEN - + Long.toString(storedEnergy) - + EnumChatFormatting.RESET - + " EU / " - + EnumChatFormatting.YELLOW - + Long.toString(maxEnergy) - + EnumChatFormatting.RESET - + " EU")); - } - - if (-lEUt > 0) { - mInfo.add(StatCollector.translateToLocal("GTPP.multiblock.usage") + ":"); - mInfo.add( - StatCollector - .translateToLocal("" + EnumChatFormatting.RED + (-lEUt) + EnumChatFormatting.RESET + " EU/t")); - } else { - mInfo.add(StatCollector.translateToLocal("GTPP.multiblock.generation") + ":"); - mInfo.add( - StatCollector - .translateToLocal("" + EnumChatFormatting.GREEN + lEUt + EnumChatFormatting.RESET + " EU/t")); - } - - mInfo.add( - StatCollector.translateToLocal("GTPP.multiblock.problems") + ": " - + EnumChatFormatting.RED - + (getIdealStatus() - getRepairStatus()) - + EnumChatFormatting.RESET - + " " - + StatCollector.translateToLocal("GTPP.multiblock.efficiency") - + ": " - + EnumChatFormatting.YELLOW - + Float.toString(mEfficiency / 100.0F) - + EnumChatFormatting.RESET - + " %"); - - if (this.getPollutionPerSecond(null) > 0) { - int mPollutionReduction = getPollutionReductionForAllMufflers(); - mInfo.add( - StatCollector.translateToLocal("GTPP.multiblock.pollution") + ": " - + EnumChatFormatting.RED - + this.getPollutionPerSecond(null) - + EnumChatFormatting.RESET - + "/sec"); - mInfo.add( - StatCollector.translateToLocal("GTPP.multiblock.pollutionreduced") + ": " - + EnumChatFormatting.GREEN - + mPollutionReduction - + EnumChatFormatting.RESET - + " %"); - } - - mInfo.add( - StatCollector.translateToLocal("GTPP.CC.parallel") + ": " - + EnumChatFormatting.GREEN - + (getMaxParallelRecipes()) - + EnumChatFormatting.RESET); - - mInfo.add( - "Total Time Since Built: " + EnumChatFormatting.DARK_GREEN - + Integer.toString(weeks) - + EnumChatFormatting.RESET - + " Weeks, " - + EnumChatFormatting.DARK_GREEN - + Integer.toString(days) - + EnumChatFormatting.RESET - + " Days, "); - mInfo.add( - EnumChatFormatting.DARK_GREEN + Long.toString(hours) - + EnumChatFormatting.RESET - + " Hours, " - + EnumChatFormatting.DARK_GREEN - + Long.toString(minutes) - + EnumChatFormatting.RESET - + " Minutes, " - + EnumChatFormatting.DARK_GREEN - + Long.toString(second) - + EnumChatFormatting.RESET - + " Seconds."); - mInfo.add("Total Time in ticks: " + EnumChatFormatting.DARK_GREEN + Long.toString(this.mTotalRunTime)); - - String[] mInfo2 = mInfo.toArray(new String[mInfo.size()]); - return mInfo2; - } - - public int getPollutionReductionForAllMufflers() { - int mPollutionReduction = 0; - for (GT_MetaTileEntity_Hatch_Muffler tHatch : filterValidMTEs(mMufflerHatches)) { - mPollutionReduction = Math.max(calculatePollutionReductionForHatch(tHatch, 100), mPollutionReduction); - } - return mPollutionReduction; - } - - public long getStoredEnergyInAllEnergyHatches() { - long storedEnergy = 0; - for (GT_MetaTileEntity_Hatch tHatch : filterValidMTEs(mAllEnergyHatches)) { - storedEnergy += tHatch.getBaseMetaTileEntity() - .getStoredEU(); - } - return storedEnergy; - } - - public long getMaxEnergyStorageOfAllEnergyHatches() { - long maxEnergy = 0; - for (GT_MetaTileEntity_Hatch tHatch : filterValidMTEs(mAllEnergyHatches)) { - maxEnergy += tHatch.getBaseMetaTileEntity() - .getEUCapacity(); - } - return maxEnergy; - } - - public long getStoredEnergyInAllDynamoHatches() { - long storedEnergy = 0; - for (GT_MetaTileEntity_Hatch tHatch : filterValidMTEs(mAllDynamoHatches)) { - storedEnergy += tHatch.getBaseMetaTileEntity() - .getStoredEU(); - } - return storedEnergy; - } - - public long getMaxEnergyStorageOfAllDynamoHatches() { - long maxEnergy = 0; - for (GT_MetaTileEntity_Hatch tHatch : filterValidMTEs(mAllDynamoHatches)) { - maxEnergy += tHatch.getBaseMetaTileEntity() - .getEUCapacity(); - } - return maxEnergy; - } - - @Override - public boolean isGivingInformation() { - return true; - } - - private String[] aCachedToolTip; - - /* - * private final String aRequiresMuffler = "1x Muffler Hatch"; private final String aRequiresCoreModule = - * "1x Core Module"; private final String aRequiresMaint = "1x Maintanence Hatch"; - */ - - public static final String TAG_HIDE_HATCHES = "TAG_HIDE_HATCHES"; - public static final String TAG_HIDE_MAINT = "TAG_HIDE_MAINT"; - public static final String TAG_HIDE_POLLUTION = "TAG_HIDE_POLLUTION"; - public static final String TAG_HIDE_MACHINE_TYPE = "TAG_HIDE_MACHINE_TYPE"; - - public abstract int getMaxParallelRecipes(); - - @Override - public boolean isCorrectMachinePart(final ItemStack paramItemStack) { - return true; - } - - @Override - public int getDamageToComponent(final ItemStack paramItemStack) { - return 0; - } - - @Override - public boolean explodesOnComponentBreak(ItemStack p0) { - return false; - } - - /** - * A Static {@link Method} object which holds the current status of logging. - */ - public static Method aLogger = null; - - public void log(String s) { - if (!AsmConfig.disableAllLogging) { - if (CORE_Preloader.DEBUG_MODE) { - Logger.INFO(s); - } else { - Logger.MACHINE_INFO(s); - } - } - } - - @Override - protected void setProcessingLogicPower(ProcessingLogic logic) { - logic.setAvailableVoltage(GT_Utility.roundUpVoltage(this.getMaxInputVoltage())); - logic.setAvailableAmperage(1L); - } - - public long getMaxInputEnergy() { - long rEnergy = 0; - if (mEnergyHatches.size() == 1) // so it only takes 1 amp is only 1 hatch is present so it works like most gt - // multies - return mEnergyHatches.get(0) - .getBaseMetaTileEntity() - .getInputVoltage(); - for (GT_MetaTileEntity_Hatch_Energy tHatch : filterValidMTEs(mEnergyHatches)) - rEnergy += tHatch.getBaseMetaTileEntity() - .getInputVoltage() - * tHatch.getBaseMetaTileEntity() - .getInputAmperage(); - return rEnergy; - } - - public boolean isMachineRunning() { - boolean aRunning = this.getBaseMetaTileEntity() - .isActive(); - // log("Queried Multiblock is currently running: "+aRunning); - return aRunning; - } - - @Override - public void onPostTick(final IGregTechTileEntity aBaseMetaTileEntity, final long aTick) { - - // Time Counter - if (aBaseMetaTileEntity.isServerSide()) { - this.mTotalRunTime++; - } - - if (aBaseMetaTileEntity.isServerSide()) { - if (this.mUpdate == 1 || this.mStartUpCheck == 1) { - this.mChargeHatches.clear(); - this.mDischargeHatches.clear(); - this.mAirIntakes.clear(); - this.mTecTechEnergyHatches.clear(); - this.mTecTechDynamoHatches.clear(); - this.mAllEnergyHatches.clear(); - this.mAllDynamoHatches.clear(); - } - } - - super.onPostTick(aBaseMetaTileEntity, aTick); - } - - @Override - public void explodeMultiblock() { - MetaTileEntity tTileEntity; - for (final Iterator<GT_MetaTileEntity_Hatch_InputBattery> localIterator = this.mChargeHatches - .iterator(); localIterator.hasNext(); tTileEntity.getBaseMetaTileEntity() - .doExplosion(gregtech.api.enums.GT_Values.V[8])) { - tTileEntity = localIterator.next(); - } - tTileEntity = null; - for (final Iterator<GT_MetaTileEntity_Hatch_OutputBattery> localIterator = this.mDischargeHatches - .iterator(); localIterator.hasNext(); tTileEntity.getBaseMetaTileEntity() - .doExplosion(gregtech.api.enums.GT_Values.V[8])) { - tTileEntity = localIterator.next(); - } - tTileEntity = null; - for (final Iterator<GT_MetaTileEntity_Hatch> localIterator = this.mTecTechDynamoHatches - .iterator(); localIterator.hasNext(); tTileEntity.getBaseMetaTileEntity() - .doExplosion(gregtech.api.enums.GT_Values.V[8])) { - tTileEntity = localIterator.next(); - } - tTileEntity = null; - for (final Iterator<GT_MetaTileEntity_Hatch> localIterator = this.mTecTechEnergyHatches - .iterator(); localIterator.hasNext(); tTileEntity.getBaseMetaTileEntity() - .doExplosion(gregtech.api.enums.GT_Values.V[8])) { - tTileEntity = localIterator.next(); - } - - super.explodeMultiblock(); - } - - protected boolean setGUIItemStack(ItemStack aNewGuiSlotContents) { - boolean result = false; - if (this.mInventory[1] == null) { - this.mInventory[1] = aNewGuiSlotContents != null ? aNewGuiSlotContents.copy() : null; - this.depleteInput(aNewGuiSlotContents); - this.updateSlots(); - result = true; - } - return result; - } - - public ItemStack findItemInInventory(Item aSearchStack) { - return findItemInInventory(aSearchStack, 0); - } - - public ItemStack findItemInInventory(Item aSearchStack, int aMeta) { - return findItemInInventory(ItemUtils.simpleMetaStack(aSearchStack, aMeta, 1)); - } - - public ItemStack findItemInInventory(ItemStack aSearchStack) { - if (aSearchStack != null && this.mInputBusses.size() > 0) { - for (GT_MetaTileEntity_Hatch_InputBus bus : this.mInputBusses) { - if (bus != null) { - for (ItemStack uStack : bus.mInventory) { - if (uStack != null) { - if (aSearchStack.getClass() - .isInstance(uStack.getItem())) { - return uStack; - } - } - } - } - } - } - return null; - } - - /** - * Deplete fluid input from a set of restricted hatches. This assumes these hatches can store nothing else but your - * expected fluid - */ - protected boolean depleteInputFromRestrictedHatches(Collection<GT_MetaTileEntity_Hatch_CustomFluidBase> aHatches, - int aAmount) { - for (final GT_MetaTileEntity_Hatch_CustomFluidBase tHatch : filterValidMTEs(aHatches)) { - FluidStack tLiquid = tHatch.getFluid(); - if (tLiquid == null || tLiquid.amount < aAmount) { - continue; - } - tLiquid = tHatch.drain(aAmount, false); - if (tLiquid != null && tLiquid.amount >= aAmount) { - tLiquid = tHatch.drain(aAmount, true); - return tLiquid != null && tLiquid.amount >= aAmount; - } - } - return false; - } - - @Override - public void updateSlots() { - for (final GT_MetaTileEntity_Hatch_InputBattery tHatch : filterValidMTEs(this.mChargeHatches)) { - tHatch.updateSlots(); - } - for (final GT_MetaTileEntity_Hatch_OutputBattery tHatch : filterValidMTEs(this.mDischargeHatches)) { - tHatch.updateSlots(); - } - super.updateSlots(); - } - - /** - * Causes a Random Maint. Issue. - * - * @return {@link boolean} - Returns whether or not an issue was caused, should always be true. - */ - public boolean causeMaintenanceIssue() { - boolean b = false; - switch (this.getBaseMetaTileEntity() - .getRandomNumber(6)) { - case 0 -> { - this.mWrench = false; - b = true; - } - case 1 -> { - this.mScrewdriver = false; - b = true; - } - case 2 -> { - this.mSoftHammer = false; - b = true; - } - case 3 -> { - this.mHardHammer = false; - b = true; - } - case 4 -> { - this.mSolderingTool = false; - b = true; - } - case 5 -> { - this.mCrowbar = false; - b = true; - } - } - return b; - } - - public void fixAllMaintenanceIssue() { - this.mCrowbar = true; - this.mWrench = true; - this.mHardHammer = true; - this.mSoftHammer = true; - this.mSolderingTool = true; - this.mScrewdriver = true; - } - - public boolean checkHatch() { - return mMaintenanceHatches.size() <= 1 - && (this.getPollutionPerSecond(null) > 0 ? !mMufflerHatches.isEmpty() : true); - } - - @Override - public void clearHatches() { - super.clearHatches(); - this.mChargeHatches.clear(); - this.mDischargeHatches.clear(); - this.mAirIntakes.clear(); - this.mTecTechEnergyHatches.clear(); - this.mTecTechDynamoHatches.clear(); - this.mAllEnergyHatches.clear(); - this.mAllDynamoHatches.clear(); - } - - public <E> boolean addToMachineListInternal(ArrayList<E> aList, final IGregTechTileEntity aTileEntity, - final int aBaseCasingIndex) { - return addToMachineListInternal(aList, getMetaTileEntity(aTileEntity), aBaseCasingIndex); - } - - public <E> boolean addToMachineListInternal(ArrayList<E> aList, final IMetaTileEntity aTileEntity, - final int aBaseCasingIndex) { - if (aTileEntity == null) { - return false; - } - - // Check type - /* - * Class <?> aHatchType = ReflectionUtils.getTypeOfGenericObject(aList); if - * (!aHatchType.isInstance(aTileEntity)) { return false; } - */ - - // Try setRecipeMap - - try { - if (aTileEntity instanceof GT_MetaTileEntity_Hatch_Input) { - resetRecipeMapForHatch((GT_MetaTileEntity_Hatch) aTileEntity, getRecipeMap()); - } - if (aTileEntity instanceof GT_MetaTileEntity_Hatch_InputBus) { - resetRecipeMapForHatch((GT_MetaTileEntity_Hatch) aTileEntity, getRecipeMap()); - } - } catch (Throwable t) { - t.printStackTrace(); - } - - if (aList.isEmpty()) { - if (aTileEntity instanceof GT_MetaTileEntity_Hatch) { - if (GTplusplus.CURRENT_LOAD_PHASE == INIT_PHASE.STARTED) { - log( - "Adding " + aTileEntity.getInventoryName() - + " at " - + new BlockPos(aTileEntity.getBaseMetaTileEntity()).getLocationString()); - } - updateTexture(aTileEntity, aBaseCasingIndex); - return aList.add((E) aTileEntity); - } - } else { - IGregTechTileEntity aCur = aTileEntity.getBaseMetaTileEntity(); - if (aList.contains(aTileEntity)) { - log( - "Found Duplicate " + aTileEntity.getInventoryName() - + " @ " - + new BlockPos(aCur).getLocationString()); - return false; - } - BlockPos aCurPos = new BlockPos(aCur); - boolean aExists = false; - for (E m : aList) { - IGregTechTileEntity b = ((IMetaTileEntity) m).getBaseMetaTileEntity(); - if (b != null) { - BlockPos aPos = new BlockPos(b); - if (aPos != null) { - if (aCurPos.equals(aPos)) { - if (GTplusplus.CURRENT_LOAD_PHASE == INIT_PHASE.STARTED) { - log("Found Duplicate " + b.getInventoryName() + " at " + aPos.getLocationString()); - } - return false; - } - } - } - } - if (aTileEntity instanceof GT_MetaTileEntity_Hatch) { - if (GTplusplus.CURRENT_LOAD_PHASE == INIT_PHASE.STARTED) { - log("Adding " + aCur.getInventoryName() + " at " + aCurPos.getLocationString()); - } - updateTexture(aTileEntity, aBaseCasingIndex); - return aList.add((E) aTileEntity); - } - } - return false; - } - - private IMetaTileEntity getMetaTileEntity(final IGregTechTileEntity aTileEntity) { - if (aTileEntity == null) { - return null; - } - final IMetaTileEntity aMetaTileEntity = aTileEntity.getMetaTileEntity(); - return aMetaTileEntity; - } - - @Override - public boolean addToMachineList(final IGregTechTileEntity aTileEntity, final int aBaseCasingIndex) { - return addToMachineList(getMetaTileEntity(aTileEntity), aBaseCasingIndex); - } - - public boolean addToMachineList(final IMetaTileEntity aMetaTileEntity, final int aBaseCasingIndex) { - if (aMetaTileEntity == null) { - return false; - } - - // Use this to determine the correct value, then update the hatch texture after. - boolean aDidAdd = false; - - // Handle Custom Hatches - if (aMetaTileEntity instanceof GT_MetaTileEntity_Hatch_InputBattery) { - log("Found GT_MetaTileEntity_Hatch_InputBattery"); - aDidAdd = addToMachineListInternal(mChargeHatches, aMetaTileEntity, aBaseCasingIndex); - } else if (aMetaTileEntity instanceof GT_MetaTileEntity_Hatch_OutputBattery) { - log("Found GT_MetaTileEntity_Hatch_OutputBattery"); - aDidAdd = addToMachineListInternal(mDischargeHatches, aMetaTileEntity, aBaseCasingIndex); - } else if (aMetaTileEntity instanceof GT_MetaTileEntity_Hatch_AirIntake) { - aDidAdd = addToMachineListInternal(mAirIntakes, aMetaTileEntity, aBaseCasingIndex) - && addToMachineListInternal(mInputHatches, aMetaTileEntity, aBaseCasingIndex); - } - - // Handle TT Multi-A Energy Hatches - else if (TecTech.isModLoaded() && isThisHatchMultiEnergy(aMetaTileEntity)) { - log("Found isThisHatchMultiEnergy"); - aDidAdd = addToMachineListInternal(mTecTechEnergyHatches, aMetaTileEntity, aBaseCasingIndex); - updateMasterEnergyHatchList(aMetaTileEntity); - } - - // Handle TT Multi-A Dynamos - else if (TecTech.isModLoaded() && isThisHatchMultiDynamo(aMetaTileEntity)) { - log("Found isThisHatchMultiDynamo"); - aDidAdd = addToMachineListInternal(mTecTechDynamoHatches, aMetaTileEntity, aBaseCasingIndex); - updateMasterDynamoHatchList(aMetaTileEntity); - } - - // Handle Fluid Hatches using seperate logic - else if (aMetaTileEntity instanceof GT_MetaTileEntity_Hatch_Input) - aDidAdd = addToMachineListInternal(mInputHatches, aMetaTileEntity, aBaseCasingIndex); - else if (aMetaTileEntity instanceof GT_MetaTileEntity_Hatch_Output) - aDidAdd = addToMachineListInternal(mOutputHatches, aMetaTileEntity, aBaseCasingIndex); - - // Process Remaining hatches using Vanilla GT Logic - else if (aMetaTileEntity instanceof IDualInputHatch hatch) { - hatch.updateCraftingIcon(this.getMachineCraftingIcon()); - aDidAdd = addToMachineListInternal(mDualInputHatches, aMetaTileEntity, aBaseCasingIndex); - } else if (aMetaTileEntity instanceof GT_MetaTileEntity_Hatch_InputBus) - aDidAdd = addToMachineListInternal(mInputBusses, aMetaTileEntity, aBaseCasingIndex); - else if (aMetaTileEntity instanceof GT_MetaTileEntity_Hatch_OutputBus) - aDidAdd = addToMachineListInternal(mOutputBusses, aMetaTileEntity, aBaseCasingIndex); - else if (aMetaTileEntity instanceof GT_MetaTileEntity_Hatch_Energy) { - aDidAdd = addToMachineListInternal(mEnergyHatches, aMetaTileEntity, aBaseCasingIndex); - updateMasterEnergyHatchList(aMetaTileEntity); - } else if (aMetaTileEntity instanceof GT_MetaTileEntity_Hatch_Dynamo) { - aDidAdd = addToMachineListInternal(mDynamoHatches, aMetaTileEntity, aBaseCasingIndex); - updateMasterDynamoHatchList(aMetaTileEntity); - } else if (aMetaTileEntity instanceof GT_MetaTileEntity_Hatch_Maintenance) - aDidAdd = addToMachineListInternal(mMaintenanceHatches, aMetaTileEntity, aBaseCasingIndex); - else if (aMetaTileEntity instanceof GT_MetaTileEntity_Hatch_Muffler) - aDidAdd = addToMachineListInternal(mMufflerHatches, aMetaTileEntity, aBaseCasingIndex); - - // return super.addToMachineList(aTileEntity, aBaseCasingIndex); - return aDidAdd; - } - - @Override - public boolean addMaintenanceToMachineList(IGregTechTileEntity aTileEntity, int aBaseCasingIndex) { - IMetaTileEntity aMetaTileEntity = getMetaTileEntity(aTileEntity); - if (aMetaTileEntity instanceof GT_MetaTileEntity_Hatch_Maintenance) { - return addToMachineList(aMetaTileEntity, aBaseCasingIndex); - } - return false; - } - - @Override - public boolean addMufflerToMachineList(IGregTechTileEntity aTileEntity, int aBaseCasingIndex) { - IMetaTileEntity aMetaTileEntity = getMetaTileEntity(aTileEntity); - if (aMetaTileEntity instanceof GT_MetaTileEntity_Hatch_Muffler) { - return addToMachineList(aMetaTileEntity, aBaseCasingIndex); - } - return false; - } - - @Override - public boolean addInputToMachineList(IGregTechTileEntity aTileEntity, int aBaseCasingIndex) { - IMetaTileEntity aMetaTileEntity = getMetaTileEntity(aTileEntity); - if (aMetaTileEntity instanceof GT_MetaTileEntity_Hatch_Input - || aMetaTileEntity instanceof GT_MetaTileEntity_Hatch_InputBus) { - return addToMachineList(aMetaTileEntity, aBaseCasingIndex); - } - return false; - } - - @Override - public boolean addOutputToMachineList(IGregTechTileEntity aTileEntity, int aBaseCasingIndex) { - IMetaTileEntity aMetaTileEntity = getMetaTileEntity(aTileEntity); - if (aMetaTileEntity instanceof GT_MetaTileEntity_Hatch_Output - || aMetaTileEntity instanceof GT_MetaTileEntity_Hatch_OutputBus) { - return addToMachineList(aMetaTileEntity, aBaseCasingIndex); - } - return false; - } - - public boolean addAirIntakeToMachineList(final IGregTechTileEntity aTileEntity, final int aBaseCasingIndex) { - IMetaTileEntity aMetaTileEntity = getMetaTileEntity(aTileEntity); - if (aMetaTileEntity instanceof GT_MetaTileEntity_Hatch_AirIntake) { - return addToMachineList(aMetaTileEntity, aBaseCasingIndex); - } - return false; - } - - public boolean addFluidInputToMachineList(final IGregTechTileEntity aTileEntity, final int aBaseCasingIndex) { - return addFluidInputToMachineList(getMetaTileEntity(aTileEntity), aBaseCasingIndex); - } - - public boolean addFluidInputToMachineList(final IMetaTileEntity aMetaTileEntity, final int aBaseCasingIndex) { - if (aMetaTileEntity instanceof GT_MetaTileEntity_Hatch_Input) { - return addToMachineList(aMetaTileEntity, aBaseCasingIndex); - } - return false; - } - - public boolean clearRecipeMapForAllInputHatches() { - return resetRecipeMapForAllInputHatches(null); - } - - public boolean resetRecipeMapForAllInputHatches() { - return resetRecipeMapForAllInputHatches(this.getRecipeMap()); - } - - public boolean resetRecipeMapForAllInputHatches(RecipeMap<?> aMap) { - int cleared = 0; - for (GT_MetaTileEntity_Hatch_Input g : this.mInputHatches) { - if (resetRecipeMapForHatch(g, aMap)) { - cleared++; - } - } - for (GT_MetaTileEntity_Hatch_InputBus g : this.mInputBusses) { - if (resetRecipeMapForHatch(g, aMap)) { - cleared++; - } - } - return cleared > 0; - } - - public boolean resetRecipeMapForHatch(IGregTechTileEntity aTileEntity, RecipeMap<?> aMap) { - try { - final IMetaTileEntity aMetaTileEntity = getMetaTileEntity(aTileEntity); - if (aMetaTileEntity == null) { - return false; - } - if (aMetaTileEntity instanceof GT_MetaTileEntity_Hatch_Input - || aMetaTileEntity instanceof GT_MetaTileEntity_Hatch_InputBus - || aMetaTileEntity instanceof GT_MetaTileEntity_Hatch_Steam_BusInput) { - return resetRecipeMapForHatch((GT_MetaTileEntity_Hatch) aMetaTileEntity, aMap); - } else { - return false; - } - } catch (Throwable t) { - t.printStackTrace(); - return false; - } - } - - public boolean resetRecipeMapForHatch(GT_MetaTileEntity_Hatch aTileEntity, RecipeMap<?> aMap) { - if (aTileEntity == null) { - return false; - } - final IMetaTileEntity aMetaTileEntity = aTileEntity; - if (aMetaTileEntity instanceof GT_MetaTileEntity_Hatch_Input - || aMetaTileEntity instanceof GT_MetaTileEntity_Hatch_InputBus - || aMetaTileEntity instanceof GT_MetaTileEntity_Hatch_Steam_BusInput) { - if (aMetaTileEntity instanceof GT_MetaTileEntity_Hatch_Input) { - ((GT_MetaTileEntity_Hatch_Input) aMetaTileEntity).mRecipeMap = null; - ((GT_MetaTileEntity_Hatch_Input) aMetaTileEntity).mRecipeMap = aMap; - if (aMap != null) { - log("Remapped Input Hatch to " + aMap.unlocalizedName + "."); - } else { - log("Cleared Input Hatch."); - } - } else if (aMetaTileEntity instanceof GT_MetaTileEntity_Hatch_InputBus) { - ((GT_MetaTileEntity_Hatch_InputBus) aMetaTileEntity).mRecipeMap = null; - ((GT_MetaTileEntity_Hatch_InputBus) aMetaTileEntity).mRecipeMap = aMap; - if (aMap != null) { - log("Remapped Input Bus to " + aMap.unlocalizedName + "."); - } else { - log("Cleared Input Bus."); - } - } else { - ((GT_MetaTileEntity_Hatch_Steam_BusInput) aMetaTileEntity).mRecipeMap = null; - ((GT_MetaTileEntity_Hatch_Steam_BusInput) aMetaTileEntity).mRecipeMap = aMap; - if (aMap != null) { - log("Remapped Input Bus to " + aMap.unlocalizedName + "."); - } else { - log("Cleared Input Bus."); - } - } - return true; - } else { - return false; - } - } - - @Override - public final void onScrewdriverRightClick(ForgeDirection side, EntityPlayer aPlayer, float aX, float aY, float aZ) { - super.onScrewdriverRightClick(side, aPlayer, aX, aY, aZ); - clearRecipeMapForAllInputHatches(); - onModeChangeByScrewdriver(side, aPlayer, aX, aY, aZ); - resetRecipeMapForAllInputHatches(); - } - - public void onModeChangeByScrewdriver(ForgeDirection side, EntityPlayer aPlayer, float aX, float aY, float aZ) {} - - /** - * Enable Texture Casing Support if found in GT 5.09 - */ - public boolean updateTexture(final IGregTechTileEntity aTileEntity, int aCasingID) { - return updateTexture(getMetaTileEntity(aTileEntity), aCasingID); - } - - /** - * Enable Texture Casing Support if found in GT 5.09 - */ - public boolean updateTexture(final IMetaTileEntity aTileEntity, int aCasingID) { - try { // gregtech.api.metatileentity.implementations.GT_MetaTileEntity_Hatch.updateTexture(int) - - final IMetaTileEntity aMetaTileEntity = aTileEntity; - if (aMetaTileEntity == null) { - return false; - } - Method mProper = ReflectionUtils.getMethod(GT_MetaTileEntity_Hatch.class, "updateTexture", int.class); - if (mProper != null) { - if (GT_MetaTileEntity_Hatch.class.isInstance(aMetaTileEntity)) { - mProper.setAccessible(true); - mProper.invoke(aMetaTileEntity, aCasingID); - // log("Good Method Call for updateTexture."); - return true; - } - } else { - log("Bad Method Call for updateTexture."); - if (GT_MetaTileEntity_Hatch.class.isInstance(aMetaTileEntity)) { - if (aCasingID <= Byte.MAX_VALUE) { - ((GT_MetaTileEntity_Hatch) aTileEntity).updateTexture(aCasingID); - log( - "Good Method Call for updateTexture. Used fallback method of setting mMachineBlock as casing id was <= 128."); - return true; - } else { - log("updateTexture returning false. 1.2"); - } - } else { - log("updateTexture returning false. 1.3"); - } - } - log("updateTexture returning false. 1"); - return false; - } catch (SecurityException | IllegalAccessException | IllegalArgumentException | InvocationTargetException e) { - log("updateTexture returning false."); - log("updateTexture returning false. 2"); - e.printStackTrace(); - return false; - } - } - - /** - * TecTech Support - */ - - /** - * This is the array Used to Store the Tectech Multi-Amp Dynamo hatches. - */ - public ArrayList<GT_MetaTileEntity_Hatch> mTecTechDynamoHatches = new ArrayList<>(); - - /** - * This is the array Used to Store the Tectech Multi-Amp Energy hatches. - */ - public ArrayList<GT_MetaTileEntity_Hatch> mTecTechEnergyHatches = new ArrayList<>(); - - /** - * TecTech Multi-Amp Dynamo Support - * - * @param aTileEntity - The Dynamo Hatch - * @param aBaseCasingIndex - Casing Texture - * @return - */ - public boolean addMultiAmpDynamoToMachineList(final IGregTechTileEntity aTileEntity, final int aBaseCasingIndex) { - final IMetaTileEntity aMetaTileEntity = getMetaTileEntity(aTileEntity); - if (aMetaTileEntity == null) { - return false; - } - if (isThisHatchMultiDynamo(aTileEntity)) { - return addToMachineListInternal(mTecTechDynamoHatches, aMetaTileEntity, aBaseCasingIndex); - } - return false; - } - - public boolean isThisHatchMultiDynamo(IGregTechTileEntity aTileEntity) { - return isThisHatchMultiDynamo(getMetaTileEntity(aTileEntity)); - } - - public boolean isThisHatchMultiDynamo(IMetaTileEntity aMetaTileEntity) { - Class<?> mDynamoClass; - mDynamoClass = ReflectionUtils - .getClass("com.github.technus.tectech.thing.metaTileEntity.hatch.GT_MetaTileEntity_Hatch_DynamoMulti"); - if (mDynamoClass != null) { - if (mDynamoClass.isInstance(aMetaTileEntity)) { - return true; - } - } - return false; - } - - @Override - public boolean addDynamoToMachineList(IGregTechTileEntity aTileEntity, int aBaseCasingIndex) { - IMetaTileEntity aMetaTileEntity = getMetaTileEntity(aTileEntity); - if (aMetaTileEntity instanceof GT_MetaTileEntity_Hatch_Dynamo || isThisHatchMultiDynamo(aMetaTileEntity)) { - return addToMachineList(aMetaTileEntity, aBaseCasingIndex); - } - return false; - } - - private boolean updateMasterDynamoHatchList(IMetaTileEntity aMetaTileEntity) { - if (aMetaTileEntity == null) { - return false; - } - if (aMetaTileEntity instanceof GT_MetaTileEntity_Hatch aHatch) { - return mAllDynamoHatches.add(aHatch); - } - return false; - } - - /** - * TecTech Multi-Amp Energy Hatch Support - * - * @param aTileEntity - The Energy Hatch - * @param aBaseCasingIndex - Casing Texture - * @return - */ - public boolean addMultiAmpEnergyToMachineList(final IGregTechTileEntity aTileEntity, final int aBaseCasingIndex) { - final IMetaTileEntity aMetaTileEntity = getMetaTileEntity(aTileEntity); - if (aMetaTileEntity == null) { - return false; - } - if (isThisHatchMultiEnergy(aMetaTileEntity)) { - return addToMachineListInternal(mTecTechEnergyHatches, aMetaTileEntity, aBaseCasingIndex); - } - return false; - } - - public boolean isThisHatchMultiEnergy(IGregTechTileEntity aTileEntity) { - return isThisHatchMultiEnergy(getMetaTileEntity(aTileEntity)); - } - - public boolean isThisHatchMultiEnergy(IMetaTileEntity aMetaTileEntity) { - Class<?> mDynamoClass; - mDynamoClass = ReflectionUtils - .getClass("com.github.technus.tectech.thing.metaTileEntity.hatch.GT_MetaTileEntity_Hatch_EnergyMulti"); - if (mDynamoClass != null) { - if (mDynamoClass.isInstance(aMetaTileEntity)) { - return true; - } - } - return false; - } - - @Override - public boolean addEnergyInputToMachineList(IGregTechTileEntity aTileEntity, int aBaseCasingIndex) { - IMetaTileEntity aMetaTileEntity = getMetaTileEntity(aTileEntity); - if (aMetaTileEntity instanceof GT_MetaTileEntity_Hatch_Energy || isThisHatchMultiEnergy(aMetaTileEntity)) { - return addToMachineList(aMetaTileEntity, aBaseCasingIndex); - } - return false; - } - - private boolean updateMasterEnergyHatchList(IMetaTileEntity aMetaTileEntity) { - if (aMetaTileEntity == null) { - return false; - } - if (aMetaTileEntity instanceof GT_MetaTileEntity_Hatch aHatch) { - return mAllEnergyHatches.add(aHatch); - } - return false; - } - - /** - * Pollution Management - */ - public int calculatePollutionReductionForHatch(GT_MetaTileEntity_Hatch_Muffler hatch, int poll) { - return hatch.calculatePollutionReduction(poll); - } - - @Override - public void saveNBTData(NBTTagCompound aNBT) { - aNBT.setLong("mTotalRunTime", this.mTotalRunTime); - super.saveNBTData(aNBT); - } - - @Override - public void loadNBTData(NBTTagCompound aNBT) { - super.loadNBTData(aNBT); - this.mTotalRunTime = aNBT.getLong("mTotalRunTime"); - if (aNBT.hasKey("mVoidExcess")) { - // backward compatibility - voidingMode = aNBT.getBoolean("mVoidExcess") ? VoidingMode.VOID_ALL : VoidingMode.VOID_NONE; - } - if (aNBT.hasKey("mUseMultiparallelMode")) { - // backward compatibility - batchMode = aNBT.getBoolean("mUseMultiparallelMode"); - } - } - - /** - * Custom Tool Handling - */ - @Override - public boolean onRightclick(IGregTechTileEntity aBaseMetaTileEntity, EntityPlayer aPlayer, ForgeDirection side, - float aX, float aY, float aZ) { - // Do Things - if (this.getBaseMetaTileEntity() - .isServerSide()) { - // Logger.INFO("Right Clicked Controller."); - ItemStack tCurrentItem = aPlayer.inventory.getCurrentItem(); - if (tCurrentItem != null) { - // Logger.INFO("Holding Item."); - if (tCurrentItem.getItem() instanceof GT_MetaGenerated_Tool) { - // Logger.INFO("Is GT_MetaGenerated_Tool."); - int[] aOreID = OreDictionary.getOreIDs(tCurrentItem); - for (int id : aOreID) { - // Plunger - if (OreDictionary.getOreName(id) - .equals("craftingToolPlunger")) { - // Logger.INFO("Is Plunger."); - return onPlungerRightClick(aPlayer, side, aX, aY, aZ); - } - } - } - } - } - // Do Super - boolean aSuper = super.onRightclick(aBaseMetaTileEntity, aPlayer, side, aX, aY, aZ); - return aSuper; - } - - public boolean onPlungerRightClick(EntityPlayer aPlayer, ForgeDirection side, float aX, float aY, float aZ) { - int aHatchIndex = 0; - PlayerUtils.messagePlayer(aPlayer, "Trying to clear " + mOutputHatches.size() + " output hatches."); - for (GT_MetaTileEntity_Hatch_Output hatch : this.mOutputHatches) { - if (hatch.mFluid != null) { - PlayerUtils.messagePlayer( - aPlayer, - "Clearing " + hatch.mFluid.amount - + "L of " - + hatch.mFluid.getLocalizedName() - + " from hatch " - + aHatchIndex - + "."); - hatch.mFluid = null; - } - aHatchIndex++; - } - return aHatchIndex > 0; - } - - @Override - public boolean onWireCutterRightClick(ForgeDirection side, ForgeDirection wrenchingSide, EntityPlayer aPlayer, - float aX, float aY, float aZ) { - if (aPlayer.isSneaking()) { - batchMode = !batchMode; - if (batchMode) { - GT_Utility.sendChatToPlayer(aPlayer, StatCollector.translateToLocal("misc.BatchModeTextOn")); - } else { - GT_Utility.sendChatToPlayer(aPlayer, StatCollector.translateToLocal("misc.BatchModeTextOff")); - } - return true; - } - return false; - } - - @Override - public boolean onSolderingToolRightClick(ForgeDirection side, ForgeDirection wrenchingSide, EntityPlayer aPlayer, - float aX, float aY, float aZ) { - if (supportsVoidProtection() && wrenchingSide == getBaseMetaTileEntity().getFrontFacing()) { - Set<VoidingMode> allowed = getAllowedVoidingModes(); - setVoidingMode(getVoidingMode().nextInCollection(allowed)); - GT_Utility.sendChatToPlayer( - aPlayer, - StatCollector.translateToLocal("GT5U.gui.button.voiding_mode") + " " - + StatCollector.translateToLocal(getVoidingMode().getTransKey())); - return true; - } else return super.onSolderingToolRightClick(side, wrenchingSide, aPlayer, aX, aY, aZ); - } - - @Override - public void onServerStart() { - super.onServerStart(); - tryTickWaitTimerDown(); - } - - @Override - public void onFirstTick(IGregTechTileEntity aBaseMetaTileEntity) { - super.onFirstTick(aBaseMetaTileEntity); - tryTickWaitTimerDown(); - } - - @Override - public void onPreTick(IGregTechTileEntity aBaseMetaTileEntity, long aTick) { - super.onPreTick(aBaseMetaTileEntity, aTick); - tryTickWaitTimerDown(); - } - - @Override - public void onCreated(ItemStack aStack, World aWorld, EntityPlayer aPlayer) { - super.onCreated(aStack, aWorld, aPlayer); - tryTickWaitTimerDown(); - } - - private void tryTickWaitTimerDown() { - /* - * if (mStartUpCheck > 10) { mStartUpCheck = 10; } - */ - } - - // Only support to use meta to tier - - /** - * accept meta [0, maxMeta) - * - * @param maxMeta exclusive - */ - public static <T> IStructureElement<T> addTieredBlock(Block aBlock, BiConsumer<T, Integer> aSetTheMeta, - Function<T, Integer> aGetTheMeta, int maxMeta) { - return addTieredBlock(aBlock, (t, i) -> { - aSetTheMeta.accept(t, i); - return true; - }, aGetTheMeta, 0, maxMeta); - } - - /** - * - * @param minMeta inclusive - * @param maxMeta exclusive - */ - public static <T> IStructureElement<T> addTieredBlock(Block aBlock, BiConsumer<T, Integer> aSetTheMeta, - Function<T, Integer> aGetTheMeta, int minMeta, int maxMeta) { - return addTieredBlock(aBlock, (t, i) -> { - aSetTheMeta.accept(t, i); - return true; - }, aGetTheMeta, minMeta, maxMeta); - } - - /** - * - * @param minMeta inclusive - * @param maxMeta exclusive - */ - public static <T> IStructureElement<T> addTieredBlock(Block aBlock, BiPredicate<T, Integer> aSetTheMeta, - Function<T, Integer> aGetTheMeta, int minMeta, int maxMeta) { - - return new IStructureElement<>() { - - @Override - public boolean check(T t, World world, int x, int y, int z) { - Block tBlock = world.getBlock(x, y, z); - if (aBlock == tBlock) { - Integer currentMeta = aGetTheMeta.apply(t); - int newMeta = tBlock.getDamageValue(world, x, y, z) + 1; - if (newMeta > maxMeta || newMeta < minMeta + 1) return false; - if (currentMeta == 0) { - return aSetTheMeta.test(t, newMeta); - } else { - return currentMeta == newMeta; - } - } - return false; - } - - @Override - public boolean spawnHint(T t, World world, int x, int y, int z, ItemStack trigger) { - StructureLibAPI.hintParticle(world, x, y, z, aBlock, getMeta(trigger)); - return true; - } - - @Override - public boolean placeBlock(T t, World world, int x, int y, int z, ItemStack trigger) { - return world.setBlock(x, y, z, aBlock, getMeta(trigger), 3); - } - - private int getMeta(ItemStack trigger) { - int meta = trigger.stackSize; - if (meta <= 0) meta = minMeta; - if (meta + minMeta >= maxMeta) meta = maxMeta - 1 - minMeta; - return meta + minMeta; - } - - @Nullable - @Override - public BlocksToPlace getBlocksToPlace(T t, World world, int x, int y, int z, ItemStack trigger, - AutoPlaceEnvironment env) { - return BlocksToPlace.create(aBlock, getMeta(trigger)); - } - - @Override - public PlaceResult survivalPlaceBlock(T t, World world, int x, int y, int z, ItemStack trigger, - AutoPlaceEnvironment env) { - if (world.getBlock(x, y, z) == aBlock) { - if (world.getBlockMetadata(x, y, z) == getMeta(trigger)) { - return PlaceResult.SKIP; - } - return PlaceResult.REJECT; - } - return StructureUtility.survivalPlaceBlock( - aBlock, - getMeta(trigger), - world, - x, - y, - z, - env.getSource(), - env.getActor(), - env.getChatter()); - } - }; - } - - @Override - public ITexture[] getTexture(IGregTechTileEntity aBaseMetaTileEntity, ForgeDirection side, ForgeDirection facing, - int aColorIndex, boolean aActive, boolean aRedstone) { - if (side == facing) { - if (aActive) return new ITexture[] { getCasingTexture(), TextureFactory.builder() - .addIcon(getActiveOverlay()) - .extFacing() - .build() }; - return new ITexture[] { getCasingTexture(), TextureFactory.builder() - .addIcon(getInactiveOverlay()) - .extFacing() - .build() }; - } - return new ITexture[] { getCasingTexture() }; - } - - protected IIconContainer getActiveOverlay() { - return null; - } - - protected IIconContainer getInactiveOverlay() { - return null; - } - - protected ITexture getCasingTexture() { - return Textures.BlockIcons.getCasingTextureForId(getCasingTextureId()); - } - - protected int getCasingTextureId() { - return 0; - } - - @Override - public void addUIWidgets(ModularWindow.Builder builder, UIBuildContext buildContext) { - if (doesBindPlayerInventory()) { - super.addUIWidgets(builder, buildContext); - } else { - addNoPlayerInventoryUI(builder, buildContext); - } - } - - private static final Materials GOOD = Materials.Uranium; - private static final Materials BAD = Materials.Plutonium; - private static final ConcurrentHashMap<String, ItemStack> mToolStacks = new ConcurrentHashMap<>(); - - @Override - public boolean supportsVoidProtection() { - return true; - } - - @Override - public boolean supportsBatchMode() { - return true; - } - - protected void addNoPlayerInventoryUI(ModularWindow.Builder builder, UIBuildContext buildContext) { - builder.widget( - new DrawableWidget().setDrawable(GT_UITextures.PICTURE_SCREEN_BLACK) - .setPos(3, 4) - .setSize(152, 159)); - for (int i = 0; i < 9; i++) { - builder.widget( - new DrawableWidget().setDrawable(GT_UITextures.BUTTON_STANDARD) - .setPos(155, 3 + i * 18) - .setSize(18, 18)); - } - - DynamicPositionedColumn screenElements = new DynamicPositionedColumn(); - drawTextsNoPlayerInventory(screenElements); - builder.widget(screenElements); - - setupToolDisplay(); - - builder.widget( - new ItemDrawable(() -> mToolStacks.get(mWrench + "WRENCH")).asWidget() - .setPos(156, 58)) - .widget(new FakeSyncWidget.BooleanSyncer(() -> mWrench, val -> mWrench = val)); - builder.widget( - new ItemDrawable(() -> mToolStacks.get(mCrowbar + "CROWBAR")).asWidget() - .setPos(156, 76)) - .widget(new FakeSyncWidget.BooleanSyncer(() -> mCrowbar, val -> mCrowbar = val)); - builder.widget( - new ItemDrawable(() -> mToolStacks.get(mHardHammer + "HARDHAMMER")).asWidget() - .setPos(156, 94)) - .widget( - new TextWidget("H").setDefaultColor(COLOR_TEXT_WHITE.get()) - .setPos(167, 103)) - .widget(new FakeSyncWidget.BooleanSyncer(() -> mHardHammer, val -> mHardHammer = val)); - builder.widget( - new ItemDrawable(() -> mToolStacks.get(mSoftHammer + "SOFTHAMMER")).asWidget() - .setPos(156, 112)) - .widget( - new TextWidget("M").setDefaultColor(COLOR_TEXT_WHITE.get()) - .setPos(167, 121)) - .widget(new FakeSyncWidget.BooleanSyncer(() -> mSoftHammer, val -> mSoftHammer = val)); - builder.widget( - new ItemDrawable(() -> mToolStacks.get(mScrewdriver + "SCREWDRIVER")).asWidget() - .setPos(156, 130)) - .widget(new FakeSyncWidget.BooleanSyncer(() -> mScrewdriver, val -> mScrewdriver = val)); - builder.widget( - new ItemDrawable(() -> mToolStacks.get(mSolderingTool + "SOLDERING_IRON_LV")).asWidget() - .setPos(156, 148)) - .widget(new FakeSyncWidget.BooleanSyncer(() -> mSolderingTool, val -> mSolderingTool = val)); - builder.widget( - new ItemDrawable(() -> mToolStacks.get(getBaseMetaTileEntity().isActive() + "GLASS")).asWidget() - .setPos(156, 22)) - .widget( - TextWidget.dynamicString(() -> getBaseMetaTileEntity().isActive() ? "On" : "Off") - .setSynced(false) - .setDefaultColor(COLOR_TEXT_WHITE.get()) - .setPos(157, 31)) - .widget( - new FakeSyncWidget.BooleanSyncer( - () -> getBaseMetaTileEntity().isActive(), - val -> getBaseMetaTileEntity().setActive(val))); - } - - protected void drawTextsNoPlayerInventory(DynamicPositionedColumn screenElements) { - screenElements.setSynced(false) - .setSpace(0) - .setPos(6, 7); - - screenElements - .widget( - new TextWidget(GT_Utility.trans("138", "Incomplete Structure.")).setDefaultColor(COLOR_TEXT_WHITE.get()) - .setEnabled(widget -> !mMachine)) - .widget(new FakeSyncWidget.BooleanSyncer(() -> mMachine, val -> mMachine = val)) - .widget( - TextWidget - .dynamicString( - () -> StatCollector.translateToLocal("GTPP.machines.input") + " " - + StatCollector.translateToLocal("GTPP.machines.tier") - + ": " - + EnumChatFormatting.GREEN - + GT_Values.VOLTAGE_NAMES[(int) getInputTier()]) - .setDefaultColor(COLOR_TEXT_WHITE.get()) - .setEnabled(widget -> mMachine && getInputTier() > 0)) - .widget( - TextWidget - .dynamicString( - () -> StatCollector.translateToLocal("GTPP.machines.output") + " " - + StatCollector.translateToLocal("GTPP.machines.tier") - + ": " - + EnumChatFormatting.GREEN - + GT_Values.VOLTAGE_NAMES[(int) getOutputTier()]) - .setDefaultColor(COLOR_TEXT_WHITE.get()) - .setEnabled(widget -> mMachine && getOutputTier() > 0)) - .widget( - TextWidget - .dynamicString( - () -> StatCollector.translateToLocal("GTPP.multiblock.progress") + ": " - + EnumChatFormatting.GREEN - + getBaseMetaTileEntity().getProgress() / 20 - + EnumChatFormatting.RESET - + " s / " - + EnumChatFormatting.YELLOW - + getBaseMetaTileEntity().getMaxProgress() / 20 - + EnumChatFormatting.RESET - + " s") - .setDefaultColor(COLOR_TEXT_WHITE.get()) - .setEnabled(widget -> mMachine)) - .widget( - new TextWidget(StatCollector.translateToLocal("GTPP.multiblock.energy") + ":") - .setDefaultColor(COLOR_TEXT_WHITE.get()) - .setEnabled(widget -> mMachine)) - .widget( - TextWidget - .dynamicString( - () -> StatCollector.translateToLocal( - "" + EnumChatFormatting.GREEN - + getStoredEnergyInAllEnergyHatches() - + EnumChatFormatting.RESET - + " EU / " - + EnumChatFormatting.YELLOW - + getMaxEnergyStorageOfAllEnergyHatches() - + EnumChatFormatting.RESET - + " EU")) - .setDefaultColor(COLOR_TEXT_WHITE.get()) - .setEnabled(widget -> mMachine)) - .widget( - new TextWidget(StatCollector.translateToLocal("GTPP.multiblock.usage") + ":") - .setDefaultColor(COLOR_TEXT_WHITE.get()) - .setEnabled(widget -> mMachine && getLastRecipeEU() > 0 && getLastRecipeDuration() > 0)) - .widget( - TextWidget.dynamicString( - () -> StatCollector.translateToLocal( - "" + EnumChatFormatting.RED + -getLastRecipeEU() + EnumChatFormatting.RESET + " EU/t/parallel")) - .setDefaultColor(COLOR_TEXT_WHITE.get()) - .setEnabled(widget -> mMachine && getLastRecipeEU() > 0 && getLastRecipeDuration() > 0)) - .widget( - TextWidget.dynamicString(() -> StatCollector.translateToLocal("GTPP.multiblock.generation") + ":") - .setDefaultColor(COLOR_TEXT_WHITE.get()) - .setEnabled(widget -> mMachine && getLastRecipeEU() < 0 && getLastRecipeDuration() > 0)) - .widget( - TextWidget - .dynamicString( - () -> StatCollector.translateToLocal( - "" + EnumChatFormatting.GREEN - + getLastRecipeEU() - + EnumChatFormatting.RESET - + " EU/t/parallel")) - .setDefaultColor(COLOR_TEXT_WHITE.get()) - .setEnabled(widget -> mMachine && getLastRecipeEU() < 0 && getLastRecipeDuration() > 0)) - .widget( - TextWidget - .dynamicString( - () -> StatCollector.translateToLocal("GTPP.multiblock.duration") + ": " - + EnumChatFormatting.RED - + getLastRecipeDuration() - + EnumChatFormatting.RESET - + " ticks") - .setDefaultColor(COLOR_TEXT_WHITE.get()) - .setEnabled(widget -> mMachine && getLastRecipeEU() != 0 && getLastRecipeDuration() > 0)) - .widget( - TextWidget - .dynamicString( - () -> StatCollector.translateToLocal("GTPP.multiblock.specialvalue") + ": " - + EnumChatFormatting.RED - + getLastRecipeEU() - + EnumChatFormatting.RESET - + "") - .setDefaultColor(COLOR_TEXT_WHITE.get()) - .setEnabled( - widget -> mMachine && getLastRecipeEU() != 0 - && getLastRecipeDuration() > 0 - && (mLastRecipe != null ? mLastRecipe.mSpecialValue : 0) > 0)) - .widget( - new TextWidget(StatCollector.translateToLocal("GTPP.multiblock.mei") + ":") - .setDefaultColor(COLOR_TEXT_WHITE.get()) - .setEnabled(widget -> mMachine)) - .widget( - TextWidget - .dynamicString( - () -> StatCollector.translateToLocal( - "" + EnumChatFormatting.YELLOW - + getMaxInputVoltage() - + EnumChatFormatting.RESET - + " EU/t(*2A) " - + StatCollector.translateToLocal("GTPP.machines.tier") - + ": " - + EnumChatFormatting.YELLOW - + GT_Values.VN[GT_Utility.getTier(getMaxInputVoltage())] - + EnumChatFormatting.RESET)) - .setDefaultColor(COLOR_TEXT_WHITE.get()) - .setEnabled(widget -> mMachine)) - .widget( - TextWidget - .dynamicString( - () -> StatCollector.translateToLocal("GTPP.multiblock.efficiency") + ": " - + EnumChatFormatting.YELLOW - + (mEfficiency / 100.0F) - + EnumChatFormatting.RESET - + " %") - .setDefaultColor(COLOR_TEXT_WHITE.get()) - .setEnabled(widget -> mMachine)) - .widget( - TextWidget - .dynamicString( - () -> StatCollector.translateToLocal("GTPP.multiblock.pollution") + ": " - + EnumChatFormatting.RED - + (getPollutionPerTick(null) * 20) - + EnumChatFormatting.RESET - + "/sec") - .setDefaultColor(COLOR_TEXT_WHITE.get()) - .setEnabled(widget -> mMachine)) - .widget( - TextWidget - .dynamicString( - () -> StatCollector.translateToLocal("GTPP.multiblock.pollutionreduced") + ": " - + EnumChatFormatting.GREEN - + getPollutionReductionForAllMufflers() - + EnumChatFormatting.RESET - + " %") - .setDefaultColor(COLOR_TEXT_WHITE.get()) - .setEnabled(widget -> mMachine)) - .widget( - new TextWidget("Total Time Since Built: ").setDefaultColor(COLOR_TEXT_WHITE.get()) - .setEnabled(widget -> mMachine)) - .widget( - TextWidget - .dynamicString( - () -> "" + EnumChatFormatting.DARK_GREEN - + getRuntimeWeeksDisplay() - + EnumChatFormatting.RESET - + " Weeks,") - .setDefaultColor(COLOR_TEXT_WHITE.get()) - .setEnabled(widget -> mMachine)) - .widget( - TextWidget - .dynamicString( - () -> "" + EnumChatFormatting.DARK_GREEN - + getRuntimeDaysDisplay() - + EnumChatFormatting.RESET - + " Days,") - .setDefaultColor(COLOR_TEXT_WHITE.get()) - .setEnabled(widget -> mMachine)) - .widget( - TextWidget - .dynamicString( - () -> "" + EnumChatFormatting.DARK_GREEN - + getRuntimeHoursDisplay() - + EnumChatFormatting.RESET - + " Hours,") - .setDefaultColor(COLOR_TEXT_WHITE.get()) - .setEnabled(widget -> mMachine)) - .widget( - TextWidget - .dynamicString( - () -> "" + EnumChatFormatting.DARK_GREEN - + getRuntimeMinutesDisplay() - + EnumChatFormatting.RESET - + " Minutes,") - .setDefaultColor(COLOR_TEXT_WHITE.get()) - .setEnabled(widget -> mMachine)) - .widget( - TextWidget - .dynamicString( - () -> "" + EnumChatFormatting.DARK_GREEN - + getRuntimeSecondsDisplay() - + EnumChatFormatting.RESET - + " Seconds") - .setDefaultColor(COLOR_TEXT_WHITE.get()) - .setEnabled(widget -> mMachine)); - } - - protected int getLastRecipeEU() { - return mLastRecipe != null ? mLastRecipe.mEUt : 0; - } - - protected int getLastRecipeDuration() { - return mLastRecipe != null ? mLastRecipe.mDuration : 0; - } - - protected long getRuntimeSeconds() { - return getTotalRuntimeInTicks() / 20; - } - - protected long getRuntimeWeeksDisplay() { - return TimeUnit.SECONDS.toDays(getRuntimeSeconds()) / 7; - } - - protected long getRuntimeDaysDisplay() { - return TimeUnit.SECONDS.toDays(getRuntimeSeconds()) - 7 * getRuntimeWeeksDisplay(); - } - - protected long getRuntimeHoursDisplay() { - return TimeUnit.SECONDS.toHours(getRuntimeSeconds()) - TimeUnit.DAYS.toHours(getRuntimeDaysDisplay()) - - TimeUnit.DAYS.toHours(7 * getRuntimeWeeksDisplay()); - } - - protected long getRuntimeMinutesDisplay() { - return TimeUnit.SECONDS.toMinutes(getRuntimeSeconds()) - (TimeUnit.SECONDS.toHours(getRuntimeSeconds()) * 60); - } - - protected long getRuntimeSecondsDisplay() { - return TimeUnit.SECONDS.toSeconds(getRuntimeSeconds()) - (TimeUnit.SECONDS.toMinutes(getRuntimeSeconds()) * 60); - } - - protected void setupToolDisplay() { - if (!mToolStacks.isEmpty()) return; - - mToolStacks.put( - true + "WRENCH", - GT_MetaGenerated_Tool_01.INSTANCE - .getToolWithStats(GT_MetaGenerated_Tool_01.WRENCH, 1, GOOD, Materials.Tungsten, null)); - mToolStacks.put( - true + "CROWBAR", - GT_MetaGenerated_Tool_01.INSTANCE - .getToolWithStats(GT_MetaGenerated_Tool_01.CROWBAR, 1, GOOD, Materials.Tungsten, null)); - mToolStacks.put( - true + "HARDHAMMER", - GT_MetaGenerated_Tool_01.INSTANCE - .getToolWithStats(GT_MetaGenerated_Tool_01.HARDHAMMER, 1, GOOD, Materials.Tungsten, null)); - mToolStacks.put( - true + "SOFTHAMMER", - GT_MetaGenerated_Tool_01.INSTANCE - .getToolWithStats(GT_MetaGenerated_Tool_01.SOFTMALLET, 1, GOOD, Materials.Tungsten, null)); - mToolStacks.put( - true + "SCREWDRIVER", - GT_MetaGenerated_Tool_01.INSTANCE - .getToolWithStats(GT_MetaGenerated_Tool_01.SCREWDRIVER, 1, GOOD, Materials.Tungsten, null)); - mToolStacks.put( - true + "SOLDERING_IRON_LV", - GT_MetaGenerated_Tool_01.INSTANCE - .getToolWithStats(GT_MetaGenerated_Tool_01.SOLDERING_IRON_LV, 1, GOOD, Materials.Tungsten, null)); - - mToolStacks.put( - false + "WRENCH", - GT_MetaGenerated_Tool_01.INSTANCE - .getToolWithStats(GT_MetaGenerated_Tool_01.WRENCH, 1, BAD, Materials.Tungsten, null)); - mToolStacks.put( - false + "CROWBAR", - GT_MetaGenerated_Tool_01.INSTANCE - .getToolWithStats(GT_MetaGenerated_Tool_01.CROWBAR, 1, BAD, Materials.Tungsten, null)); - mToolStacks.put( - false + "HARDHAMMER", - GT_MetaGenerated_Tool_01.INSTANCE - .getToolWithStats(GT_MetaGenerated_Tool_01.HARDHAMMER, 1, BAD, Materials.Tungsten, null)); - mToolStacks.put( - false + "SOFTHAMMER", - GT_MetaGenerated_Tool_01.INSTANCE - .getToolWithStats(GT_MetaGenerated_Tool_01.SOFTMALLET, 1, BAD, Materials.Tungsten, null)); - mToolStacks.put( - false + "SCREWDRIVER", - GT_MetaGenerated_Tool_01.INSTANCE - .getToolWithStats(GT_MetaGenerated_Tool_01.SCREWDRIVER, 1, BAD, Materials.Tungsten, null)); - mToolStacks.put( - false + "SOLDERING_IRON_LV", - GT_MetaGenerated_Tool_01.INSTANCE - .getToolWithStats(GT_MetaGenerated_Tool_01.SOLDERING_IRON_LV, 1, BAD, Materials.Tungsten, null)); - - ItemStack aGlassPane1 = ItemUtils.getItemStackOfAmountFromOreDict("paneGlassRed", 1); - ItemStack aGlassPane2 = ItemUtils.getItemStackOfAmountFromOreDict("paneGlassLime", 1); - mToolStacks.put("falseGLASS", aGlassPane1); - mToolStacks.put("trueGLASS", aGlassPane2); - } - - public enum GTPPHatchElement implements IHatchElement<GregtechMeta_MultiBlockBase<?>> { - - AirIntake(GregtechMeta_MultiBlockBase::addAirIntakeToMachineList, GT_MetaTileEntity_Hatch_AirIntake.class) { - - @Override - public long count(GregtechMeta_MultiBlockBase<?> t) { - return t.mAirIntakes.size(); - } - }, - TTDynamo(GregtechMeta_MultiBlockBase::addMultiAmpDynamoToMachineList, - "com.github.technus.tectech.thing.metaTileEntity.hatch.GT_MetaTileEntity_Hatch_DynamoMulti") { - - @Override - public long count(GregtechMeta_MultiBlockBase<?> t) { - return t.mTecTechDynamoHatches.size(); - } - }, - TTEnergy(GregtechMeta_MultiBlockBase::addMultiAmpEnergyToMachineList, - "com.github.technus.tectech.thing.metaTileEntity.hatch.GT_MetaTileEntity_Hatch_EnergyMulti") { - - @Override - public long count(GregtechMeta_MultiBlockBase<?> t) { - return t.mTecTechEnergyHatches.size(); - } - },; - - @SuppressWarnings("unchecked") - private static <T> Class<T> retype(Class<?> clazz) { - return (Class<T>) clazz; - } - - private final List<? extends Class<? extends IMetaTileEntity>> mMteClasses; - private final IGT_HatchAdder<? super GregtechMeta_MultiBlockBase<?>> mAdder; - - @SafeVarargs - GTPPHatchElement(IGT_HatchAdder<? super GregtechMeta_MultiBlockBase<?>> aAdder, - Class<? extends IMetaTileEntity>... aMteClasses) { - this.mMteClasses = Arrays.asList(aMteClasses); - this.mAdder = aAdder; - } - - GTPPHatchElement(IGT_HatchAdder<? super GregtechMeta_MultiBlockBase<?>> aAdder, String... aClassNames) { - this.mMteClasses = Arrays.stream(aClassNames) - .map(ReflectionUtils::getClass) - .filter(Objects::nonNull) - .<Class<? extends IMetaTileEntity>>map(GTPPHatchElement::retype) - .collect(Collectors.toList()); - this.mAdder = aAdder; - } - - @Override - public List<? extends Class<? extends IMetaTileEntity>> mteClasses() { - return mMteClasses; - } - - @Override - public IGT_HatchAdder<? super GregtechMeta_MultiBlockBase<?>> adder() { - return mAdder; - } - } -} diff --git a/gtpp/src/main/java/gtPlusPlus/xmod/gregtech/api/metatileentity/implementations/base/GregtechMeta_SteamMultiBase.java b/gtpp/src/main/java/gtPlusPlus/xmod/gregtech/api/metatileentity/implementations/base/GregtechMeta_SteamMultiBase.java deleted file mode 100644 index 6e501815f0..0000000000 --- a/gtpp/src/main/java/gtPlusPlus/xmod/gregtech/api/metatileentity/implementations/base/GregtechMeta_SteamMultiBase.java +++ /dev/null @@ -1,428 +0,0 @@ -package gtPlusPlus.xmod.gregtech.api.metatileentity.implementations.base; - -import static gregtech.api.enums.GT_Values.V; -import static gregtech.api.util.GT_StructureUtility.buildHatchAdder; -import static gregtech.api.util.GT_Utility.filterValidMTEs; -import static gregtech.api.util.GT_Utility.formatNumbers; -import static mcp.mobius.waila.api.SpecialChars.GREEN; -import static mcp.mobius.waila.api.SpecialChars.RED; -import static mcp.mobius.waila.api.SpecialChars.RESET; - -import java.util.ArrayList; -import java.util.Collections; -import java.util.List; - -import net.minecraft.inventory.IInventory; -import net.minecraft.item.ItemStack; -import net.minecraft.nbt.NBTTagCompound; -import net.minecraft.util.StatCollector; -import net.minecraftforge.common.util.ForgeDirection; -import net.minecraftforge.fluids.FluidStack; - -import gregtech.GT_Mod; -import gregtech.api.enums.Textures; -import gregtech.api.interfaces.IHatchElement; -import gregtech.api.interfaces.ITexture; -import gregtech.api.interfaces.metatileentity.IMetaTileEntity; -import gregtech.api.interfaces.tileentity.IGregTechTileEntity; -import gregtech.api.logic.ProcessingLogic; -import gregtech.api.metatileentity.implementations.GT_MetaTileEntity_Hatch; -import gregtech.api.metatileentity.implementations.GT_MetaTileEntity_Hatch_Output; -import gregtech.api.objects.GT_RenderedTexture; -import gregtech.api.recipe.RecipeMap; -import gregtech.api.util.GT_HatchElementBuilder; -import gregtech.api.util.GT_Utility; -import gregtech.api.util.GT_Waila; -import gregtech.api.util.IGT_HatchAdder; -import gregtech.api.util.shutdown.ShutDownReasonRegistry; -import gtPlusPlus.core.util.minecraft.FluidUtils; -import gtPlusPlus.xmod.gregtech.api.metatileentity.implementations.GT_MetaTileEntity_Hatch_Steam_BusInput; -import gtPlusPlus.xmod.gregtech.api.metatileentity.implementations.GT_MetaTileEntity_Hatch_Steam_BusOutput; -import mcp.mobius.waila.api.IWailaConfigHandler; -import mcp.mobius.waila.api.IWailaDataAccessor; - -public abstract class GregtechMeta_SteamMultiBase<T extends GregtechMeta_SteamMultiBase<T>> - extends GregtechMeta_MultiBlockBase<T> { - - public ArrayList<GT_MetaTileEntity_Hatch_Steam_BusInput> mSteamInputs = new ArrayList<>(); - public ArrayList<GT_MetaTileEntity_Hatch_Steam_BusOutput> mSteamOutputs = new ArrayList<>(); - public ArrayList<GT_MetaTileEntity_Hatch_CustomFluidBase> mSteamInputFluids = new ArrayList<>(); - - protected static final String TT_steaminputbus = StatCollector.translateToLocal("GTPP.MBTT.SteamInputBus"); - protected static final String TT_steamoutputbus = StatCollector.translateToLocal("GTPP.MBTT.SteamOutputBus"); - protected static final String TT_steamhatch = StatCollector.translateToLocal("GTPP.MBTT.SteamHatch"); - - public GregtechMeta_SteamMultiBase(String aName) { - super(aName); - } - - public GregtechMeta_SteamMultiBase(int aID, String aName, String aNameRegional) { - super(aID, aName, aNameRegional); - } - - @Override - public ITexture[] getTexture(final IGregTechTileEntity aBaseMetaTileEntity, final ForgeDirection side, - final ForgeDirection facing, final int aColorIndex, final boolean aActive, final boolean aRedstone) { - if (side == facing) { - return new ITexture[] { Textures.BlockIcons.getCasingTextureForId(getCasingTextureIndex()), - aActive ? getFrontOverlayActive() : getFrontOverlay() }; - } - return new ITexture[] { Textures.BlockIcons.getCasingTextureForId(getCasingTextureIndex()) }; - } - - protected abstract GT_RenderedTexture getFrontOverlay(); - - protected abstract GT_RenderedTexture getFrontOverlayActive(); - - private int getCasingTextureIndex() { - return 10; - } - - @Override - protected ProcessingLogic createProcessingLogic() { - return new ProcessingLogic().setMaxParallelSupplier(this::getMaxParallelRecipes); - } - - @Override - protected void setProcessingLogicPower(ProcessingLogic logic) { - logic.setAvailableVoltage(V[1]); - // We need to trick the GT_ParallelHelper we have enough amps for all recipe parallels. - logic.setAvailableAmperage(getMaxParallelRecipes()); - logic.setAmperageOC(false); - } - - public ArrayList<FluidStack> getAllSteamStacks() { - ArrayList<FluidStack> aFluids = new ArrayList<>(); - FluidStack aSteam = FluidUtils.getSteam(1); - for (FluidStack aFluid : this.getStoredFluids()) { - if (aFluid.isFluidEqual(aSteam)) { - aFluids.add(aFluid); - } - } - return aFluids; - } - - public int getTotalSteamStored() { - int aSteam = 0; - for (FluidStack aFluid : getAllSteamStacks()) { - aSteam += aFluid.amount; - } - return aSteam; - } - - public boolean tryConsumeSteam(int aAmount) { - if (getTotalSteamStored() <= 0) { - return false; - } else { - return this.depleteInput(FluidUtils.getSteam(aAmount)); - } - } - - @Override - public int getMaxEfficiency(ItemStack arg0) { - return 0; - } - - @Override - public void onPostTick(final IGregTechTileEntity aBaseMetaTileEntity, final long aTick) { - if (aBaseMetaTileEntity.isServerSide()) { - if (this.mUpdate == 1 || this.mStartUpCheck == 1) { - this.mSteamInputs.clear(); - this.mSteamOutputs.clear(); - this.mSteamInputFluids.clear(); - } - } - super.onPostTick(aBaseMetaTileEntity, aTick); - } - - /** - * Called every tick the Machine runs - */ - @Override - public boolean onRunningTick(ItemStack aStack) { - fixAllMaintenanceIssue(); - if (lEUt < 0) { - long aSteamVal = ((-lEUt * 10000) / Math.max(1000, mEfficiency)); - // Logger.INFO("Trying to drain "+aSteamVal+" steam per tick."); - if (!tryConsumeSteam((int) aSteamVal)) { - stopMachine(ShutDownReasonRegistry.POWER_LOSS); - return false; - } - } - return true; - } - - @Override - public boolean addToMachineList(final IGregTechTileEntity aTileEntity, final int aBaseCasingIndex) { - if (aTileEntity == null) { - log("Invalid IGregTechTileEntity"); - return false; - } - final IMetaTileEntity aMetaTileEntity = aTileEntity.getMetaTileEntity(); - if (aMetaTileEntity == null) { - log("Invalid IMetaTileEntity"); - return false; - } - - // Use this to determine the correct value, then update the hatch texture after. - boolean aDidAdd = false; - - if (aMetaTileEntity instanceof GT_MetaTileEntity_Hatch_CustomFluidBase) { - log("Adding Steam Input Hatch"); - aDidAdd = addToMachineListInternal(mSteamInputFluids, aMetaTileEntity, aBaseCasingIndex); - } else if (aMetaTileEntity instanceof GT_MetaTileEntity_Hatch_Steam_BusInput) { - log( - "Trying to set recipe map. Type: " - + (getRecipeMap() != null ? getRecipeMap().unlocalizedName : "Null")); - this.resetRecipeMapForHatch(aTileEntity, getRecipeMap()); - log("Adding Steam Input Bus"); - aDidAdd = addToMachineListInternal(mSteamInputs, aMetaTileEntity, aBaseCasingIndex); - } else if (aMetaTileEntity instanceof GT_MetaTileEntity_Hatch_Steam_BusOutput) { - log("Adding Steam Output Bus"); - aDidAdd = addToMachineListInternal(mSteamOutputs, aMetaTileEntity, aBaseCasingIndex); - } - - return aDidAdd; - } - - /* - * Handle I/O with custom hatches - */ - - @Override - public boolean depleteInput(FluidStack aLiquid) { - if (aLiquid == null) return false; - for (GT_MetaTileEntity_Hatch_CustomFluidBase tHatch : filterValidMTEs(mSteamInputFluids)) { - FluidStack tLiquid = tHatch.getFluid(); - if (tLiquid != null && tLiquid.isFluidEqual(aLiquid)) { - tLiquid = tHatch.drain(aLiquid.amount, false); - if (tLiquid != null && tLiquid.amount >= aLiquid.amount) { - tLiquid = tHatch.drain(aLiquid.amount, true); - return tLiquid != null && tLiquid.amount >= aLiquid.amount; - } - } - } - return false; - } - - @Override - public boolean depleteInput(ItemStack aStack) { - if (GT_Utility.isStackInvalid(aStack)) return false; - FluidStack aLiquid = GT_Utility.getFluidForFilledItem(aStack, true); - if (aLiquid != null) return depleteInput(aLiquid); - for (GT_MetaTileEntity_Hatch_CustomFluidBase tHatch : filterValidMTEs(mSteamInputFluids)) { - if (GT_Utility.areStacksEqual( - aStack, - tHatch.getBaseMetaTileEntity() - .getStackInSlot(0))) { - if (tHatch.getBaseMetaTileEntity() - .getStackInSlot(0).stackSize >= aStack.stackSize) { - tHatch.getBaseMetaTileEntity() - .decrStackSize(0, aStack.stackSize); - return true; - } - } - } - for (GT_MetaTileEntity_Hatch_Steam_BusInput tHatch : filterValidMTEs(mSteamInputs)) { - tHatch.mRecipeMap = getRecipeMap(); - for (int i = tHatch.getBaseMetaTileEntity() - .getSizeInventory() - 1; i >= 0; i--) { - if (GT_Utility.areStacksEqual( - aStack, - tHatch.getBaseMetaTileEntity() - .getStackInSlot(i))) { - if (tHatch.getBaseMetaTileEntity() - .getStackInSlot(0).stackSize >= aStack.stackSize) { - tHatch.getBaseMetaTileEntity() - .decrStackSize(0, aStack.stackSize); - return true; - } - } - } - } - return false; - } - - @Override - public ArrayList<FluidStack> getStoredFluids() { - ArrayList<FluidStack> rList = new ArrayList<>(); - for (GT_MetaTileEntity_Hatch_CustomFluidBase tHatch : filterValidMTEs(mSteamInputFluids)) { - if (tHatch.getFillableStack() != null) { - rList.add(tHatch.getFillableStack()); - } - } - return rList; - } - - @Override - public ArrayList<ItemStack> getStoredInputs() { - ArrayList<ItemStack> rList = new ArrayList<>(); - for (GT_MetaTileEntity_Hatch_Steam_BusInput tHatch : filterValidMTEs(mSteamInputs)) { - tHatch.mRecipeMap = getRecipeMap(); - for (int i = tHatch.getBaseMetaTileEntity() - .getSizeInventory() - 1; i >= 0; i--) { - if (tHatch.getBaseMetaTileEntity() - .getStackInSlot(i) != null) { - rList.add( - tHatch.getBaseMetaTileEntity() - .getStackInSlot(i)); - } - } - } - return rList; - } - - @Override - public boolean addOutput(ItemStack aStack) { - if (GT_Utility.isStackInvalid(aStack)) return false; - aStack = GT_Utility.copy(aStack); - boolean outputSuccess = true; - while (outputSuccess && aStack.stackSize > 0) { - outputSuccess = false; - ItemStack single = aStack.splitStack(1); - for (GT_MetaTileEntity_Hatch_Steam_BusOutput tHatch : filterValidMTEs(mSteamOutputs)) { - if (!outputSuccess) { - for (int i = tHatch.getSizeInventory() - 1; i >= 0 && !outputSuccess; i--) { - if (tHatch.getBaseMetaTileEntity() - .addStackToSlot(i, single)) outputSuccess = true; - } - } - } - for (GT_MetaTileEntity_Hatch_Output tHatch : filterValidMTEs(mOutputHatches)) { - if (!outputSuccess && tHatch.outputsItems()) { - if (tHatch.getBaseMetaTileEntity() - .addStackToSlot(1, single)) outputSuccess = true; - } - } - } - return outputSuccess; - } - - @Override - public ArrayList<ItemStack> getStoredOutputs() { - ArrayList<ItemStack> rList = new ArrayList<>(); - for (GT_MetaTileEntity_Hatch_Steam_BusOutput tHatch : filterValidMTEs(mSteamOutputs)) { - for (int i = tHatch.getBaseMetaTileEntity() - .getSizeInventory() - 1; i >= 0; i--) { - rList.add( - tHatch.getBaseMetaTileEntity() - .getStackInSlot(i)); - } - } - return rList; - } - - @Override - public List<ItemStack> getItemOutputSlots(ItemStack[] toOutput) { - List<ItemStack> ret = new ArrayList<>(); - for (final GT_MetaTileEntity_Hatch tBus : filterValidMTEs(mSteamOutputs)) { - final IInventory tBusInv = tBus.getBaseMetaTileEntity(); - for (int i = 0; i < tBusInv.getSizeInventory(); i++) { - ret.add(tBus.getStackInSlot(i)); - } - } - return ret; - } - - @Override - public void updateSlots() { - for (GT_MetaTileEntity_Hatch_CustomFluidBase tHatch : filterValidMTEs(mSteamInputFluids)) tHatch.updateSlots(); - for (GT_MetaTileEntity_Hatch_Steam_BusInput tHatch : filterValidMTEs(mSteamInputs)) tHatch.updateSlots(); - } - - @Override - public boolean supportsBatchMode() { - return false; - } - - @Override - public void clearHatches() { - super.clearHatches(); - mSteamInputFluids.clear(); - mSteamInputs.clear(); - mSteamOutputs.clear(); - } - - @Override - public boolean resetRecipeMapForAllInputHatches(RecipeMap<?> aMap) { - boolean ret = super.resetRecipeMapForAllInputHatches(aMap); - for (GT_MetaTileEntity_Hatch_Steam_BusInput hatch : mSteamInputs) { - if (resetRecipeMapForHatch(hatch, aMap)) { - ret = true; - } - } - return ret; - } - - @Override - public void getWailaBody(ItemStack itemStack, List<String> currentTip, IWailaDataAccessor accessor, - IWailaConfigHandler config) { - final NBTTagCompound tag = accessor.getNBTData(); - - if (tag.getBoolean("incompleteStructure")) { - currentTip.add(RED + "** INCOMPLETE STRUCTURE **" + RESET); - } - currentTip.add( - (tag.getBoolean("hasProblems") ? (RED + "** HAS PROBLEMS **") : GREEN + "Running Fine") + RESET - + " Efficiency: " - + tag.getFloat("efficiency") - + "%"); - - boolean isActive = tag.getBoolean("isActive"); - if (isActive) { - long actualEnergyUsage = tag.getLong("energyUsage"); - if (actualEnergyUsage > 0) { - currentTip.add( - StatCollector.translateToLocalFormatted("GTPP.waila.steam.use", formatNumbers(actualEnergyUsage))); - } - } - currentTip.add( - GT_Waila.getMachineProgressString(isActive, tag.getInteger("maxProgress"), tag.getInteger("progress"))); - // Show ns on the tooltip - if (GT_Mod.gregtechproxy.wailaAverageNS && tag.hasKey("averageNS")) { - int tAverageTime = tag.getInteger("averageNS"); - currentTip.add("Average CPU load of ~" + formatNumbers(tAverageTime) + " ns"); - } - super.getMTEWailaBody(itemStack, currentTip, accessor, config); - } - - protected static <T extends GregtechMeta_SteamMultiBase<T>> GT_HatchElementBuilder<T> buildSteamInput( - Class<T> typeToken) { - return buildHatchAdder(typeToken).adder(GregtechMeta_SteamMultiBase::addToMachineList) - .hatchIds(31040) - .shouldReject(t -> !t.mSteamInputFluids.isEmpty()); - } - - protected enum SteamHatchElement implements IHatchElement<GregtechMeta_SteamMultiBase<?>> { - - InputBus_Steam { - - @Override - public List<? extends Class<? extends IMetaTileEntity>> mteClasses() { - return Collections.singletonList(GT_MetaTileEntity_Hatch_Steam_BusInput.class); - } - - @Override - public long count(GregtechMeta_SteamMultiBase<?> t) { - return t.mSteamInputs.size(); - } - }, - OutputBus_Steam { - - @Override - public List<? extends Class<? extends IMetaTileEntity>> mteClasses() { - return Collections.singletonList(GT_MetaTileEntity_Hatch_Steam_BusOutput.class); - } - - @Override - public long count(GregtechMeta_SteamMultiBase<?> t) { - return t.mSteamOutputs.size(); - } - },; - - @Override - public IGT_HatchAdder<? super GregtechMeta_SteamMultiBase<?>> adder() { - return GregtechMeta_SteamMultiBase::addToMachineList; - } - } -} diff --git a/gtpp/src/main/java/gtPlusPlus/xmod/gregtech/api/metatileentity/implementations/base/generators/GregtechMetaBoilerBase.java b/gtpp/src/main/java/gtPlusPlus/xmod/gregtech/api/metatileentity/implementations/base/generators/GregtechMetaBoilerBase.java deleted file mode 100644 index 3f0d8d1ec1..0000000000 --- a/gtpp/src/main/java/gtPlusPlus/xmod/gregtech/api/metatileentity/implementations/base/generators/GregtechMetaBoilerBase.java +++ /dev/null @@ -1,361 +0,0 @@ -package gtPlusPlus.xmod.gregtech.api.metatileentity.implementations.base.generators; - -import net.minecraft.entity.player.EntityPlayer; -import net.minecraft.init.Items; -import net.minecraft.item.ItemStack; -import net.minecraft.nbt.NBTTagCompound; -import net.minecraftforge.common.util.ForgeDirection; -import net.minecraftforge.fluids.FluidStack; -import net.minecraftforge.fluids.FluidTankInfo; -import net.minecraftforge.fluids.IFluidHandler; - -import gregtech.api.GregTech_API; -import gregtech.api.enums.Materials; -import gregtech.api.enums.OrePrefixes; -import gregtech.api.enums.SoundResource; -import gregtech.api.gui.modularui.GT_UIInfos; -import gregtech.api.interfaces.ITexture; -import gregtech.api.interfaces.tileentity.IGregTechTileEntity; -import gregtech.api.metatileentity.implementations.GT_MetaTileEntity_BasicTank; -import gregtech.api.objects.GT_ItemStack; -import gregtech.api.util.GT_ModHandler; -import gregtech.api.util.GT_OreDictUnificator; -import gregtech.api.util.GT_Utility; -import gtPlusPlus.core.util.math.MathUtils; - -public abstract class GregtechMetaBoilerBase extends GT_MetaTileEntity_BasicTank { - - public int mTemperature = 20; - public int mProcessingEnergy = 0; - public int mLossTimer = 0; - public FluidStack mSteam = null; - public boolean mHadNoWater = false; - public long RI = MathUtils.randLong(5L, 30L); - - public GregtechMetaBoilerBase(final int aID, final String aName, final String aNameRegional, - final String aDescription, final ITexture... aTextures) { - super(aID, aName, aNameRegional, 0, 4, aDescription, aTextures); - } - - public GregtechMetaBoilerBase(final String aName, final int aTier, final String[] aDescription, - final ITexture[][][] aTextures) { - super(aName, aTier, 4, aDescription, aTextures); - } - - @Override - public ITexture[] getTexture(final IGregTechTileEntity aBaseMetaTileEntity, final ForgeDirection side, - final ForgeDirection facing, final int aColorIndex, final boolean aActive, final boolean aRedstone) { - ITexture[] tmp = this.mTextures[side.offsetY == 0 ? side != facing ? 2 : ((byte) (aActive ? 4 : 3)) - : side.ordinal()][aColorIndex + 1]; - if ((side != facing) && (tmp.length == 2)) { - tmp = new ITexture[] { tmp[0] }; - } - return tmp; - } - - @Override - public boolean isElectric() { - return false; - } - - @Override - public boolean isPneumatic() { - return false; - } - - @Override - public boolean isSteampowered() { - return false; - } - - @Override - public boolean isSimpleMachine() { - return false; - } - - @Override - public boolean isFacingValid(final ForgeDirection facing) { - return facing.offsetY == 0; - } - - @Override - public boolean isAccessAllowed(final EntityPlayer aPlayer) { - return true; - } - - @Override - public boolean isValidSlot(final int aIndex) { - return true; - } - - @Override - public int getProgresstime() { - return this.mTemperature; - } - - @Override - public int maxProgresstime() { - return 500; - } - - @Override - public boolean onRightclick(final IGregTechTileEntity aBaseMetaTileEntity, final EntityPlayer aPlayer) { - if (aBaseMetaTileEntity.isClientSide()) { - return true; - } - if (aPlayer != null) { - if (GT_Utility.areStacksEqual(aPlayer.getCurrentEquippedItem(), new ItemStack(Items.water_bucket, 1))) { - this.fill(Materials.Water.getFluid(1000 * aPlayer.getCurrentEquippedItem().stackSize), true); - aPlayer.getCurrentEquippedItem() - .func_150996_a(Items.bucket); - } else { - GT_UIInfos.openGTTileEntityUI(aBaseMetaTileEntity, aPlayer); - } - } - return true; - } - - @Override - public boolean doesFillContainers() { - return true; - } - - @Override - public boolean doesEmptyContainers() { - return true; - } - - @Override - public boolean canTankBeFilled() { - return true; - } - - @Override - public boolean canTankBeEmptied() { - return true; - } - - @Override - public boolean displaysItemStack() { - return false; - } - - @Override - public boolean displaysStackSize() { - return false; - } - - @Override - public boolean isFluidInputAllowed(final FluidStack aFluid) { - return GT_ModHandler.isWater(aFluid); - } - - @Override - public FluidStack getDrainableStack() { - return this.mSteam; - } - - @Override - public FluidStack setDrainableStack(final FluidStack aFluid) { - this.mSteam = aFluid; - return this.mSteam; - } - - @Override - public boolean isDrainableStackSeparate() { - return true; - } - - @Override - public boolean allowCoverOnSide(final ForgeDirection side, final GT_ItemStack aCover) { - return GregTech_API.getCoverBehaviorNew(aCover.toStack()) - .isSimpleCover(); - } - - @Override - public void saveNBTData(final NBTTagCompound aNBT) { - super.saveNBTData(aNBT); - aNBT.setInteger("mLossTimer", this.mLossTimer); - aNBT.setInteger("mTemperature", this.mTemperature); - aNBT.setInteger("mProcessingEnergy", this.mProcessingEnergy); - if (this.mSteam != null) { - try { - aNBT.setTag("mSteam", this.mSteam.writeToNBT(new NBTTagCompound())); - } catch (final Throwable e) {} - } - } - - @Override - public void loadNBTData(final NBTTagCompound aNBT) { - super.loadNBTData(aNBT); - this.mLossTimer = aNBT.getInteger("mLossTimer"); - this.mTemperature = aNBT.getInteger("mTemperature"); - this.mProcessingEnergy = aNBT.getInteger("mProcessingEnergy"); - this.mSteam = FluidStack.loadFluidStackFromNBT(aNBT.getCompoundTag("mSteam")); - } - - @Override - public void onPostTick(final IGregTechTileEntity aBaseMetaTileEntity, final long aTick) { - if ((aBaseMetaTileEntity.isServerSide()) && (aTick > 20L)) { - if (this.mTemperature <= 20) { - this.mTemperature = 20; - this.mLossTimer = 0; - } - if (++this.mLossTimer > 40) { - this.mTemperature -= 1; - this.mLossTimer = 0; - } - for (final ForgeDirection side : ForgeDirection.VALID_DIRECTIONS) { - if (side != aBaseMetaTileEntity.getFrontFacing()) { - final IFluidHandler tTileEntity = aBaseMetaTileEntity.getITankContainerAtSide(side); - if (tTileEntity != null) { - final FluidStack tDrained = aBaseMetaTileEntity - .drain(side, Math.max(1, this.mSteam.amount / 2), false); - if (tDrained != null) { - final int tFilledAmount = tTileEntity.fill(side.getOpposite(), tDrained, false); - if (tFilledAmount > 0) { - tTileEntity.fill( - side.getOpposite(), - aBaseMetaTileEntity.drain(side, tFilledAmount, true), - true); - } - } - } - } - } - if ((aTick % 10L) == 0L) { - if (this.mTemperature > 100) { - if ((this.mFluid == null) || (!GT_ModHandler.isWater(this.mFluid)) || (this.mFluid.amount <= 0)) { - this.mHadNoWater = true; - } else { - if (this.mHadNoWater) { - aBaseMetaTileEntity.doExplosion(2048L); - return; - } - this.mFluid.amount -= 1; - if (this.mSteam == null) { - this.mSteam = GT_ModHandler.getSteam(150L); - } else if (GT_ModHandler.isSteam(this.mSteam)) { - this.mSteam.amount += 150; - } else { - this.mSteam = GT_ModHandler.getSteam(150L); - } - } - } else { - this.mHadNoWater = false; - } - } - if ((this.mSteam != null) && (this.mSteam.amount > getSteamCapacity())) { - this.sendSound((byte) 1); - this.mSteam.amount = getSteamCapacity() * 3 / 4; - } - if ((this.mProcessingEnergy <= 0) && (aBaseMetaTileEntity.isAllowedToWork()) - && (this.mInventory[2] != null)) { - if ((GT_OreDictUnificator - .isItemStackInstanceOf(this.mInventory[2], OrePrefixes.gem.get(Materials.Coal))) - || (GT_OreDictUnificator - .isItemStackInstanceOf(this.mInventory[2], OrePrefixes.dust.get(Materials.Coal))) - || (GT_OreDictUnificator - .isItemStackInstanceOf(this.mInventory[2], OrePrefixes.dustImpure.get(Materials.Coal))) - || (GT_OreDictUnificator - .isItemStackInstanceOf(this.mInventory[2], OrePrefixes.crushed.get(Materials.Coal)))) { - this.mProcessingEnergy += 160; - aBaseMetaTileEntity.decrStackSize(2, 1); - if (aBaseMetaTileEntity.getRandomNumber(3) == 0) { - aBaseMetaTileEntity - .addStackToSlot(3, GT_OreDictUnificator.get(OrePrefixes.dustTiny, Materials.DarkAsh, 1L)); - } - } else if (GT_OreDictUnificator - .isItemStackInstanceOf(this.mInventory[2], OrePrefixes.gem.get(Materials.Charcoal))) { - this.mProcessingEnergy += 160; - aBaseMetaTileEntity.decrStackSize(2, 1); - if (aBaseMetaTileEntity.getRandomNumber(3) == 0) { - aBaseMetaTileEntity - .addStackToSlot(3, GT_OreDictUnificator.get(OrePrefixes.dustTiny, Materials.Ash, 1L)); - } - } else if (GT_OreDictUnificator.isItemStackInstanceOf(this.mInventory[2], "fuelCoke")) { - this.mProcessingEnergy += 640; - aBaseMetaTileEntity.decrStackSize(2, 1); - if (aBaseMetaTileEntity.getRandomNumber(2) == 0) { - aBaseMetaTileEntity - .addStackToSlot(3, GT_OreDictUnificator.get(OrePrefixes.dustTiny, Materials.Ash, 1L)); - } - } else if ((GT_OreDictUnificator - .isItemStackInstanceOf(this.mInventory[2], OrePrefixes.gem.get(Materials.Lignite))) - || (GT_OreDictUnificator - .isItemStackInstanceOf(this.mInventory[2], OrePrefixes.dust.get(Materials.Lignite))) - || (GT_OreDictUnificator - .isItemStackInstanceOf(this.mInventory[2], OrePrefixes.dustImpure.get(Materials.Lignite))) - || (GT_OreDictUnificator - .isItemStackInstanceOf(this.mInventory[2], OrePrefixes.crushed.get(Materials.Lignite)))) { - this.mProcessingEnergy += 40; - aBaseMetaTileEntity.decrStackSize(2, 1); - if (aBaseMetaTileEntity.getRandomNumber(8) == 0) { - aBaseMetaTileEntity.addStackToSlot( - 3, - GT_OreDictUnificator.get(OrePrefixes.dustTiny, Materials.DarkAsh, 1L)); - } - } - } - if ((this.mTemperature < 1000) && (this.mProcessingEnergy > 0) && ((aTick % 12L) == 0L)) { - this.mProcessingEnergy -= 2; - this.mTemperature += 1; - } - aBaseMetaTileEntity.setActive(this.mProcessingEnergy > 0); - } - } - - @Override - // Since this type of machine can have different water and steam capacities, we need to override getTankInfo() to - // support returning those different capacities. - public FluidTankInfo[] getTankInfo(ForgeDirection aSide) { - return new FluidTankInfo[] { new FluidTankInfo(this.mFluid, getCapacity()), - new FluidTankInfo(this.mSteam, getSteamCapacity()) }; - } - - @Override - public boolean allowPullStack(final IGregTechTileEntity aBaseMetaTileEntity, final int aIndex, - final ForgeDirection side, final ItemStack aStack) { - return (aIndex == 1) || (aIndex == 3); - } - - @Override - public boolean allowPutStack(final IGregTechTileEntity aBaseMetaTileEntity, final int aIndex, - final ForgeDirection side, final ItemStack aStack) { - return aIndex == 2; - } - - @Override - public void doSound(final byte aIndex, final double aX, final double aY, final double aZ) { - if (aIndex == 1) { - GT_Utility.doSoundAtClient(SoundResource.RANDOM_FIZZ, 2, 1.0F, aX, aY, aZ); - for (int l = 0; l < 8; l++) { - this.getBaseMetaTileEntity() - .getWorld() - .spawnParticle( - "largesmoke", - (aX - 0.5D) + Math.random(), - aY, - (aZ - 0.5D) + Math.random(), - 0.0D, - 0.0D, - 0.0D); - } - } - } - - @Override - public int getCapacity() { - return 16000; - } - - // This type of machine can have different water and steam capacities. - public int getSteamCapacity() { - return 32000; - } - - @Override - public int getTankPressure() { - return 100; - } -} diff --git a/gtpp/src/main/java/gtPlusPlus/xmod/gregtech/api/metatileentity/implementations/base/generators/GregtechMetaSolarGenerator.java b/gtpp/src/main/java/gtPlusPlus/xmod/gregtech/api/metatileentity/implementations/base/generators/GregtechMetaSolarGenerator.java deleted file mode 100644 index 5e0588acfd..0000000000 --- a/gtpp/src/main/java/gtPlusPlus/xmod/gregtech/api/metatileentity/implementations/base/generators/GregtechMetaSolarGenerator.java +++ /dev/null @@ -1,241 +0,0 @@ -package gtPlusPlus.xmod.gregtech.api.metatileentity.implementations.base.generators; - -import static gregtech.api.enums.GT_Values.V; - -import net.minecraft.entity.player.EntityPlayer; -import net.minecraftforge.common.util.ForgeDirection; - -import org.apache.commons.lang3.ArrayUtils; - -import gregtech.api.enums.Textures; -import gregtech.api.gui.modularui.GT_UIInfos; -import gregtech.api.interfaces.ITexture; -import gregtech.api.interfaces.tileentity.IGregTechTileEntity; -import gregtech.api.metatileentity.implementations.GT_MetaTileEntity_BasicTank; - -public abstract class GregtechMetaSolarGenerator extends GT_MetaTileEntity_BasicTank { - - public int mEfficiency; - public int mProcessingEnergy = 0; - public int mSolarCharge = 20; - public int mLossTimer = 0; - public static int sEnergyPerTick = 16; - - public GregtechMetaSolarGenerator(final int aID, final String aName, final String aNameRegional, final int aTier, - final String aDescription, final ITexture... aTextures) { - super(aID, aName, aNameRegional, aTier, 3, aDescription, aTextures); - } - - public GregtechMetaSolarGenerator(final String aName, final int aTier, final String[] aDescription, - final ITexture[][][] aTextures) { - super(aName, aTier, 3, aDescription, aTextures); - } - - @Override - public ITexture[][][] getTextureSet(final ITexture[] aTextures) { - final ITexture[][][] rTextures = new ITexture[10][17][]; - for (byte i = -1; i < 16; i++) { - rTextures[0][i + 1] = this.getFront(i); - rTextures[1][i + 1] = this.getBack(i); - rTextures[2][i + 1] = this.getBottom(i); - rTextures[3][i + 1] = this.getTop(i); - rTextures[4][i + 1] = this.getSides(i); - rTextures[5][i + 1] = this.getFrontActive(i); - rTextures[6][i + 1] = this.getBackActive(i); - rTextures[7][i + 1] = this.getBottomActive(i); - rTextures[8][i + 1] = this.getTopActive(i); - rTextures[9][i + 1] = this.getSidesActive(i); - } - return rTextures; - } - - @Override - public ITexture[] getTexture(final IGregTechTileEntity aBaseMetaTileEntity, final ForgeDirection side, - final ForgeDirection facing, final int aColorIndex, final boolean aActive, final boolean aRedstone) { - return this.mTextures[(aActive ? 5 : 0) + (side == facing ? 0 - : side == facing.getOpposite() ? 1 - : side == ForgeDirection.DOWN ? 2 : side == ForgeDirection.UP ? 3 : 4)][aColorIndex + 1]; - } - - @Override - public String[] getDescription() { - return ArrayUtils.add(this.mDescriptionArray, "Efficiency: " + this.getEfficiency() + "%"); - } - - @Override - public boolean onRightclick(final IGregTechTileEntity aBaseMetaTileEntity, final EntityPlayer aPlayer) { - if (aBaseMetaTileEntity.isClientSide()) { - return true; - } - GT_UIInfos.openGTTileEntityUI(aBaseMetaTileEntity, aPlayer); - return true; - } - - public ITexture[] getFront(final byte aColor) { - return new ITexture[] { Textures.BlockIcons.MACHINE_CASINGS[this.mTier][aColor + 1] }; - } - - public ITexture[] getBack(final byte aColor) { - return new ITexture[] { Textures.BlockIcons.MACHINE_CASINGS[this.mTier][aColor + 1] }; - } - - public ITexture[] getBottom(final byte aColor) { - return new ITexture[] { Textures.BlockIcons.MACHINE_CASINGS[this.mTier][aColor + 1] }; - } - - public ITexture[] getTop(final byte aColor) { - return new ITexture[] { Textures.BlockIcons.MACHINE_CASINGS[this.mTier][aColor + 1] }; - } - - public ITexture[] getSides(final byte aColor) { - return new ITexture[] { Textures.BlockIcons.MACHINE_CASINGS[this.mTier][aColor + 1] }; - } - - public ITexture[] getFrontActive(final byte aColor) { - return this.getFront(aColor); - } - - public ITexture[] getBackActive(final byte aColor) { - return this.getBack(aColor); - } - - public ITexture[] getBottomActive(final byte aColor) { - return this.getBottom(aColor); - } - - public ITexture[] getTopActive(final byte aColor) { - return this.getTop(aColor); - } - - public ITexture[] getSidesActive(final byte aColor) { - return this.getSides(aColor); - } - - @Override - public boolean isFacingValid(final ForgeDirection side) { - return side.offsetY == 0; - } - - @Override - public boolean isSimpleMachine() { - return false; - } - - @Override - public boolean isValidSlot(final int aIndex) { - return aIndex < 2; - } - - @Override - public boolean isEnetOutput() { - return true; - } - - @Override - public boolean isOutputFacing(final ForgeDirection side) { - return true; - } - - @Override - public boolean isAccessAllowed(final EntityPlayer aPlayer) { - return true; - } - - @Override - public long maxEUOutput() { - return this.getBaseMetaTileEntity() - .isAllowedToWork() ? V[this.mTier] : 0; - } - - @Override - public long maxEUStore() { - return Math.max(this.getEUVar(), (V[this.mTier] * 40) + this.getMinimumStoredEU()); - } - - @Override - public void onPostTick(final IGregTechTileEntity aBaseMetaTileEntity, final long aTick) { - if (aBaseMetaTileEntity.isServerSide() && aBaseMetaTileEntity.isAllowedToWork() - && (aTick > 20L) - && (aBaseMetaTileEntity.getUniversalEnergyStored() - < (this.maxEUOutput() + aBaseMetaTileEntity.getEUCapacity()))) { - - if (this.mSolarCharge <= 20) { - this.mSolarCharge = 20; - this.mLossTimer = 0; - } - if (++this.mLossTimer > 45) { - this.mSolarCharge -= 1; - this.mLossTimer = 0; - } - - if ((aTick % 25L) == 0L) { - if (this.mSolarCharge > 100) { - if ((this.mProcessingEnergy > 0) && (aBaseMetaTileEntity.isAllowedToWork()) - && ((aTick % 256L) == 0L) - && (!aBaseMetaTileEntity.getWorld() - .isThundering() - && (aBaseMetaTileEntity.getUniversalEnergyStored() - < ((this.maxEUOutput() * 20) + this.getMinimumStoredEU())))) { - this.getBaseMetaTileEntity() - .increaseStoredEnergyUnits((sEnergyPerTick * this.getEfficiency()) / 10, false); - } - } - } - - if ((this.mSolarCharge < 500) && (this.mProcessingEnergy > 0) && ((aTick % 12L) == 0L)) { - this.mProcessingEnergy -= 1; - this.mSolarCharge += 1; - } - - if ((this.mProcessingEnergy <= 0) && (aBaseMetaTileEntity.isAllowedToWork()) - && ((aTick % 256L) == 0L) - && (!aBaseMetaTileEntity.getWorld() - .isThundering())) { - final boolean bRain = aBaseMetaTileEntity.getWorld() - .isRaining() && (aBaseMetaTileEntity.getBiome().rainfall > 0.0F); - this.mProcessingEnergy += (bRain && (aBaseMetaTileEntity.getWorld().skylightSubtracted >= 4)) - || !aBaseMetaTileEntity.getSkyAtSide(ForgeDirection.UP) ? 0 - : !bRain && aBaseMetaTileEntity.getWorld() - .isDaytime() ? 8 : 1; - } - - if (aBaseMetaTileEntity.isServerSide()) { - aBaseMetaTileEntity.setActive( - aBaseMetaTileEntity.isAllowedToWork() && (aBaseMetaTileEntity.getUniversalEnergyStored() - >= (this.maxEUOutput() + this.getMinimumStoredEU()))); - } - } - } - - public abstract int getEfficiency(); - - @Override - public boolean doesFillContainers() { - return false; - } - - @Override - public boolean doesEmptyContainers() { - return false; - } - - @Override - public boolean canTankBeFilled() { - return false; - } - - @Override - public boolean canTankBeEmptied() { - return false; - } - - @Override - public boolean displaysItemStack() { - return false; - } - - @Override - public boolean displaysStackSize() { - return false; - } -} diff --git a/gtpp/src/main/java/gtPlusPlus/xmod/gregtech/api/metatileentity/implementations/base/generators/GregtechRocketFuelGeneratorBase.java b/gtpp/src/main/java/gtPlusPlus/xmod/gregtech/api/metatileentity/implementations/base/generators/GregtechRocketFuelGeneratorBase.java deleted file mode 100644 index 83745f393a..0000000000 --- a/gtpp/src/main/java/gtPlusPlus/xmod/gregtech/api/metatileentity/implementations/base/generators/GregtechRocketFuelGeneratorBase.java +++ /dev/null @@ -1,338 +0,0 @@ -package gtPlusPlus.xmod.gregtech.api.metatileentity.implementations.base.generators; - -import static gregtech.api.enums.GT_Values.V; - -import java.util.Collection; - -import net.minecraft.entity.player.EntityPlayer; -import net.minecraft.init.Blocks; -import net.minecraft.item.ItemStack; -import net.minecraftforge.common.util.ForgeDirection; -import net.minecraftforge.fluids.FluidStack; - -import org.apache.commons.lang3.ArrayUtils; - -import gregtech.api.enums.Textures; -import gregtech.api.gui.modularui.GT_UIInfos; -import gregtech.api.interfaces.ITexture; -import gregtech.api.interfaces.tileentity.IGregTechTileEntity; -import gregtech.api.interfaces.tileentity.RecipeMapWorkable; -import gregtech.api.metatileentity.implementations.GT_MetaTileEntity_BasicTank; -import gregtech.api.recipe.RecipeMap; -import gregtech.api.util.GT_Recipe; -import gregtech.api.util.GT_Utility; -import gtPlusPlus.core.lib.CORE; -import gtPlusPlus.core.util.math.MathUtils; -import gtPlusPlus.core.util.minecraft.gregtech.PollutionUtils; - -public abstract class GregtechRocketFuelGeneratorBase extends GT_MetaTileEntity_BasicTank implements RecipeMapWorkable { - - protected int pollMin, pollMax; - - public GregtechRocketFuelGeneratorBase(final int aID, final String aName, final String aNameRegional, - final int aTier, final String aDescription, final ITexture... aTextures) { - super(aID, aName, aNameRegional, aTier, 3, aDescription, aTextures); - pollMin = (int) (CORE.ConfigSwitches.baseMinPollutionPerSecondRocketFuelGenerator - * CORE.ConfigSwitches.pollutionReleasedByTierRocketFuelGenerator[mTier]); - pollMax = (int) (CORE.ConfigSwitches.baseMaxPollutionPerSecondRocketFuelGenerator - * CORE.ConfigSwitches.pollutionReleasedByTierRocketFuelGenerator[mTier]); - } - - public GregtechRocketFuelGeneratorBase(final String aName, final int aTier, final String[] aDescription, - final ITexture[][][] aTextures) { - super(aName, aTier, 3, aDescription, aTextures); - pollMin = (int) (CORE.ConfigSwitches.baseMinPollutionPerSecondRocketFuelGenerator - * CORE.ConfigSwitches.pollutionReleasedByTierRocketFuelGenerator[mTier]); - pollMax = (int) (CORE.ConfigSwitches.baseMaxPollutionPerSecondRocketFuelGenerator - * CORE.ConfigSwitches.pollutionReleasedByTierRocketFuelGenerator[mTier]); - } - - @Override - public ITexture[][][] getTextureSet(final ITexture[] aTextures) { - final ITexture[][][] rTextures = new ITexture[10][17][]; - for (byte i = -1; i < 16; i++) { - rTextures[0][i + 1] = this.getFront(i); - rTextures[1][i + 1] = this.getBack(i); - rTextures[2][i + 1] = this.getBottom(i); - rTextures[3][i + 1] = this.getTop(i); - rTextures[4][i + 1] = this.getSides(i); - rTextures[5][i + 1] = this.getFrontActive(i); - rTextures[6][i + 1] = this.getBackActive(i); - rTextures[7][i + 1] = this.getBottomActive(i); - rTextures[8][i + 1] = this.getTopActive(i); - rTextures[9][i + 1] = this.getSidesActive(i); - } - return rTextures; - } - - @Override - public ITexture[] getTexture(final IGregTechTileEntity aBaseMetaTileEntity, final ForgeDirection side, - final ForgeDirection facing, final int aColorIndex, final boolean aActive, final boolean aRedstone) { - return this.mTextures[(aActive ? 5 : 0) + (side == facing ? 0 - : side == facing.getOpposite() ? 1 - : side == ForgeDirection.DOWN ? 2 : side == ForgeDirection.UP ? 3 : 4)][aColorIndex + 1]; - } - - @Override - public String[] getDescription() { - String aPollution = "Causes between " + pollMin + " and " + pollMax + " Pollution per second"; - return ArrayUtils.addAll( - this.mDescriptionArray, - "Fuel Efficiency: " + this.getEfficiency() + "%", - aPollution, - CORE.GT_Tooltip.get()); - } - - @Override - public boolean onRightclick(final IGregTechTileEntity aBaseMetaTileEntity, final EntityPlayer aPlayer) { - GT_UIInfos.openGTTileEntityUI(aBaseMetaTileEntity, aPlayer); - return true; - } - - public ITexture[] getFront(final byte aColor) { - return new ITexture[] { Textures.BlockIcons.MACHINE_CASINGS[this.mTier][aColor + 1] }; - } - - public ITexture[] getBack(final byte aColor) { - return new ITexture[] { Textures.BlockIcons.MACHINE_CASINGS[this.mTier][aColor + 1] }; - } - - public ITexture[] getBottom(final byte aColor) { - return new ITexture[] { Textures.BlockIcons.MACHINE_CASINGS[this.mTier][aColor + 1] }; - } - - public ITexture[] getTop(final byte aColor) { - return new ITexture[] { Textures.BlockIcons.MACHINE_CASINGS[this.mTier][aColor + 1] }; - } - - public ITexture[] getSides(final byte aColor) { - return new ITexture[] { Textures.BlockIcons.MACHINE_CASINGS[this.mTier][aColor + 1] }; - } - - public ITexture[] getFrontActive(final byte aColor) { - return this.getFront(aColor); - } - - public ITexture[] getBackActive(final byte aColor) { - return this.getBack(aColor); - } - - public ITexture[] getBottomActive(final byte aColor) { - return this.getBottom(aColor); - } - - public ITexture[] getTopActive(final byte aColor) { - return this.getTop(aColor); - } - - public ITexture[] getSidesActive(final byte aColor) { - return this.getSides(aColor); - } - - @Override - public boolean isFacingValid(final ForgeDirection side) { - return side.offsetY == 0; - } - - @Override - public boolean isSimpleMachine() { - return false; - } - - @Override - public boolean isValidSlot(final int aIndex) { - return aIndex < 2; - } - - @Override - public boolean isEnetOutput() { - return true; - } - - @Override - public boolean isOutputFacing(final ForgeDirection side) { - return this.getBaseMetaTileEntity() - .getFrontFacing() == side; - } - - @Override - public boolean isAccessAllowed(final EntityPlayer aPlayer) { - return true; - } - - @Override - public long maxEUOutput() { - return V[this.mTier]; - } - - @Override - public long maxEUStore() { - return Math.max(this.getEUVar(), (V[this.mTier] * 500) + this.getMinimumStoredEU()); - } - - @Override - public boolean doesFillContainers() { - return false; - } - - @Override - public boolean doesEmptyContainers() { - return true; - } - - @Override - public boolean canTankBeFilled() { - return true; - } - - @Override - public boolean canTankBeEmptied() { - return false; - } - - @Override - public boolean displaysItemStack() { - return true; - } - - @Override - public boolean displaysStackSize() { - return false; - } - - @Override - public boolean isFluidInputAllowed(final FluidStack aFluid) { - return this.getFuelValue(aFluid) > 0; - } - - @Override - public void onPostTick(final IGregTechTileEntity aBaseMetaTileEntity, final long aTick) { - - if (aBaseMetaTileEntity.isServerSide() && aBaseMetaTileEntity.isAllowedToWork() && ((aTick % 10) == 0)) { - if (this.mFluid == null) { - if (aBaseMetaTileEntity.getUniversalEnergyStored() < (this.maxEUOutput() + this.getMinimumStoredEU())) { - this.mInventory[this.getStackDisplaySlot()] = null; - } else { - if (this.mInventory[this.getStackDisplaySlot()] == null) { - this.mInventory[this.getStackDisplaySlot()] = new ItemStack(Blocks.fire, 1); - } - this.mInventory[this.getStackDisplaySlot()].setStackDisplayName( - "Generating: " + (aBaseMetaTileEntity.getUniversalEnergyStored() - this.getMinimumStoredEU()) - + " EU"); - } - } else { - final int tFuelValue = this.getFuelValue(this.mFluid), - tConsumed = this.consumedFluidPerOperation(this.mFluid); - if ((tFuelValue > 0) && (tConsumed > 0) && (this.mFluid.amount >= tConsumed)) { - final long tFluidAmountToUse = Math.min( - this.mFluid.amount / tConsumed, - (((this.maxEUOutput() * 20) + this.getMinimumStoredEU()) - - aBaseMetaTileEntity.getUniversalEnergyStored()) / tFuelValue); - if ((tFluidAmountToUse > 0) - && aBaseMetaTileEntity.increaseStoredEnergyUnits(tFluidAmountToUse * tFuelValue, true)) { - int aSafeFloor = (int) Math.max(((tFluidAmountToUse * tConsumed) / 3), 1); - this.mFluid.amount -= (int) aSafeFloor; - PollutionUtils.addPollution(getBaseMetaTileEntity(), 10 * getPollution()); - } - } - } - if ((this.mInventory[this.getInputSlot()] != null) - && (aBaseMetaTileEntity.getUniversalEnergyStored() - < ((this.maxEUOutput() * 20) + this.getMinimumStoredEU())) - && (GT_Utility.getFluidForFilledItem(this.mInventory[this.getInputSlot()], true) == null)) { - final int tFuelValue = this.getFuelValue(this.mInventory[this.getInputSlot()]); - if (tFuelValue > 0) { - final ItemStack tEmptyContainer = this.getEmptyContainer(this.mInventory[this.getInputSlot()]); - if (aBaseMetaTileEntity.addStackToSlot(this.getOutputSlot(), tEmptyContainer)) { - aBaseMetaTileEntity.increaseStoredEnergyUnits(tFuelValue, true); - aBaseMetaTileEntity.decrStackSize(this.getInputSlot(), 1); - PollutionUtils.addPollution(getBaseMetaTileEntity(), getPollution() / 2); - } - } - } - } - - if (aBaseMetaTileEntity.isServerSide()) { - aBaseMetaTileEntity.setActive( - aBaseMetaTileEntity.isAllowedToWork() && (aBaseMetaTileEntity.getUniversalEnergyStored() - >= (this.maxEUOutput() + this.getMinimumStoredEU()))); - } - } - - public int getPollution() { - return MathUtils.randInt(pollMin, pollMax); - } - - @Override - public abstract RecipeMap<?> getRecipeMap(); - - public abstract int getEfficiency(); - - public int consumedFluidPerOperation(final FluidStack aLiquid) { - return 1; - } - - public int getFuelValue(final FluidStack aLiquid) { - if ((aLiquid == null) || (this.getRecipeMap() == null)) { - return 0; - } - FluidStack tLiquid; - final Collection<GT_Recipe> tRecipeList = this.getRecipeMap() - .getAllRecipes(); - for (final GT_Recipe tFuel : tRecipeList) { - if ((tLiquid = tFuel.mFluidInputs[0]) != null) { - if (aLiquid.isFluidEqual(tLiquid)) { - int aperOp = this.consumedFluidPerOperation(tLiquid); - return (int) (((long) tFuel.mSpecialValue * this.getEfficiency() * aperOp) / 100); - } - } - } - return 0; - } - - public int getFuelValue(final ItemStack aStack) { - if (GT_Utility.isStackInvalid(aStack) || (this.getRecipeMap() == null)) { - return 0; - } - final GT_Recipe tFuel = this.getRecipeMap() - .findRecipe(this.getBaseMetaTileEntity(), false, Long.MAX_VALUE, null, aStack); - if (tFuel != null) { - return (int) ((tFuel.mSpecialValue * 1000L * this.getEfficiency()) / 100); - } - return 0; - } - - public ItemStack getEmptyContainer(final ItemStack aStack) { - if (GT_Utility.isStackInvalid(aStack) || (this.getRecipeMap() == null)) { - return null; - } - final GT_Recipe tFuel = this.getRecipeMap() - .findRecipe(this.getBaseMetaTileEntity(), false, Long.MAX_VALUE, null, aStack); - if (tFuel != null) { - return GT_Utility.copy(tFuel.getOutput(0)); - } - return GT_Utility.getContainerItem(aStack, true); - } - - @Override - public boolean allowPutStack(final IGregTechTileEntity aBaseMetaTileEntity, final int aIndex, - final ForgeDirection side, final ItemStack aStack) { - return super.allowPutStack(aBaseMetaTileEntity, aIndex, side, aStack) && ((this.getFuelValue(aStack) > 0) - || (this.getFuelValue(GT_Utility.getFluidForFilledItem(aStack, true)) > 0)); - } - - @Override - public int getCapacity() { - return 32000; - } - - @Override - public int getTankPressure() { - return -100; - } - - @Override - public boolean useModularUI() { - return true; - } -} diff --git a/gtpp/src/main/java/gtPlusPlus/xmod/gregtech/api/metatileentity/implementations/base/machines/GregtechMetaTreeFarmerBase.java b/gtpp/src/main/java/gtPlusPlus/xmod/gregtech/api/metatileentity/implementations/base/machines/GregtechMetaTreeFarmerBase.java deleted file mode 100644 index fe3253244a..0000000000 --- a/gtpp/src/main/java/gtPlusPlus/xmod/gregtech/api/metatileentity/implementations/base/machines/GregtechMetaTreeFarmerBase.java +++ /dev/null @@ -1,180 +0,0 @@ -package gtPlusPlus.xmod.gregtech.api.metatileentity.implementations.base.machines; - -import net.minecraft.entity.player.EntityPlayer; -import net.minecraft.item.ItemStack; -import net.minecraftforge.common.util.ForgeDirection; - -import gregtech.api.interfaces.ITexture; -import gregtech.api.interfaces.tileentity.IGregTechTileEntity; -import gregtech.api.metatileentity.implementations.GT_MetaTileEntity_TieredMachineBlock; -import gregtech.api.objects.GT_RenderedTexture; -import gtPlusPlus.xmod.gregtech.common.blocks.textures.TexturesGtBlock; - -public abstract class GregtechMetaTreeFarmerBase extends GT_MetaTileEntity_TieredMachineBlock { - - public GregtechMetaTreeFarmerBase(final int aID, final String aName, final String aNameRegional, final int aTier, - final int aInvSlotCount, final String aDescription) { - super(aID, aName, aNameRegional, aTier, aInvSlotCount, aDescription); - } - - public GregtechMetaTreeFarmerBase(final String aName, final int aTier, final int aInvSlotCount, - final String[] aDescription, final ITexture[][][] aTextures) { - super(aName, aTier, aInvSlotCount, aDescription, aTextures); - } - - @Override - public ITexture[][][] getTextureSet(final ITexture[] aTextures) { - final ITexture[][][] rTextures = new ITexture[10][17][]; - for (byte i = -1; i < 16; i++) { - rTextures[0][i + 1] = this.getFront(i); - rTextures[1][i + 1] = this.getBack(i); - rTextures[2][i + 1] = this.getBottom(i); - rTextures[3][i + 1] = this.getTop(i); - rTextures[4][i + 1] = this.getSides(i); - rTextures[5][i + 1] = this.getFrontActive(i); - rTextures[6][i + 1] = this.getBackActive(i); - rTextures[7][i + 1] = this.getBottomActive(i); - rTextures[8][i + 1] = this.getTopActive(i); - rTextures[9][i + 1] = this.getSidesActive(i); - } - return rTextures; - } - - @Override - public ITexture[] getTexture(final IGregTechTileEntity aBaseMetaTileEntity, final ForgeDirection side, - final ForgeDirection facing, final int aColorIndex, final boolean aActive, final boolean aRedstone) { - return this.mTextures[(aActive ? 5 : 0) + (side == facing ? 0 - : side == facing.getOpposite() ? 1 - : side == ForgeDirection.DOWN ? 2 : side == ForgeDirection.UP ? 3 : 4)][aColorIndex + 1]; - } - - @Override - public boolean isSimpleMachine() { - return false; - } - - @Override - public boolean isValidSlot(final int aIndex) { - return false; - } - - @Override - public boolean isFacingValid(final ForgeDirection facing) { - return true; - } - - @Override - public boolean isEnetInput() { - return false; - } - - @Override - public boolean isEnetOutput() { - return false; - } - - @Override - public boolean isInputFacing(final ForgeDirection side) { - return !this.isOutputFacing(side); - } - - @Override - public boolean isOutputFacing(final ForgeDirection side) { - return this.getBaseMetaTileEntity() - .getBackFacing() == side; - } - - @Override - public boolean isTeleporterCompatible() { - return false; - } - - @Override - public long getMinimumStoredEU() { - return 0; - } - - @Override - public long maxEUStore() { - return 0; - } - - @Override - public long maxEUInput() { - return 0; - } - - @Override - public long maxEUOutput() { - return 0; - } - - @Override - public long maxAmperesIn() { - return 0; - } - - @Override - public long maxAmperesOut() { - return 0; - } - - @Override - public boolean isAccessAllowed(final EntityPlayer aPlayer) { - return false; - } - - public abstract ITexture getOverlayIcon(); - - @Override - public boolean allowPullStack(final IGregTechTileEntity aBaseMetaTileEntity, final int aIndex, - final ForgeDirection side, final ItemStack aStack) { - return false; - } - - @Override - public boolean allowPutStack(final IGregTechTileEntity aBaseMetaTileEntity, final int aIndex, - final ForgeDirection side, final ItemStack aStack) { - return false; - } - - public ITexture[] getFront(final byte aColor) { - return new ITexture[] { new GT_RenderedTexture(TexturesGtBlock.Casing_Machine_Farm_Manager) }; - } - - public ITexture[] getBack(final byte aColor) { - return new ITexture[] { new GT_RenderedTexture(TexturesGtBlock.Casing_Machine_Farm_Manager) }; - } - - public ITexture[] getBottom(final byte aColor) { - return new ITexture[] { new GT_RenderedTexture(TexturesGtBlock.Casing_Machine_Acacia_Log) }; - } - - public ITexture[] getTop(final byte aColor) { - return new ITexture[] { new GT_RenderedTexture(TexturesGtBlock.Casing_Machine_Podzol) }; - } - - public ITexture[] getSides(final byte aColor) { - return new ITexture[] { new GT_RenderedTexture(TexturesGtBlock.Casing_Machine_Farm_Manager) }; - } - - public ITexture[] getFrontActive(final byte aColor) { - return this.getFront(aColor); - } - - public ITexture[] getBackActive(final byte aColor) { - return this.getBack(aColor); - } - - public ITexture[] getBottomActive(final byte aColor) { - return this.getBottom(aColor); - } - - public ITexture[] getTopActive(final byte aColor) { - return this.getTop(aColor); - } - - public ITexture[] getSidesActive(final byte aColor) { - return this.getSides(aColor); - } -} diff --git a/gtpp/src/main/java/gtPlusPlus/xmod/gregtech/api/metatileentity/implementations/nbthandlers/GT_MetaTileEntity_Hatch_Catalysts.java b/gtpp/src/main/java/gtPlusPlus/xmod/gregtech/api/metatileentity/implementations/nbthandlers/GT_MetaTileEntity_Hatch_Catalysts.java deleted file mode 100644 index b53e540044..0000000000 --- a/gtpp/src/main/java/gtPlusPlus/xmod/gregtech/api/metatileentity/implementations/nbthandlers/GT_MetaTileEntity_Hatch_Catalysts.java +++ /dev/null @@ -1,71 +0,0 @@ -package gtPlusPlus.xmod.gregtech.api.metatileentity.implementations.nbthandlers; - -import net.minecraft.item.ItemStack; -import net.minecraftforge.common.util.ForgeDirection; - -import org.apache.commons.lang3.ArrayUtils; - -import gregtech.api.interfaces.ITexture; -import gregtech.api.interfaces.tileentity.IGregTechTileEntity; -import gregtech.api.metatileentity.MetaTileEntity; -import gregtech.api.objects.GT_RenderedTexture; -import gtPlusPlus.api.objects.data.AutoMap; -import gtPlusPlus.core.lib.CORE; -import gtPlusPlus.core.util.minecraft.ItemUtils; -import gtPlusPlus.xmod.gregtech.common.blocks.textures.TexturesGtBlock; - -public class GT_MetaTileEntity_Hatch_Catalysts extends GT_MetaTileEntity_Hatch_NbtConsumable { - - public GT_MetaTileEntity_Hatch_Catalysts(int aID, String aName, String aNameRegional) { - super(aID, aName, aNameRegional, 0, 16, "Dedicated Catalyst Storage", false); - } - - public GT_MetaTileEntity_Hatch_Catalysts(String aName, String[] aDescription, ITexture[][][] aTextures) { - super(aName, 0, 16, aDescription, false, aTextures); - } - - @Override - public ITexture[] getTexturesActive(ITexture aBaseTexture) { - return new ITexture[] { aBaseTexture, new GT_RenderedTexture(TexturesGtBlock.Overlay_Bus_Catalyst) }; - } - - @Override - public ITexture[] getTexturesInactive(ITexture aBaseTexture) { - return new ITexture[] { aBaseTexture, new GT_RenderedTexture(TexturesGtBlock.Overlay_Bus_Catalyst) }; - } - - @Override - public String[] getDescription() { - return ArrayUtils.add(this.mDescriptionArray, CORE.GT_Tooltip.get()); - } - - @Override - public boolean isFacingValid(ForgeDirection facing) { - return true; - } - - @Override - public MetaTileEntity newMetaEntity(IGregTechTileEntity aTileEntity) { - return new GT_MetaTileEntity_Hatch_Catalysts(mName, mDescriptionArray, mTextures); - } - - @Override - public String getNameGUI() { - return "Catalyst Container"; - } - - @Override - public AutoMap<ItemStack> getItemsValidForUsageSlots() { - return new AutoMap<>(); - } - - @Override - public boolean isItemValidForUsageSlot(ItemStack aStack) { - return ItemUtils.isCatalyst(aStack); - } - - @Override - public int getInputSlotCount() { - return 16; - } -} diff --git a/gtpp/src/main/java/gtPlusPlus/xmod/gregtech/api/metatileentity/implementations/nbthandlers/GT_MetaTileEntity_Hatch_MillingBalls.java b/gtpp/src/main/java/gtPlusPlus/xmod/gregtech/api/metatileentity/implementations/nbthandlers/GT_MetaTileEntity_Hatch_MillingBalls.java deleted file mode 100644 index e3134f5812..0000000000 --- a/gtpp/src/main/java/gtPlusPlus/xmod/gregtech/api/metatileentity/implementations/nbthandlers/GT_MetaTileEntity_Hatch_MillingBalls.java +++ /dev/null @@ -1,71 +0,0 @@ -package gtPlusPlus.xmod.gregtech.api.metatileentity.implementations.nbthandlers; - -import net.minecraft.item.ItemStack; -import net.minecraftforge.common.util.ForgeDirection; - -import org.apache.commons.lang3.ArrayUtils; - -import gregtech.api.interfaces.ITexture; -import gregtech.api.interfaces.tileentity.IGregTechTileEntity; -import gregtech.api.metatileentity.MetaTileEntity; -import gregtech.api.objects.GT_RenderedTexture; -import gtPlusPlus.api.objects.data.AutoMap; -import gtPlusPlus.core.lib.CORE; -import gtPlusPlus.core.util.minecraft.ItemUtils; -import gtPlusPlus.xmod.gregtech.common.blocks.textures.TexturesGtBlock; - -public class GT_MetaTileEntity_Hatch_MillingBalls extends GT_MetaTileEntity_Hatch_NbtConsumable { - - public GT_MetaTileEntity_Hatch_MillingBalls(int aID, String aName, String aNameRegional) { - super(aID, aName, aNameRegional, 6, 4, "Dedicated Milling Ball Storage", false); - } - - public GT_MetaTileEntity_Hatch_MillingBalls(String aName, String[] aDescription, ITexture[][][] aTextures) { - super(aName, 6, 4, aDescription, false, aTextures); - } - - @Override - public ITexture[] getTexturesActive(ITexture aBaseTexture) { - return new ITexture[] { aBaseTexture, new GT_RenderedTexture(TexturesGtBlock.Overlay_Bus_Milling_Balls) }; - } - - @Override - public ITexture[] getTexturesInactive(ITexture aBaseTexture) { - return new ITexture[] { aBaseTexture, new GT_RenderedTexture(TexturesGtBlock.Overlay_Bus_Milling_Balls) }; - } - - @Override - public String[] getDescription() { - return ArrayUtils.add(this.mDescriptionArray, CORE.GT_Tooltip.get()); - } - - @Override - public boolean isFacingValid(ForgeDirection facing) { - return true; - } - - @Override - public MetaTileEntity newMetaEntity(IGregTechTileEntity aTileEntity) { - return new GT_MetaTileEntity_Hatch_MillingBalls(mName, mDescriptionArray, mTextures); - } - - @Override - public String getNameGUI() { - return "Ball Housing"; - } - - @Override - public AutoMap<ItemStack> getItemsValidForUsageSlots() { - return new AutoMap<>(); - } - - @Override - public boolean isItemValidForUsageSlot(ItemStack aStack) { - return ItemUtils.isMillingBall(aStack); - } - - @Override - public int getInputSlotCount() { - return 4; - } -} diff --git a/gtpp/src/main/java/gtPlusPlus/xmod/gregtech/api/metatileentity/implementations/nbthandlers/GT_MetaTileEntity_Hatch_NbtConsumable.java b/gtpp/src/main/java/gtPlusPlus/xmod/gregtech/api/metatileentity/implementations/nbthandlers/GT_MetaTileEntity_Hatch_NbtConsumable.java deleted file mode 100644 index e81c9ed554..0000000000 --- a/gtpp/src/main/java/gtPlusPlus/xmod/gregtech/api/metatileentity/implementations/nbthandlers/GT_MetaTileEntity_Hatch_NbtConsumable.java +++ /dev/null @@ -1,353 +0,0 @@ -package gtPlusPlus.xmod.gregtech.api.metatileentity.implementations.nbthandlers; - -import net.minecraft.entity.player.EntityPlayer; -import net.minecraft.item.ItemStack; -import net.minecraftforge.common.util.ForgeDirection; - -import com.gtnewhorizons.modularui.api.screen.ModularWindow; -import com.gtnewhorizons.modularui.api.screen.UIBuildContext; -import com.gtnewhorizons.modularui.common.widget.DrawableWidget; -import com.gtnewhorizons.modularui.common.widget.SlotGroup; -import com.gtnewhorizons.modularui.common.widget.TextWidget; - -import gregtech.api.gui.modularui.GT_UIInfos; -import gregtech.api.interfaces.ITexture; -import gregtech.api.interfaces.modularui.IAddGregtechLogo; -import gregtech.api.interfaces.tileentity.IGregTechTileEntity; -import gregtech.api.metatileentity.MetaTileEntity; -import gregtech.api.metatileentity.implementations.GT_MetaTileEntity_Hatch; -import gregtech.api.util.GT_Utility; -import gtPlusPlus.api.objects.Logger; -import gtPlusPlus.api.objects.data.AutoMap; -import gtPlusPlus.core.util.minecraft.ItemUtils; - -public abstract class GT_MetaTileEntity_Hatch_NbtConsumable extends GT_MetaTileEntity_Hatch - implements IAddGregtechLogo { - - private final int mInputslotCount; - private final int mTotalSlotCount; - private final boolean mAllowDuplicateUsageTypes; - - public GT_MetaTileEntity_Hatch_NbtConsumable(int aID, String aName, String aNameRegional, int aTier, - int aInputSlots, String aDescription, boolean aAllowDuplicateTypes) { - super(aID, aName, aNameRegional, aTier, aInputSlots * 2, aDescription); - mInputslotCount = getInputSlotCount(); - mTotalSlotCount = getInputSlotCount() * 2; - mAllowDuplicateUsageTypes = aAllowDuplicateTypes; - } - - public GT_MetaTileEntity_Hatch_NbtConsumable(String aName, int aTier, int aInputSlots, String[] aDescription, - boolean aAllowDuplicateTypes, ITexture[][][] aTextures) { - super(aName, aTier, aInputSlots * 2, aDescription, aTextures); - mInputslotCount = getInputSlotCount(); - mTotalSlotCount = getInputSlotCount() * 2; - mAllowDuplicateUsageTypes = aAllowDuplicateTypes; - } - - @Override - public abstract ITexture[] getTexturesActive(ITexture aBaseTexture); - - @Override - public abstract ITexture[] getTexturesInactive(ITexture aBaseTexture); - - public abstract int getInputSlotCount(); - - @Override - public final boolean isSimpleMachine() { - return true; - } - - @Override - public boolean isFacingValid(ForgeDirection facing) { - return true; - } - - @Override - public final boolean isAccessAllowed(EntityPlayer aPlayer) { - return true; - } - - @Override - public final boolean isValidSlot(int aIndex) { - return true; - } - - @Override - public abstract MetaTileEntity newMetaEntity(IGregTechTileEntity aTileEntity); - - @Override - public final boolean onRightclick(IGregTechTileEntity aBaseMetaTileEntity, EntityPlayer aPlayer) { - GT_UIInfos.openGTTileEntityUI(aBaseMetaTileEntity, aPlayer); - return true; - } - - public abstract String getNameGUI(); - - @Override - public void onPostTick(IGregTechTileEntity aBaseMetaTileEntity, long aTimer) { - validateUsageSlots(); - if (aBaseMetaTileEntity.isServerSide() && aBaseMetaTileEntity.hasInventoryBeenModified()) { - fillStacksIntoFirstSlots(); - tryFillUsageSlots(); - } - } - - public final void updateSlots() { - for (int i = 0; i < mInventory.length; i++) { - if (mInventory[i] != null && mInventory[i].stackSize <= 0) { - mInventory[i] = null; - } - // Only moves items in the first four slots - if (i <= getSlotID_LastInput()) { - fillStacksIntoFirstSlots(); - } - } - } - - protected void validateUsageSlots() { - for (int i = getSlotID_FirstUsage(); i <= getSlotID_LastUsage(); i++) { - if (mInventory[i] != null && mInventory[i].stackSize < 1) { - mInventory[i] = null; - this.markDirty(); - } - } - } - - // Only moves items in the first four slots - protected final void fillStacksIntoFirstSlots() { - for (int i = 0; i <= getSlotID_LastInput(); i++) { - for (int j = i + 1; j <= getSlotID_LastInput(); j++) { - if (mInventory[j] != null - && (mInventory[i] == null || GT_Utility.areStacksEqual(mInventory[i], mInventory[j]))) { - GT_Utility.moveStackFromSlotAToSlotB( - getBaseMetaTileEntity(), - getBaseMetaTileEntity(), - j, - i, - (byte) 64, - (byte) 1, - (byte) 64, - (byte) 1); - } - } - } - } - - public final void tryFillUsageSlots() { - int aSlotSpace = (mInputslotCount - getContentUsageSlots().size()); - if (aSlotSpace > 0) { - Logger.INFO("We have empty usage slots. " + aSlotSpace); - for (int i = getSlotID_FirstInput(); i <= getSlotID_LastInput(); i++) { - ItemStack aStackToTryMove = mInventory[i]; - if (aStackToTryMove != null && isItemValidForUsageSlot(aStackToTryMove)) { - Logger.INFO("Trying to move stack from input slot " + i); - if (moveItemFromStockToUsageSlots(aStackToTryMove)) { - Logger.INFO("Updating Slots."); - updateSlots(); - } - } - } - } - } - - private int getSlotID_FirstInput() { - return 0; - } - - private int getSlotID_LastInput() { - return mInputslotCount - 1; - } - - private int getSlotID_FirstUsage() { - return mInputslotCount; - } - - private int getSlotID_LastUsage() { - return mTotalSlotCount - 1; - } - - public final AutoMap<ItemStack> getContentUsageSlots() { - AutoMap<ItemStack> aItems = new AutoMap<>(); - for (int i = mInputslotCount; i < mTotalSlotCount; i++) { - if (mInventory[i] != null) { - aItems.add(mInventory[i]); - } - } - return aItems; - } - - public final boolean moveItemFromStockToUsageSlots(ItemStack aStack) { - return moveItemFromStockToUsageSlots(aStack, mAllowDuplicateUsageTypes); - } - - public final boolean moveItemFromStockToUsageSlots(ItemStack aStack, boolean aAllowMultiOfSameTypeInUsageSlots) { - if (aStack != null) { - if (aStack.stackSize > 0) { - - if (!isItemValidForUsageSlot(aStack)) { - Logger.INFO("Stack not valid: " + ItemUtils.getItemName(aStack)); - return false; - } - - // Copy the input stack into a new object - ItemStack aStackToMove = aStack.copy(); - // Set stack size of stack to move to 1. - aStackToMove.stackSize = 1; - // Did we set a stack in the usage slots? - boolean aDidSet = false; - // Did we find another of this item already in the usage slots? - boolean aFoundMatching = false; - // Continue processing with our new stack - // First check for duplicates - for (int i = getSlotID_FirstUsage(); i <= getSlotID_LastUsage(); i++) { - if (mInventory[i] != null) { - if (GT_Utility.areStacksEqual(aStackToMove, mInventory[i], true)) { - Logger.INFO("Found matching stack in slot " + i + "."); - aFoundMatching = true; - break; - } - } - } - // Then Move stack to Usage slots - for (int i = getSlotID_FirstUsage(); i <= getSlotID_LastUsage(); i++) { - if (mInventory[i] == null) { - if ((aFoundMatching && aAllowMultiOfSameTypeInUsageSlots) || !aFoundMatching) { - mInventory[i] = aStackToMove; - aDidSet = true; - Logger.INFO("Moving new stack to usage slots."); - break; - } - } - } - if (aDidSet) { - Logger.INFO("Depleting input stack size by 1."); - // Depleted one from the original input stack - aStack.stackSize--; - } - return aDidSet; - } - } - return false; - } - - @Override - public final boolean allowPullStack(IGregTechTileEntity aBaseMetaTileEntity, int aIndex, ForgeDirection side, - ItemStack aStack) { - return false; - } - - @Override - public final boolean allowPutStack(IGregTechTileEntity aBaseMetaTileEntity, int aIndex, ForgeDirection side, - ItemStack aStack) { - return side == getBaseMetaTileEntity().getFrontFacing() && isItemValidForUsageSlot(aStack) - && aIndex < mInputslotCount; - } - - /** - * Items that get compared when checking for Usage Slot validity. Can return an empty map if - * isItemValidForUsageSlot() is overridden. - * - * @return - */ - public abstract AutoMap<ItemStack> getItemsValidForUsageSlots(); - - /** - * Checks if the given item is valid for Usage Slots. Can be overridden for easier handling if you already have - * methods to check this. - * - * @param aStack - * @return - */ - public boolean isItemValidForUsageSlot(ItemStack aStack) { - if (aStack != null) { - for (ItemStack aValid : getItemsValidForUsageSlots()) { - if (GT_Utility.areStacksEqual(aStack, aValid, true)) { - return true; - } - } - } - return false; - } - - @Override - public boolean useModularUI() { - return true; - } - - @Override - public void addGregTechLogo(ModularWindow.Builder builder) { - switch (mTotalSlotCount) { - case 8, 18 -> builder.widget( - new DrawableWidget().setDrawable(getGUITextureSet().getGregTechLogo()) - .setSize(17, 17) - .setPos(152, 63)); - case 32 -> builder.widget( - new DrawableWidget().setDrawable(getGUITextureSet().getGregTechLogo()) - .setSize(17, 17) - .setPos(79, 35)); - } - } - - @Override - public void addUIWidgets(ModularWindow.Builder builder, UIBuildContext buildContext) { - switch (mTotalSlotCount) { - case 8 -> { - builder.widget( - SlotGroup.ofItemHandler(inventoryHandler, 2) - .startFromSlot(0) - .endAtSlot(3) - .build() - .setPos(25, 25)); - builder.widget( - SlotGroup.ofItemHandler(inventoryHandler, 2) - .startFromSlot(4) - .endAtSlot(7) - .canInsert(false) - .build() - .setPos(115, 25)); - builder.widget( - new TextWidget("Stock").setDefaultColor(COLOR_TEXT_GRAY.get()) - .setPos(25, 16)) - .widget( - new TextWidget("Active").setDefaultColor(COLOR_TEXT_GRAY.get()) - .setPos(115, 16)); - } - case 18 -> { - builder.widget( - SlotGroup.ofItemHandler(inventoryHandler, 3) - .startFromSlot(0) - .endAtSlot(8) - .build() - .setPos(25, 19)); - builder.widget( - SlotGroup.ofItemHandler(inventoryHandler, 3) - .startFromSlot(9) - .endAtSlot(17) - .canInsert(false) - .build() - .setPos(97, 19)); - builder.widget( - new TextWidget("Stock").setDefaultColor(COLOR_TEXT_GRAY.get()) - .setPos(25, 14)) - .widget( - new TextWidget("Active").setDefaultColor(COLOR_TEXT_GRAY.get()) - .setPos(15, 14)); - } - case 32 -> { - builder.widget( - SlotGroup.ofItemHandler(inventoryHandler, 4) - .startFromSlot(0) - .endAtSlot(15) - .build() - .setPos(7, 7)); - builder.widget( - SlotGroup.ofItemHandler(inventoryHandler, 4) - .startFromSlot(16) - .endAtSlot(31) - .canInsert(false) - .build() - .setPos(96, 7)); - } - } - } -} diff --git a/gtpp/src/main/java/gtPlusPlus/xmod/gregtech/api/objects/GTPP_CopiedBlockTexture.java b/gtpp/src/main/java/gtPlusPlus/xmod/gregtech/api/objects/GTPP_CopiedBlockTexture.java deleted file mode 100644 index 6a780d227c..0000000000 --- a/gtpp/src/main/java/gtPlusPlus/xmod/gregtech/api/objects/GTPP_CopiedBlockTexture.java +++ /dev/null @@ -1,28 +0,0 @@ -package gtPlusPlus.xmod.gregtech.api.objects; - -import net.minecraft.block.Block; - -import gregtech.api.enums.Dyes; -import gregtech.api.objects.GT_CopiedBlockTexture; - -/** - * Made this to get rid of deprecation warnings <i>everywhere</i>. - * - * @author Alkalus - * - */ -@SuppressWarnings("deprecation") -public class GTPP_CopiedBlockTexture extends GT_CopiedBlockTexture { - - public GTPP_CopiedBlockTexture(Block aBlock, int aSide, int aMeta, short[] aRGBa, boolean aAllowAlpha) { - super(aBlock, aMeta, aMeta, aRGBa, aAllowAlpha); - } - - public GTPP_CopiedBlockTexture(Block aBlock, int aSide, int aMeta, short[] aRGBa) { - this(aBlock, aSide, aMeta, aRGBa, true); - } - - public GTPP_CopiedBlockTexture(Block aBlock, int aSide, int aMeta) { - this(aBlock, aSide, aMeta, Dyes._NULL.mRGBa); - } -} diff --git a/gtpp/src/main/java/gtPlusPlus/xmod/gregtech/api/objects/GTPP_RenderedTexture.java b/gtpp/src/main/java/gtPlusPlus/xmod/gregtech/api/objects/GTPP_RenderedTexture.java deleted file mode 100644 index 0da0136193..0000000000 --- a/gtpp/src/main/java/gtPlusPlus/xmod/gregtech/api/objects/GTPP_RenderedTexture.java +++ /dev/null @@ -1,27 +0,0 @@ -package gtPlusPlus.xmod.gregtech.api.objects; - -import gregtech.api.enums.Dyes; -import gregtech.api.interfaces.IIconContainer; -import gregtech.api.objects.GT_RenderedTexture; - -/** - * Made this to get rid of deprecation warnings <i>everywhere</i>. - * - * @author Alkalus - * - */ -@SuppressWarnings("deprecation") -public class GTPP_RenderedTexture extends GT_RenderedTexture { - - public GTPP_RenderedTexture(IIconContainer aIcon, short[] aRGBa, boolean aAllowAlpha) { - super(aIcon, aRGBa, aAllowAlpha); - } - - public GTPP_RenderedTexture(IIconContainer aIcon, short[] aRGBa) { - this(aIcon, aRGBa, true); - } - - public GTPP_RenderedTexture(IIconContainer aIcon) { - this(aIcon, Dyes._NULL.mRGBa); - } -} diff --git a/gtpp/src/main/java/gtPlusPlus/xmod/gregtech/api/objects/GregtechItemData.java b/gtpp/src/main/java/gtPlusPlus/xmod/gregtech/api/objects/GregtechItemData.java deleted file mode 100644 index 967d3ae916..0000000000 --- a/gtpp/src/main/java/gtPlusPlus/xmod/gregtech/api/objects/GregtechItemData.java +++ /dev/null @@ -1,147 +0,0 @@ -package gtPlusPlus.xmod.gregtech.api.objects; - -import java.util.ArrayList; -import java.util.Arrays; -import java.util.List; - -import net.minecraft.item.ItemStack; - -import gregtech.api.objects.GT_ArrayList; -import gtPlusPlus.xmod.gregtech.api.enums.GregtechOrePrefixes; -import gtPlusPlus.xmod.gregtech.api.enums.GregtechOrePrefixes.GT_Materials; - -public class GregtechItemData { - - private static final GregtechMaterialStack[] EMPTY_GT_MaterialStack_ARRAY = new GregtechMaterialStack[0]; - - public final List<Object> mExtraData = new GT_ArrayList<>(false, 1); - public final GregtechOrePrefixes mPrefix; - public final GregtechMaterialStack mMaterial; - public final GregtechMaterialStack[] mByProducts; - public boolean mBlackListed = false; - public ItemStack mUnificationTarget = null; - - public GregtechItemData(final GregtechOrePrefixes aPrefix, final GT_Materials aMaterial, - final boolean aBlackListed) { - this.mPrefix = aPrefix; - this.mMaterial = aMaterial == null ? null : new GregtechMaterialStack(aMaterial, aPrefix.mMaterialAmount); - this.mBlackListed = aBlackListed; - this.mByProducts = (aPrefix.mSecondaryMaterial == null) || (aPrefix.mSecondaryMaterial.mMaterial == null) - ? EMPTY_GT_MaterialStack_ARRAY - : new GregtechMaterialStack[] { aPrefix.mSecondaryMaterial.clone() }; - } - - public GregtechItemData(final GregtechOrePrefixes aPrefix, final GT_Materials aMaterial) { - this(aPrefix, aMaterial, false); - } - - public GregtechItemData(final GregtechMaterialStack aMaterial, final GregtechMaterialStack... aByProducts) { - this.mPrefix = null; - this.mMaterial = aMaterial.mMaterial == null ? null : aMaterial.clone(); - this.mBlackListed = true; - if (aByProducts == null) { - this.mByProducts = EMPTY_GT_MaterialStack_ARRAY; - } else { - final GregtechMaterialStack[] tByProducts = aByProducts.length < 1 ? EMPTY_GT_MaterialStack_ARRAY - : new GregtechMaterialStack[aByProducts.length]; - int j = 0; - for (GregtechMaterialStack aByProduct : aByProducts) { - if ((aByProduct != null) && (aByProduct.mMaterial != null)) { - tByProducts[j++] = aByProduct.clone(); - } - } - this.mByProducts = j > 0 ? new GregtechMaterialStack[j] : EMPTY_GT_MaterialStack_ARRAY; - for (int i = 0; i < this.mByProducts.length; i++) { - this.mByProducts[i] = tByProducts[i]; - } - } - } - - public GregtechItemData(final GT_Materials aMaterial, final long aAmount, - final GregtechMaterialStack... aByProducts) { - this(new GregtechMaterialStack(aMaterial, aAmount), aByProducts); - } - - public GregtechItemData(final GT_Materials aMaterial, final long aAmount, final GT_Materials aByProduct, - final long aByProductAmount) { - this(new GregtechMaterialStack(aMaterial, aAmount), new GregtechMaterialStack(aByProduct, aByProductAmount)); - } - - public GregtechItemData(final GregtechItemData... aData) { - this.mPrefix = null; - this.mBlackListed = true; - - final ArrayList<GregtechMaterialStack> aList = new ArrayList<>(), rList = new ArrayList<>(); - - for (final GregtechItemData tData : aData) { - if (tData != null) { - if (tData.hasValidMaterialData() && (tData.mMaterial.mAmount > 0)) { - aList.add(tData.mMaterial.clone()); - } - for (final GregtechMaterialStack tMaterial : tData.mByProducts) { - if (tMaterial.mAmount > 0) { - aList.add(tMaterial.clone()); - } - } - } - } - - for (final GregtechMaterialStack aMaterial : aList) { - boolean temp = true; - for (final GregtechMaterialStack tMaterial : rList) { - if (aMaterial.mMaterial == tMaterial.mMaterial) { - tMaterial.mAmount += aMaterial.mAmount; - temp = false; - break; - } - } - if (temp) { - rList.add(aMaterial.clone()); - } - } - - rList.sort((a, b) -> Long.compare(b.mAmount, a.mAmount)); - - if (rList.isEmpty()) { - this.mMaterial = null; - } else { - this.mMaterial = rList.get(0); - rList.remove(0); - } - - this.mByProducts = rList.toArray(new GregtechMaterialStack[0]); - } - - public boolean hasValidPrefixMaterialData() { - return (this.mPrefix != null) && (this.mMaterial != null) && (this.mMaterial.mMaterial != null); - } - - public boolean hasValidPrefixData() { - return this.mPrefix != null; - } - - public boolean hasValidMaterialData() { - return (this.mMaterial != null) && (this.mMaterial.mMaterial != null); - } - - public ArrayList<GregtechMaterialStack> getAllGT_MaterialStacks() { - final ArrayList<GregtechMaterialStack> rList = new ArrayList<>(); - if (this.hasValidMaterialData()) { - rList.add(this.mMaterial); - } - rList.addAll(Arrays.asList(this.mByProducts)); - return rList; - } - - public GregtechMaterialStack getByProduct(final int aIndex) { - return (aIndex >= 0) && (aIndex < this.mByProducts.length) ? this.mByProducts[aIndex] : null; - } - - @Override - public String toString() { - if ((this.mPrefix == null) || (this.mMaterial == null) || (this.mMaterial.mMaterial == null)) { - return ""; - } - return this.mPrefix.name() + this.mMaterial.mMaterial.name(); - } -} diff --git a/gtpp/src/main/java/gtPlusPlus/xmod/gregtech/api/objects/GregtechMaterialStack.java b/gtpp/src/main/java/gtPlusPlus/xmod/gregtech/api/objects/GregtechMaterialStack.java deleted file mode 100644 index d1ee02f480..0000000000 --- a/gtpp/src/main/java/gtPlusPlus/xmod/gregtech/api/objects/GregtechMaterialStack.java +++ /dev/null @@ -1,55 +0,0 @@ -package gtPlusPlus.xmod.gregtech.api.objects; - -import gtPlusPlus.xmod.gregtech.api.enums.GregtechOrePrefixes.GT_Materials; - -public class GregtechMaterialStack implements Cloneable { - - public long mAmount; - public GT_Materials mMaterial; - - public GregtechMaterialStack(final GT_Materials aMaterial, final long aAmount) { - this.mMaterial = aMaterial == null ? GT_Materials._NULL : aMaterial; - this.mAmount = aAmount; - } - - public GregtechMaterialStack copy(final long aAmount) { - return new GregtechMaterialStack(this.mMaterial, aAmount); - } - - @Override - public GregtechMaterialStack clone() { - return new GregtechMaterialStack(this.mMaterial, this.mAmount); - } - - @Override - public boolean equals(final Object aObject) { - if (aObject == this) { - return true; - } - if (aObject == null) { - return false; - } - if (aObject instanceof GT_Materials) { - return aObject == this.mMaterial; - } - if (aObject instanceof GregtechMaterialStack) { - return (((GregtechMaterialStack) aObject).mMaterial == this.mMaterial) - && ((this.mAmount < 0) || (((GregtechMaterialStack) aObject).mAmount < 0) - || (((GregtechMaterialStack) aObject).mAmount == this.mAmount)); - } - return false; - } - - @Override - public String toString() { - return ((this.mMaterial.mMaterialList.size() > 1) && (this.mAmount > 1) ? "(" : "") - + this.mMaterial.getToolTip(true) - + ((this.mMaterial.mMaterialList.size() > 1) && (this.mAmount > 1) ? ")" : "") - + (this.mAmount > 1 ? this.mAmount : ""); - } - - @Override - public int hashCode() { - return this.mMaterial.hashCode(); - } -} diff --git a/gtpp/src/main/java/gtPlusPlus/xmod/gregtech/api/util/GTPP_Config.java b/gtpp/src/main/java/gtPlusPlus/xmod/gregtech/api/util/GTPP_Config.java deleted file mode 100644 index 65beea207a..0000000000 --- a/gtpp/src/main/java/gtPlusPlus/xmod/gregtech/api/util/GTPP_Config.java +++ /dev/null @@ -1,123 +0,0 @@ -package gtPlusPlus.xmod.gregtech.api.util; - -import static gregtech.api.enums.GT_Values.E; - -import net.minecraft.item.ItemStack; -import net.minecraftforge.common.config.Configuration; -import net.minecraftforge.common.config.Property; - -import gregtech.api.GregTech_API; -import gregtech.api.util.GT_OreDictUnificator; -import gregtech.api.util.GT_Utility; - -public class GTPP_Config implements Runnable { - - public static boolean troll = false; - - public static Configuration sConfigFileIDs; - public final Configuration mConfig; - - public GTPP_Config(Configuration aConfig) { - mConfig = aConfig; - mConfig.load(); - mConfig.save(); - } - - public static int addIDConfig(Object aCategory, String aName, int aDefault) { - if (GT_Utility.isStringInvalid(aName)) return aDefault; - Property tProperty = sConfigFileIDs.get( - aCategory.toString() - .replaceAll("\\|", "."), - aName.replaceAll("\\|", "."), - aDefault); - int rResult = tProperty.getInt(aDefault); - if (!tProperty.wasRead() && GregTech_API.sPostloadFinished) sConfigFileIDs.save(); - return rResult; - } - - public static String getStackConfigName(ItemStack aStack) { - if (GT_Utility.isStackInvalid(aStack)) return E; - Object rName = GT_OreDictUnificator.getAssociation(aStack); - if (rName != null) return rName.toString(); - try { - if (GT_Utility.isStringValid(rName = aStack.getUnlocalizedName())) return rName.toString(); - } catch (Throwable e) { - /* Do nothing */ - } - String sName = aStack.getItem() - .toString(); - String[] tmp = sName.split("@"); - if (tmp.length > 0) sName = tmp[0]; - return sName + "." + aStack.getItemDamage(); - } - - public boolean get(Object aCategory, ItemStack aStack, boolean aDefault) { - String aName = getStackConfigName(aStack); - return get(aCategory, aName, aDefault); - } - - public boolean get(Object aCategory, String aName, boolean aDefault) { - if (GT_Utility.isStringInvalid(aName)) return aDefault; - Property tProperty = mConfig.get( - aCategory.toString() - .replaceAll("\\|", "_"), - (aName + "_" + aDefault).replaceAll("\\|", "_"), - aDefault); - boolean rResult = tProperty.getBoolean(aDefault); - if (!tProperty.wasRead() && GregTech_API.sPostloadFinished) mConfig.save(); - return rResult; - } - - public int get(Object aCategory, ItemStack aStack, int aDefault) { - return get(aCategory, getStackConfigName(aStack), aDefault); - } - - public int get(Object aCategory, String aName, int aDefault) { - if (GT_Utility.isStringInvalid(aName)) return aDefault; - Property tProperty = mConfig.get( - aCategory.toString() - .replaceAll("\\|", "_"), - (aName + "_" + aDefault).replaceAll("\\|", "_"), - aDefault); - int rResult = tProperty.getInt(aDefault); - if (!tProperty.wasRead() && GregTech_API.sPostloadFinished) mConfig.save(); - return rResult; - } - - public double get(Object aCategory, ItemStack aStack, double aDefault) { - return get(aCategory, getStackConfigName(aStack), aDefault); - } - - public double get(Object aCategory, String aName, double aDefault) { - if (GT_Utility.isStringInvalid(aName)) return aDefault; - Property tProperty = mConfig.get( - aCategory.toString() - .replaceAll("\\|", "_"), - (aName + "_" + aDefault).replaceAll("\\|", "_"), - aDefault); - double rResult = tProperty.getDouble(aDefault); - if (!tProperty.wasRead() && GregTech_API.sPostloadFinished) mConfig.save(); - return rResult; - } - - public String get(Object aCategory, ItemStack aStack, String aDefault) { - return get(aCategory, getStackConfigName(aStack), aDefault); - } - - public String get(Object aCategory, String aName, String aDefault) { - if (GT_Utility.isStringInvalid(aName)) return aDefault; - Property tProperty = mConfig.get( - aCategory.toString() - .replaceAll("\\|", "_"), - (aName + "_" + aDefault).replaceAll("\\|", "_"), - aDefault); - String rResult = tProperty.getString(); - if (!tProperty.wasRead() && GregTech_API.sPostloadFinished) mConfig.save(); - return rResult; - } - - @Override - public void run() { - mConfig.save(); - } -} diff --git a/gtpp/src/main/java/gtPlusPlus/xmod/gregtech/api/util/SpecialBehaviourTooltipHandler.java b/gtpp/src/main/java/gtPlusPlus/xmod/gregtech/api/util/SpecialBehaviourTooltipHandler.java deleted file mode 100644 index df95b7de2b..0000000000 --- a/gtpp/src/main/java/gtPlusPlus/xmod/gregtech/api/util/SpecialBehaviourTooltipHandler.java +++ /dev/null @@ -1,35 +0,0 @@ -package gtPlusPlus.xmod.gregtech.api.util; - -import java.util.HashMap; - -import net.minecraft.item.ItemStack; -import net.minecraft.util.EnumChatFormatting; -import net.minecraftforge.event.entity.player.ItemTooltipEvent; - -import cpw.mods.fml.common.eventhandler.SubscribeEvent; -import gregtech.api.util.GT_Utility; - -public class SpecialBehaviourTooltipHandler { - - private static final HashMap<ItemStack, String> mTooltipCache = new HashMap<>(); - - public static void addTooltipForItem(ItemStack aStack, String aTooltip) { - mTooltipCache.put(aStack, aTooltip); - } - - @SubscribeEvent - public void onItemTooltip(ItemTooltipEvent event) { - if (event != null) { - if (event.itemStack != null) { - for (ItemStack aKey : mTooltipCache.keySet()) { - if (GT_Utility.areStacksEqual(aKey, event.itemStack, false)) { - String s = mTooltipCache.get(aKey); - if (s != null && s.length() > 0) { - event.toolTip.add(EnumChatFormatting.RED + s); - } - } - } - } - } - } -} diff --git a/gtpp/src/main/java/gtPlusPlus/xmod/gregtech/common/Meta_GT_Proxy.java b/gtpp/src/main/java/gtPlusPlus/xmod/gregtech/common/Meta_GT_Proxy.java deleted file mode 100644 index c53e217560..0000000000 --- a/gtpp/src/main/java/gtPlusPlus/xmod/gregtech/common/Meta_GT_Proxy.java +++ /dev/null @@ -1,96 +0,0 @@ -package gtPlusPlus.xmod.gregtech.common; - -import net.minecraft.block.Block; -import net.minecraft.item.ItemStack; -import net.minecraftforge.fluids.Fluid; -import net.minecraftforge.fluids.FluidRegistry; - -import cpw.mods.fml.common.registry.LanguageRegistry; -import gregtech.api.enums.ItemList; -import gregtech.api.enums.TAE; -import gregtech.api.util.GT_LanguageManager; -import gtPlusPlus.api.objects.Logger; -import gtPlusPlus.core.handler.AchievementHandler; -import gtPlusPlus.core.util.minecraft.ItemUtils; -import gtPlusPlus.core.util.minecraft.LangUtils; -import gtPlusPlus.core.util.minecraft.gregtech.PollutionUtils; -import gtPlusPlus.xmod.gregtech.common.covers.CoverManager; -import ic2.core.init.BlocksItems; -import ic2.core.init.InternalName; - -public class Meta_GT_Proxy { - - public static AchievementHandler mAssemblyAchievements; - - public Meta_GT_Proxy() {} - - public static void preInit() { - fixIC2FluidNames(); - CoverManager.generateCustomCovers(); - } - - public static void init() { - PollutionUtils.setPollutionFluids(); - fixIC2FluidNames(); - } - - public static void postInit() { - mAssemblyAchievements = new AchievementHandler(); - fixIC2FluidNames(); - - // Finalise TAE - TAE.finalizeTAE(); - } - - @SuppressWarnings("deprecation") - public static void fixIC2FluidNames() { - // Fix IC2 Hot Water name - try { - String aNewHeatedWaterName = "Heated Water"; - Logger.INFO("Renaming [IC2 Hotspring Water] --> [" + aNewHeatedWaterName + "]."); - LanguageRegistry.instance() - .addStringLocalization("fluidHotWater", "Heated Water"); - LanguageRegistry.instance() - .addStringLocalization("fluidHotWater", aNewHeatedWaterName); - LanguageRegistry.instance() - .addStringLocalization("ic2.fluidHotWater", aNewHeatedWaterName); - GT_LanguageManager.addStringLocalization("fluidHotWater", aNewHeatedWaterName); - GT_LanguageManager.addStringLocalization("ic2.fluidHotWater", aNewHeatedWaterName); - - Block b = BlocksItems.getFluidBlock(InternalName.fluidHotWater); - if (b != null) { - LanguageRegistry.addName(ItemUtils.getSimpleStack(b), aNewHeatedWaterName); - LanguageRegistry.instance() - .addStringLocalization(b.getUnlocalizedName(), aNewHeatedWaterName); - GT_LanguageManager.addStringLocalization(b.getUnlocalizedName(), aNewHeatedWaterName); - } - Fluid f = BlocksItems.getFluid(InternalName.fluidHotWater); - if (f != null) { - LanguageRegistry.instance() - .addStringLocalization(f.getUnlocalizedName(), aNewHeatedWaterName); - GT_LanguageManager.addStringLocalization(f.getUnlocalizedName(), aNewHeatedWaterName); - int aDam = FluidRegistry.getFluidID(f); - ItemStack s = ItemList.Display_Fluid.getWithDamage(1, aDam); - if (s != null) { - LanguageRegistry.addName(s, aNewHeatedWaterName); - } - } - - String[] aLangs = new String[] { "de_DE", "en_US", "en_GB", "en_IC", "es_AR", "es_ES", "es_MX", "es_UY", - "es_VE", "fr_CA", "fr_FR", "it_IT", "ko_KR", "pt_BR", "pt_PT", "ru_RU", "sv_SE", "tr_TR", "zh_CN", - "zh_TW", }; - String[] aLangValues = new String[] { "Erhitztes Wasser", "Heated Water", "Heated Water", "Heated Water", - "Agua caliente", "Agua caliente", "Agua caliente", "Agua caliente", "Agua caliente", "Eau chauffée", - "Eau chauffée", "Acqua riscaldata", "온수", "Água aquecida", "Água aquecida", "Вода с подогревом", - "Uppvärmt vatten", "Isıtılmış Su", "热水", "热水", }; - for (int i = 0; i < aLangs.length; i++) { - Logger - .REFLECTION("Trying to inject new lang data for " + aLangs[i] + ", using value: " + aLangValues[i]); - LangUtils.rewriteEntryForLanguageRegistry(aLangs[i], "fluidHotWater", aLangValues[i]); - LangUtils.rewriteEntryForLanguageRegistry(aLangs[i], "ic2.fluidHotWater", aLangValues[i]); - } - } catch (Throwable t) { - - } - } -} diff --git a/gtpp/src/main/java/gtPlusPlus/xmod/gregtech/common/blocks/GregtechMetaCasingBlocks.java b/gtpp/src/main/java/gtPlusPlus/xmod/gregtech/common/blocks/GregtechMetaCasingBlocks.java deleted file mode 100644 index ee0d040394..0000000000 --- a/gtpp/src/main/java/gtPlusPlus/xmod/gregtech/common/blocks/GregtechMetaCasingBlocks.java +++ /dev/null @@ -1,79 +0,0 @@ -package gtPlusPlus.xmod.gregtech.common.blocks; - -import net.minecraft.item.ItemStack; -import net.minecraft.util.IIcon; -import net.minecraft.world.IBlockAccess; -import net.minecraftforge.common.util.ForgeDirection; - -import cpw.mods.fml.relauncher.Side; -import cpw.mods.fml.relauncher.SideOnly; -import gregtech.api.enums.TAE; -import gregtech.api.util.GT_LanguageManager; -import gregtech.common.blocks.GT_Material_Casings; -import gtPlusPlus.xmod.gregtech.api.enums.GregtechItemList; -import gtPlusPlus.xmod.gregtech.api.objects.GTPP_CopiedBlockTexture; -import gtPlusPlus.xmod.gregtech.common.blocks.textures.CasingTextureHandler; - -public class GregtechMetaCasingBlocks extends GregtechMetaCasingBlocksAbstract { - - CasingTextureHandler TextureHandler = new CasingTextureHandler(); - - public GregtechMetaCasingBlocks() { - super(GregtechMetaCasingItems.class, "miscutils.blockcasings", GT_Material_Casings.INSTANCE); - for (byte i = 0; i < 16; i = (byte) (i + 1)) { - if (i == 2 || i == 3 || i == 4) { - continue; - } - TAE.registerTexture(0, i, new GTPP_CopiedBlockTexture(this, 6, i)); - } - GT_LanguageManager.addStringLocalization(this.getUnlocalizedName() + ".0.name", "Centrifuge Casing"); - GT_LanguageManager.addStringLocalization(this.getUnlocalizedName() + ".1.name", "Structural Coke Oven Casing"); - GT_LanguageManager - .addStringLocalization(this.getUnlocalizedName() + ".2.name", "Heat Resistant Coke Oven Casing"); - GT_LanguageManager.addStringLocalization(this.getUnlocalizedName() + ".3.name", "Heat Proof Coke Oven Casing"); // 60 - GT_LanguageManager - .addStringLocalization(this.getUnlocalizedName() + ".4.name", "Material Press Machine Casing"); - GT_LanguageManager.addStringLocalization(this.getUnlocalizedName() + ".5.name", "Electrolyzer Casing"); - GT_LanguageManager.addStringLocalization(this.getUnlocalizedName() + ".6.name", "Wire Factory Casing"); - GT_LanguageManager.addStringLocalization(this.getUnlocalizedName() + ".7.name", "Maceration Stack Casing"); - GT_LanguageManager.addStringLocalization(this.getUnlocalizedName() + ".8.name", "Matter Generation Coil"); // 65 - GT_LanguageManager.addStringLocalization(this.getUnlocalizedName() + ".9.name", "Matter Fabricator Casing"); - GT_LanguageManager.addStringLocalization(this.getUnlocalizedName() + ".10.name", "Iron Plated Bricks"); - GT_LanguageManager.addStringLocalization(this.getUnlocalizedName() + ".11.name", "Multitank Exterior Casing"); - GT_LanguageManager.addStringLocalization(this.getUnlocalizedName() + ".12.name", "Hastelloy-N Reactor Casing"); - GT_LanguageManager.addStringLocalization(this.getUnlocalizedName() + ".13.name", "Zeron-100 Reactor Shielding"); - GT_LanguageManager - .addStringLocalization(this.getUnlocalizedName() + ".14.name", "Blast Smelter Heat Containment Coil "); - GT_LanguageManager.addStringLocalization(this.getUnlocalizedName() + ".15.name", "Blast Smelter Casing Block"); - GregtechItemList.Casing_Centrifuge1.set(new ItemStack(this, 1, 0)); - GregtechItemList.Casing_CokeOven.set(new ItemStack(this, 1, 1)); - GregtechItemList.Casing_CokeOven_Coil1.set(new ItemStack(this, 1, 2)); - GregtechItemList.Casing_CokeOven_Coil2.set(new ItemStack(this, 1, 3)); - GregtechItemList.Casing_MaterialPress.set(new ItemStack(this, 1, 4)); - GregtechItemList.Casing_Electrolyzer.set(new ItemStack(this, 1, 5)); - GregtechItemList.Casing_WireFactory.set(new ItemStack(this, 1, 6)); - GregtechItemList.Casing_MacerationStack.set(new ItemStack(this, 1, 7)); - GregtechItemList.Casing_MatterGen.set(new ItemStack(this, 1, 8)); - GregtechItemList.Casing_MatterFab.set(new ItemStack(this, 1, 9)); - GregtechItemList.Casing_IronPlatedBricks.set(new ItemStack(this, 1, 10)); - GregtechItemList.Casing_MultitankExterior.set(new ItemStack(this, 1, 11)); - GregtechItemList.Casing_Reactor_I.set(new ItemStack(this, 1, 12)); - GregtechItemList.Casing_Reactor_II.set(new ItemStack(this, 1, 13)); - GregtechItemList.Casing_Coil_BlastSmelter.set(new ItemStack(this, 1, 14)); - GregtechItemList.Casing_BlastSmelter.set(new ItemStack(this, 1, 15)); - } - - @Override - public IIcon getIcon(final int ordinalSide, final int aMeta) { // Texture ID's. case 0 == ID[57] - return CasingTextureHandler.getIcon(ordinalSide, aMeta); - } - - @Override - @SideOnly(Side.CLIENT) - public IIcon getIcon(final IBlockAccess aWorld, final int xCoord, final int yCoord, final int zCoord, - final int ordinalSide) { - final GregtechMetaCasingBlocks i = this; - return CasingTextureHandler - .handleCasingsGT(aWorld, xCoord, yCoord, zCoord, ForgeDirection.getOrientation(ordinalSide), i); - } -} diff --git a/gtpp/src/main/java/gtPlusPlus/xmod/gregtech/common/blocks/GregtechMetaCasingBlocks2.java b/gtpp/src/main/java/gtPlusPlus/xmod/gregtech/common/blocks/GregtechMetaCasingBlocks2.java deleted file mode 100644 index 9d53c281a2..0000000000 --- a/gtpp/src/main/java/gtPlusPlus/xmod/gregtech/common/blocks/GregtechMetaCasingBlocks2.java +++ /dev/null @@ -1,111 +0,0 @@ -package gtPlusPlus.xmod.gregtech.common.blocks; - -import java.util.List; - -import net.minecraft.block.Block; -import net.minecraft.creativetab.CreativeTabs; -import net.minecraft.entity.player.EntityPlayer; -import net.minecraft.item.Item; -import net.minecraft.item.ItemStack; -import net.minecraft.util.IIcon; - -import gregtech.api.enums.TAE; -import gregtech.api.util.GT_LanguageManager; -import gregtech.api.util.GT_Utility; -import gregtech.common.blocks.GT_Material_Casings; -import gtPlusPlus.xmod.gregtech.api.enums.GregtechItemList; -import gtPlusPlus.xmod.gregtech.api.objects.GTPP_CopiedBlockTexture; -import gtPlusPlus.xmod.gregtech.common.blocks.textures.CasingTextureHandler2; -import gtPlusPlus.xmod.gregtech.common.tileentities.machines.multi.storage.GregtechMetaTileEntity_PowerSubStationController; - -public class GregtechMetaCasingBlocks2 extends GregtechMetaCasingBlocksAbstract { - - @Override - public void getSubBlocks(Item aItem, CreativeTabs par2CreativeTabs, List aList) { - aList.add(new ItemStack(aItem, 1, 0)); - aList.add(new ItemStack(aItem, 1, 1)); - aList.add(new ItemStack(aItem, 1, 2)); - aList.add(new ItemStack(aItem, 1, 3)); - aList.add(new ItemStack(aItem, 1, 4)); - aList.add(new ItemStack(aItem, 1, 5)); - aList.add(new ItemStack(aItem, 1, 6)); - aList.add(new ItemStack(aItem, 1, 7)); - aList.add(new ItemStack(aItem, 1, 8)); - aList.add(new ItemStack(aItem, 1, 9)); - aList.add(new ItemStack(aItem, 1, 10)); - aList.add(new ItemStack(aItem, 1, 11)); - aList.add(new ItemStack(aItem, 1, 12)); - aList.add(new ItemStack(aItem, 1, 13)); - - aList.add(new ItemStack(aItem, 1, 15)); - - } - - public static class GregtechMetaCasingItemBlocks2 extends GregtechMetaCasingItems { - - public GregtechMetaCasingItemBlocks2(Block par1) { - super(par1); - } - - @Override - public void addInformation(ItemStack aStack, EntityPlayer aPlayer, List aList, boolean aF3_H) { - int meta = aStack.getItemDamage(); - int tier = GregtechMetaTileEntity_PowerSubStationController.getCellTier(field_150939_a, meta); - if (meta == 7 && tier > 0) { - long capacity = GregtechMetaTileEntity_PowerSubStationController.getCapacityFromCellTier(tier); - aList.add("Energy Storage: " + GT_Utility.formatNumbers(capacity)); - } - super.addInformation(aStack, aPlayer, aList, aF3_H); - } - } - - public GregtechMetaCasingBlocks2() { - super(GregtechMetaCasingItemBlocks2.class, "gtplusplus.blockcasings.2", GT_Material_Casings.INSTANCE); - for (byte i = 0; i < 16; i = (byte) (i + 1)) { - if (i == 4 || i == 10 || i == 11 || i == 12 || i == 14) { - continue; - } - TAE.registerTexture(1, i, new GTPP_CopiedBlockTexture(this, 6, i)); - } - GT_LanguageManager.addStringLocalization(this.getUnlocalizedName() + ".0.name", "Thermal Processing Casing"); - GT_LanguageManager.addStringLocalization(this.getUnlocalizedName() + ".1.name", "Hastelloy-N Sealant Block"); - GT_LanguageManager.addStringLocalization(this.getUnlocalizedName() + ".2.name", "Hastelloy-X Structural Block"); - GT_LanguageManager - .addStringLocalization(this.getUnlocalizedName() + ".3.name", "Incoloy-DS Fluid Containment Block"); - GT_LanguageManager.addStringLocalization(this.getUnlocalizedName() + ".4.name", "Wash Plant Casing"); - GT_LanguageManager.addStringLocalization(this.getUnlocalizedName() + ".5.name", "Industrial Sieve Casing"); - GT_LanguageManager.addStringLocalization(this.getUnlocalizedName() + ".6.name", "Large Sieve Grate"); - GT_LanguageManager - .addStringLocalization(this.getUnlocalizedName() + ".7.name", "Vanadium Redox Power Cell (EV)"); - GT_LanguageManager.addStringLocalization(this.getUnlocalizedName() + ".8.name", "Sub-Station External Casing"); - GT_LanguageManager.addStringLocalization(this.getUnlocalizedName() + ".9.name", "Cyclotron Coil"); - GT_LanguageManager.addStringLocalization(this.getUnlocalizedName() + ".10.name", "Cyclotron Outer Casing"); - GT_LanguageManager.addStringLocalization(this.getUnlocalizedName() + ".11.name", "Thermal Containment Casing"); - GT_LanguageManager.addStringLocalization(this.getUnlocalizedName() + ".12.name", "Bulk Production Frame"); - GT_LanguageManager.addStringLocalization(this.getUnlocalizedName() + ".13.name", "Cutting Factory Frame"); - - GT_LanguageManager.addStringLocalization(this.getUnlocalizedName() + ".15.name", "Sterile Farm Casing"); - - GregtechItemList.Casing_ThermalCentrifuge.set(new ItemStack(this, 1, 0)); - GregtechItemList.Casing_Refinery_External.set(new ItemStack(this, 1, 1)); - GregtechItemList.Casing_Refinery_Structural.set(new ItemStack(this, 1, 2)); - GregtechItemList.Casing_Refinery_Internal.set(new ItemStack(this, 1, 3)); - GregtechItemList.Casing_WashPlant.set(new ItemStack(this, 1, 4)); - GregtechItemList.Casing_Sifter.set(new ItemStack(this, 1, 5)); - GregtechItemList.Casing_SifterGrate.set(new ItemStack(this, 1, 6)); - GregtechItemList.Casing_Vanadium_Redox.set(new ItemStack(this, 1, 7)); - GregtechItemList.Casing_Power_SubStation.set(new ItemStack(this, 1, 8)); - GregtechItemList.Casing_Cyclotron_Coil.set(new ItemStack(this, 1, 9)); - GregtechItemList.Casing_Cyclotron_External.set(new ItemStack(this, 1, 10)); - GregtechItemList.Casing_ThermalContainment.set(new ItemStack(this, 1, 11)); - GregtechItemList.Casing_Autocrafter.set(new ItemStack(this, 1, 12)); - GregtechItemList.Casing_CuttingFactoryFrame.set(new ItemStack(this, 1, 13)); - - GregtechItemList.Casing_PLACEHOLDER_TreeFarmer.set(new ItemStack(this, 1, 15)); // Tree Farmer Textures - } - - @Override - public IIcon getIcon(final int ordinalSide, final int aMeta) { - return CasingTextureHandler2.getIcon(ordinalSide, aMeta); - } -} diff --git a/gtpp/src/main/java/gtPlusPlus/xmod/gregtech/common/blocks/GregtechMetaCasingBlocks3.java b/gtpp/src/main/java/gtPlusPlus/xmod/gregtech/common/blocks/GregtechMetaCasingBlocks3.java deleted file mode 100644 index 76fb077de1..0000000000 --- a/gtpp/src/main/java/gtPlusPlus/xmod/gregtech/common/blocks/GregtechMetaCasingBlocks3.java +++ /dev/null @@ -1,379 +0,0 @@ -package gtPlusPlus.xmod.gregtech.common.blocks; - -import java.util.List; - -import net.minecraft.block.Block; -import net.minecraft.entity.player.EntityPlayer; -import net.minecraft.item.ItemStack; -import net.minecraft.util.IIcon; -import net.minecraft.world.IBlockAccess; - -import cpw.mods.fml.relauncher.Side; -import cpw.mods.fml.relauncher.SideOnly; -import gregtech.api.enums.TAE; -import gregtech.api.util.GT_LanguageManager; -import gregtech.api.util.GT_Utility; -import gregtech.common.blocks.GT_Material_Casings; -import gtPlusPlus.xmod.gregtech.api.enums.GregtechItemList; -import gtPlusPlus.xmod.gregtech.api.objects.GTPP_CopiedBlockTexture; -import gtPlusPlus.xmod.gregtech.common.blocks.textures.CasingTextureHandler3; -import gtPlusPlus.xmod.gregtech.common.blocks.textures.TexturesGtBlock; -import gtPlusPlus.xmod.gregtech.common.tileentities.machines.multi.storage.GregtechMetaTileEntity_PowerSubStationController; - -public class GregtechMetaCasingBlocks3 extends GregtechMetaCasingBlocksAbstract { - - public static boolean mConnectedMachineTextures = false; - CasingTextureHandler3 TextureHandler = new CasingTextureHandler3(); - - public static class GregtechMetaCasingItemBlocks3 extends GregtechMetaCasingItems { - - public GregtechMetaCasingItemBlocks3(Block par1) { - super(par1); - } - - @Override - public void addInformation(ItemStack aStack, EntityPlayer aPlayer, List aList, boolean aF3_H) { - int meta = aStack.getItemDamage(); - int tier = GregtechMetaTileEntity_PowerSubStationController.getCellTier(field_150939_a, meta); - if (tier > 0) { - long capacity = GregtechMetaTileEntity_PowerSubStationController.getCapacityFromCellTier(tier); - aList.add("Energy Storage: " + GT_Utility.formatNumbers(capacity)); - } - super.addInformation(aStack, aPlayer, aList, aF3_H); - } - } - - public GregtechMetaCasingBlocks3() { - super(GregtechMetaCasingItemBlocks3.class, "gtplusplus.blockcasings.3", GT_Material_Casings.INSTANCE); - for (byte i = 0; i < 16; i = (byte) (i + 1)) { - // Free up Redox casing in TAE - if (i >= 4 && i <= 8) { - continue; - } - TAE.registerTexture(2, i, new GTPP_CopiedBlockTexture(this, 6, i)); - } - GT_LanguageManager.addStringLocalization(this.getUnlocalizedName() + ".0.name", "Aquatic Casing"); - GT_LanguageManager.addStringLocalization(this.getUnlocalizedName() + ".1.name", "Inconel Reinforced Casing"); - GT_LanguageManager.addStringLocalization(this.getUnlocalizedName() + ".2.name", "Multi-Use Casing"); - GT_LanguageManager.addStringLocalization(this.getUnlocalizedName() + ".3.name", "Trinium Plated Casing"); - GT_LanguageManager - .addStringLocalization(this.getUnlocalizedName() + ".4.name", "Vanadium Redox Power Cell (IV)"); - GT_LanguageManager - .addStringLocalization(this.getUnlocalizedName() + ".5.name", "Vanadium Redox Power Cell (LuV)"); - GT_LanguageManager - .addStringLocalization(this.getUnlocalizedName() + ".6.name", "Vanadium Redox Power Cell (ZPM)"); - GT_LanguageManager - .addStringLocalization(this.getUnlocalizedName() + ".7.name", "Vanadium Redox Power Cell (UV)"); - GT_LanguageManager - .addStringLocalization(this.getUnlocalizedName() + ".8.name", "Vanadium Redox Power Cell (UHV)"); - GT_LanguageManager.addStringLocalization(this.getUnlocalizedName() + ".9.name", "Supply Depot Casing"); - GT_LanguageManager.addStringLocalization(this.getUnlocalizedName() + ".10.name", "Advanced Cryogenic Casing"); - GT_LanguageManager.addStringLocalization(this.getUnlocalizedName() + ".11.name", "Volcanus Casing"); - GT_LanguageManager - .addStringLocalization(this.getUnlocalizedName() + ".12.name", "Fusion Machine Casing MK III"); - GT_LanguageManager.addStringLocalization(this.getUnlocalizedName() + ".13.name", "Advanced Fusion Coil"); - GT_LanguageManager.addStringLocalization(this.getUnlocalizedName() + ".14.name", "Unnamed"); // Can Use, don't - // change texture - // (Used for Fusion - // MK4) - GT_LanguageManager.addStringLocalization(this.getUnlocalizedName() + ".15.name", "Containment Casing"); - GregtechItemList.Casing_FishPond.set(new ItemStack(this, 1, 0)); - GregtechItemList.Casing_Extruder.set(new ItemStack(this, 1, 1)); - GregtechItemList.Casing_Multi_Use.set(new ItemStack(this, 1, 2)); - GregtechItemList.Casing_BedrockMiner.set(new ItemStack(this, 1, 3)); - GregtechItemList.Casing_Vanadium_Redox_IV.set(new ItemStack(this, 1, 4)); - GregtechItemList.Casing_Vanadium_Redox_LuV.set(new ItemStack(this, 1, 5)); - GregtechItemList.Casing_Vanadium_Redox_ZPM.set(new ItemStack(this, 1, 6)); - GregtechItemList.Casing_Vanadium_Redox_UV.set(new ItemStack(this, 1, 7)); - GregtechItemList.Casing_Vanadium_Redox_MAX.set(new ItemStack(this, 1, 8)); - GregtechItemList.Casing_AmazonWarehouse.set(new ItemStack(this, 1, 9)); - GregtechItemList.Casing_AdvancedVacuum.set(new ItemStack(this, 1, 10)); - GregtechItemList.Casing_Adv_BlastFurnace.set(new ItemStack(this, 1, 11)); - GregtechItemList.Casing_Fusion_External.set(new ItemStack(this, 1, 12)); - GregtechItemList.Casing_Fusion_Internal.set(new ItemStack(this, 1, 13)); - GregtechItemList.Casing_Containment.set(new ItemStack(this, 1, 15)); - } - - @Override - public IIcon getIcon(final int ordinalSide, final int aMeta) { - return CasingTextureHandler3.getIcon(ordinalSide, aMeta); - } - - @SideOnly(Side.CLIENT) - @Override - public IIcon getIcon(final IBlockAccess aWorld, final int xCoord, final int yCoord, final int zCoord, - final int ordinalSide) { - final Block thisBlock = aWorld.getBlock(xCoord, yCoord, zCoord); - final int tMeta = aWorld.getBlockMetadata(xCoord, yCoord, zCoord); - if ((tMeta != 12) || !GregtechMetaCasingBlocks3.mConnectedMachineTextures) { - return getIcon(ordinalSide, tMeta); - } - final int tStartIndex = 0; - if (tMeta == 12) { - final boolean[] tConnectedSides = { - aWorld.getBlock(xCoord, yCoord - 1, zCoord) == thisBlock - && aWorld.getBlockMetadata(xCoord, yCoord - 1, zCoord) == tMeta, - aWorld.getBlock(xCoord, yCoord + 1, zCoord) == thisBlock - && aWorld.getBlockMetadata(xCoord, yCoord + 1, zCoord) == tMeta, - aWorld.getBlock(xCoord + 1, yCoord, zCoord) == thisBlock - && aWorld.getBlockMetadata(xCoord + 1, yCoord, zCoord) == tMeta, - aWorld.getBlock(xCoord, yCoord, zCoord + 1) == thisBlock - && aWorld.getBlockMetadata(xCoord, yCoord, zCoord + 1) == tMeta, - aWorld.getBlock(xCoord - 1, yCoord, zCoord) == thisBlock - && aWorld.getBlockMetadata(xCoord - 1, yCoord, zCoord) == tMeta, - aWorld.getBlock(xCoord, yCoord, zCoord - 1) == thisBlock - && aWorld.getBlockMetadata(xCoord, yCoord, zCoord - 1) == tMeta }; - switch (ordinalSide) { - case 0: { - if (tConnectedSides[0]) { - return TexturesGtBlock.CONNECTED_FUSION_HULLS[tStartIndex + 7].getIcon(); - } - if (tConnectedSides[4] && tConnectedSides[5] && tConnectedSides[2] && tConnectedSides[3]) { - return TexturesGtBlock.CONNECTED_FUSION_HULLS[tStartIndex + 6].getIcon(); - } - if (!tConnectedSides[4] && tConnectedSides[5] && tConnectedSides[2] && tConnectedSides[3]) { - return TexturesGtBlock.CONNECTED_FUSION_HULLS[tStartIndex + 2].getIcon(); - } - if (tConnectedSides[4] && !tConnectedSides[5] && tConnectedSides[2] && tConnectedSides[3]) { - return TexturesGtBlock.CONNECTED_FUSION_HULLS[tStartIndex + 3].getIcon(); - } - if (tConnectedSides[4] && tConnectedSides[5] && !tConnectedSides[2] && tConnectedSides[3]) { - return TexturesGtBlock.CONNECTED_FUSION_HULLS[tStartIndex + 4].getIcon(); - } - if (tConnectedSides[4] && tConnectedSides[5] && tConnectedSides[2] && !tConnectedSides[3]) { - return TexturesGtBlock.CONNECTED_FUSION_HULLS[tStartIndex + 5].getIcon(); - } - if (!tConnectedSides[4] && !tConnectedSides[5] && tConnectedSides[2] && tConnectedSides[3]) { - return TexturesGtBlock.CONNECTED_FUSION_HULLS[tStartIndex + 8].getIcon(); - } - if (tConnectedSides[4] && !tConnectedSides[5] && !tConnectedSides[2] && tConnectedSides[3]) { - return TexturesGtBlock.CONNECTED_FUSION_HULLS[tStartIndex + 9].getIcon(); - } - if (tConnectedSides[4] && tConnectedSides[5] && !tConnectedSides[2] && !tConnectedSides[3]) { - return TexturesGtBlock.CONNECTED_FUSION_HULLS[tStartIndex + 10].getIcon(); - } - if (!tConnectedSides[4] && tConnectedSides[5] && tConnectedSides[2] && !tConnectedSides[3]) { - return TexturesGtBlock.CONNECTED_FUSION_HULLS[tStartIndex + 11].getIcon(); - } - if (!tConnectedSides[4] && !tConnectedSides[5] && !tConnectedSides[2] && !tConnectedSides[3]) { - return TexturesGtBlock.CONNECTED_FUSION_HULLS[tStartIndex + 7].getIcon(); - } - if (!tConnectedSides[4] && !tConnectedSides[2]) { - return TexturesGtBlock.CONNECTED_FUSION_HULLS[tStartIndex + 1].getIcon(); - } - if (!tConnectedSides[5] && !tConnectedSides[3]) { - return TexturesGtBlock.CONNECTED_FUSION_HULLS[tStartIndex + 0].getIcon(); - } - } - case 1: { - if (tConnectedSides[1]) { - return TexturesGtBlock.CONNECTED_FUSION_HULLS[tStartIndex + 7].getIcon(); - } - if (tConnectedSides[4] && tConnectedSides[5] && tConnectedSides[2] && tConnectedSides[3]) { - return TexturesGtBlock.CONNECTED_FUSION_HULLS[tStartIndex + 6].getIcon(); - } - if (!tConnectedSides[4] && tConnectedSides[5] && tConnectedSides[2] && tConnectedSides[3]) { - return TexturesGtBlock.CONNECTED_FUSION_HULLS[tStartIndex + 2].getIcon(); - } - if (tConnectedSides[4] && !tConnectedSides[5] && tConnectedSides[2] && tConnectedSides[3]) { - return TexturesGtBlock.CONNECTED_FUSION_HULLS[tStartIndex + 3].getIcon(); - } - if (tConnectedSides[4] && tConnectedSides[5] && !tConnectedSides[2] && tConnectedSides[3]) { - return TexturesGtBlock.CONNECTED_FUSION_HULLS[tStartIndex + 4].getIcon(); - } - if (tConnectedSides[4] && tConnectedSides[5] && tConnectedSides[2] && !tConnectedSides[3]) { - return TexturesGtBlock.CONNECTED_FUSION_HULLS[tStartIndex + 5].getIcon(); - } - if (!tConnectedSides[4] && !tConnectedSides[5] && tConnectedSides[2] && tConnectedSides[3]) { - return TexturesGtBlock.CONNECTED_FUSION_HULLS[tStartIndex + 8].getIcon(); - } - if (tConnectedSides[4] && !tConnectedSides[5] && !tConnectedSides[2] && tConnectedSides[3]) { - return TexturesGtBlock.CONNECTED_FUSION_HULLS[tStartIndex + 9].getIcon(); - } - if (tConnectedSides[4] && tConnectedSides[5] && !tConnectedSides[2] && !tConnectedSides[3]) { - return TexturesGtBlock.CONNECTED_FUSION_HULLS[tStartIndex + 10].getIcon(); - } - if (!tConnectedSides[4] && tConnectedSides[5] && tConnectedSides[2] && !tConnectedSides[3]) { - return TexturesGtBlock.CONNECTED_FUSION_HULLS[tStartIndex + 11].getIcon(); - } - if (!tConnectedSides[4] && !tConnectedSides[5] && !tConnectedSides[2] && !tConnectedSides[3]) { - return TexturesGtBlock.CONNECTED_FUSION_HULLS[tStartIndex + 7].getIcon(); - } - if (!tConnectedSides[2] && !tConnectedSides[4]) { - return TexturesGtBlock.CONNECTED_FUSION_HULLS[tStartIndex + 1].getIcon(); - } - if (!tConnectedSides[3] && !tConnectedSides[5]) { - return TexturesGtBlock.CONNECTED_FUSION_HULLS[tStartIndex + 0].getIcon(); - } - } - case 2: { - if (tConnectedSides[5]) { - return TexturesGtBlock.CONNECTED_FUSION_HULLS[tStartIndex + 7].getIcon(); - } - if (tConnectedSides[2] && tConnectedSides[0] && tConnectedSides[4] && tConnectedSides[1]) { - return TexturesGtBlock.CONNECTED_FUSION_HULLS[tStartIndex + 6].getIcon(); - } - if (!tConnectedSides[2] && tConnectedSides[0] && tConnectedSides[4] && tConnectedSides[1]) { - return TexturesGtBlock.CONNECTED_FUSION_HULLS[tStartIndex + 2].getIcon(); - } - if (tConnectedSides[2] && !tConnectedSides[0] && tConnectedSides[4] && tConnectedSides[1]) { - return TexturesGtBlock.CONNECTED_FUSION_HULLS[tStartIndex + 5].getIcon(); - } - if (tConnectedSides[2] && tConnectedSides[0] && !tConnectedSides[4] && tConnectedSides[1]) { - return TexturesGtBlock.CONNECTED_FUSION_HULLS[tStartIndex + 4].getIcon(); - } - if (tConnectedSides[2] && tConnectedSides[0] && tConnectedSides[4] && !tConnectedSides[1]) { - return TexturesGtBlock.CONNECTED_FUSION_HULLS[tStartIndex + 3].getIcon(); - } - if (!tConnectedSides[2] && !tConnectedSides[0] && tConnectedSides[4] && tConnectedSides[1]) { - return TexturesGtBlock.CONNECTED_FUSION_HULLS[tStartIndex + 11].getIcon(); - } - if (tConnectedSides[2] && !tConnectedSides[0] && !tConnectedSides[4] && tConnectedSides[1]) { - return TexturesGtBlock.CONNECTED_FUSION_HULLS[tStartIndex + 10].getIcon(); - } - if (tConnectedSides[2] && tConnectedSides[0] && !tConnectedSides[4] && !tConnectedSides[1]) { - return TexturesGtBlock.CONNECTED_FUSION_HULLS[tStartIndex + 9].getIcon(); - } - if (!tConnectedSides[2] && tConnectedSides[0] && tConnectedSides[4] && !tConnectedSides[1]) { - return TexturesGtBlock.CONNECTED_FUSION_HULLS[tStartIndex + 8].getIcon(); - } - if (!tConnectedSides[2] && !tConnectedSides[0] && !tConnectedSides[4] && !tConnectedSides[1]) { - return TexturesGtBlock.CONNECTED_FUSION_HULLS[tStartIndex + 7].getIcon(); - } - if (!tConnectedSides[2] && !tConnectedSides[4]) { - return TexturesGtBlock.CONNECTED_FUSION_HULLS[tStartIndex + 1].getIcon(); - } - if (!tConnectedSides[0] && !tConnectedSides[1]) { - return TexturesGtBlock.CONNECTED_FUSION_HULLS[tStartIndex + 0].getIcon(); - } - } - case 3: { - if (tConnectedSides[3]) { - return TexturesGtBlock.CONNECTED_FUSION_HULLS[tStartIndex + 7].getIcon(); - } - if (tConnectedSides[2] && tConnectedSides[0] && tConnectedSides[4] && tConnectedSides[1]) { - return TexturesGtBlock.CONNECTED_FUSION_HULLS[tStartIndex + 6].getIcon(); - } - if (!tConnectedSides[2] && tConnectedSides[0] && tConnectedSides[4] && tConnectedSides[1]) { - return TexturesGtBlock.CONNECTED_FUSION_HULLS[tStartIndex + 4].getIcon(); - } - if (tConnectedSides[2] && !tConnectedSides[0] && tConnectedSides[4] && tConnectedSides[1]) { - return TexturesGtBlock.CONNECTED_FUSION_HULLS[tStartIndex + 5].getIcon(); - } - if (tConnectedSides[2] && tConnectedSides[0] && !tConnectedSides[4] && tConnectedSides[1]) { - return TexturesGtBlock.CONNECTED_FUSION_HULLS[tStartIndex + 2].getIcon(); - } - if (tConnectedSides[2] && tConnectedSides[0] && tConnectedSides[4] && !tConnectedSides[1]) { - return TexturesGtBlock.CONNECTED_FUSION_HULLS[tStartIndex + 3].getIcon(); - } - if (!tConnectedSides[2] && !tConnectedSides[0] && tConnectedSides[4] && tConnectedSides[1]) { - return TexturesGtBlock.CONNECTED_FUSION_HULLS[tStartIndex + 10].getIcon(); - } - if (tConnectedSides[2] && !tConnectedSides[0] && !tConnectedSides[4] && tConnectedSides[1]) { - return TexturesGtBlock.CONNECTED_FUSION_HULLS[tStartIndex + 11].getIcon(); - } - if (tConnectedSides[2] && tConnectedSides[0] && !tConnectedSides[4] && !tConnectedSides[1]) { - return TexturesGtBlock.CONNECTED_FUSION_HULLS[tStartIndex + 8].getIcon(); - } - if (!tConnectedSides[2] && tConnectedSides[0] && tConnectedSides[4] && !tConnectedSides[1]) { - return TexturesGtBlock.CONNECTED_FUSION_HULLS[tStartIndex + 9].getIcon(); - } - if (!tConnectedSides[2] && !tConnectedSides[0] && !tConnectedSides[4] && !tConnectedSides[1]) { - return TexturesGtBlock.CONNECTED_FUSION_HULLS[tStartIndex + 7].getIcon(); - } - if (!tConnectedSides[2] && !tConnectedSides[4]) { - return TexturesGtBlock.CONNECTED_FUSION_HULLS[tStartIndex + 1].getIcon(); - } - if (!tConnectedSides[0] && !tConnectedSides[1]) { - return TexturesGtBlock.CONNECTED_FUSION_HULLS[tStartIndex + 0].getIcon(); - } - } - case 4: { - if (tConnectedSides[4]) { - return TexturesGtBlock.CONNECTED_FUSION_HULLS[tStartIndex + 7].getIcon(); - } - if (tConnectedSides[0] && tConnectedSides[3] && tConnectedSides[1] && tConnectedSides[5]) { - return TexturesGtBlock.CONNECTED_FUSION_HULLS[tStartIndex + 6].getIcon(); - } - if (!tConnectedSides[0] && tConnectedSides[3] && tConnectedSides[1] && tConnectedSides[5]) { - return TexturesGtBlock.CONNECTED_FUSION_HULLS[tStartIndex + 5].getIcon(); - } - if (tConnectedSides[0] && !tConnectedSides[3] && tConnectedSides[1] && tConnectedSides[5]) { - return TexturesGtBlock.CONNECTED_FUSION_HULLS[tStartIndex + 4].getIcon(); - } - if (tConnectedSides[0] && tConnectedSides[3] && !tConnectedSides[1] && tConnectedSides[5]) { - return TexturesGtBlock.CONNECTED_FUSION_HULLS[tStartIndex + 3].getIcon(); - } - if (tConnectedSides[0] && tConnectedSides[3] && tConnectedSides[1] && !tConnectedSides[5]) { - return TexturesGtBlock.CONNECTED_FUSION_HULLS[tStartIndex + 2].getIcon(); - } - if (!tConnectedSides[0] && !tConnectedSides[3] && tConnectedSides[1] && tConnectedSides[5]) { - return TexturesGtBlock.CONNECTED_FUSION_HULLS[tStartIndex + 10].getIcon(); - } - if (tConnectedSides[0] && !tConnectedSides[3] && !tConnectedSides[1] && tConnectedSides[5]) { - return TexturesGtBlock.CONNECTED_FUSION_HULLS[tStartIndex + 9].getIcon(); - } - if (tConnectedSides[0] && tConnectedSides[3] && !tConnectedSides[1] && !tConnectedSides[5]) { - return TexturesGtBlock.CONNECTED_FUSION_HULLS[tStartIndex + 8].getIcon(); - } - if (!tConnectedSides[0] && tConnectedSides[3] && tConnectedSides[1] && !tConnectedSides[5]) { - return TexturesGtBlock.CONNECTED_FUSION_HULLS[tStartIndex + 11].getIcon(); - } - if (!tConnectedSides[0] && !tConnectedSides[3] && !tConnectedSides[1] && !tConnectedSides[5]) { - return TexturesGtBlock.CONNECTED_FUSION_HULLS[tStartIndex + 7].getIcon(); - } - if (!tConnectedSides[0] && !tConnectedSides[1]) { - return TexturesGtBlock.CONNECTED_FUSION_HULLS[tStartIndex + 0].getIcon(); - } - if (!tConnectedSides[3] && !tConnectedSides[5]) { - return TexturesGtBlock.CONNECTED_FUSION_HULLS[tStartIndex + 1].getIcon(); - } - } - case 5: { - if (tConnectedSides[2]) { - return TexturesGtBlock.CONNECTED_FUSION_HULLS[tStartIndex + 7].getIcon(); - } - if (tConnectedSides[0] && tConnectedSides[3] && tConnectedSides[1] && tConnectedSides[5]) { - return TexturesGtBlock.CONNECTED_FUSION_HULLS[tStartIndex + 6].getIcon(); - } - if (!tConnectedSides[0] && tConnectedSides[3] && tConnectedSides[1] && tConnectedSides[5]) { - return TexturesGtBlock.CONNECTED_FUSION_HULLS[tStartIndex + 5].getIcon(); - } - if (tConnectedSides[0] && !tConnectedSides[3] && tConnectedSides[1] && tConnectedSides[5]) { - return TexturesGtBlock.CONNECTED_FUSION_HULLS[tStartIndex + 2].getIcon(); - } - if (tConnectedSides[0] && tConnectedSides[3] && !tConnectedSides[1] && tConnectedSides[5]) { - return TexturesGtBlock.CONNECTED_FUSION_HULLS[tStartIndex + 3].getIcon(); - } - if (tConnectedSides[0] && tConnectedSides[3] && tConnectedSides[1] && !tConnectedSides[5]) { - return TexturesGtBlock.CONNECTED_FUSION_HULLS[tStartIndex + 4].getIcon(); - } - if (!tConnectedSides[0] && !tConnectedSides[3] && tConnectedSides[1] && tConnectedSides[5]) { - return TexturesGtBlock.CONNECTED_FUSION_HULLS[tStartIndex + 11].getIcon(); - } - if (tConnectedSides[0] && !tConnectedSides[3] && !tConnectedSides[1] && tConnectedSides[5]) { - return TexturesGtBlock.CONNECTED_FUSION_HULLS[tStartIndex + 8].getIcon(); - } - if (tConnectedSides[0] && tConnectedSides[3] && !tConnectedSides[1] && !tConnectedSides[5]) { - return TexturesGtBlock.CONNECTED_FUSION_HULLS[tStartIndex + 9].getIcon(); - } - if (!tConnectedSides[0] && tConnectedSides[3] && tConnectedSides[1] && !tConnectedSides[5]) { - return TexturesGtBlock.CONNECTED_FUSION_HULLS[tStartIndex + 10].getIcon(); - } - if (!tConnectedSides[0] && !tConnectedSides[3] && !tConnectedSides[1] && !tConnectedSides[5]) { - return TexturesGtBlock.CONNECTED_FUSION_HULLS[tStartIndex + 7].getIcon(); - } - if (!tConnectedSides[0] && !tConnectedSides[1]) { - return TexturesGtBlock.CONNECTED_FUSION_HULLS[tStartIndex + 0].getIcon(); - } - if (!tConnectedSides[3] && !tConnectedSides[5]) { - return TexturesGtBlock.CONNECTED_FUSION_HULLS[tStartIndex + 1].getIcon(); - } - break; - } - } - return TexturesGtBlock.CONNECTED_FUSION_HULLS[tStartIndex + 7].getIcon(); - } - return CasingTextureHandler3.getIcon(ordinalSide, tMeta); - } -} diff --git a/gtpp/src/main/java/gtPlusPlus/xmod/gregtech/common/blocks/GregtechMetaCasingBlocks4.java b/gtpp/src/main/java/gtPlusPlus/xmod/gregtech/common/blocks/GregtechMetaCasingBlocks4.java deleted file mode 100644 index a150d7e828..0000000000 --- a/gtpp/src/main/java/gtPlusPlus/xmod/gregtech/common/blocks/GregtechMetaCasingBlocks4.java +++ /dev/null @@ -1,126 +0,0 @@ -package gtPlusPlus.xmod.gregtech.common.blocks; - -import java.util.List; - -import net.minecraft.creativetab.CreativeTabs; -import net.minecraft.item.Item; -import net.minecraft.item.ItemStack; -import net.minecraft.util.IIcon; - -import gregtech.api.enums.TAE; -import gregtech.api.enums.Textures; -import gregtech.api.util.GT_LanguageManager; -import gregtech.common.blocks.GT_Material_Casings; -import gtPlusPlus.xmod.gregtech.api.enums.GregtechItemList; -import gtPlusPlus.xmod.gregtech.api.objects.GTPP_CopiedBlockTexture; -import gtPlusPlus.xmod.gregtech.common.blocks.textures.TexturesGtBlock; - -public class GregtechMetaCasingBlocks4 extends GregtechMetaCasingBlocksAbstract { - - public GregtechMetaCasingBlocks4() { - super(GregtechMetaCasingItems.class, "gtplusplus.blockcasings.4", GT_Material_Casings.INSTANCE); - for (byte i = 0; i < 16; i = (byte) (i + 1)) { - if (i == 2 || i == 4 || i == 5 || i == 6 || i == 7 || i == 8 || i == 12 || i == 13 || i == 14 || i == 15) { - continue; - } - TAE.registerTexture(3, i, new GTPP_CopiedBlockTexture(this, 6, i)); - } - GT_LanguageManager.addStringLocalization(this.getUnlocalizedName() + ".0.name", "Naquadah Reactor Base"); - GT_LanguageManager.addStringLocalization(this.getUnlocalizedName() + ".1.name", "Reactor Piping"); - GT_LanguageManager.addStringLocalization(this.getUnlocalizedName() + ".2.name", "Naquadah Containment Chamber"); - GT_LanguageManager.addStringLocalization(this.getUnlocalizedName() + ".3.name", "Tempered Arc Furnace Casing"); - GT_LanguageManager - .addStringLocalization(this.getUnlocalizedName() + ".4.name", "Quantum Force Transformer Coil Casings"); - GT_LanguageManager.addStringLocalization(this.getUnlocalizedName() + ".10.name", "Vacuum Casing"); - GT_LanguageManager.addStringLocalization(this.getUnlocalizedName() + ".11.name", "Turbodyne Casing"); - - GregtechItemList.Casing_Naq_Reactor_A.set(new ItemStack(this, 1, 0)); - GregtechItemList.Casing_Naq_Reactor_B.set(new ItemStack(this, 1, 1)); - GregtechItemList.Casing_Naq_Reactor_C.set(new ItemStack(this, 1, 2)); - GregtechItemList.Casing_Industrial_Arc_Furnace.set(new ItemStack(this, 1, 3)); - GregtechItemList.Casing_Coil_QuantumForceTransformer.set(new ItemStack(this, 1, 4)); - GregtechItemList.Casing_Vacuum_Furnace.set(new ItemStack(this, 1, 10)); - GregtechItemList.Casing_RocketEngine.set(new ItemStack(this, 1, 11)); - } - - @Override - public IIcon getIcon(final int ordinalSide, final int aMeta) { - return getStaticIcon((byte) ordinalSide, (byte) aMeta); - } - - public static IIcon getStaticIcon(final byte aSide, final byte aMeta) { - // Texture ID's. case 0 == ID[57] - if ((aMeta >= 0) && (aMeta < 16)) { - switch (aMeta) { - case 0 -> { - return TexturesGtBlock.Casing_Trinium_Titanium.getIcon(); - } - case 1 -> { - return TexturesGtBlock.TEXTURE_TECH_C.getIcon(); - } - case 2 -> { - return TexturesGtBlock.TEXTURE_ORGANIC_PANEL_A_GLOWING.getIcon(); - } - case 3 -> { - return TexturesGtBlock.TEXTURE_METAL_PANEL_A.getIcon(); - } - case 4 -> { - return TexturesGtBlock.Casing_Coil_QFT.getIcon(); - } - case 5 -> { - return Textures.BlockIcons.RENDERING_ERROR.getIcon(); - } - case 6 -> { - return Textures.BlockIcons.RENDERING_ERROR.getIcon(); - } - case 7 -> { - return Textures.BlockIcons.RENDERING_ERROR.getIcon(); - } - case 8 -> { - return Textures.BlockIcons.RENDERING_ERROR.getIcon(); - } - case 9 -> { - return TexturesGtBlock.Casing_Material_MaragingSteel.getIcon(); - } - case 10 -> { - if (aSide < 2) { - return TexturesGtBlock.TEXTURE_STONE_RED_B.getIcon(); - } else { - return TexturesGtBlock.TEXTURE_STONE_RED_A.getIcon(); - } - } - case 11 -> { - return TexturesGtBlock.TEXTURE_CASING_ROCKETDYNE.getIcon(); - } - case 12 -> { - return Textures.BlockIcons.RENDERING_ERROR.getIcon(); - } - case 13 -> { - return Textures.BlockIcons.RENDERING_ERROR.getIcon(); - } - case 14 -> { - return Textures.BlockIcons.RENDERING_ERROR.getIcon(); - } - case 15 -> { - return Textures.BlockIcons.RENDERING_ERROR.getIcon(); - } - default -> { - return TexturesGtBlock.Casing_Material_MaragingSteel.getIcon(); - } - } - } - return TexturesGtBlock._PlaceHolder.getIcon(); - } - - @Override - public void getSubBlocks(Item aItem, CreativeTabs par2CreativeTabs, List aList) { - aList.add(new ItemStack(aItem, 1, 0)); - aList.add(new ItemStack(aItem, 1, 1)); - aList.add(new ItemStack(aItem, 1, 2)); - aList.add(new ItemStack(aItem, 1, 3)); - aList.add(new ItemStack(aItem, 1, 4)); - - aList.add(new ItemStack(aItem, 1, 10)); - aList.add(new ItemStack(aItem, 1, 11)); - } -} diff --git a/gtpp/src/main/java/gtPlusPlus/xmod/gregtech/common/blocks/GregtechMetaCasingBlocks5.java b/gtpp/src/main/java/gtPlusPlus/xmod/gregtech/common/blocks/GregtechMetaCasingBlocks5.java deleted file mode 100644 index cc573cd188..0000000000 --- a/gtpp/src/main/java/gtPlusPlus/xmod/gregtech/common/blocks/GregtechMetaCasingBlocks5.java +++ /dev/null @@ -1,159 +0,0 @@ -package gtPlusPlus.xmod.gregtech.common.blocks; - -import net.minecraft.item.ItemStack; -import net.minecraft.util.IIcon; -import net.minecraft.world.IBlockAccess; - -import cpw.mods.fml.relauncher.Side; -import cpw.mods.fml.relauncher.SideOnly; -import gregtech.api.enums.TAE; -import gregtech.api.enums.Textures; -import gregtech.api.util.GT_LanguageManager; -import gregtech.common.blocks.GT_Material_Casings; -import gtPlusPlus.xmod.gregtech.api.enums.GregtechItemList; -import gtPlusPlus.xmod.gregtech.api.objects.GTPP_CopiedBlockTexture; -import gtPlusPlus.xmod.gregtech.common.blocks.textures.TexturesGrinderMultiblock; -import gtPlusPlus.xmod.gregtech.common.blocks.textures.TexturesGtBlock; - -public class GregtechMetaCasingBlocks5 extends GregtechMetaCasingBlocksAbstract { - - // Free Indexes within TAE: 91, 92, 94, 100, 101, 102, 103, 104, 114, 116, 117, 118, 119, 120, 121, 124, 125, 126, - // 127 - // 19 Free Indexes - private static final TexturesGrinderMultiblock mGrinderOverlayHandler = new TexturesGrinderMultiblock(); - - public GregtechMetaCasingBlocks5() { - super(GregtechMetaCasingItems.class, "gtplusplus.blockcasings.5", GT_Material_Casings.INSTANCE); - GT_LanguageManager.addStringLocalization(this.getUnlocalizedName() + ".0.name", "IsaMill Exterior Casing"); // IsaMill - // Casing - TAE.registerTexture(0, 2, new GTPP_CopiedBlockTexture(this, 6, 0)); - GT_LanguageManager.addStringLocalization(this.getUnlocalizedName() + ".1.name", "IsaMill Piping"); // IsaMill - // Pipe - GT_LanguageManager.addStringLocalization(this.getUnlocalizedName() + ".2.name", "IsaMill Gearbox"); // IsaMill - // Gearbox - GT_LanguageManager.addStringLocalization(this.getUnlocalizedName() + ".3.name", "Elemental Confinement Shell"); // Duplicator - // Casing - TAE.registerTexture(0, 3, new GTPP_CopiedBlockTexture(this, 6, 3)); - GT_LanguageManager.addStringLocalization(this.getUnlocalizedName() + ".4.name", "Sparge Tower Exterior Casing"); // Sparge - // Tower - // Casing - TAE.registerTexture(0, 4, new GTPP_CopiedBlockTexture(this, 6, 4)); - GT_LanguageManager.addStringLocalization(this.getUnlocalizedName() + ".5.name", "Sturdy Printer Casing"); // Unused - TAE.registerTexture(1, 10, new GTPP_CopiedBlockTexture(this, 6, 5)); - GT_LanguageManager.addStringLocalization(this.getUnlocalizedName() + ".6.name", "Forge Casing"); // Forge Hammer - // Casing - TAE.registerTexture(1, 11, new GTPP_CopiedBlockTexture(this, 6, 6)); - GT_LanguageManager.addStringLocalization(this.getUnlocalizedName() + ".7.name", "Neutron Pulse Manipulator"); - GT_LanguageManager.addStringLocalization(this.getUnlocalizedName() + ".8.name", "Cosmic Fabric Manipulator"); - GT_LanguageManager.addStringLocalization(this.getUnlocalizedName() + ".9.name", "Infinity Infused Manipulator"); - GT_LanguageManager.addStringLocalization(this.getUnlocalizedName() + ".10.name", "SpaceTime Continuum Ripper"); - GT_LanguageManager.addStringLocalization(this.getUnlocalizedName() + ".11.name", "Neutron Shielding Core"); - GT_LanguageManager - .addStringLocalization(this.getUnlocalizedName() + ".12.name", "Cosmic Fabric Shielding Core"); - GT_LanguageManager - .addStringLocalization(this.getUnlocalizedName() + ".13.name", "Infinity Infused Shielding Core"); - GT_LanguageManager.addStringLocalization(this.getUnlocalizedName() + ".14.name", "SpaceTime Bending Core"); - GT_LanguageManager.addStringLocalization(this.getUnlocalizedName() + ".15.name", "Force Field Glass"); - - GregtechItemList.Casing_IsaMill_Casing.set(new ItemStack(this, 1, 0)); - GregtechItemList.Casing_IsaMill_Pipe.set(new ItemStack(this, 1, 1)); - GregtechItemList.Casing_IsaMill_Gearbox.set(new ItemStack(this, 1, 2)); - GregtechItemList.Casing_ElementalDuplicator.set(new ItemStack(this, 1, 3)); - GregtechItemList.Casing_Sparge_Tower_Exterior.set(new ItemStack(this, 1, 4)); - GregtechItemList.Casing_IndustrialAutoChisel.set(new ItemStack(this, 1, 5)); - GregtechItemList.Casing_IndustrialForgeHammer.set(new ItemStack(this, 1, 6)); - GregtechItemList.NeutronPulseManipulator.set(new ItemStack(this, 1, 7)); - GregtechItemList.CosmicFabricManipulator.set(new ItemStack(this, 1, 8)); - GregtechItemList.InfinityInfusedManipulator.set(new ItemStack(this, 1, 9)); - GregtechItemList.SpaceTimeContinuumRipper.set(new ItemStack(this, 1, 10)); - GregtechItemList.NeutronShieldingCore.set(new ItemStack(this, 1, 11)); - GregtechItemList.CosmicFabricShieldingCore.set(new ItemStack(this, 1, 12)); - GregtechItemList.InfinityInfusedShieldingCore.set(new ItemStack(this, 1, 13)); - GregtechItemList.SpaceTimeBendingCore.set(new ItemStack(this, 1, 14)); - GregtechItemList.ForceFieldGlass.set(new ItemStack(this, 1, 15)); - } - - @Override - public IIcon getIcon(final int ordinalSide, final int aMeta) { - return getStaticIcon(ordinalSide, aMeta); - } - - public static IIcon getStaticIcon(final int ordinalSide, final int aMeta) { - if ((aMeta >= 0) && (aMeta < 16)) { - switch (aMeta) { - case 0 -> { - return TexturesGtBlock.TEXTURE_PIPE_GRINDING_MILL.getIcon(); - } - case 1 -> { - return TexturesGtBlock.TEXTURE_CASING_GRINDING_MILL.getIcon(); - } - case 2 -> { - return TexturesGtBlock.TEXTURE_GEARBOX_GRINDING_MILL.getIcon(); - } - case 3 -> { - return TexturesGtBlock.TEXTURE_TECH_PANEL_D.getIcon(); - } - case 4 -> { - return TexturesGtBlock.Casing_Machine_Metal_Sheet_H.getIcon(); - } - case 5 -> { - return TexturesGtBlock.Casing_Machine_Metal_Sheet_I.getIcon(); - } - case 6 -> { - return TexturesGtBlock.TEXTURE_TECH_PANEL_H.getIcon(); - } - case 7 -> { - if (ordinalSide == 0 || ordinalSide == 1) { - return TexturesGtBlock.Manipulator_Top.getIcon(); - } - return TexturesGtBlock.NeutronPulseManipulator.getIcon(); - } - case 8 -> { - if (ordinalSide == 0 || ordinalSide == 1) { - return TexturesGtBlock.Manipulator_Top.getIcon(); - } - return TexturesGtBlock.CosmicFabricManipulator.getIcon(); - } - case 9 -> { - if (ordinalSide == 0 || ordinalSide == 1) { - return TexturesGtBlock.Manipulator_Top.getIcon(); - } - return TexturesGtBlock.InfinityInfusedManipulator.getIcon(); - } - case 10 -> { - if (ordinalSide == 0 || ordinalSide == 1) { - return TexturesGtBlock.Manipulator_Top.getIcon(); - } - return TexturesGtBlock.SpaceTimeContinuumRipper.getIcon(); - } - case 11 -> { - return TexturesGtBlock.NeutronShieldingCore.getIcon(); - } - case 12 -> { - return TexturesGtBlock.CosmicFabricShieldingCore.getIcon(); - } - case 13 -> { - return TexturesGtBlock.InfinityInfusedShieldingCore.getIcon(); - } - case 14 -> { - return TexturesGtBlock.SpaceTimeBendingCore.getIcon(); - } - case 15 -> { - if (ordinalSide == 0 || ordinalSide == 1) { - return TexturesGtBlock.Blank.getIcon(); - } - return TexturesGtBlock.ForceFieldGlass.getIcon(); - } - } - } - return Textures.BlockIcons.RENDERING_ERROR.getIcon(); - } - - @Override - @SideOnly(Side.CLIENT) - public IIcon getIcon(final IBlockAccess aWorld, final int xCoord, final int yCoord, final int zCoord, - final int ordinalSide) { - final GregtechMetaCasingBlocks5 i = this; - return mGrinderOverlayHandler.handleCasingsGT(aWorld, xCoord, yCoord, zCoord, ordinalSide, i); - } -} diff --git a/gtpp/src/main/java/gtPlusPlus/xmod/gregtech/common/blocks/GregtechMetaCasingBlocks6.java b/gtpp/src/main/java/gtPlusPlus/xmod/gregtech/common/blocks/GregtechMetaCasingBlocks6.java deleted file mode 100644 index d257078461..0000000000 --- a/gtpp/src/main/java/gtPlusPlus/xmod/gregtech/common/blocks/GregtechMetaCasingBlocks6.java +++ /dev/null @@ -1,341 +0,0 @@ -package gtPlusPlus.xmod.gregtech.common.blocks; - -import java.util.List; - -import net.minecraft.block.Block; -import net.minecraft.creativetab.CreativeTabs; -import net.minecraft.entity.player.EntityPlayer; -import net.minecraft.item.Item; -import net.minecraft.item.ItemStack; -import net.minecraft.util.IIcon; -import net.minecraft.world.IBlockAccess; - -import cpw.mods.fml.relauncher.Side; -import cpw.mods.fml.relauncher.SideOnly; -import gregtech.api.enums.TAE; -import gregtech.api.util.GT_LanguageManager; -import gregtech.common.blocks.GT_Material_Casings; -import gtPlusPlus.xmod.gregtech.api.enums.GregtechItemList; -import gtPlusPlus.xmod.gregtech.api.objects.GTPP_CopiedBlockTexture; -import gtPlusPlus.xmod.gregtech.common.blocks.textures.CasingTextureHandler6; -import gtPlusPlus.xmod.gregtech.common.blocks.textures.TexturesGtBlock; - -public class GregtechMetaCasingBlocks6 extends GregtechMetaCasingBlocksAbstract { - - public static boolean mConnectedMachineTextures = false; - CasingTextureHandler6 TextureHandler = new CasingTextureHandler6(); - - @Override - public void getSubBlocks(Item aItem, CreativeTabs par2CreativeTabs, List aList) { - for (int i = 0; i < 3; i++) { - aList.add(new ItemStack(aItem, 1, i)); - } - } - - public static class GregtechMetaCasingItemBlocks3 extends GregtechMetaCasingItems { - - public GregtechMetaCasingItemBlocks3(Block par1) { - super(par1); - } - - @Override - public void addInformation(ItemStack aStack, EntityPlayer aPlayer, List aList, boolean aF3_H) { - super.addInformation(aStack, aPlayer, aList, aF3_H); - } - } - - public GregtechMetaCasingBlocks6() { - super(GregtechMetaCasingItemBlocks3.class, "gtplusplus.blockcasings.6", GT_Material_Casings.INSTANCE); - GT_LanguageManager.addStringLocalization(this.getUnlocalizedName() + ".0.name", "Fusion Machine Casing MK IV"); - TAE.registerTexture(3, 4, new GTPP_CopiedBlockTexture(this, 6, 0)); - GT_LanguageManager.addStringLocalization(this.getUnlocalizedName() + ".1.name", "Advanced Fusion Coil II"); - TAE.registerTexture(3, 5, new GTPP_CopiedBlockTexture(this, 6, 1)); - GT_LanguageManager.addStringLocalization(this.getUnlocalizedName() + ".2.name", "Unnamed"); - TAE.registerTexture(3, 6, new GTPP_CopiedBlockTexture(this, 6, 2)); - GregtechItemList.Casing_Fusion_External2.set(new ItemStack(this, 1, 0)); - GregtechItemList.Casing_Fusion_Internal2.set(new ItemStack(this, 1, 1)); - } - - @Override - public IIcon getIcon(final int ordinalSide, final int aMeta) { - return CasingTextureHandler6.getIcon(ordinalSide, aMeta); - } - - @SideOnly(Side.CLIENT) - @Override - public IIcon getIcon(final IBlockAccess aWorld, final int xCoord, final int yCoord, final int zCoord, - final int ordinalSide) { - final Block thisBlock = aWorld.getBlock(xCoord, yCoord, zCoord); - final int tMeta = aWorld.getBlockMetadata(xCoord, yCoord, zCoord); - if ((tMeta != 0) || !GregtechMetaCasingBlocks6.mConnectedMachineTextures) { - return getIcon(ordinalSide, tMeta); - } - final int tStartIndex = 0; - if (tMeta == 0) { - final boolean[] tConnectedSides = { - aWorld.getBlock(xCoord, yCoord - 1, zCoord) == thisBlock - && aWorld.getBlockMetadata(xCoord, yCoord - 1, zCoord) == tMeta, - aWorld.getBlock(xCoord, yCoord + 1, zCoord) == thisBlock - && aWorld.getBlockMetadata(xCoord, yCoord + 1, zCoord) == tMeta, - aWorld.getBlock(xCoord + 1, yCoord, zCoord) == thisBlock - && aWorld.getBlockMetadata(xCoord + 1, yCoord, zCoord) == tMeta, - aWorld.getBlock(xCoord, yCoord, zCoord + 1) == thisBlock - && aWorld.getBlockMetadata(xCoord, yCoord, zCoord + 1) == tMeta, - aWorld.getBlock(xCoord - 1, yCoord, zCoord) == thisBlock - && aWorld.getBlockMetadata(xCoord - 1, yCoord, zCoord) == tMeta, - aWorld.getBlock(xCoord, yCoord, zCoord - 1) == thisBlock - && aWorld.getBlockMetadata(xCoord, yCoord, zCoord - 1) == tMeta }; - switch (ordinalSide) { - case 0: { - if (tConnectedSides[0]) { - return TexturesGtBlock.CONNECTED_FUSION_HULLS_MK4[tStartIndex + 7].getIcon(); - } - if (tConnectedSides[4] && tConnectedSides[5] && tConnectedSides[2] && tConnectedSides[3]) { - return TexturesGtBlock.CONNECTED_FUSION_HULLS_MK4[tStartIndex + 6].getIcon(); - } - if (!tConnectedSides[4] && tConnectedSides[5] && tConnectedSides[2] && tConnectedSides[3]) { - return TexturesGtBlock.CONNECTED_FUSION_HULLS_MK4[tStartIndex + 2].getIcon(); - } - if (tConnectedSides[4] && !tConnectedSides[5] && tConnectedSides[2] && tConnectedSides[3]) { - return TexturesGtBlock.CONNECTED_FUSION_HULLS_MK4[tStartIndex + 3].getIcon(); - } - if (tConnectedSides[4] && tConnectedSides[5] && !tConnectedSides[2] && tConnectedSides[3]) { - return TexturesGtBlock.CONNECTED_FUSION_HULLS_MK4[tStartIndex + 4].getIcon(); - } - if (tConnectedSides[4] && tConnectedSides[5] && tConnectedSides[2] && !tConnectedSides[3]) { - return TexturesGtBlock.CONNECTED_FUSION_HULLS_MK4[tStartIndex + 5].getIcon(); - } - if (!tConnectedSides[4] && !tConnectedSides[5] && tConnectedSides[2] && tConnectedSides[3]) { - return TexturesGtBlock.CONNECTED_FUSION_HULLS_MK4[tStartIndex + 8].getIcon(); - } - if (tConnectedSides[4] && !tConnectedSides[5] && !tConnectedSides[2] && tConnectedSides[3]) { - return TexturesGtBlock.CONNECTED_FUSION_HULLS_MK4[tStartIndex + 9].getIcon(); - } - if (tConnectedSides[4] && tConnectedSides[5] && !tConnectedSides[2] && !tConnectedSides[3]) { - return TexturesGtBlock.CONNECTED_FUSION_HULLS_MK4[tStartIndex + 10].getIcon(); - } - if (!tConnectedSides[4] && tConnectedSides[5] && tConnectedSides[2] && !tConnectedSides[3]) { - return TexturesGtBlock.CONNECTED_FUSION_HULLS_MK4[tStartIndex + 11].getIcon(); - } - if (!tConnectedSides[4] && !tConnectedSides[5] && !tConnectedSides[2] && !tConnectedSides[3]) { - return TexturesGtBlock.CONNECTED_FUSION_HULLS_MK4[tStartIndex + 7].getIcon(); - } - if (!tConnectedSides[4] && !tConnectedSides[2]) { - return TexturesGtBlock.CONNECTED_FUSION_HULLS_MK4[tStartIndex + 1].getIcon(); - } - if (!tConnectedSides[5] && !tConnectedSides[3]) { - return TexturesGtBlock.CONNECTED_FUSION_HULLS_MK4[tStartIndex + 0].getIcon(); - } - } - case 1: { - if (tConnectedSides[1]) { - return TexturesGtBlock.CONNECTED_FUSION_HULLS_MK4[tStartIndex + 7].getIcon(); - } - if (tConnectedSides[4] && tConnectedSides[5] && tConnectedSides[2] && tConnectedSides[3]) { - return TexturesGtBlock.CONNECTED_FUSION_HULLS_MK4[tStartIndex + 6].getIcon(); - } - if (!tConnectedSides[4] && tConnectedSides[5] && tConnectedSides[2] && tConnectedSides[3]) { - return TexturesGtBlock.CONNECTED_FUSION_HULLS_MK4[tStartIndex + 2].getIcon(); - } - if (tConnectedSides[4] && !tConnectedSides[5] && tConnectedSides[2] && tConnectedSides[3]) { - return TexturesGtBlock.CONNECTED_FUSION_HULLS_MK4[tStartIndex + 3].getIcon(); - } - if (tConnectedSides[4] && tConnectedSides[5] && !tConnectedSides[2] && tConnectedSides[3]) { - return TexturesGtBlock.CONNECTED_FUSION_HULLS_MK4[tStartIndex + 4].getIcon(); - } - if (tConnectedSides[4] && tConnectedSides[5] && tConnectedSides[2] && !tConnectedSides[3]) { - return TexturesGtBlock.CONNECTED_FUSION_HULLS_MK4[tStartIndex + 5].getIcon(); - } - if (!tConnectedSides[4] && !tConnectedSides[5] && tConnectedSides[2] && tConnectedSides[3]) { - return TexturesGtBlock.CONNECTED_FUSION_HULLS_MK4[tStartIndex + 8].getIcon(); - } - if (tConnectedSides[4] && !tConnectedSides[5] && !tConnectedSides[2] && tConnectedSides[3]) { - return TexturesGtBlock.CONNECTED_FUSION_HULLS_MK4[tStartIndex + 9].getIcon(); - } - if (tConnectedSides[4] && tConnectedSides[5] && !tConnectedSides[2] && !tConnectedSides[3]) { - return TexturesGtBlock.CONNECTED_FUSION_HULLS_MK4[tStartIndex + 10].getIcon(); - } - if (!tConnectedSides[4] && tConnectedSides[5] && tConnectedSides[2] && !tConnectedSides[3]) { - return TexturesGtBlock.CONNECTED_FUSION_HULLS_MK4[tStartIndex + 11].getIcon(); - } - if (!tConnectedSides[4] && !tConnectedSides[5] && !tConnectedSides[2] && !tConnectedSides[3]) { - return TexturesGtBlock.CONNECTED_FUSION_HULLS_MK4[tStartIndex + 7].getIcon(); - } - if (!tConnectedSides[2] && !tConnectedSides[4]) { - return TexturesGtBlock.CONNECTED_FUSION_HULLS_MK4[tStartIndex + 1].getIcon(); - } - if (!tConnectedSides[3] && !tConnectedSides[5]) { - return TexturesGtBlock.CONNECTED_FUSION_HULLS_MK4[tStartIndex + 0].getIcon(); - } - } - case 2: { - if (tConnectedSides[5]) { - return TexturesGtBlock.CONNECTED_FUSION_HULLS_MK4[tStartIndex + 7].getIcon(); - } - if (tConnectedSides[2] && tConnectedSides[0] && tConnectedSides[4] && tConnectedSides[1]) { - return TexturesGtBlock.CONNECTED_FUSION_HULLS_MK4[tStartIndex + 6].getIcon(); - } - if (!tConnectedSides[2] && tConnectedSides[0] && tConnectedSides[4] && tConnectedSides[1]) { - return TexturesGtBlock.CONNECTED_FUSION_HULLS_MK4[tStartIndex + 2].getIcon(); - } - if (tConnectedSides[2] && !tConnectedSides[0] && tConnectedSides[4] && tConnectedSides[1]) { - return TexturesGtBlock.CONNECTED_FUSION_HULLS_MK4[tStartIndex + 5].getIcon(); - } - if (tConnectedSides[2] && tConnectedSides[0] && !tConnectedSides[4] && tConnectedSides[1]) { - return TexturesGtBlock.CONNECTED_FUSION_HULLS_MK4[tStartIndex + 4].getIcon(); - } - if (tConnectedSides[2] && tConnectedSides[0] && tConnectedSides[4] && !tConnectedSides[1]) { - return TexturesGtBlock.CONNECTED_FUSION_HULLS_MK4[tStartIndex + 3].getIcon(); - } - if (!tConnectedSides[2] && !tConnectedSides[0] && tConnectedSides[4] && tConnectedSides[1]) { - return TexturesGtBlock.CONNECTED_FUSION_HULLS_MK4[tStartIndex + 11].getIcon(); - } - if (tConnectedSides[2] && !tConnectedSides[0] && !tConnectedSides[4] && tConnectedSides[1]) { - return TexturesGtBlock.CONNECTED_FUSION_HULLS_MK4[tStartIndex + 10].getIcon(); - } - if (tConnectedSides[2] && tConnectedSides[0] && !tConnectedSides[4] && !tConnectedSides[1]) { - return TexturesGtBlock.CONNECTED_FUSION_HULLS_MK4[tStartIndex + 9].getIcon(); - } - if (!tConnectedSides[2] && tConnectedSides[0] && tConnectedSides[4] && !tConnectedSides[1]) { - return TexturesGtBlock.CONNECTED_FUSION_HULLS_MK4[tStartIndex + 8].getIcon(); - } - if (!tConnectedSides[2] && !tConnectedSides[0] && !tConnectedSides[4] && !tConnectedSides[1]) { - return TexturesGtBlock.CONNECTED_FUSION_HULLS_MK4[tStartIndex + 7].getIcon(); - } - if (!tConnectedSides[2] && !tConnectedSides[4]) { - return TexturesGtBlock.CONNECTED_FUSION_HULLS_MK4[tStartIndex + 1].getIcon(); - } - if (!tConnectedSides[0] && !tConnectedSides[1]) { - return TexturesGtBlock.CONNECTED_FUSION_HULLS_MK4[tStartIndex + 0].getIcon(); - } - } - case 3: { - if (tConnectedSides[3]) { - return TexturesGtBlock.CONNECTED_FUSION_HULLS_MK4[tStartIndex + 7].getIcon(); - } - if (tConnectedSides[2] && tConnectedSides[0] && tConnectedSides[4] && tConnectedSides[1]) { - return TexturesGtBlock.CONNECTED_FUSION_HULLS_MK4[tStartIndex + 6].getIcon(); - } - if (!tConnectedSides[2] && tConnectedSides[0] && tConnectedSides[4] && tConnectedSides[1]) { - return TexturesGtBlock.CONNECTED_FUSION_HULLS_MK4[tStartIndex + 4].getIcon(); - } - if (tConnectedSides[2] && !tConnectedSides[0] && tConnectedSides[4] && tConnectedSides[1]) { - return TexturesGtBlock.CONNECTED_FUSION_HULLS_MK4[tStartIndex + 5].getIcon(); - } - if (tConnectedSides[2] && tConnectedSides[0] && !tConnectedSides[4] && tConnectedSides[1]) { - return TexturesGtBlock.CONNECTED_FUSION_HULLS_MK4[tStartIndex + 2].getIcon(); - } - if (tConnectedSides[2] && tConnectedSides[0] && tConnectedSides[4] && !tConnectedSides[1]) { - return TexturesGtBlock.CONNECTED_FUSION_HULLS_MK4[tStartIndex + 3].getIcon(); - } - if (!tConnectedSides[2] && !tConnectedSides[0] && tConnectedSides[4] && tConnectedSides[1]) { - return TexturesGtBlock.CONNECTED_FUSION_HULLS_MK4[tStartIndex + 10].getIcon(); - } - if (tConnectedSides[2] && !tConnectedSides[0] && !tConnectedSides[4] && tConnectedSides[1]) { - return TexturesGtBlock.CONNECTED_FUSION_HULLS_MK4[tStartIndex + 11].getIcon(); - } - if (tConnectedSides[2] && tConnectedSides[0] && !tConnectedSides[4] && !tConnectedSides[1]) { - return TexturesGtBlock.CONNECTED_FUSION_HULLS_MK4[tStartIndex + 8].getIcon(); - } - if (!tConnectedSides[2] && tConnectedSides[0] && tConnectedSides[4] && !tConnectedSides[1]) { - return TexturesGtBlock.CONNECTED_FUSION_HULLS_MK4[tStartIndex + 9].getIcon(); - } - if (!tConnectedSides[2] && !tConnectedSides[0] && !tConnectedSides[4] && !tConnectedSides[1]) { - return TexturesGtBlock.CONNECTED_FUSION_HULLS_MK4[tStartIndex + 7].getIcon(); - } - if (!tConnectedSides[2] && !tConnectedSides[4]) { - return TexturesGtBlock.CONNECTED_FUSION_HULLS_MK4[tStartIndex + 1].getIcon(); - } - if (!tConnectedSides[0] && !tConnectedSides[1]) { - return TexturesGtBlock.CONNECTED_FUSION_HULLS_MK4[tStartIndex + 0].getIcon(); - } - } - case 4: { - if (tConnectedSides[4]) { - return TexturesGtBlock.CONNECTED_FUSION_HULLS_MK4[tStartIndex + 7].getIcon(); - } - if (tConnectedSides[0] && tConnectedSides[3] && tConnectedSides[1] && tConnectedSides[5]) { - return TexturesGtBlock.CONNECTED_FUSION_HULLS_MK4[tStartIndex + 6].getIcon(); - } - if (!tConnectedSides[0] && tConnectedSides[3] && tConnectedSides[1] && tConnectedSides[5]) { - return TexturesGtBlock.CONNECTED_FUSION_HULLS_MK4[tStartIndex + 5].getIcon(); - } - if (tConnectedSides[0] && !tConnectedSides[3] && tConnectedSides[1] && tConnectedSides[5]) { - return TexturesGtBlock.CONNECTED_FUSION_HULLS_MK4[tStartIndex + 4].getIcon(); - } - if (tConnectedSides[0] && tConnectedSides[3] && !tConnectedSides[1] && tConnectedSides[5]) { - return TexturesGtBlock.CONNECTED_FUSION_HULLS_MK4[tStartIndex + 3].getIcon(); - } - if (tConnectedSides[0] && tConnectedSides[3] && tConnectedSides[1] && !tConnectedSides[5]) { - return TexturesGtBlock.CONNECTED_FUSION_HULLS_MK4[tStartIndex + 2].getIcon(); - } - if (!tConnectedSides[0] && !tConnectedSides[3] && tConnectedSides[1] && tConnectedSides[5]) { - return TexturesGtBlock.CONNECTED_FUSION_HULLS_MK4[tStartIndex + 10].getIcon(); - } - if (tConnectedSides[0] && !tConnectedSides[3] && !tConnectedSides[1] && tConnectedSides[5]) { - return TexturesGtBlock.CONNECTED_FUSION_HULLS_MK4[tStartIndex + 9].getIcon(); - } - if (tConnectedSides[0] && tConnectedSides[3] && !tConnectedSides[1] && !tConnectedSides[5]) { - return TexturesGtBlock.CONNECTED_FUSION_HULLS_MK4[tStartIndex + 8].getIcon(); - } - if (!tConnectedSides[0] && tConnectedSides[3] && tConnectedSides[1] && !tConnectedSides[5]) { - return TexturesGtBlock.CONNECTED_FUSION_HULLS_MK4[tStartIndex + 11].getIcon(); - } - if (!tConnectedSides[0] && !tConnectedSides[3] && !tConnectedSides[1] && !tConnectedSides[5]) { - return TexturesGtBlock.CONNECTED_FUSION_HULLS_MK4[tStartIndex + 7].getIcon(); - } - if (!tConnectedSides[0] && !tConnectedSides[1]) { - return TexturesGtBlock.CONNECTED_FUSION_HULLS_MK4[tStartIndex + 0].getIcon(); - } - if (!tConnectedSides[3] && !tConnectedSides[5]) { - return TexturesGtBlock.CONNECTED_FUSION_HULLS_MK4[tStartIndex + 1].getIcon(); - } - } - case 5: { - if (tConnectedSides[2]) { - return TexturesGtBlock.CONNECTED_FUSION_HULLS_MK4[tStartIndex + 7].getIcon(); - } - if (tConnectedSides[0] && tConnectedSides[3] && tConnectedSides[1] && tConnectedSides[5]) { - return TexturesGtBlock.CONNECTED_FUSION_HULLS_MK4[tStartIndex + 6].getIcon(); - } - if (!tConnectedSides[0] && tConnectedSides[3] && tConnectedSides[1] && tConnectedSides[5]) { - return TexturesGtBlock.CONNECTED_FUSION_HULLS_MK4[tStartIndex + 5].getIcon(); - } - if (tConnectedSides[0] && !tConnectedSides[3] && tConnectedSides[1] && tConnectedSides[5]) { - return TexturesGtBlock.CONNECTED_FUSION_HULLS_MK4[tStartIndex + 2].getIcon(); - } - if (tConnectedSides[0] && tConnectedSides[3] && !tConnectedSides[1] && tConnectedSides[5]) { - return TexturesGtBlock.CONNECTED_FUSION_HULLS_MK4[tStartIndex + 3].getIcon(); - } - if (tConnectedSides[0] && tConnectedSides[3] && tConnectedSides[1] && !tConnectedSides[5]) { - return TexturesGtBlock.CONNECTED_FUSION_HULLS_MK4[tStartIndex + 4].getIcon(); - } - if (!tConnectedSides[0] && !tConnectedSides[3] && tConnectedSides[1] && tConnectedSides[5]) { - return TexturesGtBlock.CONNECTED_FUSION_HULLS_MK4[tStartIndex + 11].getIcon(); - } - if (tConnectedSides[0] && !tConnectedSides[3] && !tConnectedSides[1] && tConnectedSides[5]) { - return TexturesGtBlock.CONNECTED_FUSION_HULLS_MK4[tStartIndex + 8].getIcon(); - } - if (tConnectedSides[0] && tConnectedSides[3] && !tConnectedSides[1] && !tConnectedSides[5]) { - return TexturesGtBlock.CONNECTED_FUSION_HULLS_MK4[tStartIndex + 9].getIcon(); - } - if (!tConnectedSides[0] && tConnectedSides[3] && tConnectedSides[1] && !tConnectedSides[5]) { - return TexturesGtBlock.CONNECTED_FUSION_HULLS_MK4[tStartIndex + 10].getIcon(); - } - if (!tConnectedSides[0] && !tConnectedSides[3] && !tConnectedSides[1] && !tConnectedSides[5]) { - return TexturesGtBlock.CONNECTED_FUSION_HULLS_MK4[tStartIndex + 7].getIcon(); - } - if (!tConnectedSides[0] && !tConnectedSides[1]) { - return TexturesGtBlock.CONNECTED_FUSION_HULLS_MK4[tStartIndex + 0].getIcon(); - } - if (!tConnectedSides[3] && !tConnectedSides[5]) { - return TexturesGtBlock.CONNECTED_FUSION_HULLS_MK4[tStartIndex + 1].getIcon(); - } - break; - } - } - return TexturesGtBlock.CONNECTED_FUSION_HULLS_MK4[tStartIndex + 7].getIcon(); - } - return CasingTextureHandler6.getIcon(ordinalSide, tMeta); - } -} diff --git a/gtpp/src/main/java/gtPlusPlus/xmod/gregtech/common/blocks/GregtechMetaCasingBlocksAbstract.java b/gtpp/src/main/java/gtPlusPlus/xmod/gregtech/common/blocks/GregtechMetaCasingBlocksAbstract.java deleted file mode 100644 index a87f6c92b3..0000000000 --- a/gtpp/src/main/java/gtPlusPlus/xmod/gregtech/common/blocks/GregtechMetaCasingBlocksAbstract.java +++ /dev/null @@ -1,151 +0,0 @@ -package gtPlusPlus.xmod.gregtech.common.blocks; - -import java.util.List; -import java.util.Random; - -import net.minecraft.block.Block; -import net.minecraft.block.material.Material; -import net.minecraft.client.renderer.texture.IIconRegister; -import net.minecraft.creativetab.CreativeTabs; -import net.minecraft.entity.Entity; -import net.minecraft.entity.EnumCreatureType; -import net.minecraft.init.Blocks; -import net.minecraft.item.Item; -import net.minecraft.item.ItemBlock; -import net.minecraft.item.ItemStack; -import net.minecraft.util.StatCollector; -import net.minecraft.world.IBlockAccess; -import net.minecraft.world.World; - -import cpw.mods.fml.relauncher.Side; -import cpw.mods.fml.relauncher.SideOnly; -import gregtech.api.GregTech_API; -import gregtech.api.util.GT_LanguageManager; -import gregtech.common.blocks.GT_Block_Casings_Abstract; -import gtPlusPlus.core.creative.AddToCreativeTab; - -public abstract class GregtechMetaCasingBlocksAbstract extends GT_Block_Casings_Abstract { - - public GregtechMetaCasingBlocksAbstract(final Class<? extends ItemBlock> aItemClass, final String aName, - final Material aMaterial) { - super(aItemClass, aName, aMaterial); - this.setStepSound(soundTypeMetal); - this.setCreativeTab(AddToCreativeTab.tabMachines); - GregTech_API.registerMachineBlock(this, -1); - GT_LanguageManager - .addStringLocalization(this.getUnlocalizedName() + "." + 32767 + ".name", "Any Sub Block of this"); - } - - @Override - public String getHarvestTool(final int aMeta) { - return "wrench"; - } - - @Override - public int getHarvestLevel(final int aMeta) { - return 2; - } - - @Override - public float getBlockHardness(final World aWorld, final int aX, final int aY, final int aZ) { - return Blocks.iron_block.getBlockHardness(aWorld, aX, aY, aZ); - } - - @Override - public float getExplosionResistance(final Entity aTNT) { - return Blocks.iron_block.getExplosionResistance(aTNT); - } - - @Override - protected boolean canSilkHarvest() { - return false; - } - - @Override - public void onBlockAdded(final World aWorld, final int aX, final int aY, final int aZ) { - if (GregTech_API.isMachineBlock(this, aWorld.getBlockMetadata(aX, aY, aZ))) { - GregTech_API.causeMachineUpdate(aWorld, aX, aY, aZ); - } - } - - @Override - public String getUnlocalizedName() { - return this.mUnlocalizedName; - } - - @Override - public String getLocalizedName() { - return StatCollector.translateToLocal(this.mUnlocalizedName + ".name"); - } - - @Override - public boolean canBeReplacedByLeaves(final IBlockAccess aWorld, final int aX, final int aY, final int aZ) { - return false; - } - - @Override - public boolean isNormalCube(final IBlockAccess aWorld, final int aX, final int aY, final int aZ) { - return true; - } - - @Override - public boolean renderAsNormalBlock() { - return true; - } - - @Override - public boolean isOpaqueCube() { - return false; - } - - @Override - public int getRenderBlockPass() { - return 0; - } - - @Override - public void breakBlock(final World aWorld, final int aX, final int aY, final int aZ, final Block aBlock, - final int aMetaData) { - if (GregTech_API.isMachineBlock(this, aWorld.getBlockMetadata(aX, aY, aZ))) { - GregTech_API.causeMachineUpdate(aWorld, aX, aY, aZ); - } - } - - @Override - public boolean canCreatureSpawn(final EnumCreatureType type, final IBlockAccess world, final int x, final int y, - final int z) { - return false; - } - - @Override - public int damageDropped(final int par1) { - return par1; - } - - @Override - public int getDamageValue(final World par1World, final int par2, final int par3, final int par4) { - return par1World.getBlockMetadata(par2, par3, par4); - } - - @Override - public int quantityDropped(final Random par1Random) { - return 1; - } - - @Override - public Item getItemDropped(final int par1, final Random par2Random, final int par3) { - return Item.getItemFromBlock(this); - } - - @Override - @SideOnly(Side.CLIENT) - public void registerBlockIcons(final IIconRegister aIconRegister) {} - - @Override - @SideOnly(Side.CLIENT) - public void getSubBlocks(final Item aItem, final CreativeTabs par2CreativeTabs, final List aList) { - for (int i = 0; i < 16; i++) { - aList.add(new ItemStack(aItem, 1, i)); - } - } -} diff --git a/gtpp/src/main/java/gtPlusPlus/xmod/gregtech/common/blocks/GregtechMetaCasingBlocksPipeGearbox.java b/gtpp/src/main/java/gtPlusPlus/xmod/gregtech/common/blocks/GregtechMetaCasingBlocksPipeGearbox.java deleted file mode 100644 index ad2b11f924..0000000000 --- a/gtpp/src/main/java/gtPlusPlus/xmod/gregtech/common/blocks/GregtechMetaCasingBlocksPipeGearbox.java +++ /dev/null @@ -1,91 +0,0 @@ -package gtPlusPlus.xmod.gregtech.common.blocks; - -import java.util.HashMap; - -import net.minecraft.util.IIcon; -import net.minecraft.world.IBlockAccess; - -import cpw.mods.fml.relauncher.Side; -import cpw.mods.fml.relauncher.SideOnly; -import gregtech.api.enums.Textures; -import gregtech.api.util.GT_LanguageManager; -import gregtech.common.blocks.GT_Material_Casings; -import gtPlusPlus.core.material.ALLOY; -import gtPlusPlus.xmod.gregtech.common.blocks.textures.TexturesGtBlock; - -public class GregtechMetaCasingBlocksPipeGearbox extends GregtechMetaCasingBlocksAbstract { - - private static HashMap<Integer, Integer> sMaterialMapping = new HashMap<>(); - - public GregtechMetaCasingBlocksPipeGearbox() { - super(GregtechMetaCasingItems.class, "gtplusplus.blockcasings.pipesgears", GT_Material_Casings.INSTANCE); - GT_LanguageManager.addStringLocalization(this.getUnlocalizedName() + ".0.name", "Eglin Steel Gear Box Casing"); - GT_LanguageManager.addStringLocalization(this.getUnlocalizedName() + ".1.name", "Inconel-792 Gear Box Casing"); - GT_LanguageManager - .addStringLocalization(this.getUnlocalizedName() + ".2.name", "Incoloy MA956 Gear Box Casing"); - GT_LanguageManager.addStringLocalization(this.getUnlocalizedName() + ".3.name", "Nitinol-60 Gear Box Casing"); - GT_LanguageManager.addStringLocalization(this.getUnlocalizedName() + ".4.name", "Zeron-100 Gear Box Casing"); - GT_LanguageManager.addStringLocalization(this.getUnlocalizedName() + ".5.name", "Pikyonium Gear Box Casing"); - GT_LanguageManager.addStringLocalization(this.getUnlocalizedName() + ".6.name", "Titansteel Gear Box Casing"); - GT_LanguageManager.addStringLocalization(this.getUnlocalizedName() + ".7.name", "Abyssal Gear Box Casing"); - GT_LanguageManager.addStringLocalization(this.getUnlocalizedName() + ".8.name", "Babbit Alloy Pipe Casing"); - GT_LanguageManager.addStringLocalization(this.getUnlocalizedName() + ".9.name", "Inconel-690 Pipe Casing"); - GT_LanguageManager.addStringLocalization(this.getUnlocalizedName() + ".10.name", "Stellite Pipe Casing"); - GT_LanguageManager.addStringLocalization(this.getUnlocalizedName() + ".11.name", "Nitinol-60 Pipe Casing"); - GT_LanguageManager.addStringLocalization(this.getUnlocalizedName() + ".12.name", "Lafium Pipe Casing"); - GT_LanguageManager.addStringLocalization(this.getUnlocalizedName() + ".13.name", "Cinobite Pipe Casing"); - GT_LanguageManager.addStringLocalization(this.getUnlocalizedName() + ".14.name", "Titansteel Pipe Casing"); - GT_LanguageManager.addStringLocalization(this.getUnlocalizedName() + ".15.name", "Abyssal Pipe Casing"); - - int aMappingID = 0; - sMaterialMapping.put(aMappingID++, ALLOY.EGLIN_STEEL.getRgbAsHex()); - sMaterialMapping.put(aMappingID++, ALLOY.INCONEL_792.getRgbAsHex()); - sMaterialMapping.put(aMappingID++, ALLOY.INCOLOY_MA956.getRgbAsHex()); - sMaterialMapping.put(aMappingID++, ALLOY.NITINOL_60.getRgbAsHex()); - sMaterialMapping.put(aMappingID++, ALLOY.ZERON_100.getRgbAsHex()); - sMaterialMapping.put(aMappingID++, ALLOY.PIKYONIUM.getRgbAsHex()); - sMaterialMapping.put(aMappingID++, ALLOY.TITANSTEEL.getRgbAsHex()); - sMaterialMapping.put(aMappingID++, ALLOY.ABYSSAL.getRgbAsHex()); - sMaterialMapping.put(aMappingID++, ALLOY.BABBIT_ALLOY.getRgbAsHex()); - sMaterialMapping.put(aMappingID++, ALLOY.INCONEL_690.getRgbAsHex()); - sMaterialMapping.put(aMappingID++, ALLOY.STELLITE.getRgbAsHex()); - sMaterialMapping.put(aMappingID++, ALLOY.NITINOL_60.getRgbAsHex()); - sMaterialMapping.put(aMappingID++, ALLOY.LAFIUM.getRgbAsHex()); - sMaterialMapping.put(aMappingID++, ALLOY.CINOBITE.getRgbAsHex()); - sMaterialMapping.put(aMappingID++, ALLOY.TITANSTEEL.getRgbAsHex()); - sMaterialMapping.put(aMappingID++, ALLOY.ABYSSAL.getRgbAsHex()); - } - - @Override - public IIcon getIcon(final int ordinalSide, final int meta) { - if ((meta >= 0) && (meta < 16)) { - switch (meta) { - case 0, 1, 2, 3, 4, 5, 6, 7 -> { - return TexturesGtBlock.TEXTURE_GEARBOX_GENERIC.getIcon(); - } - case 8, 9, 10, 11, 12, 13, 14, 15 -> { - return TexturesGtBlock.TEXTURE_PIPE_GENERIC.getIcon(); - } - } - } - return Textures.BlockIcons.RENDERING_ERROR.getIcon(); - } - - @SideOnly(Side.CLIENT) - @Override - public int colorMultiplier(final IBlockAccess par1IBlockAccess, final int par2, final int par3, final int par4) { - return sMaterialMapping.get(par1IBlockAccess.getBlockMetadata(par2, par3, par4)); - } - - @SideOnly(Side.CLIENT) - @Override - public int getRenderColor(final int aMeta) { - return sMaterialMapping.get(aMeta); - } - - @SideOnly(Side.CLIENT) - @Override - public int getBlockColor() { - return super.getBlockColor(); - } -} diff --git a/gtpp/src/main/java/gtPlusPlus/xmod/gregtech/common/blocks/GregtechMetaCasingItems.java b/gtpp/src/main/java/gtPlusPlus/xmod/gregtech/common/blocks/GregtechMetaCasingItems.java deleted file mode 100644 index f86c6af265..0000000000 --- a/gtpp/src/main/java/gtPlusPlus/xmod/gregtech/common/blocks/GregtechMetaCasingItems.java +++ /dev/null @@ -1,10 +0,0 @@ -package gtPlusPlus.xmod.gregtech.common.blocks; - -import net.minecraft.block.Block; - -public class GregtechMetaCasingItems extends GregtechMetaItemCasingsAbstract { - - public GregtechMetaCasingItems(final Block par1) { - super(par1); - } -} diff --git a/gtpp/src/main/java/gtPlusPlus/xmod/gregtech/common/blocks/GregtechMetaItemCasingsAbstract.java b/gtpp/src/main/java/gtPlusPlus/xmod/gregtech/common/blocks/GregtechMetaItemCasingsAbstract.java deleted file mode 100644 index 23d9ab5007..0000000000 --- a/gtpp/src/main/java/gtPlusPlus/xmod/gregtech/common/blocks/GregtechMetaItemCasingsAbstract.java +++ /dev/null @@ -1,67 +0,0 @@ -package gtPlusPlus.xmod.gregtech.common.blocks; - -import java.util.List; - -import net.minecraft.block.Block; -import net.minecraft.entity.player.EntityPlayer; -import net.minecraft.item.ItemBlock; -import net.minecraft.item.ItemStack; - -import gregtech.api.util.GT_LanguageManager; - -public abstract class GregtechMetaItemCasingsAbstract extends ItemBlock { - - protected final String mCasing_Centrifuge = GT_LanguageManager - .addStringLocalization("mu.centrifugecasing", "Warning! Standing in the Centrifuge not recommended"); - protected final String mCasing_CokeOven = GT_LanguageManager - .addStringLocalization("mu.cokeoven", "Sturdy and Strong"); - protected final String mCasing_CokeCoil1 = GT_LanguageManager - .addStringLocalization("mu.coil01tooltip", "Base Heating Capacity = 1350 Kelvin"); - protected final String mCasing_CokeCoil2 = GT_LanguageManager - .addStringLocalization("mu.coil02tooltip", "Base Heating Capacity = 2275 Kelvin"); - protected final String mNoMobsToolTip = GT_LanguageManager - .addStringLocalization("gt.nomobspawnsonthisblock", "Mobs cannot Spawn on this Block"); - protected final String mNoTileEntityToolTip = GT_LanguageManager - .addStringLocalization("gt.notileentityinthisblock", "This is NOT a TileEntity!"); - - public GregtechMetaItemCasingsAbstract(final Block par1) { - super(par1); - this.setMaxDamage(0); - this.setHasSubtypes(true); - // setCreativeTab(AddToCreativeTab.tabMachines); - } - - @Override - public int getMetadata(final int aMeta) { - return aMeta; - } - - @Override - public String getUnlocalizedName(final ItemStack aStack) { - return this.field_150939_a.getUnlocalizedName() + "." + this.getDamage(aStack); - } - - @Override - public void addInformation(final ItemStack aStack, final EntityPlayer aPlayer, final List aList, - final boolean aF3_H) { - super.addInformation(aStack, aPlayer, aList, aF3_H); - switch (this.getDamage(aStack)) { - case 0: - // aList.add(this.mCasing_Centrifuge); - break; - case 1: - // aList.add(this.mCasing_CokeOven); - break; - case 2: - // aList.add(this.mCasing_CokeCoil1); - break; - case 3: - // aList.add(this.mCasing_CokeCoil2); - break; - default: - break; - } - aList.add(this.mNoMobsToolTip); - aList.add(this.mNoTileEntityToolTip); - } -} diff --git a/gtpp/src/main/java/gtPlusPlus/xmod/gregtech/common/blocks/GregtechMetaSpecialMachineCasings.java b/gtpp/src/main/java/gtPlusPlus/xmod/gregtech/common/blocks/GregtechMetaSpecialMachineCasings.java deleted file mode 100644 index 473c13f3da..0000000000 --- a/gtpp/src/main/java/gtPlusPlus/xmod/gregtech/common/blocks/GregtechMetaSpecialMachineCasings.java +++ /dev/null @@ -1,76 +0,0 @@ -package gtPlusPlus.xmod.gregtech.common.blocks; - -import java.util.List; - -import net.minecraft.block.Block; -import net.minecraft.creativetab.CreativeTabs; -import net.minecraft.entity.player.EntityPlayer; -import net.minecraft.item.Item; -import net.minecraft.item.ItemStack; -import net.minecraft.util.IIcon; - -import gregtech.api.enums.TAE; -import gregtech.api.enums.Textures; -import gregtech.api.util.GT_LanguageManager; -import gregtech.common.blocks.GT_Material_Casings; -import gtPlusPlus.xmod.gregtech.api.enums.GregtechItemList; -import gtPlusPlus.xmod.gregtech.api.objects.GTPP_CopiedBlockTexture; -import gtPlusPlus.xmod.gregtech.common.blocks.textures.TexturesGtBlock; - -public class GregtechMetaSpecialMachineCasings extends GregtechMetaCasingBlocksAbstract { - - @Override - public void getSubBlocks(Item aItem, CreativeTabs par2CreativeTabs, List aList) { - for (int i = 0; i < 4; i++) { - aList.add(new ItemStack(aItem, 1, i)); - } - } - - public static class SpecialCasingItemBlock extends GregtechMetaCasingItems { - - public SpecialCasingItemBlock(Block par1) { - super(par1); - } - - @Override - public void addInformation(ItemStack aStack, EntityPlayer aPlayer, List aList, boolean aF3_H) { - int aMeta = aStack.getItemDamage(); - if (aMeta < 10) { - // aList.add("Tier: "+GT_Values.VN[aMeta]); - } - super.addInformation(aStack, aPlayer, aList, aF3_H); - } - } - - public GregtechMetaSpecialMachineCasings() { - super(SpecialCasingItemBlock.class, "gtplusplus.blockspecialcasings.2", GT_Material_Casings.INSTANCE); - for (byte i = 0; i < 16; i = (byte) (i + 1)) { - // TAE.registerTextures(new GT_CopiedBlockTexture(this, 6, i)); - // Don't register these Textures, They already exist within vanilla GT. (May not exist in 5.08) - } - GT_LanguageManager.addStringLocalization(this.getUnlocalizedName() + ".0.name", "Strong Bronze Machine Casing"); - GT_LanguageManager - .addStringLocalization(this.getUnlocalizedName() + ".1.name", "Sturdy Aluminium Machine Casing"); - GT_LanguageManager - .addStringLocalization(this.getUnlocalizedName() + ".2.name", "Vigorous Laurenium Machine Casing"); - TAE.registerTexture(84, new GTPP_CopiedBlockTexture(this, 6, 2)); - GT_LanguageManager - .addStringLocalization(this.getUnlocalizedName() + ".3.name", "Rugged Botmium Machine Casing"); - - GregtechItemList.Casing_Machine_Custom_1.set(new ItemStack(this, 1, 0)); - GregtechItemList.Casing_Machine_Custom_2.set(new ItemStack(this, 1, 1)); - GregtechItemList.Casing_Machine_Custom_3.set(new ItemStack(this, 1, 2)); - GregtechItemList.Casing_Machine_Custom_4.set(new ItemStack(this, 1, 3)); - } - - @Override - public IIcon getIcon(int ordinalSide, int aMeta) { - return switch (aMeta) { - case 0 -> Textures.BlockIcons.MACHINE_BRONZEPLATEDBRICKS.getIcon(); - case 1 -> Textures.BlockIcons.MACHINE_CASING_FROST_PROOF.getIcon(); - case 2 -> TexturesGtBlock.Casing_Material_Laurenium.getIcon(); - case 3 -> Textures.BlockIcons.MACHINE_HEATPROOFCASING.getIcon(); - default -> Textures.BlockIcons.RENDERING_ERROR.getIcon(); - }; - } -} diff --git a/gtpp/src/main/java/gtPlusPlus/xmod/gregtech/common/blocks/GregtechMetaSpecialMultiCasings.java b/gtpp/src/main/java/gtPlusPlus/xmod/gregtech/common/blocks/GregtechMetaSpecialMultiCasings.java deleted file mode 100644 index 1d7c853e71..0000000000 --- a/gtpp/src/main/java/gtPlusPlus/xmod/gregtech/common/blocks/GregtechMetaSpecialMultiCasings.java +++ /dev/null @@ -1,120 +0,0 @@ -package gtPlusPlus.xmod.gregtech.common.blocks; - -import java.util.List; - -import net.minecraft.block.Block; -import net.minecraft.entity.player.EntityPlayer; -import net.minecraft.item.ItemStack; -import net.minecraft.util.IIcon; -import net.minecraft.world.IBlockAccess; -import net.minecraftforge.common.util.ForgeDirection; - -import cpw.mods.fml.relauncher.Side; -import cpw.mods.fml.relauncher.SideOnly; -import gregtech.api.enums.TAE; -import gregtech.api.enums.Textures; -import gregtech.api.util.GT_LanguageManager; -import gregtech.common.blocks.GT_Material_Casings; -import gtPlusPlus.xmod.gregtech.api.enums.GregtechItemList; -import gtPlusPlus.xmod.gregtech.api.objects.GTPP_CopiedBlockTexture; -import gtPlusPlus.xmod.gregtech.common.blocks.textures.TexturesGtBlock; -import gtPlusPlus.xmod.gregtech.common.blocks.textures.turbine.LargeTurbineTextureHandler; - -public class GregtechMetaSpecialMultiCasings extends GregtechMetaCasingBlocksAbstract { - - public static class SpecialCasingItemBlock extends GregtechMetaCasingItems { - - public SpecialCasingItemBlock(Block par1) { - super(par1); - } - - @Override - public void addInformation(ItemStack aStack, EntityPlayer aPlayer, List aList, boolean aF3_H) { - int aMeta = aStack.getItemDamage(); - if (aMeta < 10) { - // aList.add("Tier: "+GT_Values.VN[aMeta]); - } - super.addInformation(aStack, aPlayer, aList, aF3_H); - } - } - - public GregtechMetaSpecialMultiCasings() { - super(SpecialCasingItemBlock.class, "gtplusplus.blockspecialcasings.1", GT_Material_Casings.INSTANCE); - GT_LanguageManager.addStringLocalization(this.getUnlocalizedName() + ".0.name", "Turbine Shaft"); - GT_LanguageManager - .addStringLocalization(this.getUnlocalizedName() + ".1.name", "Reinforced Steam Turbine Casing"); - GT_LanguageManager - .addStringLocalization(this.getUnlocalizedName() + ".2.name", "Reinforced HP Steam Turbine Casing"); - GT_LanguageManager - .addStringLocalization(this.getUnlocalizedName() + ".3.name", "Reinforced Gas Turbine Casing"); - GT_LanguageManager - .addStringLocalization(this.getUnlocalizedName() + ".4.name", "Reinforced Plasma Turbine Casing"); - GT_LanguageManager.addStringLocalization(this.getUnlocalizedName() + ".5.name", "Tesla Containment Casing"); - GT_LanguageManager.addStringLocalization(this.getUnlocalizedName() + ".6.name", "Structural Solar Casing"); - GT_LanguageManager.addStringLocalization(this.getUnlocalizedName() + ".7.name", "Salt Containment Casing"); - GT_LanguageManager.addStringLocalization(this.getUnlocalizedName() + ".8.name", "Thermally Insulated Casing"); - GT_LanguageManager.addStringLocalization(this.getUnlocalizedName() + ".9.name", "Flotation Cell Casings"); - GT_LanguageManager.addStringLocalization(this.getUnlocalizedName() + ".10.name", "Reinforced Engine Casing"); - GT_LanguageManager - .addStringLocalization(this.getUnlocalizedName() + ".11.name", "Molecular Containment Casing"); - GT_LanguageManager - .addStringLocalization(this.getUnlocalizedName() + ".12.name", "High Voltage Current Capacitor"); - GT_LanguageManager.addStringLocalization(this.getUnlocalizedName() + ".13.name", "Particle Containment Casing"); - GT_LanguageManager - .addStringLocalization(this.getUnlocalizedName() + ".14.name", "Reinforced Heat Exchanger Casing"); - GT_LanguageManager - .addStringLocalization(this.getUnlocalizedName() + ".15.name", "Reinforced SC Turbine Casing"); - TAE.registerTexture(1, 12, new GTPP_CopiedBlockTexture(this, 6, 14)); - - GregtechItemList.Casing_Turbine_Shaft.set(new ItemStack(this, 1, 0)); - GregtechItemList.Casing_Turbine_LP.set(new ItemStack(this, 1, 1)); - GregtechItemList.Casing_Turbine_HP.set(new ItemStack(this, 1, 2)); - GregtechItemList.Casing_Turbine_Gas.set(new ItemStack(this, 1, 3)); - GregtechItemList.Casing_Turbine_Plasma.set(new ItemStack(this, 1, 4)); - GregtechItemList.Casing_SolarTower_Structural.set(new ItemStack(this, 1, 6)); - GregtechItemList.Casing_SolarTower_SaltContainment.set(new ItemStack(this, 1, 7)); - GregtechItemList.Casing_SolarTower_HeatContainment.set(new ItemStack(this, 1, 8)); - GregtechItemList.Casing_Flotation_Cell.set(new ItemStack(this, 1, 9)); - GregtechItemList.Casing_Reinforced_Engine_Casing.set(new ItemStack(this, 1, 10)); - GregtechItemList.Casing_Molecular_Transformer_1.set(new ItemStack(this, 1, 11)); - GregtechItemList.Casing_Molecular_Transformer_2.set(new ItemStack(this, 1, 12)); - GregtechItemList.Casing_Molecular_Transformer_3.set(new ItemStack(this, 1, 13)); - GregtechItemList.Casing_XL_HeatExchanger.set(new ItemStack(this, 1, 14)); - GregtechItemList.Casing_Turbine_SC.set(new ItemStack(this, 1, 15)); - } - - @Override - @SideOnly(Side.CLIENT) - public IIcon getIcon(final IBlockAccess aWorld, final int xCoord, final int yCoord, final int zCoord, - final int ordinalSide) { - return LargeTurbineTextureHandler - .handleCasingsGT(aWorld, xCoord, yCoord, zCoord, ForgeDirection.getOrientation(ordinalSide), this); - } - - @Override - public IIcon getIcon(final int ordinalSide, final int aMeta) { - return getStaticIcon((byte) ordinalSide, (byte) aMeta); - } - - public static IIcon getStaticIcon(final int ordinalSide, final byte aMeta) { - return switch (aMeta) { - case 0 -> TexturesGtBlock.Casing_Redox_1.getIcon(); - case 1 -> Textures.BlockIcons.MACHINE_CASING_TURBINE.getIcon(); - case 2 -> Textures.BlockIcons.MACHINE_CASING_STABLE_TITANIUM.getIcon(); - case 3 -> Textures.BlockIcons.MACHINE_CASING_CLEAN_STAINLESSSTEEL.getIcon(); - case 4 -> Textures.BlockIcons.MACHINE_CASING_ROBUST_TUNGSTENSTEEL.getIcon(); - case 5 -> TexturesGtBlock.Casing_Material_RedSteel.getIcon(); - case 6 -> TexturesGtBlock.Casing_Material_MaragingSteel.getIcon(); - case 7 -> TexturesGtBlock.Casing_Material_Stellite.getIcon(); - case 8 -> TexturesGtBlock.Casing_Machine_Simple_Top.getIcon(); - case 9 -> TexturesGtBlock.TEXTURE_CASING_FLOTATION.getIcon(); - case 10 -> TexturesGtBlock.Casing_Material_Talonite.getIcon(); - case 11 -> Textures.BlockIcons.MACHINE_CASING_RADIATIONPROOF.getIcon(); - case 12 -> TexturesGtBlock.Casing_Redox_5.getIcon(); - case 13 -> TexturesGtBlock.TEXTURE_MAGIC_PANEL_B.getIcon(); - case 14 -> TexturesGtBlock.Casing_Material_Talonite.getIcon(); - case 15 -> TexturesGtBlock.Turbine_SC_Material_Casing.getIcon(); - default -> Textures.BlockIcons.RENDERING_ERROR.getIcon(); - }; - } -} diff --git a/gtpp/src/main/java/gtPlusPlus/xmod/gregtech/common/blocks/GregtechMetaSpecialMultiCasings2.java b/gtpp/src/main/java/gtPlusPlus/xmod/gregtech/common/blocks/GregtechMetaSpecialMultiCasings2.java deleted file mode 100644 index 9a2912c2c5..0000000000 --- a/gtpp/src/main/java/gtPlusPlus/xmod/gregtech/common/blocks/GregtechMetaSpecialMultiCasings2.java +++ /dev/null @@ -1,99 +0,0 @@ -package gtPlusPlus.xmod.gregtech.common.blocks; - -import java.util.List; - -import net.minecraft.block.Block; -import net.minecraft.creativetab.CreativeTabs; -import net.minecraft.entity.player.EntityPlayer; -import net.minecraft.item.Item; -import net.minecraft.item.ItemStack; -import net.minecraft.util.IIcon; -import net.minecraft.world.IBlockAccess; - -import cpw.mods.fml.relauncher.Side; -import cpw.mods.fml.relauncher.SideOnly; -import gregtech.api.enums.Textures; -import gregtech.api.util.GT_LanguageManager; -import gregtech.common.blocks.GT_Material_Casings; -import gtPlusPlus.xmod.gregtech.api.enums.GregtechItemList; -import gtPlusPlus.xmod.gregtech.common.blocks.textures.TexturesGtBlock; - -public class GregtechMetaSpecialMultiCasings2 extends GregtechMetaCasingBlocksAbstract { - - @Override - public void getSubBlocks(Item aItem, CreativeTabs par2CreativeTabs, List aList) { - for (int i = 0; i < 8; i++) { - aList.add(new ItemStack(aItem, 1, i)); - } - } - - public static class SpecialCasingItemBlock extends GregtechMetaCasingItems { - - public SpecialCasingItemBlock(Block par1) { - super(par1); - } - - @Override - public void addInformation(ItemStack aStack, EntityPlayer aPlayer, List aList, boolean aF3_H) { - int aMeta = aStack.getItemDamage(); - if (aMeta < 4) { - aList.add("Provides quantum stability"); - } - if (aMeta >= 4 && aMeta < 8) { - aList.add("Provides quantum modulation"); - } - super.addInformation(aStack, aPlayer, aList, aF3_H); - } - } - - public GregtechMetaSpecialMultiCasings2() { - super(SpecialCasingItemBlock.class, "gtplusplus.blockspecialcasings.3", GT_Material_Casings.INSTANCE); - for (byte i = 0; i < 16; i = (byte) (i + 1)) { - // TAE.registerTextures(new GT_CopiedBlockTexture(this, 6, i)); - // Don't register these Textures, They already exist within vanilla GT. (May not exist in 5.08) - } - GT_LanguageManager.addStringLocalization(this.getUnlocalizedName() + ".0.name", "Resonance Chamber I"); - GT_LanguageManager.addStringLocalization(this.getUnlocalizedName() + ".1.name", "Resonance Chamber II"); - GT_LanguageManager.addStringLocalization(this.getUnlocalizedName() + ".2.name", "Resonance Chamber III"); - GT_LanguageManager.addStringLocalization(this.getUnlocalizedName() + ".3.name", "Resonance Chamber IV"); - GT_LanguageManager.addStringLocalization(this.getUnlocalizedName() + ".4.name", "Modulator I"); - GT_LanguageManager.addStringLocalization(this.getUnlocalizedName() + ".5.name", "Modulator II"); - GT_LanguageManager.addStringLocalization(this.getUnlocalizedName() + ".6.name", "Modulator III"); - GT_LanguageManager.addStringLocalization(this.getUnlocalizedName() + ".7.name", "Modulator IV"); - - GregtechItemList.ResonanceChamber_I.set(new ItemStack(this, 1, 0)); - GregtechItemList.ResonanceChamber_II.set(new ItemStack(this, 1, 1)); - GregtechItemList.ResonanceChamber_III.set(new ItemStack(this, 1, 2)); - GregtechItemList.ResonanceChamber_IV.set(new ItemStack(this, 1, 3)); - GregtechItemList.Modulator_I.set(new ItemStack(this, 1, 4)); - GregtechItemList.Modulator_II.set(new ItemStack(this, 1, 5)); - GregtechItemList.Modulator_III.set(new ItemStack(this, 1, 6)); - GregtechItemList.Modulator_IV.set(new ItemStack(this, 1, 7)); - } - - @Override - @SideOnly(Side.CLIENT) - public IIcon getIcon(final IBlockAccess aWorld, final int xCoord, final int yCoord, final int zCoord, - final int ordinalSide) { - return getStaticIcon((byte) ordinalSide, (byte) aWorld.getBlockMetadata(xCoord, yCoord, zCoord)); - } - - @Override - public IIcon getIcon(final int ordinalSide, final int aMeta) { - return getStaticIcon((byte) ordinalSide, (byte) aMeta); - } - - public static IIcon getStaticIcon(final byte aSide, final byte aMeta) { - return switch (aMeta) { - case 0 -> TexturesGtBlock.Casing_Resonance_1.getIcon(); - case 1 -> TexturesGtBlock.Casing_Resonance_2.getIcon(); - case 2 -> TexturesGtBlock.Casing_Resonance_3.getIcon(); - case 3 -> TexturesGtBlock.Casing_Resonance_4.getIcon(); - case 4 -> TexturesGtBlock.Casing_Modulator_1.getIcon(); - case 5 -> TexturesGtBlock.Casing_Modulator_2.getIcon(); - case 6 -> TexturesGtBlock.Casing_Modulator_3.getIcon(); - case 7 -> TexturesGtBlock.Casing_Modulator_4.getIcon(); - default -> Textures.BlockIcons.RENDERING_ERROR.getIcon(); - }; - } -} diff --git a/gtpp/src/main/java/gtPlusPlus/xmod/gregtech/common/blocks/GregtechMetaTieredCasingBlocks1.java b/gtpp/src/main/java/gtPlusPlus/xmod/gregtech/common/blocks/GregtechMetaTieredCasingBlocks1.java deleted file mode 100644 index 7ddab1c471..0000000000 --- a/gtpp/src/main/java/gtPlusPlus/xmod/gregtech/common/blocks/GregtechMetaTieredCasingBlocks1.java +++ /dev/null @@ -1,84 +0,0 @@ -package gtPlusPlus.xmod.gregtech.common.blocks; - -import java.util.List; - -import net.minecraft.block.Block; -import net.minecraft.creativetab.CreativeTabs; -import net.minecraft.entity.player.EntityPlayer; -import net.minecraft.item.Item; -import net.minecraft.item.ItemStack; -import net.minecraft.util.IIcon; - -import gregtech.api.enums.GT_Values; -import gregtech.api.enums.Textures; -import gregtech.api.util.GT_LanguageManager; -import gregtech.common.blocks.GT_Material_Casings; -import gtPlusPlus.xmod.gregtech.api.enums.GregtechItemList; -import gtPlusPlus.xmod.gregtech.common.blocks.textures.TexturesGtBlock; - -public class GregtechMetaTieredCasingBlocks1 extends GregtechMetaCasingBlocksAbstract { - - @Override - public void getSubBlocks(Item aItem, CreativeTabs par2CreativeTabs, List aList) { - for (int i = 0; i < 10; i++) { - aList.add(new ItemStack(aItem, 1, i)); - } - } - - public static class TieredCasingItemBlock extends GregtechMetaCasingItems { - - public TieredCasingItemBlock(Block par1) { - super(par1); - } - - @Override - public void addInformation(ItemStack aStack, EntityPlayer aPlayer, List aList, boolean aF3_H) { - int aMeta = aStack.getItemDamage(); - if (aMeta < 10) { - aList.add("Tier: " + GT_Values.VN[aMeta]); - } - super.addInformation(aStack, aPlayer, aList, aF3_H); - } - } - - public GregtechMetaTieredCasingBlocks1() { - super(TieredCasingItemBlock.class, "gtplusplus.blocktieredcasings.1", GT_Material_Casings.INSTANCE); - GT_LanguageManager.addStringLocalization(this.getUnlocalizedName() + ".0.name", "Integral Encasement I"); - GT_LanguageManager.addStringLocalization(this.getUnlocalizedName() + ".1.name", "Integral Encasement II"); - GT_LanguageManager.addStringLocalization(this.getUnlocalizedName() + ".2.name", "Integral Encasement III"); - GT_LanguageManager.addStringLocalization(this.getUnlocalizedName() + ".3.name", "Integral Encasement IV"); - GT_LanguageManager.addStringLocalization(this.getUnlocalizedName() + ".4.name", "Integral Encasement V"); - GT_LanguageManager.addStringLocalization(this.getUnlocalizedName() + ".5.name", "Integral Framework I"); - GT_LanguageManager.addStringLocalization(this.getUnlocalizedName() + ".6.name", "Integral Framework II"); - GT_LanguageManager.addStringLocalization(this.getUnlocalizedName() + ".7.name", "Integral Framework III"); - GT_LanguageManager.addStringLocalization(this.getUnlocalizedName() + ".8.name", "Integral Framework IV"); - GT_LanguageManager.addStringLocalization(this.getUnlocalizedName() + ".9.name", "Integral Framework V"); - - GregtechItemList.GTPP_Casing_ULV.set(new ItemStack(this, 1, 0)); - GregtechItemList.GTPP_Casing_LV.set(new ItemStack(this, 1, 1)); - GregtechItemList.GTPP_Casing_MV.set(new ItemStack(this, 1, 2)); - GregtechItemList.GTPP_Casing_HV.set(new ItemStack(this, 1, 3)); - GregtechItemList.GTPP_Casing_EV.set(new ItemStack(this, 1, 4)); - GregtechItemList.GTPP_Casing_IV.set(new ItemStack(this, 1, 5)); - GregtechItemList.GTPP_Casing_LuV.set(new ItemStack(this, 1, 6)); - GregtechItemList.GTPP_Casing_ZPM.set(new ItemStack(this, 1, 7)); - GregtechItemList.GTPP_Casing_UV.set(new ItemStack(this, 1, 8)); - GregtechItemList.GTPP_Casing_UHV.set(new ItemStack(this, 1, 9)); - } - - @Override - public IIcon getIcon(int ordinalSide, int aMeta) { - if (aMeta < 10) { - return TexturesGtBlock.TIERED_MACHINE_HULLS[aMeta].getIcon(); - } - return switch (aMeta) { - case 10 -> Textures.BlockIcons.RENDERING_ERROR.getIcon(); - case 11 -> Textures.BlockIcons.RENDERING_ERROR.getIcon(); - case 12 -> Textures.BlockIcons.RENDERING_ERROR.getIcon(); - case 13 -> Textures.BlockIcons.RENDERING_ERROR.getIcon(); - case 14 -> Textures.BlockIcons.RENDERING_ERROR.getIcon(); - case 15 -> Textures.BlockIcons.RENDERING_ERROR.getIcon(); - default -> Textures.BlockIcons.RENDERING_ERROR.getIcon(); - }; - } -} diff --git a/gtpp/src/main/java/gtPlusPlus/xmod/gregtech/common/blocks/fluid/GregtechFluidHandler.java b/gtpp/src/main/java/gtPlusPlus/xmod/gregtech/common/blocks/fluid/GregtechFluidHandler.java deleted file mode 100644 index e478bf5c18..0000000000 --- a/gtpp/src/main/java/gtPlusPlus/xmod/gregtech/common/blocks/fluid/GregtechFluidHandler.java +++ /dev/null @@ -1,146 +0,0 @@ -package gtPlusPlus.xmod.gregtech.common.blocks.fluid; - -import net.minecraft.item.ItemStack; -import net.minecraftforge.fluids.FluidRegistry; - -import gregtech.api.enums.OrePrefixes; -import gregtech.api.util.GT_OreDictUnificator; -import gtPlusPlus.api.objects.Logger; -import gtPlusPlus.core.util.Utils; -import gtPlusPlus.core.util.minecraft.FluidUtils; -import gtPlusPlus.core.util.minecraft.ItemUtils; -import gtPlusPlus.xmod.gregtech.api.enums.GregtechOrePrefixes.GT_Materials; - -public class GregtechFluidHandler { - - protected static int cellID = 0; - - public static void run() { - start(); - } - - private static void start() { - Logger.INFO("Adding in our own GT versions of Thermal Foundation Fluids if they do not already exist."); - if (!FluidRegistry.isFluidRegistered("cryotheum")) { - FluidUtils.addGtFluid( - "cryotheum", - "Gelid Cryotheum", - GT_Materials.Cryotheum, - 4, - -1200, - GT_OreDictUnificator.get(OrePrefixes.cell, GT_Materials.Cryotheum, 1L), - ItemUtils.getEmptyCell(), - 1000); - } - if (!FluidRegistry.isFluidRegistered("pyrotheum")) { - FluidUtils.addGtFluid( - "pyrotheum", - "Blazing Pyrotheum", - GT_Materials.Pyrotheum, - 4, - 4000, - GT_OreDictUnificator.get(OrePrefixes.cell, GT_Materials.Pyrotheum, 1L), - ItemUtils.getEmptyCell(), - 1000); - } - if (!FluidRegistry.isFluidRegistered("ender")) { - FluidUtils.addGtFluid( - "ender", - "Resonant Ender", - GT_Materials.Ender, - 4, - 4000, - GT_OreDictUnificator.get(OrePrefixes.cell, GT_Materials.Ender, 1L), - ItemUtils.getEmptyCell(), - 1000); - } - Logger.INFO("Adding in GT Fluids for various nuclear related content."); - - FluidUtils.addGtFluid( - "hydrofluoricAcid", - "Industrial Strength Hydrofluoric Acid", - GT_Materials.HydrofluoricAcid, - 1, - 120, - GT_OreDictUnificator.get(OrePrefixes.cell, GT_Materials.HydrofluoricAcid, 1L), - ItemUtils.getEmptyCell(), - 1000, - false); - generateIC2FluidCell("HydrofluoricAcid"); - - FluidUtils.generateFluidNoPrefix( - "SulfurDioxide", - "High Quality Sulfur Dioxide", - 263, - GT_Materials.SulfurDioxide.mRGBa); - - FluidUtils.addGtFluid( - "sulfurousAcid", - "Sulfurous Acid", - GT_Materials.SulfurousAcid, - 4, - 75, - GT_OreDictUnificator.get(OrePrefixes.cell, GT_Materials.SulfurousAcid, 1L), - ItemUtils.getEmptyCell(), - 1000, - false); - generateIC2FluidCell("SulfurousAcid"); - - FluidUtils.addGtFluid( - "sulfuricApatite", - "Sulfuric Apatite Mix", - GT_Materials.SulfuricApatite, - 4, - 500, - GT_OreDictUnificator.get(OrePrefixes.cell, GT_Materials.SulfuricApatite, 1L), - ItemUtils.getEmptyCell(), - 1000, - false); - generateIC2FluidCell("SulfuricApatite"); - - // Check for Hydrogen Chloride - if (FluidUtils.getFluidStack("hydrogenchloride", 1) == null) { - FluidUtils.addGtFluid( - "hydrogenChloride", - "Industrial Strength Hydrogen Chloride", - GT_Materials.HydrogenChloride, - 4, - 75, - GT_OreDictUnificator.get(OrePrefixes.cell, GT_Materials.HydrogenChloride, 1L), - ItemUtils.getEmptyCell(), - 1000, - false); - generateIC2FluidCell("HydrogenChloride"); - } - - FluidUtils.addGtFluid( - "sulfuricLithium", - "Sulfuric Lithium Mix", - GT_Materials.SulfuricLithium, - 4, - 280, - GT_OreDictUnificator.get(OrePrefixes.cell, GT_Materials.SulfuricLithium, 1L), - ItemUtils.getEmptyCell(), - 1000, - false); - generateIC2FluidCell("SulfuricLithium"); - - FluidUtils.addGtFluid( - "lithiumHydroxide", - "Lithium Hydroxide", - GT_Materials.LithiumHydroxide, - 4, - 500, - GT_OreDictUnificator.get(OrePrefixes.cell, GT_Materials.LithiumHydroxide, 1L), - ItemUtils.getEmptyCell(), - 1000, - false); - generateIC2FluidCell("LithiumHydroxide"); - } - - private static ItemStack generateIC2FluidCell(final String fluidNameWithCaps) { - Logger.INFO("Adding a Cell for " + fluidNameWithCaps); - return Utils.createInternalNameAndFluidCell(fluidNameWithCaps); - } - -} diff --git a/gtpp/src/main/java/gtPlusPlus/xmod/gregtech/common/blocks/textures/CasingTextureHandler.java b/gtpp/src/main/java/gtPlusPlus/xmod/gregtech/common/blocks/textures/CasingTextureHandler.java deleted file mode 100644 index c85bac7115..0000000000 --- a/gtpp/src/main/java/gtPlusPlus/xmod/gregtech/common/blocks/textures/CasingTextureHandler.java +++ /dev/null @@ -1,57 +0,0 @@ -package gtPlusPlus.xmod.gregtech.common.blocks.textures; - -import net.minecraft.util.IIcon; -import net.minecraft.world.IBlockAccess; -import net.minecraftforge.common.util.ForgeDirection; - -import gregtech.api.enums.Textures; -import gtPlusPlus.xmod.gregtech.common.blocks.GregtechMetaCasingBlocks; - -public class CasingTextureHandler { - - private static final TexturesCentrifugeMultiblock gregtechX = new TexturesCentrifugeMultiblock(); - - public static IIcon getIcon(final int ordinalSide, final int aMeta) { // Texture ID's. case 0 == ID[57] - if ((aMeta >= 0) && (aMeta < 16)) { - return switch (aMeta) { - // Centrifuge - case 0 -> TexturesGtBlock.Casing_Material_Centrifuge.getIcon(); - // Coke Oven Frame - case 1 -> TexturesGtBlock.Casing_Material_Tantalloy61.getIcon(); - // Coke Oven Casing Tier 1 - case 2 -> Textures.BlockIcons.MACHINE_CASING_FIREBOX_BRONZE.getIcon(); - // Coke Oven Casing Tier 2 - case 3 -> Textures.BlockIcons.MACHINE_CASING_FIREBOX_STEEL.getIcon(); - // Material Press Casings - case 4 -> Textures.BlockIcons.MACHINE_CASING_STABLE_TITANIUM.getIcon(); - // Electrolyzer Casings - case 5 -> TexturesGtBlock.Casing_Material_Potin.getIcon(); - // Broken Blue Fusion Casings - case 6 -> TexturesGtBlock.Casing_Material_MaragingSteel.getIcon(); - // Maceration Stack Casings - case 7 -> TexturesGtBlock.Casing_Material_Tumbaga.getIcon(); - // Broken Pink Fusion Casings - case 8 -> TexturesGtBlock.TEXTURE_ORGANIC_PANEL_A_GLOWING.getIcon(); - // Matter Fabricator Casings - case 9 -> TexturesGtBlock.TEXTURE_METAL_PANEL_F.getIcon(); - // Iron Blast Fuance Textures - case 10 -> TexturesGtBlock.Casing_Machine_Simple_Top.getIcon(); - // Multitank Exterior Casing - case 11 -> TexturesGtBlock.Casing_Material_Grisium.getIcon(); - // Reactor Casing I - case 12 -> TexturesGtBlock.Casing_Material_Stellite.getIcon(); - // Reactor Casing II - case 13 -> TexturesGtBlock.Casing_Material_Zeron100.getIcon(); - case 14 -> TexturesGtBlock.Casing_Staballoy_Firebox.getIcon(); - case 15 -> TexturesGtBlock.Casing_Material_ZirconiumCarbide.getIcon(); - default -> Textures.BlockIcons.MACHINE_CASING_RADIOACTIVEHAZARD.getIcon(); - }; - } - return Textures.BlockIcons.MACHINE_CASING_GEARBOX_TUNGSTENSTEEL.getIcon(); - } - - public static IIcon handleCasingsGT(final IBlockAccess aWorld, final int xCoord, final int yCoord, final int zCoord, - final ForgeDirection side, final GregtechMetaCasingBlocks thisBlock) { - return gregtechX.handleCasingsGT(aWorld, xCoord, yCoord, zCoord, side, thisBlock); - } -} diff --git a/gtpp/src/main/java/gtPlusPlus/xmod/gregtech/common/blocks/textures/CasingTextureHandler2.java b/gtpp/src/main/java/gtPlusPlus/xmod/gregtech/common/blocks/textures/CasingTextureHandler2.java deleted file mode 100644 index 1da572fb35..0000000000 --- a/gtpp/src/main/java/gtPlusPlus/xmod/gregtech/common/blocks/textures/CasingTextureHandler2.java +++ /dev/null @@ -1,71 +0,0 @@ -package gtPlusPlus.xmod.gregtech.common.blocks.textures; - -import net.minecraft.util.IIcon; - -import gregtech.api.enums.Textures; - -public class CasingTextureHandler2 { - - public static IIcon getIcon(final int ordinalSide, final int aMeta) { // Texture ID's. case 0 == ID[57] - if ((aMeta >= 0) && (aMeta < 16)) { - switch (aMeta) { - case 0 -> { - return TexturesGtBlock.Casing_Material_RedSteel.getIcon(); - } - case 1 -> { - return TexturesGtBlock.Casing_Material_HastelloyX.getIcon(); - } - case 2 -> { - return TexturesGtBlock.Casing_Material_HastelloyN.getIcon(); - } - case 3 -> { - return TexturesGtBlock.Casing_Material_Fluid_IncoloyDS.getIcon(); - } - case 4 -> { - return TexturesGtBlock.Casing_Material_Grisium.getIcon(); - } - case 5 -> { - return TexturesGtBlock.Casing_Machine_Metal_Panel_A.getIcon(); - } - case 6 -> { - return TexturesGtBlock.Casing_Machine_Metal_Grate_A.getIcon(); - } - case 7 -> { - return TexturesGtBlock.Casing_Redox_1.getIcon(); - } - case 8 -> { - return TexturesGtBlock.Casing_Machine_Metal_Sheet_A.getIcon(); - } - case 9 -> { - return TexturesGtBlock.Overlay_Machine_Cyber_A.getIcon(); - } - case 10 -> { - return Textures.BlockIcons.MACHINE_CASING_RADIATIONPROOF.getIcon(); - } - case 11 -> { - return TexturesGtBlock.Casing_Material_Tantalloy61.getIcon(); - } - case 12 -> { - return TexturesGtBlock.Casing_Machine_Simple_Top.getIcon(); - } - case 13 -> { - if (ordinalSide < 2) { - return TexturesGtBlock.TEXTURE_TECH_A.getIcon(); - } else { - return TexturesGtBlock.TEXTURE_TECH_B.getIcon(); - } - } - case 14 -> { - return Textures.BlockIcons.RENDERING_ERROR.getIcon(); - } - case 15 -> { - return TexturesGtBlock.Casing_Machine_Acacia_Log.getIcon(); - } - default -> { - return TexturesGtBlock.Overlay_UU_Matter.getIcon(); - } - } - } - return TexturesGtBlock._PlaceHolder.getIcon(); - } -} diff --git a/gtpp/src/main/java/gtPlusPlus/xmod/gregtech/common/blocks/textures/CasingTextureHandler3.java b/gtpp/src/main/java/gtPlusPlus/xmod/gregtech/common/blocks/textures/CasingTextureHandler3.java deleted file mode 100644 index 6b2627ec39..0000000000 --- a/gtpp/src/main/java/gtPlusPlus/xmod/gregtech/common/blocks/textures/CasingTextureHandler3.java +++ /dev/null @@ -1,61 +0,0 @@ -package gtPlusPlus.xmod.gregtech.common.blocks.textures; - -import net.minecraft.util.IIcon; - -import gtPlusPlus.xmod.gregtech.common.blocks.GregtechMetaCasingBlocks3; - -public class CasingTextureHandler3 { - - public static IIcon getIcon(final int ordinalSide, final int aMeta) { // Texture ID's. case 0 == ID[57] - if ((aMeta >= 0) && (aMeta < 16)) { - return switch (aMeta) { - case 0 -> - // Aquatic Casing - TexturesGtBlock.TEXTURE_METAL_PANEL_B.getIcon(); - case 1 -> - // Inconel Reinforced Casing - TexturesGtBlock.TEXTURE_METAL_PANEL_D.getIcon(); - case 2 -> - // Multi-Use Casing - TexturesGtBlock.TEXTURE_METAL_PANEL_C.getIcon(); - case 3 -> - // Trinium Plated Mining Platform Casing - TexturesGtBlock.Casing_Trinium_Naquadah_Vent.getIcon(); - case 4 -> - // Vanadium Redox IV - TexturesGtBlock.Casing_Redox_2.getIcon(); - case 5 -> - // Vanadium Redox LuV - TexturesGtBlock.Casing_Redox_3.getIcon(); - case 6 -> - // Vanadium Redox ZPM - TexturesGtBlock.Casing_Redox_4.getIcon(); - case 7 -> - // Vanadium Redox UV - TexturesGtBlock.Casing_Redox_5.getIcon(); - case 8 -> - // Vanadium Redox MAX - TexturesGtBlock.Casing_Redox_6.getIcon(); - case 9 -> - // Amazon Warehouse Casing - TexturesGtBlock.TEXTURE_CASING_AMAZON.getIcon(); - case 10 -> - // Adv. Vac. Freezer - TexturesGtBlock.TEXTURE_CASING_ADVANCED_CRYOGENIC.getIcon(); - case 11 -> - // Adv. EBF - TexturesGtBlock.TEXTURE_CASING_ADVANCED_VOLCNUS.getIcon(); - case 12 -> TexturesGtBlock.TEXTURE_CASING_FUSION_COIL_II.getIcon(); - case 13 -> TexturesGtBlock.TEXTURE_CASING_FUSION_COIL_II_INNER.getIcon(); - case 14 -> TexturesGtBlock.TEXTURE_CASING_FUSION_CASING_ULTRA.getIcon(); - case 15 -> TexturesGtBlock.TEXTURE_MAGIC_PANEL_A.getIcon(); - default -> TexturesGtBlock._PlaceHolder.getIcon(); - }; - } - return TexturesGtBlock._PlaceHolder.getIcon(); - } - - static { - GregtechMetaCasingBlocks3.mConnectedMachineTextures = true; - } -} diff --git a/gtpp/src/main/java/gtPlusPlus/xmod/gregtech/common/blocks/textures/CasingTextureHandler6.java b/gtpp/src/main/java/gtPlusPlus/xmod/gregtech/common/blocks/textures/CasingTextureHandler6.java deleted file mode 100644 index b8d5a024df..0000000000 --- a/gtpp/src/main/java/gtPlusPlus/xmod/gregtech/common/blocks/textures/CasingTextureHandler6.java +++ /dev/null @@ -1,25 +0,0 @@ -package gtPlusPlus.xmod.gregtech.common.blocks.textures; - -import net.minecraft.util.IIcon; - -import gtPlusPlus.xmod.gregtech.common.blocks.GregtechMetaCasingBlocks6; - -public class CasingTextureHandler6 { - - public static IIcon getIcon(final int ordinalSide, final int aMeta) { // Texture ID's. case 0 == ID[57] - if ((aMeta >= 0) && (aMeta < 16)) { - return switch (aMeta) { - case 0 -> TexturesGtBlock.TEXTURE_CASING_FUSION_COIL_III.getIcon(); - case 1 -> TexturesGtBlock.TEXTURE_CASING_FUSION_COIL_III_INNER.getIcon(); - case 2 -> TexturesGtBlock.TEXTURE_CASING_FUSION_CASING_HYPER.getIcon(); - default -> TexturesGtBlock._PlaceHolder.getIcon(); - }; - } - return TexturesGtBlock._PlaceHolder.getIcon(); - } - - static { - GregtechMetaCasingBlocks6.mConnectedMachineTextures = true; - } - -} diff --git a/gtpp/src/main/java/gtPlusPlus/xmod/gregtech/common/blocks/textures/TexturesCentrifugeMultiblock.java b/gtpp/src/main/java/gtPlusPlus/xmod/gregtech/common/blocks/textures/TexturesCentrifugeMultiblock.java deleted file mode 100644 index 058d2a7f1e..0000000000 --- a/gtpp/src/main/java/gtPlusPlus/xmod/gregtech/common/blocks/textures/TexturesCentrifugeMultiblock.java +++ /dev/null @@ -1,151 +0,0 @@ -package gtPlusPlus.xmod.gregtech.common.blocks.textures; - -import net.minecraft.tileentity.TileEntity; -import net.minecraft.util.IIcon; -import net.minecraft.world.IBlockAccess; -import net.minecraftforge.common.util.ForgeDirection; - -import gregtech.api.interfaces.metatileentity.IMetaTileEntity; -import gregtech.api.interfaces.tileentity.IGregTechTileEntity; -import gtPlusPlus.xmod.gregtech.common.blocks.GregtechMetaCasingBlocks; -import gtPlusPlus.xmod.gregtech.common.blocks.textures.TexturesGtBlock.CustomIcon; -import gtPlusPlus.xmod.gregtech.common.tileentities.machines.multi.processing.GregtechMetaTileEntity_IndustrialCentrifuge; - -public class TexturesCentrifugeMultiblock { - - private static CustomIcon GT8_1_Active = new CustomIcon("iconsets/LARGECENTRIFUGE_ACTIVE1"); - private static CustomIcon GT8_1 = new CustomIcon("iconsets/LARGECENTRIFUGE1"); - private static CustomIcon GT8_2_Active = new CustomIcon("iconsets/LARGECENTRIFUGE_ACTIVE2"); - private static CustomIcon GT8_2 = new CustomIcon("iconsets/LARGECENTRIFUGE2"); - private static CustomIcon GT8_3_Active = new CustomIcon("iconsets/LARGECENTRIFUGE_ACTIVE3"); - private static CustomIcon GT8_3 = new CustomIcon("iconsets/LARGECENTRIFUGE3"); - private static CustomIcon GT8_4_Active = new CustomIcon("iconsets/LARGECENTRIFUGE_ACTIVE4"); - private static CustomIcon GT8_4 = new CustomIcon("iconsets/LARGECENTRIFUGE4"); - private static CustomIcon GT8_5_Active = new CustomIcon("iconsets/LARGECENTRIFUGE_ACTIVE5"); - private static CustomIcon GT8_5 = new CustomIcon("iconsets/LARGECENTRIFUGE5"); - private static CustomIcon GT8_6_Active = new CustomIcon("iconsets/LARGECENTRIFUGE_ACTIVE6"); - private static CustomIcon GT8_6 = new CustomIcon("iconsets/LARGECENTRIFUGE6"); - private static CustomIcon GT8_7_Active = new CustomIcon("iconsets/LARGECENTRIFUGE_ACTIVE7"); - private static CustomIcon GT8_7 = new CustomIcon("iconsets/LARGECENTRIFUGE7"); - private static CustomIcon GT8_8_Active = new CustomIcon("iconsets/LARGECENTRIFUGE_ACTIVE8"); - private static CustomIcon GT8_8 = new CustomIcon("iconsets/LARGECENTRIFUGE8"); - private static CustomIcon GT8_9_Active = new CustomIcon("iconsets/LARGECENTRIFUGE_ACTIVE9"); - private static CustomIcon GT8_9 = new CustomIcon("iconsets/LARGECENTRIFUGE9"); - - private static CustomIcon frontFace_0 = (GT8_1); - private static CustomIcon frontFaceActive_0 = (GT8_1_Active); - private static CustomIcon frontFace_1 = (GT8_2); - private static CustomIcon frontFaceActive_1 = (GT8_2_Active); - private static CustomIcon frontFace_2 = (GT8_3); - private static CustomIcon frontFaceActive_2 = (GT8_3_Active); - private static CustomIcon frontFace_3 = (GT8_4); - private static CustomIcon frontFaceActive_3 = (GT8_4_Active); - private static CustomIcon frontFace_4 = (GT8_5); - private static CustomIcon frontFaceActive_4 = (GT8_5_Active); - private static CustomIcon frontFace_5 = (GT8_6); - private static CustomIcon frontFaceActive_5 = (GT8_6_Active); - private static CustomIcon frontFace_6 = (GT8_7); - private static CustomIcon frontFaceActive_6 = (GT8_7_Active); - private static CustomIcon frontFace_7 = (GT8_8); - private static CustomIcon frontFaceActive_7 = (GT8_8_Active); - private static CustomIcon frontFace_8 = (GT8_9); - private static CustomIcon frontFaceActive_8 = (GT8_9_Active); - - CustomIcon[] CENTRIFUGE = new CustomIcon[] { frontFace_0, frontFace_1, frontFace_2, frontFace_3, frontFace_4, - frontFace_5, frontFace_6, frontFace_7, frontFace_8 }; - - CustomIcon[] CENTRIFUGE_ACTIVE = new CustomIcon[] { frontFaceActive_0, frontFaceActive_1, frontFaceActive_2, - frontFaceActive_3, frontFaceActive_4, frontFaceActive_5, frontFaceActive_6, frontFaceActive_7, - frontFaceActive_8 }; - - public IIcon handleCasingsGT(final IBlockAccess aWorld, final int xCoord, final int yCoord, final int zCoord, - final ForgeDirection side, final GregtechMetaCasingBlocks thisBlock) { - return this.handleCasingsGT58(aWorld, xCoord, yCoord, zCoord, side, thisBlock); - } - - private static int isCentrifugeControllerWithSide(IBlockAccess aWorld, int aX, int aY, int aZ, - ForgeDirection side) { - TileEntity tTileEntity = aWorld.getTileEntity(aX, aY, aZ); - if (!(tTileEntity instanceof IGregTechTileEntity tTile)) return 0; - if (tTile.getMetaTileEntity() instanceof GregtechMetaTileEntity_IndustrialCentrifuge - && tTile.getFrontFacing() == side) return tTile.isActive() ? 1 : 2; - return 0; - } - - public IIcon handleCasingsGT58(final IBlockAccess aWorld, final int xCoord, final int yCoord, final int zCoord, - final ForgeDirection side, final GregtechMetaCasingBlocks thisBlock) { - final int tMeta = aWorld.getBlockMetadata(xCoord, yCoord, zCoord); - final int ordinalSide = side.ordinal(); - if (tMeta != 0) { - return CasingTextureHandler.getIcon(ordinalSide, tMeta); - } - - int tInvertLeftRightMod = ordinalSide % 2 * 2 - 1; - switch (ordinalSide / 2) { - case 0 -> { - for (int i = -1; i < 2; i++) { - for (int j = -1; j < 2; j++) { - if (i == 0 && j == 0) continue; - if (isCentrifugeControllerWithSide(aWorld, xCoord + j, yCoord, zCoord + i, side) != 0) { - IMetaTileEntity tMetaTileEntity = ((IGregTechTileEntity) aWorld - .getTileEntity(xCoord + j, yCoord, zCoord + i)).getMetaTileEntity(); - return getIconByIndex(tMetaTileEntity, 4 - i * 3 - j); - } - } - } - } - case 1 -> { - for (int i = -1; i < 2; i++) { - for (int j = -1; j < 2; j++) { - if (i == 0 && j == 0) continue; - if (isCentrifugeControllerWithSide(aWorld, xCoord + j, yCoord + i, zCoord, side) != 0) { - IMetaTileEntity tMetaTileEntity = ((IGregTechTileEntity) aWorld - .getTileEntity(xCoord + j, yCoord + i, zCoord)).getMetaTileEntity(); - return getIconByIndex(tMetaTileEntity, 4 + i * 3 - j * tInvertLeftRightMod); - } - } - } - } - case 2 -> { - for (int i = -1; i < 2; i++) { - for (int j = -1; j < 2; j++) { - if (i == 0 && j == 0) continue; - if (isCentrifugeControllerWithSide(aWorld, xCoord, yCoord + i, zCoord + j, side) != 0) { - IMetaTileEntity tMetaTileEntity = ((IGregTechTileEntity) aWorld - .getTileEntity(xCoord, yCoord + i, zCoord + j)).getMetaTileEntity(); - return getIconByIndex(tMetaTileEntity, 4 + i * 3 + j * tInvertLeftRightMod); - } - } - } - } - } - return TexturesGtBlock.Casing_Material_Centrifuge.getIcon(); - } - - public boolean isCentrifugeRunning(IMetaTileEntity aTile) { - if (aTile == null) { - return false; - } else { - return aTile.getBaseMetaTileEntity() - .isActive(); - } - } - - public boolean isUsingAnimatedTexture(IMetaTileEntity aMetaTileEntity) { - if (aMetaTileEntity != null) { - if (aMetaTileEntity instanceof GregtechMetaTileEntity_IndustrialCentrifuge) { - return ((GregtechMetaTileEntity_IndustrialCentrifuge) aMetaTileEntity).usingAnimations(); - } - } - return false; - } - - public IIcon getIconByIndex(IMetaTileEntity aMetaTileEntity, int aIndex) { - if (isUsingAnimatedTexture(aMetaTileEntity)) { - if (isCentrifugeRunning(aMetaTileEntity)) { - return this.CENTRIFUGE_ACTIVE[aIndex].getIcon(); - } - } - return this.CENTRIFUGE[aIndex].getIcon(); - } -} diff --git a/gtpp/src/main/java/gtPlusPlus/xmod/gregtech/common/blocks/textures/TexturesGrinderMultiblock.java b/gtpp/src/main/java/gtPlusPlus/xmod/gregtech/common/blocks/textures/TexturesGrinderMultiblock.java deleted file mode 100644 index e7d09bd308..0000000000 --- a/gtpp/src/main/java/gtPlusPlus/xmod/gregtech/common/blocks/textures/TexturesGrinderMultiblock.java +++ /dev/null @@ -1,134 +0,0 @@ -package gtPlusPlus.xmod.gregtech.common.blocks.textures; - -import net.minecraft.tileentity.TileEntity; -import net.minecraft.util.IIcon; -import net.minecraft.world.IBlockAccess; -import net.minecraftforge.common.util.ForgeDirection; - -import gregtech.api.interfaces.metatileentity.IMetaTileEntity; -import gregtech.api.interfaces.tileentity.IGregTechTileEntity; -import gtPlusPlus.xmod.gregtech.common.blocks.GregtechMetaCasingBlocks5; -import gtPlusPlus.xmod.gregtech.common.blocks.textures.TexturesGtBlock.CustomIcon; -import gtPlusPlus.xmod.gregtech.common.tileentities.machines.multi.processing.GregtechMetaTileEntity_IsaMill; - -public class TexturesGrinderMultiblock { - - private static CustomIcon GT8_1_Active = new CustomIcon("iconsets/Grinder/GRINDER_ACTIVE1"); - private static CustomIcon GT8_1 = new CustomIcon("iconsets/Grinder/GRINDER1"); - private static CustomIcon GT8_2_Active = new CustomIcon("iconsets/Grinder/GRINDER_ACTIVE2"); - private static CustomIcon GT8_2 = new CustomIcon("iconsets/Grinder/GRINDER2"); - private static CustomIcon GT8_3_Active = new CustomIcon("iconsets/Grinder/GRINDER_ACTIVE3"); - private static CustomIcon GT8_3 = new CustomIcon("iconsets/Grinder/GRINDER3"); - private static CustomIcon GT8_4_Active = new CustomIcon("iconsets/Grinder/GRINDER_ACTIVE4"); - private static CustomIcon GT8_4 = new CustomIcon("iconsets/Grinder/GRINDER4"); - private static CustomIcon GT8_5_Active = new CustomIcon("iconsets/Grinder/GRINDER_ACTIVE5"); - private static CustomIcon GT8_5 = new CustomIcon("iconsets/Grinder/GRINDER5"); - private static CustomIcon GT8_6_Active = new CustomIcon("iconsets/Grinder/GRINDER_ACTIVE6"); - private static CustomIcon GT8_6 = new CustomIcon("iconsets/Grinder/GRINDER6"); - private static CustomIcon GT8_7_Active = new CustomIcon("iconsets/Grinder/GRINDER_ACTIVE7"); - private static CustomIcon GT8_7 = new CustomIcon("iconsets/Grinder/GRINDER7"); - private static CustomIcon GT8_8_Active = new CustomIcon("iconsets/Grinder/GRINDER_ACTIVE8"); - private static CustomIcon GT8_8 = new CustomIcon("iconsets/Grinder/GRINDER8"); - private static CustomIcon GT8_9_Active = new CustomIcon("iconsets/Grinder/GRINDER_ACTIVE9"); - private static CustomIcon GT8_9 = new CustomIcon("iconsets/Grinder/GRINDER9"); - - private static CustomIcon frontFace_0 = (GT8_1); - private static CustomIcon frontFaceActive_0 = (GT8_1_Active); - private static CustomIcon frontFace_1 = (GT8_2); - private static CustomIcon frontFaceActive_1 = (GT8_2_Active); - private static CustomIcon frontFace_2 = (GT8_3); - private static CustomIcon frontFaceActive_2 = (GT8_3_Active); - private static CustomIcon frontFace_3 = (GT8_4); - private static CustomIcon frontFaceActive_3 = (GT8_4_Active); - private static CustomIcon frontFace_4 = (GT8_5); - private static CustomIcon frontFaceActive_4 = (GT8_5_Active); - private static CustomIcon frontFace_5 = (GT8_6); - private static CustomIcon frontFaceActive_5 = (GT8_6_Active); - private static CustomIcon frontFace_6 = (GT8_7); - private static CustomIcon frontFaceActive_6 = (GT8_7_Active); - private static CustomIcon frontFace_7 = (GT8_8); - private static CustomIcon frontFaceActive_7 = (GT8_8_Active); - private static CustomIcon frontFace_8 = (GT8_9); - private static CustomIcon frontFaceActive_8 = (GT8_9_Active); - - CustomIcon[] GRINDER = new CustomIcon[] { frontFace_0, frontFace_1, frontFace_2, frontFace_3, frontFace_4, - frontFace_5, frontFace_6, frontFace_7, frontFace_8 }; - - CustomIcon[] GRINDER_ACTIVE = new CustomIcon[] { frontFaceActive_0, frontFaceActive_1, frontFaceActive_2, - frontFaceActive_3, frontFaceActive_4, frontFaceActive_5, frontFaceActive_6, frontFaceActive_7, - frontFaceActive_8 }; - - private static int isIsaControllerWithSide(IBlockAccess aWorld, int aX, int aY, int aZ, ForgeDirection side) { - TileEntity tTileEntity = aWorld.getTileEntity(aX, aY, aZ); - if (!(tTileEntity instanceof IGregTechTileEntity tTile)) return 0; - if (tTile.getMetaTileEntity() instanceof GregtechMetaTileEntity_IsaMill && tTile.getFrontFacing() == side) - return tTile.isActive() ? 1 : 2; - return 0; - } - - public IIcon handleCasingsGT(final IBlockAccess aWorld, final int xCoord, final int yCoord, final int zCoord, - final int ordinalSide, final GregtechMetaCasingBlocks5 ii) { - final int tMeta = aWorld.getBlockMetadata(xCoord, yCoord, zCoord); - final ForgeDirection side = ForgeDirection.getOrientation(ordinalSide); - if (tMeta != 1) { - return GregtechMetaCasingBlocks5.getStaticIcon(ordinalSide, tMeta); - } - int tInvertLeftRightMod = ordinalSide % 2 * 2 - 1; - switch (ordinalSide / 2) { - case 0 -> { - for (int i = -1; i < 2; i++) { - for (int j = -1; j < 2; j++) { - if (i == 0 && j == 0) continue; - if (isIsaControllerWithSide(aWorld, xCoord + j, yCoord, zCoord + i, side) != 0) { - IMetaTileEntity tMetaTileEntity = ((IGregTechTileEntity) aWorld - .getTileEntity(xCoord + j, yCoord, zCoord + i)).getMetaTileEntity(); - return getIconByIndex(tMetaTileEntity, 4 - i * 3 - j); - } - } - } - } - case 1 -> { - for (int i = -1; i < 2; i++) { - for (int j = -1; j < 2; j++) { - if (i == 0 && j == 0) continue; - if (isIsaControllerWithSide(aWorld, xCoord + j, yCoord + i, zCoord, side) != 0) { - IMetaTileEntity tMetaTileEntity = ((IGregTechTileEntity) aWorld - .getTileEntity(xCoord + j, yCoord + i, zCoord)).getMetaTileEntity(); - return getIconByIndex(tMetaTileEntity, 4 + i * 3 - j * tInvertLeftRightMod); - } - } - } - } - case 2 -> { - for (int i = -1; i < 2; i++) { - for (int j = -1; j < 2; j++) { - if (i == 0 && j == 0) continue; - if (isIsaControllerWithSide(aWorld, xCoord, yCoord + i, zCoord + j, side) != 0) { - IMetaTileEntity tMetaTileEntity = ((IGregTechTileEntity) aWorld - .getTileEntity(xCoord, yCoord + i, zCoord + j)).getMetaTileEntity(); - return getIconByIndex(tMetaTileEntity, 4 + i * 3 + j * tInvertLeftRightMod); - } - } - } - } - } - return TexturesGtBlock.TEXTURE_CASING_GRINDING_MILL.getIcon(); - } - - public boolean isCentrifugeRunning(IMetaTileEntity aTile) { - if (aTile == null) { - return false; - } else { - return aTile.getBaseMetaTileEntity() - .isActive(); - } - } - - public IIcon getIconByIndex(IMetaTileEntity aMetaTileEntity, int aIndex) { - if (isCentrifugeRunning(aMetaTileEntity)) { - return this.GRINDER_ACTIVE[aIndex].getIcon(); - } - - return this.GRINDER[aIndex].getIcon(); - } -} diff --git a/gtpp/src/main/java/gtPlusPlus/xmod/gregtech/common/blocks/textures/TexturesGtBlock.java b/gtpp/src/main/java/gtPlusPlus/xmod/gregtech/common/blocks/textures/TexturesGtBlock.java deleted file mode 100644 index 743cd0b85b..0000000000 --- a/gtpp/src/main/java/gtPlusPlus/xmod/gregtech/common/blocks/textures/TexturesGtBlock.java +++ /dev/null @@ -1,486 +0,0 @@ -package gtPlusPlus.xmod.gregtech.common.blocks.textures; - -import static gregtech.api.enums.Mods.GTPlusPlus; - -import net.minecraft.client.renderer.texture.TextureMap; -import net.minecraft.util.IIcon; -import net.minecraft.util.ResourceLocation; - -import gregtech.api.GregTech_API; -import gregtech.api.interfaces.IIconContainer; -import gregtech.api.interfaces.ITexture; -import gregtech.api.objects.GT_RenderedTexture; -import gtPlusPlus.api.objects.Logger; -import gtPlusPlus.api.objects.data.AutoMap; -import gtPlusPlus.core.lib.CORE; - -public class TexturesGtBlock { - - private static boolean mAnimated = CORE.ConfigSwitches.enableAnimatedTextures; - - private static AutoMap<Runnable> mCustomiconMap = new AutoMap<>(); - - /* - * Handles Custom Textures. - */ - - public static class CustomIcon implements IIconContainer, Runnable { - - protected IIcon mIcon; - protected String mIconName; - protected String mModID; - - public CustomIcon(final String aIconName) { - this(GTPlusPlus.ID, aIconName); - } - - public CustomIcon(final String aModID, final String aIconName) { - this.mIconName = aIconName; - this.mModID = aModID; - mCustomiconMap.put(this); - Logger.WARNING("Constructing a Custom Texture. " + this.mIconName); - GregTech_API.sGTBlockIconload.add(this); - } - - @Override - public IIcon getIcon() { - return this.mIcon; - } - - @Override - public IIcon getOverlayIcon() { - return null; - } - - @Override - public void run() { - this.mIcon = GregTech_API.sBlockIcons.registerIcon(this.mModID + ":" + this.mIconName); - Logger.WARNING( - "FIND ME _ Processing texture: " + this.getTextureFile() - .getResourcePath()); - } - - @Override - public ResourceLocation getTextureFile() { - return TextureMap.locationBlocksTexture; - } - } - - /* - * Add Some Custom Textures below. I am not sure whether or not I need to declare them as such, but better to be - * safe than sorry. Right? - */ - - // PlaceHolder Texture - private static final CustomIcon Internal_PlaceHolder = new CustomIcon("TileEntities/_PlaceHolder"); - public static final CustomIcon _PlaceHolder = Internal_PlaceHolder; - - public static final CustomIcon OVERLAY_ENERGY_OUT_MULTI_BUFFER = new CustomIcon( - "iconsets/OVERLAY_ENERGY_OUT_MULTI_BUFFER"); - - // Machine Casings - // Simple - private static final CustomIcon Internal_Casing_Machine_Simple_Top = new CustomIcon("TileEntities/machine_top"); - public static final CustomIcon Casing_Machine_Simple_Top = Internal_Casing_Machine_Simple_Top; - private static final CustomIcon Internal_Casing_Machine_Simple_Bottom = new CustomIcon( - "TileEntities/machine_bottom"); - public static final CustomIcon Casing_Machine_Simple_Bottom = Internal_Casing_Machine_Simple_Bottom; - // Advanced and Ultra - private static final CustomIcon Internal_Casing_Machine_Advanced = new CustomIcon("TileEntities/high_adv_machine"); - public static final CustomIcon Casing_Machine_Advanced = Internal_Casing_Machine_Advanced; - private static final CustomIcon Internal_Casing_Machine_Ultra = new CustomIcon("TileEntities/adv_machine_lesu"); - public static final CustomIcon Casing_Machine_Ultra = Internal_Casing_Machine_Ultra; - // Dimensional - Non Overlay - private static final CustomIcon Internal_Casing_Machine_Dimensional = new CustomIcon( - "TileEntities/adv_machine_dimensional"); - public static final CustomIcon Casing_Machine_Dimensional = Internal_Casing_Machine_Dimensional; - - // Material Casings - private static final CustomIcon Internal_Casing_Tantalloy61 = new CustomIcon( - "TileEntities/MACHINE_CASING_STABLE_TANTALLOY61"); - public static final CustomIcon Casing_Material_Tantalloy61 = Internal_Casing_Tantalloy61; - private static final CustomIcon Internal_Casing_MaragingSteel = new CustomIcon( - "TileEntities/MACHINE_CASING_STABLE_MARAGINGSTEEL"); - public static final CustomIcon Casing_Material_MaragingSteel = Internal_Casing_MaragingSteel; - private static final CustomIcon Internal_Casing_Stellite = new CustomIcon( - "TileEntities/MACHINE_CASING_STABLE_STELLITE"); - public static final CustomIcon Casing_Material_Stellite = Internal_Casing_Stellite; - private static final CustomIcon Internal_Casing_Talonite = new CustomIcon( - "TileEntities/MACHINE_CASING_STABLE_TALONITE"); - public static final CustomIcon Casing_Material_Talonite = Internal_Casing_Talonite; - private static final CustomIcon Internal_Turbine_SC_Casing = new TexturesGtBlock.CustomIcon("iconsets/SC_TURBINE"); - public static final CustomIcon Turbine_SC_Material_Casing = Internal_Turbine_SC_Casing; - private static final CustomIcon Internal_Casing_Tumbaga = new CustomIcon( - "TileEntities/MACHINE_CASING_STABLE_TUMBAGA"); - public static final CustomIcon Casing_Material_Tumbaga = Internal_Casing_Tumbaga; - private static final CustomIcon Internal_Casing_Zeron100 = new CustomIcon( - "TileEntities/MACHINE_CASING_STABLE_ZERON100"); - public static final CustomIcon Casing_Material_Zeron100 = Internal_Casing_Zeron100; - private static final CustomIcon Internal_Casing_Potin = new CustomIcon("TileEntities/MACHINE_CASING_STABLE_POTIN"); - public static final CustomIcon Casing_Material_Potin = Internal_Casing_Potin; - - private static final CustomIcon Internal_Casing_Grisium = new CustomIcon( - "TileEntities/MACHINE_CASING_STABLE_GRISIUM"); - public static final CustomIcon Casing_Material_Grisium = Internal_Casing_Grisium; - private static final CustomIcon Internal_Casing_RedSteel = new CustomIcon( - "TileEntities/MACHINE_CASING_STABLE_RED_STEEL"); - public static final CustomIcon Casing_Material_RedSteel = Internal_Casing_RedSteel; - private static final CustomIcon Internal_Casing_ZirconiumCarbide = new CustomIcon( - "TileEntities/MACHINE_CASING_STABLE_ZIRCONIUM_CARBIDE"); - public static final CustomIcon Casing_Material_ZirconiumCarbide = Internal_Casing_ZirconiumCarbide; - - private static final CustomIcon Internal_Casing_HastelloyX = new CustomIcon( - "TileEntities/MACHINE_CASING_STABLE_HASTELLOY_X"); - public static final CustomIcon Casing_Material_HastelloyX = Internal_Casing_HastelloyX; - private static final CustomIcon Internal_Casing_HastelloyN = new CustomIcon( - "TileEntities/MACHINE_CASING_STABLE_HASTELLOY_N"); - public static final CustomIcon Casing_Material_HastelloyN = Internal_Casing_HastelloyN; - private static final CustomIcon Internal_Casing_Fluid_IncoloyDS = new CustomIcon( - "TileEntities/MACHINE_CASING_FLUID_INCOLOY_DS"); - public static final CustomIcon Casing_Material_Fluid_IncoloyDS = Internal_Casing_Fluid_IncoloyDS; - - private static final CustomIcon Internal_Casing_Laurenium = new CustomIcon("TileEntities/MACHINE_CASING_LAURENIUM"); - public static final CustomIcon Casing_Material_Laurenium = Internal_Casing_Laurenium; - - // Trinium Alloys - public static final CustomIcon Casing_Trinium_Titanium = new CustomIcon( - "TileEntities/MACHINE_CASING_STABLE_TRINIUM_TITANIUM"); - public static final CustomIcon Casing_Trinium_Naquadah_Vent = new CustomIcon( - "TileEntities/MACHINE_CASING_STABLE_TRINIUM_NAQUADAH_VENT"); - - // Material Machine/Firebox Casings - private static final CustomIcon Internal_Casing_Staballoy_Firebox = new CustomIcon( - "TileEntities/MACHINE_CASING_FIREBOX_STABALLOY"); - public static final CustomIcon Casing_Staballoy_Firebox = Internal_Casing_Staballoy_Firebox; - - // Misc Casings - private static final CustomIcon Internal_Casing_Machine_Redstone_Off = new CustomIcon( - "TileEntities/cover_redstone_conductor"); - public static final CustomIcon Casing_Machine_Redstone_Off = Internal_Casing_Machine_Redstone_Off; - private static final CustomIcon Internal_Casing_Machine_Redstone_On = new CustomIcon( - "TileEntities/cover_redstone_emitter"); - public static final CustomIcon Casing_Machine_Redstone_On = Internal_Casing_Machine_Redstone_On; - - // Redox Cells - public static final CustomIcon Casing_Redox_1 = new CustomIcon("redox/redox1"); - public static final CustomIcon Casing_Redox_2 = new CustomIcon("redox/redox2"); - public static final CustomIcon Casing_Redox_3 = new CustomIcon("redox/redox3"); - public static final CustomIcon Casing_Redox_4 = new CustomIcon("redox/redox4"); - public static final CustomIcon Casing_Redox_5 = new CustomIcon("redox/redox5"); - public static final CustomIcon Casing_Redox_6 = new CustomIcon("redox/redox6"); - - // Special Block 2 - public static final CustomIcon Casing_Resonance_1 = new CustomIcon("special/block_1"); - public static final CustomIcon Casing_Resonance_2 = new CustomIcon("special/block_2"); - public static final CustomIcon Casing_Resonance_3 = new CustomIcon("special/block_3"); - public static final CustomIcon Casing_Resonance_4 = new CustomIcon("special/block_4"); - public static final CustomIcon Casing_Modulator_1 = new CustomIcon("special/block_5"); - public static final CustomIcon Casing_Modulator_2 = new CustomIcon("special/block_6"); - public static final CustomIcon Casing_Modulator_3 = new CustomIcon("special/block_7"); - public static final CustomIcon Casing_Modulator_4 = new CustomIcon("special/block_8"); - - // Centrifuge Casing - private static final CustomIcon Internal_Casing_Centrifuge = new CustomIcon( - "TileEntities/MACHINE_CASING_CENTRIFUGE"); - public static final CustomIcon Casing_Material_Centrifuge = Internal_Casing_Centrifuge; - - // Quantum Force Transformer Casing - // spotless:off - private static final CustomIcon Internal_Casing_QFT = new CustomIcon("TileEntities/MACHINE_CASING_QFT_COIL"); - public static final CustomIcon Casing_Coil_QFT = Internal_Casing_QFT; - public static final CustomIcon NeutronPulseManipulator = mAnimated ? new CustomIcon("NeutronPulseManipulator") : new CustomIcon("NeutronPulseManipulatorStatic"); - public static final CustomIcon CosmicFabricManipulator = mAnimated ? new CustomIcon("CosmicFabricManipulator") : new CustomIcon("CosmicFabricManipulatorStatic"); - public static final CustomIcon InfinityInfusedManipulator = mAnimated ? new CustomIcon("InfinityInfusedManipulator") : new CustomIcon("InfinityInfusedManipulatorStatic"); - public static final CustomIcon SpaceTimeContinuumRipper = mAnimated ? new CustomIcon("SpaceTimeContinuumRipper") : new CustomIcon("SpaceTimeContinuumRipperStatic"); - public static final CustomIcon Manipulator_Top = new CustomIcon("Manipulator_Top"); - public static final CustomIcon NeutronShieldingCore = mAnimated ? new CustomIcon("NeutronShieldingCore") : new CustomIcon("NeutronShieldingCoreStatic"); - public static final CustomIcon CosmicFabricShieldingCore = mAnimated ? new CustomIcon("CosmicFabricShieldingCore") : new CustomIcon("CosmicFabricShieldingCoreStatic"); - public static final CustomIcon InfinityInfusedShieldingCore = mAnimated ? new CustomIcon("InfinityInfusedShieldingCore") : new CustomIcon("InfinityInfusedShieldingCoreStatic"); - public static final CustomIcon SpaceTimeBendingCore = mAnimated ? new CustomIcon("SpaceTimeBendingCore") : new CustomIcon("SpaceTimeBendingCoreStatic"); - public static final CustomIcon ForceFieldGlass = new CustomIcon("ForceFieldGlass"); - public static final CustomIcon ForceField = new CustomIcon("rendering/ForceField"); - public static final CustomIcon Blank = new CustomIcon("Blank"); - //spotless:on - - // MACHINE_CASING_FARM_MANAGER_STRUCTURAL - // Farm Manager Casings - private static final CustomIcon Internal_Casing_Machine_Farm_Manager = new CustomIcon( - "TileEntities/MACHINE_CASING_FARM_MANAGER_STRUCTURAL"); - public static final CustomIcon Casing_Machine_Farm_Manager = Internal_Casing_Machine_Farm_Manager; - // Acacia_Log - private static final CustomIcon Internal_Casing_Machine_Acacia_Log = new CustomIcon("TileEntities/log_acacia_top"); - public static final CustomIcon Casing_Machine_Acacia_Log = Internal_Casing_Machine_Acacia_Log; - // Podzol Top - private static final CustomIcon Internal_Casing_Machine_Podzol = new CustomIcon("TileEntities/dirt_podzol_top"); - public static final CustomIcon Casing_Machine_Podzol = Internal_Casing_Machine_Podzol; - - // Structural Blocks - private static final CustomIcon Internal_Casing_Machine_Metal_Grate_A = new CustomIcon("chrono/MetalGrate"); - public static final CustomIcon Casing_Machine_Metal_Grate_A = Internal_Casing_Machine_Metal_Grate_A; - - private static final CustomIcon Internal_Casing_Machine_Metal_Panel_A = new CustomIcon("chrono/MetalPanel"); - public static final CustomIcon Casing_Machine_Metal_Panel_A = Internal_Casing_Machine_Metal_Panel_A; - private static final CustomIcon Internal_Casing_Machine_Metal_Sheet_A = new CustomIcon("chrono/MetalSheet"); - public static final CustomIcon Casing_Machine_Metal_Sheet_A = Internal_Casing_Machine_Metal_Sheet_A; - private static final CustomIcon Internal_Casing_Machine_Metal_Sheet_H = new CustomIcon("chrono/MetalSheet8"); - public static final CustomIcon Casing_Machine_Metal_Sheet_H = Internal_Casing_Machine_Metal_Sheet_H; - private static final CustomIcon Internal_Casing_Machine_Metal_Sheet_I = new CustomIcon("chrono/MetalSheet9"); - public static final CustomIcon Casing_Machine_Metal_Sheet_I = Internal_Casing_Machine_Metal_Sheet_I; - private static final CustomIcon Internal_Overlay_Machine_Cyber_A = new CustomIcon("chrono/CyberPanel"); - public static final CustomIcon Overlay_Machine_Cyber_A = Internal_Overlay_Machine_Cyber_A; - - public static final CustomIcon TEXTURE_CASING_AMAZON = new CustomIcon("TileEntities/CASING_AMAZON"); - public static final CustomIcon TEXTURE_CASING_ADVANCED_CRYOGENIC = new CustomIcon( - "TileEntities/MACHINE_CASING_ADVANCED_CRYOGENIC"); - public static final CustomIcon TEXTURE_CASING_ADVANCED_VOLCNUS = new CustomIcon( - "TileEntities/MACHINE_CASING_ADVANCED_VOLCANUS"); - public static final CustomIcon TEXTURE_CASING_ROCKETDYNE = new CustomIcon("TileEntities/MACHINE_CASING_ROCKETDYNE"); - public static final CustomIcon TEXTURE_CASING_GRINDING_MILL = new CustomIcon( - "TileEntities/MACHINE_CASING_GRINDING_FACTORY"); - public static final CustomIcon TEXTURE_CASING_FLOTATION = new CustomIcon("TileEntities/MACHINE_CASING_FLOTATION"); - - // Custom Pipes - public static final CustomIcon TEXTURE_PIPE_GRINDING_MILL = new CustomIcon("TileEntities/MACHINE_CASING_PIPE_T1"); - public static final CustomIcon TEXTURE_PIPE_GENERIC = new CustomIcon("iconsets/MACHINE_CASING_PIPE_GENERIC"); - - // Custom Gearboxes - public static final CustomIcon TEXTURE_GEARBOX_GRINDING_MILL = new CustomIcon( - "TileEntities/MACHINE_CASING_GEARBOX_T1"); - public static final CustomIcon TEXTURE_GEARBOX_GENERIC = new CustomIcon("iconsets/MACHINE_CASING_GEARBOX_GENERIC"); - - public static final CustomIcon TEXTURE_CASING_FUSION_COIL_II = new CustomIcon("iconsets/MACHINE_CASING_FUSION_3"); - public static final CustomIcon TEXTURE_CASING_FUSION_COIL_II_INNER = new CustomIcon( - "iconsets/MACHINE_CASING_FUSION_COIL_II"); - public static final CustomIcon TEXTURE_CASING_FUSION_CASING_ULTRA = new CustomIcon( - "iconsets/MACHINE_CASING_FUSION_GLASS_ULTRA"); - - public static final CustomIcon TEXTURE_CASING_FUSION_COIL_III = new CustomIcon("iconsets/MACHINE_CASING_FUSION_4"); - public static final CustomIcon TEXTURE_CASING_FUSION_COIL_III_INNER = new CustomIcon( - "iconsets/MACHINE_CASING_FUSION_COIL_III"); - public static final CustomIcon TEXTURE_CASING_FUSION_CASING_HYPER = new CustomIcon( - "iconsets/MACHINE_CASING_FUSION_GLASS_HYPER"); - // - public static final CustomIcon TEXTURE_CASING_FUSION_COIL_II_1 = new CustomIcon("iconsets/FUSIONIII_1"); - public static final CustomIcon TEXTURE_CASING_FUSION_COIL_II_2 = new CustomIcon("iconsets/FUSIONIII_2"); - public static final CustomIcon TEXTURE_CASING_FUSION_COIL_II_3 = new CustomIcon("iconsets/FUSIONIII_3"); - public static final CustomIcon TEXTURE_CASING_FUSION_COIL_II_4 = new CustomIcon("iconsets/FUSIONIII_4"); - public static final CustomIcon TEXTURE_CASING_FUSION_COIL_II_5 = new CustomIcon("iconsets/FUSIONIII_5"); - public static final CustomIcon TEXTURE_CASING_FUSION_COIL_II_6 = new CustomIcon("iconsets/FUSIONIII_6"); - public static final CustomIcon TEXTURE_CASING_FUSION_COIL_II_7 = new CustomIcon("iconsets/FUSIONIII_7"); - public static final CustomIcon TEXTURE_CASING_FUSION_COIL_II_8 = new CustomIcon("iconsets/FUSIONIII_8"); - public static final CustomIcon TEXTURE_CASING_FUSION_COIL_II_9 = new CustomIcon("iconsets/FUSIONIII_9"); - public static final CustomIcon TEXTURE_CASING_FUSION_COIL_II_10 = new CustomIcon("iconsets/FUSIONIII_10"); - public static final CustomIcon TEXTURE_CASING_FUSION_COIL_II_11 = new CustomIcon("iconsets/FUSIONIII_11"); - public static final CustomIcon TEXTURE_CASING_FUSION_COIL_II_12 = new CustomIcon("iconsets/FUSIONIII_12"); - - // MK5 Fusion casings - public static final CustomIcon TEXTURE_CASING_FUSION_COIL_III_1 = new CustomIcon("iconsets/FUSIONIV_1"); - public static final CustomIcon TEXTURE_CASING_FUSION_COIL_III_2 = new CustomIcon("iconsets/FUSIONIV_2"); - public static final CustomIcon TEXTURE_CASING_FUSION_COIL_III_3 = new CustomIcon("iconsets/FUSIONIV_3"); - public static final CustomIcon TEXTURE_CASING_FUSION_COIL_III_4 = new CustomIcon("iconsets/FUSIONIV_4"); - public static final CustomIcon TEXTURE_CASING_FUSION_COIL_III_5 = new CustomIcon("iconsets/FUSIONIV_5"); - public static final CustomIcon TEXTURE_CASING_FUSION_COIL_III_6 = new CustomIcon("iconsets/FUSIONIV_6"); - public static final CustomIcon TEXTURE_CASING_FUSION_COIL_III_7 = new CustomIcon("iconsets/FUSIONIV_7"); - public static final CustomIcon TEXTURE_CASING_FUSION_COIL_III_8 = new CustomIcon("iconsets/FUSIONIV_8"); - public static final CustomIcon TEXTURE_CASING_FUSION_COIL_III_9 = new CustomIcon("iconsets/FUSIONIV_9"); - public static final CustomIcon TEXTURE_CASING_FUSION_COIL_III_10 = new CustomIcon("iconsets/FUSIONIV_10"); - public static final CustomIcon TEXTURE_CASING_FUSION_COIL_III_11 = new CustomIcon("iconsets/FUSIONIV_11"); - public static final CustomIcon TEXTURE_CASING_FUSION_COIL_III_12 = new CustomIcon("iconsets/FUSIONIV_12"); - - // Overlays - // Fan Textures - private static final CustomIcon Internal_Overlay_Machine_Vent = new CustomIcon( - "TileEntities/machine_top_vent_rotating"); - public static final CustomIcon Overlay_Machine_Vent = Internal_Overlay_Machine_Vent; - private static final CustomIcon Internal_Overlay_Machine_Vent_Fast = new CustomIcon( - "TileEntities/machine_top_vent_rotating_fast"); - public static final CustomIcon Overlay_Machine_Vent_Fast = Internal_Overlay_Machine_Vent_Fast; - private static final CustomIcon Internal_Overlay_Machine_Vent_Adv = new CustomIcon( - "TileEntities/adv_machine_vent_rotating"); - // Diesel Engines - private static final CustomIcon Internal_Overlay_Machine_Diesel_Vertical = new CustomIcon( - "TileEntities/machine_top_dieselmotor"); - public static final CustomIcon Overlay_Machine_Diesel_Vertical = Internal_Overlay_Machine_Diesel_Vertical; - private static final CustomIcon Internal_Overlay_Machine_Diesel_Horizontal = new CustomIcon( - "TileEntities/machine_top_dieselmotor2"); - public static final CustomIcon Overlay_Machine_Diesel_Horizontal = Internal_Overlay_Machine_Diesel_Horizontal; - private static final CustomIcon Internal_Overlay_Machine_Diesel_Vertical_Active = new CustomIcon( - "TileEntities/machine_top_dieselmotor_active"); - public static final CustomIcon Overlay_Machine_Diesel_Vertical_Active = Internal_Overlay_Machine_Diesel_Vertical_Active; - private static final CustomIcon Internal_Overlay_Machine_Diesel_Horizontal_Active = new CustomIcon( - "TileEntities/machine_top_dieselmotor2_active"); - public static final CustomIcon Overlay_Machine_Diesel_Horizontal_Active = Internal_Overlay_Machine_Diesel_Horizontal_Active; - // Computer Screens - private static final CustomIcon Internal_Casing_Machine_Screen_1 = new CustomIcon( - "TileEntities/adv_machine_screen_random1"); - public static final CustomIcon Casing_Machine_Screen_1 = Internal_Casing_Machine_Screen_1; - private static final CustomIcon Internal_Casing_Machine_Screen_2 = new CustomIcon( - "TileEntities/adv_machine_screen_random2"); - public static final CustomIcon Casing_Machine_Screen_2 = Internal_Casing_Machine_Screen_2; - private static final CustomIcon Internal_Casing_Machine_Screen_3 = new CustomIcon( - "TileEntities/adv_machine_screen_random3"); - public static final CustomIcon Casing_Machine_Screen_3 = Internal_Casing_Machine_Screen_3; - - private static final CustomIcon Internal_Casing_Machine_Screen_Rainbow = new CustomIcon( - "TileEntities/overlay_rainbowscreen"); - public static final CustomIcon Casing_Machine_Screen_Rainbow = Internal_Casing_Machine_Screen_Rainbow; - private static final CustomIcon Internal_Casing_Machine_Screen_Frequency = new CustomIcon( - "TileEntities/adv_machine_screen_frequency"); - public static final CustomIcon Casing_Machine_Screen_Frequency = Internal_Casing_Machine_Screen_Frequency; - private static final CustomIcon Internal_Overlay_Machine_Screen_Logo = new CustomIcon( - "TileEntities/adv_machine_screen_logo"); - public static final CustomIcon Overlay_Machine_Screen_Logo = Internal_Overlay_Machine_Screen_Logo; - - // Machine Controller Overlays - private static final CustomIcon Internal_Overlay_Machine_Controller_Default = new CustomIcon( - "iconsets/OVERLAY_FRONT_ELECTRIC_BLAST_FURNACE_ANIMATED"); - public static final CustomIcon Overlay_Machine_Controller_Default = Internal_Overlay_Machine_Controller_Default; - private static final CustomIcon Internal_Overlay_Machine_Controller_Default_Active = new CustomIcon( - "iconsets/OVERLAY_FRONT_ELECTRIC_BLAST_FURNACE_ANIMATED_ACTIVE"); - public static final CustomIcon Overlay_Machine_Controller_Default_Active = Internal_Overlay_Machine_Controller_Default_Active; - - private static final CustomIcon Internal_Overlay_Machine_Controller_Advanced = new CustomIcon( - "iconsets/OVERLAY_FRONT_ADVANCED_MULTIBLOCK_ANIMATED"); - public static final CustomIcon Overlay_Machine_Controller_Advanced = Internal_Overlay_Machine_Controller_Advanced; - private static final CustomIcon Internal_Overlay_Machine_Controller_Advanced_Active = new CustomIcon( - "iconsets/OVERLAY_FRONT_ADVANCED_MULTIBLOCK_ANIMATED_ACTIVE"); - public static final CustomIcon Overlay_Machine_Controller_Advanced_Active = Internal_Overlay_Machine_Controller_Advanced_Active; - - // Crafting Overlays - public static final CustomIcon Casing_Adv_Workbench_Crafting_Overlay = new CustomIcon( - "TileEntities/gt4/machine_top_crafting"); - - public static final CustomIcon Casing_CropHarvester_Cutter = new CustomIcon("TileEntities/gt4/OVERLAY_CROP"); - public static final CustomIcon Casing_CropHarvester_Boxes = new CustomIcon("TileEntities/gt4/OVERLAY_BOXES"); - - // Covers - private static final CustomIcon Internal_Overlay_Overflow_Valve = new CustomIcon("iconsets/OVERLAY_OVERFLOW_VALVE"); - public static final CustomIcon Overlay_Overflow_Valve = Internal_Overlay_Overflow_Valve; - - // Hatch Overlays - // Charger Texture - private static final CustomIcon Internal_Overlay_Hatch_Charger = new CustomIcon("TileEntities/cover_charger"); - public static final CustomIcon Overlay_Hatch_Charger = Internal_Overlay_Hatch_Charger; - // Discharger Texture - private static final CustomIcon Internal_Overlay_Hatch_Discharger = new CustomIcon("TileEntities/cover_discharge"); - public static final CustomIcon Overlay_Hatch_Discharger = Internal_Overlay_Hatch_Discharger; - // Advanced Muffler - private static final CustomIcon Internal_Overlay_Hatch_Muffler_Adv = new CustomIcon("iconsets/OVERLAY_MUFFLER_ADV"); - public static final CustomIcon Overlay_Hatch_Muffler_Adv = Internal_Overlay_Hatch_Muffler_Adv; - // Milling Ball Bus - private static final CustomIcon Internal_Overlay_Bus_Milling_Balls = new CustomIcon( - "iconsets/OVERLAY_MILLING_BALL_BUS"); - public static final CustomIcon Overlay_Bus_Milling_Balls = Internal_Overlay_Bus_Milling_Balls; - // Catalyst Bus - private static final CustomIcon Internal_Overlay_Bus_Catalyst = new CustomIcon("iconsets/OVERLAY_CATALYSTS"); - public static final CustomIcon Overlay_Bus_Catalyst = Internal_Overlay_Bus_Catalyst; - - // Data Orb Hatch - public static final CustomIcon Overlay_Hatch_Data_Orb = new CustomIcon("iconsets/OVERLAY_DATA_ORB"); - - // Dimensional - private static final CustomIcon Internal_Overlay_Machine_Dimensional_Orange = new CustomIcon( - "TileEntities/adv_machine_dimensional_cover_orange"); - public static final CustomIcon Overlay_Machine_Dimensional_Orange = Internal_Overlay_Machine_Dimensional_Orange; - // Icons - private static final CustomIcon Internal_Overlay_MatterFab = new CustomIcon("TileEntities/adv_machine_matterfab"); - public static final CustomIcon Overlay_MatterFab = Internal_Overlay_MatterFab; - private static final CustomIcon Internal_Overlay_MatterFab_Active = new CustomIcon( - "TileEntities/adv_machine_matterfab_active"); - public static final CustomIcon Overlay_MatterFab_Active = Internal_Overlay_MatterFab_Active; - - private static final CustomIcon Internal_Overlay_MatterFab_Animated = new CustomIcon( - "TileEntities/adv_machine_matterfab_animated"); - public static final CustomIcon Overlay_MatterFab_Animated = Internal_Overlay_MatterFab_Animated; - private static final CustomIcon Internal_Overlay_MatterFab_Active_Animated = new CustomIcon( - "TileEntities/adv_machine_matterfab_active_animated"); - public static final CustomIcon Overlay_MatterFab_Active_Animated = Internal_Overlay_MatterFab_Active_Animated; - - private static final CustomIcon Internal_Overlay_Water = new CustomIcon("TileEntities/adv_machine_water"); - public static final CustomIcon Overlay_Water = Internal_Overlay_Water; - private static final CustomIcon Internal_Overlay_UU_Matter = new CustomIcon("TileEntities/adv_machine_uum"); - public static final CustomIcon Overlay_UU_Matter = Internal_Overlay_UU_Matter; - - // GT++ Tiered Hulls - public static final CustomIcon TEXTURE_CASING_TIERED_ULV = new CustomIcon("iconsets/TieredHulls/CASING_ULV"); - public static final CustomIcon TEXTURE_CASING_TIERED_LV = new CustomIcon("iconsets/TieredHulls/CASING_LV"); - public static final CustomIcon TEXTURE_CASING_TIERED_MV = new CustomIcon("iconsets/TieredHulls/CASING_MV"); - public static final CustomIcon TEXTURE_CASING_TIERED_HV = new CustomIcon("iconsets/TieredHulls/CASING_HV"); - public static final CustomIcon TEXTURE_CASING_TIERED_EV = new CustomIcon("iconsets/TieredHulls/CASING_EV"); - public static final CustomIcon TEXTURE_CASING_TIERED_IV = new CustomIcon("iconsets/TieredHulls/CASING_IV"); - public static final CustomIcon TEXTURE_CASING_TIERED_LuV = new CustomIcon("iconsets/TieredHulls/CASING_LuV"); - public static final CustomIcon TEXTURE_CASING_TIERED_ZPM = new CustomIcon("iconsets/TieredHulls/CASING_ZPM"); - public static final CustomIcon TEXTURE_CASING_TIERED_UV = new CustomIcon("iconsets/TieredHulls/CASING_UV"); - public static final CustomIcon TEXTURE_CASING_TIERED_MAX = new CustomIcon("iconsets/TieredHulls/CASING_MAX"); - - // Metroid related - public static final CustomIcon TEXTURE_METAL_PANEL_A = new CustomIcon("metro/TEXTURE_METAL_PANEL_A"); - public static final CustomIcon TEXTURE_METAL_PANEL_B = new CustomIcon("metro/TEXTURE_METAL_PANEL_B"); - public static final CustomIcon TEXTURE_METAL_PANEL_C = new CustomIcon("metro/TEXTURE_METAL_PANEL_C"); - public static final CustomIcon TEXTURE_METAL_PANEL_D = new CustomIcon("metro/TEXTURE_METAL_PANEL_D"); - public static final CustomIcon TEXTURE_METAL_PANEL_F = new CustomIcon("metro/TEXTURE_METAL_PANEL_F"); - - public static final CustomIcon TEXTURE_MAGIC_PANEL_A = new CustomIcon("metro/TEXTURE_MAGIC_A"); - public static final CustomIcon TEXTURE_MAGIC_PANEL_B = new CustomIcon("metro/TEXTURE_MAGIC_B"); - - public static final CustomIcon TEXTURE_ORGANIC_PANEL_A_GLOWING = new CustomIcon( - "metro/TEXTURE_ORGANIC_PANEL_A_GLOWING"); - - public static final CustomIcon TEXTURE_STONE_RED_A = new CustomIcon("metro/TEXTURE_STONE_RED_A"); - public static final CustomIcon TEXTURE_STONE_RED_B = new CustomIcon("metro/TEXTURE_STONE_RED_B"); - - public static final CustomIcon OVERLAY_SC_TURBINE1 = new TexturesGtBlock.CustomIcon("iconsets/SC_TURBINE_IDEL1"); - public static final CustomIcon OVERLAY_SC_TURBINE2 = new TexturesGtBlock.CustomIcon("iconsets/SC_TURBINE_IDEL2"); - public static final CustomIcon OVERLAY_SC_TURBINE3 = new TexturesGtBlock.CustomIcon("iconsets/SC_TURBINE_IDEL3"); - public static final CustomIcon OVERLAY_SC_TURBINE4 = new TexturesGtBlock.CustomIcon("iconsets/SC_TURBINE_IDEL4"); - public static final CustomIcon OVERLAY_SC_TURBINE5 = new TexturesGtBlock.CustomIcon("iconsets/SC_TURBINE_IDEL5"); - public static final CustomIcon OVERLAY_SC_TURBINE6 = new TexturesGtBlock.CustomIcon("iconsets/SC_TURBINE_IDEL6"); - public static final CustomIcon OVERLAY_SC_TURBINE7 = new TexturesGtBlock.CustomIcon("iconsets/SC_TURBINE_IDEL7"); - public static final CustomIcon OVERLAY_SC_TURBINE8 = new TexturesGtBlock.CustomIcon("iconsets/SC_TURBINE_IDEL8"); - public static final CustomIcon OVERLAY_SC_TURBINE9 = new TexturesGtBlock.CustomIcon("iconsets/SC_TURBINE_IDEL9"); - - public static final CustomIcon OVERLAY_SC_TURBINE1_ACTIVE = new TexturesGtBlock.CustomIcon("iconsets/SC_TURBINE1"); - public static final CustomIcon OVERLAY_SC_TURBINE2_ACTIVE = new TexturesGtBlock.CustomIcon("iconsets/SC_TURBINE2"); - public static final CustomIcon OVERLAY_SC_TURBINE3_ACTIVE = new TexturesGtBlock.CustomIcon("iconsets/SC_TURBINE3"); - public static final CustomIcon OVERLAY_SC_TURBINE4_ACTIVE = new TexturesGtBlock.CustomIcon("iconsets/SC_TURBINE4"); - public static final CustomIcon OVERLAY_SC_TURBINE5_ACTIVE = new TexturesGtBlock.CustomIcon("iconsets/SC_TURBINE5"); - public static final CustomIcon OVERLAY_SC_TURBINE6_ACTIVE = new TexturesGtBlock.CustomIcon("iconsets/SC_TURBINE6"); - public static final CustomIcon OVERLAY_SC_TURBINE7_ACTIVE = new TexturesGtBlock.CustomIcon("iconsets/SC_TURBINE7"); - public static final CustomIcon OVERLAY_SC_TURBINE8_ACTIVE = new TexturesGtBlock.CustomIcon("iconsets/SC_TURBINE8"); - public static final CustomIcon OVERLAY_SC_TURBINE9_ACTIVE = new TexturesGtBlock.CustomIcon("iconsets/SC_TURBINE9"); - public static final CustomIcon TEXTURE_TECH_A = new CustomIcon("metro/TEXTURE_TECH_A"); - public static final CustomIcon TEXTURE_TECH_B = new CustomIcon("metro/TEXTURE_TECH_B"); - public static final CustomIcon TEXTURE_TECH_C = new CustomIcon("metro/TEXTURE_TECH_C"); - - public static final CustomIcon TEXTURE_TECH_PANEL_D = new CustomIcon("metro/TEXTURE_TECH_PANEL_D"); - public static final CustomIcon TEXTURE_TECH_PANEL_H = new CustomIcon("metro/TEXTURE_TECH_PANEL_H"); - - public static ITexture[] OVERLAYS_ENERGY_OUT_MULTI_BUFFER = new ITexture[] { - new GT_RenderedTexture(OVERLAY_ENERGY_OUT_MULTI_BUFFER, new short[] { 220, 220, 220, 0 }), - new GT_RenderedTexture(OVERLAY_ENERGY_OUT_MULTI_BUFFER, new short[] { 220, 220, 220, 0 }), - new GT_RenderedTexture(OVERLAY_ENERGY_OUT_MULTI_BUFFER, new short[] { 255, 100, 0, 0 }), - new GT_RenderedTexture(OVERLAY_ENERGY_OUT_MULTI_BUFFER, new short[] { 255, 255, 30, 0 }), - new GT_RenderedTexture(OVERLAY_ENERGY_OUT_MULTI_BUFFER, new short[] { 128, 128, 128, 0 }), - new GT_RenderedTexture(OVERLAY_ENERGY_OUT_MULTI_BUFFER, new short[] { 240, 240, 245, 0 }), - new GT_RenderedTexture(OVERLAY_ENERGY_OUT_MULTI_BUFFER, new short[] { 240, 240, 245, 0 }), - new GT_RenderedTexture(OVERLAY_ENERGY_OUT_MULTI_BUFFER, new short[] { 240, 240, 245, 0 }), - new GT_RenderedTexture(OVERLAY_ENERGY_OUT_MULTI_BUFFER, new short[] { 240, 240, 245, 0 }), - new GT_RenderedTexture(OVERLAY_ENERGY_OUT_MULTI_BUFFER, new short[] { 240, 240, 245, 0 }) }; - - public static IIconContainer[] CONNECTED_FUSION_HULLS = new IIconContainer[] { TEXTURE_CASING_FUSION_COIL_II_1, - TEXTURE_CASING_FUSION_COIL_II_2, TEXTURE_CASING_FUSION_COIL_II_3, TEXTURE_CASING_FUSION_COIL_II_4, - TEXTURE_CASING_FUSION_COIL_II_5, TEXTURE_CASING_FUSION_COIL_II_6, TEXTURE_CASING_FUSION_COIL_II_7, - TEXTURE_CASING_FUSION_COIL_II_8, TEXTURE_CASING_FUSION_COIL_II_9, TEXTURE_CASING_FUSION_COIL_II_10, - TEXTURE_CASING_FUSION_COIL_II_11, TEXTURE_CASING_FUSION_COIL_II_12 }; - - public static IIconContainer[] CONNECTED_FUSION_HULLS_MK4 = new IIconContainer[] { TEXTURE_CASING_FUSION_COIL_III_1, - TEXTURE_CASING_FUSION_COIL_III_2, TEXTURE_CASING_FUSION_COIL_III_3, TEXTURE_CASING_FUSION_COIL_III_4, - TEXTURE_CASING_FUSION_COIL_III_5, TEXTURE_CASING_FUSION_COIL_III_6, TEXTURE_CASING_FUSION_COIL_III_7, - TEXTURE_CASING_FUSION_COIL_III_8, TEXTURE_CASING_FUSION_COIL_III_9, TEXTURE_CASING_FUSION_COIL_III_10, - TEXTURE_CASING_FUSION_COIL_III_11, TEXTURE_CASING_FUSION_COIL_III_12 }; - - public static IIconContainer[] TIERED_MACHINE_HULLS = new IIconContainer[] { TEXTURE_CASING_TIERED_ULV, - TEXTURE_CASING_TIERED_LV, TEXTURE_CASING_TIERED_MV, TEXTURE_CASING_TIERED_HV, TEXTURE_CASING_TIERED_EV, - TEXTURE_CASING_TIERED_IV, TEXTURE_CASING_TIERED_LuV, TEXTURE_CASING_TIERED_ZPM, TEXTURE_CASING_TIERED_UV, - TEXTURE_CASING_TIERED_MAX }; -} diff --git a/gtpp/src/main/java/gtPlusPlus/xmod/gregtech/common/blocks/textures/TexturesGtTools.java b/gtpp/src/main/java/gtPlusPlus/xmod/gregtech/common/blocks/textures/TexturesGtTools.java deleted file mode 100644 index a9f74cd75d..0000000000 --- a/gtpp/src/main/java/gtPlusPlus/xmod/gregtech/common/blocks/textures/TexturesGtTools.java +++ /dev/null @@ -1,51 +0,0 @@ -package gtPlusPlus.xmod.gregtech.common.blocks.textures; - -import static gregtech.api.enums.Mods.GTPlusPlus; - -import net.minecraft.client.renderer.texture.TextureMap; -import net.minecraft.util.IIcon; -import net.minecraft.util.ResourceLocation; - -import gregtech.api.GregTech_API; -import gregtech.api.interfaces.IIconContainer; -import gtPlusPlus.api.objects.Logger; - -public final class TexturesGtTools { - - public static final CustomIcon ANGLE_GRINDER = new CustomIcon("iconsets/ANGLE_GRINDER"); - public static final CustomIcon ELECTRIC_SNIPS = new CustomIcon("iconsets/ELECTRIC_SNIPS"); - - public static final class CustomIcon implements IIconContainer, Runnable { - - private IIcon mIcon, mOverlay; - private final String mIconName; - - public CustomIcon(final String aIconName) { - this.mIconName = aIconName; - Logger.INFO("Constructing a Custom Texture. " + this.mIconName); - GregTech_API.sGTItemIconload.add(this); - } - - @Override - public IIcon getIcon() { - return this.mIcon; - } - - @Override - public IIcon getOverlayIcon() { - return this.mOverlay; - } - - @Override - public void run() { - this.mIcon = GregTech_API.sItemIcons.registerIcon(GTPlusPlus.ID + ":" + this.mIconName); - // Utils.LOG_INFO("Registering a Custom Texture. "+mIcon.g); - this.mOverlay = GregTech_API.sItemIcons.registerIcon(GTPlusPlus.ID + ":" + this.mIconName + "_OVERLAY"); - } - - @Override - public ResourceLocation getTextureFile() { - return TextureMap.locationItemsTexture; - } - } -} diff --git a/gtpp/src/main/java/gtPlusPlus/xmod/gregtech/common/blocks/textures/turbine/LargeTurbineTextureHandler.java b/gtpp/src/main/java/gtPlusPlus/xmod/gregtech/common/blocks/textures/turbine/LargeTurbineTextureHandler.java deleted file mode 100644 index c983044319..0000000000 --- a/gtpp/src/main/java/gtPlusPlus/xmod/gregtech/common/blocks/textures/turbine/LargeTurbineTextureHandler.java +++ /dev/null @@ -1,410 +0,0 @@ -package gtPlusPlus.xmod.gregtech.common.blocks.textures.turbine; - -import static gregtech.api.enums.Textures.BlockIcons.LARGETURBINE_SS1; -import static gregtech.api.enums.Textures.BlockIcons.LARGETURBINE_SS2; -import static gregtech.api.enums.Textures.BlockIcons.LARGETURBINE_SS3; -import static gregtech.api.enums.Textures.BlockIcons.LARGETURBINE_SS4; -import static gregtech.api.enums.Textures.BlockIcons.LARGETURBINE_SS5; -import static gregtech.api.enums.Textures.BlockIcons.LARGETURBINE_SS6; -import static gregtech.api.enums.Textures.BlockIcons.LARGETURBINE_SS7; -import static gregtech.api.enums.Textures.BlockIcons.LARGETURBINE_SS8; -import static gregtech.api.enums.Textures.BlockIcons.LARGETURBINE_SS9; -import static gregtech.api.enums.Textures.BlockIcons.LARGETURBINE_SS_ACTIVE1; -import static gregtech.api.enums.Textures.BlockIcons.LARGETURBINE_SS_ACTIVE2; -import static gregtech.api.enums.Textures.BlockIcons.LARGETURBINE_SS_ACTIVE3; -import static gregtech.api.enums.Textures.BlockIcons.LARGETURBINE_SS_ACTIVE4; -import static gregtech.api.enums.Textures.BlockIcons.LARGETURBINE_SS_ACTIVE5; -import static gregtech.api.enums.Textures.BlockIcons.LARGETURBINE_SS_ACTIVE6; -import static gregtech.api.enums.Textures.BlockIcons.LARGETURBINE_SS_ACTIVE7; -import static gregtech.api.enums.Textures.BlockIcons.LARGETURBINE_SS_ACTIVE8; -import static gregtech.api.enums.Textures.BlockIcons.LARGETURBINE_SS_ACTIVE9; -import static gregtech.api.enums.Textures.BlockIcons.LARGETURBINE_ST1; -import static gregtech.api.enums.Textures.BlockIcons.LARGETURBINE_ST2; -import static gregtech.api.enums.Textures.BlockIcons.LARGETURBINE_ST3; -import static gregtech.api.enums.Textures.BlockIcons.LARGETURBINE_ST4; -import static gregtech.api.enums.Textures.BlockIcons.LARGETURBINE_ST5; -import static gregtech.api.enums.Textures.BlockIcons.LARGETURBINE_ST6; -import static gregtech.api.enums.Textures.BlockIcons.LARGETURBINE_ST7; -import static gregtech.api.enums.Textures.BlockIcons.LARGETURBINE_ST8; -import static gregtech.api.enums.Textures.BlockIcons.LARGETURBINE_ST9; -import static gregtech.api.enums.Textures.BlockIcons.LARGETURBINE_ST_ACTIVE1; -import static gregtech.api.enums.Textures.BlockIcons.LARGETURBINE_ST_ACTIVE2; -import static gregtech.api.enums.Textures.BlockIcons.LARGETURBINE_ST_ACTIVE3; -import static gregtech.api.enums.Textures.BlockIcons.LARGETURBINE_ST_ACTIVE4; -import static gregtech.api.enums.Textures.BlockIcons.LARGETURBINE_ST_ACTIVE5; -import static gregtech.api.enums.Textures.BlockIcons.LARGETURBINE_ST_ACTIVE6; -import static gregtech.api.enums.Textures.BlockIcons.LARGETURBINE_ST_ACTIVE7; -import static gregtech.api.enums.Textures.BlockIcons.LARGETURBINE_ST_ACTIVE8; -import static gregtech.api.enums.Textures.BlockIcons.LARGETURBINE_ST_ACTIVE9; -import static gregtech.api.enums.Textures.BlockIcons.LARGETURBINE_TI1; -import static gregtech.api.enums.Textures.BlockIcons.LARGETURBINE_TI2; -import static gregtech.api.enums.Textures.BlockIcons.LARGETURBINE_TI3; -import static gregtech.api.enums.Textures.BlockIcons.LARGETURBINE_TI4; -import static gregtech.api.enums.Textures.BlockIcons.LARGETURBINE_TI5; -import static gregtech.api.enums.Textures.BlockIcons.LARGETURBINE_TI6; -import static gregtech.api.enums.Textures.BlockIcons.LARGETURBINE_TI7; -import static gregtech.api.enums.Textures.BlockIcons.LARGETURBINE_TI8; -import static gregtech.api.enums.Textures.BlockIcons.LARGETURBINE_TI9; -import static gregtech.api.enums.Textures.BlockIcons.LARGETURBINE_TI_ACTIVE1; -import static gregtech.api.enums.Textures.BlockIcons.LARGETURBINE_TI_ACTIVE2; -import static gregtech.api.enums.Textures.BlockIcons.LARGETURBINE_TI_ACTIVE3; -import static gregtech.api.enums.Textures.BlockIcons.LARGETURBINE_TI_ACTIVE4; -import static gregtech.api.enums.Textures.BlockIcons.LARGETURBINE_TI_ACTIVE5; -import static gregtech.api.enums.Textures.BlockIcons.LARGETURBINE_TI_ACTIVE6; -import static gregtech.api.enums.Textures.BlockIcons.LARGETURBINE_TI_ACTIVE7; -import static gregtech.api.enums.Textures.BlockIcons.LARGETURBINE_TI_ACTIVE8; -import static gregtech.api.enums.Textures.BlockIcons.LARGETURBINE_TI_ACTIVE9; -import static gregtech.api.enums.Textures.BlockIcons.LARGETURBINE_TU1; -import static gregtech.api.enums.Textures.BlockIcons.LARGETURBINE_TU2; -import static gregtech.api.enums.Textures.BlockIcons.LARGETURBINE_TU3; -import static gregtech.api.enums.Textures.BlockIcons.LARGETURBINE_TU4; -import static gregtech.api.enums.Textures.BlockIcons.LARGETURBINE_TU5; -import static gregtech.api.enums.Textures.BlockIcons.LARGETURBINE_TU6; -import static gregtech.api.enums.Textures.BlockIcons.LARGETURBINE_TU7; -import static gregtech.api.enums.Textures.BlockIcons.LARGETURBINE_TU8; -import static gregtech.api.enums.Textures.BlockIcons.LARGETURBINE_TU9; -import static gregtech.api.enums.Textures.BlockIcons.LARGETURBINE_TU_ACTIVE1; -import static gregtech.api.enums.Textures.BlockIcons.LARGETURBINE_TU_ACTIVE2; -import static gregtech.api.enums.Textures.BlockIcons.LARGETURBINE_TU_ACTIVE3; -import static gregtech.api.enums.Textures.BlockIcons.LARGETURBINE_TU_ACTIVE4; -import static gregtech.api.enums.Textures.BlockIcons.LARGETURBINE_TU_ACTIVE5; -import static gregtech.api.enums.Textures.BlockIcons.LARGETURBINE_TU_ACTIVE6; -import static gregtech.api.enums.Textures.BlockIcons.LARGETURBINE_TU_ACTIVE7; -import static gregtech.api.enums.Textures.BlockIcons.LARGETURBINE_TU_ACTIVE8; -import static gregtech.api.enums.Textures.BlockIcons.LARGETURBINE_TU_ACTIVE9; -import static gtPlusPlus.xmod.gregtech.common.blocks.textures.TexturesGtBlock.OVERLAY_SC_TURBINE1; -import static gtPlusPlus.xmod.gregtech.common.blocks.textures.TexturesGtBlock.OVERLAY_SC_TURBINE1_ACTIVE; -import static gtPlusPlus.xmod.gregtech.common.blocks.textures.TexturesGtBlock.OVERLAY_SC_TURBINE2; -import static gtPlusPlus.xmod.gregtech.common.blocks.textures.TexturesGtBlock.OVERLAY_SC_TURBINE2_ACTIVE; -import static gtPlusPlus.xmod.gregtech.common.blocks.textures.TexturesGtBlock.OVERLAY_SC_TURBINE3; -import static gtPlusPlus.xmod.gregtech.common.blocks.textures.TexturesGtBlock.OVERLAY_SC_TURBINE3_ACTIVE; -import static gtPlusPlus.xmod.gregtech.common.blocks.textures.TexturesGtBlock.OVERLAY_SC_TURBINE4; -import static gtPlusPlus.xmod.gregtech.common.blocks.textures.TexturesGtBlock.OVERLAY_SC_TURBINE4_ACTIVE; -import static gtPlusPlus.xmod.gregtech.common.blocks.textures.TexturesGtBlock.OVERLAY_SC_TURBINE5; -import static gtPlusPlus.xmod.gregtech.common.blocks.textures.TexturesGtBlock.OVERLAY_SC_TURBINE5_ACTIVE; -import static gtPlusPlus.xmod.gregtech.common.blocks.textures.TexturesGtBlock.OVERLAY_SC_TURBINE6; -import static gtPlusPlus.xmod.gregtech.common.blocks.textures.TexturesGtBlock.OVERLAY_SC_TURBINE6_ACTIVE; -import static gtPlusPlus.xmod.gregtech.common.blocks.textures.TexturesGtBlock.OVERLAY_SC_TURBINE7; -import static gtPlusPlus.xmod.gregtech.common.blocks.textures.TexturesGtBlock.OVERLAY_SC_TURBINE7_ACTIVE; -import static gtPlusPlus.xmod.gregtech.common.blocks.textures.TexturesGtBlock.OVERLAY_SC_TURBINE8; -import static gtPlusPlus.xmod.gregtech.common.blocks.textures.TexturesGtBlock.OVERLAY_SC_TURBINE8_ACTIVE; -import static gtPlusPlus.xmod.gregtech.common.blocks.textures.TexturesGtBlock.OVERLAY_SC_TURBINE9; -import static gtPlusPlus.xmod.gregtech.common.blocks.textures.TexturesGtBlock.OVERLAY_SC_TURBINE9_ACTIVE; - -import net.minecraft.tileentity.TileEntity; -import net.minecraft.util.IIcon; -import net.minecraft.world.IBlockAccess; -import net.minecraftforge.common.util.ForgeDirection; - -import gregtech.api.interfaces.metatileentity.IMetaTileEntity; -import gregtech.api.interfaces.tileentity.IGregTechTileEntity; -import gtPlusPlus.xmod.gregtech.api.metatileentity.implementations.GT_MetaTileEntity_Hatch_Turbine; -import gtPlusPlus.xmod.gregtech.common.blocks.GregtechMetaSpecialMultiCasings; - -public class LargeTurbineTextureHandler { - - /** - * LP Turbines - */ - public static IIcon[] OVERLAY_LP_TURBINE = new IIcon[] { LARGETURBINE_ST1.getIcon(), LARGETURBINE_ST2.getIcon(), - LARGETURBINE_ST3.getIcon(), LARGETURBINE_ST4.getIcon(), LARGETURBINE_ST5.getIcon(), LARGETURBINE_ST6.getIcon(), - LARGETURBINE_ST7.getIcon(), LARGETURBINE_ST8.getIcon(), LARGETURBINE_ST9.getIcon(), }; - - public static IIcon[] OVERLAY_LP_TURBINE_ACTIVE = new IIcon[] { LARGETURBINE_ST_ACTIVE1.getIcon(), - LARGETURBINE_ST_ACTIVE2.getIcon(), LARGETURBINE_ST_ACTIVE3.getIcon(), LARGETURBINE_ST_ACTIVE4.getIcon(), - LARGETURBINE_ST_ACTIVE5.getIcon(), LARGETURBINE_ST_ACTIVE6.getIcon(), LARGETURBINE_ST_ACTIVE7.getIcon(), - LARGETURBINE_ST_ACTIVE8.getIcon(), LARGETURBINE_ST_ACTIVE9.getIcon(), }; - - /** - * HP Turbines - */ - public static IIcon[] OVERLAY_HP_TURBINE = new IIcon[] { LARGETURBINE_TI1.getIcon(), LARGETURBINE_TI2.getIcon(), - LARGETURBINE_TI3.getIcon(), LARGETURBINE_TI4.getIcon(), LARGETURBINE_TI5.getIcon(), LARGETURBINE_TI6.getIcon(), - LARGETURBINE_TI7.getIcon(), LARGETURBINE_TI8.getIcon(), LARGETURBINE_TI9.getIcon(), }; - - public static IIcon[] OVERLAY_HP_TURBINE_ACTIVE = new IIcon[] { LARGETURBINE_TI_ACTIVE1.getIcon(), - LARGETURBINE_TI_ACTIVE2.getIcon(), LARGETURBINE_TI_ACTIVE3.getIcon(), LARGETURBINE_TI_ACTIVE4.getIcon(), - LARGETURBINE_TI_ACTIVE5.getIcon(), LARGETURBINE_TI_ACTIVE6.getIcon(), LARGETURBINE_TI_ACTIVE7.getIcon(), - LARGETURBINE_TI_ACTIVE8.getIcon(), LARGETURBINE_TI_ACTIVE9.getIcon(), }; - - /** - * Gas Turbines - */ - public static IIcon[] OVERLAY_GAS_TURBINE = new IIcon[] { LARGETURBINE_SS1.getIcon(), LARGETURBINE_SS2.getIcon(), - LARGETURBINE_SS3.getIcon(), LARGETURBINE_SS4.getIcon(), LARGETURBINE_SS5.getIcon(), LARGETURBINE_SS6.getIcon(), - LARGETURBINE_SS7.getIcon(), LARGETURBINE_SS8.getIcon(), LARGETURBINE_SS9.getIcon(), }; - - public static IIcon[] OVERLAY_GAS_TURBINE_ACTIVE = new IIcon[] { LARGETURBINE_SS_ACTIVE1.getIcon(), - LARGETURBINE_SS_ACTIVE2.getIcon(), LARGETURBINE_SS_ACTIVE3.getIcon(), LARGETURBINE_SS_ACTIVE4.getIcon(), - LARGETURBINE_SS_ACTIVE5.getIcon(), LARGETURBINE_SS_ACTIVE6.getIcon(), LARGETURBINE_SS_ACTIVE7.getIcon(), - LARGETURBINE_SS_ACTIVE8.getIcon(), LARGETURBINE_SS_ACTIVE9.getIcon(), }; - - /** - * Plasma Turbines - */ - public static IIcon[] OVERLAY_PLASMA_TURBINE = new IIcon[] { LARGETURBINE_TU1.getIcon(), LARGETURBINE_TU2.getIcon(), - LARGETURBINE_TU3.getIcon(), LARGETURBINE_TU4.getIcon(), LARGETURBINE_TU5.getIcon(), LARGETURBINE_TU6.getIcon(), - LARGETURBINE_TU7.getIcon(), LARGETURBINE_TU8.getIcon(), LARGETURBINE_TU9.getIcon(), }; - - public static IIcon[] OVERLAY_PLASMA_TURBINE_ACTIVE = new IIcon[] { LARGETURBINE_TU_ACTIVE1.getIcon(), - LARGETURBINE_TU_ACTIVE2.getIcon(), LARGETURBINE_TU_ACTIVE3.getIcon(), LARGETURBINE_TU_ACTIVE4.getIcon(), - LARGETURBINE_TU_ACTIVE5.getIcon(), LARGETURBINE_TU_ACTIVE6.getIcon(), LARGETURBINE_TU_ACTIVE7.getIcon(), - LARGETURBINE_TU_ACTIVE8.getIcon(), LARGETURBINE_TU_ACTIVE9.getIcon(), }; - - public static IIcon[] OVERLAY_SC_TURBINE = new IIcon[] { OVERLAY_SC_TURBINE1.getIcon(), - OVERLAY_SC_TURBINE2.getIcon(), OVERLAY_SC_TURBINE3.getIcon(), OVERLAY_SC_TURBINE4.getIcon(), - OVERLAY_SC_TURBINE5.getIcon(), OVERLAY_SC_TURBINE6.getIcon(), OVERLAY_SC_TURBINE7.getIcon(), - OVERLAY_SC_TURBINE8.getIcon(), OVERLAY_SC_TURBINE9.getIcon(), }; - - public static IIcon[] OVERLAY_SC_TURBINE_ACTIVE = new IIcon[] { OVERLAY_SC_TURBINE1_ACTIVE.getIcon(), - OVERLAY_SC_TURBINE2_ACTIVE.getIcon(), OVERLAY_SC_TURBINE3_ACTIVE.getIcon(), - OVERLAY_SC_TURBINE4_ACTIVE.getIcon(), OVERLAY_SC_TURBINE5_ACTIVE.getIcon(), - OVERLAY_SC_TURBINE6_ACTIVE.getIcon(), OVERLAY_SC_TURBINE7_ACTIVE.getIcon(), - OVERLAY_SC_TURBINE8_ACTIVE.getIcon(), OVERLAY_SC_TURBINE9_ACTIVE.getIcon(), }; - - public static IIcon handleCasingsGT(final IBlockAccess aWorld, final int xCoord, final int yCoord, final int zCoord, - final ForgeDirection side, final GregtechMetaSpecialMultiCasings i) { - final int tMeta = aWorld.getBlockMetadata(xCoord, yCoord, zCoord); - - // 0 shaft - // 1 LP - // 2 HP - // 3 Gas - // 4 Plasma - - IIcon[] mGetCurrentTextureSet = null; - IIcon[] mGetCurrentTextureSet_ACTIVE = null; - - if ((tMeta <= 0 || tMeta >= 5) && tMeta != 15) { - return GregtechMetaSpecialMultiCasings.getStaticIcon(side.ordinal(), (byte) tMeta); - } else { - if (tMeta == 1) { - mGetCurrentTextureSet = OVERLAY_LP_TURBINE; - mGetCurrentTextureSet_ACTIVE = OVERLAY_LP_TURBINE_ACTIVE; - } else if (tMeta == 2) { - mGetCurrentTextureSet = OVERLAY_HP_TURBINE; - mGetCurrentTextureSet_ACTIVE = OVERLAY_HP_TURBINE_ACTIVE; - } else if (tMeta == 3) { - mGetCurrentTextureSet = OVERLAY_GAS_TURBINE; - mGetCurrentTextureSet_ACTIVE = OVERLAY_GAS_TURBINE_ACTIVE; - } else if (tMeta == 4) { - mGetCurrentTextureSet = OVERLAY_PLASMA_TURBINE; - mGetCurrentTextureSet_ACTIVE = OVERLAY_PLASMA_TURBINE_ACTIVE; - } else { - mGetCurrentTextureSet = OVERLAY_SC_TURBINE; - mGetCurrentTextureSet_ACTIVE = OVERLAY_SC_TURBINE_ACTIVE; - } - if (mGetCurrentTextureSet == null || mGetCurrentTextureSet_ACTIVE == null) { - return GregtechMetaSpecialMultiCasings.getStaticIcon(side.ordinal(), (byte) tMeta); - } - - if ((side == ForgeDirection.NORTH) || (side == ForgeDirection.SOUTH)) { - TileEntity tTileEntity; - IMetaTileEntity tMetaTileEntity; - if ((null != (tTileEntity = aWorld - .getTileEntity(xCoord + (side == ForgeDirection.SOUTH ? 1 : -1), yCoord - 1, zCoord))) - && ((tTileEntity instanceof IGregTechTileEntity)) - && (((IGregTechTileEntity) tTileEntity).getFrontFacing() == side) - && (null != (tMetaTileEntity = ((IGregTechTileEntity) tTileEntity).getMetaTileEntity())) - && ((tMetaTileEntity instanceof GT_MetaTileEntity_Hatch_Turbine))) { - if (isUsingAnimatedTexture(tTileEntity)) { - return mGetCurrentTextureSet_ACTIVE[0]; - } - return mGetCurrentTextureSet[0]; - } - if ((null != (tTileEntity = aWorld - .getTileEntity(xCoord + (side == ForgeDirection.SOUTH ? 1 : -1), yCoord, zCoord))) - && ((tTileEntity instanceof IGregTechTileEntity)) - && (((IGregTechTileEntity) tTileEntity).getFrontFacing() == side) - && (null != (tMetaTileEntity = ((IGregTechTileEntity) tTileEntity).getMetaTileEntity())) - && ((tMetaTileEntity instanceof GT_MetaTileEntity_Hatch_Turbine))) { - if (isUsingAnimatedTexture(tTileEntity)) { - return mGetCurrentTextureSet_ACTIVE[3]; - } - return mGetCurrentTextureSet[3]; - } - if ((null != (tTileEntity = aWorld - .getTileEntity(xCoord + (side == ForgeDirection.SOUTH ? 1 : -1), yCoord + 1, zCoord))) - && ((tTileEntity instanceof IGregTechTileEntity)) - && (((IGregTechTileEntity) tTileEntity).getFrontFacing() == side) - && (null != (tMetaTileEntity = ((IGregTechTileEntity) tTileEntity).getMetaTileEntity())) - && ((tMetaTileEntity instanceof GT_MetaTileEntity_Hatch_Turbine))) { - if (isUsingAnimatedTexture(tTileEntity)) { - return mGetCurrentTextureSet_ACTIVE[6]; - } - return mGetCurrentTextureSet[6]; - } - if ((null != (tTileEntity = aWorld.getTileEntity(xCoord, yCoord - 1, zCoord))) - && ((tTileEntity instanceof IGregTechTileEntity)) - && (((IGregTechTileEntity) tTileEntity).getFrontFacing() == side) - && (null != (tMetaTileEntity = ((IGregTechTileEntity) tTileEntity).getMetaTileEntity())) - && ((tMetaTileEntity instanceof GT_MetaTileEntity_Hatch_Turbine))) { - if (isUsingAnimatedTexture(tTileEntity)) { - return mGetCurrentTextureSet_ACTIVE[1]; - } - return mGetCurrentTextureSet[1]; - } - if ((null != (tTileEntity = aWorld.getTileEntity(xCoord, yCoord + 1, zCoord))) - && ((tTileEntity instanceof IGregTechTileEntity)) - && (((IGregTechTileEntity) tTileEntity).getFrontFacing() == side) - && (null != (tMetaTileEntity = ((IGregTechTileEntity) tTileEntity).getMetaTileEntity())) - && ((tMetaTileEntity instanceof GT_MetaTileEntity_Hatch_Turbine))) { - if (isUsingAnimatedTexture(tTileEntity)) { - return mGetCurrentTextureSet_ACTIVE[7]; - } - return mGetCurrentTextureSet[7]; - } - if ((null != (tTileEntity = aWorld - .getTileEntity(xCoord + (side == ForgeDirection.NORTH ? 1 : -1), yCoord + 1, zCoord))) - && ((tTileEntity instanceof IGregTechTileEntity)) - && (((IGregTechTileEntity) tTileEntity).getFrontFacing() == side) - && (null != (tMetaTileEntity = ((IGregTechTileEntity) tTileEntity).getMetaTileEntity())) - && ((tMetaTileEntity instanceof GT_MetaTileEntity_Hatch_Turbine))) { - if (isUsingAnimatedTexture(tTileEntity)) { - return mGetCurrentTextureSet_ACTIVE[8]; - } - return mGetCurrentTextureSet[8]; - } - if ((null != (tTileEntity = aWorld - .getTileEntity(xCoord + (side == ForgeDirection.NORTH ? 1 : -1), yCoord, zCoord))) - && ((tTileEntity instanceof IGregTechTileEntity)) - && (((IGregTechTileEntity) tTileEntity).getFrontFacing() == side) - && (null != (tMetaTileEntity = ((IGregTechTileEntity) tTileEntity).getMetaTileEntity())) - && ((tMetaTileEntity instanceof GT_MetaTileEntity_Hatch_Turbine))) { - if (isUsingAnimatedTexture(tTileEntity)) { - return mGetCurrentTextureSet_ACTIVE[5]; - } - return mGetCurrentTextureSet[5]; - } - if ((null != (tTileEntity = aWorld - .getTileEntity(xCoord + (side == ForgeDirection.NORTH ? 1 : -1), yCoord - 1, zCoord))) - && ((tTileEntity instanceof IGregTechTileEntity)) - && (((IGregTechTileEntity) tTileEntity).getFrontFacing() == side) - && (null != (tMetaTileEntity = ((IGregTechTileEntity) tTileEntity).getMetaTileEntity())) - && ((tMetaTileEntity instanceof GT_MetaTileEntity_Hatch_Turbine))) { - if (isUsingAnimatedTexture(tTileEntity)) { - return mGetCurrentTextureSet_ACTIVE[2]; - } - return mGetCurrentTextureSet[2]; - } - } else if ((side == ForgeDirection.WEST) || (side == ForgeDirection.EAST)) { - TileEntity tTileEntity; - Object tMetaTileEntity; - if ((null != (tTileEntity = aWorld - .getTileEntity(xCoord, yCoord - 1, zCoord + (side == ForgeDirection.WEST ? 1 : -1)))) - && ((tTileEntity instanceof IGregTechTileEntity)) - && (((IGregTechTileEntity) tTileEntity).getFrontFacing() == side) - && (null != (tMetaTileEntity = ((IGregTechTileEntity) tTileEntity).getMetaTileEntity())) - && ((tMetaTileEntity instanceof GT_MetaTileEntity_Hatch_Turbine))) { - if (isUsingAnimatedTexture(tTileEntity)) { - return mGetCurrentTextureSet_ACTIVE[0]; - } - return mGetCurrentTextureSet[0]; - } - if ((null != (tTileEntity = aWorld - .getTileEntity(xCoord, yCoord, zCoord + (side == ForgeDirection.WEST ? 1 : -1)))) - && ((tTileEntity instanceof IGregTechTileEntity)) - && (((IGregTechTileEntity) tTileEntity).getFrontFacing() == side) - && (null != (tMetaTileEntity = ((IGregTechTileEntity) tTileEntity).getMetaTileEntity())) - && ((tMetaTileEntity instanceof GT_MetaTileEntity_Hatch_Turbine))) { - if (isUsingAnimatedTexture(tTileEntity)) { - return mGetCurrentTextureSet_ACTIVE[3]; - } - return mGetCurrentTextureSet[3]; - } - if ((null != (tTileEntity = aWorld - .getTileEntity(xCoord, yCoord + 1, zCoord + (side == ForgeDirection.WEST ? 1 : -1)))) - && ((tTileEntity instanceof IGregTechTileEntity)) - && (((IGregTechTileEntity) tTileEntity).getFrontFacing() == side) - && (null != (tMetaTileEntity = ((IGregTechTileEntity) tTileEntity).getMetaTileEntity())) - && ((tMetaTileEntity instanceof GT_MetaTileEntity_Hatch_Turbine))) { - if (isUsingAnimatedTexture(tTileEntity)) { - return mGetCurrentTextureSet_ACTIVE[6]; - } - return mGetCurrentTextureSet[6]; - } - if ((null != (tTileEntity = aWorld.getTileEntity(xCoord, yCoord - 1, zCoord))) - && ((tTileEntity instanceof IGregTechTileEntity)) - && (((IGregTechTileEntity) tTileEntity).getFrontFacing() == side) - && (null != (tMetaTileEntity = ((IGregTechTileEntity) tTileEntity).getMetaTileEntity())) - && ((tMetaTileEntity instanceof GT_MetaTileEntity_Hatch_Turbine))) { - if (isUsingAnimatedTexture(tTileEntity)) { - return mGetCurrentTextureSet_ACTIVE[1]; - } - return mGetCurrentTextureSet[1]; - } - if ((null != (tTileEntity = aWorld.getTileEntity(xCoord, yCoord + 1, zCoord))) - && ((tTileEntity instanceof IGregTechTileEntity)) - && (((IGregTechTileEntity) tTileEntity).getFrontFacing() == side) - && (null != (tMetaTileEntity = ((IGregTechTileEntity) tTileEntity).getMetaTileEntity())) - && ((tMetaTileEntity instanceof GT_MetaTileEntity_Hatch_Turbine))) { - if (isUsingAnimatedTexture(tTileEntity)) { - return mGetCurrentTextureSet_ACTIVE[7]; - } - return mGetCurrentTextureSet[7]; - } - if ((null != (tTileEntity = aWorld - .getTileEntity(xCoord, yCoord + 1, zCoord + (side == ForgeDirection.EAST ? 1 : -1)))) - && ((tTileEntity instanceof IGregTechTileEntity)) - && (((IGregTechTileEntity) tTileEntity).getFrontFacing() == side) - && (null != (tMetaTileEntity = ((IGregTechTileEntity) tTileEntity).getMetaTileEntity())) - && ((tMetaTileEntity instanceof GT_MetaTileEntity_Hatch_Turbine))) { - if (isUsingAnimatedTexture(tTileEntity)) { - return mGetCurrentTextureSet_ACTIVE[8]; - } - return mGetCurrentTextureSet[8]; - } - if ((null != (tTileEntity = aWorld - .getTileEntity(xCoord, yCoord, zCoord + (side == ForgeDirection.EAST ? 1 : -1)))) - && ((tTileEntity instanceof IGregTechTileEntity)) - && (((IGregTechTileEntity) tTileEntity).getFrontFacing() == side) - && (null != (tMetaTileEntity = ((IGregTechTileEntity) tTileEntity).getMetaTileEntity())) - && ((tMetaTileEntity instanceof GT_MetaTileEntity_Hatch_Turbine))) { - if (isUsingAnimatedTexture(tTileEntity)) { - return mGetCurrentTextureSet_ACTIVE[5]; - } - return mGetCurrentTextureSet[5]; - } - if ((null != (tTileEntity = aWorld - .getTileEntity(xCoord, yCoord - 1, zCoord + (side == ForgeDirection.EAST ? 1 : -1)))) - && ((tTileEntity instanceof IGregTechTileEntity)) - && (((IGregTechTileEntity) tTileEntity).getFrontFacing() == side) - && (null != (tMetaTileEntity = ((IGregTechTileEntity) tTileEntity).getMetaTileEntity())) - && ((tMetaTileEntity instanceof GT_MetaTileEntity_Hatch_Turbine))) { - if (isUsingAnimatedTexture(tTileEntity)) { - return mGetCurrentTextureSet_ACTIVE[2]; - } - return mGetCurrentTextureSet[2]; - } - } - } - return GregtechMetaSpecialMultiCasings.getStaticIcon(side.ordinal(), (byte) tMeta); - } - - public static boolean isUsingAnimatedTexture(TileEntity tTileEntity) { - boolean aVal = true; - IGregTechTileEntity aTile; - if (tTileEntity instanceof IGregTechTileEntity) { - aTile = (IGregTechTileEntity) tTileEntity; - if (aTile != null) { - final IMetaTileEntity aMetaTileEntity = aTile.getMetaTileEntity(); - if (aMetaTileEntity != null && aMetaTileEntity instanceof GT_MetaTileEntity_Hatch_Turbine) { - aVal = ((GT_MetaTileEntity_Hatch_Turbine) aMetaTileEntity).getBaseMetaTileEntity() - .isActive(); - // Logger.INFO("Returning "+aVal+" as Rotor Assembly controller status"); - } - } - } - return aVal; - } - - public static GT_MetaTileEntity_Hatch_Turbine isTurbineHatch(final IGregTechTileEntity aTileEntity) { - if (aTileEntity != null) { - final IMetaTileEntity aMetaTileEntity = aTileEntity.getMetaTileEntity(); - if (aMetaTileEntity != null && aMetaTileEntity instanceof GT_MetaTileEntity_Hatch_Turbine) { - return (GT_MetaTileEntity_Hatch_Turbine) aMetaTileEntity; - } - } - return null; - } -} diff --git a/gtpp/src/main/java/gtPlusPlus/xmod/gregtech/common/covers/CoverManager.java b/gtpp/src/main/java/gtPlusPlus/xmod/gregtech/common/covers/CoverManager.java deleted file mode 100644 index c1f87ef041..0000000000 --- a/gtpp/src/main/java/gtPlusPlus/xmod/gregtech/common/covers/CoverManager.java +++ /dev/null @@ -1,16 +0,0 @@ -package gtPlusPlus.xmod.gregtech.common.covers; - -import gtPlusPlus.xmod.gregtech.common.items.covers.MetaItemCoverCasings; - -public class CoverManager { - - // GT - public static MetaItemCoverCasings Cover_Gt_Machine_Casing; - - public static void generateCustomCovers() { - - // GT Machine Casings - Cover_Gt_Machine_Casing = new MetaItemCoverCasings(); - } - -} diff --git a/gtpp/src/main/java/gtPlusPlus/xmod/gregtech/common/covers/GTPP_Cover_Overflow.java b/gtpp/src/main/java/gtPlusPlus/xmod/gregtech/common/covers/GTPP_Cover_Overflow.java deleted file mode 100644 index 8b75f4f156..0000000000 --- a/gtpp/src/main/java/gtPlusPlus/xmod/gregtech/common/covers/GTPP_Cover_Overflow.java +++ /dev/null @@ -1,203 +0,0 @@ -package gtPlusPlus.xmod.gregtech.common.covers; - -import java.util.concurrent.atomic.AtomicBoolean; - -import net.minecraft.entity.player.EntityPlayer; -import net.minecraftforge.common.util.ForgeDirection; -import net.minecraftforge.fluids.Fluid; -import net.minecraftforge.fluids.FluidStack; -import net.minecraftforge.fluids.IFluidHandler; - -import com.gtnewhorizons.modularui.api.screen.ModularWindow; -import com.gtnewhorizons.modularui.common.widget.TextWidget; - -import gregtech.api.gui.modularui.GT_CoverUIBuildContext; -import gregtech.api.interfaces.tileentity.ICoverable; -import gregtech.api.util.GT_CoverBehavior; -import gregtech.api.util.GT_Utility; -import gregtech.api.util.ISerializableObject; -import gregtech.common.gui.modularui.widget.CoverDataControllerWidget; -import gregtech.common.gui.modularui.widget.CoverDataFollower_NumericWidget; - -public class GTPP_Cover_Overflow extends GT_CoverBehavior { - - public final int mTransferRate; - public final int mInitialTransferRate; - public final int mMaxTransferRate; - - public GTPP_Cover_Overflow(int aTransferRate) { - this.mTransferRate = aTransferRate * 1000 / 10; - this.mInitialTransferRate = aTransferRate; - this.mMaxTransferRate = aTransferRate * 1000; - } - - public int doCoverThings(ForgeDirection side, byte aInputRedstone, int aCoverID, int aCoverVariable, - ICoverable aTileEntity, long aTimer) { - if (aCoverVariable == 0) { - return aCoverVariable; - } - if ((aTileEntity instanceof IFluidHandler)) { - // Logger.INFO("Trying to Void via Overflow."); - IFluidHandler tTank1; - ForgeDirection directionFrom; - directionFrom = ForgeDirection.UNKNOWN; - tTank1 = (IFluidHandler) aTileEntity; - if (tTank1 != null) { - FluidStack aTankStack = tTank1.getTankInfo(directionFrom)[0].fluid; - if (aTankStack != null) { - // Logger.INFO("Found Fluid inside self - "+aTankStack.getLocalizedName()+", overflow point set at - // "+aCoverVariable+"L and we have "+aTankStack.amount+"L inside."); - if (aTankStack.amount > aCoverVariable) { - int aAmountToDrain = aTankStack.amount - aCoverVariable; - // Logger.INFO("There is "+aAmountToDrain+" more fluid in the tank than we would like."); - if (aAmountToDrain > 0) { - FluidStack tLiquid = tTank1.drain(directionFrom, Math.abs(aAmountToDrain), true); - if (tLiquid != null) { - // Logger.INFO("Drained "+aAmountToDrain+"L."); - } - } - } - } else { - // Logger.INFO("Could not simulate drain on self."); - } - } - } - return aCoverVariable; - } - - public int onCoverScrewdriverclick(ForgeDirection side, int aCoverID, int aCoverVariable, ICoverable aTileEntity, - EntityPlayer aPlayer, float aX, float aY, float aZ) { - if (GT_Utility.getClickedFacingCoords(side, aX, aY, aZ)[0] >= 0.5F) { - aCoverVariable += (mMaxTransferRate * (aPlayer.isSneaking() ? 0.1f : 0.01f)); - } else { - aCoverVariable -= (mMaxTransferRate * (aPlayer.isSneaking() ? 0.1f : 0.01f)); - } - if (aCoverVariable > mMaxTransferRate) { - aCoverVariable = mInitialTransferRate; - } - if (aCoverVariable <= 0) { - aCoverVariable = mMaxTransferRate; - } - GT_Utility.sendChatToPlayer( - aPlayer, - GT_Utility.trans("322", "Overflow point: ") + aCoverVariable + GT_Utility.trans("323", "L")); - return aCoverVariable; - } - - public boolean onCoverRightclick(ForgeDirection side, int aCoverID, int aCoverVariable, ICoverable aTileEntity, - EntityPlayer aPlayer, float aX, float aY, float aZ) { - boolean aShift = aPlayer.isSneaking(); - int aAmount = aShift ? 128 : 8; - if (GT_Utility.getClickedFacingCoords(side, aX, aY, aZ)[0] >= 0.5F) { - aCoverVariable += aAmount; - } else { - aCoverVariable -= aAmount; - } - if (aCoverVariable > mMaxTransferRate) { - aCoverVariable = mInitialTransferRate; - } - if (aCoverVariable <= 0) { - aCoverVariable = mMaxTransferRate; - } - GT_Utility.sendChatToPlayer( - aPlayer, - GT_Utility.trans("322", "Overflow point: ") + aCoverVariable + GT_Utility.trans("323", "L")); - aTileEntity.setCoverDataAtSide(side, new ISerializableObject.LegacyCoverData(aCoverVariable)); - return true; - } - - public boolean letsRedstoneGoIn(ForgeDirection side, int aCoverID, int aCoverVariable, ICoverable aTileEntity) { - return true; - } - - public boolean letsRedstoneGoOut(ForgeDirection side, int aCoverID, int aCoverVariable, ICoverable aTileEntity) { - return true; - } - - public boolean letsEnergyIn(ForgeDirection side, int aCoverID, int aCoverVariable, ICoverable aTileEntity) { - return true; - } - - public boolean letsEnergyOut(ForgeDirection side, int aCoverID, int aCoverVariable, ICoverable aTileEntity) { - return true; - } - - public boolean letsItemsIn(ForgeDirection side, int aCoverID, int aCoverVariable, int aSlot, - ICoverable aTileEntity) { - return true; - } - - public boolean letsItemsOut(ForgeDirection side, int aCoverID, int aCoverVariable, int aSlot, - ICoverable aTileEntity) { - return true; - } - - public boolean letsFluidIn(ForgeDirection side, int aCoverID, int aCoverVariable, Fluid aFluid, - ICoverable aTileEntity) { - return false; - } - - public boolean letsFluidOut(ForgeDirection side, int aCoverID, int aCoverVariable, Fluid aFluid, - ICoverable aTileEntity) { - return true; - } - - public boolean alwaysLookConnected(ForgeDirection side, int aCoverID, int aCoverVariable, ICoverable aTileEntity) { - return true; - } - - public int getTickRate(ForgeDirection side, int aCoverID, int aCoverVariable, ICoverable aTileEntity) { - return 5; - } - - // GUI - - @Override - public boolean hasCoverGUI() { - return true; - } - - @Override - public boolean useModularUI() { - return true; - } - - @Override - public ModularWindow createWindow(GT_CoverUIBuildContext buildContext) { - return new OverflowUIFactory(buildContext).createWindow(); - } - - private class OverflowUIFactory extends UIFactory { - - private static final int startX = 10; - private static final int startY = 25; - private static final int spaceX = 18; - private static final int spaceY = 18; - - public OverflowUIFactory(GT_CoverUIBuildContext buildContext) { - super(buildContext); - } - - @SuppressWarnings("PointlessArithmeticExpression") - @Override - protected void addUIWidgets(ModularWindow.Builder builder) { - AtomicBoolean warn = new AtomicBoolean(false); - - builder - .widget( - new CoverDataControllerWidget<>(this::getCoverData, this::setCoverData, GTPP_Cover_Overflow.this) - .addFollower( - new CoverDataFollower_NumericWidget<>(), - coverData -> (double) convert(coverData), - (coverData, state) -> new ISerializableObject.LegacyCoverData(state.intValue()), - widget -> widget.setBounds(0, mMaxTransferRate) - .setScrollValues(1000, 144, 100000) - .setFocusOnGuiOpen(true) - .setPos(startX + spaceX * 0, startY + spaceY * 1 + 8) - .setSize(spaceX * 4 - 3, 12))) - .widget( - new TextWidget(GT_Utility.trans("322", "Overflow point: ")).setDefaultColor(COLOR_TEXT_GRAY.get()) - .setPos(startX, 4 + startY + spaceY * 0 + 8)); - } - } -} diff --git a/gtpp/src/main/java/gtPlusPlus/xmod/gregtech/common/covers/GTPP_Cover_ToggleVisual.java b/gtpp/src/main/java/gtPlusPlus/xmod/gregtech/common/covers/GTPP_Cover_ToggleVisual.java deleted file mode 100644 index 42ab793c9c..0000000000 --- a/gtpp/src/main/java/gtPlusPlus/xmod/gregtech/common/covers/GTPP_Cover_ToggleVisual.java +++ /dev/null @@ -1,184 +0,0 @@ -package gtPlusPlus.xmod.gregtech.common.covers; - -import java.util.Map; -import java.util.concurrent.ConcurrentHashMap; - -import net.minecraft.entity.player.EntityPlayer; -import net.minecraft.item.ItemStack; -import net.minecraft.nbt.NBTTagCompound; -import net.minecraftforge.common.util.ForgeDirection; -import net.minecraftforge.fluids.Fluid; - -import gregtech.api.interfaces.tileentity.ICoverable; -import gregtech.api.interfaces.tileentity.IGregTechTileEntity; -import gregtech.api.objects.XSTR; -import gregtech.api.util.GT_CoverBehavior; -import gregtech.api.util.GT_Utility; -import gregtech.api.util.ISerializableObject; -import gtPlusPlus.api.objects.Logger; -import gtPlusPlus.api.objects.minecraft.BlockPos; -import gtPlusPlus.core.util.minecraft.PlayerUtils; - -public class GTPP_Cover_ToggleVisual extends GT_CoverBehavior { - - private static final Map<String, Integer> sConnectionStateForEntityMap = new ConcurrentHashMap<>(); - private static final Map<String, String> sPrefixMap = new ConcurrentHashMap<>(); - private static final int VALUE_OFF = 0; - private static final int VALUE_ON = 1; - - public static String generateUniqueKey(ForgeDirection side, ICoverable aEntity) { - try { - BlockPos aPos = new BlockPos( - aEntity.getIGregTechTileEntity(aEntity.getXCoord(), aEntity.getYCoord(), aEntity.getZCoord())); - - String s = aEntity.getInventoryName() + "." + aPos.getUniqueIdentifier() + side.name(); - return s; - } catch (Throwable t) {} - XSTR x = new XSTR(); - return "ERROR." + x.getSeed() + x.hashCode() + x.nextDouble() + ".ID"; - } - - public boolean onCoverRightclick(ForgeDirection side, int aCoverID, int aCoverVariable, ICoverable aTileEntity, - EntityPlayer aPlayer, float aX, float aY, float aZ) { - PlayerUtils - .messagePlayer(aPlayer, GT_Utility.trans("756", "Connectable: ") + getConnectionState(aCoverVariable)); - return super.onCoverRightclick(side, aCoverID, aCoverVariable, aTileEntity, aPlayer, aX, aY, aZ); - } - - public int onCoverScrewdriverclick(ForgeDirection side, int aCoverID, int aCoverVariable, ICoverable aTileEntity, - EntityPlayer aPlayer, float aX, float aY, float aZ) { - return super.onCoverScrewdriverclick(side, aCoverID, aCoverVariable, aTileEntity, aPlayer, aX, aY, aZ); - } - - public boolean letsEnergyIn(ForgeDirection side, int aCoverID, int aCoverVariable, ICoverable aTileEntity) { - return getConnectionState(aCoverVariable); - } - - public boolean letsEnergyOut(ForgeDirection side, int aCoverID, int aCoverVariable, ICoverable aTileEntity) { - return getConnectionState(aCoverVariable); - } - - public boolean letsFluidIn(ForgeDirection side, int aCoverID, int aCoverVariable, Fluid aFluid, - ICoverable aTileEntity) { - return getConnectionState(aCoverVariable); - } - - public boolean letsFluidOut(ForgeDirection side, int aCoverID, int aCoverVariable, Fluid aFluid, - ICoverable aTileEntity) { - return getConnectionState(aCoverVariable); - } - - public boolean letsItemsIn(ForgeDirection side, int aCoverID, int aCoverVariable, int aSlot, - ICoverable aTileEntity) { - return getConnectionState(aCoverVariable); - } - - public boolean letsItemsOut(ForgeDirection side, int aCoverID, int aCoverVariable, int aSlot, - ICoverable aTileEntity) { - return getConnectionState(aCoverVariable); - } - - public int getTickRate(ForgeDirection side, int aCoverID, int aCoverVariable, ICoverable aTileEntity) { - return 1; - } - - @Override - public int doCoverThings(ForgeDirection side, byte aInputRedstone, int aCoverID, int aCoverVariable, - ICoverable aTileEntity, long aTimer) { - try { - String aKey = generateUniqueKey(side, aTileEntity); - Integer b = sConnectionStateForEntityMap.get(aKey); - // Logger.INFO("Val: "+aCoverVariable); - if (b != null && aCoverVariable != b) { - aCoverVariable = b; - } - if (b == null) { - b = aCoverVariable; - sConnectionStateForEntityMap.put(aKey, b); - trySetState(side, b == VALUE_ON ? VALUE_ON : VALUE_OFF, aTileEntity); - } - } catch (Throwable t) { - - } - return aCoverVariable; - } - - @Override - public boolean letsRedstoneGoIn(ForgeDirection side, int aCoverID, int aCoverVariable, ICoverable aTileEntity) { - return getConnectionState(aCoverVariable); - } - - @Override - public boolean letsRedstoneGoOut(ForgeDirection side, int aCoverID, int aCoverVariable, ICoverable aTileEntity) { - return getConnectionState(aCoverVariable); - } - - @Override - public boolean alwaysLookConnected(ForgeDirection side, int aCoverID, int aCoverVariable, ICoverable aTileEntity) { - return super.alwaysLookConnected(side, aCoverID, aCoverVariable, aTileEntity); - } - - @Override - public byte getRedstoneInput(ForgeDirection side, byte aInputRedstone, int aCoverID, int aCoverVariable, - ICoverable aTileEntity) { - if (!getConnectionState(aCoverVariable)) { - return 0; - } - return super.getRedstoneInput(side, aInputRedstone, aCoverID, aCoverVariable, aTileEntity); - } - - @Override - public void placeCover(ForgeDirection side, ItemStack aCover, ICoverable aTileEntity) { - String aKey = generateUniqueKey(side, aTileEntity); - boolean state = getCoverConnections(aCover); - sPrefixMap.put(aKey, aCover.getUnlocalizedName()); - Logger.INFO("Mapping key " + aKey + " to " + state); - sConnectionStateForEntityMap.put(aKey, state ? VALUE_ON : VALUE_OFF); - Logger.INFO("Key Value: " + (state ? VALUE_ON : VALUE_OFF)); - // Try set cover state directly - // trySetState(aSide, state ? VALUE_ON : VALUE_OFF, aTileEntity); - super.placeCover(side, aCover, aTileEntity); - } - - @Override - public boolean onCoverRemoval(ForgeDirection side, int aCoverID, int aCoverVariable, ICoverable aTileEntity, - boolean aForced) { - String aKey = generateUniqueKey(side, aTileEntity); - sConnectionStateForEntityMap.remove(aKey); - // Logger.INFO("Unmapping key "+aKey+"."); - return true; - } - - public static boolean getConnectionState(int aCoverVar) { - return aCoverVar == VALUE_ON; - } - - private static void trySetState(ForgeDirection side, int aState, ICoverable aTile) { - // Try set cover state directly - if (aTile instanceof IGregTechTileEntity gTileEntity) { - gTileEntity.setCoverDataAtSide(side, new ISerializableObject.LegacyCoverData(aState)); - } - } - - public static boolean getConnectionState(ForgeDirection side, ICoverable aTile) { - String aKey = generateUniqueKey(side, aTile); - return getConnectionState(aKey); - } - - public static boolean getConnectionState(String aKey) { - Integer b = sConnectionStateForEntityMap.get(aKey); - // Logger.INFO("Get State: "+b+" | "+aKey); - return b != null ? b == VALUE_ON : false; - } - - public static final boolean getCoverConnections(final ItemStack aStack) { - NBTTagCompound aNBT = aStack.getTagCompound(); - if (aNBT != null) { - aNBT = aNBT.getCompoundTag("CustomCoverMeta"); - if (aNBT != null) { - return aNBT.getBoolean("AllowConnections"); - } - } - return false; - } -} diff --git a/gtpp/src/main/java/gtPlusPlus/xmod/gregtech/common/helpers/ChargingHelper.java b/gtpp/src/main/java/gtPlusPlus/xmod/gregtech/common/helpers/ChargingHelper.java deleted file mode 100644 index 924484e098..0000000000 --- a/gtpp/src/main/java/gtPlusPlus/xmod/gregtech/common/helpers/ChargingHelper.java +++ /dev/null @@ -1,346 +0,0 @@ -package gtPlusPlus.xmod.gregtech.common.helpers; - -import static gregtech.api.GregTech_API.mEUtoRF; -import static gregtech.api.enums.Mods.Baubles; -import static gregtech.api.enums.Mods.COFHCore; - -import java.util.HashMap; -import java.util.Map; -import java.util.UUID; - -import javax.annotation.Nonnull; - -import net.minecraft.entity.player.EntityPlayer; -import net.minecraft.entity.player.InventoryPlayer; -import net.minecraft.inventory.IInventory; -import net.minecraft.item.ItemStack; - -import baubles.api.BaublesApi; -import cofh.api.energy.IEnergyContainerItem; -import cpw.mods.fml.common.eventhandler.EventPriority; -import cpw.mods.fml.common.eventhandler.SubscribeEvent; -import cpw.mods.fml.common.gameevent.TickEvent.ServerTickEvent; -import gregtech.api.enums.GT_Values; -import gregtech.api.util.GT_ModHandler; -import gregtech.common.items.GT_MetaGenerated_Item_01; -import gregtech.common.items.GT_MetaGenerated_Item_02; -import gregtech.common.items.GT_MetaGenerated_Item_03; -import gregtech.common.items.GT_MetaGenerated_Tool_01; -import gtPlusPlus.api.objects.data.Pair; -import gtPlusPlus.api.objects.minecraft.BlockPos; -import gtPlusPlus.core.util.Utils; -import gtPlusPlus.core.util.math.MathUtils; -import gtPlusPlus.core.util.minecraft.NBTUtils; -import gtPlusPlus.core.util.minecraft.PlayerUtils; -import gtPlusPlus.xmod.gregtech.common.tileentities.machines.basic.GregtechMetaWirelessCharger; -import ic2.api.item.ElectricItem; -import ic2.api.item.IElectricItem; - -public class ChargingHelper { - - private static final Map<String, Pair<GregtechMetaWirelessCharger, Byte>> mValidPlayers = new HashMap<>(); - protected static Map<BlockPos, GregtechMetaWirelessCharger> mChargerMap = new HashMap<>(); - private int mTickTimer = 0; - private static final int mTickMultiplier = 20; - - @SubscribeEvent(priority = EventPriority.HIGHEST) - public void onServerTick(ServerTickEvent event) { - if (++mTickTimer % mTickMultiplier == 0) { - if (Utils.isServer()) { - for (EntityPlayer mPlayerMan : PlayerUtils.getOnlinePlayers()) { - doPlayerChargeTick(mPlayerMan); - } - } - } - } - - @SuppressWarnings("unused") - private void doPlayerChargeTick(EntityPlayer mPlayerMan) { - try { - long mVoltage; - long mEuStored; - - if (!mChargerMap.isEmpty() && mValidPlayers.containsKey(mPlayerMan.getDisplayName())) { - InventoryPlayer mPlayerInventory = mPlayerMan.inventory; - ItemStack[] mArmourContents = mPlayerInventory.armorInventory.clone(); - ItemStack[] mInventoryContents = mPlayerInventory.mainInventory.clone(); - ItemStack[] baubleSlots = null; - if (Baubles.isModLoaded()) { - IInventory baubleInv = BaublesApi.getBaubles(mPlayerMan); - if (baubleInv != null) { - baubleSlots = new ItemStack[baubleInv.getSizeInventory()]; - for (int i = 0; i < baubleInv.getSizeInventory(); i++) { - baubleSlots[i] = baubleInv.getStackInSlot(i); - } - } - } - - for (GregtechMetaWirelessCharger mEntityTemp : mChargerMap.values()) { - if (mEntityTemp != null) { - if (mEntityTemp.getBaseMetaTileEntity() == null || !mEntityTemp.getBaseMetaTileEntity() - .isAllowedToWork()) continue; - if (mPlayerMan.getEntityWorld().provider.dimensionId == mEntityTemp.getDimensionID()) { - mVoltage = mEntityTemp.maxEUInput(); - mEuStored = mEntityTemp.getEUVar(); - if (mVoltage > 0 && mEuStored >= mVoltage) { - Map<String, UUID> LR = mEntityTemp.getLongRangeMap(); - Map<String, UUID> LO = mEntityTemp.getLocalMap(); - - long mStartingEu = mEntityTemp.getEUVar(); - if (canCharge(mEntityTemp, mPlayerMan, LR, LO)) { - chargeItems(mEntityTemp, mArmourContents); - chargeItems(mEntityTemp, mInventoryContents); - chargeItems(mEntityTemp, baubleSlots); - } - - if (mStartingEu - mEntityTemp.getEUVar() <= 0) { - long mMaxDistance; - if (mEntityTemp.getMode() == 0) { - mMaxDistance = (4 * GT_Values.V[mEntityTemp.getTier()]); - } else if (mEntityTemp.getMode() == 1) { - mMaxDistance = (mEntityTemp.getTier() * 10L); - } else { - mMaxDistance = (4 * GT_Values.V[mEntityTemp.getTier()] / 2); - } - double mDistance = calculateDistance(mEntityTemp, mPlayerMan); - long mVoltageCost = MathUtils.findPercentageOfInt(mMaxDistance, (float) mDistance); - - if (mVoltageCost > 0) { - if (mVoltageCost > mEntityTemp.maxEUInput()) { - mEntityTemp.setEUVar((mEntityTemp.getEUVar() - mEntityTemp.maxEUInput())); - } else { - mEntityTemp.setEUVar((mEntityTemp.getEUVar() - mVoltageCost)); - } - } - } - } - } - } - } - } - } catch (Throwable t) { - if (!mChargerMap.isEmpty()) { - for (BlockPos aPos : mChargerMap.keySet()) { - GregtechMetaWirelessCharger r = mChargerMap.get(aPos); - if (r == null || r.getBaseMetaTileEntity() - .isInvalidTileEntity()) { - mChargerMap.remove(aPos); - } - } - } - } - } - - public static GregtechMetaWirelessCharger getEntry(BlockPos mPos) { - return mChargerMap.get(mPos); - } - - public static boolean addEntry(BlockPos mPos, GregtechMetaWirelessCharger mEntity) { - if (mEntity == null) { - return false; - } - mChargerMap.put(mPos, mEntity); - return true; - } - - public static boolean removeEntry(BlockPos mPos, GregtechMetaWirelessCharger mEntity) { - if (mEntity == null) { - return false; - } - if (mChargerMap.containsKey(mPos)) { - return mChargerMap.remove(mPos, mEntity); - } else { - return false; - } - } - - public static boolean addValidPlayer(EntityPlayer mPlayer, GregtechMetaWirelessCharger mEntity) { - if (mEntity == null) { - return false; - } - if (mValidPlayers.containsKey(mPlayer.getDisplayName())) { - return false; - } else { - Pair<GregtechMetaWirelessCharger, Byte> mEntry = new Pair<>(mEntity, (byte) mEntity.getMode()); - return mValidPlayers.put(mPlayer.getDisplayName(), mEntry) == null; - } - } - - public static boolean removeValidPlayer(EntityPlayer mPlayer, GregtechMetaWirelessCharger mEntity) { - if (mEntity == null) { - return false; - } - if (mValidPlayers.containsKey(mPlayer.getDisplayName())) { - Pair<GregtechMetaWirelessCharger, Byte> mEntry = new Pair<>(mEntity, (byte) mEntity.getMode()); - return mValidPlayers.remove(mPlayer.getDisplayName(), mEntry); - } else { - return false; - } - } - - private boolean canCharge(GregtechMetaWirelessCharger charger, EntityPlayer chargeablePlayer, - Map<String, UUID> longRangeChargers, Map<String, UUID> shortRangeChargers) { - if (charger.getMode() == 0) { - return !longRangeChargers.isEmpty() && longRangeChargers.containsKey(chargeablePlayer.getDisplayName()); - } else if (charger.getMode() == 1) { - return !shortRangeChargers.isEmpty() && shortRangeChargers.containsKey(chargeablePlayer.getDisplayName()); - } else { - if (!longRangeChargers.isEmpty() && longRangeChargers.containsKey(chargeablePlayer.getDisplayName())) { - return true; - } - return !shortRangeChargers.isEmpty() && shortRangeChargers.containsKey(chargeablePlayer.getDisplayName()); - } - } - - private double calculateDistance(GregtechMetaWirelessCharger mEntityTemp, EntityPlayer mPlayerMan) { - if (mEntityTemp == null || mPlayerMan == null) { - return 0; - } - return mEntityTemp.getDistanceBetweenTwoPositions( - mEntityTemp.getTileEntityPosition(), - mEntityTemp.getPositionOfEntity(mPlayerMan)); - } - - private void chargeItems(@Nonnull GregtechMetaWirelessCharger mEntity, ItemStack[] mItems) { - if (mItems == null || mItems.length == 0) { - return; - } - chargeItemsEx(mEntity, mItems); - } - - private void chargeItemsEx(@Nonnull GregtechMetaWirelessCharger mEntity, ItemStack[] mItems) { - // Bad Inventory - if (mItems == null || mItems.length == 0) { - return; - } - // Set Variables to Charge - final long mVoltage = mEntity.maxEUInput(); - long mEuStored = mEntity.getEUVar(); - // For Inventory Contents - - for (ItemStack mTemp : mItems) { - // Is item Electrical - if (isItemValid(mTemp)) { - // Transfer Limit - double mItemEuTLimit = ((IElectricItem) mTemp.getItem()).getTransferLimit(mTemp); - // Check if Tile has more or equal EU to what can be transferred into the item. - if (mEuStored >= mItemEuTLimit) { - - double mItemMaxCharge = ((IElectricItem) mTemp.getItem()).getMaxCharge(mTemp); - double mitemCurrentCharge = ElectricItem.manager.getCharge(mTemp); - - if (mitemCurrentCharge >= mItemMaxCharge) { - continue; - } - - // Try to get charge direct from NBT for GT and IC2 stacks - if (mTemp.getItem() instanceof GT_MetaGenerated_Tool_01 - || mTemp.getItem() instanceof GT_MetaGenerated_Item_01 - || mTemp.getItem() instanceof GT_MetaGenerated_Item_02 - || mTemp.getItem() instanceof GT_MetaGenerated_Item_03 - || mTemp.getItem() - .getClass() - .getName() - .equalsIgnoreCase(GT_MetaGenerated_Tool_01.class.getName())) { - if (!NBTUtils.hasKey(mTemp, "GT.ItemCharge")) { - if (!mTemp.getDisplayName() - .toLowerCase() - .contains("battery")) { - if (!GT_ModHandler.isElectricItem(mTemp)) { - continue; - } - } else { - mitemCurrentCharge = 0; - } - } else { - mitemCurrentCharge = NBTUtils.getLong(mTemp, "GT.ItemCharge"); - } - } else if (mTemp.getItem() instanceof IElectricItem) { - mitemCurrentCharge = NBTUtils.getLong(mTemp, "charge"); - } - - double mVoltageIncrease; - if (mItemEuTLimit >= mVoltage) { - mVoltageIncrease = mVoltage; - } else if (mItemEuTLimit < mVoltage) { - mVoltageIncrease = mItemEuTLimit; - } else { - mVoltageIncrease = mItemEuTLimit; - } - - int mMulti; - if ((mitemCurrentCharge + (mVoltageIncrease * 20)) <= (mItemMaxCharge - (mVoltageIncrease * 20))) { - mMulti = 20; - } else if ((mitemCurrentCharge + (mVoltageIncrease * 10)) - <= (mItemMaxCharge - (mVoltageIncrease * 10))) { - mMulti = 10; - } else if ((mitemCurrentCharge + (mVoltageIncrease * 5)) - <= (mItemMaxCharge - (mVoltageIncrease * 5))) { - mMulti = 5; - } else { - mMulti = 1; - } - - int mMultiVoltage = (int) (mMulti * mVoltageIncrease); - - if ((mitemCurrentCharge + mMultiVoltage) <= mItemMaxCharge) { - if (GT_ModHandler.chargeElectricItem(mTemp, mMultiVoltage, Integer.MAX_VALUE, true, false) - > 0) { - for (int i = 0; i < mMulti; i++) { - ElectricItem.manager.charge(mTemp, mVoltageIncrease, Integer.MAX_VALUE, false, false); - } - } - if (ElectricItem.manager.getCharge(mTemp) > mitemCurrentCharge) { - mEntity.setEUVar(mEuStored - (mVoltage * mMulti)); - mEuStored = mEntity.getEUVar(); - } - } - - // Try top up Item Chrage - mitemCurrentCharge = ElectricItem.manager.getCharge(mTemp); - if (mitemCurrentCharge < mItemMaxCharge && mitemCurrentCharge >= (mItemMaxCharge - mVoltage)) { - int xDif = (int) (mItemMaxCharge - mitemCurrentCharge); - if (GT_ModHandler.chargeElectricItem(mTemp, xDif, Integer.MAX_VALUE, true, false) >= 0) { - if (ElectricItem.manager.getCharge(mTemp) >= mItemMaxCharge) { - mEntity.setEUVar(mEntity.getEUVar() - (xDif)); - mEuStored = mEntity.getEUVar(); - } - } - } - } - } else if (isItemValidRF(mTemp)) { - try { - IEnergyContainerItem rfItem = (IEnergyContainerItem) mTemp.getItem(); - if (rfItem != null) { - long chargedPower = Math.min( - rfItem.getMaxEnergyStored(mTemp) - rfItem.getEnergyStored(mTemp), - mEntity.getEUVar() * mEUtoRF / 100L); - chargedPower = rfItem.receiveEnergy( - mTemp, - chargedPower > Integer.MAX_VALUE ? Integer.MAX_VALUE : (int) chargedPower, - false); - chargedPower = chargedPower * 100L / mEUtoRF; - mEntity.setEUVar(Math.max(mEntity.getEUVar() - chargedPower, 0)); - mEuStored = mEntity.getEUVar(); - } - } catch (Exception ignored) { - - } - } - } - } - - public static boolean isItemValid(final ItemStack itemstack) { - if (itemstack == null) { - return false; - } - if (GT_ModHandler.isElectricItem(itemstack)) { - return true; - } - return itemstack.getItem() instanceof IElectricItem; - } - - private static boolean isItemValidRF(final ItemStack itemStack) { - return itemStack != null && COFHCore.isModLoaded() && itemStack.getItem() instanceof IEnergyContainerItem; - } -} diff --git a/gtpp/src/main/java/gtPlusPlus/xmod/gregtech/common/helpers/FlotationRecipeHandler.java b/gtpp/src/main/java/gtPlusPlus/xmod/gregtech/common/helpers/FlotationRecipeHandler.java deleted file mode 100644 index 8cbb473a42..0000000000 --- a/gtpp/src/main/java/gtPlusPlus/xmod/gregtech/common/helpers/FlotationRecipeHandler.java +++ /dev/null @@ -1,62 +0,0 @@ -package gtPlusPlus.xmod.gregtech.common.helpers; - -import java.util.HashMap; - -import net.minecraft.item.ItemStack; -import net.minecraftforge.oredict.OreDictionary; - -import gregtech.api.enums.OrePrefixes; -import gregtech.api.util.GT_Recipe; -import gregtech.api.util.GT_Utility; -import gtPlusPlus.api.objects.Logger; -import gtPlusPlus.core.material.Material; - -public class FlotationRecipeHandler { - - private static final HashMap<String, Material> sMaterialMap = new HashMap<>(); - private static final HashMap<String, ItemStack> sMilledMap = new HashMap<>(); - - public static boolean registerOreType(Material aMaterial) { - String aMaterialKey = aMaterial.getUnlocalizedName(); - if (sMaterialMap.containsKey(aMaterialKey)) { - Logger.WARNING("Tried to register a Flotation material already in use. Material: " + aMaterialKey); - return false; - } else { - sMaterialMap.put(aMaterialKey, aMaterial); - sMilledMap.put(aMaterialKey, aMaterial.getMilled(1)); - } - return true; - } - - public static Material getMaterialOfMilledProduct(ItemStack aMilled) { - for (String aKey : sMilledMap.keySet()) { - ItemStack aTempMilledStack = sMilledMap.get(aKey); - if (GT_Utility.areStacksEqual(aTempMilledStack, aMilled, true)) { - return sMaterialMap.get(aKey); - } - } - return null; - } - - public static ItemStack findMilledStack(GT_Recipe aRecipe) { - if (aRecipe == null || aRecipe.mInputs == null || aRecipe.mInputs.length <= 0) { - return null; - } - return findMilledStack(aRecipe.mInputs); - } - - public static ItemStack findMilledStack(ItemStack[] aInputs) { - if (aInputs == null || aInputs.length <= 0) { - return null; - } - for (ItemStack aStack : aInputs) { - for (int oredictID : OreDictionary.getOreIDs(aStack)) { - String oredict = OreDictionary.getOreName(oredictID); - if (oredict.startsWith(OrePrefixes.milled.toString())) { - return aStack; - } - } - } - return null; - } -} diff --git a/gtpp/src/main/java/gtPlusPlus/xmod/gregtech/common/helpers/GT_MethodHelper.java b/gtpp/src/main/java/gtPlusPlus/xmod/gregtech/common/helpers/GT_MethodHelper.java deleted file mode 100644 index ced9b46c3e..0000000000 --- a/gtpp/src/main/java/gtPlusPlus/xmod/gregtech/common/helpers/GT_MethodHelper.java +++ /dev/null @@ -1,19 +0,0 @@ -package gtPlusPlus.xmod.gregtech.common.helpers; - -import net.minecraft.block.Block; -import net.minecraft.tileentity.TileEntity; -import net.minecraftforge.common.util.ForgeDirection; - -import gregtech.api.enums.Textures.BlockIcons; -import gregtech.api.interfaces.ITexture; -import gregtech.api.interfaces.tileentity.ITexturedTileEntity; - -public class GT_MethodHelper { - - public static ITexture[] getTexture(TileEntity tTileEntity, Block aBlock, ForgeDirection side) { - if (tTileEntity instanceof ITexturedTileEntity) { - return ((ITexturedTileEntity) tTileEntity).getTexture(aBlock, side); - } - return BlockIcons.ERROR_RENDERING; - } -} diff --git a/gtpp/src/main/java/gtPlusPlus/xmod/gregtech/common/helpers/VolumetricFlaskHelper.java b/gtpp/src/main/java/gtPlusPlus/xmod/gregtech/common/helpers/VolumetricFlaskHelper.java deleted file mode 100644 index 2b0e2a7a4d..0000000000 --- a/gtpp/src/main/java/gtPlusPlus/xmod/gregtech/common/helpers/VolumetricFlaskHelper.java +++ /dev/null @@ -1,125 +0,0 @@ -package gtPlusPlus.xmod.gregtech.common.helpers; - -import net.minecraft.item.Item; -import net.minecraft.item.ItemStack; -import net.minecraft.nbt.NBTTagCompound; -import net.minecraftforge.fluids.FluidStack; - -import gregtech.api.enums.ItemList; -import gregtech.common.items.GT_VolumetricFlask; -import gtPlusPlus.xmod.gregtech.api.enums.GregtechItemList; - -public class VolumetricFlaskHelper { - - public static ItemStack getVolumetricFlask(int aAmount) { - return ItemList.VOLUMETRIC_FLASK.get(aAmount); - } - - public static ItemStack getLargeVolumetricFlask(int aAmount) { - return GregtechItemList.VOLUMETRIC_FLASK_8k.get(aAmount); - } - - public static ItemStack getGiganticVolumetricFlask(int aAmount) { - return GregtechItemList.VOLUMETRIC_FLASK_32k.get(aAmount); - } - - public static boolean isVolumetricFlask(ItemStack aStack) { - return isNormalVolumetricFlask(aStack) || isLargeVolumetricFlask(aStack) || isGiganticVolumetricFlask(aStack); - } - - public static boolean isNormalVolumetricFlask(ItemStack aStack) { - return aStack.getItem() == ItemList.VOLUMETRIC_FLASK.getItem(); - } - - public static boolean isLargeVolumetricFlask(ItemStack aStack) { - return GregtechItemList.VOLUMETRIC_FLASK_8k.getItem() == aStack.getItem(); - } - - public static boolean isGiganticVolumetricFlask(ItemStack aStack) { - return GregtechItemList.VOLUMETRIC_FLASK_32k.getItem() == aStack.getItem(); - } - - public static int getMaxFlaskCapacity(ItemStack aStack) { - if (aStack != null) { - Item aItem = aStack.getItem(); - if (aItem instanceof GT_VolumetricFlask) { - return ((GT_VolumetricFlask) aItem).getMaxCapacity(); - } - } - return 0; - } - - public static boolean isFlaskEmpty(ItemStack aStack) { - return getFlaskFluid(aStack) == null; - } - - public static FluidStack getFlaskFluid(ItemStack aStack) { - if (aStack.hasTagCompound()) { - NBTTagCompound nbt = aStack.getTagCompound(); - if (nbt.hasKey("Fluid", 10)) return FluidStack.loadFluidStackFromNBT(nbt.getCompoundTag("Fluid")); - } - return null; - } - - public static void setFluid(ItemStack stack, FluidStack fluidStack) { - boolean removeFluid = (fluidStack == null) || (fluidStack.amount <= 0); - NBTTagCompound nbt = stack.getTagCompound(); - if (nbt == null) { - if (removeFluid) return; - stack.setTagCompound(nbt = new NBTTagCompound()); - } - if (removeFluid) { - nbt.removeTag("Fluid"); - if (nbt.hasNoTags()) { - stack.setTagCompound(null); - } - } else { - nbt.setTag("Fluid", fluidStack.writeToNBT(new NBTTagCompound())); - } - } - - public static int getFlaskCapacity(ItemStack aStack) { - int capacity = 1000; - if (aStack.hasTagCompound()) { - NBTTagCompound nbt = aStack.getTagCompound(); - if (nbt.hasKey("Capacity", 3)) capacity = nbt.getInteger("Capacity"); - } - return Math.min(getMaxFlaskCapacity(aStack), capacity); - } - - public static boolean setNewFlaskCapacity(ItemStack aStack, int aCapacity) { - if (aStack == null || aCapacity <= 0) { - return false; - } - aCapacity = Math.min(aCapacity, getMaxFlaskCapacity(aStack)); - NBTTagCompound nbt = aStack.getTagCompound(); - if (nbt == null) { - aStack.setTagCompound(nbt = new NBTTagCompound()); - } - nbt.setInteger("Capacity", aCapacity); - return true; - } - - public static int fillFlask(ItemStack stack, FluidStack resource, boolean doFill) { - if (stack.stackSize != 1) return 0; - if ((resource == null) || (resource.amount <= 0)) { - return 0; - } - FluidStack fluidStack = getFlaskFluid(stack); - if (fluidStack == null) { - fluidStack = new FluidStack(resource, 0); - } else if (!fluidStack.isFluidEqual(resource)) { - return 0; - } - int amount = Math.min(getMaxFlaskCapacity(stack) - fluidStack.amount, resource.amount); - if ((doFill) && (amount > 0)) { - fluidStack.amount += amount; - setFluid(stack, fluidStack); - } - return amount; - } - - public static Item generateNewFlask(String unlocalized, String english, int maxCapacity) { - return new GT_VolumetricFlask(unlocalized, english, maxCapacity); - } -} diff --git a/gtpp/src/main/java/gtPlusPlus/xmod/gregtech/common/helpers/tesseract/TesseractHelper.java b/gtpp/src/main/java/gtPlusPlus/xmod/gregtech/common/helpers/tesseract/TesseractHelper.java deleted file mode 100644 index 3717f17554..0000000000 --- a/gtpp/src/main/java/gtPlusPlus/xmod/gregtech/common/helpers/tesseract/TesseractHelper.java +++ /dev/null @@ -1,256 +0,0 @@ -package gtPlusPlus.xmod.gregtech.common.helpers.tesseract; - -import static gtPlusPlus.core.lib.CORE.sTesseractGeneratorOwnershipMap; -import static gtPlusPlus.core.lib.CORE.sTesseractTerminalOwnershipMap; - -import java.util.HashMap; -import java.util.Map; -import java.util.Map.Entry; -import java.util.Set; -import java.util.UUID; - -import net.minecraft.entity.player.EntityPlayer; - -import gtPlusPlus.api.objects.Logger; -import gtPlusPlus.xmod.gregtech.common.tileentities.automation.GT_MetaTileEntity_TesseractGenerator; -import gtPlusPlus.xmod.gregtech.common.tileentities.automation.GT_MetaTileEntity_TesseractTerminal; - -public class TesseractHelper { - - /** - * Tesseract Generator Helpers - * - * @param player - * @return - */ - - // Checks if a Generator is owned by a player. - public static final boolean isGeneratorOwnedByPlayer(EntityPlayer player, - GT_MetaTileEntity_TesseractGenerator generator) { - if (player == null) { - Logger.WARNING("Failed. [isGeneratorOwnedByPlayer]"); - return false; - } - // Utils.LOG_WARNING("Success. [isGeneratorOwnedByPlayer] 1"); - UUID playerIdentifier = player.getUniqueID(); - if (!sTesseractGeneratorOwnershipMap.isEmpty() && playerIdentifier != null) { - // Utils.LOG_WARNING("Success. [isGeneratorOwnedByPlayer] 2"); - Map<Integer, GT_MetaTileEntity_TesseractGenerator> generators = getGeneratorOwnershipByPlayer(player); - Set<Entry<Integer, GT_MetaTileEntity_TesseractGenerator>> players = generators.entrySet(); - for (Entry<Integer, GT_MetaTileEntity_TesseractGenerator> current : players) { - // Utils.LOG_WARNING("Success. [isGeneratorOwnedByPlayer] 3"); - if (current.getValue() - .equals(generator)) { - // Utils.LOG_WARNING("Success. [isGeneratorOwnedByPlayer] 4"); - return true; - } - } - } - Logger.WARNING("Failed. [isGeneratorOwnedByPlayer]"); - return false; - } - - // Saves A Generator to the Players UUID map along with the Freq. - public static final boolean setGeneratorOwnershipByPlayer(EntityPlayer player, int freq, - GT_MetaTileEntity_TesseractGenerator generator) { - if (player == null) { - return false; - } - UUID playerIdentifier = player.getUniqueID(); - Logger.WARNING("Setting Generator on " + freq + " for " + player.getDisplayName() + "."); - if (playerIdentifier != null) { - Map<Integer, GT_MetaTileEntity_TesseractGenerator> playerOwned = sTesseractGeneratorOwnershipMap - .get(playerIdentifier); - if (playerOwned == null || playerOwned.isEmpty()) { - Map<Integer, GT_MetaTileEntity_TesseractGenerator> newOwnershipMap = new HashMap<>(); - newOwnershipMap.put(freq, generator); - sTesseractGeneratorOwnershipMap.put(playerIdentifier, newOwnershipMap); - Logger.WARNING("Success! [Empty Map]"); - return true; - } else if (sTesseractGeneratorOwnershipMap.containsKey(playerIdentifier)) { - Map<Integer, GT_MetaTileEntity_TesseractGenerator> ownershipMap = sTesseractGeneratorOwnershipMap - .get(playerIdentifier); - if (!ownershipMap.containsKey(freq)) { - ownershipMap.put(freq, generator); - } - ownershipMap.put(freq, generator); - sTesseractGeneratorOwnershipMap.put(playerIdentifier, ownershipMap); - Logger.WARNING("Success!"); - return true; - } - } - Logger.WARNING("Failed. [setGeneratorOwnershipByPlayer]"); - return false; - } - - // Gets Generator based on Frequency. - public static final GT_MetaTileEntity_TesseractGenerator getGeneratorByFrequency(EntityPlayer player, int freq) { - if (player == null) { - return null; - } - UUID playerIdentifier = player.getUniqueID(); - Logger.WARNING("Getting Generator on " + freq + " for " + player.getDisplayName() + "."); - if (!sTesseractGeneratorOwnershipMap.isEmpty() && playerIdentifier != null) { - // Utils.LOG_WARNING("Success. [getGeneratorByFrequency] 1"); - Map<Integer, GT_MetaTileEntity_TesseractGenerator> generators = getGeneratorOwnershipByPlayer(player); - Set<Entry<Integer, GT_MetaTileEntity_TesseractGenerator>> players = generators.entrySet(); - for (Entry<Integer, GT_MetaTileEntity_TesseractGenerator> current : players) { - // Utils.LOG_WARNING("Success. [getGeneratorByFrequency] 2"); - if (current.getKey() - .equals(freq)) { - // Utils.LOG_WARNING("Success. [getGeneratorByFrequency] 3"); - Logger.WARNING("Success!"); - return current.getValue(); - } - } - } - Logger.WARNING("Failed. [getGeneratorByFrequency]"); - return null; - } - - // Remove Tesseract Generator - public static final boolean removeGenerator(EntityPlayer player, int frequency) { - if (player == null) { - return false; - } - UUID playerIdentifier = player.getUniqueID(); - if (!sTesseractGeneratorOwnershipMap.isEmpty() && playerIdentifier != null) { - sTesseractGeneratorOwnershipMap.get(playerIdentifier) - .remove(frequency); - return true; - } - return false; - } - - /** - * - * Tesseract Terminal Helpers - * - * @param player - * @return - */ - - // Checks if a Terminal is owned by a player. - public static final boolean isTerminalOwnedByPlayer(EntityPlayer player, - GT_MetaTileEntity_TesseractTerminal generator) { - if (player == null) { - return false; - } - UUID playerIdentifier = player.getUniqueID(); - if (!sTesseractTerminalOwnershipMap.isEmpty() && playerIdentifier != null) { - Map<Integer, GT_MetaTileEntity_TesseractTerminal> generators = getTerminalOwnershipByPlayer(player); - Set<Entry<Integer, GT_MetaTileEntity_TesseractTerminal>> players = generators.entrySet(); - for (Entry<Integer, GT_MetaTileEntity_TesseractTerminal> current : players) { - if (current.getValue() - .equals(generator)) { - return true; - } - } - } - return false; - } - - // Saves A Terminal to the Players UUID map along with the Freq. - public static final boolean setTerminalOwnershipByPlayer(EntityPlayer player, int freq, - GT_MetaTileEntity_TesseractTerminal generator) { - if (player == null) { - return false; - } - UUID playerIdentifier = player.getUniqueID(); - if (playerIdentifier != null) { - Logger.WARNING("Setting Terminal on " + freq + " for " + player.getDisplayName() + "."); - Map<Integer, GT_MetaTileEntity_TesseractTerminal> playerOwned = sTesseractTerminalOwnershipMap - .get(playerIdentifier); - if (playerOwned == null || playerOwned.isEmpty()) { - Map<Integer, GT_MetaTileEntity_TesseractTerminal> newOwnershipMap = new HashMap<>(); - newOwnershipMap.put(freq, generator); - sTesseractTerminalOwnershipMap.put(playerIdentifier, newOwnershipMap); - Logger.WARNING("Success! [Empty Map]"); - return true; - } else if (sTesseractTerminalOwnershipMap.containsKey(playerIdentifier)) { - Map<Integer, GT_MetaTileEntity_TesseractTerminal> ownershipMap = sTesseractTerminalOwnershipMap - .get(playerIdentifier); - if (!ownershipMap.containsKey(freq)) { - ownershipMap.put(freq, generator); - } - sTesseractTerminalOwnershipMap.put(playerIdentifier, ownershipMap); - Logger.WARNING("Success!"); - return true; - } - } - Logger.WARNING("Failed. [setTerminalOwnershipByPlayer]"); - return false; - } - - // Gets Terminal based on Frequency. - public static final GT_MetaTileEntity_TesseractTerminal getTerminalByFrequency(EntityPlayer player, int freq) { - if (player == null) { - return null; - } - UUID playerIdentifier = player.getUniqueID(); - Logger.WARNING("Getting Terminal on " + freq + " for " + player.getDisplayName() + "."); - if (!sTesseractTerminalOwnershipMap.isEmpty() && playerIdentifier != null) { - Map<Integer, GT_MetaTileEntity_TesseractTerminal> generators = getTerminalOwnershipByPlayer(player); - Set<Entry<Integer, GT_MetaTileEntity_TesseractTerminal>> players = generators.entrySet(); - for (Entry<Integer, GT_MetaTileEntity_TesseractTerminal> current : players) { - if (current.getKey() - .equals(freq)) { - Logger.WARNING("Success!"); - return current.getValue(); - } - } - } - Logger.WARNING("Failed. [getTerminalByFrequency]"); - return null; - } - - // Remove Tesseract Terminal - public static final boolean removeTerminal(EntityPlayer player, int frequency) { - if (player == null) { - return false; - } - UUID playerIdentifier = player.getUniqueID(); - if (!sTesseractTerminalOwnershipMap.isEmpty() && playerIdentifier != null) { - sTesseractTerminalOwnershipMap.get(playerIdentifier) - .remove(frequency); - return true; - } - return false; - } - - /** - * - * Internal Methods - * - */ - private static Map<Integer, GT_MetaTileEntity_TesseractGenerator> getGeneratorOwnershipByPlayer( - EntityPlayer player) { - UUID playerIdentifier = player.getUniqueID(); - if (!sTesseractGeneratorOwnershipMap.isEmpty() && playerIdentifier != null) { - Set<Entry<UUID, Map<Integer, GT_MetaTileEntity_TesseractGenerator>>> players = sTesseractGeneratorOwnershipMap - .entrySet(); - for (Entry<UUID, Map<Integer, GT_MetaTileEntity_TesseractGenerator>> current : players) { - if (current.getKey() - .compareTo(playerIdentifier) == 0) { - return current.getValue(); - } - } - } - return null; - } - - private static Map<Integer, GT_MetaTileEntity_TesseractTerminal> getTerminalOwnershipByPlayer(EntityPlayer player) { - UUID playerIdentifier = player.getUniqueID(); - if (!sTesseractTerminalOwnershipMap.isEmpty() && playerIdentifier != null) { - Set<Entry<UUID, Map<Integer, GT_MetaTileEntity_TesseractTerminal>>> players = sTesseractTerminalOwnershipMap - .entrySet(); - for (Entry<UUID, Map<Integer, GT_MetaTileEntity_TesseractTerminal>> current : players) { - if (current.getKey() - .compareTo(playerIdentifier) == 0) { - return current.getValue(); - } - } - } - return null; - } -} diff --git a/gtpp/src/main/java/gtPlusPlus/xmod/gregtech/common/items/MetaCustomCoverItem.java b/gtpp/src/main/java/gtPlusPlus/xmod/gregtech/common/items/MetaCustomCoverItem.java deleted file mode 100644 index 8edb8c2cf9..0000000000 --- a/gtpp/src/main/java/gtPlusPlus/xmod/gregtech/common/items/MetaCustomCoverItem.java +++ /dev/null @@ -1,222 +0,0 @@ -package gtPlusPlus.xmod.gregtech.common.items; - -import static gregtech.api.enums.Mods.GTPlusPlus; - -import java.util.List; - -import net.minecraft.creativetab.CreativeTabs; -import net.minecraft.entity.player.EntityPlayer; -import net.minecraft.item.Item; -import net.minecraft.item.ItemStack; -import net.minecraft.nbt.NBTTagCompound; -import net.minecraft.util.EnumChatFormatting; -import net.minecraft.util.IIcon; -import net.minecraft.world.World; - -import org.apache.commons.lang3.StringUtils; - -import cpw.mods.fml.common.registry.GameRegistry; -import gregtech.api.GregTech_API; -import gregtech.api.interfaces.IIconContainer; -import gregtech.api.interfaces.ITexture; -import gregtech.api.objects.GT_MultiTexture; -import gregtech.api.objects.GT_RenderedTexture; -import gtPlusPlus.api.objects.Logger; -import gtPlusPlus.core.creative.AddToCreativeTab; -import gtPlusPlus.core.util.Utils; -import gtPlusPlus.core.util.minecraft.ItemUtils; -import gtPlusPlus.core.util.sys.KeyboardUtils; -import gtPlusPlus.xmod.gregtech.common.covers.GTPP_Cover_ToggleVisual; - -public class MetaCustomCoverItem extends Item { - - protected final IIcon[] icons; - private final String mModID; - private final String mTextureSetName; - protected final IIconContainer[] mTextures; - private final short[][] mRGB; - - public MetaCustomCoverItem(String aModId, int aTextureCount, String aTextureSetName, IIconContainer[] aTextures, - short[][] aRGB) { - super(); - icons = new IIcon[aTextureCount]; - mModID = aModId; - mTextureSetName = Utils.sanitizeString(aTextureSetName); - mTextures = aTextures; - mRGB = aRGB; - this.setTextureName(GTPlusPlus.ID + ":" + "itemPlate"); - this.setHasSubtypes(true); - String unlocalizedName = "itemCustomMetaCover." + mModID + "." + mTextureSetName; - this.setUnlocalizedName(unlocalizedName); - this.setCreativeTab(AddToCreativeTab.tabMisc); - this.setMaxStackSize(1); - GameRegistry.registerItem(this, unlocalizedName); - registerCover(); - Logger.INFO( - "[Covers] Generated Custom covers for " + mModID - + " using " - + aTextureCount - + " textures from " - + mTextureSetName - + "."); - } - - public boolean hide() { - return true; - } - - private void registerCover() { - // CommonProxy.registerItemRendererGlobal(this, new CustomItemBlockRenderer()); - for (int i = 0; i < icons.length; i++) { - ItemStack thisStack = ItemUtils.simpleMetaStack(this, i, 1); - if (i > 0 && hide()) { - ItemUtils.hideItemFromNEI(thisStack); - } - GregTech_API.registerCover( - thisStack, - new GT_MultiTexture(new ITexture[] { new GT_RenderedTexture(mTextures[i]) }), - new GTPP_Cover_ToggleVisual()); - } - } - - /* - * @Override public void registerIcons(IIconRegister reg) { for (int i = 0; i < icons.length; i++) { this.icons[i] = - * mTextures[i].getIcon(); } } - * @Override public IIcon getIconFromDamage(int meta) { return this.icons[meta]; } - */ - - @Override - public void getSubItems(Item item, CreativeTabs tab, List list) { - for (int i = 0; i < icons.length; i++) { - list.add(new ItemStack(item, 1, i)); - } - } - - @Override - public String getUnlocalizedName(ItemStack stack) { - return this.getUnlocalizedName() + "_" + stack.getItemDamage(); - } - - @Override - public String getItemStackDisplayName(final ItemStack tItem) { - return StringUtils.capitalize(mTextureSetName) + " (" + tItem.getItemDamage() + ")"; // super.getItemStackDisplayName(tItem); - } - - private static boolean createNBT(ItemStack rStack) { - final NBTTagCompound tagMain = new NBTTagCompound(); - final NBTTagCompound tagNBT = new NBTTagCompound(); - tagNBT.setLong("Damage", 0); - tagNBT.setBoolean("AllowConnections", false); - tagMain.setTag("CustomCoverMeta", tagNBT); - rStack.setTagCompound(tagMain); - return true; - } - - public static final long getCoverDamage(final ItemStack aStack) { - NBTTagCompound aNBT = aStack.getTagCompound(); - if (aNBT != null) { - aNBT = aNBT.getCompoundTag("CustomCoverMeta"); - if (aNBT != null) { - return aNBT.getLong("Damage"); - } - } else { - createNBT(aStack); - } - return 0L; - } - - public static final boolean setCoverDamage(final ItemStack aStack, final long aDamage) { - NBTTagCompound aNBT = aStack.getTagCompound(); - if (aNBT != null) { - aNBT = aNBT.getCompoundTag("CustomCoverMeta"); - if (aNBT != null) { - aNBT.setLong("Damage", aDamage); - return true; - } - } - return false; - } - - public static final boolean getCoverConnections(final ItemStack aStack) { - NBTTagCompound aNBT = aStack.getTagCompound(); - if (aNBT != null) { - aNBT = aNBT.getCompoundTag("CustomCoverMeta"); - if (aNBT != null) { - return aNBT.getBoolean("AllowConnections"); - } - } else { - createNBT(aStack); - } - return false; - } - - public static final boolean setCoverConnections(final ItemStack aStack, final boolean aConnections) { - NBTTagCompound aNBT = aStack.getTagCompound(); - if (aNBT != null) { - aNBT = aNBT.getCompoundTag("CustomCoverMeta"); - if (aNBT != null) { - aNBT.setBoolean("AllowConnections", aConnections); - return true; - } - } - return false; - } - - @Override - public double getDurabilityForDisplay(ItemStack stack) { - if (stack.getTagCompound() == null) { - createNBT(stack); - } - double currentDamage = getCoverDamage(stack); - double meta = stack.getItemDamage() == 0 ? 50 : 2500; - double durabilitypercent = currentDamage / meta; - return durabilitypercent; - } - - @Override - public ItemStack onItemRightClick(ItemStack stack, World world, EntityPlayer player) { - if (KeyboardUtils.isShiftKeyDown()) { - boolean con = getCoverConnections(stack); - if (con) { - setCoverConnections(stack, false); - } else { - setCoverConnections(stack, true); - } - } - return stack; - } - - @Override - public void addInformation(ItemStack stack, EntityPlayer player, List list, boolean bool) { - boolean cons = getCoverConnections(stack); - list.add(EnumChatFormatting.GRAY + "Allows Connections: " + cons); - list.add(EnumChatFormatting.GRAY + "Shift Rmb to change state before applying"); - super.addInformation(stack, player, list, bool); - } - - @Override - public boolean showDurabilityBar(ItemStack stack) { - return false; - } - - @Override - public Item setFull3D() { - // TODO Auto-generated method stub - return super.setFull3D(); - } - - @Override - public boolean isFull3D() { - // TODO Auto-generated method stub - return super.isFull3D(); - } - - @Override - public int getColorFromItemStack(final ItemStack stack, final int HEX_OxFFFFFF) { - if (this.mRGB == null) { - return super.getColorFromItemStack(stack, HEX_OxFFFFFF); - } - int aMeta = stack.getItemDamage(); - return Utils.rgbtoHexValue(mRGB[aMeta][0], mRGB[aMeta][1], mRGB[aMeta][2]); - } -} diff --git a/gtpp/src/main/java/gtPlusPlus/xmod/gregtech/common/items/MetaGeneratedGregtechItems.java b/gtpp/src/main/java/gtPlusPlus/xmod/gregtech/common/items/MetaGeneratedGregtechItems.java deleted file mode 100644 index 8173a868aa..0000000000 --- a/gtpp/src/main/java/gtPlusPlus/xmod/gregtech/common/items/MetaGeneratedGregtechItems.java +++ /dev/null @@ -1,292 +0,0 @@ -package gtPlusPlus.xmod.gregtech.common.items; - -import static gregtech.client.GT_TooltipHandler.Tier.EV; -import static gregtech.client.GT_TooltipHandler.registerTieredTooltip; -import static gtPlusPlus.core.util.Utils.getTcAspectStack; - -import gregtech.api.GregTech_API; -import gregtech.api.enums.GT_Values; -import gregtech.api.enums.OrePrefixes; -import gregtech.api.enums.TC_Aspects; -import gregtech.api.enums.Textures; -import gregtech.api.objects.GT_MultiTexture; -import gregtech.api.objects.GT_RenderedTexture; -import gregtech.api.util.GT_ModHandler; -import gtPlusPlus.core.lib.CORE; -import gtPlusPlus.core.util.data.StringUtils; -import gtPlusPlus.core.util.math.MathUtils; -import gtPlusPlus.xmod.gregtech.api.enums.GregtechItemList; -import gtPlusPlus.xmod.gregtech.api.items.Gregtech_MetaItem_X32; -import gtPlusPlus.xmod.gregtech.common.blocks.textures.TexturesGtBlock; -import gtPlusPlus.xmod.gregtech.common.covers.GTPP_Cover_Overflow; - -public class MetaGeneratedGregtechItems extends Gregtech_MetaItem_X32 { - - public static final MetaGeneratedGregtechItems INSTANCE; - - static { - INSTANCE = new MetaGeneratedGregtechItems(); - } - - public MetaGeneratedGregtechItems() { - super("MU-metaitem.01", new OrePrefixes[] { null }); - } - - public void generateMetaItems() { - int tLastID = 0; - - // Extruder Shape - GregtechItemList.Shape_Extruder_WindmillShaft - .set(this.addItem(40, "Extruder Shape (Shaft)", "Extruder Shape for making Windmill Shafts")); - - // Batteries - GregtechItemList.Battery_RE_EV_Sodium.set( - this.addItem( - tLastID = 50, - "Quad Cell Sodium Battery", - "Reusable", - getTcAspectStack(TC_Aspects.ELECTRUM, 2L), - getTcAspectStack(TC_Aspects.METALLUM, 2L), - getTcAspectStack(TC_Aspects.POTENTIA, 2L))); - this.setElectricStats(32000 + tLastID, 3200000L, GT_Values.V[4], 4L, -3L, true); - registerTieredTooltip(GregtechItemList.Battery_RE_EV_Sodium.get(1), EV); - - GregtechItemList.Battery_RE_EV_Cadmium.set( - this.addItem( - tLastID = 52, - "Quad Cell Cadmium Battery", - "Reusable", - getTcAspectStack(TC_Aspects.ELECTRUM, 1L), - getTcAspectStack(TC_Aspects.METALLUM, 1L), - getTcAspectStack(TC_Aspects.POTENTIA, 1L))); - this.setElectricStats(32000 + tLastID, 4800000L, GT_Values.V[4], 4L, -3L, true); - registerTieredTooltip(GregtechItemList.Battery_RE_EV_Cadmium.get(1), EV); - - GregtechItemList.Battery_RE_EV_Lithium.set( - this.addItem( - tLastID = 54, - "Quad Cell Lithium Battery", - "Reusable", - getTcAspectStack(TC_Aspects.ELECTRUM, 3L), - getTcAspectStack(TC_Aspects.METALLUM, 3L), - getTcAspectStack(TC_Aspects.POTENTIA, 3L))); - this.setElectricStats(32000 + tLastID, 6400000L, GT_Values.V[4], 4L, -3L, true); - registerTieredTooltip(GregtechItemList.Battery_RE_EV_Lithium.get(1), EV); - - /** - * Power Gems - */ - GregtechItemList.Battery_Gem_1.set( - this.addItem( - tLastID = 66, - "Proton Cell", - "Reusable", - getTcAspectStack(TC_Aspects.ELECTRUM, 8L), - getTcAspectStack(TC_Aspects.METALLUM, 24L), - getTcAspectStack(TC_Aspects.POTENTIA, 16L))); - this.setElectricStats(32000 + tLastID, GT_Values.V[6] * 20 * 300 / 4, GT_Values.V[6], 6L, -3L, false); - GregtechItemList.Battery_Gem_2.set( - this.addItem( - tLastID = 68, - "Electron Cell", - "Reusable", - getTcAspectStack(TC_Aspects.ELECTRUM, 16L), - getTcAspectStack(TC_Aspects.METALLUM, 32L), - getTcAspectStack(TC_Aspects.POTENTIA, 32L))); - this.setElectricStats(32000 + tLastID, GT_Values.V[7] * 20 * 300 / 4, GT_Values.V[7], 7L, -3L, false); - GregtechItemList.Battery_Gem_3.set( - this.addItem( - tLastID = 70, - "Quark Entanglement", - "Reusable", - getTcAspectStack(TC_Aspects.ELECTRUM, 32L), - getTcAspectStack(TC_Aspects.METALLUM, 48L), - getTcAspectStack(TC_Aspects.POTENTIA, 64L))); - this.setElectricStats(32000 + tLastID, GT_Values.V[8] * 20 * 300 / 4, GT_Values.V[8], 8L, -3L, false); - - // RTG Pellet - GregtechItemList.Pellet_RTG_PU238.set( - this.addItem( - 41, - StringUtils.superscript("238") + "Pu Pellet", - "", - getTcAspectStack(TC_Aspects.RADIO, 4L), - getTcAspectStack(TC_Aspects.POTENTIA, 2L), - getTcAspectStack(TC_Aspects.METALLUM, 2L))); - GregtechItemList.Pellet_RTG_SR90.set( - this.addItem( - 42, - StringUtils.superscript("90") + "Sr Pellet", - "", - getTcAspectStack(TC_Aspects.RADIO, 4L), - getTcAspectStack(TC_Aspects.POTENTIA, 2L), - getTcAspectStack(TC_Aspects.METALLUM, 2L))); - GregtechItemList.Pellet_RTG_PO210.set( - this.addItem( - 43, - StringUtils.superscript("210") + "Po Pellet", - "", - getTcAspectStack(TC_Aspects.RADIO, 4L), - getTcAspectStack(TC_Aspects.POTENTIA, 2L), - getTcAspectStack(TC_Aspects.METALLUM, 2L))); - GregtechItemList.Pellet_RTG_AM241.set( - this.addItem( - 44, - StringUtils.superscript("241") + "Am Pellet", - "", - getTcAspectStack(TC_Aspects.RADIO, 4L), - getTcAspectStack(TC_Aspects.POTENTIA, 2L), - getTcAspectStack(TC_Aspects.METALLUM, 2L))); - - CORE.RA.addFuelForRTG(GregtechItemList.Pellet_RTG_PU238.get(1), MathUtils.roundToClosestInt(87.7f), 64); - CORE.RA.addFuelForRTG(GregtechItemList.Pellet_RTG_SR90.get(1), MathUtils.roundToClosestInt(28.8f), 32); - CORE.RA.addFuelForRTG(GregtechItemList.Pellet_RTG_PO210.get(1), 1, 512); - CORE.RA.addFuelForRTG(GregtechItemList.Pellet_RTG_AM241.get(1), 216, 16); - CORE.RA.addFuelForRTG(GT_ModHandler.getIC2Item("RTGPellets", 1), MathUtils.roundToClosestInt(2.6f), 8); - - // Computer Cube - GregtechItemList.Gregtech_Computer_Cube.set( - this.addItem( - tLastID = 55, - "Gregtech Computer Cube", - "Reusable", - getTcAspectStack(TC_Aspects.ELECTRUM, 8L), - getTcAspectStack(TC_Aspects.METALLUM, 8L), - getTcAspectStack(TC_Aspects.POTENTIA, 8L))); - this.setElectricStats(32000 + tLastID, GT_Values.V[6] * 10 * 60 * 20, GT_Values.V[5], 5L, -3L, false); - - GregtechItemList.Cover_Overflow_LV.set( - this.addItem( - 72, - "Overflow Valve (LV)", - "Maximum void amount: 64,000", - getTcAspectStack(TC_Aspects.ELECTRUM, 1L), - getTcAspectStack(TC_Aspects.MACHINA, 1L), - getTcAspectStack(TC_Aspects.ITER, 1L), - getTcAspectStack(TC_Aspects.AQUA, 1L))); - GregtechItemList.Cover_Overflow_MV.set( - this.addItem( - 73, - "Overflow Valve (MV)", - "Maximum void amount: 512,000", - getTcAspectStack(TC_Aspects.ELECTRUM, 1L), - getTcAspectStack(TC_Aspects.MACHINA, 1L), - getTcAspectStack(TC_Aspects.ITER, 1L), - getTcAspectStack(TC_Aspects.AQUA, 1L))); - GregtechItemList.Cover_Overflow_HV.set( - this.addItem( - 74, - "Overflow Valve (HV)", - "Maximum void amount: 4,096,000", - getTcAspectStack(TC_Aspects.ELECTRUM, 1L), - getTcAspectStack(TC_Aspects.MACHINA, 1L), - getTcAspectStack(TC_Aspects.ITER, 1L), - getTcAspectStack(TC_Aspects.AQUA, 1L))); - GregtechItemList.Cover_Overflow_EV.set( - this.addItem( - 75, - "Overflow Valve (EV)", - "Maximum void amount: 32,768,000", - getTcAspectStack(TC_Aspects.ELECTRUM, 1L), - getTcAspectStack(TC_Aspects.MACHINA, 1L), - getTcAspectStack(TC_Aspects.ITER, 1L), - getTcAspectStack(TC_Aspects.AQUA, 1L))); - GregtechItemList.Cover_Overflow_IV.set( - this.addItem( - 76, - "Overflow Valve (IV)", - "Maximum void amount: 262,144,000", - getTcAspectStack(TC_Aspects.ELECTRUM, 1L), - getTcAspectStack(TC_Aspects.MACHINA, 1L), - getTcAspectStack(TC_Aspects.ITER, 1L), - getTcAspectStack(TC_Aspects.AQUA, 1L))); - - GregTech_API.registerCover( - GregtechItemList.Cover_Overflow_LV.get(1L), - new GT_MultiTexture( - Textures.BlockIcons.MACHINE_CASINGS[4][0], - new GT_RenderedTexture(TexturesGtBlock.Overlay_Overflow_Valve)), - new GTPP_Cover_Overflow(64)); - GregTech_API.registerCover( - GregtechItemList.Cover_Overflow_MV.get(1L), - new GT_MultiTexture( - Textures.BlockIcons.MACHINE_CASINGS[5][0], - new GT_RenderedTexture(TexturesGtBlock.Overlay_Overflow_Valve)), - new GTPP_Cover_Overflow(512)); - GregTech_API.registerCover( - GregtechItemList.Cover_Overflow_HV.get(1L), - new GT_MultiTexture( - Textures.BlockIcons.MACHINE_CASINGS[5][0], - new GT_RenderedTexture(TexturesGtBlock.Overlay_Overflow_Valve)), - new GTPP_Cover_Overflow(4096)); - GregTech_API.registerCover( - GregtechItemList.Cover_Overflow_EV.get(1L), - new GT_MultiTexture( - Textures.BlockIcons.MACHINE_CASINGS[8][0], - new GT_RenderedTexture(TexturesGtBlock.Overlay_Overflow_Valve)), - new GTPP_Cover_Overflow(32768)); - GregTech_API.registerCover( - GregtechItemList.Cover_Overflow_IV.get(1L), - new GT_MultiTexture( - Textures.BlockIcons.MACHINE_CASINGS[8][0], - new GT_RenderedTexture(TexturesGtBlock.Overlay_Overflow_Valve)), - new GTPP_Cover_Overflow(262144)); - - // Fusion Reactor MK4 Singularity - GregtechItemList.Compressed_Fusion_Reactor.set( - this.addItem( - 100, - "Hypervisor Matrix (Fusion)", - "A memory unit containing an RI (Restricted Intelligence)")); - - GregtechItemList.Laser_Lens_Special - .set(this.addItem(105, "Quantum Anomaly", "Probably should shoot it with lasers")); - - GregtechItemList.Battery_Casing_Gem_1.set(this.addItem(106, "Containment Unit I", "Used in crafting")); - GregtechItemList.Battery_Casing_Gem_2.set(this.addItem(107, "Containment Unit II", "Used in crafting")); - GregtechItemList.Battery_Casing_Gem_3.set(this.addItem(108, "Advanced Containment Unit", "Used in crafting")); - GregtechItemList.Battery_Casing_Gem_4.set(this.addItem(109, "Exotic Containment Unit", "Used in crafting")); - - GregtechItemList.Battery_Gem_4.set( - this.addItem( - tLastID = 110, - "Graviton Anomaly", - "Reusable", - getTcAspectStack(TC_Aspects.ELECTRUM, 64L), - getTcAspectStack(TC_Aspects.METALLUM, 64L), - getTcAspectStack(TC_Aspects.POTENTIA, 64L))); - this.setElectricStats(32000 + tLastID, (64000000000L * 16), GT_Values.V[9], 9L, -3L, false); - - /* - * High Tier 'Saws' for the tree Farm - */ - - GregtechItemList.Laser_Lens_WoodsGlass.set( - this.addItem(140, "Wood's Glass Lens", "Allows UV & IF to pass through, blocks visible light spectrums")); - - // 141 now unused, was the ulv transmission component - int aStartID = 142; - GregtechItemList[] aTransParts = new GregtechItemList[] { GregtechItemList.TransmissionComponent_LV, - GregtechItemList.TransmissionComponent_MV, GregtechItemList.TransmissionComponent_HV, - GregtechItemList.TransmissionComponent_EV, GregtechItemList.TransmissionComponent_IV, - GregtechItemList.TransmissionComponent_LuV, GregtechItemList.TransmissionComponent_ZPM, - GregtechItemList.TransmissionComponent_UV, GregtechItemList.TransmissionComponent_UHV, }; - for (int tier = 1; tier < aTransParts.length + 1; tier++) { - aTransParts[tier - 1].set( - this.addItem( - aStartID++, - "Transmission Component (" + GT_Values.VN[tier] + ")", - "", - getTcAspectStack(TC_Aspects.ELECTRUM, tier), - getTcAspectStack(TC_Aspects.MACHINA, tier), - getTcAspectStack(TC_Aspects.MAGNETO, tier))); - } - - // Distillus Chip - GregtechItemList.Distillus_Upgrade_Chip - .set(this.addItem(151, "Distillus Upgrade Chip", "Used to upgrade Distillus to Tier 2")); - GregtechItemList.Maceration_Upgrade_Chip - .set(this.addItem(152, "Maceration Upgrade Chip", "Used to upgrade Maceration Stack to Tier 2")); - } - -} diff --git a/gtpp/src/main/java/gtPlusPlus/xmod/gregtech/common/items/MetaGeneratedGregtechTools.java b/gtpp/src/main/java/gtPlusPlus/xmod/gregtech/common/items/MetaGeneratedGregtechTools.java deleted file mode 100644 index 30250a46f3..0000000000 --- a/gtpp/src/main/java/gtPlusPlus/xmod/gregtech/common/items/MetaGeneratedGregtechTools.java +++ /dev/null @@ -1,54 +0,0 @@ -package gtPlusPlus.xmod.gregtech.common.items; - -import gregtech.api.GregTech_API; -import gregtech.api.enums.TC_Aspects; -import gregtech.api.enums.ToolDictNames; -import gregtech.api.items.GT_MetaGenerated_Tool; -import gtPlusPlus.xmod.gregtech.api.enums.GregtechToolDictNames; -import gtPlusPlus.xmod.gregtech.common.tools.TOOL_Gregtech_AngleGrinder; -import gtPlusPlus.xmod.gregtech.common.tools.TOOL_Gregtech_ElectricSnips; - -public class MetaGeneratedGregtechTools extends GT_MetaGenerated_Tool { - - public static final short ANGLE_GRINDER = 7834; - public static final short ELECTRIC_SNIPS = 7934; - public static GT_MetaGenerated_Tool INSTANCE; - - static { - INSTANCE = new MetaGeneratedGregtechTools(); - } - - public static GT_MetaGenerated_Tool getInstance() { - return INSTANCE; - } - - private MetaGeneratedGregtechTools() { - super("plusplus.metatool.01"); - - // Electric File - this.addTool( - ANGLE_GRINDER, - "Angle Grinder", - "Hand-held electric filing device", - new TOOL_Gregtech_AngleGrinder(), - GregtechToolDictNames.craftingToolAngleGrinder, - ToolDictNames.craftingToolFile, - new TC_Aspects.TC_AspectStack(TC_Aspects.INSTRUMENTUM, 2L), - new TC_Aspects.TC_AspectStack(TC_Aspects.FABRICO, 2L), - new TC_Aspects.TC_AspectStack(TC_Aspects.ORDO, 2L)); - - // Electric Wire Cutter - GregTech_API.registerWireCutter( - this.addTool( - ELECTRIC_SNIPS, - "Automatic Snips", - "Hand-held electric wire cutter", - new TOOL_Gregtech_ElectricSnips(), - GregtechToolDictNames.craftingToolElectricSnips, - ToolDictNames.craftingToolWireCutter, - new TC_Aspects.TC_AspectStack(TC_Aspects.INSTRUMENTUM, 4L), - new TC_Aspects.TC_AspectStack(TC_Aspects.FABRICO, 4L), - new TC_Aspects.TC_AspectStack(TC_Aspects.ORDO, 4L))); - - } -} diff --git a/gtpp/src/main/java/gtPlusPlus/xmod/gregtech/common/items/behaviours/Behaviour_Choocher.java b/gtpp/src/main/java/gtPlusPlus/xmod/gregtech/common/items/behaviours/Behaviour_Choocher.java deleted file mode 100644 index f85822750d..0000000000 --- a/gtpp/src/main/java/gtPlusPlus/xmod/gregtech/common/items/behaviours/Behaviour_Choocher.java +++ /dev/null @@ -1,91 +0,0 @@ -package gtPlusPlus.xmod.gregtech.common.items.behaviours; - -import java.util.List; - -import net.minecraft.entity.player.EntityPlayer; -import net.minecraft.item.ItemStack; -import net.minecraft.world.World; -import net.minecraftforge.common.util.ForgeDirection; - -import gregtech.api.items.GT_MetaBase_Item; -import gregtech.api.util.GT_LanguageManager; -import gregtech.common.items.behaviors.Behaviour_None; -import gregtech.common.items.behaviors.Behaviour_Wrench; -import gtPlusPlus.core.util.minecraft.NBTUtils; -import gtPlusPlus.core.util.minecraft.PlayerUtils; - -public class Behaviour_Choocher extends Behaviour_None { - - private boolean isWrench = true; - private final Behaviour_Wrench wrench = new Behaviour_Wrench(150); - private final Behaviour_Prospecting_Ex prospecting = new Behaviour_Prospecting_Ex(10, 1250); - private final String mTooltip1 = GT_LanguageManager - .addStringLocalization("gt.behaviour.choochering1", "Current tool mode: "); - private final String mTooltip2 = GT_LanguageManager - .addStringLocalization("gt.behaviour.choochering2", "Change tool mode using Shift+Rightclick."); - private final String mTooltipH = GT_LanguageManager - .addStringLocalization("gt.behaviour.prospectingEx", "Usable for Prospecting large areas."); - private final String mTooltipW = GT_LanguageManager - .addStringLocalization("gt.behaviour.wrench", "Rotates Blocks on Rightclick."); - - public Behaviour_Choocher() {} - - @Override - public boolean onItemUseFirst(final GT_MetaBase_Item aItem, final ItemStack aStack, final EntityPlayer aPlayer, - final World aWorld, final int aX, final int aY, final int aZ, final ForgeDirection side, final float hitX, - final float hitY, final float hitZ) { - if (aWorld.isRemote) { - return false; - } - - boolean inWrenchMode; - if (NBTUtils.hasKey(aStack, "aMode")) { - inWrenchMode = NBTUtils.getBoolean(aStack, "aMode"); - } else { - aStack.getTagCompound() - .setBoolean("aMode", true); - inWrenchMode = true; - } - - if (aPlayer.isSneaking()) { - boolean aModeNew = !inWrenchMode; - aStack.getTagCompound() - .setBoolean("aMode", aModeNew); - PlayerUtils.messagePlayer(aPlayer, "Mode: " + (aModeNew ? "Wrench" : "Hammer")); - return true; - } else { - if (inWrenchMode) { - return this.wrench.onItemUseFirst(aItem, aStack, aPlayer, aWorld, aX, aY, aZ, side, hitZ, hitZ, hitZ); - } else { - return this.prospecting - .onItemUseFirst(aItem, aStack, aPlayer, aWorld, aX, aY, aZ, side, hitX, hitY, hitZ); - } - } - } - - @Override - public List<String> getAdditionalToolTips(final GT_MetaBase_Item aItem, final List<String> aList, - final ItemStack aStack) { - - boolean inWrenchMode; - if (NBTUtils.hasKey(aStack, "aMode")) { - inWrenchMode = NBTUtils.getBoolean(aStack, "aMode"); - } else { - NBTUtils.setBoolean(aStack, "aMode", true); - aStack.getTagCompound() - .setBoolean("aMode", true); - inWrenchMode = true; - } - - if (inWrenchMode) { - aList.add(this.mTooltip1 + "Wrench"); - aList.add(this.mTooltipW); - } else { - aList.add(this.mTooltip1 + "Prospecting"); - aList.add(this.mTooltipH); - } - aList.add(this.mTooltip2); - - return aList; - } -} diff --git a/gtpp/src/main/java/gtPlusPlus/xmod/gregtech/common/items/behaviours/Behaviour_Electric_Lighter.java b/gtpp/src/main/java/gtPlusPlus/xmod/gregtech/common/items/behaviours/Behaviour_Electric_Lighter.java deleted file mode 100644 index f3d7f87a86..0000000000 --- a/gtpp/src/main/java/gtPlusPlus/xmod/gregtech/common/items/behaviours/Behaviour_Electric_Lighter.java +++ /dev/null @@ -1,225 +0,0 @@ -package gtPlusPlus.xmod.gregtech.common.items.behaviours; - -import java.util.List; - -import net.minecraft.entity.Entity; -import net.minecraft.entity.monster.EntityCreeper; -import net.minecraft.entity.player.EntityPlayer; -import net.minecraft.init.Blocks; -import net.minecraft.item.ItemStack; -import net.minecraft.util.EnumChatFormatting; -import net.minecraft.world.World; -import net.minecraftforge.common.util.ForgeDirection; - -import codechicken.lib.math.MathHelper; -import gregtech.api.enums.SoundResource; -import gregtech.api.items.GT_MetaBase_Item; -import gregtech.api.util.GT_LanguageManager; -import gregtech.api.util.GT_Utility; -import gregtech.common.items.behaviors.Behaviour_None; -import gtPlusPlus.api.objects.Logger; -import gtPlusPlus.core.entity.projectile.EntityLightningAttack; -import gtPlusPlus.core.lib.CORE; -import gtPlusPlus.core.util.minecraft.NBTUtils; -import gtPlusPlus.core.util.minecraft.PlayerUtils; -import gtPlusPlus.xmod.gregtech.common.helpers.ChargingHelper; -import gtPlusPlus.xmod.gregtech.common.items.MetaGeneratedGregtechTools; -import ic2.api.item.IElectricItemManager; - -public class Behaviour_Electric_Lighter extends Behaviour_None { - - private final String mTooltip = GT_LanguageManager - .addStringLocalization("gt.behaviour.lighter.tooltip", "Can light things on Fire"); - private final String mTooltipUses = GT_LanguageManager - .addStringLocalization("gt.behaviour.lighter.uses", "Remaining Uses:"); - private final String mTooltipUnstackable = GT_LanguageManager - .addStringLocalization("gt.behaviour.unstackable", "Not usable when stacked!"); - - public Behaviour_Electric_Lighter() {} - - @Override - public boolean onLeftClickEntity(GT_MetaBase_Item aItem, ItemStack aStack, EntityPlayer aPlayer, Entity aEntity) { - if (!aPlayer.worldObj.isRemote && aStack != null && aStack.stackSize == 1) { - boolean rOutput = false; - if (aEntity instanceof EntityCreeper) { - if (this.prepare(aStack) || aPlayer.capabilities.isCreativeMode) { - GT_Utility.sendSoundToPlayers( - aPlayer.worldObj, - SoundResource.FIRE_IGNITE, - 1.0F, - 1.0F, - MathHelper.floor_double(aEntity.posX), - MathHelper.floor_double(aEntity.posY), - MathHelper.floor_double(aEntity.posZ)); - ((EntityCreeper) aEntity).func_146079_cb(); - rOutput = true; - } - } - return rOutput; - } else { - return false; - } - } - - @Override - public boolean onItemUse(GT_MetaBase_Item aItem, ItemStack aStack, EntityPlayer aPlayer, World aWorld, int aX, - int aY, int aZ, int ordinalSide, float hitX, float hitY, float hitZ) { - if (!aWorld.isRemote && aStack != null && aStack.stackSize == 1) { - if (aPlayer.isSneaking()) { - Logger.INFO("Changing Mode"); - boolean aCurrentMode = NBTUtils.getBoolean(aStack, "aFireballMode"); - Logger.INFO("Is currently in Fireball mode? " + aCurrentMode); - boolean aNewMode = !aCurrentMode; - Logger.INFO("Is now set to Fireball mode? " + aNewMode); - aStack.getTagCompound() - .setBoolean("aFireballMod", aNewMode); - // NBTUtils.setBoolean(aStack, "aFireballMode", aNewMode); - PlayerUtils.messagePlayer( - aPlayer, - "Current Mode: " + EnumChatFormatting.RED + (aNewMode ? "Projectile" : "Fire Starter")); - } else { - boolean aCurrentMode = NBTUtils.getBoolean(aStack, "aFireballMode"); - if (aCurrentMode) { - // Shoot Lightning Attack - aWorld - .playSoundAtEntity(aPlayer, "random.bow", 0.5F, 0.4F / (CORE.RANDOM.nextFloat() * 0.4F + 0.8F)); - if (!aWorld.isRemote) { - aWorld.spawnEntityInWorld(new EntityLightningAttack(aWorld, aPlayer, hitX, hitY, hitZ)); - } - } else { - // Lights Fires Mode - Logger.WARNING("Preparing Lighter a"); - boolean rOutput = false; - ForgeDirection tDirection = ForgeDirection.getOrientation(ordinalSide); - aX += tDirection.offsetX; - aY += tDirection.offsetY; - aZ += tDirection.offsetZ; - if (GT_Utility.isBlockAir(aWorld, aX, aY, aZ) - && aPlayer.canPlayerEdit(aX, aY, aZ, ordinalSide, aStack)) { - Logger.WARNING("Preparing Lighter b"); - if (this.prepare(aStack) || aPlayer.capabilities.isCreativeMode) { - Logger.WARNING("Preparing Lighter c"); - GT_Utility.sendSoundToPlayers(aWorld, SoundResource.FIRE_IGNITE, 1.0F, 1.0F, aX, aY, aZ); - aWorld.setBlock(aX, aY, aZ, Blocks.fire); - rOutput = true; - // ItemNBT.setLighterFuel(aStack, tFuelAmount); - return rOutput; - } - } - } - } - } - Logger.WARNING("Preparing Lighter z"); - return false; - } - - public boolean onItemUseFirst(GT_MetaBase_Item aItem, ItemStack aStack, EntityPlayer aPlayer, World aWorld, int aX, - int aY, int aZ, int ordinalSide, float hitX, float hitY, float hitZ) { - if (!aWorld.isRemote && aStack != null && aStack.stackSize == 1) { - if (aPlayer.isSneaking()) { - Logger.INFO("Changing Mode"); - boolean aCurrentMode = NBTUtils.getBoolean(aStack, "aFireballMode"); - Logger.INFO("Is currently in Fireball mode? " + aCurrentMode); - boolean aNewMode = !aCurrentMode; - Logger.INFO("Is now set to Fireball mode? " + aNewMode); - aStack.getTagCompound() - .setBoolean("aFireballMode", aNewMode); - // NBTUtils.setBoolean(aStack, "aFireballMode", aNewMode); - PlayerUtils.messagePlayer( - aPlayer, - "Current Mode: " + EnumChatFormatting.RED + (aNewMode ? "Projectile" : "Fire Starter")); - } else { - boolean aCurrentMode = NBTUtils.getBoolean(aStack, "aFireballMode"); - if (aCurrentMode) { - // Shoot Lightning Attack - aWorld - .playSoundAtEntity(aPlayer, "random.bow", 0.5F, 0.4F / (CORE.RANDOM.nextFloat() * 0.4F + 0.8F)); - if (!aWorld.isRemote) { - aWorld.spawnEntityInWorld(new EntityLightningAttack(aWorld, aPlayer, hitX, hitY, hitZ)); - } - } else { - // Lights Fires Mode - Logger.WARNING("Preparing Lighter a"); - boolean rOutput = false; - ForgeDirection tDirection = ForgeDirection.getOrientation(ordinalSide); - aX += tDirection.offsetX; - aY += tDirection.offsetY; - aZ += tDirection.offsetZ; - if (GT_Utility.isBlockAir(aWorld, aX, aY, aZ) - && aPlayer.canPlayerEdit(aX, aY, aZ, ordinalSide, aStack)) { - Logger.WARNING("Preparing Lighter b"); - if (this.prepare(aStack) || aPlayer.capabilities.isCreativeMode) { - Logger.WARNING("Preparing Lighter c"); - GT_Utility.sendSoundToPlayers(aWorld, SoundResource.FIRE_IGNITE, 1.0F, 1.0F, aX, aY, aZ); - aWorld.setBlock(aX, aY, aZ, Blocks.fire); - rOutput = true; - // ItemNBT.setLighterFuel(aStack, tFuelAmount); - return rOutput; - } - } - } - } - } - Logger.WARNING("Preparing Lighter z"); - return false; - } - - private boolean prepare(ItemStack aStack) { - if (aStack != null) { - Logger.WARNING("Preparing Lighter 1"); - if (aStack.getItem() instanceof MetaGeneratedGregtechTools) { - Logger.WARNING("Preparing Lighter 2"); - if (ChargingHelper.isItemValid(aStack)) { - Logger.WARNING("Preparing Lighter 3"); - if (aStack.getItem() instanceof IElectricItemManager aItemElec) { - Logger.WARNING("Preparing Lighter 4"); - double aCharge = aItemElec.getCharge(aStack); - long aEuCost = 4096 * 2; - if (aCharge >= aEuCost) { - Logger.WARNING("Preparing Lighter 5"); - aItemElec.discharge(aStack, aEuCost, 3, true, true, false); - return true; - } - } - } - } - } - Logger.WARNING("Preparing Lighter 0"); - return false; - } - - private void useUp(ItemStack aStack) {} - - @Override - public List<String> getAdditionalToolTips(GT_MetaBase_Item aItem, List<String> aList, ItemStack aStack) { - aList.add(this.mTooltip); - int aUses = 0; - if (aStack != null) { - if (aStack.getItem() instanceof MetaGeneratedGregtechTools) { - if (ChargingHelper.isItemValid(aStack)) { - if (aStack.getItem() instanceof IElectricItemManager aItemElec) { - double aCharge = aItemElec.getCharge(aStack); - long aEuCost = 4096 * 2; - aUses = (int) (aCharge / aEuCost); - } - } - boolean aCurrentMode; - if (!NBTUtils.hasTagCompound(aStack)) { - NBTUtils.createEmptyTagCompound(aStack); - } - if (NBTUtils.hasKey(aStack, "aFireballMode")) { - aCurrentMode = NBTUtils.getBoolean(aStack, "aFireballMode"); - } else { - aStack.getTagCompound() - .setBoolean("aFireballMode", false); - aCurrentMode = false; - } - aList.add("Current Mode: " + EnumChatFormatting.RED + (aCurrentMode ? "Projectile" : "Fire Starter")); - } - } - - aList.add(this.mTooltipUses + " " + aUses); - aList.add(this.mTooltipUnstackable); - return aList; - } -} diff --git a/gtpp/src/main/java/gtPlusPlus/xmod/gregtech/common/items/behaviours/Behaviour_Prospecting_Ex.java b/gtpp/src/main/java/gtPlusPlus/xmod/gregtech/common/items/behaviours/Behaviour_Prospecting_Ex.java deleted file mode 100644 index 5749204296..0000000000 --- a/gtpp/src/main/java/gtPlusPlus/xmod/gregtech/common/items/behaviours/Behaviour_Prospecting_Ex.java +++ /dev/null @@ -1,140 +0,0 @@ -package gtPlusPlus.xmod.gregtech.common.items.behaviours; - -import java.util.Random; - -import net.minecraft.block.Block; -import net.minecraft.entity.player.EntityPlayer; -import net.minecraft.init.Blocks; -import net.minecraft.item.ItemStack; -import net.minecraft.tileentity.TileEntity; -import net.minecraft.world.World; -import net.minecraftforge.common.util.ForgeDirection; -import net.minecraftforge.fluids.IFluidBlock; - -import gregtech.api.GregTech_API; -import gregtech.api.enums.Materials; -import gregtech.api.enums.SoundResource; -import gregtech.api.items.GT_MetaBase_Item; -import gregtech.api.items.GT_MetaGenerated_Tool; -import gregtech.api.objects.ItemData; -import gregtech.api.util.GT_ModHandler; -import gregtech.api.util.GT_OreDictUnificator; -import gregtech.api.util.GT_Utility; -import gregtech.common.blocks.GT_Block_Ores; -import gregtech.common.blocks.GT_TileEntity_Ores; -import gregtech.common.items.behaviors.Behaviour_Prospecting; - -public class Behaviour_Prospecting_Ex extends Behaviour_Prospecting { - - private final int mVanillaCosts; - private final int mEUCosts; - - public Behaviour_Prospecting_Ex(final int aVanillaCosts, final int aEUCosts) { - super(aVanillaCosts, aEUCosts); - this.mVanillaCosts = aVanillaCosts; - this.mEUCosts = aEUCosts; - } - - @Override - public boolean onItemUseFirst(final GT_MetaBase_Item aItem, final ItemStack aStack, final EntityPlayer aPlayer, - final World aWorld, final int aX, final int aY, final int aZ, final ForgeDirection side, final float hitX, - final float hitY, final float hitZ) { - if (aWorld.isRemote) { - return false; - } - final Block aBlock = aWorld.getBlock(aX, aY, aZ); - if (aBlock == null) { - return false; - } - final byte aMeta = (byte) aWorld.getBlockMetadata(aX, aY, aZ); - - ItemData tAssotiation = GT_OreDictUnificator.getAssociation(new ItemStack(aBlock, 1, aMeta)); - if ((tAssotiation != null) && (tAssotiation.mPrefix.toString() - .startsWith("ore"))) { - GT_Utility - .sendChatToPlayer(aPlayer, "This is " + tAssotiation.mMaterial.mMaterial.mDefaultLocalName + " Ore."); - GT_Utility.sendSoundToPlayers(aWorld, SoundResource.RANDOM_ANVIL_USE, 1.0F, -1.0F, aX, aY, aZ); - return true; - } - if ((aBlock.isReplaceableOreGen(aWorld, aX, aY, aZ, Blocks.stone)) - || (aBlock.isReplaceableOreGen(aWorld, aX, aY, aZ, GregTech_API.sBlockGranites)) - || (aBlock.isReplaceableOreGen(aWorld, aX, aY, aZ, Blocks.netherrack)) - || (aBlock.isReplaceableOreGen(aWorld, aX, aY, aZ, Blocks.end_stone)) - || (aBlock.isReplaceableOreGen(aWorld, aX, aY, aZ, Blocks.dirt)) - || (aBlock.isReplaceableOreGen(aWorld, aX, aY, aZ, Blocks.grass))) { - if (GT_ModHandler.damageOrDechargeItem(aStack, this.mVanillaCosts, this.mEUCosts, aPlayer)) { - GT_Utility.sendSoundToPlayers(aWorld, SoundResource.RANDOM_ANVIL_USE, 1.0F, -1.0F, aX, aY, aZ); - int tX = aX; - int tY = aY; - int tZ = aZ; - int tMetaID = 0; - final int tQuality = ((aItem instanceof GT_MetaGenerated_Tool) - ? ((GT_MetaGenerated_Tool) aItem).getHarvestLevel(aStack, "") - : 0) * 3; - - int i = 0; - for (final int j = 6 + tQuality; i < j; i++) { - tX -= side.offsetX; - tY -= side.offsetY; - tZ -= side.offsetZ; - - final Block tBlock = aWorld.getBlock(tX, tY, tZ); - if ((tBlock == Blocks.lava) || (tBlock == Blocks.flowing_lava)) { - GT_Utility.sendChatToPlayer(aPlayer, "There is Lava behind this Block."); - break; - } - if ((tBlock == Blocks.water) || (tBlock == Blocks.flowing_water) - || ((tBlock instanceof IFluidBlock))) { - GT_Utility.sendChatToPlayer(aPlayer, "There is a Liquid behind this Block."); - break; - } - if ((tBlock == Blocks.monster_egg) || (!GT_Utility.hasBlockHitBox(aWorld, tX, tY, tZ))) { - GT_Utility.sendChatToPlayer(aPlayer, "There is an Air Pocket behind this Block."); - break; - } - if (tBlock != aBlock) { - if (i >= 4) { - break; - } - GT_Utility.sendChatToPlayer(aPlayer, "Material is changing behind this Block."); - break; - } - } - final Random tRandom = new Random(aX ^ aY ^ aZ ^ side.ordinal()); - i = 0; - for (final int j = 9 + (2 * tQuality); i < j; i++) { - tX = (aX - 4 - tQuality) + tRandom.nextInt(j); - tY = (aY - 4 - tQuality) + tRandom.nextInt(j); - tZ = (aZ - 4 - tQuality) + tRandom.nextInt(j); - final Block tBlock = aWorld.getBlock(tX, tY, tZ); - if ((tBlock instanceof GT_Block_Ores)) { - final TileEntity tTileEntity = aWorld.getTileEntity(tX, tY, tZ); - if ((tTileEntity instanceof GT_TileEntity_Ores)) { - final Materials tMaterial = GregTech_API.sGeneratedMaterials[(((GT_TileEntity_Ores) tTileEntity).mMetaData - % 1000)]; - if ((tMaterial != null) && (tMaterial != Materials._NULL)) { - GT_Utility.sendChatToPlayer( - aPlayer, - "Found traces of " + tMaterial.mDefaultLocalName + " Ore."); - return true; - } - } - } else { - tMetaID = aWorld.getBlockMetadata(tX, tY, tZ); - tAssotiation = GT_OreDictUnificator.getAssociation(new ItemStack(tBlock, 1, tMetaID)); - if ((tAssotiation != null) && (tAssotiation.mPrefix.toString() - .startsWith("ore"))) { - GT_Utility.sendChatToPlayer( - aPlayer, - "Found traces of " + tAssotiation.mMaterial.mMaterial.mDefaultLocalName + " Ore."); - return true; - } - } - } - GT_Utility.sendChatToPlayer(aPlayer, "No Ores found."); - } - return true; - } - return false; - } -} diff --git a/gtpp/src/main/java/gtPlusPlus/xmod/gregtech/common/items/covers/MetaItemCoverCasings.java b/gtpp/src/main/java/gtPlusPlus/xmod/gregtech/common/items/covers/MetaItemCoverCasings.java deleted file mode 100644 index 987924952a..0000000000 --- a/gtpp/src/main/java/gtPlusPlus/xmod/gregtech/common/items/covers/MetaItemCoverCasings.java +++ /dev/null @@ -1,50 +0,0 @@ -package gtPlusPlus.xmod.gregtech.common.items.covers; - -import static gregtech.api.enums.Mods.GTPlusPlus; - -import net.minecraft.client.renderer.texture.IIconRegister; -import net.minecraft.item.ItemStack; -import net.minecraft.util.EnumChatFormatting; -import net.minecraft.util.IIcon; -import net.minecraft.util.StatCollector; - -import gregtech.api.enums.GT_Values; -import gregtech.api.enums.Textures; -import gtPlusPlus.core.util.math.MathUtils; -import gtPlusPlus.xmod.gregtech.common.items.MetaCustomCoverItem; - -public class MetaItemCoverCasings extends MetaCustomCoverItem { - - public MetaItemCoverCasings() { - super( - GTPlusPlus.ID, - Textures.BlockIcons.MACHINECASINGS_SIDE.length, - "Gt Machine Casings", - Textures.BlockIcons.MACHINECASINGS_SIDE, - null); - } - - @Override - public void registerIcons(IIconRegister reg) { - for (int i = 0; i < icons.length; i++) { - this.icons[i] = reg.registerIcon(GTPlusPlus.ID + ":" + "covers/" + i); - } - } - - @Override - public boolean hide() { - return false; - } - - @Override - public IIcon getIconFromDamage(int meta) { - return this.icons[MathUtils.balance(meta, 0, 15)]; - } - - @Override - public String getItemStackDisplayName(final ItemStack tItem) { - return EnumChatFormatting.LIGHT_PURPLE + StatCollector.translateToLocalFormatted( - "item.itemCustomMetaCover.miscutils.GtMachineCasings", - GT_Values.VOLTAGE_NAMES[MathUtils.balance(tItem.getItemDamage(), 0, GT_Values.VOLTAGE_NAMES.length - 1)]); // super.getItemStackDisplayName(tItem); - } -} diff --git a/gtpp/src/main/java/gtPlusPlus/xmod/gregtech/common/render/GTPP_CapeRenderer.java b/gtpp/src/main/java/gtPlusPlus/xmod/gregtech/common/render/GTPP_CapeRenderer.java deleted file mode 100644 index a281a205d2..0000000000 --- a/gtpp/src/main/java/gtPlusPlus/xmod/gregtech/common/render/GTPP_CapeRenderer.java +++ /dev/null @@ -1,500 +0,0 @@ -package gtPlusPlus.xmod.gregtech.common.render; - -import java.io.File; -import java.io.FileOutputStream; -import java.io.IOException; -import java.io.InputStream; -import java.net.URL; -import java.util.Date; -import java.util.List; -import java.util.concurrent.ForkJoinPool; - -import net.minecraft.client.entity.AbstractClientPlayer; -import net.minecraft.client.model.ModelBiped; -import net.minecraft.client.renderer.entity.RenderManager; -import net.minecraft.client.renderer.entity.RenderPlayer; -import net.minecraft.potion.Potion; -import net.minecraft.util.MathHelper; -import net.minecraft.util.ResourceLocation; -import net.minecraftforge.client.event.RenderPlayerEvent; - -import org.apache.commons.io.IOUtils; -import org.lwjgl.opengl.GL11; - -import gregtech.api.util.GT_Utility; -import gtPlusPlus.api.objects.Logger; -import gtPlusPlus.api.objects.data.AutoMap; -import gtPlusPlus.api.objects.data.Pair; -import gtPlusPlus.core.lib.CORE; -import gtPlusPlus.core.lib.CORE.ConfigSwitches; -import gtPlusPlus.core.proxy.ClientProxy; -import gtPlusPlus.core.util.data.AES; -import gtPlusPlus.core.util.data.FileUtils; -import gtPlusPlus.core.util.math.MathUtils; - -public class GTPP_CapeRenderer extends RenderPlayer { - - private static final ResourceLocation[] mCapes = { new ResourceLocation("miscutils:textures/OrangeHD.png"), - new ResourceLocation("miscutils:textures/FancyCapeHD.png"), - new ResourceLocation("miscutils:textures/TesterCapeHD.png"), - new ResourceLocation("miscutils:textures/PatreonCapeHD.png"), - new ResourceLocation("miscutils:textures/DevCapeHD.png"), }; - - private final boolean mInit; - - public GTPP_CapeRenderer() { - mInit = init(); - } - - private boolean init() { - if (mInit) { - return false; - } - return CapeUtils.init(); - } - - private static boolean hasResourceChecked = false; - private static boolean hasSetRenderer = false; - private boolean hasCape = false; - private ResourceLocation tResource = null; - - public synchronized void receiveRenderSpecialsEvent(RenderPlayerEvent.Specials.Pre aEvent) { - - // Check we have set Render Manager - if (this.renderManager == null) { - hasSetRenderer = false; - } - - // Set Render Manager - if (!hasSetRenderer) { - if (RenderManager.instance != null) { - setRenderManager(RenderManager.instance); - hasSetRenderer = true; - } - } - - // Actually Render - if (hasSetRenderer) { - - // We have capes turned off, so let's not render. - if (!ConfigSwitches.enableCustomCapes) { - return; - } - - if (!CapeUtils.mapsPopulated) { - if (!CapeUtils.cacheReady) { - return; - } - CapeUtils.writeCacheToMaps(); - CapeUtils.mapsPopulated = true; - } - - // We have already checked if this player has a cape, but since they do not, we best not render. - if (hasResourceChecked) { - if (!hasCape && !CORE.DEVENV) { - return; - } - } - - // Allocate client player object - AbstractClientPlayer aPlayer = (AbstractClientPlayer) aEvent.entityPlayer; - - // Make sure we don't keep checking on clients who dont have capes. - if (!hasResourceChecked) { - - // Get players UUID - String aPlayerUUID = aPlayer != null ? aPlayer.getGameProfile() - .getId() - .toString() : "BAD"; - - // If for whatever reason this fails, we just exit early. - if (aPlayerUUID.equals("BAD")) { - return; - } - - // Automatically allocate a Dev cape while in Dev mode. - if (tResource == null && CORE.DEVENV) { - tResource = mCapes[4]; - hasCape = true; - } - - String aPlayerName = ClientProxy.playerName; - - // Check cape lists for the cape this player owns. - if (!hasCape) { - for (Pair<String, String> aData : CapeUtils.mOrangeCapes) { - if (aData.getKey() - .equals(aPlayerUUID) || aPlayerName.equals(aData.getValue())) { - tResource = mCapes[0]; - hasCape = true; - break; - } - } - } - if (!hasCape) { - for (Pair<String, String> aData : CapeUtils.mMiscCapes) { - if (aData.getKey() - .equals(aPlayerUUID) || aPlayerName.equals(aData.getValue())) { - tResource = mCapes[1]; - hasCape = true; - break; - } - } - } - if (!hasCape) { - for (Pair<String, String> aData : CapeUtils.mBetaTestCapes) { - if (aData.getKey() - .equals(aPlayerUUID) || aPlayerName.equals(aData.getValue())) { - tResource = mCapes[2]; - hasCape = true; - break; - } - } - } - if (!hasCape) { - for (Pair<String, String> aData : CapeUtils.mPatreonCapes) { - if (aData.getKey() - .equals(aPlayerUUID) || aPlayerName.equals(aData.getValue())) { - tResource = mCapes[3]; - hasCape = true; - break; - } - } - } - if (!hasCape) { - for (Pair<String, String> aData : CapeUtils.mDevCapes) { - if (aData.getKey() - .equals(aPlayerUUID) || aPlayerName.equals(aData.getValue())) { - tResource = mCapes[4]; - hasCape = true; - break; - } - } - } - hasResourceChecked = true; - } - - if (hasResourceChecked) { - // We have met all the conditions, let's render that cape. - renderCapeOnPlayer(aEvent, aPlayer); - } - } - } - - private boolean renderCapeOnPlayer(RenderPlayerEvent.Specials.Pre aEvent, AbstractClientPlayer aPlayer) { - float aPartialTicks = aEvent.partialRenderTick; - try { - if (tResource == null && CORE.DEVENV) { - tResource = mCapes[3]; - } - - // If player is invisible, don't render. - if (GT_Utility.getFullInvisibility(aPlayer) || aPlayer.isInvisible() - || GT_Utility.getPotion(aPlayer, Integer.valueOf(Potion.invisibility.id))) { - aEvent.setCanceled(true); - return false; - } - - if ((tResource != null) && (!aPlayer.getHideCape())) { - bindTexture(tResource); - GL11.glPushMatrix(); - GL11.glTranslatef(0.0F, 0.0F, 0.125F); - double d0 = aPlayer.field_71091_bM + (aPlayer.field_71094_bP - aPlayer.field_71091_bM) * aPartialTicks - - (aPlayer.prevPosX + (aPlayer.posX - aPlayer.prevPosX) * aPartialTicks); - double d1 = aPlayer.field_71096_bN + (aPlayer.field_71095_bQ - aPlayer.field_71096_bN) * aPartialTicks - - (aPlayer.prevPosY + (aPlayer.posY - aPlayer.prevPosY) * aPartialTicks); - double d2 = aPlayer.field_71097_bO + (aPlayer.field_71085_bR - aPlayer.field_71097_bO) * aPartialTicks - - (aPlayer.prevPosZ + (aPlayer.posZ - aPlayer.prevPosZ) * aPartialTicks); - float f6 = aPlayer.prevRenderYawOffset - + (aPlayer.renderYawOffset - aPlayer.prevRenderYawOffset) * aPartialTicks; - double d3 = MathHelper.sin(f6 * CORE.PI / 180.0F); - double d4 = -MathHelper.cos(f6 * CORE.PI / 180.0F); - float f7 = (float) d1 * 10.0F; - float f8 = (float) (d0 * d3 + d2 * d4) * 100.0F; - float f9 = (float) (d0 * d4 - d2 * d3) * 100.0F; - if (f7 < -6.0F) { - f7 = -6.0F; - } - if (f7 > 32.0F) { - f7 = 32.0F; - } - if (f8 < 0.0F) { - f8 = 0.0F; - } - float f10 = aPlayer.prevCameraYaw + (aPlayer.cameraYaw - aPlayer.prevCameraYaw) * aPartialTicks; - f7 += MathHelper.sin( - (aPlayer.prevDistanceWalkedModified - + (aPlayer.distanceWalkedModified - aPlayer.prevDistanceWalkedModified) * aPartialTicks) * 6.0F) - * 32.0F - * f10; - if (aPlayer.isSneaking()) { - f7 += 25.0F; - } - GL11.glRotatef(6.0F + f8 / 2.0F + f7, 1.0F, 0.0F, 0.0F); - GL11.glRotatef(f9 / 2.0F, 0.0F, 0.0F, 1.0F); - GL11.glRotatef(-f9 / 2.0F, 0.0F, 1.0F, 0.0F); - GL11.glRotatef(180.0F, 0.0F, 1.0F, 0.0F); - ((ModelBiped) this.mainModel).renderCloak(0.0625F); - GL11.glPopMatrix(); - return true; - } - } catch (Throwable e) { - - } - return false; - } - - private static class CapeUtils { - - private static char SPLIT_CHARACTER = '§'; - private static AES sAES; - private static volatile boolean cacheReady = false; - private static boolean mapsPopulated = false; - - // UUID - Username - private static final AutoMap<Pair<String, String>> mOrangeCapes = new AutoMap<>(); - private static final AutoMap<Pair<String, String>> mMiscCapes = new AutoMap<>(); - private static final AutoMap<Pair<String, String>> mBetaTestCapes = new AutoMap<>(); - private static final AutoMap<Pair<String, String>> mPatreonCapes = new AutoMap<>(); - private static final AutoMap<Pair<String, String>> mDevCapes = new AutoMap<>(); - - private static boolean init() { - CapeUtils.handleOldCapeCache(); - if (CORE.DEVENV) { - return true; - } - ForkJoinPool.commonPool() - .execute(() -> { - try { - if (shouldDownloadCapeList()) { - downloadCapeList(); - } - } catch (Exception ignored) {} - cacheReady = true; - }); - return true; - } - - private static boolean shouldDownloadCapeList() { - if (!doesCapeCacheExistLocally()) { - return true; - } - if (isCapeCacheWeekOld()) { - return true; - } - return false; - } - - private static boolean isCapeCacheWeekOld() { - if (!doesCapeCacheExistLocally()) { - return true; - } else { - File dat = CapeUtils.getCapeCache(); - Date dateLastMod = new Date(dat.lastModified()); - Date dateNow = new Date(System.currentTimeMillis() - (7l * 24 * 60 * 60 * 1000)); - if (dateLastMod.before(dateNow)) { - return true; - } - } - return false; - } - - private static void downloadCapeList() { - try { - File dat = getCapeCache(); - File temp = allocateTempFile(); - InputStream inputStream = new URL("https://alkcorp.overminddl1.com/CapeCache.dat").openStream(); - FileOutputStream fileOS = new FileOutputStream(temp); - IOUtils.copy(inputStream, fileOS); - if (isDownloadedCapeListBigger(temp)) { - fileOS = new FileOutputStream(dat); - IOUtils.copy(inputStream, fileOS); - } - } catch (Throwable t) { - Logger.INFO("Unable to download GT++ cape list."); - } - } - - private static boolean isDownloadedCapeListBigger(File aFile) { - double aExistingFileSize = (doesCapeCacheExistLocally() ? getCapeCache().length() : 0); - double aNewFileSize = aFile.length(); - if (aNewFileSize > aExistingFileSize) { - return true; - } - return false; - } - - private static void handleOldCapeCache() { - File aCacheFile = FileUtils.getFile("GTPP", "dat"); - if (FileUtils.doesFileExist(aCacheFile)) { - aCacheFile.delete(); - } - } - - private static boolean doesCapeCacheExistLocally() { - File aCacheFile = FileUtils.getFile("CapeCache", "dat"); - if (FileUtils.doesFileExist(aCacheFile)) { - return true; - } - return false; - } - - private static File getCapeCache() { - File aCacheFile = FileUtils.getFile("CapeCache", "dat"); - if (FileUtils.doesFileExist(aCacheFile)) { - FileUtils.createFile(aCacheFile); - } - return aCacheFile; - } - - public static final List<String> getDataFromCache() { - File aCacheFile = getCapeCache(); - List<String> aCache = FileUtils.readLines(aCacheFile); - if (aCache != null && !aCache.isEmpty()) { - return aCache; - } - return new AutoMap<>(); - } - - private static File allocateTempFile() { - File tempFile = null; - try { - tempFile = File.createTempFile("gtpp-", null); - } catch (IOException e) { - e.printStackTrace(); - } - if (tempFile == null) { - tempFile = FileUtils - .createFile("", "gtpp-" + MathUtils.randInt(Short.MAX_VALUE, (Integer.MAX_VALUE / 2)), "tmp"); - } - tempFile.deleteOnExit(); - return tempFile; - } - - public static final void writeCacheToMaps() { - List<String> aCacheData = getDataFromCache(); - if (aCacheData != null && !aCacheData.isEmpty()) { - if (sAES == null) { - sAES = new AES(); - } - AutoMap<String> aDecodedData = new AutoMap<>(); - for (String aToDecode : aCacheData) { - aDecodedData.put(sAES.decode(aToDecode)); - } - if (!aDecodedData.isEmpty()) { - AutoMap<Pair<String, String>> aCapeType1 = new AutoMap<>(); - AutoMap<Pair<String, String>> aCapeType2 = new AutoMap<>(); - AutoMap<Pair<String, String>> aCapeType3 = new AutoMap<>(); - AutoMap<Pair<String, String>> aCapeType4 = new AutoMap<>(); - AutoMap<Pair<String, String>> aCapeType5 = new AutoMap<>(); - boolean didProcessStringData = false; - Logger.INFO("Decoded String Count: " + aDecodedData.size()); - for (String aToSplit : aDecodedData) { - String[] aSplitData = aToSplit.split("" + SPLIT_CHARACTER); - if (aSplitData != null && aSplitData.length >= 2) { - if (aSplitData[0] != null) { - Integer aCapeTypeID2 = Integer.parseInt(aSplitData[0]); - if (aCapeTypeID2 != null) { - int aCapeTypeID = aCapeTypeID2; - Pair<String, String> aFinalString = new Pair<>( - "UUID: " + aSplitData[1], - "Username: " - + (aSplitData[2] != null && aSplitData[0].length() > 0 ? aSplitData[2] - : "Not Specified")); - Logger.INFO("Cape Type: " + aCapeTypeID); - switch (aCapeTypeID) { - case 0 -> { - aCapeType1.add(aFinalString); - Logger.INFO( - "Added user to map " + aCapeTypeID - + ", map now holds " - + aCapeType1.size() - + " users."); - } - case 1 -> { - aCapeType2.add(aFinalString); - Logger.INFO( - "Added user to map " + aCapeTypeID - + ", map now holds " - + aCapeType2.size() - + " users."); - } - case 2 -> { - aCapeType3.add(aFinalString); - Logger.INFO( - "Added user to map " + aCapeTypeID - + ", map now holds " - + aCapeType3.size() - + " users."); - } - case 3 -> { - aCapeType4.add(aFinalString); - Logger.INFO( - "Added user to map " + aCapeTypeID - + ", map now holds " - + aCapeType4.size() - + " users."); - } - case 4 -> { - aCapeType5.add(aFinalString); - Logger.INFO( - "Added user to map " + aCapeTypeID - + ", map now holds " - + aCapeType5.size() - + " users."); - } - default -> {} - } - } - } - } - } - if (!aCapeType1.isEmpty() || !aCapeType2.isEmpty() - || !aCapeType3.isEmpty() - || !aCapeType4.isEmpty() - || !aCapeType5.isEmpty()) { - didProcessStringData = true; - } else { - // did not process any data - } - if (didProcessStringData) { - if (!aCapeType1.isEmpty()) { - for (Pair<String, String> aUser : aCapeType1) { - Logger.INFO("Adding Generic cape for " + aUser.getKey()); - mOrangeCapes.add(aUser); - } - } - if (!aCapeType2.isEmpty()) { - for (Pair<String, String> aUser : aCapeType2) { - Logger.INFO("Adding Blue cape for " + aUser.getKey()); - mMiscCapes.add(aUser); - } - } - if (!aCapeType3.isEmpty()) { - for (Pair<String, String> aUser : aCapeType3) { - Logger.INFO("Adding Beta cape for " + aUser.getKey()); - mBetaTestCapes.add(aUser); - } - } - if (!aCapeType4.isEmpty()) { - for (Pair<String, String> aUser : aCapeType4) { - Logger.INFO("Adding Patreon cape for " + aUser.getKey()); - mPatreonCapes.add(aUser); - } - } - if (!aCapeType5.isEmpty()) { - for (Pair<String, String> aUser : aCapeType5) { - Logger.INFO("Adding Dev cape for " + aUser.getKey()); - mDevCapes.add(aUser); - } - } - } - } else { - // No data decoded - } - } else { - // Nothing was cached? - } - } - } -} diff --git a/gtpp/src/main/java/gtPlusPlus/xmod/gregtech/common/render/GTPP_FlaskRenderer.java b/gtpp/src/main/java/gtPlusPlus/xmod/gregtech/common/render/GTPP_FlaskRenderer.java deleted file mode 100644 index 0c9e59e2f2..0000000000 --- a/gtpp/src/main/java/gtPlusPlus/xmod/gregtech/common/render/GTPP_FlaskRenderer.java +++ /dev/null @@ -1,107 +0,0 @@ -package gtPlusPlus.xmod.gregtech.common.render; - -import net.minecraft.client.Minecraft; -import net.minecraft.client.renderer.ItemRenderer; -import net.minecraft.client.renderer.Tessellator; -import net.minecraft.client.renderer.texture.TextureMap; -import net.minecraft.item.ItemStack; -import net.minecraft.util.IIcon; -import net.minecraftforge.client.IItemRenderer; -import net.minecraftforge.client.MinecraftForgeClient; -import net.minecraftforge.fluids.FluidStack; - -import org.lwjgl.opengl.GL11; - -import cpw.mods.fml.relauncher.SideOnly; -import gregtech.common.items.GT_VolumetricFlask; -import gtPlusPlus.xmod.gregtech.api.enums.GregtechItemList; -import ic2.core.util.DrawUtil; - -@SideOnly(cpw.mods.fml.relauncher.Side.CLIENT) -public final class GTPP_FlaskRenderer implements net.minecraftforge.client.IItemRenderer { - - public GTPP_FlaskRenderer() { - MinecraftForgeClient.registerItemRenderer(GregtechItemList.VOLUMETRIC_FLASK_8k.getItem(), this); - MinecraftForgeClient.registerItemRenderer(GregtechItemList.VOLUMETRIC_FLASK_32k.getItem(), this); - } - - @Override - public boolean handleRenderType(ItemStack item, ItemRenderType type) { - return type != ItemRenderType.FIRST_PERSON_MAP; - } - - @Override - public boolean shouldUseRenderHelper(ItemRenderType type, ItemStack item, IItemRenderer.ItemRendererHelper helper) { - return type == ItemRenderType.ENTITY; - } - - @Override - public void renderItem(ItemRenderType type, ItemStack item, Object... data) { - GT_VolumetricFlask cell = (GT_VolumetricFlask) item.getItem(); - - int aType = cell.getMaxCapacity() == 8000 ? 0 : 1; - IIcon icon = item.getIconIndex(); - GL11.glEnable(3042); - GL11.glEnable(3008); - if (type.equals(ItemRenderType.ENTITY)) { - GL11.glRotated(180.0D, 0.0D, 0.0D, 1.0D); - GL11.glRotated(90.0D, 0.0D, 1.0D, 0.0D); - GL11.glTranslated(-0.5D, -0.6D, 0.0D); - } else if (type.equals(ItemRenderType.EQUIPPED_FIRST_PERSON)) { - GL11.glTranslated(1.0D, 1.0D, 0.0D); - GL11.glRotated(180.0D, 0.0D, 0.0D, 1.0D); - } else if (type.equals(ItemRenderType.EQUIPPED)) { - GL11.glRotated(180.0D, 0.0D, 0.0D, 1.0D); - GL11.glTranslated(-1.0D, -1.0D, 0.0D); - } - - FluidStack fs = cell.getFluid(item); - if (fs != null) { - IIcon iconWindow = cell.iconWindow; - IIcon fluidicon = fs.getFluid() - .getIcon(fs); - int fluidColor = fs.getFluid() - .getColor(fs); - Minecraft.getMinecraft().renderEngine.bindTexture(TextureMap.locationItemsTexture); - GL11.glBlendFunc(0, 1); - if (type.equals(ItemRenderType.INVENTORY)) { - DrawUtil.renderIcon(iconWindow, 16.0D, 0.0D, 0.0F, 0.0F, -1.0F); - } else { - DrawUtil.renderIcon(iconWindow, 1.0D, -0.001D, 0.0F, 0.0F, 1.0F); - DrawUtil.renderIcon(iconWindow, 1.0D, -0.0615D, 0.0F, 0.0F, -1.0F); - } - - Minecraft.getMinecraft().renderEngine.bindTexture(TextureMap.locationBlocksTexture); - GL11.glBlendFunc(770, 771); - GL11.glDepthFunc(514); - GL11.glColor3ub((byte) (fluidColor >> 16), (byte) (fluidColor >> 8), (byte) fluidColor); - if (type.equals(ItemRenderType.INVENTORY)) { - DrawUtil.renderIcon(fluidicon, 16.0D, 0.0D, 0.0F, 0.0F, -1.0F); - } else { - DrawUtil.renderIcon(fluidicon, 1.0D, -0.001D, 0.0F, 0.0F, 1.0F); - DrawUtil.renderIcon(fluidicon, 1.0D, -0.0615D, 0.0F, 0.0F, -1.0F); - } - - GL11.glColor3ub((byte) -1, (byte) -1, (byte) -1); - GL11.glDepthFunc(515); - } - - Minecraft.getMinecraft().renderEngine.bindTexture(TextureMap.locationItemsTexture); - GL11.glBlendFunc(770, 771); - if (type.equals(ItemRenderType.INVENTORY)) { - DrawUtil.renderIcon(icon, 16.0D, 0.001D, 0.0F, 0.0F, -1.0F); - } else { - ItemRenderer.renderItemIn2D( - Tessellator.instance, - icon.getMaxU(), - icon.getMinV(), - icon.getMinU(), - icon.getMaxV(), - icon.getIconWidth(), - icon.getIconHeight(), - 0.0625F); - } - GL11.glDisable(3008); - GL11.glDisable(3042); - } -} diff --git a/gtpp/src/main/java/gtPlusPlus/xmod/gregtech/common/render/GTPP_Render_MachineBlock.java b/gtpp/src/main/java/gtPlusPlus/xmod/gregtech/common/render/GTPP_Render_MachineBlock.java deleted file mode 100644 index bfd16b4cc5..0000000000 --- a/gtpp/src/main/java/gtPlusPlus/xmod/gregtech/common/render/GTPP_Render_MachineBlock.java +++ /dev/null @@ -1,1250 +0,0 @@ -package gtPlusPlus.xmod.gregtech.common.render; - -import static gregtech.api.interfaces.metatileentity.IConnectable.CONNECTED_DOWN; -import static gregtech.api.interfaces.metatileentity.IConnectable.CONNECTED_EAST; -import static gregtech.api.interfaces.metatileentity.IConnectable.CONNECTED_NORTH; -import static gregtech.api.interfaces.metatileentity.IConnectable.CONNECTED_SOUTH; -import static gregtech.api.interfaces.metatileentity.IConnectable.CONNECTED_UP; -import static gregtech.api.interfaces.metatileentity.IConnectable.CONNECTED_WEST; -import static gregtech.api.interfaces.metatileentity.IConnectable.HAS_FOAM; -import static gregtech.api.interfaces.metatileentity.IConnectable.NO_CONNECTION; -import static net.minecraftforge.common.util.ForgeDirection.DOWN; -import static net.minecraftforge.common.util.ForgeDirection.EAST; -import static net.minecraftforge.common.util.ForgeDirection.NORTH; -import static net.minecraftforge.common.util.ForgeDirection.SOUTH; -import static net.minecraftforge.common.util.ForgeDirection.UP; -import static net.minecraftforge.common.util.ForgeDirection.WEST; - -import java.util.EnumMap; -import java.util.EnumSet; - -import net.minecraft.block.Block; -import net.minecraft.client.renderer.RenderBlocks; -import net.minecraft.client.renderer.Tessellator; -import net.minecraft.tileentity.TileEntity; -import net.minecraft.world.IBlockAccess; -import net.minecraftforge.common.util.ForgeDirection; - -import org.lwjgl.opengl.GL11; - -import cpw.mods.fml.client.registry.RenderingRegistry; -import gregtech.api.GregTech_API; -import gregtech.api.interfaces.ITexture; -import gregtech.api.interfaces.metatileentity.IMetaTileEntity; -import gregtech.api.interfaces.tileentity.IGregTechTileEntity; -import gregtech.api.interfaces.tileentity.IPipeRenderedTileEntity; -import gregtech.api.interfaces.tileentity.ITexturedTileEntity; -import gregtech.api.metatileentity.MetaPipeEntity; -import gregtech.common.blocks.GT_Block_Machines; -import gregtech.common.render.GT_Renderer_Block; -import gtPlusPlus.xmod.gregtech.common.helpers.GT_MethodHelper; - -public class GTPP_Render_MachineBlock extends GT_Renderer_Block { - - public static GTPP_Render_MachineBlock INSTANCE; - public final int mRenderID = RenderingRegistry.getNextAvailableRenderId(); - - public GTPP_Render_MachineBlock() { - INSTANCE = this; - RenderingRegistry.registerBlockHandler(this); - } - - private static ITexture[] getTexture(IMetaTileEntity tile, ForgeDirection side, ForgeDirection facing, - int colorIndex, boolean active, boolean arg5) { - final IGregTechTileEntity gtTile = tile.getBaseMetaTileEntity(); - return tile.getTexture(gtTile, side, facing, (byte) colorIndex, active, arg5); - } - - private static ITexture[] getTexture(IMetaTileEntity tile, ForgeDirection side, int facingMask, int colorIndex, - boolean active, boolean arg5) { - final MetaPipeEntity gtTile = (MetaPipeEntity) tile.getBaseMetaTileEntity(); - return gtTile.getTexture((IGregTechTileEntity) tile, side, facingMask, colorIndex, active, arg5); - } - - private static void renderNormalInventoryMetaTileEntity(Block aBlock, int aMeta, RenderBlocks aRenderer) { - if (aMeta > 0 && aMeta < GregTech_API.METATILEENTITIES.length) { - IMetaTileEntity tMetaTileEntity = GregTech_API.METATILEENTITIES[aMeta]; - if (tMetaTileEntity != null) { - aBlock.setBlockBoundsForItemRender(); - aRenderer.setRenderBoundsFromBlock(aBlock); - GL11.glRotatef(90.0F, 0.0F, 1.0F, 0.0F); - GL11.glTranslatef(-0.5F, -0.5F, -0.5F); - if (tMetaTileEntity.getBaseMetaTileEntity() instanceof IPipeRenderedTileEntity pipeRenderedTile) { - float tThickness = pipeRenderedTile.getThickNess(); - float sp = (1.0F - tThickness) / 2.0F; - aBlock.setBlockBounds(0.0F, sp, sp, 1.0F, sp + tThickness, sp + tThickness); - aRenderer.setRenderBoundsFromBlock(aBlock); - Tessellator.instance.startDrawingQuads(); - Tessellator.instance.setNormal(0.0F, -1.0F, 0.0F); - renderNegativeYFacing( - null, - aRenderer, - aBlock, - 0, - 0, - 0, - getTexture(tMetaTileEntity, DOWN, 0b001001, -1, false, false), - true); - Tessellator.instance.draw(); - Tessellator.instance.startDrawingQuads(); - Tessellator.instance.setNormal(0.0F, 1.0F, 0.0F); - renderPositiveYFacing( - null, - aRenderer, - aBlock, - 0, - 0, - 0, - getTexture(tMetaTileEntity, UP, 0b001001, -1, false, false), - true); - Tessellator.instance.draw(); - Tessellator.instance.startDrawingQuads(); - Tessellator.instance.setNormal(0.0F, 0.0F, -1.0F); - renderNegativeZFacing( - null, - aRenderer, - aBlock, - 0, - 0, - 0, - getTexture(tMetaTileEntity, ForgeDirection.NORTH, 0b001001, -1, false, false), - true); - Tessellator.instance.draw(); - Tessellator.instance.startDrawingQuads(); - Tessellator.instance.setNormal(0.0F, 0.0F, 1.0F); - renderPositiveZFacing( - null, - aRenderer, - aBlock, - 0, - 0, - 0, - getTexture(tMetaTileEntity, ForgeDirection.SOUTH, 0b001001, -1, false, false), - true); - Tessellator.instance.draw(); - Tessellator.instance.startDrawingQuads(); - Tessellator.instance.setNormal(-1.0F, 0.0F, 0.0F); - renderNegativeXFacing( - null, - aRenderer, - aBlock, - 0, - 0, - 0, - getTexture(tMetaTileEntity, ForgeDirection.WEST, 0b001001, -1, true, false), - true); - Tessellator.instance.draw(); - Tessellator.instance.startDrawingQuads(); - Tessellator.instance.setNormal(1.0F, 0.0F, 0.0F); - renderPositiveXFacing( - null, - aRenderer, - aBlock, - 0, - 0, - 0, - getTexture(tMetaTileEntity, ForgeDirection.EAST, 0b001001, -1, true, false), - true); - Tessellator.instance.draw(); - } else { - Tessellator.instance.startDrawingQuads(); - Tessellator.instance.setNormal(0.0F, -1.0F, 0.0F); - renderNegativeYFacing( - null, - aRenderer, - aBlock, - 0, - 0, - 0, - getTexture(tMetaTileEntity, DOWN, ForgeDirection.WEST, -1, true, false), - true); - Tessellator.instance.draw(); - Tessellator.instance.startDrawingQuads(); - Tessellator.instance.setNormal(0.0F, 1.0F, 0.0F); - renderPositiveYFacing( - null, - aRenderer, - aBlock, - 0, - 0, - 0, - getTexture(tMetaTileEntity, UP, ForgeDirection.WEST, -1, true, false), - true); - Tessellator.instance.draw(); - Tessellator.instance.startDrawingQuads(); - Tessellator.instance.setNormal(0.0F, 0.0F, -1.0F); - renderNegativeZFacing( - null, - aRenderer, - aBlock, - 0, - 0, - 0, - getTexture(tMetaTileEntity, ForgeDirection.NORTH, ForgeDirection.WEST, -1, true, false), - true); - Tessellator.instance.draw(); - Tessellator.instance.startDrawingQuads(); - Tessellator.instance.setNormal(0.0F, 0.0F, 1.0F); - renderPositiveZFacing( - null, - aRenderer, - aBlock, - 0, - 0, - 0, - getTexture(tMetaTileEntity, ForgeDirection.SOUTH, ForgeDirection.WEST, -1, true, false), - true); - Tessellator.instance.draw(); - Tessellator.instance.startDrawingQuads(); - Tessellator.instance.setNormal(-1.0F, 0.0F, 0.0F); - renderNegativeXFacing( - null, - aRenderer, - aBlock, - 0, - 0, - 0, - getTexture(tMetaTileEntity, ForgeDirection.WEST, ForgeDirection.WEST, -1, true, false), - true); - Tessellator.instance.draw(); - Tessellator.instance.startDrawingQuads(); - Tessellator.instance.setNormal(1.0F, 0.0F, 0.0F); - renderPositiveXFacing( - null, - aRenderer, - aBlock, - 0, - 0, - 0, - getTexture(tMetaTileEntity, ForgeDirection.EAST, ForgeDirection.WEST, -1, true, false), - true); - Tessellator.instance.draw(); - } - - aBlock.setBlockBounds(0.0F, 0.0F, 0.0F, 1.0F, 1.0F, 1.0F); - aRenderer.setRenderBoundsFromBlock(aBlock); - GL11.glTranslatef(0.5F, 0.5F, 0.5F); - } - } - } - - public boolean renderStandardBlock(IBlockAccess aWorld, int aX, int aY, int aZ, Block aBlock, - RenderBlocks aRenderer) { - TileEntity tTileEntity = aWorld.getTileEntity(aX, aY, aZ); - - return tTileEntity instanceof ITexturedTileEntity - ? renderStandardBlock( - aWorld, - aX, - aY, - aZ, - aBlock, - aRenderer, - new ITexture[][] { GT_MethodHelper.getTexture(tTileEntity, aBlock, DOWN), - GT_MethodHelper.getTexture(tTileEntity, aBlock, UP), - GT_MethodHelper.getTexture(tTileEntity, aBlock, ForgeDirection.NORTH), - GT_MethodHelper.getTexture(tTileEntity, aBlock, ForgeDirection.SOUTH), - GT_MethodHelper.getTexture(tTileEntity, aBlock, ForgeDirection.WEST), - GT_MethodHelper.getTexture(tTileEntity, aBlock, ForgeDirection.EAST) }) - : false; - } - - public boolean renderStandardBlock(IBlockAccess aWorld, int aX, int aY, int aZ, Block aBlock, - RenderBlocks aRenderer, ITexture[][] aTextures) { - aBlock.setBlockBounds(0.0F, 0.0F, 0.0F, 1.0F, 1.0F, 1.0F); - aRenderer.setRenderBoundsFromBlock(aBlock); - renderNegativeYFacing(aWorld, aRenderer, aBlock, aX, aY, aZ, aTextures[DOWN.ordinal()], true); - renderPositiveYFacing(aWorld, aRenderer, aBlock, aX, aY, aZ, aTextures[UP.ordinal()], true); - renderNegativeZFacing(aWorld, aRenderer, aBlock, aX, aY, aZ, aTextures[ForgeDirection.NORTH.ordinal()], true); - renderPositiveZFacing(aWorld, aRenderer, aBlock, aX, aY, aZ, aTextures[ForgeDirection.SOUTH.ordinal()], true); - renderNegativeXFacing(aWorld, aRenderer, aBlock, aX, aY, aZ, aTextures[ForgeDirection.WEST.ordinal()], true); - renderPositiveXFacing(aWorld, aRenderer, aBlock, aX, aY, aZ, aTextures[ForgeDirection.EAST.ordinal()], true); - return true; - } - - public boolean renderPipeBlock(IBlockAccess aWorld, int aX, int aY, int aZ, Block aBlock, - IPipeRenderedTileEntity aTileEntity, RenderBlocks aRenderer) { - final int aConnections = aTileEntity.getConnections(); - if ((aConnections & HAS_FOAM) != 0) { - return renderStandardBlock(aWorld, aX, aY, aZ, aBlock, aRenderer); - } else { - float tThickness = aTileEntity.getThickNess(); - if (tThickness >= 0.99F) { - return renderStandardBlock(aWorld, aX, aY, aZ, aBlock, aRenderer); - } else { - float sp = (1.0F - tThickness) / 2.0F; - int connexionSidesBits = 0; - - for (int ordinalSide = 0; ordinalSide < 6; ++ordinalSide) { - if ((aConnections & 1 << ordinalSide) != 0) { - connexionSidesBits = connexionSidesBits | 1 << (ordinalSide + 2) % 6; - } - } - - final EnumSet<ForgeDirection> coveredSides = EnumSet.noneOf(ForgeDirection.class); - - for (final ForgeDirection side : ForgeDirection.VALID_DIRECTIONS) { - if (aTileEntity.getCoverIDAtSide(side) != 0) coveredSides.add(side); - } - - if (coveredSides.containsAll(EnumSet.of(DOWN, UP, NORTH, SOUTH, WEST, EAST))) { - return renderStandardBlock(aWorld, aX, aY, aZ, aBlock, aRenderer); - } else { - final EnumMap<ForgeDirection, ITexture[]> texture = new EnumMap<>(ForgeDirection.class); - final EnumMap<ForgeDirection, ITexture[]> textureUncovered = new EnumMap<>(ForgeDirection.class); - - for (final ForgeDirection side : ForgeDirection.VALID_DIRECTIONS) { - texture.put(side, GT_MethodHelper.getTexture((TileEntity) aTileEntity, aBlock, side)); - textureUncovered.put(side, aTileEntity.getTextureUncovered(side)); - } - - switch (connexionSidesBits) { - case NO_CONNECTION -> { - aBlock.setBlockBounds(sp, sp, sp, sp + tThickness, sp + tThickness, sp + tThickness); - aRenderer.setRenderBoundsFromBlock(aBlock); - renderNegativeYFacing( - aWorld, - aRenderer, - aBlock, - aX, - aY, - aZ, - textureUncovered.get(DOWN), - false); - renderPositiveYFacing( - aWorld, - aRenderer, - aBlock, - aX, - aY, - aZ, - textureUncovered.get(UP), - false); - renderNegativeZFacing( - aWorld, - aRenderer, - aBlock, - aX, - aY, - aZ, - textureUncovered.get(NORTH), - false); - renderPositiveZFacing( - aWorld, - aRenderer, - aBlock, - aX, - aY, - aZ, - textureUncovered.get(SOUTH), - false); - renderNegativeXFacing( - aWorld, - aRenderer, - aBlock, - aX, - aY, - aZ, - textureUncovered.get(WEST), - false); - renderPositiveXFacing( - aWorld, - aRenderer, - aBlock, - aX, - aY, - aZ, - textureUncovered.get(EAST), - false); - } - case (CONNECTED_DOWN | CONNECTED_UP) -> { - aBlock.setBlockBounds(0.0F, sp, sp, 1.0F, sp + tThickness, sp + tThickness); - aRenderer.setRenderBoundsFromBlock(aBlock); - renderNegativeYFacing( - aWorld, - aRenderer, - aBlock, - aX, - aY, - aZ, - textureUncovered.get(DOWN), - false); - renderPositiveYFacing( - aWorld, - aRenderer, - aBlock, - aX, - aY, - aZ, - textureUncovered.get(UP), - false); - renderNegativeZFacing( - aWorld, - aRenderer, - aBlock, - aX, - aY, - aZ, - textureUncovered.get(NORTH), - false); - renderPositiveZFacing( - aWorld, - aRenderer, - aBlock, - aX, - aY, - aZ, - textureUncovered.get(SOUTH), - false); - if (!coveredSides.contains(WEST)) { - renderNegativeXFacing( - aWorld, - aRenderer, - aBlock, - aX, - aY, - aZ, - textureUncovered.get(WEST), - false); - } - if (!coveredSides.contains(EAST)) { - renderPositiveXFacing( - aWorld, - aRenderer, - aBlock, - aX, - aY, - aZ, - textureUncovered.get(EAST), - false); - } - } - case (CONNECTED_NORTH | CONNECTED_SOUTH) -> { - aBlock.setBlockBounds(sp, 0.0F, sp, sp + tThickness, 1.0F, sp + tThickness); - aRenderer.setRenderBoundsFromBlock(aBlock); - renderNegativeZFacing( - aWorld, - aRenderer, - aBlock, - aX, - aY, - aZ, - textureUncovered.get(NORTH), - false); - renderPositiveZFacing( - aWorld, - aRenderer, - aBlock, - aX, - aY, - aZ, - textureUncovered.get(SOUTH), - false); - renderNegativeXFacing( - aWorld, - aRenderer, - aBlock, - aX, - aY, - aZ, - textureUncovered.get(WEST), - false); - renderPositiveXFacing( - aWorld, - aRenderer, - aBlock, - aX, - aY, - aZ, - textureUncovered.get(EAST), - false); - if (!coveredSides.contains(DOWN)) { - renderNegativeYFacing( - aWorld, - aRenderer, - aBlock, - aX, - aY, - aZ, - textureUncovered.get(DOWN), - false); - } - if (!coveredSides.contains(UP)) { - renderPositiveYFacing( - aWorld, - aRenderer, - aBlock, - aX, - aY, - aZ, - textureUncovered.get(UP), - false); - } - } - case (CONNECTED_WEST | CONNECTED_EAST) -> { - aBlock.setBlockBounds(sp, sp, 0.0F, sp + tThickness, sp + tThickness, 1.0F); - aRenderer.setRenderBoundsFromBlock(aBlock); - renderNegativeYFacing( - aWorld, - aRenderer, - aBlock, - aX, - aY, - aZ, - textureUncovered.get(DOWN), - false); - renderPositiveYFacing( - aWorld, - aRenderer, - aBlock, - aX, - aY, - aZ, - textureUncovered.get(UP), - false); - renderNegativeXFacing( - aWorld, - aRenderer, - aBlock, - aX, - aY, - aZ, - textureUncovered.get(WEST), - false); - renderPositiveXFacing( - aWorld, - aRenderer, - aBlock, - aX, - aY, - aZ, - textureUncovered.get(EAST), - false); - if (!coveredSides.contains(NORTH)) { - renderNegativeZFacing( - aWorld, - aRenderer, - aBlock, - aX, - aY, - aZ, - textureUncovered.get(NORTH), - false); - } - if (!coveredSides.contains(SOUTH)) { - renderPositiveZFacing( - aWorld, - aRenderer, - aBlock, - aX, - aY, - aZ, - textureUncovered.get(SOUTH), - false); - } - } - default -> { - if ((connexionSidesBits & CONNECTED_DOWN) == 0) { - aBlock.setBlockBounds(sp, sp, sp, sp + tThickness, sp + tThickness, sp + tThickness); - aRenderer.setRenderBoundsFromBlock(aBlock); - renderNegativeXFacing( - aWorld, - aRenderer, - aBlock, - aX, - aY, - aZ, - textureUncovered.get(WEST), - false); - } else { - aBlock.setBlockBounds(0.0F, sp, sp, sp, sp + tThickness, sp + tThickness); - aRenderer.setRenderBoundsFromBlock(aBlock); - renderNegativeYFacing( - aWorld, - aRenderer, - aBlock, - aX, - aY, - aZ, - textureUncovered.get(DOWN), - false); - renderPositiveYFacing( - aWorld, - aRenderer, - aBlock, - aX, - aY, - aZ, - textureUncovered.get(UP), - false); - renderNegativeZFacing( - aWorld, - aRenderer, - aBlock, - aX, - aY, - aZ, - textureUncovered.get(NORTH), - false); - renderPositiveZFacing( - aWorld, - aRenderer, - aBlock, - aX, - aY, - aZ, - textureUncovered.get(SOUTH), - false); - if (!coveredSides.contains(WEST)) { - renderNegativeXFacing( - aWorld, - aRenderer, - aBlock, - aX, - aY, - aZ, - textureUncovered.get(WEST), - false); - } - } - if ((connexionSidesBits & CONNECTED_UP) == 0) { - aBlock.setBlockBounds(sp, sp, sp, sp + tThickness, sp + tThickness, sp + tThickness); - aRenderer.setRenderBoundsFromBlock(aBlock); - renderPositiveXFacing( - aWorld, - aRenderer, - aBlock, - aX, - aY, - aZ, - textureUncovered.get(EAST), - false); - } else { - aBlock.setBlockBounds(sp + tThickness, sp, sp, 1.0F, sp + tThickness, sp + tThickness); - aRenderer.setRenderBoundsFromBlock(aBlock); - renderNegativeYFacing( - aWorld, - aRenderer, - aBlock, - aX, - aY, - aZ, - textureUncovered.get(DOWN), - false); - renderPositiveYFacing( - aWorld, - aRenderer, - aBlock, - aX, - aY, - aZ, - textureUncovered.get(UP), - false); - renderNegativeZFacing( - aWorld, - aRenderer, - aBlock, - aX, - aY, - aZ, - textureUncovered.get(NORTH), - false); - renderPositiveZFacing( - aWorld, - aRenderer, - aBlock, - aX, - aY, - aZ, - textureUncovered.get(SOUTH), - false); - if (!coveredSides.contains(EAST)) { - renderPositiveXFacing( - aWorld, - aRenderer, - aBlock, - aX, - aY, - aZ, - textureUncovered.get(EAST), - false); - } - } - if ((connexionSidesBits & CONNECTED_NORTH) == 0) { - aBlock.setBlockBounds(sp, sp, sp, sp + tThickness, sp + tThickness, sp + tThickness); - aRenderer.setRenderBoundsFromBlock(aBlock); - renderNegativeYFacing( - aWorld, - aRenderer, - aBlock, - aX, - aY, - aZ, - textureUncovered.get(DOWN), - false); - } else { - aBlock.setBlockBounds(sp, 0.0F, sp, sp + tThickness, sp, sp + tThickness); - aRenderer.setRenderBoundsFromBlock(aBlock); - renderNegativeZFacing( - aWorld, - aRenderer, - aBlock, - aX, - aY, - aZ, - textureUncovered.get(NORTH), - false); - renderPositiveZFacing( - aWorld, - aRenderer, - aBlock, - aX, - aY, - aZ, - textureUncovered.get(SOUTH), - false); - renderNegativeXFacing( - aWorld, - aRenderer, - aBlock, - aX, - aY, - aZ, - textureUncovered.get(WEST), - false); - renderPositiveXFacing( - aWorld, - aRenderer, - aBlock, - aX, - aY, - aZ, - textureUncovered.get(EAST), - false); - if (!coveredSides.contains(DOWN)) { - renderNegativeYFacing( - aWorld, - aRenderer, - aBlock, - aX, - aY, - aZ, - textureUncovered.get(DOWN), - false); - } - } - if ((connexionSidesBits & CONNECTED_SOUTH) == 0) { - aBlock.setBlockBounds(sp, sp, sp, sp + tThickness, sp + tThickness, sp + tThickness); - aRenderer.setRenderBoundsFromBlock(aBlock); - renderPositiveYFacing( - aWorld, - aRenderer, - aBlock, - aX, - aY, - aZ, - textureUncovered.get(UP), - false); - } else { - aBlock.setBlockBounds(sp, sp + tThickness, sp, sp + tThickness, 1.0F, sp + tThickness); - aRenderer.setRenderBoundsFromBlock(aBlock); - renderNegativeZFacing( - aWorld, - aRenderer, - aBlock, - aX, - aY, - aZ, - textureUncovered.get(NORTH), - false); - renderPositiveZFacing( - aWorld, - aRenderer, - aBlock, - aX, - aY, - aZ, - textureUncovered.get(SOUTH), - false); - renderNegativeXFacing( - aWorld, - aRenderer, - aBlock, - aX, - aY, - aZ, - textureUncovered.get(WEST), - false); - renderPositiveXFacing( - aWorld, - aRenderer, - aBlock, - aX, - aY, - aZ, - textureUncovered.get(EAST), - false); - if (!coveredSides.contains(UP)) { - renderPositiveYFacing( - aWorld, - aRenderer, - aBlock, - aX, - aY, - aZ, - textureUncovered.get(UP), - false); - } - } - if ((connexionSidesBits & CONNECTED_WEST) == 0) { - aBlock.setBlockBounds(sp, sp, sp, sp + tThickness, sp + tThickness, sp + tThickness); - aRenderer.setRenderBoundsFromBlock(aBlock); - renderNegativeZFacing( - aWorld, - aRenderer, - aBlock, - aX, - aY, - aZ, - textureUncovered.get(NORTH), - false); - } else { - aBlock.setBlockBounds(sp, sp, 0.0F, sp + tThickness, sp + tThickness, sp); - aRenderer.setRenderBoundsFromBlock(aBlock); - renderNegativeYFacing( - aWorld, - aRenderer, - aBlock, - aX, - aY, - aZ, - textureUncovered.get(DOWN), - false); - renderPositiveYFacing( - aWorld, - aRenderer, - aBlock, - aX, - aY, - aZ, - textureUncovered.get(UP), - false); - renderNegativeXFacing( - aWorld, - aRenderer, - aBlock, - aX, - aY, - aZ, - textureUncovered.get(WEST), - false); - renderPositiveXFacing( - aWorld, - aRenderer, - aBlock, - aX, - aY, - aZ, - textureUncovered.get(EAST), - false); - if (!coveredSides.contains(NORTH)) { - renderNegativeZFacing( - aWorld, - aRenderer, - aBlock, - aX, - aY, - aZ, - textureUncovered.get(NORTH), - false); - } - } - if ((connexionSidesBits & CONNECTED_EAST) == 0) { - aBlock.setBlockBounds(sp, sp, sp, sp + tThickness, sp + tThickness, sp + tThickness); - aRenderer.setRenderBoundsFromBlock(aBlock); - renderPositiveZFacing( - aWorld, - aRenderer, - aBlock, - aX, - aY, - aZ, - textureUncovered.get(SOUTH), - false); - } else { - aBlock.setBlockBounds(sp, sp, sp + tThickness, sp + tThickness, sp + tThickness, 1.0F); - aRenderer.setRenderBoundsFromBlock(aBlock); - renderNegativeYFacing( - aWorld, - aRenderer, - aBlock, - aX, - aY, - aZ, - textureUncovered.get(DOWN), - false); - renderPositiveYFacing( - aWorld, - aRenderer, - aBlock, - aX, - aY, - aZ, - textureUncovered.get(UP), - false); - renderNegativeXFacing( - aWorld, - aRenderer, - aBlock, - aX, - aY, - aZ, - textureUncovered.get(WEST), - false); - renderPositiveXFacing( - aWorld, - aRenderer, - aBlock, - aX, - aY, - aZ, - textureUncovered.get(EAST), - false); - if (!coveredSides.contains(SOUTH)) { - renderPositiveZFacing( - aWorld, - aRenderer, - aBlock, - aX, - aY, - aZ, - textureUncovered.get(SOUTH), - false); - } - } - } - } - - if (coveredSides.contains(DOWN)) { - aBlock.setBlockBounds(0.0F, 0.0F, 0.0F, 1.0F, 0.125F, 1.0F); - aRenderer.setRenderBoundsFromBlock(aBlock); - renderNegativeYFacing(aWorld, aRenderer, aBlock, aX, aY, aZ, texture.get(DOWN), false); - renderPositiveYFacing(aWorld, aRenderer, aBlock, aX, aY, aZ, texture.get(DOWN), false); - if (!coveredSides.contains(NORTH)) { - renderNegativeZFacing(aWorld, aRenderer, aBlock, aX, aY, aZ, texture.get(DOWN), false); - } - - if (!coveredSides.contains(SOUTH)) { - renderPositiveZFacing(aWorld, aRenderer, aBlock, aX, aY, aZ, texture.get(DOWN), false); - } - - if (!coveredSides.contains(WEST)) { - renderNegativeXFacing(aWorld, aRenderer, aBlock, aX, aY, aZ, texture.get(DOWN), false); - } - - if (!coveredSides.contains(EAST)) { - renderPositiveXFacing(aWorld, aRenderer, aBlock, aX, aY, aZ, texture.get(DOWN), false); - } - } - - if (coveredSides.contains(UP)) { - aBlock.setBlockBounds(0.0F, 0.875F, 0.0F, 1.0F, 1.0F, 1.0F); - aRenderer.setRenderBoundsFromBlock(aBlock); - renderNegativeYFacing(aWorld, aRenderer, aBlock, aX, aY, aZ, texture.get(UP), false); - renderPositiveYFacing(aWorld, aRenderer, aBlock, aX, aY, aZ, texture.get(UP), false); - if (!coveredSides.contains(NORTH)) { - renderNegativeZFacing(aWorld, aRenderer, aBlock, aX, aY, aZ, texture.get(UP), false); - } - - if (!coveredSides.contains(SOUTH)) { - renderPositiveZFacing(aWorld, aRenderer, aBlock, aX, aY, aZ, texture.get(UP), false); - } - - if (!coveredSides.contains(WEST)) { - renderNegativeXFacing(aWorld, aRenderer, aBlock, aX, aY, aZ, texture.get(UP), false); - } - - if (!coveredSides.contains(EAST)) { - renderPositiveXFacing(aWorld, aRenderer, aBlock, aX, aY, aZ, texture.get(UP), false); - } - } - - if (coveredSides.contains(NORTH)) { - aBlock.setBlockBounds(0.0F, 0.0F, 0.0F, 1.0F, 1.0F, 0.125F); - aRenderer.setRenderBoundsFromBlock(aBlock); - if (!coveredSides.contains(DOWN)) { - renderNegativeYFacing(aWorld, aRenderer, aBlock, aX, aY, aZ, texture.get(NORTH), false); - } - - if (!coveredSides.contains(UP)) { - renderPositiveYFacing(aWorld, aRenderer, aBlock, aX, aY, aZ, texture.get(NORTH), false); - } - - renderNegativeZFacing(aWorld, aRenderer, aBlock, aX, aY, aZ, texture.get(NORTH), false); - renderPositiveZFacing(aWorld, aRenderer, aBlock, aX, aY, aZ, texture.get(NORTH), false); - if (!coveredSides.contains(WEST)) { - renderNegativeXFacing(aWorld, aRenderer, aBlock, aX, aY, aZ, texture.get(NORTH), false); - } - - if (!coveredSides.contains(EAST)) { - renderPositiveXFacing(aWorld, aRenderer, aBlock, aX, aY, aZ, texture.get(NORTH), false); - } - } - - if (coveredSides.contains(SOUTH)) { - aBlock.setBlockBounds(0.0F, 0.0F, 0.875F, 1.0F, 1.0F, 1.0F); - aRenderer.setRenderBoundsFromBlock(aBlock); - if (!coveredSides.contains(DOWN)) { - renderNegativeYFacing(aWorld, aRenderer, aBlock, aX, aY, aZ, texture.get(SOUTH), false); - } - - if (!coveredSides.contains(UP)) { - renderPositiveYFacing(aWorld, aRenderer, aBlock, aX, aY, aZ, texture.get(SOUTH), false); - } - - renderNegativeZFacing(aWorld, aRenderer, aBlock, aX, aY, aZ, texture.get(SOUTH), false); - renderPositiveZFacing(aWorld, aRenderer, aBlock, aX, aY, aZ, texture.get(SOUTH), false); - if (!coveredSides.contains(WEST)) { - renderNegativeXFacing(aWorld, aRenderer, aBlock, aX, aY, aZ, texture.get(SOUTH), false); - } - - if (!coveredSides.contains(EAST)) { - renderPositiveXFacing(aWorld, aRenderer, aBlock, aX, aY, aZ, texture.get(SOUTH), false); - } - } - - if (coveredSides.contains(WEST)) { - aBlock.setBlockBounds(0.0F, 0.0F, 0.0F, 0.125F, 1.0F, 1.0F); - aRenderer.setRenderBoundsFromBlock(aBlock); - if (!coveredSides.contains(DOWN)) { - renderNegativeYFacing(aWorld, aRenderer, aBlock, aX, aY, aZ, texture.get(WEST), false); - } - - if (!coveredSides.contains(UP)) { - renderPositiveYFacing(aWorld, aRenderer, aBlock, aX, aY, aZ, texture.get(WEST), false); - } - - if (!coveredSides.contains(NORTH)) { - renderNegativeZFacing(aWorld, aRenderer, aBlock, aX, aY, aZ, texture.get(WEST), false); - } - - if (!coveredSides.contains(SOUTH)) { - renderPositiveZFacing(aWorld, aRenderer, aBlock, aX, aY, aZ, texture.get(WEST), false); - } - - renderNegativeXFacing(aWorld, aRenderer, aBlock, aX, aY, aZ, texture.get(WEST), false); - renderPositiveXFacing(aWorld, aRenderer, aBlock, aX, aY, aZ, texture.get(WEST), false); - } - - if (coveredSides.contains(EAST)) { - aBlock.setBlockBounds(0.875F, 0.0F, 0.0F, 1.0F, 1.0F, 1.0F); - aRenderer.setRenderBoundsFromBlock(aBlock); - if (!coveredSides.contains(DOWN)) { - renderNegativeYFacing(aWorld, aRenderer, aBlock, aX, aY, aZ, texture.get(EAST), false); - } - - if (!coveredSides.contains(UP)) { - renderPositiveYFacing(aWorld, aRenderer, aBlock, aX, aY, aZ, texture.get(EAST), false); - } - - if (!coveredSides.contains(NORTH)) { - renderNegativeZFacing(aWorld, aRenderer, aBlock, aX, aY, aZ, texture.get(EAST), false); - } - - if (!coveredSides.contains(SOUTH)) { - renderPositiveZFacing(aWorld, aRenderer, aBlock, aX, aY, aZ, texture.get(EAST), false); - } - - renderNegativeXFacing(aWorld, aRenderer, aBlock, aX, aY, aZ, texture.get(EAST), false); - renderPositiveXFacing(aWorld, aRenderer, aBlock, aX, aY, aZ, texture.get(EAST), false); - } - - aBlock.setBlockBounds(0.0F, 0.0F, 0.0F, 1.0F, 1.0F, 1.0F); - aRenderer.setRenderBoundsFromBlock(aBlock); - return true; - } - } - } - } - - public static void renderNegativeYFacing(IBlockAccess aWorld, RenderBlocks aRenderer, Block aBlock, int aX, int aY, - int aZ, ITexture[] aIcon, boolean aFullBlock) { - if (aWorld != null) { - if (aFullBlock && !aBlock.shouldSideBeRendered(aWorld, aX, aY - 1, aZ, 0)) { - return; - } - - Tessellator.instance - .setBrightness(aBlock.getMixedBrightnessForBlock(aWorld, aX, aFullBlock ? aY - 1 : aY, aZ)); - } - - if (aIcon != null) { - for (ITexture iTexture : aIcon) { - if (iTexture != null) { - iTexture.renderYNeg(aRenderer, aBlock, aX, aY, aZ); - } - } - } - - aRenderer.flipTexture = false; - } - - public static void renderPositiveYFacing(IBlockAccess aWorld, RenderBlocks aRenderer, Block aBlock, int aX, int aY, - int aZ, ITexture[] aIcon, boolean aFullBlock) { - if (aWorld != null) { - if (aFullBlock && !aBlock.shouldSideBeRendered(aWorld, aX, aY + 1, aZ, 1)) { - return; - } - - Tessellator.instance - .setBrightness(aBlock.getMixedBrightnessForBlock(aWorld, aX, aFullBlock ? aY + 1 : aY, aZ)); - } - - if (aIcon != null) { - for (ITexture iTexture : aIcon) { - if (iTexture != null) { - iTexture.renderYPos(aRenderer, aBlock, aX, aY, aZ); - } - } - } - - aRenderer.flipTexture = false; - } - - public static void renderNegativeZFacing(IBlockAccess aWorld, RenderBlocks aRenderer, Block aBlock, int aX, int aY, - int aZ, ITexture[] aIcon, boolean aFullBlock) { - if (aWorld != null) { - if (aFullBlock && !aBlock.shouldSideBeRendered(aWorld, aX, aY, aZ - 1, 2)) { - return; - } - - Tessellator.instance - .setBrightness(aBlock.getMixedBrightnessForBlock(aWorld, aX, aY, aFullBlock ? aZ - 1 : aZ)); - } - - aRenderer.flipTexture = !aFullBlock; - if (aIcon != null) { - for (ITexture iTexture : aIcon) { - if (iTexture != null) { - iTexture.renderZNeg(aRenderer, aBlock, aX, aY, aZ); - } - } - } - - aRenderer.flipTexture = false; - } - - public static void renderPositiveZFacing(IBlockAccess aWorld, RenderBlocks aRenderer, Block aBlock, int aX, int aY, - int aZ, ITexture[] aIcon, boolean aFullBlock) { - if (aWorld != null) { - if (aFullBlock && !aBlock.shouldSideBeRendered(aWorld, aX, aY, aZ + 1, 3)) { - return; - } - - Tessellator.instance - .setBrightness(aBlock.getMixedBrightnessForBlock(aWorld, aX, aY, aFullBlock ? aZ + 1 : aZ)); - } - - if (aIcon != null) { - for (ITexture iTexture : aIcon) { - if (iTexture != null) { - iTexture.renderZPos(aRenderer, aBlock, aX, aY, aZ); - } - } - } - - aRenderer.flipTexture = false; - } - - public static void renderNegativeXFacing(IBlockAccess aWorld, RenderBlocks aRenderer, Block aBlock, int aX, int aY, - int aZ, ITexture[] aIcon, boolean aFullBlock) { - if (aWorld != null) { - if (aFullBlock && !aBlock.shouldSideBeRendered(aWorld, aX - 1, aY, aZ, 4)) { - return; - } - - Tessellator.instance - .setBrightness(aBlock.getMixedBrightnessForBlock(aWorld, aFullBlock ? aX - 1 : aX, aY, aZ)); - } - - if (aIcon != null) { - for (ITexture iTexture : aIcon) { - if (iTexture != null) { - iTexture.renderXNeg(aRenderer, aBlock, aX, aY, aZ); - } - } - } - - aRenderer.flipTexture = false; - } - - public static void renderPositiveXFacing(IBlockAccess aWorld, RenderBlocks aRenderer, Block aBlock, int aX, int aY, - int aZ, ITexture[] aIcon, boolean aFullBlock) { - if (aWorld != null) { - if (aFullBlock && !aBlock.shouldSideBeRendered(aWorld, aX + 1, aY, aZ, 5)) { - return; - } - - Tessellator.instance - .setBrightness(aBlock.getMixedBrightnessForBlock(aWorld, aFullBlock ? aX + 1 : aX, aY, aZ)); - } - - aRenderer.flipTexture = !aFullBlock; - if (aIcon != null) { - for (ITexture iTexture : aIcon) { - if (iTexture != null) { - iTexture.renderXPos(aRenderer, aBlock, aX, aY, aZ); - } - } - } - - aRenderer.flipTexture = false; - } - - @Override - public void renderInventoryBlock(Block aBlock, int aMeta, int aModelID, RenderBlocks aRenderer) { - aMeta += 30400; - if (aBlock instanceof GT_Block_Machines) { - if (aMeta > 0 && aMeta < GregTech_API.METATILEENTITIES.length - && GregTech_API.METATILEENTITIES[aMeta] != null - && !GregTech_API.METATILEENTITIES[aMeta].renderInInventory(aBlock, aMeta, aRenderer)) { - renderNormalInventoryMetaTileEntity(aBlock, aMeta, aRenderer); - } - } - aBlock.setBlockBounds(0.0F, 0.0F, 0.0F, 1.0F, 1.0F, 1.0F); - aRenderer.setRenderBoundsFromBlock(aBlock); - GL11.glTranslatef(0.5F, 0.5F, 0.5F); - } - - @Override - public boolean renderWorldBlock(IBlockAccess aWorld, int aX, int aY, int aZ, Block aBlock, int aModelID, - RenderBlocks aRenderer) { - TileEntity aTileEntity = aWorld.getTileEntity(aX, aY, aZ); - return aTileEntity == null ? false - : (aTileEntity instanceof IGregTechTileEntity - && ((IGregTechTileEntity) aTileEntity).getMetaTileEntity() != null - && ((IGregTechTileEntity) aTileEntity).getMetaTileEntity() - .renderInWorld(aWorld, aX, aY, aZ, aBlock, aRenderer) - ? true - : (aTileEntity instanceof IPipeRenderedTileEntity - ? renderPipeBlock( - aWorld, - aX, - aY, - aZ, - aBlock, - (IPipeRenderedTileEntity) aTileEntity, - aRenderer) - : renderStandardBlock(aWorld, aX, aY, aZ, aBlock, aRenderer))); - } - - @Override - public boolean shouldRender3DInInventory(int aModel) { - return true; - } - - @Override - public int getRenderId() { - return this.mRenderID; - } -} diff --git a/gtpp/src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/automation/GT_MetaTileEntity_ElectricAutoWorkbench.java b/gtpp/src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/automation/GT_MetaTileEntity_ElectricAutoWorkbench.java deleted file mode 100644 index 87ae66b2ad..0000000000 --- a/gtpp/src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/automation/GT_MetaTileEntity_ElectricAutoWorkbench.java +++ /dev/null @@ -1,873 +0,0 @@ -package gtPlusPlus.xmod.gregtech.common.tileentities.automation; - -import java.util.ArrayList; - -import net.minecraft.entity.player.EntityPlayer; -import net.minecraft.item.ItemStack; -import net.minecraft.nbt.NBTTagCompound; -import net.minecraftforge.common.util.ForgeDirection; -import net.minecraftforge.oredict.OreDictionary; - -import com.gtnewhorizons.modularui.api.screen.ModularWindow; -import com.gtnewhorizons.modularui.api.screen.UIBuildContext; -import com.gtnewhorizons.modularui.common.widget.CycleButtonWidget; -import com.gtnewhorizons.modularui.common.widget.DrawableWidget; -import com.gtnewhorizons.modularui.common.widget.SlotGroup; -import com.gtnewhorizons.modularui.common.widget.SlotWidget; - -import gregtech.api.enums.GT_Values; -import gregtech.api.enums.OrePrefixes; -import gregtech.api.enums.Textures; -import gregtech.api.enums.Textures.BlockIcons; -import gregtech.api.gui.modularui.GT_UIInfos; -import gregtech.api.gui.modularui.GT_UITextures; -import gregtech.api.interfaces.ITexture; -import gregtech.api.interfaces.modularui.IAddGregtechLogo; -import gregtech.api.interfaces.tileentity.IGregTechTileEntity; -import gregtech.api.metatileentity.MetaTileEntity; -import gregtech.api.metatileentity.implementations.GT_MetaTileEntity_BasicTank; -import gregtech.api.objects.GT_ItemStack; -import gregtech.api.objects.GT_RenderedTexture; -import gregtech.api.util.GT_ModHandler; -import gregtech.api.util.GT_OreDictUnificator; -import gregtech.api.util.GT_Utility; -import gtPlusPlus.core.lib.CORE; -import gtPlusPlus.xmod.gregtech.api.gui.GTPP_UITextures; -import gtPlusPlus.xmod.gregtech.common.blocks.textures.TexturesGtBlock; - -public class GT_MetaTileEntity_ElectricAutoWorkbench extends GT_MetaTileEntity_BasicTank implements IAddGregtechLogo { - - public int mMode = 0, mCurrentSlot = 0, mThroughPut = 0, mTicksUntilNextUpdate = 20; - public boolean mLastCraftSuccessful = false; - protected String mLocalName; - - private static final int MAX_MODES = 10; - private static final int MAX_THROUGHPUT = 4; - - public GT_MetaTileEntity_ElectricAutoWorkbench(final int aID, final int aTier, final String aDescription) { - super( - aID, - "basicmachine.automation.autoworkbench.0" + aTier, - "Auto Workbench (" + GT_Values.VN[aTier] + ")", - aTier, - 30, - aDescription); - mLocalName = "Auto Workbench (" + GT_Values.VN[aTier] + ")"; - } - - public GT_MetaTileEntity_ElectricAutoWorkbench(final String aName, final int aTier, final String[] aDescription, - final ITexture[][][] aTextures) { - super(aName, aTier, 30, aDescription, aTextures); - } - - @Override - public boolean isTransformerUpgradable() { - return true; - } - - @Override - public boolean isOverclockerUpgradable() { - return false; - } - - @Override - public boolean isSimpleMachine() { - return false; - } - - @Override - public boolean isValidSlot(int aIndex) { - return aIndex < 19; - } - - @Override - public boolean isFacingValid(ForgeDirection facing) { - return true; - } - - @Override - public boolean isEnetInput() { - return true; - } - - @Override - public boolean isEnetOutput() { - return true; - } - - @Override - public boolean isInputFacing(ForgeDirection side) { - return !isOutputFacing(side); - } - - @Override - public boolean isOutputFacing(ForgeDirection side) { - return side == getBaseMetaTileEntity().getBackFacing(); - } - - @Override - public boolean isTeleporterCompatible() { - return false; - } - - @Override - public long maxEUInput() { - return GT_Values.V[mTier]; - } - - @Override - public long maxEUOutput() { - return mThroughPut % 2 == 0 ? GT_Values.V[mTier] : 0; - } - - @Override - public long getMinimumStoredEU() { - return GT_Values.V[this.mTier]; - } - - @Override - public long maxEUStore() { - return Math.max(2048L, GT_Values.V[this.mTier] * (this.mTier * GT_Values.V[this.mTier])); - } - - @Override - public int getSizeInventory() { - return 30; - } - - @Override - public boolean isAccessAllowed(EntityPlayer aPlayer) { - return true; - } - - @Override - public boolean onRightclick(final IGregTechTileEntity aBaseMetaTileEntity, final EntityPlayer aPlayer) { - GT_UIInfos.openGTTileEntityUI(aBaseMetaTileEntity, aPlayer); - return true; - } - - @Override - public MetaTileEntity newMetaEntity(IGregTechTileEntity aTileEntity) { - return new GT_MetaTileEntity_ElectricAutoWorkbench( - this.mName, - this.mTier, - this.mDescriptionArray, - this.mTextures); - } - - @Override - public void saveNBTData(NBTTagCompound aNBT) { - super.saveNBTData(aNBT); - aNBT.setInteger("mMode", mMode); - aNBT.setInteger("mThroughPut", mThroughPut); - } - - @Override - public void loadNBTData(NBTTagCompound aNBT) { - super.loadNBTData(aNBT); - mMode = aNBT.getInteger("mMode"); - mThroughPut = aNBT.getInteger("mThroughPut"); - } - - @Override - public boolean doesFillContainers() { - return false; - } - - @Override - public boolean doesEmptyContainers() { - return false; - } - - @Override - public boolean canTankBeFilled() { - return true; - } - - @Override - public boolean canTankBeEmptied() { - return true; - } - - @Override - public boolean displaysItemStack() { - return false; - } - - @Override - public boolean displaysStackSize() { - return false; - } - - @Override - public boolean allowCoverOnSide(ForgeDirection side, GT_ItemStack aStack) { - return side != getBaseMetaTileEntity().getFrontFacing() && side != getBaseMetaTileEntity().getBackFacing(); - } - - private void switchMode() { - mInventory[28] = null; - } - - @Override - public void onPostTick(IGregTechTileEntity aBaseMetaTileEntity, long aTick) { - super.onPostTick(aBaseMetaTileEntity, aTick); - if (getBaseMetaTileEntity().isAllowedToWork() && getBaseMetaTileEntity().isServerSide() - && getBaseMetaTileEntity().getUniversalEnergyStored() >= (mMode == 5 || mMode == 6 ? 128 : 2048) - && (getBaseMetaTileEntity().hasWorkJustBeenEnabled() || --mTicksUntilNextUpdate < 1)) { - mTicksUntilNextUpdate = 32; - - for (byte i = 19; i < 28; i++) { - if (mInventory[i] != null && mInventory[i].isItemStackDamageable() - && mInventory[i].getItem() - .hasContainerItem(mInventory[i])) { - mInventory[i].setItemDamage(OreDictionary.WILDCARD_VALUE); - } - } - - if (mInventory[18] == null) { - for (byte i = 0; i < 18 && mFluid != null; i++) { - ItemStack tOutput = GT_Utility.fillFluidContainer(mFluid, mInventory[i], false, true); - if (tOutput != null) { - for (byte j = 0; j < 9; j++) { - if (mInventory[j] == null || (GT_Utility.areStacksEqual(tOutput, mInventory[j]) - && mInventory[j].stackSize + tOutput.stackSize <= tOutput.getMaxStackSize())) { - mFluid.amount -= GT_Utility.getFluidForFilledItem(tOutput, true).amount - * tOutput.stackSize; - getBaseMetaTileEntity().decrStackSize(i, 1); - if (mInventory[j] == null) { - mInventory[j] = tOutput; - } else { - mInventory[j].stackSize++; - } - if (mFluid.amount <= 0) mFluid = null; - break; - } - } - } - } - - ItemStack[] tRecipe = new ItemStack[9]; - ItemStack tTempStack = null, tOutput = null; - - if (mInventory[17] != null && mThroughPut < 2 && mMode != 0) { - if (mInventory[18] == null) { - mInventory[18] = mInventory[17]; - mInventory[17] = null; - } - } else { - if (!mLastCraftSuccessful) { - mCurrentSlot = (mCurrentSlot + 1) % 18; - for (int i = 0; i < 17 && mInventory[mCurrentSlot] == null; i++) - mCurrentSlot = (mCurrentSlot + 1) % 18; - } - switch (mMode) { - case 0 -> { - if (mInventory[mCurrentSlot] != null - && !isItemTypeOrItsEmptyLiquidContainerInCraftingGrid(mInventory[mCurrentSlot])) { - if (mInventory[18] == null && mThroughPut < 2 && mCurrentSlot < 8) { - mInventory[18] = mInventory[mCurrentSlot]; - mInventory[mCurrentSlot] = null; - mTicksUntilNextUpdate = 1; - } - break; - } - for (int i = 0; i < 9; i++) { - tRecipe[i] = mInventory[i + 19]; - if (tRecipe[i] != null) { - tRecipe[i] = GT_Utility.copy(tRecipe[i]); - tRecipe[i].stackSize = 1; - } - } - } - case 1 -> { - if (isItemTypeOrItsEmptyLiquidContainerInCraftingGrid(mInventory[mCurrentSlot])) { - if (mInventory[18] == null && mThroughPut < 2) { - mInventory[18] = mInventory[mCurrentSlot]; - mInventory[mCurrentSlot] = null; - mTicksUntilNextUpdate = 1; - } - break; - } - tTempStack = GT_Utility.copy(mInventory[mCurrentSlot]); - tTempStack.stackSize = 1; - tRecipe[0] = tTempStack; - if (GT_ModHandler.getAllRecipeOutput(getBaseMetaTileEntity().getWorld(), tRecipe) == null) { - tRecipe[1] = tTempStack; - tRecipe[3] = tTempStack; - tRecipe[4] = tTempStack; - } else break; - if (GT_ModHandler.getAllRecipeOutput(getBaseMetaTileEntity().getWorld(), tRecipe) == null) { - tRecipe[2] = tTempStack; - tRecipe[5] = tTempStack; - tRecipe[6] = tTempStack; - tRecipe[7] = tTempStack; - tRecipe[8] = tTempStack; - } else break; - if (GT_ModHandler.getAllRecipeOutput(getBaseMetaTileEntity().getWorld(), tRecipe) == null) { - if (mInventory[18] == null) { - mInventory[18] = mInventory[mCurrentSlot]; - mInventory[mCurrentSlot] = null; - mTicksUntilNextUpdate = 1; - } - } - } - case 2 -> { - if (isItemTypeOrItsEmptyLiquidContainerInCraftingGrid(mInventory[mCurrentSlot])) { - if (mInventory[18] == null && mThroughPut < 2) { - mInventory[18] = mInventory[mCurrentSlot]; - mInventory[mCurrentSlot] = null; - mTicksUntilNextUpdate = 1; - } - break; - } - tTempStack = GT_Utility.copy(mInventory[mCurrentSlot]); - tTempStack.stackSize = 1; - tRecipe[0] = tTempStack; - if (GT_ModHandler.getAllRecipeOutput(getBaseMetaTileEntity().getWorld(), tRecipe) == null) { - if (mInventory[18] == null) { - mInventory[18] = mInventory[mCurrentSlot]; - mInventory[mCurrentSlot] = null; - mTicksUntilNextUpdate = 1; - } - } - } - case 3 -> { - if (isItemTypeOrItsEmptyLiquidContainerInCraftingGrid(mInventory[mCurrentSlot])) { - if (mInventory[18] == null && mThroughPut < 2) { - mInventory[18] = mInventory[mCurrentSlot]; - mInventory[mCurrentSlot] = null; - mTicksUntilNextUpdate = 1; - } - break; - } - tTempStack = GT_Utility.copy(mInventory[mCurrentSlot]); - tTempStack.stackSize = 1; - tRecipe[0] = tTempStack; - tRecipe[1] = tTempStack; - tRecipe[3] = tTempStack; - tRecipe[4] = tTempStack; - if (GT_ModHandler.getAllRecipeOutput(getBaseMetaTileEntity().getWorld(), tRecipe) == null) { - if (mInventory[18] == null) { - mInventory[18] = mInventory[mCurrentSlot]; - mInventory[mCurrentSlot] = null; - mTicksUntilNextUpdate = 1; - } - } - } - case 4 -> { - if (isItemTypeOrItsEmptyLiquidContainerInCraftingGrid(mInventory[mCurrentSlot])) { - if (mInventory[18] == null && mThroughPut < 2) { - mInventory[18] = mInventory[mCurrentSlot]; - mInventory[mCurrentSlot] = null; - mTicksUntilNextUpdate = 1; - } - break; - } - tTempStack = GT_Utility.copy(mInventory[mCurrentSlot]); - tTempStack.stackSize = 1; - tRecipe[0] = tTempStack; - tRecipe[1] = tTempStack; - tRecipe[2] = tTempStack; - tRecipe[3] = tTempStack; - tRecipe[4] = tTempStack; - tRecipe[5] = tTempStack; - tRecipe[6] = tTempStack; - tRecipe[7] = tTempStack; - tRecipe[8] = tTempStack; - if (GT_ModHandler.getAllRecipeOutput(getBaseMetaTileEntity().getWorld(), tRecipe) == null) { - if (mInventory[18] == null) { - mInventory[18] = mInventory[mCurrentSlot]; - mInventory[mCurrentSlot] = null; - mTicksUntilNextUpdate = 1; - } - } - } - case 5 -> { - if (isItemTypeOrItsEmptyLiquidContainerInCraftingGrid(mInventory[mCurrentSlot])) { - if (mInventory[18] == null && mThroughPut < 2) { - mInventory[18] = mInventory[mCurrentSlot]; - mInventory[mCurrentSlot] = null; - mTicksUntilNextUpdate = 1; - } - break; - } - tTempStack = GT_Utility.copy(mInventory[mCurrentSlot]); - tTempStack.stackSize = 1; - tRecipe[0] = tTempStack; - tOutput = GT_OreDictUnificator.get(true, tTempStack); - if (tOutput != null && GT_Utility.areStacksEqual(tOutput, tTempStack)) tOutput = null; - if (tOutput == null) { - tRecipe[0] = null; - if (mInventory[18] == null) { - mInventory[18] = mInventory[mCurrentSlot]; - mInventory[mCurrentSlot] = null; - mTicksUntilNextUpdate = 1; - } - } - } - case 6 -> { - if (isItemTypeOrItsEmptyLiquidContainerInCraftingGrid(mInventory[mCurrentSlot])) { - if (mInventory[18] == null && mThroughPut < 2) { - mInventory[18] = mInventory[mCurrentSlot]; - mInventory[mCurrentSlot] = null; - mTicksUntilNextUpdate = 1; - } - } else if (OrePrefixes.dustSmall.contains(mInventory[mCurrentSlot])) { - tTempStack = GT_Utility.copy(mInventory[mCurrentSlot]); - tTempStack.stackSize = 1; - tRecipe[0] = tTempStack; - tRecipe[1] = tTempStack; - tRecipe[3] = tTempStack; - tRecipe[4] = tTempStack; - if (GT_ModHandler.getAllRecipeOutput(getBaseMetaTileEntity().getWorld(), tRecipe) - == null) { - if (mInventory[18] == null) { - mInventory[18] = mInventory[mCurrentSlot]; - mInventory[mCurrentSlot] = null; - mTicksUntilNextUpdate = 1; - } - } - } else if (OrePrefixes.dustTiny.contains(mInventory[mCurrentSlot])) { - tTempStack = GT_Utility.copy(mInventory[mCurrentSlot]); - tTempStack.stackSize = 1; - tRecipe[0] = tTempStack; - tRecipe[1] = tTempStack; - tRecipe[2] = tTempStack; - tRecipe[3] = tTempStack; - tRecipe[4] = tTempStack; - tRecipe[5] = tTempStack; - tRecipe[6] = tTempStack; - tRecipe[7] = tTempStack; - tRecipe[8] = tTempStack; - if (GT_ModHandler.getAllRecipeOutput(getBaseMetaTileEntity().getWorld(), tRecipe) - == null) { - if (mInventory[18] == null) { - mInventory[18] = mInventory[mCurrentSlot]; - mInventory[mCurrentSlot] = null; - mTicksUntilNextUpdate = 1; - } - } - } else { - if (mInventory[18] == null && mThroughPut < 2) { - mInventory[18] = mInventory[mCurrentSlot]; - mInventory[mCurrentSlot] = null; - mTicksUntilNextUpdate = 1; - } - } - } - case 7 -> { - if (isItemTypeOrItsEmptyLiquidContainerInCraftingGrid(mInventory[mCurrentSlot]) - || !OrePrefixes.nugget.contains(mInventory[mCurrentSlot])) { - if (mInventory[18] == null && mThroughPut < 2) { - mInventory[18] = mInventory[mCurrentSlot]; - mInventory[mCurrentSlot] = null; - mTicksUntilNextUpdate = 1; - } - break; - } - tTempStack = GT_Utility.copy(mInventory[mCurrentSlot]); - tTempStack.stackSize = 1; - tRecipe[0] = tTempStack; - tRecipe[1] = tTempStack; - tRecipe[2] = tTempStack; - tRecipe[3] = tTempStack; - tRecipe[4] = tTempStack; - tRecipe[5] = tTempStack; - tRecipe[6] = tTempStack; - tRecipe[7] = tTempStack; - tRecipe[8] = tTempStack; - if (GT_ModHandler.getAllRecipeOutput(getBaseMetaTileEntity().getWorld(), tRecipe) == null) { - if (mInventory[18] == null) { - mInventory[18] = mInventory[mCurrentSlot]; - mInventory[mCurrentSlot] = null; - mTicksUntilNextUpdate = 1; - } - } - } - case 8 -> { - if (isItemTypeOrItsEmptyLiquidContainerInCraftingGrid(mInventory[mCurrentSlot]) - || mInventory[mCurrentSlot].getItemDamage() <= 0 - || !mInventory[mCurrentSlot].getItem() - .isRepairable()) { - if (mInventory[18] == null && mThroughPut < 2) { - mInventory[18] = mInventory[mCurrentSlot]; - mInventory[mCurrentSlot] = null; - mTicksUntilNextUpdate = 1; - } - break; - } - tTempStack = GT_Utility.copy(mInventory[mCurrentSlot]); - tTempStack.stackSize = 1; - for (int i = mCurrentSlot + 1; i < 18; i++) { - if (mInventory[i] != null && mInventory[i].getItem() == tTempStack.getItem() - && mInventory[mCurrentSlot].getItemDamage() + mInventory[i].getItemDamage() - > tTempStack.getMaxDamage()) { - tRecipe[0] = tTempStack; - tRecipe[1] = GT_Utility.copy(mInventory[i]); - if (GT_ModHandler.getAllRecipeOutput(getBaseMetaTileEntity().getWorld(), tRecipe) - == null) { - if (mInventory[18] == null) { - mInventory[18] = mInventory[mCurrentSlot]; - mInventory[mCurrentSlot] = null; - mTicksUntilNextUpdate = 1; - } - } - break; - } - } - } - case 9 -> { - if (isItemTypeOrItsEmptyLiquidContainerInCraftingGrid(mInventory[mCurrentSlot])) { - if (mInventory[18] == null && mThroughPut < 2) { - mInventory[18] = mInventory[mCurrentSlot]; - mInventory[mCurrentSlot] = null; - mTicksUntilNextUpdate = 1; - } - break; - } - for (byte i = 0, j = 0; i < 18 && j < 9 - && (j < 2 - || GT_ModHandler.getAllRecipeOutput(getBaseMetaTileEntity().getWorld(), tRecipe) - == null); i++) { - tRecipe[j] = mInventory[(mCurrentSlot + i) % 18]; - if (tRecipe[j] != null) { - tRecipe[j] = GT_Utility.copy(tRecipe[j]); - tRecipe[j].stackSize = 1; - j++; - } - } - if (tRecipe[1] == null) tRecipe[0] = null; - } - } - } - - if (tOutput == null) - tOutput = GT_ModHandler.getAllRecipeOutput(getBaseMetaTileEntity().getWorld(), tRecipe); - - if (tOutput != null || mMode == 0) mInventory[28] = tOutput; - - if (tOutput == null) { - mLastCraftSuccessful = false; - } else { - if ((tTempStack = GT_OreDictUnificator.get(true, tOutput)) != null) { - tTempStack.stackSize = tOutput.stackSize; - tOutput = tTempStack; - } - - mInventory[28] = GT_Utility.copy(tOutput); - ArrayList<ItemStack> tList = recipeContent(tRecipe), tContent = benchContent(); - if (tList.size() > 0 && tContent.size() > 0) { - - boolean success = (mMode == 6 || mMode == 7 || mInventory[17] == null); - for (byte i = 0; i < tList.size() && success; i++) { - success = false; - for (byte j = 0; j < tContent.size() && !success; j++) { - if (GT_Utility.areStacksEqual(tList.get(i), tContent.get(j))) { - if (tList.get(i).stackSize <= tContent.get(j).stackSize) { - success = true; - } - } - } - } - - if (success) { - mLastCraftSuccessful = true; - - for (byte i = 8; i > -1; i--) { - for (byte j = 17; j > -1; j--) { - if (tRecipe[i] != null && mInventory[j] != null) { - if (GT_Utility.areStacksEqual(tRecipe[i], mInventory[j])) { - ItemStack tStack = GT_Utility.getContainerItem(mInventory[j], true); - if (tStack != null) { - getBaseMetaTileEntity().decrStackSize(j, 1); - if (!tStack.isItemStackDamageable() - || tStack.getItemDamage() < tStack.getMaxDamage()) { - for (byte k = 9; k < 18; k++) { - if (mInventory[k] == null) { - mInventory[k] = GT_Utility.copy(tStack); - break; - } else if (GT_Utility.areStacksEqual(mInventory[k], tStack) - && mInventory[k].stackSize + tStack.stackSize - <= tStack.getMaxStackSize()) { - mInventory[k].stackSize += tStack.stackSize; - break; - } - } - } - } else { - getBaseMetaTileEntity().decrStackSize(j, 1); - } - break; - } - } - } - } - - mInventory[18] = GT_Utility.copy(tOutput); - getBaseMetaTileEntity() - .decreaseStoredEnergyUnits(mMode == 5 || mMode == 6 || mMode == 7 ? 128 : 2048, true); - mTicksUntilNextUpdate = 1; - } else { - mLastCraftSuccessful = false; - if (mInventory[mMode == 0 ? 8 : 17] != null && mInventory[18] == null && mThroughPut < 2) { - mInventory[18] = mInventory[mMode == 0 ? 8 : 17]; - mInventory[mMode == 0 ? 8 : 17] = null; - mTicksUntilNextUpdate = 1; - } - } - } - - if (mInventory[18] == null && mThroughPut < 2) { - for (byte i = 0; i < 8; i++) { - for (byte j = i; ++j < 9;) { - if (GT_Utility.areStacksEqual(mInventory[i], mInventory[j]) - && mInventory[i].getMaxStackSize() > 8) { - mInventory[18] = mInventory[j]; - mInventory[j] = null; - mTicksUntilNextUpdate = 1; - break; - } - } - } - } - } - } - - if (mThroughPut < 2) { - getBaseMetaTileEntity().decreaseStoredEnergyUnits( - GT_Utility.moveOneItemStack( - getBaseMetaTileEntity(), - getBaseMetaTileEntity().getIInventoryAtSide(getBaseMetaTileEntity().getBackFacing()), - getBaseMetaTileEntity().getBackFacing(), - getBaseMetaTileEntity().getFrontFacing(), - null, - false, - (byte) 64, - (byte) 1, - (byte) 64, - (byte) 1) * 10, - true); - } - } - } - - private boolean isItemTypeOrItsEmptyLiquidContainerInCraftingGrid(ItemStack aStack) { - if (aStack == null) return true; - for (byte i = 19; i < 28; i++) { - if (mInventory[i] != null) { - if (GT_Utility.areStacksEqual(mInventory[i], aStack)) return true; - if (GT_Utility.areStacksEqual(GT_Utility.getContainerForFilledItem(mInventory[i], true), aStack)) - return true; - } - } - return false; - } - - private ArrayList<ItemStack> recipeContent(ItemStack[] tRecipe) { - ArrayList<ItemStack> tList = new ArrayList<>(); - for (byte i = 0; i < 9; i++) { - if (tRecipe[i] != null) { - boolean temp = false; - for (ItemStack itemStack : tList) { - if (GT_Utility.areStacksEqual(tRecipe[i], itemStack)) { - itemStack.stackSize++; - temp = true; - break; - } - } - if (!temp) tList.add(GT_Utility.copy(1, tRecipe[i])); - } - } - return tList; - } - - private ArrayList<ItemStack> benchContent() { - ArrayList<ItemStack> tList = new ArrayList<>(); - for (byte i = 0; i < 18; i++) { - if (mInventory[i] != null) { - boolean temp = false; - for (byte j = 0; j < tList.size(); j++) { - if (GT_Utility.areStacksEqual(mInventory[i], mInventory[j])) { - tList.get(j).stackSize += mInventory[i].stackSize; - temp = true; - break; - } - } - if (!temp) tList.add(GT_Utility.copy(mInventory[i])); - } - } - return tList; - } - - @Override - public boolean allowPullStack(IGregTechTileEntity aBaseMetaTileEntity, int aIndex, ForgeDirection side, - ItemStack aStack) { - return mMode == 0 ? aIndex >= 10 : aIndex >= 18; - } - - @Override - public boolean allowPutStack(IGregTechTileEntity aBaseMetaTileEntity, int aIndex, ForgeDirection side, - ItemStack aStack) { - return mMode == 0 ? aIndex < 9 : aIndex < 18; - } - - /* - * @Override public int getTextureIndex(byte aSide, byte aFacing, boolean aActive, boolean aRedstone) { if (aSide == - * aFacing) return 112; if (GT_Utility.getOppositeSide(aSide) == aFacing) return 113; return 114; } - */ - - @Override - public int getCapacity() { - return 16000; - } - - @Override - public int getTankPressure() { - return -100; - } - - @Override - public String[] getDescription() { - return new String[] { "Automatic Crafting Table Mk III", - // this.mDescription, - CORE.GT_Tooltip.get() }; - } - - @Override - public ITexture[][][] getTextureSet(final ITexture[] aTextures) { - final ITexture[][][] rTextures = new ITexture[10][17][]; - for (byte i = -1; i < 16; i++) { - rTextures[0][i + 1] = this.getFront(i); - rTextures[1][i + 1] = this.getBack(i); - rTextures[2][i + 1] = this.getBottom(i); - rTextures[3][i + 1] = this.getTop(i); - rTextures[4][i + 1] = this.getSides(i); - rTextures[5][i + 1] = this.getFront(i); - rTextures[6][i + 1] = this.getBack(i); - rTextures[7][i + 1] = this.getBottom(i); - rTextures[8][i + 1] = this.getTop(i); - rTextures[9][i + 1] = this.getSides(i); - } - return rTextures; - } - - @Override - public ITexture[] getTexture(final IGregTechTileEntity aBaseMetaTileEntity, final ForgeDirection side, - final ForgeDirection facing, final int aColorIndex, final boolean aActive, final boolean aRedstone) { - if (side == facing) { - return this.mTextures[0][aColorIndex + 1]; - } else if (side.getOpposite() == facing) { - return this.mTextures[1][aColorIndex + 1]; - } else { - return this.mTextures[4][aColorIndex + 1]; - } - } - - public ITexture[] getFront(final byte aColor) { - return new ITexture[] { Textures.BlockIcons.MACHINE_CASINGS[mTier][aColor + 1], - new GT_RenderedTexture(TexturesGtBlock.Casing_Adv_Workbench_Crafting_Overlay) }; - } - - public ITexture[] getBack(final byte aColor) { - return new ITexture[] { Textures.BlockIcons.MACHINE_CASINGS[mTier][aColor + 1], - new GT_RenderedTexture(BlockIcons.OVERLAY_PIPE) }; - } - - public ITexture[] getBottom(final byte aColor) { - return new ITexture[] { Textures.BlockIcons.MACHINE_CASINGS[mTier][aColor + 1], }; - } - - public ITexture[] getTop(final byte aColor) { - return new ITexture[] { Textures.BlockIcons.MACHINE_CASINGS[mTier][aColor + 1], - new GT_RenderedTexture(TexturesGtBlock.Casing_Adv_Workbench_Crafting_Overlay) }; - } - - public ITexture[] getSides(final byte aColor) { - return new ITexture[] { Textures.BlockIcons.MACHINE_CASINGS[mTier][aColor + 1], - new GT_RenderedTexture(TexturesGtBlock.Casing_Adv_Workbench_Crafting_Overlay) }; - } - - @Override - public boolean useModularUI() { - return true; - } - - @Override - public void addGregTechLogo(ModularWindow.Builder builder) { - builder.widget( - new DrawableWidget().setDrawable(getGUITextureSet().getGregTechLogo()) - .setSize(17, 17) - .setPos(118, 22)); - } - - @Override - public void addUIWidgets(ModularWindow.Builder builder, UIBuildContext buildContext) { - builder.widget( - SlotGroup.ofItemHandler(inventoryHandler, 3) - .endAtSlot(8) - .build() - .setPos(7, 4)) - .widget( - SlotGroup.ofItemHandler(inventoryHandler, 9) - .startFromSlot(9) - .endAtSlot(17) - .canInsert(false) - .background(GT_UITextures.SLOT_DARK_GRAY) - .applyForWidget(SlotWidget::disableShiftInsert) - .build() - .setPos(7, 59)) - .widget( - new SlotWidget(inventoryHandler, 18).setAccess(true, false) - .setBackground(getGUITextureSet().getItemSlot(), GT_UITextures.OVERLAY_SLOT_OUT) - .setPos(151, 40)) - .widget( - new DrawableWidget().setDrawable(GT_UITextures.PICTURE_SLOTS_HOLO_3BY3) - .setPos(62, 4) - .setSize(54, 54)) - .widget( - SlotGroup.ofItemHandler(inventoryHandler, 3) - .startFromSlot(19) - .endAtSlot(27) - .phantom(true) - .background(GT_UITextures.TRANSPARENT) - .build() - .setPos(62, 4)) - .widget( - SlotWidget.phantom(inventoryHandler, 28) - .disableInteraction() - .setBackground(getGUITextureSet().getItemSlot(), GTPP_UITextures.OVERLAY_SLOT_ARROW_4) - .setPos(151, 4)); - builder.widget( - new CycleButtonWidget().setGetter(() -> mThroughPut) - .setSetter(val -> mThroughPut = val) - .setLength(MAX_THROUGHPUT) - .setTextureGetter(i -> GTPP_UITextures.OVERLAY_BUTTON_THROUGHPUT[i]) - .setBackground(GT_UITextures.BUTTON_STANDARD) - .setPos(120, 4) - .setSize(18, 18)); - String[] mModeText = new String[] { "Normal Crafting Table", "???", "1x1", "2x2", "3x3", "Unifier", "Dust", - "???", "Hammer?", "Circle" }; - CycleButtonWidget modeButton = new CycleButtonWidget().setGetter(() -> mMode) - .setSetter(val -> { - mMode = val; - switchMode(); - }) - .setLength(MAX_MODES) - .setTextureGetter(i -> GTPP_UITextures.OVERLAY_BUTTON_MODE[i]); - for (int i = 0; i < MAX_MODES; i++) { - modeButton.addTooltip(i, "Mode: " + mModeText[i]); - } - builder.widget( - modeButton.setBackground(GT_UITextures.BUTTON_STANDARD) - .setPos(120, 40) - .setSize(18, 18)); - builder.widget( - new DrawableWidget().setDrawable(GTPP_UITextures.PICTURE_WORKBENCH_CIRCLE) - .setPos(136, 23) - .setSize(16, 16)) - .widget( - new DrawableWidget().setDrawable(GTPP_UITextures.PICTURE_ARROW_WHITE_DOWN) - .setPos(155, 23) - .setSize(10, 16)); - } -} diff --git a/gtpp/src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/automation/GT_MetaTileEntity_TesseractGenerator.java b/gtpp/src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/automation/GT_MetaTileEntity_TesseractGenerator.java deleted file mode 100644 index 7fc2b50f68..0000000000 --- a/gtpp/src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/automation/GT_MetaTileEntity_TesseractGenerator.java +++ /dev/null @@ -1,834 +0,0 @@ -package gtPlusPlus.xmod.gregtech.common.tileentities.automation; - -import static gtPlusPlus.core.lib.CORE.sTesseractGeneratorOwnershipMap; -import static gtPlusPlus.core.lib.CORE.sTesseractTerminalOwnershipMap; - -import java.util.UUID; - -import net.minecraft.entity.player.EntityPlayer; -import net.minecraft.inventory.IInventory; -import net.minecraft.inventory.ISidedInventory; -import net.minecraft.item.ItemStack; -import net.minecraft.nbt.NBTTagCompound; -import net.minecraft.tileentity.TileEntity; -import net.minecraft.util.EnumChatFormatting; -import net.minecraft.world.World; -import net.minecraftforge.common.util.ForgeDirection; -import net.minecraftforge.fluids.Fluid; -import net.minecraftforge.fluids.FluidStack; -import net.minecraftforge.fluids.FluidTankInfo; -import net.minecraftforge.fluids.IFluidHandler; - -import org.apache.commons.lang3.ArrayUtils; - -import gregtech.api.enums.Textures; -import gregtech.api.interfaces.ITexture; -import gregtech.api.interfaces.tileentity.IDigitalChest; -import gregtech.api.interfaces.tileentity.IGregTechDeviceInformation; -import gregtech.api.interfaces.tileentity.IGregTechTileEntity; -import gregtech.api.metatileentity.MetaTileEntity; -import gregtech.api.metatileentity.implementations.GT_MetaTileEntity_BasicTank; -import gregtech.api.objects.GT_RenderedTexture; -import gregtech.api.util.GT_Config; -import gregtech.api.util.GT_Utility; -import gtPlusPlus.api.objects.Logger; -import gtPlusPlus.core.lib.CORE; -import gtPlusPlus.core.util.minecraft.PlayerUtils; -import gtPlusPlus.xmod.gregtech.common.blocks.textures.TexturesGtBlock; -import gtPlusPlus.xmod.gregtech.common.helpers.tesseract.TesseractHelper; - -public class GT_MetaTileEntity_TesseractGenerator extends GT_MetaTileEntity_BasicTank { - - public static int TESSERACT_ENERGY_COST_DIMENSIONAL = 512; - public static int TESSERACT_ENERGY_COST = 128; - public byte isWorking = 0; - public int oFrequency = 0; - public int mNeededEnergy = 0; - public int mFrequency = 0; - public UUID mOwner; - - public GT_MetaTileEntity_TesseractGenerator(final int aID, final String aName, final String aNameRegional, - final int aTier) { - super(aID, aName, aNameRegional, aTier, 3, ""); - } - - public GT_MetaTileEntity_TesseractGenerator(final String aName, final int aTier, final String[] aDescription, - final ITexture[][][] aTextures) { - super(aName, aTier, 3, aDescription, aTextures); - } - - @Override - public MetaTileEntity newMetaEntity(final IGregTechTileEntity aTileEntity) { - return new GT_MetaTileEntity_TesseractGenerator(this.mName, this.mTier, this.mDescriptionArray, this.mTextures); - } - - @Override - public boolean isTransformerUpgradable() { - return true; - } - - @Override - public boolean isOverclockerUpgradable() { - return false; - } - - @Override - public boolean isSimpleMachine() { - return false; - } - - @Override - public boolean isFacingValid(final ForgeDirection facing) { - return true; - } - - @Override - public boolean isEnetInput() { - return true; - } - - @Override - public boolean isEnetOutput() { - return false; - } - - @Override - public boolean isInputFacing(final ForgeDirection side) { - return true; - } - - @Override - public boolean isOutputFacing(final ForgeDirection side) { - return side == this.getBaseMetaTileEntity() - .getBackFacing(); - } - - @Override - public boolean isValidSlot(final int aIndex) { - return false; - } - - @Override - public long getMinimumStoredEU() { - return this.getBaseMetaTileEntity() - .getEUCapacity() / 2; - } - - @Override - public long maxEUInput() { - return 512; - } - - @Override - public long maxEUOutput() { - return 0; - } - - @Override - public long maxEUStore() { - return 512 * 32; - } - - @Override - public long maxSteamStore() { - return this.maxEUStore(); - } - - @Override - public boolean isAccessAllowed(final EntityPlayer aPlayer) { - return true; - } - - @Override - public boolean ownerControl() { - return true; - } - - @Override - public int getProgresstime() { - return (TesseractHelper.getGeneratorByFrequency(PlayerUtils.getPlayerOnServerFromUUID(mOwner), this.mFrequency) - == this) && (this.isWorking >= 20) ? 999 : 0; - } - - @Override - public int maxProgresstime() { - return 1000; - } - - @Override - public void saveNBTData(final NBTTagCompound aNBT) { - aNBT.setInteger("mFrequency", this.mFrequency); - if (mOwner != null) aNBT.setString("mOwner", mOwner.toString()); - } - - @Override - public void loadNBTData(final NBTTagCompound aNBT) { - this.mFrequency = aNBT.getInteger("mFrequency"); - try { - this.mOwner = UUID.fromString(aNBT.getString("mOnwer")); - } catch (IllegalArgumentException i) { - - } - } - - @Override - public void onConfigLoad(final GT_Config aConfig) { - int J = 4; - TESSERACT_ENERGY_COST = 128 * J; - TESSERACT_ENERGY_COST_DIMENSIONAL = 512 * J; - } - - @Override - public void onServerStart() { - sTesseractGeneratorOwnershipMap.clear(); - sTesseractTerminalOwnershipMap.clear(); - } - - public void onServerStop() { - sTesseractGeneratorOwnershipMap.clear(); - sTesseractTerminalOwnershipMap.clear(); - } - - @Override - public boolean onRightclick(final IGregTechTileEntity aBaseMetaTileEntity, final EntityPlayer aPlayer, - final ForgeDirection side, final float aX, final float aY, final float aZ) { - - if (this.mOwner == null) { - if (this.getBaseMetaTileEntity() - .getOwnerName() != null - && !this.getBaseMetaTileEntity() - .getOwnerName() - .equals("")) { - if (this.getBaseMetaTileEntity() - .getOwnerName() - .toLowerCase() - .equals( - aPlayer.getDisplayName() - .toLowerCase())) { - this.mOwner = PlayerUtils.getPlayersUUIDByName( - this.getBaseMetaTileEntity() - .getOwnerName()); - } - } - } - - if (side == this.getBaseMetaTileEntity() - .getFrontFacing()) { - if (aPlayer.getUniqueID() - .compareTo(this.mOwner) == 0) { - final float[] tCoords = GT_Utility.getClickedFacingCoords(side, aX, aY, aZ); - switch ((byte) ((byte) (int) (tCoords[0] * 2.0F) + (2 * (byte) (int) (tCoords[1] * 2.0F)))) { - case 0: - Logger.WARNING("Freq. -1 | " + this.mFrequency); - try { - CORE.sTesseractGeneratorOwnershipMap.get(mOwner) - .remove(this.mFrequency); - } catch (Throwable t) {} - this.mFrequency -= 1; - - break; - case 1: - Logger.WARNING("Freq. +1 | " + this.mFrequency); - try { - CORE.sTesseractGeneratorOwnershipMap.get(mOwner) - .remove(this.mFrequency); - } catch (Throwable t) {} - this.mFrequency += 1; - default: - // Utils.LOG_WARNING("Did not click the correct place."); - break; - } - if (getGeneratorEntity(this.mFrequency) != null && getGeneratorEntity(this.mFrequency) != this) { - GT_Utility.sendChatToPlayer( - aPlayer, - "Frequency: " + this.mFrequency + EnumChatFormatting.RED + " (Occupied)"); - } else { - GT_Utility.sendChatToPlayer(aPlayer, "Frequency: " + this.mFrequency); - } - } else if (aPlayer.getUniqueID() - .compareTo(this.mOwner) != 0) { - GT_Utility.sendChatToPlayer(aPlayer, "This is not your Tesseract Generator to configure."); - } - } - - return true; - } - - @Override - public void onScrewdriverRightClick(final ForgeDirection side, final EntityPlayer aPlayer, final float aX, - final float aY, final float aZ) { - if (aPlayer.getUniqueID() - .compareTo(this.mOwner) == 0) { - if (side == this.getBaseMetaTileEntity() - .getFrontFacing()) { - final float[] tCoords = GT_Utility.getClickedFacingCoords(side, aX, aY, aZ); - switch ((byte) ((byte) (int) (tCoords[0] * 2.0F) + (2 * (byte) (int) (tCoords[1] * 2.0F)))) { - case 0 -> { - try { - CORE.sTesseractGeneratorOwnershipMap.get(mOwner) - .remove(this.mFrequency); - } catch (Throwable t) {} - this.mFrequency -= 64; - } - case 1 -> { - try { - CORE.sTesseractGeneratorOwnershipMap.get(mOwner) - .remove(this.mFrequency); - } catch (Throwable t) {} - this.mFrequency += 64; - } - case 2 -> { - try { - CORE.sTesseractGeneratorOwnershipMap.get(mOwner) - .remove(this.mFrequency); - } catch (Throwable t) {} - this.mFrequency -= 512; - } - case 3 -> { - try { - CORE.sTesseractGeneratorOwnershipMap.get(mOwner) - .remove(this.mFrequency); - } catch (Throwable t) {} - this.mFrequency += 512; - } - } - if (getGeneratorEntity(this.mFrequency) != null && getGeneratorEntity(this.mFrequency) != this) { - GT_Utility.sendChatToPlayer( - aPlayer, - "Frequency: " + this.mFrequency + EnumChatFormatting.RED + " (Occupied)"); - } else { - GT_Utility.sendChatToPlayer(aPlayer, "Frequency: " + this.mFrequency); - } - } - } else { - GT_Utility.sendChatToPlayer(aPlayer, "This is not your Tesseract Generator to configure."); - } - } - - public boolean allowCoverOnSide(final ForgeDirection side, final int aCoverID) { - return side != this.getBaseMetaTileEntity() - .getFrontFacing(); - } - - @Override - public String[] getInfoData() { - final TileEntity tTileEntity = this.getBaseMetaTileEntity() - .getTileEntityAtSide( - this.getBaseMetaTileEntity() - .getBackFacing()); - if ((tTileEntity != null) && (this.getBaseMetaTileEntity() - .isAllowedToWork()) - && ((tTileEntity instanceof IGregTechDeviceInformation)) - && (((IGregTechDeviceInformation) tTileEntity).isGivingInformation())) { - return ((IGregTechDeviceInformation) tTileEntity).getInfoData(); - } - return new String[] { "Tesseract Generator", "Freqency:", "" + this.mFrequency, - (getGeneratorEntity() == this) && (this.isWorking >= 20) ? "Active" : "Inactive" }; - } - - @Override - public boolean isGivingInformation() { - return true; - } - - public boolean isSendingInformation() { - final TileEntity tTileEntity = this.getBaseMetaTileEntity() - .getTileEntityAtSide( - this.getBaseMetaTileEntity() - .getBackFacing()); - if ((tTileEntity != null) && (this.getBaseMetaTileEntity() - .isAllowedToWork()) && ((tTileEntity instanceof IGregTechDeviceInformation))) { - return ((IGregTechDeviceInformation) tTileEntity).isGivingInformation(); - } - return false; - } - - @Override - public boolean isDigitalChest() { - final TileEntity tTileEntity = this.getBaseMetaTileEntity() - .getTileEntityAtSide( - this.getBaseMetaTileEntity() - .getBackFacing()); - if ((tTileEntity != null) && (this.getBaseMetaTileEntity() - .isAllowedToWork()) && ((tTileEntity instanceof IDigitalChest))) { - return ((IDigitalChest) tTileEntity).isDigitalChest(); - } - return false; - } - - @Override - public ItemStack[] getStoredItemData() { - final TileEntity tTileEntity = this.getBaseMetaTileEntity() - .getTileEntityAtSide( - this.getBaseMetaTileEntity() - .getBackFacing()); - if ((tTileEntity != null) && (this.getBaseMetaTileEntity() - .isAllowedToWork()) && ((tTileEntity instanceof IDigitalChest))) { - return ((IDigitalChest) tTileEntity).getStoredItemData(); - } - return new ItemStack[] {}; - } - - @Override - public void setItemCount(final int aCount) { - final TileEntity tTileEntity = this.getBaseMetaTileEntity() - .getTileEntityAtSide( - this.getBaseMetaTileEntity() - .getBackFacing()); - if ((tTileEntity != null) && (this.getBaseMetaTileEntity() - .isAllowedToWork()) && ((tTileEntity instanceof IDigitalChest))) { - ((IDigitalChest) tTileEntity).setItemCount(aCount); - } - } - - @Override - public int getMaxItemCount() { - final TileEntity tTileEntity = this.getBaseMetaTileEntity() - .getTileEntityAtSide( - this.getBaseMetaTileEntity() - .getBackFacing()); - if ((tTileEntity != null) && (this.getBaseMetaTileEntity() - .isAllowedToWork()) && ((tTileEntity instanceof IDigitalChest))) { - return ((IDigitalChest) tTileEntity).getMaxItemCount(); - } - return 0; - } - - @Override - public boolean isItemValidForSlot(final int aIndex, final ItemStack aStack) { - final IInventory tTileEntity = this.getBaseMetaTileEntity() - .getIInventoryAtSide( - this.getBaseMetaTileEntity() - .getBackFacing()); - if ((tTileEntity == null) || (!this.getBaseMetaTileEntity() - .isAllowedToWork())) { - return false; - } - return tTileEntity.isItemValidForSlot(aIndex, aStack); - } - - @Override - public int[] getAccessibleSlotsFromSide(final int ordinalSide) { - final IInventory tTileEntity = this.getBaseMetaTileEntity() - .getIInventoryAtSide( - this.getBaseMetaTileEntity() - .getBackFacing()); - if ((tTileEntity == null) || (!this.getBaseMetaTileEntity() - .isAllowedToWork())) { - return new int[0]; - } - if ((tTileEntity instanceof ISidedInventory)) { - return ((ISidedInventory) tTileEntity).getAccessibleSlotsFromSide(ordinalSide); - } - final int[] rArray = new int[this.getSizeInventory()]; - for (int i = 0; i < this.getSizeInventory(); i++) { - rArray[i] = i; - } - return rArray; - } - - @Override - public boolean canInsertItem(final int aIndex, final ItemStack aStack, final int ordinalSide) { - final IInventory tTileEntity = this.getBaseMetaTileEntity() - .getIInventoryAtSide( - this.getBaseMetaTileEntity() - .getBackFacing()); - if ((tTileEntity == null) || (!this.getBaseMetaTileEntity() - .isAllowedToWork())) { - return false; - } - if ((tTileEntity instanceof ISidedInventory)) { - return ((ISidedInventory) tTileEntity).canInsertItem(aIndex, aStack, ordinalSide); - } - return true; - } - - @Override - public boolean canExtractItem(final int aIndex, final ItemStack aStack, final int ordinalSide) { - final IInventory tTileEntity = this.getBaseMetaTileEntity() - .getIInventoryAtSide( - this.getBaseMetaTileEntity() - .getBackFacing()); - if ((tTileEntity == null) || (!this.getBaseMetaTileEntity() - .isAllowedToWork())) { - return false; - } - if ((tTileEntity instanceof ISidedInventory)) { - return ((ISidedInventory) tTileEntity).canExtractItem(aIndex, aStack, ordinalSide); - } - return true; - } - - @Override - public int getSizeInventory() { - final IInventory tTileEntity = this.getBaseMetaTileEntity() - .getIInventoryAtSide( - this.getBaseMetaTileEntity() - .getBackFacing()); - if ((tTileEntity == null) || (!this.getBaseMetaTileEntity() - .isAllowedToWork())) { - return 0; - } - return tTileEntity.getSizeInventory(); - } - - @Override - public ItemStack getStackInSlot(final int aIndex) { - final IInventory tTileEntity = this.getBaseMetaTileEntity() - .getIInventoryAtSide( - this.getBaseMetaTileEntity() - .getBackFacing()); - if ((tTileEntity == null) || (!this.getBaseMetaTileEntity() - .isAllowedToWork())) { - return null; - } - return tTileEntity.getStackInSlot(aIndex); - } - - @Override - public void setInventorySlotContents(final int aIndex, final ItemStack aStack) { - final IInventory tTileEntity = this.getBaseMetaTileEntity() - .getIInventoryAtSide( - this.getBaseMetaTileEntity() - .getBackFacing()); - if ((tTileEntity == null) || (!this.getBaseMetaTileEntity() - .isAllowedToWork())) { - return; - } - tTileEntity.setInventorySlotContents(aIndex, aStack); - } - - @Override - public ItemStack decrStackSize(final int aIndex, final int aAmount) { - final IInventory tTileEntity = this.getBaseMetaTileEntity() - .getIInventoryAtSide( - this.getBaseMetaTileEntity() - .getBackFacing()); - if ((tTileEntity == null) || (!this.getBaseMetaTileEntity() - .isAllowedToWork())) { - return null; - } - return tTileEntity.decrStackSize(aIndex, aAmount); - } - - @Override - public String getInventoryName() { - final IInventory tTileEntity = this.getBaseMetaTileEntity() - .getIInventoryAtSide( - this.getBaseMetaTileEntity() - .getBackFacing()); - if ((tTileEntity == null) || (!this.getBaseMetaTileEntity() - .isAllowedToWork())) { - return ""; - } - return tTileEntity.getInventoryName(); - } - - @Override - public int getInventoryStackLimit() { - final IInventory tTileEntity = this.getBaseMetaTileEntity() - .getIInventoryAtSide( - this.getBaseMetaTileEntity() - .getBackFacing()); - if ((tTileEntity == null) || (!this.getBaseMetaTileEntity() - .isAllowedToWork())) { - return 0; - } - return tTileEntity.getInventoryStackLimit(); - } - - @Override - public boolean canFill(final ForgeDirection aSide, final Fluid aFluid) { - final IFluidHandler tTileEntity = this.getBaseMetaTileEntity() - .getITankContainerAtSide( - this.getBaseMetaTileEntity() - .getBackFacing()); - if ((tTileEntity == null) || (!this.getBaseMetaTileEntity() - .isAllowedToWork())) { - return false; - } - return tTileEntity.canFill(aSide, aFluid); - } - - @Override - public boolean canDrain(final ForgeDirection aSide, final Fluid aFluid) { - final IFluidHandler tTileEntity = this.getBaseMetaTileEntity() - .getITankContainerAtSide( - this.getBaseMetaTileEntity() - .getBackFacing()); - if ((tTileEntity == null) || (!this.getBaseMetaTileEntity() - .isAllowedToWork())) { - return false; - } - return tTileEntity.canDrain(aSide, aFluid); - } - - @Override - public FluidTankInfo[] getTankInfo(final ForgeDirection aSide) { - final IFluidHandler tTileEntity = this.getBaseMetaTileEntity() - .getITankContainerAtSide( - this.getBaseMetaTileEntity() - .getBackFacing()); - if ((tTileEntity == null) || (!this.getBaseMetaTileEntity() - .isAllowedToWork())) { - return new FluidTankInfo[0]; - } - return tTileEntity.getTankInfo(aSide); - } - - @Override - public int fill_default(final ForgeDirection aDirection, final FluidStack aFluid, final boolean doFill) { - final IFluidHandler tTileEntity = this.getBaseMetaTileEntity() - .getITankContainerAtSide( - this.getBaseMetaTileEntity() - .getBackFacing()); - if ((tTileEntity == null) || (!this.getBaseMetaTileEntity() - .isAllowedToWork())) { - return 0; - } - return tTileEntity.fill(aDirection, aFluid, doFill); - } - - @Override - public FluidStack drain(final ForgeDirection aDirection, final int maxDrain, final boolean doDrain) { - final IFluidHandler tTileEntity = this.getBaseMetaTileEntity() - .getITankContainerAtSide( - this.getBaseMetaTileEntity() - .getBackFacing()); - if ((tTileEntity == null) || (!this.getBaseMetaTileEntity() - .isAllowedToWork())) { - return null; - } - return tTileEntity.drain(aDirection, maxDrain, doDrain); - } - - @Override - public FluidStack drain(final ForgeDirection aSide, final FluidStack aFluid, final boolean doDrain) { - final IFluidHandler tTileEntity = this.getBaseMetaTileEntity() - .getITankContainerAtSide( - this.getBaseMetaTileEntity() - .getBackFacing()); - if ((tTileEntity == null) || (!this.getBaseMetaTileEntity() - .isAllowedToWork())) { - return null; - } - return tTileEntity.drain(aSide, aFluid, doDrain); - } - - public boolean addEnergyConsumption(final GT_MetaTileEntity_TesseractTerminal aTerminal) { - if (!this.getBaseMetaTileEntity() - .isAllowedToWork()) { - return false; - } - int J = (aTerminal.getBaseMetaTileEntity() - .getWorld() - == this.getBaseMetaTileEntity() - .getWorld() ? TESSERACT_ENERGY_COST : TESSERACT_ENERGY_COST_DIMENSIONAL); - - J *= 4; - - this.mNeededEnergy += J; - - return true; - } - - public boolean isValidTesseractGenerator(final String aOwnerName, final boolean aWorkIrrelevant) { - return (this.getBaseMetaTileEntity() != null) && (!this.getBaseMetaTileEntity() - .isInvalidTileEntity()) - && (this.getBaseMetaTileEntity() - .isAllowedToWork()) - && ((aOwnerName == null) || (this.getBaseMetaTileEntity() - .getOwnerName() - .equals(aOwnerName))) - && ((aWorkIrrelevant) || (this.isWorking >= 20)); - } - - @Override - public void onPreTick(IGregTechTileEntity aBaseMetaTileEntity, long aTick) { - // TODO Auto-generated method stub - super.onPreTick(aBaseMetaTileEntity, aTick); - } - - @Override - public void onPostTick(IGregTechTileEntity aBaseMetaTileEntity, long aTick) { - // Utils.LOG_WARNING("Ticking Generator. 0"); - if (this.getBaseMetaTileEntity() - .isServerSide()) { - // Utils.LOG_WARNING("Ticking Generator."); - // Set owner - if (PlayerUtils.getPlayersUUIDByName( - this.getBaseMetaTileEntity() - .getOwnerName()) - != null) { - if (this.mOwner == null) { - Logger.WARNING("Setting Generators Owner. 1"); - this.mOwner = PlayerUtils.getPlayersUUIDByName( - this.getBaseMetaTileEntity() - .getOwnerName()); - } - } - - if (this.mFrequency != this.oFrequency) { - - Logger.WARNING("mFreq != oFreq"); - - if (getGeneratorEntity() == this) { - getGeneratorEntity(this.oFrequency); - this.getBaseMetaTileEntity() - .issueBlockUpdate(); - Logger.WARNING("this Gen == oFreq on map - do block update"); - } - Logger.WARNING("mFreq will be set to oFreq"); - this.oFrequency = this.mFrequency; - } - if ((this.getBaseMetaTileEntity() - .isAllowedToWork()) - && (this.getBaseMetaTileEntity() - .decreaseStoredEnergyUnits(this.mNeededEnergy, false))) { - // Utils.LOG_WARNING("Can Work & Has Energy"); - if ((getGeneratorEntity(Integer.valueOf(this.mFrequency)) == null) - || (!getGeneratorEntity(Integer.valueOf(this.mFrequency)).isValidTesseractGenerator(null, true))) { - // Utils.LOG_WARNING("storing TE I think to mFreq map?"); - TesseractHelper.setGeneratorOwnershipByPlayer( - PlayerUtils.getPlayerOnServerFromUUID(mOwner), - this.mFrequency, - this); - } - } else { - if (getGeneratorEntity(Integer.valueOf(this.mFrequency)) == this) { - Logger.WARNING("this gen == mFreq on map - do block update"); - TesseractHelper.removeGenerator(PlayerUtils.getPlayerOnServerFromUUID(mOwner), this.mFrequency); - this.getBaseMetaTileEntity() - .issueBlockUpdate(); - } - this.isWorking = 0; - } - if (getGeneratorEntity(Integer.valueOf(this.mFrequency)) == this) { - // Utils.LOG_WARNING("mFreq == this - do work related things"); - if (this.isWorking < 20) { - this.isWorking = ((byte) (this.isWorking + 1)); - } - if (this.isWorking == 20) { - this.getBaseMetaTileEntity() - .issueBlockUpdate(); - this.isWorking = ((byte) (this.isWorking + 1)); - } - } else { - this.isWorking = 0; - } - this.mNeededEnergy = 0; - } - super.onPostTick(aBaseMetaTileEntity, aTick); - } - - @Override - public String[] getDescription() { - return ArrayUtils.addAll( - this.mDescriptionArray, - "Generates a Tesseract for the attached Inventory", - "Connect with pipes to insert items", - "Consumes " + TESSERACT_ENERGY_COST + "EU/t for same dimension transfers", - "Consumes " + TESSERACT_ENERGY_COST_DIMENSIONAL + "EU/t for cross dimensional transfers", - CORE.GT_Tooltip.get()); - } - - @Override - public boolean allowPullStack(final IGregTechTileEntity aBaseMetaTileEntity, final int aIndex, - final ForgeDirection side, final ItemStack aStack) { - return false; - } - - @Override - public boolean allowPutStack(final IGregTechTileEntity aBaseMetaTileEntity, final int aIndex, - final ForgeDirection side, final ItemStack aStack) { - return false; - } - - @Override - public ITexture[][][] getTextureSet(final ITexture[] aTextures) { - return new ITexture[0][0][0]; - } - - @Override - public ITexture[] getTexture(final IGregTechTileEntity aBaseMetaTileEntity, final ForgeDirection side, - final ForgeDirection facing, final int aColorIndex, final boolean aActive, final boolean aRedstone) { - return side == facing - ? new ITexture[] { new GT_RenderedTexture(TexturesGtBlock.Casing_Machine_Dimensional), - new GT_RenderedTexture(TexturesGtBlock.Casing_Machine_Screen_Frequency) } - : new ITexture[] { new GT_RenderedTexture(TexturesGtBlock.Casing_Machine_Dimensional), - new GT_RenderedTexture(Textures.BlockIcons.VOID) }; - } - - // To-Do? - @Override - public boolean doesFillContainers() { - return false; - } - - @Override - public boolean doesEmptyContainers() { - return false; - } - - @Override - public boolean canTankBeFilled() { - return false; - } - - @Override - public boolean canTankBeEmptied() { - return false; - } - - @Override - public boolean displaysItemStack() { - return false; - } - - @Override - public boolean displaysStackSize() { - return false; - } - - private GT_MetaTileEntity_TesseractGenerator getGeneratorEntity() { - GT_MetaTileEntity_TesseractGenerator thisGenerator = TesseractHelper - .getGeneratorByFrequency(PlayerUtils.getPlayerOnServerFromUUID(mOwner), this.mFrequency); - if (thisGenerator != null) { - return thisGenerator; - } - return null; - } - - private GT_MetaTileEntity_TesseractGenerator getGeneratorEntity(int frequency) { - GT_MetaTileEntity_TesseractGenerator thisGenerator = TesseractHelper - .getGeneratorByFrequency(PlayerUtils.getPlayerOnServerFromUUID(mOwner), frequency); - if (thisGenerator != null) { - return thisGenerator; - } - return null; - } - - @Override - public void onCreated(ItemStack aStack, World aWorld, EntityPlayer aPlayer) { - if (this.getBaseMetaTileEntity() - .getOwnerName() != null - && !this.getBaseMetaTileEntity() - .getOwnerName() - .equals("")) { - this.mOwner = PlayerUtils.getPlayersUUIDByName( - this.getBaseMetaTileEntity() - .getOwnerName()); - Logger.WARNING("Setting Generators Owner. 2"); - } - super.onCreated(aStack, aWorld, aPlayer); - } - - @Override - public void onRemoval() { - try { - CORE.sTesseractGeneratorOwnershipMap.get(mOwner) - .remove(this.mFrequency); - } catch (Throwable t) {} - super.onRemoval(); - } -} diff --git a/gtpp/src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/automation/GT_MetaTileEntity_TesseractTerminal.java b/gtpp/src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/automation/GT_MetaTileEntity_TesseractTerminal.java deleted file mode 100644 index 659f34e0d8..0000000000 --- a/gtpp/src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/automation/GT_MetaTileEntity_TesseractTerminal.java +++ /dev/null @@ -1,644 +0,0 @@ -package gtPlusPlus.xmod.gregtech.common.tileentities.automation; - -import java.util.UUID; - -import net.minecraft.entity.player.EntityPlayer; -import net.minecraft.item.ItemStack; -import net.minecraft.nbt.NBTTagCompound; -import net.minecraft.util.EnumChatFormatting; -import net.minecraft.world.World; -import net.minecraftforge.common.util.ForgeDirection; -import net.minecraftforge.fluids.Fluid; -import net.minecraftforge.fluids.FluidStack; -import net.minecraftforge.fluids.FluidTankInfo; - -import org.apache.commons.lang3.ArrayUtils; - -import gregtech.api.enums.Textures; -import gregtech.api.interfaces.ITexture; -import gregtech.api.interfaces.tileentity.IGregTechTileEntity; -import gregtech.api.metatileentity.MetaTileEntity; -import gregtech.api.metatileentity.implementations.GT_MetaTileEntity_BasicTank; -import gregtech.api.objects.GT_RenderedTexture; -import gregtech.api.util.GT_Config; -import gregtech.api.util.GT_Utility; -import gtPlusPlus.core.lib.CORE; -import gtPlusPlus.core.util.minecraft.PlayerUtils; -import gtPlusPlus.xmod.gregtech.common.blocks.textures.TexturesGtBlock; -import gtPlusPlus.xmod.gregtech.common.helpers.tesseract.TesseractHelper; - -public class GT_MetaTileEntity_TesseractTerminal extends GT_MetaTileEntity_BasicTank { - - public int mFrequency = 0; - public UUID mOwner; - public boolean mDidWork = false; - public static boolean sInterDimensionalTesseractAllowed = true; - private static int TESSERACT_ENERGY_COST = 128; - private static int TESSERACT_ENERGY_COST_DIMENSIONAL = 512; - - public GT_MetaTileEntity_TesseractTerminal(final int aID, final String aName, final String aNameRegional, - final int aTier) { - super(aID, aName, aNameRegional, aTier, 3, ""); - } - - public GT_MetaTileEntity_TesseractTerminal(final String aName, final int aTier, final String[] aDescription, - final ITexture[][][] aTextures) { - super(aName, aTier, 3, aDescription, aTextures); - } - - @Override - public MetaTileEntity newMetaEntity(final IGregTechTileEntity aTileEntity) { - return new GT_MetaTileEntity_TesseractTerminal(this.mName, this.mTier, this.mDescriptionArray, this.mTextures); - } - - @Override - public boolean isTransformerUpgradable() { - return false; - } - - @Override - public boolean isOverclockerUpgradable() { - return false; - } - - @Override - public boolean isSimpleMachine() { - return false; - } - - @Override - public boolean isFacingValid(final ForgeDirection facing) { - return true; - } - - @Override - public boolean isOutputFacing(final ForgeDirection side) { - return side == this.getBaseMetaTileEntity() - .getBackFacing(); - } - - @Override - public boolean isValidSlot(final int aIndex) { - return false; - } - - @Override - public long getMinimumStoredEU() { - return (this.getBaseMetaTileEntity() - .getEUCapacity() / 100); - } - - @Override - public long maxEUInput() { - return TESSERACT_ENERGY_COST_DIMENSIONAL; - } - - @Override - public boolean isAccessAllowed(final EntityPlayer aPlayer) { - return true; - } - - @Override - public long maxEUStore() { - return TESSERACT_ENERGY_COST_DIMENSIONAL * 8 * 32; - } - - @Override - public long maxSteamStore() { - return this.maxEUStore(); - } - - @Override - public boolean ownerControl() { - return true; - } - - @Override - public int getProgresstime() { - return this.getTesseract(this.mFrequency, false) != null ? 999 : 0; - } - - @Override - public int maxProgresstime() { - return 1000; - } - - @Override - public void saveNBTData(final NBTTagCompound aNBT) { - aNBT.setInteger("mFrequency", this.mFrequency); - aNBT.setString("mOwner", mOwner.toString()); - } - - @Override - public void loadNBTData(final NBTTagCompound aNBT) { - this.mFrequency = aNBT.getInteger("mFrequency"); - this.mOwner = UUID.fromString(aNBT.getString("mOnwer")); - } - - @Override - public void onConfigLoad(final GT_Config aConfig) { - sInterDimensionalTesseractAllowed = true; - TESSERACT_ENERGY_COST = 512; - TESSERACT_ENERGY_COST_DIMENSIONAL = 2048; - } - - @Override - public boolean onRightclick(final IGregTechTileEntity aBaseMetaTileEntity, final EntityPlayer aPlayer, - final ForgeDirection side, final float aX, final float aY, final float aZ) { - - if (this.mOwner == null) { - if (this.getBaseMetaTileEntity() - .getOwnerName() != null - && !this.getBaseMetaTileEntity() - .getOwnerName() - .equals("")) { - if (this.getBaseMetaTileEntity() - .getOwnerName() - .toLowerCase() - .equals( - aPlayer.getDisplayName() - .toLowerCase())) { - this.mOwner = PlayerUtils.getPlayersUUIDByName( - this.getBaseMetaTileEntity() - .getOwnerName()); - } - } - } - - if (aPlayer.getUniqueID() - .compareTo(this.mOwner) == 0) { - if (side == this.getBaseMetaTileEntity() - .getFrontFacing()) { - final float[] tCoords = GT_Utility.getClickedFacingCoords(side, aX, aY, aZ); - switch ((byte) ((byte) (int) (tCoords[0] * 2.0F) + (2 * (byte) (int) (tCoords[1] * 2.0F)))) { - case 0: - // Utils.LOG_WARNING("Freq. -1 | " + this.mFrequency); - try { - CORE.sTesseractTerminalOwnershipMap.get(mOwner) - .remove(this.mFrequency); - } catch (Throwable t) {} - this.mFrequency -= 1; - break; - case 1: - // Utils.LOG_WARNING("Freq. +1 | " + this.mFrequency); - try { - CORE.sTesseractTerminalOwnershipMap.get(mOwner) - .remove(this.mFrequency); - } catch (Throwable t) {} - this.mFrequency += 1; - default: - // Utils.LOG_WARNING("Did not click the correct place."); - try { - CORE.sTesseractTerminalOwnershipMap.get(mOwner) - .remove(this.mFrequency); - } catch (Throwable t) {} - break; - } - PlayerUtils.messagePlayer(aPlayer, "Frequency: " + this.mFrequency); - if (this.getTesseract(this.mFrequency, false) != null) { - PlayerUtils.messagePlayer( - aPlayer, - new StringBuilder().append(EnumChatFormatting.GREEN) - .append(" (Connected)") - .toString()); - } - } - } else if (aPlayer.getUniqueID() - .compareTo(this.mOwner) != 0) { - GT_Utility.sendChatToPlayer(aPlayer, "This is not your Tesseract Terminal to configure."); - } - return true; - } - - @Override - public void onScrewdriverRightClick(final ForgeDirection side, final EntityPlayer aPlayer, final float aX, - final float aY, final float aZ) { - if (aPlayer.getUniqueID() - .compareTo(this.mOwner) == 0) { - if (side == this.getBaseMetaTileEntity() - .getFrontFacing()) { - final float[] tCoords = GT_Utility.getClickedFacingCoords(side, aX, aY, aZ); - switch ((byte) ((byte) (int) (tCoords[0] * 2.0F) + (2 * (byte) (int) (tCoords[1] * 2.0F)))) { - case 0 -> { - try { - CORE.sTesseractTerminalOwnershipMap.get(mOwner) - .remove(this.mFrequency); - } catch (Throwable t) {} - this.mFrequency -= 64; - } - case 1 -> { - try { - CORE.sTesseractTerminalOwnershipMap.get(mOwner) - .remove(this.mFrequency); - } catch (Throwable t) {} - this.mFrequency += 64; - } - case 2 -> { - try { - CORE.sTesseractTerminalOwnershipMap.get(mOwner) - .remove(this.mFrequency); - } catch (Throwable t) {} - this.mFrequency -= 512; - } - case 3 -> { - try { - CORE.sTesseractTerminalOwnershipMap.get(mOwner) - .remove(this.mFrequency); - } catch (Throwable t) {} - this.mFrequency += 512; - } - } - GT_Utility.sendChatToPlayer( - aPlayer, - "Frequency: " + this.mFrequency - + (this.getTesseract(this.mFrequency, false) == null ? "" - : new StringBuilder().append(EnumChatFormatting.GREEN) - .append(" (Connected)") - .toString())); - } - } else if (aPlayer.getUniqueID() - .compareTo(this.mOwner) != 0) { - GT_Utility.sendChatToPlayer(aPlayer, "This is not your Tesseract Terminal to configure."); - } - } - - public boolean allowCoverOnSide(final ForgeDirection side, final int aCoverID) { - return side != this.getBaseMetaTileEntity() - .getFrontFacing(); - } - - public GT_MetaTileEntity_TesseractGenerator getTesseract(final int aFrequency, final boolean aWorkIrrelevant) { - final GT_MetaTileEntity_TesseractGenerator rTesseract = TesseractHelper - .getGeneratorByFrequency(PlayerUtils.getPlayerOnServerFromUUID(mOwner), aFrequency); - if (rTesseract == null) { - return null; - } - if (!TesseractHelper.isGeneratorOwnedByPlayer(PlayerUtils.getPlayerOnServerFromUUID(mOwner), rTesseract)) { - return null; - } - if (rTesseract.mFrequency != aFrequency) { - TesseractHelper.setTerminalOwnershipByPlayer( - PlayerUtils.getPlayerOnServerFromUUID(mOwner), - Integer.valueOf(aFrequency), - null); - return null; - } - if (!rTesseract.isValidTesseractGenerator( - this.getBaseMetaTileEntity() - .getOwnerName(), - aWorkIrrelevant)) { - return null; - } - if ((!sInterDimensionalTesseractAllowed) && (rTesseract.getBaseMetaTileEntity() - .getWorld() - != this.getBaseMetaTileEntity() - .getWorld())) { - return null; - } - return rTesseract; - } - - @Override - public String[] getInfoData() { - final GT_MetaTileEntity_TesseractGenerator tTileEntity = this.getTesseract(this.mFrequency, false); - if ((tTileEntity != null) && (this.getBaseMetaTileEntity() - .isAllowedToWork()) && (tTileEntity.isSendingInformation())) { - return tTileEntity.getInfoData(); - } - return new String[] { "Tesseract Generator", "Freqency:", "" + this.mFrequency, - this.getTesseract(this.mFrequency, false) != null ? "Active" : "Inactive" }; - } - - @Override - public boolean isGivingInformation() { - return true; - } - - @Override - public boolean isDigitalChest() { - final GT_MetaTileEntity_TesseractGenerator tTileEntity = this.getTesseract(this.mFrequency, false); - if ((tTileEntity == null) || (!this.getBaseMetaTileEntity() - .isAllowedToWork())) { - return false; - } - return tTileEntity.isDigitalChest(); - } - - @Override - public ItemStack[] getStoredItemData() { - final GT_MetaTileEntity_TesseractGenerator tTileEntity = this.getTesseract(this.mFrequency, false); - if ((tTileEntity == null) || (!this.getBaseMetaTileEntity() - .isAllowedToWork())) { - return null; - } - return tTileEntity.getStoredItemData(); - } - - @Override - public void setItemCount(final int aCount) { - final GT_MetaTileEntity_TesseractGenerator tTileEntity = this.getTesseract(this.mFrequency, false); - if ((tTileEntity == null) || (!this.getBaseMetaTileEntity() - .isAllowedToWork())) { - return; - } - tTileEntity.setItemCount(aCount); - } - - @Override - public int getMaxItemCount() { - final GT_MetaTileEntity_TesseractGenerator tTileEntity = this.getTesseract(this.mFrequency, false); - if ((tTileEntity == null) || (!this.getBaseMetaTileEntity() - .isAllowedToWork())) { - return 0; - } - return tTileEntity.getMaxItemCount(); - } - - @Override - public boolean isItemValidForSlot(final int aIndex, final ItemStack aStack) { - final GT_MetaTileEntity_TesseractGenerator tTileEntity = this.getTesseract(this.mFrequency, false); - if ((tTileEntity == null) || (!this.getBaseMetaTileEntity() - .isAllowedToWork())) { - return false; - } - return tTileEntity.isItemValidForSlot(aIndex, aStack); - } - - @Override - public int[] getAccessibleSlotsFromSide(final int ordinalSide) { - final GT_MetaTileEntity_TesseractGenerator tTileEntity = this.getTesseract(this.mFrequency, false); - if ((tTileEntity == null) || (!this.getBaseMetaTileEntity() - .isAllowedToWork())) { - return new int[0]; - } - return tTileEntity.getAccessibleSlotsFromSide(ordinalSide); - } - - @Override - public boolean canInsertItem(final int aIndex, final ItemStack aStack, final int ordinalSide) { - final GT_MetaTileEntity_TesseractGenerator tTileEntity = this.getTesseract(this.mFrequency, false); - if ((tTileEntity == null) || (!this.getBaseMetaTileEntity() - .isAllowedToWork())) { - return false; - } - return tTileEntity.canInsertItem(aIndex, aStack, ordinalSide); - } - - @Override - public boolean canExtractItem(final int aIndex, final ItemStack aStack, final int ordinalSide) { - final GT_MetaTileEntity_TesseractGenerator tTileEntity = this.getTesseract(this.mFrequency, false); - if ((tTileEntity == null) || (!this.getBaseMetaTileEntity() - .isAllowedToWork())) { - return false; - } - return tTileEntity.canExtractItem(aIndex, aStack, ordinalSide); - } - - @Override - public int getSizeInventory() { - final GT_MetaTileEntity_TesseractGenerator tTileEntity = this.getTesseract(this.mFrequency, false); - if ((tTileEntity == null) || (!this.getBaseMetaTileEntity() - .isAllowedToWork())) { - return 0; - } - return tTileEntity.getSizeInventory(); - } - - @Override - public ItemStack getStackInSlot(final int aIndex) { - final GT_MetaTileEntity_TesseractGenerator tTileEntity = this.getTesseract(this.mFrequency, false); - if ((tTileEntity == null) || (!this.getBaseMetaTileEntity() - .isAllowedToWork())) { - return null; - } - return tTileEntity.getStackInSlot(aIndex); - } - - @Override - public void setInventorySlotContents(final int aIndex, final ItemStack aStack) { - final GT_MetaTileEntity_TesseractGenerator tTileEntity = this.getTesseract(this.mFrequency, false); - if ((tTileEntity == null) || (!this.getBaseMetaTileEntity() - .isAllowedToWork())) { - return; - } - tTileEntity.setInventorySlotContents(aIndex, aStack); - } - - @Override - public ItemStack decrStackSize(final int aIndex, final int aAmount) { - final GT_MetaTileEntity_TesseractGenerator tTileEntity = this.getTesseract(this.mFrequency, false); - if ((tTileEntity == null) || (!this.getBaseMetaTileEntity() - .isAllowedToWork())) { - return null; - } - return tTileEntity.decrStackSize(aIndex, aAmount); - } - - @Override - public String getInventoryName() { - final GT_MetaTileEntity_TesseractGenerator tTileEntity = this.getTesseract(this.mFrequency, false); - if ((tTileEntity == null) || (!this.getBaseMetaTileEntity() - .isAllowedToWork())) { - return ""; - } - return tTileEntity.getInventoryName(); - } - - @Override - public int getInventoryStackLimit() { - final GT_MetaTileEntity_TesseractGenerator tTileEntity = this.getTesseract(this.mFrequency, false); - if ((tTileEntity == null) || (!this.getBaseMetaTileEntity() - .isAllowedToWork())) { - return 0; - } - return tTileEntity.getInventoryStackLimit(); - } - - @Override - public boolean canFill(final ForgeDirection aSide, final Fluid aFluid) { - final GT_MetaTileEntity_TesseractGenerator tTileEntity = this.getTesseract(this.mFrequency, false); - if ((tTileEntity == null) || (!this.getBaseMetaTileEntity() - .isAllowedToWork())) { - return false; - } - return tTileEntity.canFill(aSide, aFluid); - } - - @Override - public boolean canDrain(final ForgeDirection aSide, final Fluid aFluid) { - final GT_MetaTileEntity_TesseractGenerator tTileEntity = this.getTesseract(this.mFrequency, false); - if ((tTileEntity == null) || (!this.getBaseMetaTileEntity() - .isAllowedToWork())) { - return false; - } - return tTileEntity.canDrain(aSide, aFluid); - } - - @Override - public FluidTankInfo[] getTankInfo(final ForgeDirection aSide) { - final GT_MetaTileEntity_TesseractGenerator tTileEntity = this.getTesseract(this.mFrequency, false); - if ((tTileEntity == null) || (!this.getBaseMetaTileEntity() - .isAllowedToWork())) { - return new FluidTankInfo[0]; - } - return tTileEntity.getTankInfo(aSide); - } - - @Override - public int fill_default(final ForgeDirection aDirection, final FluidStack aFluid, final boolean doFill) { - final GT_MetaTileEntity_TesseractGenerator tTileEntity = this.getTesseract(this.mFrequency, false); - if ((tTileEntity == null) || (!this.getBaseMetaTileEntity() - .isAllowedToWork())) { - return 0; - } - return tTileEntity.fill(aDirection, aFluid, doFill); - } - - @Override - public FluidStack drain(final ForgeDirection aDirection, final int maxDrain, final boolean doDrain) { - final GT_MetaTileEntity_TesseractGenerator tTileEntity = this.getTesseract(this.mFrequency, false); - if ((tTileEntity == null) || (!this.getBaseMetaTileEntity() - .isAllowedToWork())) { - return null; - } - return tTileEntity.drain(aDirection, maxDrain, doDrain); - } - - @Override - public FluidStack drain(final ForgeDirection aSide, final FluidStack aFluid, final boolean doDrain) { - final GT_MetaTileEntity_TesseractGenerator tTileEntity = this.getTesseract(this.mFrequency, false); - if ((tTileEntity == null) || (!this.getBaseMetaTileEntity() - .isAllowedToWork())) { - return null; - } - return tTileEntity.drain(aSide, aFluid, doDrain); - } - - @Override - public void onPostTick(IGregTechTileEntity aBaseMetaTileEntity, long aTick) { - if ((this.getBaseMetaTileEntity() - .isServerSide()) - && (this.getBaseMetaTileEntity() - .isAllowedToWork())) { - // Set owner - if (PlayerUtils.getPlayersUUIDByName( - this.getBaseMetaTileEntity() - .getOwnerName()) - != null) { - if (this.mOwner == null) { - this.mOwner = PlayerUtils.getPlayersUUIDByName( - this.getBaseMetaTileEntity() - .getOwnerName()); - } - } - final GT_MetaTileEntity_TesseractGenerator tTileEntity = this.getTesseract(this.mFrequency, true); - if (tTileEntity != null) { - tTileEntity.addEnergyConsumption(this); - if ((!this.mDidWork) && (this.getTesseract(this.mFrequency, false) != null)) { - this.mDidWork = true; - this.getBaseMetaTileEntity() - .issueBlockUpdate(); - this.getBaseMetaTileEntity() - .decreaseStoredEnergyUnits(128, false); - } - } else if (this.mDidWork == true) { - this.mDidWork = false; - this.getBaseMetaTileEntity() - .issueBlockUpdate(); - } - } - } - - @Override - public String[] getDescription() { - return ArrayUtils.addAll( - this.mDescriptionArray, - "Accesses Tesseract Generators remotely", - "Connect with pipes to extract items or fluids", - "Outputs from the back face", - "Consumes " + TESSERACT_ENERGY_COST + "EU/t for same dimension transfers", - "Consumes " + TESSERACT_ENERGY_COST_DIMENSIONAL + "EU/t for cross dimensional transfers", - CORE.GT_Tooltip.get()); - } - - @Override - public boolean allowPullStack(final IGregTechTileEntity aBaseMetaTileEntity, final int aIndex, - final ForgeDirection side, final ItemStack aStack) { - return false; - } - - @Override - public boolean allowPutStack(final IGregTechTileEntity aBaseMetaTileEntity, final int aIndex, - final ForgeDirection side, final ItemStack aStack) { - return false; - } - - @Override - public ITexture[][][] getTextureSet(final ITexture[] aTextures) { - return new ITexture[0][0][0]; - } - - @Override - public ITexture[] getTexture(final IGregTechTileEntity aBaseMetaTileEntity, final ForgeDirection side, - final ForgeDirection facing, final int aColorIndex, final boolean aActive, final boolean aRedstone) { - return side == facing - ? new ITexture[] { new GT_RenderedTexture(TexturesGtBlock.Casing_Machine_Dimensional), - new GT_RenderedTexture(TexturesGtBlock.Casing_Machine_Screen_Frequency) } - : new ITexture[] { new GT_RenderedTexture(TexturesGtBlock.Casing_Machine_Dimensional), - new GT_RenderedTexture(Textures.BlockIcons.VOID) }; - } - - // To-Do? - @Override - public boolean doesFillContainers() { - return false; - } - - @Override - public boolean doesEmptyContainers() { - return false; - } - - @Override - public boolean canTankBeFilled() { - return false; - } - - @Override - public boolean canTankBeEmptied() { - return false; - } - - @Override - public boolean displaysItemStack() { - return false; - } - - @Override - public boolean displaysStackSize() { - return false; - } - - @Override - public void onCreated(ItemStack aStack, World aWorld, EntityPlayer aPlayer) { - if (this.getBaseMetaTileEntity() - .getOwnerName() != null - && !this.getBaseMetaTileEntity() - .getOwnerName() - .equals("")) { - this.mOwner = PlayerUtils.getPlayersUUIDByName( - this.getBaseMetaTileEntity() - .getOwnerName()); - } - super.onCreated(aStack, aWorld, aPlayer); - } - - @Override - public void onRemoval() { - try { - CORE.sTesseractTerminalOwnershipMap.get(mOwner) - .remove(this.mFrequency); - } catch (Throwable t) {} - super.onRemoval(); - } -} diff --git a/gtpp/src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/generators/GT_MetaTileEntity_Boiler_Base.java b/gtpp/src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/generators/GT_MetaTileEntity_Boiler_Base.java deleted file mode 100644 index b27c1a759a..0000000000 --- a/gtpp/src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/generators/GT_MetaTileEntity_Boiler_Base.java +++ /dev/null @@ -1,333 +0,0 @@ -package gtPlusPlus.xmod.gregtech.common.tileentities.generators; - -import net.minecraft.item.ItemStack; -import net.minecraft.tileentity.TileEntityFurnace; -import net.minecraftforge.common.util.ForgeDirection; -import net.minecraftforge.fluids.FluidTankInfo; - -import org.apache.commons.lang3.ArrayUtils; - -import com.gtnewhorizons.modularui.api.drawable.IDrawable; -import com.gtnewhorizons.modularui.api.drawable.UITexture; - -import cpw.mods.fml.common.registry.GameRegistry; -import gregtech.api.enums.Materials; -import gregtech.api.enums.OrePrefixes; -import gregtech.api.enums.Textures; -import gregtech.api.gui.modularui.GT_UITextures; -import gregtech.api.gui.modularui.GUITextureSet; -import gregtech.api.interfaces.ITexture; -import gregtech.api.interfaces.tileentity.IGregTechTileEntity; -import gregtech.api.metatileentity.MetaTileEntity; -import gregtech.api.objects.GT_ItemStack; -import gregtech.api.objects.GT_RenderedTexture; -import gregtech.api.util.GT_OreDictUnificator; -import gregtech.common.tileentities.boilers.GT_MetaTileEntity_Boiler; -import gtPlusPlus.core.lib.CORE; -import gtPlusPlus.xmod.gregtech.api.gui.GTPP_UITextures; - -public class GT_MetaTileEntity_Boiler_Base extends GT_MetaTileEntity_Boiler { - - private final int steamPerSecond; - private final int tier; - - public GT_MetaTileEntity_Boiler_Base(int aID, String aNameRegional, int tier) { - super( - aID, - "electricboiler." + tier + ".tier.single", - aNameRegional, - "Produces " + (CORE.ConfigSwitches.boilerSteamPerSecond * tier) + "L of Steam per second"); - this.steamPerSecond = (CORE.ConfigSwitches.boilerSteamPerSecond * tier); - this.tier = tier; - } - - public GT_MetaTileEntity_Boiler_Base(String aName, int aTier, String[] aDescription, ITexture[][][] aTextures) { - super(aName, aTier, aDescription, aTextures); - this.steamPerSecond = (CORE.ConfigSwitches.boilerSteamPerSecond * aTier); - this.tier = aTier; - } - - @Override - public String[] getDescription() { - return ArrayUtils.addAll( - this.mDescriptionArray, - "Produces " + getPollution() + " pollution/sec", - "Consumes fuel only when temperature is less than 100C", - "Fuel with burn time greater than 500 is more efficient.", - "Doesn't explode if there's no water", - CORE.GT_Tooltip.get()); - } - - public ITexture getOverlayIcon() { - return new GT_RenderedTexture(Textures.BlockIcons.BOILER_FRONT); - } - - @Override - public ITexture[][][] getTextureSet(final ITexture[] aTextures) { - final ITexture[][][] rTextures = new ITexture[10][17][]; - for (byte i = -1; i < 16; i++) { - rTextures[0][i + 1] = this.getFront(i); - rTextures[1][i + 1] = this.getBack(i); - rTextures[2][i + 1] = this.getBottom(i); - rTextures[3][i + 1] = this.getTop(i); - rTextures[4][i + 1] = this.getSides(i); - rTextures[5][i + 1] = this.getFrontActive(i); - rTextures[6][i + 1] = this.getBackActive(i); - rTextures[7][i + 1] = this.getBottomActive(i); - rTextures[8][i + 1] = this.getTopActive(i); - rTextures[9][i + 1] = this.getSidesActive(i); - } - return rTextures; - } - - protected GT_RenderedTexture getCasingTexture() { - if (this.tier == 1) { - return new GT_RenderedTexture(Textures.BlockIcons.MACHINE_LV_SIDE); - } else if (this.tier == 2) { - return new GT_RenderedTexture(Textures.BlockIcons.MACHINE_MV_SIDE); - } else { - return new GT_RenderedTexture(Textures.BlockIcons.MACHINE_HV_SIDE); - } - } - - @Override - public ITexture[] getTexture(final IGregTechTileEntity aBaseMetaTileEntity, final ForgeDirection side, - final ForgeDirection facing, final int aColorIndex, final boolean aActive, final boolean aRedstone) { - return this.mTextures[(aActive ? 5 : 0) + (side == facing ? 0 - : side == facing.getOpposite() ? 1 - : side == ForgeDirection.DOWN ? 2 : side == ForgeDirection.UP ? 3 : 4)][aColorIndex + 1]; - } - - public ITexture[] getFront(final byte aColor) { - return new ITexture[] { Textures.BlockIcons.MACHINE_CASINGS[this.tier][aColor + 1], this.getCasingTexture() }; - } - - public ITexture[] getBack(final byte aColor) { - return this.getSides(aColor); - } - - public ITexture[] getBottom(final byte aColor) { - return this.getSides(aColor); - } - - public ITexture[] getTop(final byte aColor) { - return this.getSides(aColor); - } - - public ITexture[] getSides(final byte aColor) { - return new ITexture[] { Textures.BlockIcons.MACHINE_CASINGS[this.tier][aColor + 1], this.getCasingTexture() }; - } - - public ITexture[] getFrontActive(final byte aColor) { - return this.getFront(aColor); - } - - public ITexture[] getBackActive(final byte aColor) { - return this.getSides(aColor); - } - - public ITexture[] getBottomActive(final byte aColor) { - return this.getBottom(aColor); - } - - public ITexture[] getTopActive(final byte aColor) { - return this.getTop(aColor); - } - - public ITexture[] getSidesActive(final byte aColor) { - return this.getSides(aColor); - } - - @Override - public boolean isOutputFacing(final ForgeDirection side) { - return side != this.getBaseMetaTileEntity() - .getFrontFacing(); - } - - @Override - public boolean isFacingValid(final ForgeDirection side) { - return side.offsetY == 0; - } - - // Please find out what I do. - // I do stuff within the GUI. - // this.mTemperature = Math.min(54, Math.max(0, this.mTemperature * 54 / (((GT_MetaTileEntity_Boiler) - // this.mTileEntity.getMetaTileEntity()).maxProgresstime() - 10))); - @Override - public int maxProgresstime() { - return 1000 + (250 * tier); - } - - @Override - public boolean isElectric() { - return false; - } - - @Override - public int getCapacity() { - return (16000 + (16000 * tier)); - } - - // This type of machine can have different water and steam capacities. - @Override - public int getSteamCapacity() { - return 2 * getCapacity(); - } - - @Override - protected int getProductionPerSecond() { - return steamPerSecond; - } - - @Override - protected int getMaxTemperature() { - return maxProgresstime(); - } - - @Override - protected int getEnergyConsumption() { - return 2; - } - - @Override - protected int getCooldownInterval() { - return 40; - } - - @Override - protected int getHeatUpRate() { - return 10; - } - - @Override - protected void updateFuel(IGregTechTileEntity tile, long ticks) { - ItemStack fuelStack = this.mInventory[2]; - if (fuelStack == null) return; - - int burnTime = getBurnTime(fuelStack); - if (burnTime > 0 && this.mTemperature <= 101) { - consumeFuel(tile, fuelStack, burnTime); - } - } - - @Override - // Since this type of machine can have different water and steam capacities, we need to override getTankInfo() to - // support returning those different capacities. - public FluidTankInfo[] getTankInfo(ForgeDirection aSide) { - return new FluidTankInfo[] { new FluidTankInfo(this.mFluid, getCapacity()), - new FluidTankInfo(this.mSteam, getSteamCapacity()) }; - } - - @Override - public boolean allowPullStack(IGregTechTileEntity aBaseMetaTileEntity, int aIndex, ForgeDirection side, - ItemStack aStack) { - return aIndex == 1 || aIndex == 3; - } - - @Override - public boolean allowPutStack(IGregTechTileEntity aBaseMetaTileEntity, int aIndex, ForgeDirection side, - ItemStack aStack) { - return aIndex == 2; - } - - @Override - protected int getPollution() { - return (int) (CORE.ConfigSwitches.basePollutionPerSecondBoiler - * CORE.ConfigSwitches.pollutionReleasedByTierBoiler[this.tier]); - } - - @Override - public MetaTileEntity newMetaEntity(IGregTechTileEntity aTileEntity) { - return new GT_MetaTileEntity_Boiler_Base(this.mName, tier, this.mDescriptionArray, this.mTextures); - } - - @Override - protected void onDangerousWaterLack(IGregTechTileEntity tile, long ticks) { - // Smart boilers don't explode! - } - - /** - * Returns burn time if the stack is a valid fuel, otherwise return 0. - */ - private static int getBurnTime(ItemStack stack) { - int burnTime = GameRegistry.getFuelValue(stack); - if (burnTime <= 0) { - burnTime = TileEntityFurnace.getItemBurnTime(stack); - } - - return burnTime; - } - - public void consumeFuel(IGregTechTileEntity tile, ItemStack fuel, int burnTime) { - this.mProcessingEnergy += burnTime / 10; - this.mTemperature += burnTime / 500; // will add bonus temperature points if the burn time is pretty high - - tile.decrStackSize(2, 1); - if (tile.getRandomNumber(3) == 0) { - if (fuel.getDisplayName() - .toLowerCase() - .contains("charcoal") - || fuel.getDisplayName() - .toLowerCase() - .contains("coke")) { - tile.addStackToSlot(3, GT_OreDictUnificator.get(OrePrefixes.dustTiny, Materials.Ash, 1L)); - } else { - tile.addStackToSlot(3, GT_OreDictUnificator.get(OrePrefixes.dustTiny, Materials.DarkAsh, 1L)); - } - } - } - - @Override - public boolean allowCoverOnSide(ForgeDirection side, GT_ItemStack aCover) { - if (side != this.getBaseMetaTileEntity() - .getFrontFacing()) { - return true; - } - return super.allowCoverOnSide(side, aCover); - } - - @Override - public GUITextureSet getGUITextureSet() { - return GUITextureSet.DEFAULT; - } - - @Override - protected IDrawable[] getFuelSlotBackground() { - return new IDrawable[] { getGUITextureSet().getItemSlot(), GTPP_UITextures.OVERLAY_SLOT_COAL }; - } - - @Override - protected IDrawable[] getAshSlotBackground() { - return new IDrawable[] { getGUITextureSet().getItemSlot(), GT_UITextures.OVERLAY_SLOT_DUST }; - } - - @Override - public int getTitleColor() { - return COLOR_TITLE.get(); - } - - @Override - protected IDrawable getOverlaySlotIn() { - return GT_UITextures.OVERLAY_SLOT_IN; - } - - @Override - protected IDrawable getOverlaySlotOut() { - return GT_UITextures.OVERLAY_SLOT_OUT; - } - - @Override - protected IDrawable getOverlaySlotCanister() { - return GTPP_UITextures.OVERLAY_SLOT_CANISTER_DARK; - } - - @Override - protected UITexture getProgressbarEmpty() { - return GTPP_UITextures.PROGRESSBAR_BOILER_EMPTY; - } - - @Override - protected UITexture getProgressbarFuel() { - return GTPP_UITextures.PROGRESSBAR_FUEL; - } -} diff --git a/gtpp/src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/generators/GT_MetaTileEntity_Boiler_HV.java b/gtpp/src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/generators/GT_MetaTileEntity_Boiler_HV.java deleted file mode 100644 index e77915aa01..0000000000 --- a/gtpp/src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/generators/GT_MetaTileEntity_Boiler_HV.java +++ /dev/null @@ -1,52 +0,0 @@ -package gtPlusPlus.xmod.gregtech.common.tileentities.generators; - -import gregtech.api.enums.Textures; -import gregtech.api.interfaces.ITexture; -import gregtech.api.interfaces.tileentity.IGregTechTileEntity; -import gregtech.api.metatileentity.MetaTileEntity; -import gregtech.api.objects.GT_RenderedTexture; -import gtPlusPlus.xmod.gregtech.common.blocks.textures.TexturesGtBlock; - -public class GT_MetaTileEntity_Boiler_HV extends GT_MetaTileEntity_Boiler_Base { - - public GT_MetaTileEntity_Boiler_HV(int aID, String aNameRegional, int aBoilerTier) { - super(aID, aNameRegional, aBoilerTier); - } - - public GT_MetaTileEntity_Boiler_HV(String aName, int aTier, String[] aDescription, ITexture[][][] aTextures) { - super(aName, aTier, aDescription, aTextures); - } - - @Override - public MetaTileEntity newMetaEntity(IGregTechTileEntity aTileEntity) { - return new GT_MetaTileEntity_Boiler_HV(this.mName, 3, this.mDescriptionArray, this.mTextures); - } - - @Override - protected GT_RenderedTexture getCasingTexture() { - return new GT_RenderedTexture(Textures.BlockIcons.MACHINE_HV_SIDE); - } - - @Override - public ITexture[] getFront(final byte aColor) { - return new ITexture[] { super.getFront(aColor)[0], this.getCasingTexture(), - new GT_RenderedTexture(Textures.BlockIcons.BOILER_FRONT) }; - } - - @Override - public ITexture[] getTop(final byte aColor) { - return new ITexture[] { super.getTop(aColor)[0], this.getCasingTexture(), - new GT_RenderedTexture(TexturesGtBlock.Casing_Material_Talonite) }; - } - - @Override - public ITexture[] getFrontActive(final byte aColor) { - return new ITexture[] { super.getFrontActive(aColor)[0], this.getCasingTexture(), - new GT_RenderedTexture(Textures.BlockIcons.BOILER_FRONT_ACTIVE) }; - } - - @Override - public ITexture[] getTopActive(final byte aColor) { - return getTop(aColor); - } -} diff --git a/gtpp/src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/generators/GT_MetaTileEntity_Boiler_LV.java b/gtpp/src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/generators/GT_MetaTileEntity_Boiler_LV.java deleted file mode 100644 index 23abfe1e3f..0000000000 --- a/gtpp/src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/generators/GT_MetaTileEntity_Boiler_LV.java +++ /dev/null @@ -1,52 +0,0 @@ -package gtPlusPlus.xmod.gregtech.common.tileentities.generators; - -import gregtech.api.enums.Textures; -import gregtech.api.interfaces.ITexture; -import gregtech.api.interfaces.tileentity.IGregTechTileEntity; -import gregtech.api.metatileentity.MetaTileEntity; -import gregtech.api.objects.GT_RenderedTexture; -import gtPlusPlus.xmod.gregtech.common.blocks.textures.TexturesGtBlock; - -public class GT_MetaTileEntity_Boiler_LV extends GT_MetaTileEntity_Boiler_Base { - - public GT_MetaTileEntity_Boiler_LV(int aID, String aNameRegional, int aBoilerTier) { - super(aID, aNameRegional, aBoilerTier); - } - - public GT_MetaTileEntity_Boiler_LV(String aName, int aTier, String[] aDescription, ITexture[][][] aTextures) { - super(aName, aTier, aDescription, aTextures); - } - - @Override - public MetaTileEntity newMetaEntity(IGregTechTileEntity aTileEntity) { - return new GT_MetaTileEntity_Boiler_LV(this.mName, 1, this.mDescriptionArray, this.mTextures); - } - - @Override - protected GT_RenderedTexture getCasingTexture() { - return new GT_RenderedTexture(Textures.BlockIcons.MACHINE_LV_SIDE); - } - - @Override - public ITexture[] getFront(final byte aColor) { - return new ITexture[] { super.getFront(aColor)[0], this.getCasingTexture(), - new GT_RenderedTexture(Textures.BlockIcons.BOILER_FRONT) }; - } - - @Override - public ITexture[] getTop(final byte aColor) { - return new ITexture[] { super.getTop(aColor)[0], this.getCasingTexture(), - new GT_RenderedTexture(TexturesGtBlock.Casing_Material_Potin) }; - } - - @Override - public ITexture[] getFrontActive(final byte aColor) { - return new ITexture[] { super.getFrontActive(aColor)[0], this.getCasingTexture(), - new GT_RenderedTexture(Textures.BlockIcons.BOILER_FRONT_ACTIVE) }; - } - - @Override - public ITexture[] getTopActive(final byte aColor) { - return getTop(aColor); - } -} diff --git a/gtpp/src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/generators/GT_MetaTileEntity_Boiler_MV.java b/gtpp/src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/generators/GT_MetaTileEntity_Boiler_MV.java deleted file mode 100644 index 379f67b55d..0000000000 --- a/gtpp/src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/generators/GT_MetaTileEntity_Boiler_MV.java +++ /dev/null @@ -1,52 +0,0 @@ -package gtPlusPlus.xmod.gregtech.common.tileentities.generators; - -import gregtech.api.enums.Textures; -import gregtech.api.interfaces.ITexture; -import gregtech.api.interfaces.tileentity.IGregTechTileEntity; -import gregtech.api.metatileentity.MetaTileEntity; -import gregtech.api.objects.GT_RenderedTexture; -import gtPlusPlus.xmod.gregtech.common.blocks.textures.TexturesGtBlock; - -public class GT_MetaTileEntity_Boiler_MV extends GT_MetaTileEntity_Boiler_Base { - - public GT_MetaTileEntity_Boiler_MV(int aID, String aNameRegional, int aBoilerTier) { - super(aID, aNameRegional, aBoilerTier); - } - - public GT_MetaTileEntity_Boiler_MV(String aName, int aTier, String[] aDescription, ITexture[][][] aTextures) { - super(aName, aTier, aDescription, aTextures); - } - - @Override - public MetaTileEntity newMetaEntity(IGregTechTileEntity aTileEntity) { - return new GT_MetaTileEntity_Boiler_MV(this.mName, 2, this.mDescriptionArray, this.mTextures); - } - - @Override - protected GT_RenderedTexture getCasingTexture() { - return new GT_RenderedTexture(Textures.BlockIcons.MACHINE_MV_SIDE); - } - - @Override - public ITexture[] getFront(final byte aColor) { - return new ITexture[] { super.getFront(aColor)[0], this.getCasingTexture(), - new GT_RenderedTexture(Textures.BlockIcons.BOILER_FRONT) }; - } - - @Override - public ITexture[] getTop(final byte aColor) { - return new ITexture[] { super.getTop(aColor)[0], this.getCasingTexture(), - new GT_RenderedTexture(TexturesGtBlock.Casing_Material_Tumbaga) }; - } - - @Override - public ITexture[] getFrontActive(final byte aColor) { - return new ITexture[] { super.getFrontActive(aColor)[0], this.getCasingTexture(), - new GT_RenderedTexture(Textures.BlockIcons.BOILER_FRONT_ACTIVE) }; - } - - @Override - public ITexture[] getTopActive(final byte aColor) { - return getTop(aColor); - } -} diff --git a/gtpp/src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/generators/GT_MetaTileEntity_SemiFluidGenerator.java b/gtpp/src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/generators/GT_MetaTileEntity_SemiFluidGenerator.java deleted file mode 100644 index 993b0e9035..0000000000 --- a/gtpp/src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/generators/GT_MetaTileEntity_SemiFluidGenerator.java +++ /dev/null @@ -1,173 +0,0 @@ -package gtPlusPlus.xmod.gregtech.common.tileentities.generators; - -import net.minecraft.item.ItemStack; -import net.minecraftforge.common.util.ForgeDirection; - -import org.apache.commons.lang3.ArrayUtils; - -import cpw.mods.fml.common.registry.GameRegistry; -import gregtech.api.GregTech_API; -import gregtech.api.enums.ConfigCategories; -import gregtech.api.enums.ItemList; -import gregtech.api.enums.Textures; -import gregtech.api.interfaces.ITexture; -import gregtech.api.interfaces.tileentity.IGregTechTileEntity; -import gregtech.api.metatileentity.MetaTileEntity; -import gregtech.api.metatileentity.implementations.GT_MetaTileEntity_BasicGenerator; -import gregtech.api.objects.GT_ItemStack; -import gregtech.api.objects.GT_RenderedTexture; -import gregtech.api.recipe.RecipeMap; -import gregtech.api.util.GT_ModHandler; -import gregtech.api.util.GT_Utility; -import gtPlusPlus.api.objects.Logger; -import gtPlusPlus.api.recipe.GTPPRecipeMaps; -import gtPlusPlus.core.lib.CORE; - -public class GT_MetaTileEntity_SemiFluidGenerator extends GT_MetaTileEntity_BasicGenerator { - - public int mEfficiency; - - public GT_MetaTileEntity_SemiFluidGenerator(int aID, String aName, String aNameRegional, int aTier) { - super(aID, aName, aNameRegional, aTier, "Requires semi-fluid Fuel", new ITexture[0]); - onConfigLoad(); - } - - public GT_MetaTileEntity_SemiFluidGenerator(String aName, int aTier, String[] aDescription, - ITexture[][][] aTextures) { - super(aName, aTier, aDescription, aTextures); - onConfigLoad(); - } - - @Override - public int getPollution() { - return (int) (CORE.ConfigSwitches.basePollutionPerSecondSemiFluidGenerator - * CORE.ConfigSwitches.pollutionReleasedByTierSemiFluidGenerator[this.mTier]); - } - - @Override - public int getCapacity() { - return 16000; - } - - public void onConfigLoad() { - this.mEfficiency = GregTech_API.sMachineFile.get( - ConfigCategories.machineconfig, - "SemiFluidGenerator.efficiency.tier." + this.mTier, - 100 - (this.mTier * 5)); - } - - @Override - public MetaTileEntity newMetaEntity(IGregTechTileEntity aTileEntity) { - return new GT_MetaTileEntity_SemiFluidGenerator(this.mName, this.mTier, this.mDescriptionArray, this.mTextures); - } - - @Override - public RecipeMap<?> getRecipeMap() { - // Logger.WARNING("Fuel Count: "+Gregtech_Recipe_Map.sSemiFluidLiquidFuels.mRecipeList.size()); - return GTPPRecipeMaps.semiFluidFuels; - } - - @Override - public String[] getDescription() { - return ArrayUtils.addAll( - this.mDescriptionArray, - "Produces " + (this.getPollution()) + " pollution/sec", - "Fuel Efficiency: " + this.getEfficiency() + "%", - CORE.GT_Tooltip.get()); - } - - @Override - public int getEfficiency() { - return this.mEfficiency; - } - - @Override - public boolean isOutputFacing(ForgeDirection side) { - return (side == getBaseMetaTileEntity().getFrontFacing()); - } - - @Override - public boolean allowCoverOnSide(ForgeDirection side, GT_ItemStack aCover) { - if (side != this.getBaseMetaTileEntity() - .getFrontFacing()) { - return true; - } - return super.allowCoverOnSide(side, aCover); - } - - @Override - public int getFuelValue(ItemStack aStack) { - if ((GT_Utility.isStackInvalid(aStack)) || (getRecipeMap() == null)) { - Logger.WARNING("Bad Fuel?"); - return 0; - } - int rValue = Math.max(GT_ModHandler.getFuelValue(aStack) * 6 / 5, super.getFuelValue(aStack)); - if (ItemList.Fuel_Can_Plastic_Filled.isStackEqual(aStack, false, true)) { - rValue = Math.max(rValue, GameRegistry.getFuelValue(aStack) * 3); - } - Logger.WARNING("Good Fuel: " + rValue); - return rValue; - } - - @Override - public ITexture[] getFront(byte aColor) { - return new ITexture[] { super.getFront(aColor)[0], - new GT_RenderedTexture(Textures.BlockIcons.DIESEL_GENERATOR_FRONT), - Textures.BlockIcons.OVERLAYS_ENERGY_OUT[this.mTier] }; - } - - @Override - public ITexture[] getBack(byte aColor) { - return new ITexture[] { super.getBack(aColor)[0], - new GT_RenderedTexture(Textures.BlockIcons.DIESEL_GENERATOR_TOP) }; - } - - @Override - public ITexture[] getBottom(byte aColor) { - return new ITexture[] { super.getBottom(aColor)[0], - new GT_RenderedTexture(Textures.BlockIcons.DIESEL_GENERATOR_BOTTOM) }; - } - - @Override - public ITexture[] getTop(byte aColor) { - return new ITexture[] { super.getTop(aColor)[0], - new GT_RenderedTexture(Textures.BlockIcons.DIESEL_GENERATOR_SIDE) }; - } - - @Override - public ITexture[] getSides(byte aColor) { - return new ITexture[] { super.getSides(aColor)[0], - new GT_RenderedTexture(Textures.BlockIcons.DIESEL_GENERATOR_TOP) }; - } - - @Override - public ITexture[] getFrontActive(byte aColor) { - return new ITexture[] { super.getFrontActive(aColor)[0], - new GT_RenderedTexture(Textures.BlockIcons.DIESEL_GENERATOR_FRONT_ACTIVE), - Textures.BlockIcons.OVERLAYS_ENERGY_OUT[this.mTier] }; - } - - @Override - public ITexture[] getBackActive(byte aColor) { - return new ITexture[] { super.getBackActive(aColor)[0], - new GT_RenderedTexture(Textures.BlockIcons.DIESEL_GENERATOR_TOP_ACTIVE) }; - } - - @Override - public ITexture[] getBottomActive(byte aColor) { - return new ITexture[] { super.getBottomActive(aColor)[0], - new GT_RenderedTexture(Textures.BlockIcons.DIESEL_GENERATOR_BOTTOM_ACTIVE) }; - } - - @Override - public ITexture[] getTopActive(byte aColor) { - return new ITexture[] { super.getTopActive(aColor)[0], - new GT_RenderedTexture(Textures.BlockIcons.DIESEL_GENERATOR_SIDE_ACTIVE) }; - } - - @Override - public ITexture[] getSidesActive(byte aColor) { - return new ITexture[] { super.getSidesActive(aColor)[0], - new GT_RenderedTexture(Textures.BlockIcons.DIESEL_GENERATOR_TOP_ACTIVE) }; - } -} diff --git a/gtpp/src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/generators/GregtechMetaTileEntityGeothermalGenerator.java b/gtpp/src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/generators/GregtechMetaTileEntityGeothermalGenerator.java deleted file mode 100644 index e1f1c8a2e6..0000000000 --- a/gtpp/src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/generators/GregtechMetaTileEntityGeothermalGenerator.java +++ /dev/null @@ -1,176 +0,0 @@ -package gtPlusPlus.xmod.gregtech.common.tileentities.generators; - -import net.minecraft.entity.player.EntityPlayer; -import net.minecraft.item.ItemStack; -import net.minecraftforge.common.util.ForgeDirection; - -import org.apache.commons.lang3.ArrayUtils; - -import cpw.mods.fml.common.registry.GameRegistry; -import gregtech.api.GregTech_API; -import gregtech.api.enums.ConfigCategories; -import gregtech.api.enums.ItemList; -import gregtech.api.enums.Textures; -import gregtech.api.gui.modularui.GT_UIInfos; -import gregtech.api.interfaces.ITexture; -import gregtech.api.interfaces.tileentity.IGregTechTileEntity; -import gregtech.api.metatileentity.MetaTileEntity; -import gregtech.api.metatileentity.implementations.GT_MetaTileEntity_BasicGenerator; -import gregtech.api.objects.GT_RenderedTexture; -import gregtech.api.recipe.RecipeMap; -import gregtech.api.recipe.RecipeMaps; -import gregtech.api.util.GT_ModHandler; -import gtPlusPlus.core.lib.CORE; -import gtPlusPlus.xmod.gregtech.common.blocks.textures.TexturesGtBlock; - -public class GregtechMetaTileEntityGeothermalGenerator extends GT_MetaTileEntity_BasicGenerator { - - public int mEfficiency; - - public GregtechMetaTileEntityGeothermalGenerator(final int aID, final String aName, final String aNameRegional, - final int aTier) { - super(aID, aName, aNameRegional, aTier, "Requires Pahoehoe Lava or Normal Lava as Fuel", new ITexture[0]); - this.onConfigLoad(); - } - - public GregtechMetaTileEntityGeothermalGenerator(final String aName, final int aTier, final String[] aDescription, - final ITexture[][][] aTextures) { - super(aName, aTier, aDescription, aTextures); - this.onConfigLoad(); - } - - @Override - public String[] getDescription() { - String aPollution = "Causes " + this.getPollution() + " Pollution per second"; - return ArrayUtils.addAll( - this.mDescriptionArray, - "Generates power at " + this.getEfficiency() + "% Efficiency per tick", - aPollution, - CORE.GT_Tooltip.get()); - } - - @Override - public boolean onRightclick(final IGregTechTileEntity aBaseMetaTileEntity, final EntityPlayer aPlayer) { - GT_UIInfos.openGTTileEntityUI(aBaseMetaTileEntity, aPlayer); - return true; - } - - @Override - public int getCapacity() { - // return MathUtils.roundToClosestMultiple(32000*(this.mTier/2), 25000); - return 5000 * this.mTier; - } - - public void onConfigLoad() { - this.mEfficiency = GregTech_API.sMachineFile.get( - ConfigCategories.machineconfig, - "ThermalGenerator.efficiency.tier." + this.mTier, - (100 - (this.mTier * 7))); - } - - @Override - public int getEfficiency() { - return this.mEfficiency; - } - - @Override - public int getFuelValue(final ItemStack aStack) { - int rValue = Math.max((GT_ModHandler.getFuelValue(aStack) * 6) / 5, super.getFuelValue(aStack)); - if (ItemList.Fuel_Can_Plastic_Filled.isStackEqual(aStack, false, true)) { - rValue = Math.max(rValue, GameRegistry.getFuelValue(aStack) * 3); - } - return rValue; - } - - @Override - public boolean isOutputFacing(final ForgeDirection side) { - return side == this.getBaseMetaTileEntity() - .getFrontFacing(); - } - - @Override - public MetaTileEntity newMetaEntity(final IGregTechTileEntity aTileEntity) { - return new GregtechMetaTileEntityGeothermalGenerator( - this.mName, - this.mTier, - this.mDescriptionArray, - this.mTextures); - } - - @Override - public ITexture[] getFront(final byte aColor) { - return new ITexture[] { super.getFront(aColor)[0], - new GT_RenderedTexture(Textures.BlockIcons.DIESEL_GENERATOR_SIDE), - Textures.BlockIcons.OVERLAYS_ENERGY_OUT_MULTI[this.mTier] }; - } - - @Override - public ITexture[] getBack(final byte aColor) { - return new ITexture[] { super.getBack(aColor)[0], - new GT_RenderedTexture(Textures.BlockIcons.DIESEL_GENERATOR_BACK), - new GT_RenderedTexture(TexturesGtBlock.Overlay_Machine_Diesel_Vertical) }; - } - - @Override - public ITexture[] getBottom(final byte aColor) { - return new ITexture[] { super.getBottom(aColor)[0], - new GT_RenderedTexture(Textures.BlockIcons.DIESEL_GENERATOR_BOTTOM) }; - } - - @Override - public ITexture[] getTop(final byte aColor) { - return new ITexture[] { super.getTop(aColor)[0], - new GT_RenderedTexture(Textures.BlockIcons.DIESEL_GENERATOR_SIDE), - new GT_RenderedTexture(Textures.BlockIcons.OVERLAY_FRONT_ROCK_BREAKER) }; - } - - @Override - public ITexture[] getSides(final byte aColor) { - return new ITexture[] { super.getSides(aColor)[0], - new GT_RenderedTexture(Textures.BlockIcons.BOILER_LAVA_FRONT) }; - } - - @Override - public ITexture[] getFrontActive(final byte aColor) { - return new ITexture[] { super.getFrontActive(aColor)[0], - new GT_RenderedTexture(Textures.BlockIcons.DIESEL_GENERATOR_SIDE_ACTIVE), - Textures.BlockIcons.OVERLAYS_ENERGY_OUT_MULTI[this.mTier] }; - } - - @Override - public ITexture[] getBackActive(final byte aColor) { - return new ITexture[] { super.getBackActive(aColor)[0], - new GT_RenderedTexture(Textures.BlockIcons.DIESEL_GENERATOR_BACK_ACTIVE), - new GT_RenderedTexture(TexturesGtBlock.Overlay_Machine_Diesel_Vertical_Active) }; - } - - @Override - public ITexture[] getBottomActive(final byte aColor) { - return new ITexture[] { super.getBottomActive(aColor)[0], - new GT_RenderedTexture(Textures.BlockIcons.DIESEL_GENERATOR_BOTTOM_ACTIVE) }; - } - - @Override - public ITexture[] getTopActive(final byte aColor) { - return new ITexture[] { super.getTopActive(aColor)[0], - new GT_RenderedTexture(Textures.BlockIcons.DIESEL_GENERATOR_SIDE), - new GT_RenderedTexture(Textures.BlockIcons.OVERLAY_FRONT_ROCK_BREAKER_ACTIVE) }; - } - - @Override - public ITexture[] getSidesActive(final byte aColor) { - return new ITexture[] { super.getSidesActive(aColor)[0], - new GT_RenderedTexture(Textures.BlockIcons.BOILER_LAVA_FRONT_ACTIVE) }; - } - - @Override - public RecipeMap<?> getRecipeMap() { - return RecipeMaps.hotFuels; - } - - @Override - public int getPollution() { - return (int) (CORE.ConfigSwitches.basePollutionPerSecondGeothermalGenerator - * CORE.ConfigSwitches.pollutionReleasedByTierGeothermalGenerator[mTier]); - } -} diff --git a/gtpp/src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/generators/GregtechMetaTileEntityRocketFuelGenerator.java b/gtpp/src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/generators/GregtechMetaTileEntityRocketFuelGenerator.java deleted file mode 100644 index 45d4177709..0000000000 --- a/gtpp/src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/generators/GregtechMetaTileEntityRocketFuelGenerator.java +++ /dev/null @@ -1,156 +0,0 @@ -package gtPlusPlus.xmod.gregtech.common.tileentities.generators; - -import net.minecraft.item.ItemStack; -import net.minecraftforge.common.util.ForgeDirection; - -import cpw.mods.fml.common.registry.GameRegistry; -import gregtech.api.GregTech_API; -import gregtech.api.enums.ConfigCategories; -import gregtech.api.enums.ItemList; -import gregtech.api.enums.Textures; -import gregtech.api.interfaces.ITexture; -import gregtech.api.interfaces.tileentity.IGregTechTileEntity; -import gregtech.api.metatileentity.MetaTileEntity; -import gregtech.api.objects.GT_RenderedTexture; -import gregtech.api.recipe.RecipeMap; -import gregtech.api.util.GT_ModHandler; -import gtPlusPlus.api.recipe.GTPPRecipeMaps; -import gtPlusPlus.xmod.gregtech.api.metatileentity.implementations.base.generators.GregtechRocketFuelGeneratorBase; -import gtPlusPlus.xmod.gregtech.common.blocks.textures.TexturesGtBlock; - -public class GregtechMetaTileEntityRocketFuelGenerator extends GregtechRocketFuelGeneratorBase { - - public int mEfficiency; - - public GregtechMetaTileEntityRocketFuelGenerator(final int aID, final String aName, final String aNameRegional, - final int aTier) { - super(aID, aName, aNameRegional, aTier, "Requires GT++ Rocket Fuels", new ITexture[0]); - this.onConfigLoad(); - } - - public GregtechMetaTileEntityRocketFuelGenerator(final String aName, final int aTier, final String[] aDescription, - final ITexture[][][] aTextures) { - super(aName, aTier, aDescription, aTextures); - this.onConfigLoad(); - } - - @Override - public boolean isOutputFacing(final ForgeDirection side) { - return side == this.getBaseMetaTileEntity() - .getFrontFacing(); - } - - @Override - public MetaTileEntity newMetaEntity(final IGregTechTileEntity aTileEntity) { - return new GregtechMetaTileEntityRocketFuelGenerator( - this.mName, - this.mTier, - this.mDescriptionArray, - this.mTextures); - } - - @Override - public RecipeMap<?> getRecipeMap() { - return GTPPRecipeMaps.rocketFuels; - } - - @Override - public int getCapacity() { - return 32000; - } - - public void onConfigLoad() { - this.mEfficiency = GregTech_API.sMachineFile.get( - ConfigCategories.machineconfig, - "RocketEngine.efficiency.tier." + this.mTier, - 80 - (10 * (this.mTier - 4))); - } - - @Override - public int getEfficiency() { - int eff = 80 - (10 * (this.mTier - 4)); - return eff; - } - - @Override - public int getFuelValue(final ItemStack aStack) { - int rValue = Math.max((GT_ModHandler.getFuelValue(aStack) * 6) / 5, super.getFuelValue(aStack)); - if (ItemList.Fuel_Can_Plastic_Filled.isStackEqual(aStack, false, true)) { - rValue = Math.max(rValue, GameRegistry.getFuelValue(aStack) * 3); - } - return rValue; - } - - private GT_RenderedTexture getCasingTexture() { - if (this.mTier <= 4) { - return new GT_RenderedTexture(TexturesGtBlock.Casing_Machine_Simple_Top); - } else if (this.mTier == 5) { - - return new GT_RenderedTexture(TexturesGtBlock.Casing_Machine_Advanced); - } else { - - return new GT_RenderedTexture(TexturesGtBlock.Casing_Machine_Ultra); - } - // return new GT_RenderedTexture(TexturesGtBlock.Casing_Machine_Simple_Top); - } - - @Override - public ITexture[] getFront(final byte aColor) { - return new ITexture[] { super.getFront(aColor)[0], this.getCasingTexture(), - Textures.BlockIcons.OVERLAYS_ENERGY_OUT_MULTI[this.mTier] }; - } - - @Override - public ITexture[] getBack(final byte aColor) { - return new ITexture[] { super.getBack(aColor)[0], this.getCasingTexture(), - new GT_RenderedTexture(TexturesGtBlock.Overlay_Machine_Vent) }; - } - - @Override - public ITexture[] getBottom(final byte aColor) { - return new ITexture[] { super.getBottom(aColor)[0], - new GT_RenderedTexture(TexturesGtBlock.Casing_Machine_Simple_Bottom) }; - } - - @Override - public ITexture[] getTop(final byte aColor) { - return new ITexture[] { super.getTop(aColor)[0], - new GT_RenderedTexture(TexturesGtBlock.Casing_Machine_Redstone_Off) }; - } - - @Override - public ITexture[] getSides(final byte aColor) { - return new ITexture[] { super.getSides(aColor)[0], this.getCasingTexture(), - new GT_RenderedTexture(TexturesGtBlock.Overlay_Machine_Diesel_Horizontal) }; - } - - @Override - public ITexture[] getFrontActive(final byte aColor) { - return new ITexture[] { super.getFrontActive(aColor)[0], this.getCasingTexture(), - Textures.BlockIcons.OVERLAYS_ENERGY_OUT_MULTI[this.mTier] }; - } - - @Override - public ITexture[] getBackActive(final byte aColor) { - return new ITexture[] { super.getBackActive(aColor)[0], this.getCasingTexture(), - new GT_RenderedTexture(TexturesGtBlock.Overlay_Machine_Vent_Fast) }; - } - - @Override - public ITexture[] getBottomActive(final byte aColor) { - return new ITexture[] { super.getBottomActive(aColor)[0], - new GT_RenderedTexture(TexturesGtBlock.Casing_Machine_Simple_Bottom) }; - } - - @Override - public ITexture[] getTopActive(final byte aColor) { - return new ITexture[] { super.getTopActive(aColor)[0], - new GT_RenderedTexture(TexturesGtBlock.Casing_Machine_Redstone_On) }; - } - - @Override - public ITexture[] getSidesActive(final byte aColor) { - return new ITexture[] { super.getSidesActive(aColor)[0], this.getCasingTexture(), - new GT_RenderedTexture(TexturesGtBlock.Overlay_Machine_Diesel_Horizontal_Active) }; - } -} diff --git a/gtpp/src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/generators/GregtechMetaTileEntity_RTG.java b/gtpp/src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/generators/GregtechMetaTileEntity_RTG.java deleted file mode 100644 index 32cf3a92cc..0000000000 --- a/gtpp/src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/generators/GregtechMetaTileEntity_RTG.java +++ /dev/null @@ -1,379 +0,0 @@ -package gtPlusPlus.xmod.gregtech.common.tileentities.generators; - -import net.minecraft.init.Blocks; -import net.minecraft.item.ItemStack; -import net.minecraft.nbt.NBTTagCompound; -import net.minecraft.nbt.NBTTagList; -import net.minecraftforge.common.util.ForgeDirection; -import net.minecraftforge.fluids.FluidStack; - -import org.apache.commons.lang3.ArrayUtils; - -import gregtech.api.enums.Textures; -import gregtech.api.interfaces.ITexture; -import gregtech.api.interfaces.tileentity.IGregTechTileEntity; -import gregtech.api.metatileentity.MetaTileEntity; -import gregtech.api.metatileentity.implementations.GT_MetaTileEntity_BasicGenerator; -import gregtech.api.objects.GT_RenderedTexture; -import gregtech.api.recipe.RecipeMap; -import gregtech.api.util.GT_Recipe; -import gregtech.api.util.GT_Utility; -import gtPlusPlus.api.objects.Logger; -import gtPlusPlus.api.recipe.GTPPRecipeMaps; -import gtPlusPlus.core.lib.CORE; -import gtPlusPlus.core.util.math.MathUtils; -import gtPlusPlus.core.util.minecraft.gregtech.PollutionUtils; -import gtPlusPlus.core.util.reflect.ReflectionUtils; -import gtPlusPlus.xmod.gregtech.api.enums.GregtechItemList; - -public class GregtechMetaTileEntity_RTG extends GT_MetaTileEntity_BasicGenerator { - - public int mEfficiency; - private long mTicksToBurnFor; - private int mVoltage = 0; - private GT_Recipe mCurrentRecipe; - private int mDaysRemaining = 0; - private int mDayTick = 0; - private byte mNewTier = 0; - - public int removeDayOfTime() { - if (this.mDaysRemaining > 0) { - return this.mDaysRemaining--; - } - return this.mDaysRemaining; - } - - // Generates fuel value based on MC days - public static int convertDaysToTicks(float days) { - int value = 0; - value = MathUtils.roundToClosestInt(20 * 86400 * days); - return value; - } - - public static long getTotalEUGenerated(int ticks, int voltage) { - return ticks * voltage; - } - - @Override - public void saveNBTData(NBTTagCompound aNBT) { - super.saveNBTData(aNBT); - aNBT.setLong("mTicksToBurnFor", this.mTicksToBurnFor); - aNBT.setInteger("mVoltage", this.mVoltage); - aNBT.setInteger("mDaysRemaining", this.mDaysRemaining); - aNBT.setInteger("mDayTick", this.mDayTick); - aNBT.setByte("mNewTier", this.mNewTier); - - if (this.mCurrentRecipe != null) { - final NBTTagList list = new NBTTagList(); - final ItemStack stack = this.mCurrentRecipe.mInputs[0]; - if (stack != null) { - final NBTTagCompound data = new NBTTagCompound(); - stack.writeToNBT(data); - data.setInteger("mSlot", 0); - list.appendTag(data); - } - aNBT.setTag("mRecipeItem", list); - } - } - - @Override - public void loadNBTData(NBTTagCompound aNBT) { - super.loadNBTData(aNBT); - this.mTicksToBurnFor = aNBT.getLong("mTicksToBurnFor"); - this.mVoltage = aNBT.getInteger("mVoltage"); - this.mDaysRemaining = aNBT.getInteger("mDaysRemaining"); - this.mDayTick = aNBT.getInteger("mDayTick"); - this.mNewTier = aNBT.getByte("mNewTier"); - - try { - ReflectionUtils.setByte(this, "mTier", this.mNewTier); - } catch (Exception e) { - if (this.getBaseMetaTileEntity() != null) { - IGregTechTileEntity thisTile = this.getBaseMetaTileEntity(); - if (thisTile.isAllowedToWork() || thisTile.isActive()) { - thisTile.setActive(false); - } - } - } - - final NBTTagList list = aNBT.getTagList("mRecipeItem", 10); - final NBTTagCompound data = list.getCompoundTagAt(0); - ItemStack lastUsedFuel = ItemStack.loadItemStackFromNBT(data); - if (lastUsedFuel != null) { - this.mCurrentRecipe = getRecipeMap().findRecipe( - getBaseMetaTileEntity(), - false, - 9223372036854775807L, - null, - new ItemStack[] { lastUsedFuel }); - } - } - - @Override - public void onPostTick(IGregTechTileEntity aBaseMetaTileEntity, long aTick) { - if (aBaseMetaTileEntity.isServerSide()) { - if (this.mDayTick < 24000) { - this.mDayTick++; - } else if (this.mDayTick >= 24000) { - this.mDayTick = 0; - this.mDaysRemaining = this.removeDayOfTime(); - } - } - - if ((aBaseMetaTileEntity.isServerSide()) && (aBaseMetaTileEntity.isAllowedToWork()) && (aTick % 10L == 0L)) { - long tProducedEU = 0L; - if (this.mFluid == null) { - if (aBaseMetaTileEntity.getUniversalEnergyStored() < maxEUOutput() + getMinimumStoredEU()) { - this.mInventory[getStackDisplaySlot()] = null; - } else { - if (this.mInventory[getStackDisplaySlot()] == null) - this.mInventory[getStackDisplaySlot()] = new ItemStack(Blocks.fire, 1); - this.mInventory[getStackDisplaySlot()].setStackDisplayName( - "Generating: " - + GT_Utility.formatNumbers( - aBaseMetaTileEntity.getUniversalEnergyStored() - getMinimumStoredEU()) - + " EU"); - } - } else { - int tFuelValue = getFuelValue(this.mFluid); - int tConsumed = consumedFluidPerOperation(this.mFluid); - if ((tFuelValue > 0) && (tConsumed > 0) && (this.mFluid.amount > tConsumed)) { - long tFluidAmountToUse = Math.min( - this.mFluid.amount / tConsumed, - (maxEUStore() - aBaseMetaTileEntity.getUniversalEnergyStored()) / tFuelValue); - if ((tFluidAmountToUse > 0L) - && (aBaseMetaTileEntity.increaseStoredEnergyUnits(tFluidAmountToUse * tFuelValue, true))) { - tProducedEU = tFluidAmountToUse * tFuelValue; - FluidStack tmp260_257 = this.mFluid; - tmp260_257.amount = (int) (tmp260_257.amount - (tFluidAmountToUse * tConsumed)); - } - } - } - if ((this.mInventory[getInputSlot()] != null) - && (aBaseMetaTileEntity.getUniversalEnergyStored() < maxEUOutput() * 20L + getMinimumStoredEU()) - && (GT_Utility.getFluidForFilledItem(this.mInventory[getInputSlot()], true) == null)) { - int tFuelValue = getFuelValue(this.mInventory[getInputSlot()]); - if (tFuelValue > 0) { - ItemStack tEmptyContainer = getEmptyContainer(this.mInventory[getInputSlot()]); - if (aBaseMetaTileEntity.addStackToSlot(getOutputSlot(), tEmptyContainer)) { - aBaseMetaTileEntity.increaseStoredEnergyUnits(tFuelValue, true); - aBaseMetaTileEntity.decrStackSize(getInputSlot(), 1); - tProducedEU = tFuelValue; - } - } - } - if ((tProducedEU > 0L) && (getPollution() > 0)) { - PollutionUtils - .addPollution(aBaseMetaTileEntity, (int) (tProducedEU * getPollution() / 500 * this.mTier + 1L)); - } - } - - if (aBaseMetaTileEntity.isServerSide()) aBaseMetaTileEntity.setActive( - (aBaseMetaTileEntity.isAllowedToWork()) - && (aBaseMetaTileEntity.getUniversalEnergyStored() >= maxEUOutput() + getMinimumStoredEU())); - } - - @Override - public String[] getDescription() { - return ArrayUtils.addAll( - this.mDescriptionArray, - "Fuel is measured in minecraft days (Check with Scanner)", - "RTG changes output voltage depending on fuel", - "Generates power at " + GT_Utility.formatNumbers(this.getEfficiency()) + "% Efficiency per tick", - "Output Voltage: " + GT_Utility.formatNumbers(this.getOutputTier()) + " EU/t", - CORE.GT_Tooltip.get()); - } - - public GregtechMetaTileEntity_RTG(int aID, String aName, String aNameRegional, int aTier) { - super(aID, aName, aNameRegional, aTier, "Requires RTG Pellets", new ITexture[0]); - } - - private byte getTier() { - int voltage = this.mVoltage; - if (voltage >= 512) { - return 4; - } else if (voltage >= 128) { - return 3; - } else if (voltage >= 32) { - return 2; - } else if (voltage >= 8) { - return 1; - } - return 0; - } - - public GregtechMetaTileEntity_RTG(String aName, int aTier, String[] aDescription, ITexture[][][] aTextures) { - super(aName, aTier, aDescription, aTextures); - } - - @Override - public boolean isOutputFacing(ForgeDirection side) { - return ((side.offsetY == 0) && (side != getBaseMetaTileEntity().getFrontFacing()) - && (side != getBaseMetaTileEntity().getBackFacing())); - } - - @Override - public MetaTileEntity newMetaEntity(IGregTechTileEntity aTileEntity) { - return new GregtechMetaTileEntity_RTG(this.mName, this.mTier, this.mDescriptionArray, this.mTextures); - } - - @Override - public RecipeMap<?> getRecipeMap() { - return GTPPRecipeMaps.rtgFuels; - } - - @Override - public int getCapacity() { - return 0; - } - - @Override - public int getEfficiency() { - return this.mEfficiency = 100; - } - - @Override - public ITexture[] getFront(byte aColor) { - return new ITexture[] { super.getFront(aColor)[0], - new GT_RenderedTexture(Textures.BlockIcons.NAQUADAH_REACTOR_SOLID_TOP), - new GT_RenderedTexture(Textures.BlockIcons.OVERLAY_FRONT_MASSFAB) }; - } - - @Override - public ITexture[] getBack(byte aColor) { - return new ITexture[] { super.getBack(aColor)[0], - new GT_RenderedTexture(Textures.BlockIcons.NAQUADAH_REACTOR_SOLID_TOP) }; - } - - @Override - public ITexture[] getBottom(byte aColor) { - return new ITexture[] { super.getBottom(aColor)[0], - new GT_RenderedTexture(Textures.BlockIcons.NAQUADAH_REACTOR_SOLID_TOP) }; - } - - @Override - public ITexture[] getTop(byte aColor) { - return new ITexture[] { super.getTop(aColor)[0], - new GT_RenderedTexture(Textures.BlockIcons.NAQUADAH_REACTOR_SOLID_TOP), - new GT_RenderedTexture(Textures.BlockIcons.NAQUADAH_REACTOR_FLUID_SIDE) }; - } - - @Override - public ITexture[] getSides(byte aColor) { - return new ITexture[] { gregtech.api.enums.Textures.BlockIcons.MACHINE_CASINGS[this.mTier][(0)], - new GT_RenderedTexture(Textures.BlockIcons.NAQUADAH_REACTOR_SOLID_TOP_ACTIVE), - gregtech.api.enums.Textures.BlockIcons.OVERLAYS_ENERGY_OUT_MULTI[getTier()] }; - } - - @Override - public ITexture[] getFrontActive(byte aColor) { - return new ITexture[] { super.getFrontActive(aColor)[0], - new GT_RenderedTexture(Textures.BlockIcons.NAQUADAH_REACTOR_SOLID_TOP_ACTIVE), - new GT_RenderedTexture(Textures.BlockIcons.OVERLAY_FRONT_MASSFAB_ACTIVE) }; - } - - @Override - public ITexture[] getBackActive(byte aColor) { - return new ITexture[] { super.getBackActive(aColor)[0], - new GT_RenderedTexture(Textures.BlockIcons.NAQUADAH_REACTOR_SOLID_TOP_ACTIVE) }; - } - - @Override - public ITexture[] getBottomActive(byte aColor) { - return new ITexture[] { super.getBottomActive(aColor)[0], - new GT_RenderedTexture(Textures.BlockIcons.NAQUADAH_REACTOR_SOLID_TOP_ACTIVE) }; - } - - @Override - public ITexture[] getTopActive(byte aColor) { - return new ITexture[] { super.getTopActive(aColor)[0], - new GT_RenderedTexture(Textures.BlockIcons.NAQUADAH_REACTOR_SOLID_TOP_ACTIVE), - new GT_RenderedTexture(Textures.BlockIcons.NAQUADAH_REACTOR_FLUID_SIDE_ACTIVE) }; - } - - @Override - public ITexture[] getSidesActive(byte aColor) { - return new ITexture[] { gregtech.api.enums.Textures.BlockIcons.MACHINE_CASINGS[this.mTier][(0)], - new GT_RenderedTexture(Textures.BlockIcons.NAQUADAH_REACTOR_SOLID_TOP_ACTIVE), - gregtech.api.enums.Textures.BlockIcons.OVERLAYS_ENERGY_OUT_MULTI[getTier()] }; - } - - @Override - public int getPollution() { - return 0; - } - - @Override - public int getFuelValue(ItemStack aStack) { - if ((GT_Utility.isStackInvalid(aStack)) || (getRecipeMap() == null)) return 0; - GT_Recipe tFuel = getRecipeMap() - .findRecipe(getBaseMetaTileEntity(), false, 9223372036854775807L, null, new ItemStack[] { aStack }); - if (tFuel != null) { - this.mCurrentRecipe = tFuel; - int voltage = tFuel.mEUt; - this.mVoltage = voltage; - // this.mDaysRemaining = tFuel.mSpecialValue*365; - - // Do some voodoo. - byte mTier2; - // mTier2 = ReflectionUtils.getField(this.getClass(), "mTier"); - try { - if (ItemStack.areItemStacksEqual(tFuel.mInputs[0], GregtechItemList.Pellet_RTG_AM241.get(1))) { - mTier2 = 1; - } else if (ItemStack.areItemStacksEqual(tFuel.mInputs[0], GregtechItemList.Pellet_RTG_PO210.get(1))) { - mTier2 = 3; - } else if (ItemStack.areItemStacksEqual(tFuel.mInputs[0], GregtechItemList.Pellet_RTG_PU238.get(1))) { - mTier2 = 2; - } else if (ItemStack.areItemStacksEqual(tFuel.mInputs[0], GregtechItemList.Pellet_RTG_SR90.get(1))) { - mTier2 = 1; - } else { - mTier2 = 0; - } - ReflectionUtils.setByte(this, "mTier", mTier2); - this.mNewTier = mTier2; - } catch (Exception e) { - Logger.WARNING("Failed setting mTier."); - e.printStackTrace(); - } - - this.mTicksToBurnFor = getTotalEUGenerated(convertDaysToTicks(tFuel.mSpecialValue), voltage); - if (mTicksToBurnFor >= Integer.MAX_VALUE) { - mTicksToBurnFor = Integer.MAX_VALUE; - Logger.WARNING("Fuel went over Int limit, setting to MAX_VALUE."); - } - this.mDaysRemaining = MathUtils.roundToClosestInt(mTicksToBurnFor / 20 / 60 / 3); - Logger.WARNING("step | " + (int) (mTicksToBurnFor * getEfficiency() / 100L)); - return (int) (mTicksToBurnFor * getEfficiency() / 100L); - } - Logger.WARNING("Not sure"); - return 0; - } - - @Override - public long maxEUOutput() { - return ((getBaseMetaTileEntity().isAllowedToWork()) ? this.mVoltage : 0L); - } - - @Override - public long getOutputTier() { - if (this.mCurrentRecipe != null) { - return this.mVoltage = this.mCurrentRecipe.mEUt; - } - return 0; - } - - @Override - public boolean isGivingInformation() { - return true; - } - - @Override - public String[] getInfoData() { - return new String[] { "RTG - Running at tier " + this.mTier, "Active: " + this.getBaseMetaTileEntity() - .isActive(), "Current Output: " + GT_Utility.formatNumbers(mVoltage) + " EU/t", - "Days of Fuel remaining: " + GT_Utility.formatNumbers(mTicksToBurnFor / 20 / 60 / 20), - "Hours of Fuel remaining: " + GT_Utility.formatNumbers(mTicksToBurnFor / 20 / 60 / 60), - "Ticks of " + this.mVoltage + "v remaining: " + mTicksToBurnFor, - this.mCurrentRecipe.mInputs[0].getDisplayName() + " x1" }; - } -} diff --git a/gtpp/src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/generators/ULV/GT_MetaTileEntity_ULV_CombustionGenerator.java b/gtpp/src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/generators/ULV/GT_MetaTileEntity_ULV_CombustionGenerator.java deleted file mode 100644 index 24770e9503..0000000000 --- a/gtpp/src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/generators/ULV/GT_MetaTileEntity_ULV_CombustionGenerator.java +++ /dev/null @@ -1,59 +0,0 @@ -package gtPlusPlus.xmod.gregtech.common.tileentities.generators.ULV; - -import static gregtech.api.enums.GT_Values.V; - -import org.apache.commons.lang3.ArrayUtils; - -import gregtech.api.GregTech_API; -import gregtech.api.enums.ConfigCategories; -import gregtech.api.interfaces.ITexture; -import gregtech.api.interfaces.tileentity.IGregTechTileEntity; -import gregtech.api.metatileentity.MetaTileEntity; -import gregtech.common.tileentities.generators.GT_MetaTileEntity_DieselGenerator; -import gtPlusPlus.core.lib.CORE; - -public class GT_MetaTileEntity_ULV_CombustionGenerator extends GT_MetaTileEntity_DieselGenerator { - - public GT_MetaTileEntity_ULV_CombustionGenerator(int aID, String aName, String aNameRegional, int aTier) { - super(aID, aName, aNameRegional, aTier); - } - - public GT_MetaTileEntity_ULV_CombustionGenerator(String aName, int aTier, String[] aDescription, - ITexture[][][] aTextures) { - super(aName, aTier, aDescription, aTextures); - } - - @Override - public String[] getDescription() { - return ArrayUtils.addAll( - this.mDescriptionArray, - "Produces " + (this.getPollution() * 20) + " pollution/sec", - "Fuel Efficiency: " + this.getEfficiency() + "%", - CORE.GT_Tooltip.get()); - } - - @Override - public long maxEUStore() { - return Math.max(getEUVar(), V[1] * 80L + getMinimumStoredEU()); - } - - @Override - public MetaTileEntity newMetaEntity(IGregTechTileEntity aTileEntity) { - return new GT_MetaTileEntity_ULV_CombustionGenerator( - this.mName, - this.mTier, - this.mDescriptionArray, - this.mTextures); - } - - @Override - public int getCapacity() { - return 16000; - } - - @Override - public void onConfigLoad() { - this.mEfficiency = GregTech_API.sMachineFile - .get(ConfigCategories.machineconfig, "DieselGenerator.efficiency.tier." + this.mTier, 95); - } -} diff --git a/gtpp/src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/generators/ULV/GT_MetaTileEntity_ULV_SteamTurbine.java b/gtpp/src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/generators/ULV/GT_MetaTileEntity_ULV_SteamTurbine.java deleted file mode 100644 index 26429b1486..0000000000 --- a/gtpp/src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/generators/ULV/GT_MetaTileEntity_ULV_SteamTurbine.java +++ /dev/null @@ -1,42 +0,0 @@ -package gtPlusPlus.xmod.gregtech.common.tileentities.generators.ULV; - -import static gregtech.api.enums.GT_Values.V; - -import gregtech.api.GregTech_API; -import gregtech.api.enums.ConfigCategories; -import gregtech.api.interfaces.ITexture; -import gregtech.api.interfaces.tileentity.IGregTechTileEntity; -import gregtech.api.metatileentity.MetaTileEntity; -import gregtech.common.tileentities.generators.GT_MetaTileEntity_SteamTurbine; - -public class GT_MetaTileEntity_ULV_SteamTurbine extends GT_MetaTileEntity_SteamTurbine { - - public GT_MetaTileEntity_ULV_SteamTurbine(int aID, String aName, String aNameRegional) { - super(aID, aName, aNameRegional, 0); - } - - public GT_MetaTileEntity_ULV_SteamTurbine(String aName, String[] aDescription, ITexture[][][] aTextures) { - super(aName, 0, aDescription, aTextures); - } - - @Override - public long maxEUStore() { - return Math.max(getEUVar(), V[1] * 80L + getMinimumStoredEU()); - } - - @Override - public MetaTileEntity newMetaEntity(IGregTechTileEntity aTileEntity) { - return new GT_MetaTileEntity_ULV_SteamTurbine(this.mName, this.mDescriptionArray, this.mTextures); - } - - @Override - public int getCapacity() { - return 16000; - } - - @Override - public void onConfigLoad() { - this.mEfficiency = GregTech_API.sMachineFile - .get(ConfigCategories.machineconfig, "SteamTurbine.efficiency.tier." + this.mTier, 6 + 1); - } -} diff --git a/gtpp/src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/basic/GT_MetaTileEntity_CropHarvestor.java b/gtpp/src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/basic/GT_MetaTileEntity_CropHarvestor.java deleted file mode 100644 index c592a68a40..0000000000 --- a/gtpp/src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/basic/GT_MetaTileEntity_CropHarvestor.java +++ /dev/null @@ -1,716 +0,0 @@ -package gtPlusPlus.xmod.gregtech.common.tileentities.machines.basic; - -import java.util.Collections; -import java.util.HashSet; -import java.util.Iterator; -import java.util.Map; -import java.util.Map.Entry; - -import net.minecraft.entity.player.EntityPlayer; -import net.minecraft.item.Item; -import net.minecraft.item.ItemStack; -import net.minecraft.nbt.NBTTagCompound; -import net.minecraft.tileentity.TileEntity; -import net.minecraftforge.common.util.ForgeDirection; - -import org.apache.commons.lang3.ArrayUtils; - -import com.gtnewhorizon.gtnhlib.util.map.ItemStackMap; -import com.gtnewhorizons.modularui.api.screen.ModularWindow; -import com.gtnewhorizons.modularui.api.screen.UIBuildContext; -import com.gtnewhorizons.modularui.common.widget.CycleButtonWidget; -import com.gtnewhorizons.modularui.common.widget.FakeSyncWidget; -import com.gtnewhorizons.modularui.common.widget.ProgressBar; -import com.gtnewhorizons.modularui.common.widget.SlotGroup; - -import gregtech.api.enums.GT_Values; -import gregtech.api.enums.Textures; -import gregtech.api.gui.modularui.GT_UIInfos; -import gregtech.api.gui.modularui.GT_UITextures; -import gregtech.api.interfaces.ITexture; -import gregtech.api.interfaces.tileentity.IGregTechTileEntity; -import gregtech.api.metatileentity.MetaTileEntity; -import gregtech.api.metatileentity.implementations.GT_MetaTileEntity_BasicTank; -import gregtech.api.objects.GT_ItemStack; -import gregtech.api.objects.GT_RenderedTexture; -import gregtech.api.util.GT_Utility; -import gtPlusPlus.api.objects.Logger; -import gtPlusPlus.core.lib.CORE; -import gtPlusPlus.core.util.math.MathUtils; -import gtPlusPlus.core.util.minecraft.ItemUtils; -import gtPlusPlus.xmod.gregtech.api.gui.GTPP_UITextures; -import gtPlusPlus.xmod.gregtech.common.blocks.textures.TexturesGtBlock; -import ic2.api.crops.CropCard; -import ic2.api.crops.ICropTile; -import ic2.core.item.DamageHandler; - -public class GT_MetaTileEntity_CropHarvestor extends GT_MetaTileEntity_BasicTank { - - private static final int SLOT_WEEDEX_1 = 1; - private static final int SLOT_WEEDEX_2 = 2; - private static final int SLOT_FERT_1 = 3; - private static final int SLOT_FERT_4 = 6; - private static final int SLOT_OUTPUT_START = 7; - - public boolean mModeAlternative = false; - public boolean mHarvestEnabled = true; - - public GT_MetaTileEntity_CropHarvestor(final int aID, final int aTier, final String aDescription) { - super( - aID, - "basicmachine.cropharvester.0" + aTier, - "Crop Manager (" + GT_Values.VN[aTier] + ")", - aTier, - 21, - aDescription); - } - - public GT_MetaTileEntity_CropHarvestor(final String aName, final int aTier, final String[] aDescription, - final ITexture[][][] aTextures) { - super(aName, aTier, 21, aDescription, aTextures); - } - - @Override - public boolean isTransformerUpgradable() { - return true; - } - - @Override - public boolean isOverclockerUpgradable() { - return true; - } - - @Override - public boolean isSimpleMachine() { - return true; - } - - @Override - public boolean isAccessAllowed(EntityPlayer aPlayer) { - return true; - } - - @Override - public boolean isInputFacing(ForgeDirection side) { - return true; - } - - @Override - public boolean isEnetInput() { - return true; - } - - @Override - public boolean isElectric() { - return true; - } - - @Override - public long maxAmperesIn() { - return 8; - } - - @Override - public long getMinimumStoredEU() { - return GT_Values.V[this.mTier]; - } - - @Override - public long maxEUStore() { - return GT_Values.V[this.mTier] * (this.mTier * GT_Values.V[this.mTier]); - } - - @Override - public long maxEUInput() { - return GT_Values.V[this.mTier]; - } - - @Override - public int getCapacity() { - return 32000 * this.mTier; - } - - @Override - public int getTankPressure() { - return -100; - } - - @Override - public boolean onRightclick(final IGregTechTileEntity aBaseMetaTileEntity, final EntityPlayer aPlayer) { - GT_UIInfos.openGTTileEntityUI(aBaseMetaTileEntity, aPlayer); - return true; - } - - @Override - public MetaTileEntity newMetaEntity(IGregTechTileEntity aTileEntity) { - return new GT_MetaTileEntity_CropHarvestor(this.mName, this.mTier, this.mDescriptionArray, this.mTextures); - } - - @Override - public int getSizeInventory() { - return 21; - } - - private static int getRange(int aTier) { - return switch (aTier) { - case 1 -> 1; - case 2 -> 5; - case 3 -> 9; - case 4 -> 13; - case 5 -> 17; - case 6 -> 21; - case 7 -> 25; - case 8 -> 29; - case 9 -> 33; - default -> 0; - }; - } - - private HashSet<ICropTile> mCropCache = new HashSet<>(); - private boolean mInvalidCache = false; - - public boolean doesInventoryHaveSpace() { - for (int i = SLOT_OUTPUT_START; i < this.getSizeInventory(); i++) { - if (this.mInventory[i] == null || this.mInventory[i].stackSize < 64) { - return true; - } - } - return false; - } - - public long powerUsage() { - return this.maxEUInput() / 8; - } - - public long powerUsageSecondary() { - return this.maxEUInput() / 32; - } - - @Override - public void onPostTick(IGregTechTileEntity aBaseMetaTileEntity, long aTick) { - super.onPostTick(aBaseMetaTileEntity, aTick); - if (!getBaseMetaTileEntity().isServerSide() || !getBaseMetaTileEntity().isAllowedToWork() - || (!getBaseMetaTileEntity().hasWorkJustBeenEnabled() && aTick % 100 != 0)) return; - - if (this.getBaseMetaTileEntity() - .getUniversalEnergyStored() < getMinimumStoredEU()) return; - - int aTileX = this.getBaseMetaTileEntity() - .getXCoord(); - int aTileY = this.getBaseMetaTileEntity() - .getXCoord(); - int aTileZ = this.getBaseMetaTileEntity() - .getXCoord(); - - int aRadius = 10 + getRange(this.mTier); - int aSide = (aRadius - 1) / 2; - Map<ItemStack, Integer> aAllDrops = new ItemStackMap<>(true); - - if (this.mCropCache.isEmpty() || aTick % 1200 == 0 || this.mInvalidCache) { - if (!this.mCropCache.isEmpty()) { - this.mCropCache.clear(); - } - // Logger.INFO("Looking for crops."); - for (int y = -2; y <= 2; y++) { - for (int x = (-aSide); x <= aSide; x++) { - for (int z = (-aSide); z <= aSide; z++) { - TileEntity tTileEntity = getBaseMetaTileEntity().getTileEntityOffset(x, y, z); - if (tTileEntity != null && tTileEntity instanceof ICropTile tCrop) { - this.mCropCache.add(tCrop); - } - } - } - } - } - - // Process Cache - if (!doesInventoryHaveSpace()) return; - - for (ICropTile tCrop : this.mCropCache) { - if (tCrop == null) { - this.mInvalidCache = true; - break; - } - CropCard aCrop = tCrop.getCrop(); - if (aCrop == null) continue; - - if (this.mModeAlternative) processSecondaryFunctions(tCrop); - if (!this.mHarvestEnabled) continue; - - if (aCrop.canBeHarvested(tCrop) && tCrop.getSize() == aCrop.getOptimalHavestSize(tCrop)) { - if (!getBaseMetaTileEntity().decreaseStoredEnergyUnits(powerUsage(), true)) continue; - ItemStack[] aHarvest = tCrop.harvest_automated(true); - if (aHarvest == null) continue; - - for (ItemStack aStack : aHarvest) { - if (!ItemUtils.checkForInvalidItems(aStack)) continue; - if (this.mTier * 5 > MathUtils.randInt(1, 100)) { - aStack.stackSize += Math.floor(tCrop.getGain() / 10); - Logger.INFO("Bonus output given for " + aCrop.displayName()); - } - Logger.INFO("Harvested " + aCrop.displayName()); - aAllDrops.merge(aStack, aStack.stackSize, Integer::sum); - } - } - } - - if (aAllDrops.isEmpty()) return; - - Logger.INFO("Handling " + aAllDrops.size() + " Harvests"); - for (int i = SLOT_OUTPUT_START; i < this.getSizeInventory() && !aAllDrops.isEmpty(); i++) { - ItemStack invStack = mInventory[i]; - if (invStack == null || GT_Utility.isStackInvalid(invStack) || invStack.stackSize == 0) { - Iterator<Entry<ItemStack, Integer>> iter = aAllDrops.entrySet() - .iterator(); - if (!iter.hasNext()) return; - Entry<ItemStack, Integer> e = iter.next(); - int toAdd = e.getValue(); - int toAddThisSlot = Math.min( - toAdd, - e.getKey() - .getMaxStackSize()); - getBaseMetaTileEntity().setInventorySlotContents(i, GT_Utility.copyAmount(toAddThisSlot, e.getKey())); - toAdd -= toAddThisSlot; - if (toAdd <= toAddThisSlot) { - iter.remove(); - } else { - e.setValue(toAdd); - } - } else { - Integer toAddMaybeNull = aAllDrops.get(invStack); - if (toAddMaybeNull != null) { - int toAdd = toAddMaybeNull; - int space = Math.min(invStack.getMaxStackSize(), getInventoryStackLimit()) - invStack.stackSize; - if (toAdd <= space) { - getBaseMetaTileEntity().addStackToSlot(i, invStack, toAdd); - aAllDrops.remove(invStack); - } else { - getBaseMetaTileEntity().addStackToSlot(i, invStack, space); - aAllDrops.put(invStack, toAdd - space); - } - } - } - } - } - - public boolean hasFertilizer() { - for (int i = SLOT_FERT_1; i <= SLOT_FERT_4; i++) { - if (this.mInventory[i] != null) { - return true; - } - } - return false; - } - - public boolean consumeFertilizer(boolean aSimulate) { - if (hasFertilizer()) { - for (int i = SLOT_FERT_1; i <= SLOT_FERT_4; i++) { - if (this.mInventory[i] != null) { - consume(i, 1, aSimulate); - return true; - } - } - } - return false; - } - - public boolean hasWeedEX() { - for (int i = SLOT_WEEDEX_1; i <= SLOT_WEEDEX_2; i++) { - if (this.mInventory[i] != null) { - return true; - } - } - return false; - } - - public boolean consumeWeedEX(boolean aSimulate) { - if (hasWeedEX()) { - for (int i = SLOT_WEEDEX_1; i <= SLOT_WEEDEX_2; i++) { - if (this.mInventory[i] != null) { - damage(i, 1, aSimulate); - return true; - } - } - } - return false; - } - - public void processSecondaryFunctions(ICropTile aCrop) { - if (!this.mModeAlternative) { - return; - } - if (hasFertilizer() && consumeFertilizer(true) - && this.getBaseMetaTileEntity() - .getUniversalEnergyStored() >= getMinimumStoredEU() - && getBaseMetaTileEntity().decreaseStoredEnergyUnits(powerUsageSecondary(), true) - && applyFertilizer(aCrop)) { - if (consumeFertilizer(false)) { - // Logger.INFO("Consumed Fert."); - } - } - if (this.getFluidAmount() > 0 && this.getBaseMetaTileEntity() - .getUniversalEnergyStored() >= getMinimumStoredEU() - && getBaseMetaTileEntity().decreaseStoredEnergyUnits(powerUsageSecondary(), true) - && applyHydration(aCrop)) { - // Logger.INFO("Consumed Water."); - } - if (hasWeedEX() && consumeWeedEX(true) - && this.getBaseMetaTileEntity() - .getUniversalEnergyStored() >= getMinimumStoredEU() - && getBaseMetaTileEntity().decreaseStoredEnergyUnits(powerUsageSecondary(), true) - && applyWeedEx(aCrop)) { - if (consumeWeedEX(false)) { - // Logger.INFO("Consumed Weed-EX."); - } - } - } - - public boolean applyWeedEx(ICropTile aCrop) { - if (aCrop.getWeedExStorage() < 150) { - aCrop.setWeedExStorage(aCrop.getWeedExStorage() + 50); - boolean triggerDecline; - triggerDecline = aCrop.getWorld().rand.nextInt(3) == 0; - if (aCrop.getCrop() != null && aCrop.getCrop() - .isWeed(aCrop) && aCrop.getWeedExStorage() >= 75 && triggerDecline) { - switch (aCrop.getWorld().rand.nextInt(5)) { - case 0: - if (aCrop.getGrowth() > 0) { - aCrop.setGrowth((byte) (aCrop.getGrowth() - 1)); - } - case 1: - if (aCrop.getGain() > 0) { - aCrop.setGain((byte) (aCrop.getGain() - 1)); - } - default: - if (aCrop.getResistance() > 0) { - aCrop.setResistance((byte) (aCrop.getResistance() - 1)); - } - } - } - return true; - } else { - return false; - } - } - - public boolean applyFertilizer(ICropTile aCrop) { - if (aCrop.getNutrientStorage() >= 100) { - return false; - } else { - // Logger.INFO("Current Nutrient: "+aCrop.getNutrientStorage()+" for "+aCrop.getCrop().displayName()); - aCrop.setNutrientStorage(aCrop.getNutrientStorage() + 100); - return true; - } - } - - public boolean applyHydration(ICropTile aCrop) { - if (aCrop.getHydrationStorage() >= 200 || this.getFluidAmount() == 0) { - // Logger.INFO("Hydration Max"); - return false; - } else { - int apply = 200 - aCrop.getHydrationStorage(); - if (this.getFluidAmount() >= 0) { - int drain = 0; - if (this.getFluidAmount() >= apply) { - drain = apply; - } else { - drain = this.getFluidAmount(); - } - this.mFluid.amount -= drain; - if (this.mFluid.amount <= 0) { - this.mFluid = null; - } - // Logger.INFO("Did Hydrate"); - aCrop.setHydrationStorage(aCrop.getHydrationStorage() + drain); - return true; - } else { - // Logger.INFO("No water?"); - return false; - } - } - } - - public boolean consume(int aSlot, int amount, boolean simulate) { - ItemStack stack = this.mInventory[aSlot]; - if (stack != null && stack.stackSize >= amount) { - int currentAmount = Math.min(amount, stack.stackSize); - amount -= currentAmount; - if (!simulate) { - if (stack.stackSize == currentAmount) { - this.mInventory[aSlot] = null; - } else { - stack.stackSize -= currentAmount; - } - } else { - return amount >= 0; - } - return true; - } - return false; - } - - public ItemStack damage(int aSlot, int amount, boolean simulate) { - ItemStack ret = null; - int damageApplied = 0; - ItemStack stack = this.mInventory[aSlot]; - Item item = stack.getItem(); - if (stack != null && item.isDamageable() - && (ret == null || stack.getItem() == ret.getItem() && ItemStack.areItemStackTagsEqual(stack, ret))) { - if (simulate) { - stack = stack.copy(); - } - int maxDamage = DamageHandler.getMaxDamage(stack); - while (amount > 0 && stack.stackSize > 0) { - int currentAmount = Math.min(amount, maxDamage - DamageHandler.getDamage(stack)); - DamageHandler.damage(stack, currentAmount, null); - damageApplied += currentAmount; - amount -= currentAmount; - if (DamageHandler.getDamage(stack) >= maxDamage) { - --stack.stackSize; - DamageHandler.setDamage(stack, 0); - } - - if (ret == null) { - ret = stack.copy(); - } - } - if (stack.stackSize == 0 && !simulate) { - this.mInventory[aSlot] = null; - } - } - - if (ret != null) { - int i = DamageHandler.getMaxDamage(ret); - ret.stackSize = damageApplied / i; - DamageHandler.setDamage(ret, damageApplied % i); - } - return ret; - } - - @Override - public boolean allowPullStack(IGregTechTileEntity aBaseMetaTileEntity, int aIndex, ForgeDirection side, - ItemStack aStack) { - return aStack != null && aIndex >= SLOT_OUTPUT_START && aIndex < this.getSizeInventory(); - } - - @Override - public boolean allowPutStack(IGregTechTileEntity aBaseMetaTileEntity, int aIndex, ForgeDirection side, - ItemStack aStack) { - if (aStack != null) { - if (aStack.getItem() - .getUnlocalizedName() - .equals("ic2.itemFertilizer")) { - return aIndex >= SLOT_FERT_1 && aIndex <= SLOT_FERT_4; - } else if (aStack.getItem() - .getUnlocalizedName() - .equals("ic2.itemWeedEx")) { - return aIndex >= SLOT_WEEDEX_1 && aIndex <= SLOT_WEEDEX_2; - } - } - return false; - } - - @Override - public String[] getDescription() { - int aRadius = 10 + getRange(this.mTier); - int aSide = (aRadius - 1) / 2; - return ArrayUtils.addAll( - this.mDescriptionArray, - "Secondary mode can Hydrate/Fertilize/Weed-EX", - "Consumes " + powerUsage() + "eu per harvest", - "Consumes " + powerUsageSecondary() + "eu per secondary operation", - "Can harvest 1 block level above and below itself", - "Radius: " + aSide + " blocks each side (" + aRadius + "x3x" + aRadius + ")", - "Has " + (this.mTier * 5) + "% chance for extra drops", - "Holds " + this.getCapacity() + "L of Water", - CORE.GT_Tooltip.get()); - } - - @Override - public boolean allowCoverOnSide(ForgeDirection side, GT_ItemStack aStack) { - return true; - } - - /* - * @Override public int getTextureIndex(byte aSide, byte aFacing, boolean aActive, boolean aRedstone) { if (aSide == - * aFacing) return 118+(aRedstone?8:0); if (GT_Utility.getOppositeSide(aSide) == aFacing) return - * 113+(aRedstone?8:0); int tIndex = 128+(aRedstone?8:0); switch (aFacing) { case 0: return tIndex+64; case 1: - * return tIndex+32; case 2: switch (aSide) { case 0: return tIndex+32; case 1: return tIndex+32; case 4: return - * tIndex+16; case 5: return tIndex+48; } case 3: switch (aSide) { case 0: return tIndex+64; case 1: return - * tIndex+64; case 4: return tIndex+48; case 5: return tIndex+16; } case 4: switch (aSide) { case 0: return - * tIndex+16; case 1: return tIndex+16; case 2: return tIndex+48; case 3: return tIndex+16; } case 5: switch (aSide) - * { case 0: return tIndex+48; case 1: return tIndex+48; case 2: return tIndex+16; case 3: return tIndex+48; } } - * return tIndex; } - */ - - @Override - public ITexture[][][] getTextureSet(final ITexture[] aTextures) { - final ITexture[][][] rTextures = new ITexture[10][17][]; - for (byte i = -1; i < 16; i++) { - rTextures[0][i + 1] = this.getFront(i); - rTextures[1][i + 1] = this.getBack(i); - rTextures[2][i + 1] = this.getBottom(i); - rTextures[3][i + 1] = this.getTop(i); - rTextures[4][i + 1] = this.getSides(i); - rTextures[5][i + 1] = this.getFront(i); - rTextures[6][i + 1] = this.getBack(i); - rTextures[7][i + 1] = this.getBottom(i); - rTextures[8][i + 1] = this.getTop(i); - rTextures[9][i + 1] = this.getSides(i); - } - return rTextures; - } - - @Override - public ITexture[] getTexture(final IGregTechTileEntity aBaseMetaTileEntity, final ForgeDirection side, - final ForgeDirection facing, final int aColorIndex, final boolean aActive, final boolean aRedstone) { - if (side == ForgeDirection.DOWN || side == ForgeDirection.UP) { - return this.mTextures[3][aColorIndex + 1]; - } else { - return this.mTextures[4][aColorIndex + 1]; - } - /* - * return this.mTextures[(aActive ? 5 : 0) + (side == facing ? 0 : aSide == GT_Utility.getOppositeSide(aFacing) - * ? 1 : side == ForgeDirection.DOWN ? 2 : side == ForgeDirection.UP ? 3 : 4)][aColorIndex + 1]; - */ - } - - public ITexture[] getFront(final byte aColor) { - return new ITexture[] { Textures.BlockIcons.MACHINE_CASINGS[this.mTier][aColor + 1], - new GT_RenderedTexture(TexturesGtBlock.Casing_CropHarvester_Cutter) }; - } - - public ITexture[] getBack(final byte aColor) { - return new ITexture[] { Textures.BlockIcons.MACHINE_CASINGS[this.mTier][aColor + 1], - new GT_RenderedTexture(TexturesGtBlock.Casing_CropHarvester_Cutter) }; - } - - public ITexture[] getBottom(final byte aColor) { - return new ITexture[] { Textures.BlockIcons.MACHINE_CASINGS[this.mTier][aColor + 1], - new GT_RenderedTexture(TexturesGtBlock.Casing_CropHarvester_Boxes) }; - } - - public ITexture[] getTop(final byte aColor) { - return new ITexture[] { Textures.BlockIcons.MACHINE_CASINGS[this.mTier][aColor + 1], - new GT_RenderedTexture(TexturesGtBlock.Casing_CropHarvester_Boxes) }; - } - - public ITexture[] getSides(final byte aColor) { - return new ITexture[] { Textures.BlockIcons.MACHINE_CASINGS[this.mTier][aColor + 1], - new GT_RenderedTexture(TexturesGtBlock.Casing_CropHarvester_Cutter) }; - } - - @Override - public boolean doesFillContainers() { - return false; - } - - @Override - public boolean doesEmptyContainers() { - return false; - } - - @Override - public boolean canTankBeFilled() { - return true; - } - - @Override - public boolean canTankBeEmptied() { - return false; - } - - @Override - public boolean displaysItemStack() { - return false; - } - - @Override - public boolean displaysStackSize() { - return false; - } - - @Override - public void saveNBTData(NBTTagCompound aNBT) { - super.saveNBTData(aNBT); - aNBT.setBoolean("mModeAlternative", this.mModeAlternative); - aNBT.setBoolean("mHarvestEnabled", this.mHarvestEnabled); - } - - @Override - public void loadNBTData(NBTTagCompound aNBT) { - super.loadNBTData(aNBT); - this.mModeAlternative = aNBT.getBoolean("mModeAlternative"); - if (aNBT.hasKey("mHarvestEnabled")) { - this.mHarvestEnabled = aNBT.getBoolean("mHarvestEnabled"); - } - } - - @Override - public boolean useModularUI() { - return true; - } - - @Override - public void addUIWidgets(ModularWindow.Builder builder, UIBuildContext buildContext) { - builder.widget( - new CycleButtonWidget().setToggle(() -> mModeAlternative, val -> mModeAlternative = val) - .setTexture(GTPP_UITextures.OVERLAY_BUTTON_HARVESTER_MODE) - .addTooltip(0, "Enable Hydration/Fertilizing/Weed-EX") - .addTooltip(1, "Disable Hydration/Fertilizing/Weed-EX") - .setBackground(GT_UITextures.BUTTON_STANDARD) - .setPos(47, 63) - .setSize(18, 18)); - builder.widget( - new CycleButtonWidget().setToggle(() -> mHarvestEnabled, val -> mHarvestEnabled = val) - .setTexture(GTPP_UITextures.OVERLAY_BUTTON_HARVESTER_TOGGLE) - .addTooltip(0, "Enable Harvest") - .addTooltip(1, "Disable Harvest") - .setBackground(GT_UITextures.BUTTON_STANDARD) - .setPos(67, 63) - .setSize(18, 18)); - builder.widget( - SlotGroup.ofItemHandler(inventoryHandler, 2) - .startFromSlot(SLOT_WEEDEX_1) - .endAtSlot(SLOT_WEEDEX_2) - .applyForWidget( - widget -> widget.setFilter( - stack -> stack != null && stack.getItem() - .getUnlocalizedName() - .equals("ic2.itemWeedEx")) - .setBackground(getGUITextureSet().getItemSlot(), GTPP_UITextures.OVERLAY_SLOT_WEED_EX)) - .build() - .setPos(7, 13)) - .widget( - SlotGroup.ofItemHandler(inventoryHandler, 2) - .startFromSlot(SLOT_FERT_1) - .endAtSlot(SLOT_FERT_4) - .applyForWidget( - widget -> widget.setFilter( - stack -> stack != null && stack.getItem() - .getUnlocalizedName() - .equals("ic2.itemFertilizer")) - .setBackground(getGUITextureSet().getItemSlot(), GTPP_UITextures.OVERLAY_SLOT_FERTILIZER)) - .build() - .setPos(7, 31)) - .widget( - SlotGroup.ofItemHandler(inventoryHandler, 6) - .startFromSlot(SLOT_OUTPUT_START) - .endAtSlot(SLOT_OUTPUT_START + 6 * 3) - .canInsert(false) - .build() - .setPos(61, 7)); - builder - .widget( - new ProgressBar() - .setTexture(GTPP_UITextures.PROGRESSBAR_BOILER_EMPTY, GT_UITextures.PROGRESSBAR_BOILER_WATER, 54) - .setDirection(ProgressBar.Direction.UP) - .setProgress(() -> (float) getFluidAmount() / getCapacity()) - .setSynced(false, false) - .dynamicTooltip( - () -> Collections.singletonList("Water: " + getFluidAmount() + "L / " + getCapacity() + "L")) - .setPos(47, 7) - .setSize(10, 54)) - .widget(new FakeSyncWidget.FluidStackSyncer(this::getDrainableStack, this::setDrainableStack)); - } -} diff --git a/gtpp/src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/basic/GregtechMetaAtmosphericReconditioner.java b/gtpp/src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/basic/GregtechMetaAtmosphericReconditioner.java deleted file mode 100644 index 9f2789b520..0000000000 --- a/gtpp/src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/basic/GregtechMetaAtmosphericReconditioner.java +++ /dev/null @@ -1,893 +0,0 @@ -package gtPlusPlus.xmod.gregtech.common.tileentities.machines.basic; - -import static gregtech.api.enums.GT_Values.V; - -import java.util.Collections; - -import net.minecraft.entity.player.EntityPlayer; -import net.minecraft.item.ItemStack; -import net.minecraft.nbt.NBTTagCompound; -import net.minecraft.world.World; -import net.minecraft.world.chunk.Chunk; -import net.minecraftforge.common.util.ForgeDirection; - -import org.apache.commons.lang3.ArrayUtils; - -import com.gtnewhorizons.modularui.api.screen.ModularWindow; -import com.gtnewhorizons.modularui.api.screen.UIBuildContext; -import com.gtnewhorizons.modularui.common.widget.DrawableWidget; -import com.gtnewhorizons.modularui.common.widget.FakeSyncWidget; -import com.gtnewhorizons.modularui.common.widget.SlotWidget; - -import gregtech.api.enums.Materials; -import gregtech.api.enums.SoundResource; -import gregtech.api.enums.Textures; -import gregtech.api.gui.modularui.GT_UITextures; -import gregtech.api.interfaces.ITexture; -import gregtech.api.interfaces.tileentity.IGregTechTileEntity; -import gregtech.api.items.GT_MetaGenerated_Tool; -import gregtech.api.metatileentity.MetaTileEntity; -import gregtech.api.metatileentity.implementations.GT_MetaTileEntity_BasicMachine; -import gregtech.api.objects.GT_ItemStack; -import gregtech.api.objects.GT_RenderedTexture; -import gregtech.api.util.GT_ModHandler; -import gregtech.api.util.GT_Utility; -import gregtech.common.items.GT_MetaGenerated_Tool_01; -import gtPlusPlus.api.objects.Logger; -import gtPlusPlus.api.objects.data.AutoMap; -import gtPlusPlus.core.item.general.ItemAirFilter; -import gtPlusPlus.core.item.general.ItemBasicScrubberTurbine; -import gtPlusPlus.core.recipe.common.CI; -import gtPlusPlus.core.util.math.MathUtils; -import gtPlusPlus.core.util.minecraft.gregtech.PollutionUtils; -import gtPlusPlus.xmod.gregtech.api.gui.GTPP_UITextures; -import gtPlusPlus.xmod.gregtech.common.blocks.textures.TexturesGtBlock; - -public class GregtechMetaAtmosphericReconditioner extends GT_MetaTileEntity_BasicMachine { - - public int mPollutionReduction = 0; - protected int mBaseEff = 2500; - protected int mOptimalAirFlow = 0; - protected boolean mHasPollution = false; - protected int SLOT_ROTOR = 5; - protected int SLOT_FILTER = 6; - protected static boolean mPollutionEnabled = true; - - protected boolean mSaveRotor = false; - - public GregtechMetaAtmosphericReconditioner(int aID, String aName, String aNameRegional, int aTier) { - super( - aID, - aName, - aNameRegional, - aTier, - 2, - "Making sure you don't live in Gwalior - Uses 2A", - 3, - 0, - new ITexture[] { new GT_RenderedTexture(Textures.BlockIcons.OVERLAY_SIDE_MASSFAB_ACTIVE), - new GT_RenderedTexture(Textures.BlockIcons.OVERLAY_SIDE_MASSFAB), - new GT_RenderedTexture(TexturesGtBlock.Overlay_MatterFab_Active), - new GT_RenderedTexture(TexturesGtBlock.Overlay_MatterFab), - new GT_RenderedTexture(TexturesGtBlock.Overlay_Machine_Vent_Fast), - new GT_RenderedTexture(TexturesGtBlock.Overlay_Machine_Vent), - new GT_RenderedTexture(Textures.BlockIcons.OVERLAY_BOTTOM_MASSFAB_ACTIVE), - new GT_RenderedTexture(Textures.BlockIcons.OVERLAY_BOTTOM_MASSFAB) }); - mPollutionEnabled = PollutionUtils.isPollutionEnabled(); - } - - public GregtechMetaAtmosphericReconditioner(String aName, int aTier, String[] aDescription, - ITexture[][][] aTextures) { - super(aName, aTier, 2, aDescription, aTextures, 2, 0); - mPollutionEnabled = PollutionUtils.isPollutionEnabled(); - } - - @Override - public MetaTileEntity newMetaEntity(IGregTechTileEntity aTileEntity) { - return new GregtechMetaAtmosphericReconditioner(this.mName, this.mTier, this.mDescriptionArray, this.mTextures); - } - - @Override - public String[] getDescription() { - - boolean highTier = this.mTier >= 7; - - String[] A = ArrayUtils.addAll( - this.mDescriptionArray, - highTier ? "Will attempt to remove 1/4 pollution from 8 surrounding chunks" : "", - highTier ? "If these chunks are not loaded, they will be ignored" : "", - "Requires a turbine rotor and an Air Filter [T1/T2] to run.", - "The turbine rotor must be manually inserted/replaced", - "Can be configured with a soldering iron to change modes", - "Low Efficiency: Removes half pollution, Turbine takes 50% dmg", - "High Efficiency: Removes full pollution, Turbine takes 100% dmg", - "Turbine Rotor will not break in LE mode", - "Insert an equal tier Conveyor Module to enable automation"); - if (!mPollutionEnabled) { - String[] B = new String[] { "===============================================", - "Pollution is disabled, scrubbers will now have a bonus use", - "They are now able to remove ALL lingering pollution as GT ignores it", "and it will linger forever!", - "===============================================", }; - A = ArrayUtils.addAll(A, B); - } - return A; - } - - @Override - public void saveNBTData(NBTTagCompound aNBT) { - super.saveNBTData(aNBT); - aNBT.setInteger("mOptimalAirFlow", this.mOptimalAirFlow); - aNBT.setBoolean("mSaveRotor", mSaveRotor); - } - - @Override - public void loadNBTData(NBTTagCompound aNBT) { - super.loadNBTData(aNBT); - this.mOptimalAirFlow = aNBT.getInteger("mOptimalAirFlow"); - this.mSaveRotor = aNBT.getBoolean("mSaveRotor"); - } - - @Override - public long maxAmperesIn() { - return 2; - } - - @Override - public long getMinimumStoredEU() { - return V[mTier] * 2; - } - - @Override - public long maxEUStore() { - return V[mTier] * 256; - } - - @Override - public long maxEUInput() { - return V[mTier]; - } - - @Override - public void onPostTick(IGregTechTileEntity aBaseMetaTileEntity, long aTick) { - super.onPostTick(aBaseMetaTileEntity, aTick); - if (aBaseMetaTileEntity.isServerSide()) { - - // Get Current Pollution Amount. - int mCurrentPollution = getCurrentChunkPollution(); - boolean isIdle = true; - - // Get Inventory Item - ItemStack stackRotor = this.mInventory[SLOT_ROTOR]; - ItemStack stackFilter = this.mInventory[SLOT_FILTER]; - - // Power Drain - long drainEU = maxEUInput() * maxAmperesIn(); - if (aBaseMetaTileEntity.isActive() && aBaseMetaTileEntity.getStoredEU() >= drainEU) { - if (aBaseMetaTileEntity.decreaseStoredEnergyUnits(drainEU, false)) { - isIdle = false; - } else { - aBaseMetaTileEntity.setActive(false); - this.sendSound((byte) -122); - } - } else if (!aBaseMetaTileEntity.isActive() && aBaseMetaTileEntity.getStoredEU() >= drainEU / 4) { - if (aBaseMetaTileEntity.decreaseStoredEnergyUnits((drainEU / 4), false)) { - isIdle = false; - } else { - aBaseMetaTileEntity.setActive(false); - this.sendSound((byte) -122); - } - } else { - aBaseMetaTileEntity.setActive(false); - this.sendSound((byte) -122); - } - - // Only try once/sec. - if (!isIdle && aTick % 20L == 0L) { - - for (int i = 0; i < this.mInventory.length; i++) { - ItemStack aSlotContent = this.mInventory[i]; - if (aSlotContent != null) { - Logger.INFO("Found " + aSlotContent.getDisplayName() + " in slot " + i); - } - } - - for (int i = 0; i < this.mInventory.length; i++) { - if (hasRotor(this.mInventory[i])) { - Logger.INFO("Found Rotor in slot " + i); - break; - } - } - for (int i = 0; i < this.mInventory.length; i++) { - if (hasAirFilter(this.mInventory[i])) { - Logger.INFO("Found Filter in slot " + i); - break; - } - } - - // Check if machine can work. - if ((aBaseMetaTileEntity.isAllowedToWork())) { - Logger.INFO("Can work."); - - // Enable machine animation/graphic - if (hasRotor(stackRotor) && hasAirFilter(stackFilter) && this.mHasPollution) { - if (!this.getBaseMetaTileEntity() - .isActive()) { - Logger.INFO("Set Active."); - aBaseMetaTileEntity.setActive(true); - } - } else if (!this.mHasPollution || mCurrentPollution <= 0 - || stackRotor == null - || stackFilter == null - || !hasRotor(stackRotor) - || !hasAirFilter(stackFilter)) { - if (!this.getBaseMetaTileEntity() - .isActive()) { - Logger.INFO("Set Inactive."); - aBaseMetaTileEntity.setActive(false); - this.sendSound((byte) -122); - } - } - - // If Active. - if (aBaseMetaTileEntity.isActive()) { - Logger.INFO("Doing something."); - - // Do nothing if there is no pollution. - if (this.mHasPollution && mCurrentPollution > 0) { - Logger - .INFO("Has Pollution? " + mHasPollution + ", Current Pollution: " + mCurrentPollution); - - // Only check every 30s. - if (!isIdle && aTick % (20L * 30) == 0L) { - mPollutionEnabled = PollutionUtils.isPollutionEnabled(); - // Clear out pollution if it's disabled, because I am a nice gal. - if (!PollutionUtils.isPollutionEnabled()) { - PollutionUtils.nullifyPollution(this.getBaseMetaTileEntity()); - } - } - - // Use a Turbine - if (hasRotor(stackRotor) && hasAirFilter(stackFilter)) { - Logger.INFO("Found Turbine."); - - mBaseEff = getBaseEfficiency(stackRotor); - mOptimalAirFlow = getOptimalAirFlow(stackRotor); - - // Make sure we have a valid Turbine and Eff/Airflow - if (this.mBaseEff > 0 && this.mOptimalAirFlow > 0) { - // Utils.LOG_WARNING("Pollution Cleaner [5]"); - - // Log Debug information. - Logger.INFO("mBaseEff[1]:" + mBaseEff); - Logger.INFO("mOptimalAirFlow[1]:" + mOptimalAirFlow); - - // Calculate The Voltage we are running - long tVoltage = drainEU; - byte tTier = (byte) Math.max(1, GT_Utility.getTier(tVoltage)); - - // Check Sides for Air, - // More air means more pollution processing. - int mAirSides = getFreeSpaces(); - - int reduction = 0; - - // If no sides are free, how will you process the atmosphere? - if (mAirSides > 0) { - reduction += (((Math.max((tTier - 2), 1) * 2) * 50) * mAirSides); // Was - // originally - // *100 - Logger.INFO("mPollutionReduction[1]:" + reduction); - - // I stole this code - reduction = (MathUtils.safeInt((long) reduction * this.mBaseEff) / 100000) - * mAirSides - * Math.max((tTier - 2), 1); - Logger.INFO("reduction[2]:" + reduction); - reduction = MathUtils.safeInt(((long) reduction / 100) * this.mOptimalAirFlow); - Logger.INFO("reduction[3]:" + reduction); - - mPollutionReduction = reduction; - - // Set a temp to remove variable to aleviate duplicate code. - int toRemove = 0; - - Logger.INFO("mCurrentPollution[4]:" + mCurrentPollution); - Logger.INFO("mCurrentPollution[5]:" + reduction); - if (reduction <= mCurrentPollution) { - // Clean some Air. - toRemove = reduction; - } else { - // Makes sure we don't get negative pollution. - toRemove = mCurrentPollution; - } - - toRemove = toRemove / 2; - Logger.INFO("mCurrentPollution[6]:" + toRemove); - - // We are good to clean - if (toRemove > 0) { - if (damageTurbineRotor() && damageAirFilter()) { - Logger.INFO("Removing " + toRemove + " pollution"); - removePollution(mSaveRotor ? (toRemove / 2) : toRemove); - Logger.INFO("mNewPollution[4]:" + getCurrentChunkPollution()); - } else { - Logger.INFO("Could not damage turbine rotor or Air Filter."); - aBaseMetaTileEntity.setActive(false); - } - } // End of pollution removal block. - } // End of valid air sides block. - } // End of valid toolstats block. - } // End of correct inventory item block. - else { - // Utils.LOG_WARNING("Wrong Tool metaitem Found."); - } - } - } else if (!aBaseMetaTileEntity.isActive()) { - return; - } - } // End of can work block. - else { // Disable Machine. - // aBaseMetaTileEntity.setActive(false); - } - } // End of 1/sec action block. - else { - - if (hasRotor(stackRotor) && hasAirFilter(stackFilter) - && this.mHasPollution - && !isIdle - && aBaseMetaTileEntity.isAllowedToWork()) { - aBaseMetaTileEntity.setActive(true); - } else if (isIdle || !this.mHasPollution - || mCurrentPollution <= 0 - || stackRotor == null - || stackFilter == null - || !hasRotor(stackRotor) - || !hasAirFilter(stackFilter)) { - aBaseMetaTileEntity.setActive(false); - } - } - if (this.getBaseMetaTileEntity() - .isActive()) { - if (MathUtils.randInt(0, 5) <= 2) { - this.sendSound((byte) -120); - } - } - } // End of is serverside block. - } - - public int getCurrentChunkPollution() { - int mCurrentChunkPollution = 0; - if (this.mTier < 7) { - mCurrentChunkPollution = PollutionUtils.getPollution(getBaseMetaTileEntity()); - } else { - AutoMap<Chunk> aSurrounding = new AutoMap<>(); - World aWorld = this.getBaseMetaTileEntity() - .getWorld(); - int xPos = this.getBaseMetaTileEntity() - .getXCoord(); - int zPos = this.getBaseMetaTileEntity() - .getZCoord(); - Chunk a1 = aWorld.getChunkFromBlockCoords(xPos - 32, zPos - 32); - Chunk a2 = aWorld.getChunkFromBlockCoords(xPos - 32, zPos); - Chunk a3 = aWorld.getChunkFromBlockCoords(xPos - 32, zPos + 32); - Chunk b1 = aWorld.getChunkFromBlockCoords(xPos, zPos - 32); - Chunk b2 = aWorld.getChunkFromBlockCoords(xPos, zPos); - Chunk b3 = aWorld.getChunkFromBlockCoords(xPos, zPos + 32); - Chunk c1 = aWorld.getChunkFromBlockCoords(xPos + 32, zPos - 32); - Chunk c2 = aWorld.getChunkFromBlockCoords(xPos + 32, zPos); - Chunk c3 = aWorld.getChunkFromBlockCoords(xPos + 32, zPos + 32); - aSurrounding.put(a1); - aSurrounding.put(a2); - aSurrounding.put(a3); - aSurrounding.put(b1); - aSurrounding.put(b2); - aSurrounding.put(b3); - aSurrounding.put(c1); - aSurrounding.put(c2); - aSurrounding.put(c3); - for (Chunk r : aSurrounding) { - mCurrentChunkPollution += getPollutionInChunk(r); - } - } - if (mCurrentChunkPollution > 0) { - mHasPollution = true; - } else { - mHasPollution = false; - } - return mCurrentChunkPollution; - } - - public int getPollutionInChunk(Chunk aChunk) { - int mCurrentChunkPollution = PollutionUtils.getPollution(aChunk); - if (mCurrentChunkPollution > 0) { - mHasPollution = true; - } else { - mHasPollution = false; - } - return mCurrentChunkPollution; - } - - public boolean hasRotor(ItemStack rotorStack) { - if (rotorStack != null) { - if (rotorStack.getItem() instanceof ItemBasicScrubberTurbine) { - // Logger.INFO("Found Basic Turbine Rotor."); - return true; - } else if (rotorStack.getItem() instanceof GT_MetaGenerated_Tool && rotorStack.getItemDamage() >= 170 - && rotorStack.getItemDamage() <= 179) { - // Logger.INFO("Found Turbine Rotor."); - return true; - } else { - // Logger.INFO("Found: "+rotorStack.getDisplayName()+":"+rotorStack.getItemDamage()); - } - } - // Logger.INFO("Found No Turbine Rotor."); - return false; - } - - public boolean damageTurbineRotor() { - try { - - boolean creativeRotor = false; - ItemStack rotorStack = this.mInventory[SLOT_ROTOR]; - if (rotorStack == null) { - return false; - } else if (rotorStack.getItem() instanceof ItemBasicScrubberTurbine) { - long currentUse = ItemBasicScrubberTurbine.getFilterDamage(rotorStack); - // Remove broken Filter - if (rotorStack.getItemDamage() == 0 && currentUse >= 2000 - 10) { - Logger.INFO("Depleting ItemBasicScrubberTurbine T1"); - this.mInventory[this.SLOT_FILTER] = null; - return false; - } else if (rotorStack.getItemDamage() == 1 && currentUse >= 4000 - 10) { - Logger.INFO("Depleting ItemBasicScrubberTurbine T2"); - this.mInventory[this.SLOT_FILTER] = null; - return false; - } else if (rotorStack.getItemDamage() == 2 && currentUse >= 6000 - 10) { - Logger.INFO("Depleting ItemBasicScrubberTurbine T3"); - this.mInventory[this.SLOT_FILTER] = null; - return false; - } else { - // Do Damage - Logger.INFO("Damaging ItemBasicScrubberTurbine"); - ItemBasicScrubberTurbine.setFilterDamage(rotorStack, currentUse + 10); - Logger.INFO("Rotor Damage: " + currentUse); - return true; - } - } else if (rotorStack.getItem() instanceof GT_MetaGenerated_Tool_01) { - Materials t1 = GT_MetaGenerated_Tool.getPrimaryMaterial(rotorStack); - Materials t2 = GT_MetaGenerated_Tool.getSecondaryMaterial(rotorStack); - if (t1 == Materials._NULL && t2 == Materials._NULL) { - Logger.INFO("Found creative rotor."); - creativeRotor = true; - } - } else { - Logger.INFO("Bad item in rotor slot."); - return false; - } - - if (mInventory[SLOT_ROTOR].getItem() instanceof GT_MetaGenerated_Tool_01 - && ((GT_MetaGenerated_Tool) mInventory[SLOT_ROTOR].getItem()).getToolStats(mInventory[SLOT_ROTOR]) - .getSpeedMultiplier() > 0 - && GT_MetaGenerated_Tool.getPrimaryMaterial(mInventory[SLOT_ROTOR]).mToolSpeed > 0) { - - long damageValue = (long) Math - .floor(Math.abs(MathUtils.randFloat(1, 2) - MathUtils.randFloat(1, 3)) * (1 + 3 - 1) + 1); - double fDam = Math - .floor(Math.abs(MathUtils.randFloat(1f, 2f) - MathUtils.randFloat(1f, 2f)) * (1f + 2f - 1f) + 1f); - damageValue -= fDam; - - // Logger.INFO("Trying to do "+damageValue+" damage to the rotor. ["+fDam+"]"); - /* - * Materials M1 = GT_MetaGenerated_Tool.getPrimaryMaterial(this.mInventory[this.SLOT_ROTOR]); Materials - * M2 = GT_MetaGenerated_Tool.getSecondaryMaterial(this.mInventory[this.SLOT_ROTOR]); - * Logger.INFO("Trying to do "+damageValue+" damage to the rotor. [2]"); - */ - - // Damage Rotor - // int rotorDurability = this.mInventory[this.SLOT_ROTOR].getItemDamage(); - long rotorDamage = creativeRotor ? 0 - : GT_MetaGenerated_Tool.getToolDamage(this.mInventory[this.SLOT_ROTOR]); - long rotorDurabilityMax = creativeRotor ? Integer.MAX_VALUE - : GT_MetaGenerated_Tool.getToolMaxDamage(this.mInventory[this.SLOT_ROTOR]); - long rotorDurability = (rotorDurabilityMax - rotorDamage); - Logger.INFO( - "Rotor Damage: " + rotorDamage - + " | Max Durability: " - + rotorDurabilityMax - + " | " - + " Remaining Durability: " - + rotorDurability); - if (rotorDurability >= damageValue) { - - if (!mSaveRotor) { - Logger.INFO("Damaging Rotor."); - - if (!creativeRotor) GT_ModHandler - .damageOrDechargeItem(this.mInventory[this.SLOT_ROTOR], (int) damageValue, 0, null); - - long tempDur = GT_MetaGenerated_Tool.getToolDamage(this.mInventory[this.SLOT_ROTOR]); - if (tempDur < rotorDurabilityMax) { - return true; - } else { - rotorDurability = 0; - } - } else { - Logger.INFO("Damaging Rotor."); - if (rotorDurability > 1000) { - if (!creativeRotor) GT_ModHandler - .damageOrDechargeItem(this.mInventory[this.SLOT_ROTOR], (int) damageValue / 2, 0, null); - long tempDur = GT_MetaGenerated_Tool.getToolDamage(this.mInventory[this.SLOT_ROTOR]); - if (tempDur < rotorDurabilityMax) { - return true; - } else { - rotorDurability = 0; - } - } - } - } - - if (rotorDurability <= 0 && !mSaveRotor && !creativeRotor) { - Logger.INFO("Destroying Rotor."); - this.mInventory[this.SLOT_ROTOR] = null; - return false; - } else if (rotorDurability <= 0 && mSaveRotor) { - Logger.INFO("Saving Rotor."); - return false; - } - - } else { - Logger.INFO("Bad Rotor."); - return false; - } - } catch (Throwable t) { - t.printStackTrace(); - } - return false; - } - - public int getFreeSpaces() { - int mAir = 0; - IGregTechTileEntity aBaseMetaTileEntity = this.getBaseMetaTileEntity(); - if (aBaseMetaTileEntity.getAirOffset(1, 0, 0)) { - mAir++; - } - if (aBaseMetaTileEntity.getAirOffset(-1, 0, 0)) { - mAir++; - } - if (aBaseMetaTileEntity.getAirOffset(0, 0, 1)) { - mAir++; - } - if (aBaseMetaTileEntity.getAirOffset(0, 0, -1)) { - mAir++; - } - if (aBaseMetaTileEntity.getAirOffset(0, 1, 0)) { - mAir++; - } - if (aBaseMetaTileEntity.getAirOffset(0, -1, 0)) { - mAir++; - } - return mAir; - } - - public boolean removePollution(int toRemove) { - - if (this == null || this.getBaseMetaTileEntity() == null - || this.getBaseMetaTileEntity() - .getWorld() == null) { - return false; - } - - if (this.mTier < 7) { - int startPollution = getCurrentChunkPollution(); - Logger.INFO("Current Chunk Pollution: " + startPollution); - PollutionUtils.removePollution(this.getBaseMetaTileEntity(), toRemove); - int after = getCurrentChunkPollution(); - Logger.INFO("Current Chunk Pollution: " + after); - return (after < startPollution); - } else { - int chunksWithRemoval = 0; - int totalRemoved = 0; - AutoMap<Chunk> aSurrounding = new AutoMap<>(); - Chunk aThisChunk = this.getBaseMetaTileEntity() - .getWorld() - .getChunkFromBlockCoords( - this.getBaseMetaTileEntity() - .getXCoord(), - this.getBaseMetaTileEntity() - .getZCoord()); - int mainChunkX = aThisChunk.xPosition; - int mainChunkZ = aThisChunk.zPosition; - - World aWorld = this.getBaseMetaTileEntity() - .getWorld(); - int xPos = this.getBaseMetaTileEntity() - .getXCoord(); - int zPos = this.getBaseMetaTileEntity() - .getZCoord(); - - Chunk a1 = aWorld.getChunkFromBlockCoords(xPos - 32, zPos - 32); - Chunk a2 = aWorld.getChunkFromBlockCoords(xPos - 32, zPos); - Chunk a3 = aWorld.getChunkFromBlockCoords(xPos - 32, zPos + 32); - Chunk b1 = aWorld.getChunkFromBlockCoords(xPos, zPos - 32); - Chunk b2 = aWorld.getChunkFromBlockCoords(xPos, zPos); - Chunk b3 = aWorld.getChunkFromBlockCoords(xPos, zPos + 32); - Chunk c1 = aWorld.getChunkFromBlockCoords(xPos + 32, zPos - 32); - Chunk c2 = aWorld.getChunkFromBlockCoords(xPos + 32, zPos); - Chunk c3 = aWorld.getChunkFromBlockCoords(xPos + 32, zPos + 32); - - aSurrounding.put(a1); - aSurrounding.put(a2); - aSurrounding.put(a3); - aSurrounding.put(b1); - aSurrounding.put(b2); - aSurrounding.put(b3); - aSurrounding.put(c1); - aSurrounding.put(c2); - aSurrounding.put(c3); - - for (Chunk r : aSurrounding) { - if (!r.isChunkLoaded) { - continue; - } - - int startPollution = getPollutionInChunk(r); - if (startPollution == 0) { - continue; - } - - Logger.INFO( - "Trying to remove pollution from chunk " + r.xPosition - + ", " - + r.zPosition - + " | " - + startPollution); - int after = 0; - boolean isMainChunk = r.isAtLocation(mainChunkX, mainChunkZ); - - int removal = Math.max(0, !isMainChunk ? (toRemove / 4) : toRemove); - if (removePollution(r, removal)) { - chunksWithRemoval++; - after = getPollutionInChunk(r); - } else { - after = 0; - } - if (startPollution - after > 0) { - totalRemoved += (startPollution - after); - } - Logger.INFO( - "Removed " + (startPollution - after) - + " pollution from chunk " - + r.xPosition - + ", " - + r.zPosition - + " | " - + after); - } - return totalRemoved > 0 && chunksWithRemoval > 0; - } - } - - public boolean removePollution(Chunk aChunk, int toRemove) { - int before = getCurrentChunkPollution(); - PollutionUtils.removePollution(aChunk, toRemove); - int after = getCurrentChunkPollution(); - return (after < before); - } - - public boolean hasAirFilter(ItemStack filter) { - if (filter == null) { - return false; - } - return filter.getItem() instanceof ItemAirFilter; - } - - public boolean damageAirFilter() { - ItemStack filter = this.mInventory[this.SLOT_FILTER]; - if (filter == null) { - return false; - } - - boolean creativeRotor = false; - ItemStack rotorStack = this.mInventory[SLOT_ROTOR]; - if (rotorStack != null) { - if (rotorStack.getItem() instanceof GT_MetaGenerated_Tool_01) { - Materials t1 = GT_MetaGenerated_Tool.getPrimaryMaterial(rotorStack); - Materials t2 = GT_MetaGenerated_Tool.getSecondaryMaterial(rotorStack); - if (t1 == Materials._NULL && t2 == Materials._NULL) { - creativeRotor = true; - } - } - } - - if (creativeRotor) { - return true; - } - - if (filter.getItem() instanceof ItemAirFilter) { - - long currentUse = ItemAirFilter.getFilterDamage(filter); - - // Remove broken Filter - if (filter.getItemDamage() == 0 && currentUse >= 50 - 1) { - this.mInventory[this.SLOT_FILTER] = null; - return false; - } else if (filter.getItemDamage() == 1 && currentUse >= 2500 - 1) { - this.mInventory[this.SLOT_FILTER] = null; - return false; - } else { - // Do Damage - ItemAirFilter.setFilterDamage(filter, currentUse + 1); - Logger.INFO("Filter Damage: " + currentUse); - return true; - } - } - return false; - } - - @Override - public boolean canInsertItem(int aIndex, ItemStack aStack, int ordinalSide) { - if (aIndex == SLOT_FILTER) { - if (aStack.getItem() instanceof ItemAirFilter) { - Logger.INFO("Inserting Air Filter into " + aIndex); - return true; - } - } - if (aIndex == SLOT_ROTOR) { - if (this.mInventory[7] != null) { - Logger.INFO("Found conveyor, can automate turbines. Inserting into " + aIndex); - if (aStack.getItem() instanceof ItemBasicScrubberTurbine) { - return true; - } - if (aStack.getItem() instanceof GT_MetaGenerated_Tool && aStack.getItemDamage() >= 170 - && aStack.getItemDamage() <= 179) { - return true; - } - } - } - return false; - } - - @Override - public void onScrewdriverRightClick(ForgeDirection side, EntityPlayer aPlayer, float aX, float aY, float aZ) { - super.onScrewdriverRightClick(side, aPlayer, aX, aY, aZ); - } - - @Override - public void doSound(byte aIndex, double aX, double aY, double aZ) { - if (aIndex == -120) { - GT_Utility - .doSoundAtClient(SoundResource.IC2_TOOLS_BATTERY_USE, MathUtils.randInt(5, 50), 0.05F, aX, aY, aZ); - } else { - super.doSound((byte) 0, aX, aY, aZ); - } - } - - @Override - public String[] getInfoData() { - AutoMap<String> aTooltipSuper = new AutoMap<>(); - for (String s : super.getInfoData()) { - aTooltipSuper.put(s); - } - int mAirSides = getFreeSpaces(); - int reduction = 0; - - try { - long tVoltage = maxEUInput(); - byte tTier = (byte) Math.max(1, GT_Utility.getTier(tVoltage)); - reduction += (((Math.max((tTier - 2), 1) * 2) * 50) * mAirSides); - reduction = (MathUtils.safeInt((long) reduction * this.mBaseEff) / 100000) * mAirSides - * Math.max((tTier - 2), 1); - reduction = MathUtils.safeInt(((long) reduction / 100) * this.mOptimalAirFlow); - - aTooltipSuper.put("Maximum pollution removed per second: " + reduction); - } catch (Throwable t) { - aTooltipSuper.put("Maximum pollution removed per second: " + mPollutionReduction); - } - aTooltipSuper.put("Air Sides: " + mAirSides); - - String[] mBuiltOutput = new String[aTooltipSuper.size()]; - int aIndex = 0; - for (String i : aTooltipSuper) { - mBuiltOutput[aIndex++] = i; - } - - return mBuiltOutput; - } - - @Override - public boolean isGivingInformation() { - return true; - } - - @Override - public boolean allowCoverOnSide(ForgeDirection side, GT_ItemStack aCoverID) { - if (side.offsetY != 0) { - return false; - } - return super.allowCoverOnSide(side, aCoverID); - } - - @Override - public ITexture[] getTopFacingInactive(byte aColor) { - return super.getTopFacingInactive(aColor); - } - - @Override - public void setItemNBT(NBTTagCompound aNBT) { - aNBT.setInteger("mOptimalAirFlow", this.mOptimalAirFlow); - aNBT.setBoolean("mSaveRotor", mSaveRotor); - super.setItemNBT(aNBT); - } - - private static ItemStack[] sGregTurbines; - - public static ItemStack getTieredTurbine(int aTier) { - if (sGregTurbines == null) { - sGregTurbines = new ItemStack[3]; - sGregTurbines[0] = GT_MetaGenerated_Tool.sInstances.get("gt.metatool.01") - .getToolWithStats(GT_MetaGenerated_Tool_01.TURBINE_SMALL, 1, Materials.Iron, Materials.Iron, null); - sGregTurbines[1] = GT_MetaGenerated_Tool.sInstances.get("gt.metatool.01") - .getToolWithStats(GT_MetaGenerated_Tool_01.TURBINE_SMALL, 1, Materials.Bronze, Materials.Bronze, null); - sGregTurbines[2] = GT_MetaGenerated_Tool.sInstances.get("gt.metatool.01") - .getToolWithStats(GT_MetaGenerated_Tool_01.TURBINE_SMALL, 1, Materials.Steel, Materials.Steel, null); - } else { - return sGregTurbines[aTier]; - } - - return null; - } - - public int getBaseEfficiency(ItemStack aStackRotor) { - if (aStackRotor.getItem() instanceof ItemBasicScrubberTurbine) { - return getBaseEfficiency(getTieredTurbine(aStackRotor.getItemDamage())); - } - return (int) ((50.0F - + (10.0F * ((GT_MetaGenerated_Tool) aStackRotor.getItem()).getToolCombatDamage(aStackRotor))) * 100); - } - - public int getOptimalAirFlow(ItemStack aStackRotor) { - if (aStackRotor.getItem() instanceof ItemBasicScrubberTurbine) { - return getOptimalAirFlow(getTieredTurbine(aStackRotor.getItemDamage())); - } - return (int) Math.max( - Float.MIN_NORMAL, - ((GT_MetaGenerated_Tool) aStackRotor.getItem()).getToolStats(aStackRotor) - .getSpeedMultiplier() * GT_MetaGenerated_Tool.getPrimaryMaterial(aStackRotor).mToolSpeed * 50); - } - - @Override - public boolean useModularUI() { - return true; - } - - @Override - public void addUIWidgets(ModularWindow.Builder builder, UIBuildContext buildContext) { - builder.widget(new SlotWidget(inventoryHandler, SLOT_ROTOR).setFilter(stack -> { - if (stack.getItem() instanceof ItemBasicScrubberTurbine) { - return true; - } - return stack.getItem() instanceof GT_MetaGenerated_Tool && stack.getItemDamage() >= 170 - && stack.getItemDamage() <= 179; - }) - .setBackground(getGUITextureSet().getItemSlot(), GTPP_UITextures.OVERLAY_SLOT_TURBINE) - .setPos(52, 24)) - .widget( - new SlotWidget(inventoryHandler, SLOT_FILTER) - .setFilter(stack -> stack.getItem() instanceof ItemAirFilter) - .setBackground(getGUITextureSet().getItemSlot(), GT_UITextures.OVERLAY_SLOT_RECYCLE) - .setPos(106, 24)) - .widget( - new SlotWidget(inventoryHandler, 7) - .setFilter(stack -> GT_Utility.areStacksEqual(stack, CI.getConveyor(mTier, 1), true)) - .setPos(124, 62)); - builder.widget( - new DrawableWidget().setDrawable(GT_UITextures.PICTURE_INFORMATION) - .dynamicTooltip(() -> Collections.singletonList("Reduction: " + mPollutionReduction + "/s")) - .attachSyncer( - new FakeSyncWidget.IntegerSyncer(() -> mPollutionReduction, val -> mPollutionReduction = val), - builder, - (widget, val) -> widget.notifyTooltipChange()) - .setPos(163, 5) - .setSize(7, 18)); - } -} diff --git a/gtpp/src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/basic/GregtechMetaPollutionCreator.java b/gtpp/src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/basic/GregtechMetaPollutionCreator.java deleted file mode 100644 index d7b6b8fffd..0000000000 --- a/gtpp/src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/basic/GregtechMetaPollutionCreator.java +++ /dev/null @@ -1,458 +0,0 @@ -package gtPlusPlus.xmod.gregtech.common.tileentities.machines.basic; - -import net.minecraft.entity.player.EntityPlayer; -import net.minecraft.item.ItemStack; -import net.minecraft.nbt.NBTTagCompound; -import net.minecraft.world.World; -import net.minecraftforge.common.util.ForgeDirection; - -import gregtech.api.enums.Textures; -import gregtech.api.interfaces.ITexture; -import gregtech.api.interfaces.metatileentity.IMetaTileEntity; -import gregtech.api.interfaces.tileentity.IGregTechTileEntity; -import gregtech.api.objects.GT_RenderedTexture; -import gtPlusPlus.core.lib.CORE; -import gtPlusPlus.core.util.minecraft.PlayerUtils; -import gtPlusPlus.core.util.minecraft.gregtech.PollutionUtils; -import gtPlusPlus.xmod.gregtech.api.metatileentity.implementations.base.GregtechMetaTileEntity; -import gtPlusPlus.xmod.gregtech.common.blocks.textures.TexturesGtBlock; - -public class GregtechMetaPollutionCreator extends GregtechMetaTileEntity { - - int mCurrentPollution; - int mAveragePollution; - int mAveragePollutionArray[] = new int[10]; - private int mArrayPos = 0; - private int mTickTimer = 0; - private int mSecondTimer = 0; - - public GregtechMetaPollutionCreator(final int aID, final String aName, final String aNameRegional, final int aTier, - final String aDescription, final int aSlotCount) { - super(aID, aName, aNameRegional, aTier, aSlotCount, aDescription); - } - - public GregtechMetaPollutionCreator(final String aName, final int aTier, final String aDescription, - final ITexture[][][] aTextures, final int aSlotCount) { - super(aName, aTier, aSlotCount, aDescription, aTextures); - } - - @Override - public String[] getDescription() { - return new String[] { this.mDescription, "A useful debug machine to create pollution.", CORE.GT_Tooltip.get() }; - } - - @Override - public ITexture[][][] getTextureSet(final ITexture[] aTextures) { - final ITexture[][][] rTextures = new ITexture[10][17][]; - for (byte i = -1; i < 16; i++) { - rTextures[0][i + 1] = this.getFront(i); - rTextures[1][i + 1] = this.getBack(i); - rTextures[2][i + 1] = this.getBottom(i); - rTextures[3][i + 1] = this.getTop(i); - rTextures[4][i + 1] = this.getSides(i); - rTextures[5][i + 1] = this.getFrontActive(i); - rTextures[6][i + 1] = this.getBackActive(i); - rTextures[7][i + 1] = this.getBottomActive(i); - rTextures[8][i + 1] = this.getTopActive(i); - rTextures[9][i + 1] = this.getSidesActive(i); - } - return rTextures; - } - - @Override - public ITexture[] getTexture(final IGregTechTileEntity aBaseMetaTileEntity, final ForgeDirection side, - final ForgeDirection facing, final int aColorIndex, final boolean aActive, final boolean aRedstone) { - return this.mTextures[(aActive ? 5 : 0) + (side == facing ? 0 - : side == facing.getOpposite() ? 1 - : side == ForgeDirection.DOWN ? 2 : side == ForgeDirection.UP ? 3 : 4)][aColorIndex + 1]; - } - - public ITexture[] getFront(final byte aColor) { - return new ITexture[] { Textures.BlockIcons.MACHINE_CASINGS[this.mTier + 3][aColor + 1], - new GT_RenderedTexture(TexturesGtBlock.Casing_Machine_Screen_2) }; - } - - public ITexture[] getBack(final byte aColor) { - return new ITexture[] { Textures.BlockIcons.MACHINE_CASINGS[this.mTier + 3][aColor + 1], - new GT_RenderedTexture(TexturesGtBlock.Casing_Machine_Simple_Bottom) }; - } - - public ITexture[] getBottom(final byte aColor) { - return new ITexture[] { Textures.BlockIcons.MACHINE_CASINGS[this.mTier + 3][aColor + 1], - new GT_RenderedTexture(TexturesGtBlock.Casing_Machine_Simple_Bottom) }; - } - - public ITexture[] getTop(final byte aColor) { - return new ITexture[] { Textures.BlockIcons.MACHINE_CASINGS[this.mTier + 3][aColor + 1], - new GT_RenderedTexture(TexturesGtBlock.Casing_Machine_Simple_Bottom) }; - } - - public ITexture[] getSides(final byte aColor) { - return new ITexture[] { Textures.BlockIcons.MACHINE_CASINGS[this.mTier + 3][aColor + 1], - new GT_RenderedTexture(TexturesGtBlock.Casing_Machine_Simple_Bottom) }; - } - - public ITexture[] getFrontActive(final byte aColor) { - return new ITexture[] { Textures.BlockIcons.MACHINE_CASINGS[this.mTier + 3][aColor + 1], - new GT_RenderedTexture(TexturesGtBlock.Casing_Machine_Screen_2) }; - } - - public ITexture[] getBackActive(final byte aColor) { - return new ITexture[] { Textures.BlockIcons.MACHINE_CASINGS[this.mTier + 3][aColor + 1], - new GT_RenderedTexture(TexturesGtBlock.Casing_Machine_Simple_Bottom) }; - } - - public ITexture[] getBottomActive(final byte aColor) { - return new ITexture[] { Textures.BlockIcons.MACHINE_CASINGS[this.mTier + 3][aColor + 1], - new GT_RenderedTexture(TexturesGtBlock.Casing_Machine_Simple_Bottom) }; - } - - public ITexture[] getTopActive(final byte aColor) { - return new ITexture[] { Textures.BlockIcons.MACHINE_CASINGS[this.mTier + 3][aColor + 1], - new GT_RenderedTexture(TexturesGtBlock.Casing_Machine_Simple_Bottom) }; - } - - public ITexture[] getSidesActive(final byte aColor) { - return new ITexture[] { Textures.BlockIcons.MACHINE_CASINGS[this.mTier + 3][aColor + 1], - new GT_RenderedTexture(TexturesGtBlock.Casing_Machine_Simple_Bottom) }; - } - - @Override - public void onScrewdriverRightClick(ForgeDirection side, EntityPlayer aPlayer, float aX, float aY, float aZ) { - if (pollutionMultiplier > 99) { - pollutionMultiplier = 1; - } else { - pollutionMultiplier++; - } - PlayerUtils.messagePlayer(aPlayer, "Pollution Mutliplier is now " + pollutionMultiplier + "."); - super.onScrewdriverRightClick(side, aPlayer, aX, aY, aZ); - } - - @Override - public IMetaTileEntity newMetaEntity(final IGregTechTileEntity aTileEntity) { - return new GregtechMetaPollutionCreator( - this.mName, - this.mTier, - this.mDescription, - this.mTextures, - this.mInventory.length); - } - - @Override - public boolean isSimpleMachine() { - return false; - } - - @Override - public boolean isElectric() { - return true; - } - - @Override - public boolean isValidSlot(final int aIndex) { - return true; - } - - @Override - public boolean isFacingValid(final ForgeDirection facing) { - return true; - } - - @Override - public boolean isEnetInput() { - return true; - } - - @Override - public boolean isEnetOutput() { - return false; - } - - @Override - public boolean isInputFacing(final ForgeDirection side) { - return side != this.getBaseMetaTileEntity() - .getFrontFacing(); - } - - @Override - public boolean isOutputFacing(final ForgeDirection side) { - return side == this.getBaseMetaTileEntity() - .getFrontFacing(); - } - - @Override - public boolean isTeleporterCompatible() { - return false; - } - - @Override - public long getMinimumStoredEU() { - return 0; - } - - @Override - public long maxEUStore() { - return 0; - } - - @Override - public int getCapacity() { - return 0; - } - - @Override - public long maxEUInput() { - return 0; - } - - @Override - public long maxEUOutput() { - return 0; - } - - @Override - public long maxAmperesIn() { - return 0; - } - - @Override - public long maxAmperesOut() { - return 0; - } - - @Override - public int rechargerSlotStartIndex() { - return 0; - } - - @Override - public int dechargerSlotStartIndex() { - return 0; - } - - @Override - public int rechargerSlotCount() { - return 0; - } - - @Override - public int dechargerSlotCount() { - return 0; - } - - @Override - public int getProgresstime() { - return (int) this.getBaseMetaTileEntity() - .getUniversalEnergyStored(); - } - - @Override - public int maxProgresstime() { - return (int) this.getBaseMetaTileEntity() - .getUniversalEnergyCapacity(); - } - - @Override - public boolean isAccessAllowed(final EntityPlayer aPlayer) { - return true; - } - - @Override - public boolean onRightclick(final IGregTechTileEntity aBaseMetaTileEntity, final EntityPlayer aPlayer) { - if (aBaseMetaTileEntity.isClientSide()) { - return true; - } - this.showPollution(aPlayer.getEntityWorld(), aPlayer); - return true; - } - - public int pollutionMultiplier = 1; - - private void showPollution(final World worldIn, final EntityPlayer playerIn) { - if (!PollutionUtils.isPollutionEnabled()) { - PlayerUtils.messagePlayer(playerIn, "This block is useless, Pollution is disabled."); - } else { - addPollution(); - PlayerUtils - .messagePlayer(playerIn, "This chunk now contains " + getCurrentChunkPollution() + " pollution."); - // PlayerUtils.messagePlayer(playerIn, "Average over last ten minutes: "+getAveragePollutionOverLastTen()+" - // pollution."); - } - } - - private boolean addPollution() { - PollutionUtils.addPollution(getBaseMetaTileEntity(), 100000 * pollutionMultiplier); - return true; - } - - @Override - public boolean allowPullStack(final IGregTechTileEntity aBaseMetaTileEntity, final int aIndex, - final ForgeDirection side, final ItemStack aStack) { - return false; - } - - @Override - public boolean allowPutStack(final IGregTechTileEntity aBaseMetaTileEntity, final int aIndex, - final ForgeDirection side, final ItemStack aStack) { - return false; - } - - public int getCurrentChunkPollution() { - return getCurrentChunkPollution(this.getBaseMetaTileEntity()); - } - - public int getCurrentChunkPollution(IGregTechTileEntity aBaseMetaTileEntity) { - return PollutionUtils.getPollution(aBaseMetaTileEntity); - } - - @Override - public String[] getInfoData() { - return new String[] { this.getLocalName(), "Current Pollution: " + this.mCurrentPollution, - "Average/10 minutes:" + getAveragePollutionOverLastTen() }; - } - - @Override - public boolean isGivingInformation() { - return true; - } - - @Override - public int[] getAccessibleSlotsFromSide(final int p_94128_1_) { - return new int[] {}; - } - - @Override - public boolean canInsertItem(final int p_102007_1_, final ItemStack p_102007_2_, final int p_102007_3_) { - return false; - } - - @Override - public boolean canExtractItem(final int p_102008_1_, final ItemStack p_102008_2_, final int p_102008_3_) { - return false; - } - - @Override - public int getSizeInventory() { - return 0; - } - - @Override - public ItemStack getStackInSlot(final int p_70301_1_) { - return null; - } - - @Override - public ItemStack decrStackSize(final int p_70298_1_, final int p_70298_2_) { - return null; - } - - @Override - public ItemStack getStackInSlotOnClosing(final int p_70304_1_) { - return null; - } - - @Override - public void setInventorySlotContents(final int p_70299_1_, final ItemStack p_70299_2_) {} - - @Override - public String getInventoryName() { - return null; - } - - @Override - public boolean hasCustomInventoryName() { - return false; - } - - @Override - public int getInventoryStackLimit() { - return 0; - } - - @Override - public boolean isUseableByPlayer(final EntityPlayer p_70300_1_) { - return false; - } - - @Override - public void openInventory() {} - - @Override - public void closeInventory() {} - - @Override - public boolean isItemValidForSlot(final int p_94041_1_, final ItemStack p_94041_2_) { - return false; - } - - @Override - public boolean isOverclockerUpgradable() { - return false; - } - - @Override - public boolean isTransformerUpgradable() { - return false; - } - - @Override - public void saveNBTData(final NBTTagCompound aNBT) { - aNBT.setInteger("mCurrentPollution", this.mCurrentPollution); - aNBT.setInteger("mAveragePollution", this.mAveragePollution); - } - - @Override - public void loadNBTData(final NBTTagCompound aNBT) { - this.mCurrentPollution = aNBT.getInteger("mCurrentPollution"); - this.mAveragePollution = aNBT.getInteger("mAveragePollution"); - } - - @Override - public void onFirstTick(final IGregTechTileEntity aBaseMetaTileEntity) { - if (this.getBaseMetaTileEntity() - .isServerSide()) { - if (this.mCurrentPollution == 0) { - this.mCurrentPollution = getCurrentChunkPollution(); - } - if (this.mArrayPos < 0 || this.mArrayPos > 9) { - this.mArrayPos = 0; - } - this.mTickTimer = 0; - } - } - - @Override - public void onPostTick(final IGregTechTileEntity aBaseMetaTileEntity, final long aTick) { - super.onPostTick(aBaseMetaTileEntity, aTick); - if (this.getBaseMetaTileEntity() - .isServerSide()) { - // TickTimer - 20 times a second - this.mTickTimer++; - if (mTickTimer % 20 == 0) { - this.mCurrentPollution = getCurrentChunkPollution(); - } - } - } - - public int getAveragePollutionOverLastTen() { - int counter = 0; - int total = 0; - - for (int j : this.mAveragePollutionArray) { - if (j != 0) { - total += j; - counter++; - } - } - int returnValue = 0; - if (total > 0 && counter > 0) { - returnValue = (total / counter); - this.mAveragePollution = returnValue; - } else { - returnValue = getCurrentChunkPollution(); - } - // Logger.INFO("| DEBUG: "+returnValue +" | ArrayPos:"+this.mArrayPos+" | Counter:"+counter+" | Total:"+total+" - // |"); - return returnValue; - } -} diff --git a/gtpp/src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/basic/GregtechMetaPollutionDetector.java b/gtpp/src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/basic/GregtechMetaPollutionDetector.java deleted file mode 100644 index 92443d2658..0000000000 --- a/gtpp/src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/basic/GregtechMetaPollutionDetector.java +++ /dev/null @@ -1,502 +0,0 @@ -package gtPlusPlus.xmod.gregtech.common.tileentities.machines.basic; - -import net.minecraft.entity.player.EntityPlayer; -import net.minecraft.item.ItemStack; -import net.minecraft.nbt.NBTTagCompound; -import net.minecraft.world.World; -import net.minecraftforge.common.util.ForgeDirection; - -import gregtech.api.enums.Textures; -import gregtech.api.interfaces.ITexture; -import gregtech.api.interfaces.metatileentity.IMetaTileEntity; -import gregtech.api.interfaces.tileentity.IGregTechTileEntity; -import gregtech.api.objects.GT_RenderedTexture; -import gregtech.api.util.GT_Utility; -import gtPlusPlus.core.lib.CORE; -import gtPlusPlus.core.util.math.MathUtils; -import gtPlusPlus.core.util.minecraft.PlayerUtils; -import gtPlusPlus.core.util.minecraft.gregtech.PollutionUtils; -import gtPlusPlus.xmod.gregtech.api.metatileentity.implementations.base.GregtechMetaTileEntity; -import gtPlusPlus.xmod.gregtech.common.blocks.textures.TexturesGtBlock; - -public class GregtechMetaPollutionDetector extends GregtechMetaTileEntity { - - int mCurrentPollution; - int mAveragePollution; - int mAveragePollutionArray[] = new int[10]; - private int mArrayPos = 0; - private int mTickTimer = 0; - private int mSecondTimer = 0; - private long mRedstoneLevel = 0; - - public GregtechMetaPollutionDetector(final int aID, final String aName, final String aNameRegional, final int aTier, - final String aDescription, final int aSlotCount) { - super(aID, aName, aNameRegional, aTier, aSlotCount, aDescription); - } - - public GregtechMetaPollutionDetector(final String aName, final int aTier, final String aDescription, - final ITexture[][][] aTextures, final int aSlotCount) { - super(aName, aTier, aSlotCount, aDescription, aTextures); - } - - @Override - public String[] getDescription() { - return new String[] { this.mDescription, "Right click to check pollution levels.", - "Configure with screwdriver to set redstone output amount.", "Does not use power.", CORE.GT_Tooltip.get() }; - } - - @Override - public ITexture[] getTexture(final IGregTechTileEntity aBaseMetaTileEntity, final ForgeDirection side, - final ForgeDirection facing, final int aColorIndex, final boolean aActive, final boolean aRedstone) { - return side == facing - ? new ITexture[] { new GT_RenderedTexture(TexturesGtBlock.Casing_Machine_Dimensional), - new GT_RenderedTexture(TexturesGtBlock.Casing_Machine_Screen_Frequency) } - : new ITexture[] { new GT_RenderedTexture(TexturesGtBlock.Casing_Machine_Dimensional), - new GT_RenderedTexture(Textures.BlockIcons.VOID) }; - } - - @Override - public ITexture[][][] getTextureSet(final ITexture[] aTextures) { - final ITexture[][][] rTextures = new ITexture[10][17][]; - for (byte i = -1; i < 16; i++) { - rTextures[0][i + 1] = this.getFront(i); - rTextures[1][i + 1] = this.getBack(i); - rTextures[2][i + 1] = this.getBottom(i); - rTextures[3][i + 1] = this.getTop(i); - rTextures[4][i + 1] = this.getSides(i); - rTextures[5][i + 1] = this.getFrontActive(i); - rTextures[6][i + 1] = this.getBackActive(i); - rTextures[7][i + 1] = this.getBottomActive(i); - rTextures[8][i + 1] = this.getTopActive(i); - rTextures[9][i + 1] = this.getSidesActive(i); - } - return rTextures; - } - - /* - * @Override public ITexture[] getTexture(final IGregTechTileEntity aBaseMetaTileEntity, final byte aSide, final - * byte aFacing, final int aColorIndex, final boolean aActive, final boolean aRedstone) { return - * this.mTextures[(aActive ? 5 : 0) + (side == facing ? 0 : side == facing.getOpposite() ? 1 : side == - * ForgeDirection.DOWN ? 2 : side == ForgeDirection.UP ? 3 : 4)][aColorIndex + 1]; } - */ - - public ITexture[] getFront(final byte aColor) { - return new ITexture[] { Textures.BlockIcons.MACHINE_CASINGS[this.mTier][aColor + 1], - new GT_RenderedTexture(TexturesGtBlock.Casing_Machine_Screen_2) }; - } - - public ITexture[] getBack(final byte aColor) { - return new ITexture[] { Textures.BlockIcons.MACHINE_CASINGS[this.mTier][aColor + 1], - new GT_RenderedTexture(TexturesGtBlock.Casing_Machine_Simple_Bottom) }; - } - - public ITexture[] getBottom(final byte aColor) { - return new ITexture[] { Textures.BlockIcons.MACHINE_CASINGS[this.mTier][aColor + 1], - new GT_RenderedTexture(TexturesGtBlock.Casing_Machine_Simple_Bottom) }; - } - - public ITexture[] getTop(final byte aColor) { - return new ITexture[] { Textures.BlockIcons.MACHINE_CASINGS[this.mTier][aColor + 1], - new GT_RenderedTexture(TexturesGtBlock.Casing_Machine_Simple_Bottom) }; - } - - public ITexture[] getSides(final byte aColor) { - return new ITexture[] { Textures.BlockIcons.MACHINE_CASINGS[this.mTier][aColor + 1], - new GT_RenderedTexture(TexturesGtBlock.Casing_Machine_Simple_Bottom) }; - } - - public ITexture[] getFrontActive(final byte aColor) { - return new ITexture[] { Textures.BlockIcons.MACHINE_CASINGS[this.mTier][aColor + 1], - new GT_RenderedTexture(TexturesGtBlock.Casing_Machine_Screen_2) }; - } - - public ITexture[] getBackActive(final byte aColor) { - return new ITexture[] { Textures.BlockIcons.MACHINE_CASINGS[this.mTier][aColor + 1], - new GT_RenderedTexture(TexturesGtBlock.Casing_Machine_Simple_Bottom) }; - } - - public ITexture[] getBottomActive(final byte aColor) { - return new ITexture[] { Textures.BlockIcons.MACHINE_CASINGS[this.mTier][aColor + 1], - new GT_RenderedTexture(TexturesGtBlock.Casing_Machine_Simple_Bottom) }; - } - - public ITexture[] getTopActive(final byte aColor) { - return new ITexture[] { Textures.BlockIcons.MACHINE_CASINGS[this.mTier][aColor + 1], - new GT_RenderedTexture(TexturesGtBlock.Casing_Machine_Simple_Bottom) }; - } - - public ITexture[] getSidesActive(final byte aColor) { - return new ITexture[] { Textures.BlockIcons.MACHINE_CASINGS[this.mTier][aColor + 1], - new GT_RenderedTexture(TexturesGtBlock.Casing_Machine_Simple_Bottom) }; - } - - @Override - public IMetaTileEntity newMetaEntity(final IGregTechTileEntity aTileEntity) { - return new GregtechMetaPollutionDetector( - this.mName, - this.mTier, - this.mDescription, - this.mTextures, - this.mInventory.length); - } - - @Override - public boolean isSimpleMachine() { - return false; - } - - @Override - public boolean isElectric() { - return true; - } - - @Override - public boolean isValidSlot(final int aIndex) { - return true; - } - - @Override - public boolean isFacingValid(final ForgeDirection facing) { - return true; - } - - @Override - public boolean isEnetInput() { - return true; - } - - @Override - public boolean isEnetOutput() { - return false; - } - - @Override - public boolean isInputFacing(final ForgeDirection side) { - return side != this.getBaseMetaTileEntity() - .getFrontFacing(); - } - - @Override - public boolean isOutputFacing(final ForgeDirection side) { - return side == this.getBaseMetaTileEntity() - .getFrontFacing(); - } - - @Override - public boolean isTeleporterCompatible() { - return false; - } - - @Override - public long getMinimumStoredEU() { - return 0; - } - - @Override - public long maxEUStore() { - return 0; - } - - @Override - public int getCapacity() { - return 0; - } - - @Override - public long maxEUInput() { - return 0; - } - - @Override - public long maxEUOutput() { - return 0; - } - - @Override - public long maxAmperesIn() { - return 0; - } - - @Override - public long maxAmperesOut() { - return 0; - } - - @Override - public int rechargerSlotStartIndex() { - return 0; - } - - @Override - public int dechargerSlotStartIndex() { - return 0; - } - - @Override - public int rechargerSlotCount() { - return 0; - } - - @Override - public int dechargerSlotCount() { - return 0; - } - - @Override - public int getProgresstime() { - return (int) this.getBaseMetaTileEntity() - .getUniversalEnergyStored(); - } - - @Override - public int maxProgresstime() { - return (int) this.getBaseMetaTileEntity() - .getUniversalEnergyCapacity(); - } - - @Override - public boolean isAccessAllowed(final EntityPlayer aPlayer) { - return true; - } - - @Override - public boolean onRightclick(final IGregTechTileEntity aBaseMetaTileEntity, final EntityPlayer aPlayer) { - if (aBaseMetaTileEntity.isClientSide()) { - return true; - } - this.showPollution(aPlayer.getEntityWorld(), aPlayer); - return true; - } - - private void showPollution(final World worldIn, final EntityPlayer playerIn) { - if (!PollutionUtils.isPollutionEnabled()) { - PlayerUtils.messagePlayer(playerIn, "This block is useless, Pollution is disabled."); - } else { - PlayerUtils.messagePlayer(playerIn, "This chunk contains " + getCurrentChunkPollution() + " pollution."); - PlayerUtils.messagePlayer(playerIn, "Emit Redstone at pollution level: " + this.mRedstoneLevel); - } - } - - @Override - public boolean allowPullStack(final IGregTechTileEntity aBaseMetaTileEntity, final int aIndex, - final ForgeDirection side, final ItemStack aStack) { - return false; - } - - @Override - public boolean allowPutStack(final IGregTechTileEntity aBaseMetaTileEntity, final int aIndex, - final ForgeDirection side, final ItemStack aStack) { - return false; - } - - public int getCurrentChunkPollution() { - return getCurrentChunkPollution(this.getBaseMetaTileEntity()); - } - - public int getCurrentChunkPollution(IGregTechTileEntity aBaseMetaTileEntity) { - return PollutionUtils.getPollution(aBaseMetaTileEntity); - } - - @Override - public String[] getInfoData() { - return new String[] { this.getLocalName(), "Current Pollution: " + this.mCurrentPollution, - "Average/10 Sec: " + this.mAveragePollution, "Emit Redstone at pollution level: " + this.mRedstoneLevel }; - } - - @Override - public boolean isGivingInformation() { - return true; - } - - @Override - public int[] getAccessibleSlotsFromSide(final int p_94128_1_) { - return new int[] {}; - } - - @Override - public boolean canInsertItem(final int p_102007_1_, final ItemStack p_102007_2_, final int p_102007_3_) { - return false; - } - - @Override - public boolean canExtractItem(final int p_102008_1_, final ItemStack p_102008_2_, final int p_102008_3_) { - return false; - } - - @Override - public int getSizeInventory() { - return 0; - } - - @Override - public ItemStack getStackInSlot(final int p_70301_1_) { - return null; - } - - @Override - public ItemStack decrStackSize(final int p_70298_1_, final int p_70298_2_) { - return null; - } - - @Override - public ItemStack getStackInSlotOnClosing(final int p_70304_1_) { - return null; - } - - @Override - public void setInventorySlotContents(final int p_70299_1_, final ItemStack p_70299_2_) {} - - @Override - public String getInventoryName() { - return null; - } - - @Override - public boolean hasCustomInventoryName() { - return false; - } - - @Override - public int getInventoryStackLimit() { - return 0; - } - - @Override - public boolean isUseableByPlayer(final EntityPlayer p_70300_1_) { - return false; - } - - @Override - public void openInventory() {} - - @Override - public void closeInventory() {} - - @Override - public boolean isItemValidForSlot(final int p_94041_1_, final ItemStack p_94041_2_) { - return false; - } - - @Override - public boolean isOverclockerUpgradable() { - return false; - } - - @Override - public boolean isTransformerUpgradable() { - return false; - } - - @Override - public void saveNBTData(final NBTTagCompound aNBT) { - aNBT.setInteger("mCurrentPollution", this.mCurrentPollution); - aNBT.setInteger("mAveragePollution", this.mAveragePollution); - aNBT.setLong("mRedstoneLevel", this.mRedstoneLevel); - } - - @Override - public void loadNBTData(final NBTTagCompound aNBT) { - this.mCurrentPollution = aNBT.getInteger("mCurrentPollution"); - this.mAveragePollution = aNBT.getInteger("mAveragePollution"); - this.mRedstoneLevel = aNBT.getLong("mRedstoneLevel"); - } - - @Override - public void onFirstTick(final IGregTechTileEntity aBaseMetaTileEntity) { - super.onFirstTick(aBaseMetaTileEntity); - } - - public boolean allowCoverOnSide(final ForgeDirection side, final int aCoverID) { - return side != this.getBaseMetaTileEntity() - .getFrontFacing(); - } - - @Override - public void onPostTick(final IGregTechTileEntity aBaseMetaTileEntity, final long aTick) { - super.onPostTick(aBaseMetaTileEntity, aTick); - - // Only Calc server-side - if (!this.getBaseMetaTileEntity() - .isServerSide()) { - return; - } - // Emit Redstone - if (this.getCurrentChunkPollution() >= this.mRedstoneLevel) { - for (final ForgeDirection side : ForgeDirection.VALID_DIRECTIONS) { - this.getBaseMetaTileEntity() - .setStrongOutputRedstoneSignal(side, (byte) 16); - } - this.markDirty(); - } else { - for (final ForgeDirection side : ForgeDirection.VALID_DIRECTIONS) { - this.getBaseMetaTileEntity() - .setStrongOutputRedstoneSignal(side, (byte) 0); - } - this.markDirty(); - } - - // Do Math for stats - if (this.mTickTimer % 20 == 0) { - mCurrentPollution = this.getCurrentChunkPollution(); - if (mArrayPos > mAveragePollutionArray.length - 1) { - mArrayPos = 0; - } - mAveragePollutionArray[mArrayPos] = mCurrentPollution; - mAveragePollution = getAveragePollutionOverLastTen(); - mArrayPos++; - } - this.mTickTimer++; - } - - public int getAveragePollutionOverLastTen() { - return MathUtils.getIntAverage(mAveragePollutionArray); - } - - @Override - public void onScrewdriverRightClick(ForgeDirection side, EntityPlayer aPlayer, float aX, float aY, float aZ) { - - if (side == this.getBaseMetaTileEntity() - .getFrontFacing()) { - final float[] tCoords = GT_Utility.getClickedFacingCoords(side, aX, aY, aZ); - switch ((byte) ((byte) (int) (tCoords[0] * 2.0F) + (2 * (byte) (int) (tCoords[1] * 2.0F)))) { - case 0 -> this.mRedstoneLevel -= 5000; - case 1 -> this.mRedstoneLevel += 5000; - case 2 -> this.mRedstoneLevel -= 50000; - case 3 -> this.mRedstoneLevel += 50000; - } - this.markDirty(); - GT_Utility.sendChatToPlayer(aPlayer, "Emit Redstone at Pollution Level: " + this.mRedstoneLevel); - } - - super.onScrewdriverRightClick(side, aPlayer, aX, aY, aZ); - } - - @Override - public boolean allowGeneralRedstoneOutput() { - if (this.getCurrentChunkPollution() >= this.mRedstoneLevel) { - this.markDirty(); - return true; - } - return false; - } - - @Override - public boolean onRightclick(IGregTechTileEntity aBaseMetaTileEntity, EntityPlayer aPlayer, ForgeDirection side, - float aX, float aY, float aZ) { - return super.onRightclick(aBaseMetaTileEntity, aPlayer, side, aX, aY, aZ); - } - - @Override - public void onMachineBlockUpdate() { - super.onMachineBlockUpdate(); - } - - @Override - public boolean hasSidedRedstoneOutputBehavior() { - if (this.getCurrentChunkPollution() >= this.mRedstoneLevel) { - this.markDirty(); - return true; - } - return false; - } -} diff --git a/gtpp/src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/basic/GregtechMetaTileEntity_AutoChisel.java b/gtpp/src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/basic/GregtechMetaTileEntity_AutoChisel.java deleted file mode 100644 index 751771f2b4..0000000000 --- a/gtpp/src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/basic/GregtechMetaTileEntity_AutoChisel.java +++ /dev/null @@ -1,190 +0,0 @@ -package gtPlusPlus.xmod.gregtech.common.tileentities.machines.basic; - -import java.util.List; - -import net.minecraft.item.ItemStack; -import net.minecraftforge.common.util.ForgeDirection; - -import org.apache.commons.lang3.ArrayUtils; - -import com.gtnewhorizons.modularui.api.drawable.FallbackableUITexture; -import com.gtnewhorizons.modularui.api.drawable.IDrawable; -import com.gtnewhorizons.modularui.api.math.Pos2d; -import com.gtnewhorizons.modularui.common.widget.SlotWidget; - -import gregtech.api.enums.Textures.BlockIcons; -import gregtech.api.gui.modularui.GT_UITextures; -import gregtech.api.interfaces.ITexture; -import gregtech.api.interfaces.tileentity.IGregTechTileEntity; -import gregtech.api.metatileentity.MetaTileEntity; -import gregtech.api.metatileentity.implementations.GT_MetaTileEntity_BasicMachine; -import gregtech.api.objects.GT_RenderedTexture; -import gregtech.api.recipe.BasicUIProperties; -import gregtech.api.util.GT_Utility; -import gtPlusPlus.core.util.minecraft.ItemUtils; -import gtPlusPlus.xmod.gregtech.common.blocks.textures.TexturesGtBlock; -import team.chisel.carving.Carving; - -public class GregtechMetaTileEntity_AutoChisel extends GT_MetaTileEntity_BasicMachine { - - private ItemStack mInputCache; - private ItemStack mOutputCache; - - public GregtechMetaTileEntity_AutoChisel(int aID, String aName, String aNameRegional, int aTier) { - super( - aID, - aName, - aNameRegional, - aTier, - 1, - "Chisels things, Gregtech style", - 1, - 1, - new ITexture[] { new GT_RenderedTexture(BlockIcons.OVERLAY_SIDE_MASSFAB_ACTIVE), - new GT_RenderedTexture(BlockIcons.OVERLAY_SIDE_MASSFAB), - new GT_RenderedTexture(BlockIcons.OVERLAY_FRONT_MULTI_SMELTER_ACTIVE), - new GT_RenderedTexture(BlockIcons.OVERLAY_FRONT_MULTI_SMELTER), - new GT_RenderedTexture(TexturesGtBlock.Overlay_MatterFab_Active), - new GT_RenderedTexture(TexturesGtBlock.Overlay_MatterFab), - new GT_RenderedTexture(BlockIcons.OVERLAY_BOTTOM_MASSFAB_ACTIVE), - new GT_RenderedTexture(BlockIcons.OVERLAY_BOTTOM_MASSFAB) }); - } - - public GregtechMetaTileEntity_AutoChisel(String aName, int aTier, String[] aDescription, ITexture[][][] aTextures) { - super(aName, aTier, 1, aDescription, aTextures, 1, 1); - } - - @Override - public MetaTileEntity newMetaEntity(IGregTechTileEntity aTileEntity) { - return new GregtechMetaTileEntity_AutoChisel(this.mName, this.mTier, this.mDescriptionArray, this.mTextures); - } - - @Override - public String[] getDescription() { - return ArrayUtils.addAll( - this.mDescriptionArray, - "What you want to chisel goes in slot 1", - "What you want to get goes in the special slot (bottom right)", - "If special slot is empty, first chisel result is used"); - } - - private boolean hasValidCache(ItemStack aStack, ItemStack aSpecialSlot, boolean aClearOnFailure) { - if (mInputCache != null && mOutputCache != null) { - if (GT_Utility.areStacksEqual(aStack, mInputCache) - && GT_Utility.areStacksEqual(aSpecialSlot, mOutputCache)) { - return true; - } - } - // clear cache if it was invalid - if (aClearOnFailure) { - mInputCache = null; - mOutputCache = null; - } - return false; - } - - private void cacheItem(ItemStack mInputItem, ItemStack mOutputItem) { - mOutputCache = mOutputItem.copy(); - mInputCache = mInputItem.copy(); - } - - @Override - protected boolean allowPutStackValidated(IGregTechTileEntity aBaseMetaTileEntity, int aIndex, ForgeDirection side, - ItemStack aStack) { - return hasValidCache(aStack, this.getSpecialSlot(), false) ? true - : super.allowPutStackValidated(aBaseMetaTileEntity, aIndex, side, aStack) && hasChiselResults(aStack); - } - - // lets make sure the user isn't trying to make something from a block that doesn't have this as a valid target - private static boolean canBeMadeFrom(ItemStack from, ItemStack to) { - List<ItemStack> results = getItemsForChiseling(from); - for (ItemStack s : results) { - if (s.getItem() == to.getItem() && s.getItemDamage() == to.getItemDamage()) { - return true; - } - } - return false; - } - - // lets make sure the user isn't trying to make something from a block that doesn't have this as a valid target - private static boolean hasChiselResults(ItemStack from) { - List<ItemStack> results = getItemsForChiseling(from); - return results.size() > 0; - } - - private static List<ItemStack> getItemsForChiseling(ItemStack aStack) { - return Carving.chisel.getItemsForChiseling(aStack); - } - - private static ItemStack getChiselOutput(ItemStack aInput, ItemStack aTarget) { - ItemStack tOutput = null; - if (aTarget != null && canBeMadeFrom(aInput, aTarget)) { - tOutput = aTarget; - } else if (aTarget != null && !canBeMadeFrom(aInput, aTarget)) { - tOutput = null; - } else { - tOutput = getItemsForChiseling(aInput).get(0); - } - return tOutput; - } - - @Override - public int checkRecipe() { - ItemStack tOutput = null; - ItemStack aInput = getInputAt(0); - ItemStack aTarget = getSpecialSlot(); - boolean tIsCached = hasValidCache(aInput, aTarget, true); - if (aInput != null && hasChiselResults(aInput) && aInput.stackSize > 0) { - tOutput = tIsCached ? mOutputCache.copy() : getChiselOutput(aInput, aTarget); - if (tOutput != null) { - tOutput = tOutput.copy(); - tOutput.stackSize = 1; - // We can chisel this - if (canOutput(tOutput)) { - getInputAt(0).stackSize -= 1; - calculateOverclockedNess(16, 20); - // In case recipe is too OP for that machine - if (mMaxProgresstime == Integer.MAX_VALUE - 1 && mEUt == Integer.MAX_VALUE - 1) { - return FOUND_RECIPE_BUT_DID_NOT_MEET_REQUIREMENTS; - } - if (!tIsCached) { - cacheItem(ItemUtils.getSimpleStack(aInput, 1), ItemUtils.getSimpleStack(tOutput, 1)); - } - this.mOutputItems[0] = tOutput.copy(); - return FOUND_AND_SUCCESSFULLY_USED_RECIPE; - } else { - mOutputBlocked++; - return FOUND_RECIPE_BUT_DID_NOT_MEET_REQUIREMENTS; - } - } - } - return DID_NOT_FIND_RECIPE; - } - - @Override - public boolean useModularUI() { - return true; - } - - private static final FallbackableUITexture progressBarTexture = GT_UITextures - .fallbackableProgressbar("auto_chisel", GT_UITextures.PROGRESSBAR_COMPRESS); - - @Override - protected BasicUIProperties getUIProperties() { - return super.getUIProperties().toBuilder() - .progressBarTexture(progressBarTexture) - .build(); - } - - @Override - protected SlotWidget createItemInputSlot(int index, IDrawable[] backgrounds, Pos2d pos) { - return (SlotWidget) super.createItemInputSlot(index, backgrounds, pos) - .setBackground(getGUITextureSet().getItemSlot(), GT_UITextures.OVERLAY_SLOT_COMPRESSOR); - } - - @Override - protected SlotWidget createSpecialSlot(IDrawable[] backgrounds, Pos2d pos, BasicUIProperties uiProperties) { - return (SlotWidget) super.createSpecialSlot(backgrounds, pos, uiProperties) - .setGTTooltip(() -> mTooltipCache.getData("GTPP.machines.chisel_slot.tooltip")); - } -} diff --git a/gtpp/src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/basic/GregtechMetaWirelessCharger.java b/gtpp/src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/basic/GregtechMetaWirelessCharger.java deleted file mode 100644 index b1289958a9..0000000000 --- a/gtpp/src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/basic/GregtechMetaWirelessCharger.java +++ /dev/null @@ -1,672 +0,0 @@ -package gtPlusPlus.xmod.gregtech.common.tileentities.machines.basic; - -import java.util.HashMap; -import java.util.Map; -import java.util.UUID; - -import net.minecraft.entity.Entity; -import net.minecraft.entity.player.EntityPlayer; -import net.minecraft.entity.player.EntityPlayerMP; -import net.minecraft.item.ItemStack; -import net.minecraft.nbt.NBTTagCompound; -import net.minecraftforge.common.util.ForgeDirection; - -import gregtech.api.enums.GT_Values; -import gregtech.api.enums.Textures; -import gregtech.api.interfaces.ITexture; -import gregtech.api.interfaces.metatileentity.IMetaTileEntity; -import gregtech.api.interfaces.tileentity.IGregTechTileEntity; -import gregtech.api.metatileentity.BaseMetaTileEntity; -import gregtech.api.objects.GT_RenderedTexture; -import gtPlusPlus.api.objects.minecraft.BlockPos; -import gtPlusPlus.core.lib.CORE; -import gtPlusPlus.core.util.minecraft.EntityUtils; -import gtPlusPlus.core.util.minecraft.PlayerUtils; -import gtPlusPlus.xmod.gregtech.api.metatileentity.implementations.base.GregtechMetaTileEntity; -import gtPlusPlus.xmod.gregtech.common.blocks.textures.TexturesGtBlock; -import gtPlusPlus.xmod.gregtech.common.helpers.ChargingHelper; - -public class GregtechMetaWirelessCharger extends GregtechMetaTileEntity { - - private int mCurrentDimension = 0; - public int mMode = 0; - public boolean mLocked = true; - - public GregtechMetaWirelessCharger(final int aID, final String aName, final String aNameRegional, final int aTier, - final String aDescription, final int aSlotCount) { - super(aID, aName, aNameRegional, aTier, aSlotCount, aDescription); - } - - public GregtechMetaWirelessCharger(final String aName, final int aTier, final String aDescription, - final ITexture[][][] aTextures, final int aSlotCount) { - super(aName, aTier, aSlotCount, aDescription, aTextures); - } - - @Override - public String[] getDescription() { - return new String[] { this.mDescription, "Can be locked to the owner by sneaking with a screwdriver", - "Can also be locked with a lock upgrade", "", "3 Modes, Long-Range, Local and Mixed.", - "Long-Range: Can supply 2A of power to a single player up to " + (GT_Values.V[this.mTier] * 4) + "m away.", - "Local: Can supply several Amps to each player within " + this.mTier * 20 + "m.", - "Mixed: Provides both 2A of long range and 1A per player locally.", - "Mixed mode is more conservative of power and as a result only", - "Gets half the distances each singular mode gets.", CORE.GT_Tooltip.get() }; - } - - public int getTier() { - return this.mTier; - } - - public int getMode() { - return this.mMode; - } - - public int getDimensionID() { - return this.mCurrentDimension; - } - - public Map<String, UUID> getLocalMap() { - return this.mLocalChargingMap; - } - - public Map<String, UUID> getLongRangeMap() { - return this.mWirelessChargingMap; - } - - @Override - public ITexture[][][] getTextureSet(final ITexture[] aTextures) { - final ITexture[][][] rTextures = new ITexture[10][17][]; - for (byte i = -1; i < 16; i++) { - rTextures[0][i + 1] = this.getFront(i); - rTextures[1][i + 1] = this.getBack(i); - rTextures[2][i + 1] = this.getBottom(i); - rTextures[3][i + 1] = this.getTop(i); - rTextures[4][i + 1] = this.getSides(i); - rTextures[5][i + 1] = this.getFrontActive(i); - rTextures[6][i + 1] = this.getBackActive(i); - rTextures[7][i + 1] = this.getBottomActive(i); - rTextures[8][i + 1] = this.getTopActive(i); - rTextures[9][i + 1] = this.getSidesActive(i); - } - return rTextures; - } - - @Override - public ITexture[] getTexture(final IGregTechTileEntity aBaseMetaTileEntity, final ForgeDirection side, - final ForgeDirection facing, final int aColorIndex, final boolean aActive, final boolean aRedstone) { - return this.mTextures[(aActive ? 5 : 0) + (side == facing ? 0 - : side == facing.getOpposite() ? 1 - : side == ForgeDirection.DOWN ? 2 : side == ForgeDirection.UP ? 3 : 4)][aColorIndex + 1]; - } - - public ITexture[] getFront(final byte aColor) { - return new ITexture[] { Textures.BlockIcons.MACHINE_CASINGS[this.mTier][aColor + 1], - new GT_RenderedTexture(TexturesGtBlock.Casing_Machine_Screen_2) }; - } - - public ITexture[] getBack(final byte aColor) { - return new ITexture[] { Textures.BlockIcons.MACHINE_CASINGS[this.mTier][aColor + 1], - new GT_RenderedTexture(TexturesGtBlock.Casing_Machine_Simple_Bottom) }; - } - - public ITexture[] getBottom(final byte aColor) { - return new ITexture[] { Textures.BlockIcons.MACHINE_CASINGS[this.mTier][aColor + 1], - new GT_RenderedTexture(TexturesGtBlock.Casing_Machine_Simple_Bottom) }; - } - - public ITexture[] getTop(final byte aColor) { - return new ITexture[] { Textures.BlockIcons.MACHINE_CASINGS[this.mTier][aColor + 1], - new GT_RenderedTexture(TexturesGtBlock.Casing_Machine_Simple_Bottom) }; - } - - public ITexture[] getSides(final byte aColor) { - return new ITexture[] { Textures.BlockIcons.MACHINE_CASINGS[this.mTier][aColor + 1], - new GT_RenderedTexture(TexturesGtBlock.Casing_Machine_Simple_Bottom) }; - } - - public ITexture[] getFrontActive(final byte aColor) { - return new ITexture[] { Textures.BlockIcons.MACHINE_CASINGS[this.mTier][aColor + 1], - new GT_RenderedTexture(TexturesGtBlock.Casing_Machine_Screen_2) }; - } - - public ITexture[] getBackActive(final byte aColor) { - return new ITexture[] { Textures.BlockIcons.MACHINE_CASINGS[this.mTier][aColor + 1], - new GT_RenderedTexture(TexturesGtBlock.Casing_Machine_Simple_Bottom) }; - } - - public ITexture[] getBottomActive(final byte aColor) { - return new ITexture[] { Textures.BlockIcons.MACHINE_CASINGS[this.mTier][aColor + 1], - new GT_RenderedTexture(TexturesGtBlock.Casing_Machine_Simple_Bottom) }; - } - - public ITexture[] getTopActive(final byte aColor) { - return new ITexture[] { Textures.BlockIcons.MACHINE_CASINGS[this.mTier][aColor + 1], - new GT_RenderedTexture(TexturesGtBlock.Casing_Machine_Simple_Bottom) }; - } - - public ITexture[] getSidesActive(final byte aColor) { - return new ITexture[] { Textures.BlockIcons.MACHINE_CASINGS[this.mTier][aColor + 1], - new GT_RenderedTexture(TexturesGtBlock.Casing_Machine_Simple_Bottom) }; - } - - @Override - public void onScrewdriverRightClick(ForgeDirection side, EntityPlayer aPlayer, float aX, float aY, float aZ) { - - if (aPlayer.isSneaking()) { - mLocked = !mLocked; - PlayerUtils.messagePlayer(aPlayer, mLocked ? "Locked to owner." : "Unlocked."); - return; - } - - mWirelessChargingMap.clear(); - mLocalChargingMap.clear(); - if (!this.getBaseMetaTileEntity() - .getWorld().playerEntities.isEmpty()) { - for (Object mTempPlayer : this.getBaseMetaTileEntity() - .getWorld().playerEntities) { - if (mTempPlayer instanceof EntityPlayer || mTempPlayer instanceof EntityPlayerMP) { - EntityPlayer mTemp = (EntityPlayer) mTempPlayer; - ChargingHelper.removeValidPlayer(mTemp, this); - } - } - } - - if (this.mMode >= 2) { - this.mMode = 0; - } else { - this.mMode++; - } - if (this.mMode == 0) { - PlayerUtils.messagePlayer(aPlayer, "Now in Long-Range Charge Mode."); - } else if (this.mMode == 1) { - PlayerUtils.messagePlayer(aPlayer, "Now in Local Charge Mode."); - } else { - PlayerUtils.messagePlayer(aPlayer, "Now in Mixed Charge Mode."); - } - super.onScrewdriverRightClick(side, aPlayer, aX, aY, aZ); - } - - @Override - public IMetaTileEntity newMetaEntity(final IGregTechTileEntity aTileEntity) { - return new GregtechMetaWirelessCharger( - this.mName, - this.mTier, - this.mDescription, - this.mTextures, - this.mInventory.length); - } - - @Override - public boolean isSimpleMachine() { - return false; - } - - @Override - public boolean isElectric() { - return true; - } - - @Override - public boolean isValidSlot(final int aIndex) { - return true; - } - - @Override - public boolean isFacingValid(final ForgeDirection facing) { - return true; - } - - @Override - public boolean isEnetInput() { - return true; - } - - @Override - public boolean isEnetOutput() { - return false; - } - - @Override - public boolean isInputFacing(final ForgeDirection side) { - return side != this.getBaseMetaTileEntity() - .getFrontFacing(); - } - - @Override - public boolean isOutputFacing(final ForgeDirection side) { - return side == this.getBaseMetaTileEntity() - .getFrontFacing(); - } - - @Override - public boolean isTeleporterCompatible() { - return false; - } - - @Override - public long getMinimumStoredEU() { - return 0; - } - - @Override - public long maxEUStore() { - return GT_Values.V[this.mTier] * 128; - } - - @Override - public int getCapacity() { - return (int) (GT_Values.V[this.mTier] * 32); - } - - @Override - public long maxEUInput() { - return GT_Values.V[this.mTier]; - } - - @Override - public long maxEUOutput() { - return 0; - } - - @Override - public long maxAmperesIn() { - if (this.mMode == 0) { - return 2; - } else if (this.mMode == 1) { - return this.mLocalChargingMap.size() * 8; - } else { - return ((this.mLocalChargingMap.size() * 4) + this.mWirelessChargingMap.size()); - } - } - - @Override - public long maxAmperesOut() { - return 0; - } - - @Override - public int rechargerSlotStartIndex() { - return 0; - } - - @Override - public int dechargerSlotStartIndex() { - return 0; - } - - @Override - public int rechargerSlotCount() { - return 0; - } - - @Override - public int dechargerSlotCount() { - return 0; - } - - @Override - public int getProgresstime() { - return (int) this.getBaseMetaTileEntity() - .getUniversalEnergyStored(); - } - - @Override - public int maxProgresstime() { - return (int) this.getBaseMetaTileEntity() - .getUniversalEnergyCapacity(); - } - - @Override - public boolean isAccessAllowed(final EntityPlayer aPlayer) { - return true; - } - - @Override - public boolean onRightclick(final IGregTechTileEntity aBaseMetaTileEntity, final EntityPlayer aPlayer) { - if (aBaseMetaTileEntity.isClientSide()) { - return true; - } - return true; - } - - @Override - public boolean allowPullStack(final IGregTechTileEntity aBaseMetaTileEntity, final int aIndex, - final ForgeDirection side, final ItemStack aStack) { - return false; - } - - @Override - public boolean allowPutStack(final IGregTechTileEntity aBaseMetaTileEntity, final int aIndex, - final ForgeDirection side, final ItemStack aStack) { - return false; - } - - @Override - public String[] getInfoData() { - return new String[] { this.getLocalName() }; - } - - @Override - public boolean isGivingInformation() { - return true; - } - - @Override - public int[] getAccessibleSlotsFromSide(final int p_94128_1_) { - return new int[] {}; - } - - @Override - public boolean canInsertItem(final int p_102007_1_, final ItemStack p_102007_2_, final int p_102007_3_) { - return false; - } - - @Override - public boolean canExtractItem(final int p_102008_1_, final ItemStack p_102008_2_, final int p_102008_3_) { - return false; - } - - @Override - public int getSizeInventory() { - return 0; - } - - @Override - public ItemStack getStackInSlot(final int p_70301_1_) { - return null; - } - - @Override - public ItemStack decrStackSize(final int p_70298_1_, final int p_70298_2_) { - return null; - } - - @Override - public ItemStack getStackInSlotOnClosing(final int p_70304_1_) { - return null; - } - - @Override - public void setInventorySlotContents(final int p_70299_1_, final ItemStack p_70299_2_) {} - - @Override - public String getInventoryName() { - return null; - } - - @Override - public boolean hasCustomInventoryName() { - return false; - } - - @Override - public int getInventoryStackLimit() { - return 0; - } - - @Override - public boolean isUseableByPlayer(final EntityPlayer p_70300_1_) { - return false; - } - - @Override - public void openInventory() {} - - @Override - public void closeInventory() {} - - @Override - public boolean isItemValidForSlot(final int p_94041_1_, final ItemStack p_94041_2_) { - return false; - } - - @Override - public boolean isOverclockerUpgradable() { - return false; - } - - @Override - public boolean isTransformerUpgradable() { - return false; - } - - @Override - public void saveNBTData(final NBTTagCompound aNBT) { - aNBT.setBoolean("mLocked", this.mLocked); - aNBT.setInteger("mMode", this.mMode); - aNBT.setInteger("mCurrentDimension", this.mCurrentDimension); - } - - @Override - public void loadNBTData(final NBTTagCompound aNBT) { - this.mLocked = aNBT.getBoolean("mLocked"); - this.mMode = aNBT.getInteger("mMode"); - this.mCurrentDimension = aNBT.getInteger("mCurrentDimension"); - } - - @Override - public void onFirstTick(final IGregTechTileEntity aBaseMetaTileEntity) { - super.onFirstTick(aBaseMetaTileEntity); - } - - private Map<String, UUID> mWirelessChargingMap = new HashMap<>(); - private Map<String, UUID> mLocalChargingMap = new HashMap<>(); - - private boolean isValidPlayer(EntityPlayer aPlayer) { - BaseMetaTileEntity aTile = (BaseMetaTileEntity) this.getBaseMetaTileEntity(); - if (mLocked || (aTile != null && aTile.privateAccess())) { - if (aPlayer.getUniqueID() - .equals(getBaseMetaTileEntity().getOwnerUuid())) { - return true; - } else { - return false; - } - } - return true; - } - - @Override - public void onPostTick(final IGregTechTileEntity aBaseMetaTileEntity, final long aTick) { - super.onPostTick(aBaseMetaTileEntity, aTick); - if (this.getBaseMetaTileEntity() - .isServerSide()) { - - if (this.mCurrentDimension != aBaseMetaTileEntity.getWorld().provider.dimensionId) { - this.mCurrentDimension = aBaseMetaTileEntity.getWorld().provider.dimensionId; - } - - if (aTick % 20 == 0) { - boolean mHasBeenMapped = this.equals(ChargingHelper.getEntry(getTileEntityPosition())); - if (!mHasBeenMapped) { - mHasBeenMapped = ChargingHelper.addEntry(getTileEntityPosition(), this); - } - - if (mHasBeenMapped && !aBaseMetaTileEntity.getWorld().playerEntities.isEmpty()) { - for (Object mTempPlayer : aBaseMetaTileEntity.getWorld().playerEntities) { - if (mTempPlayer instanceof EntityPlayer || mTempPlayer instanceof EntityPlayerMP) { - EntityPlayer mTemp = (EntityPlayer) mTempPlayer; - - if (this.mMode == 1 || this.mMode == 2) { - int tempRange = (this.mMode == 1 ? this.mTier * 20 : this.mTier * 10); - if (getDistanceBetweenTwoPositions(getTileEntityPosition(), getPositionOfEntity(mTemp)) - < tempRange) { - if (isValidPlayer(mTemp) - && !mLocalChargingMap.containsKey(mTemp.getDisplayName())) { - mLocalChargingMap.put(mTemp.getDisplayName(), mTemp.getPersistentID()); - ChargingHelper.addValidPlayer(mTemp, this); - // PlayerUtils.messagePlayer(mTemp, "You have entered charging range. - // ["+tempRange+"m - Local]."); - } - } else { - if (mLocalChargingMap.containsKey(mTemp.getDisplayName())) { - if (mLocalChargingMap.remove(mTemp.getDisplayName()) != null) { - // PlayerUtils.messagePlayer(mTemp, "You have left charging range. - // ["+tempRange+"m - Local]."); - ChargingHelper.removeValidPlayer(mTemp, this); - } - } - } - } - if (this.mMode == 0 || this.mMode == 2) { - int tempRange = (int) (this.mMode == 0 ? 4 * GT_Values.V[this.mTier] - : 2 * GT_Values.V[this.mTier]); - if (getDistanceBetweenTwoPositions(getTileEntityPosition(), getPositionOfEntity(mTemp)) - <= tempRange) { - if (!mWirelessChargingMap.containsKey(mTemp.getDisplayName())) { - if (isValidPlayer(mTemp)) { - mWirelessChargingMap.put(mTemp.getDisplayName(), mTemp.getPersistentID()); - ChargingHelper.addValidPlayer(mTemp, this); - PlayerUtils.messagePlayer( - mTemp, - "You have entered charging range. [" + tempRange + "m - Long-Range]."); - } - } - } else { - if (mWirelessChargingMap.containsKey(mTemp.getDisplayName())) { - if (mWirelessChargingMap.remove(mTemp.getDisplayName()) != null) { - PlayerUtils.messagePlayer( - mTemp, - "You have left charging range. [" + tempRange + "m - Long Range]."); - ChargingHelper.removeValidPlayer(mTemp, this); - } - } - } - } - /* - * if (this.mMode == 0 || this.mMode == 2){ int tempRange = (int) (this.mMode == 0 ? - * 4*GT_Values.V[this.mTier] : 2*GT_Values.V[this.mTier]); if - * (getDistanceBetweenTwoPositions(getTileEntityPosition(), getPositionOfEntity(mTemp)) < - * tempRange){ if (!mWirelessChargingMap.containsKey(mTemp)){ - * mWirelessChargingMap.put(mTemp, mTemp.getPersistentID()); - * PlayerUtils.messagePlayer(mTemp, "You have entered charging range. ["+tempRange+"m]."); - * ChargingHelper.addValidPlayer(mTemp, this); } } else { if - * (mWirelessChargingMap.containsKey(mTemp)){ if (mWirelessChargingMap.remove(mTemp) != - * null){ PlayerUtils.messagePlayer(mTemp, - * "You have left charging range. ["+tempRange+"m]."); - * ChargingHelper.removeValidPlayer(mTemp, this); } } } } - */ - - } - } - } - } - } - } - - public BlockPos getTileEntityPosition() { - return new BlockPos( - this.getBaseMetaTileEntity() - .getXCoord(), - this.getBaseMetaTileEntity() - .getYCoord(), - this.getBaseMetaTileEntity() - .getZCoord(), - this.getBaseMetaTileEntity() - .getWorld()); - } - - public BlockPos getPositionOfEntity(Entity mEntity) { - if (mEntity == null) { - return null; - } - return EntityUtils.findBlockPosUnderEntity(mEntity); - } - - public double getDistanceBetweenTwoPositions(BlockPos objectA, BlockPos objectB) { - if (objectA == null || objectB == null) { - return 0f; - } - int[] objectArray1 = new int[] { objectA.xPos, objectA.yPos, objectA.zPos }; - int[] objectArray2 = new int[] { objectB.xPos, objectB.yPos, objectB.zPos }; - - final double distance = Math.sqrt( - (objectArray2[0] - objectArray1[0]) * (objectArray2[0] - objectArray1[0]) - + (objectArray2[1] - objectArray1[1]) * (objectArray2[1] - objectArray1[1]) - + (objectArray2[2] - objectArray1[2]) * (objectArray2[2] - objectArray1[2])); - return distance; - } - - @Override - public void onRemoval() { - - ChargingHelper.removeEntry(getTileEntityPosition(), this); - - mWirelessChargingMap.clear(); - mLocalChargingMap.clear(); - if (!this.getBaseMetaTileEntity() - .getWorld().playerEntities.isEmpty()) { - for (Object mTempPlayer : this.getBaseMetaTileEntity() - .getWorld().playerEntities) { - if (mTempPlayer instanceof EntityPlayer || mTempPlayer instanceof EntityPlayerMP) { - EntityPlayer mTemp = (EntityPlayer) mTempPlayer; - ChargingHelper.removeValidPlayer(mTemp, this); - } - } - } - - super.onRemoval(); - } - - @Override - public boolean onRightclick(IGregTechTileEntity aBaseMetaTileEntity, EntityPlayer aPlayer, ForgeDirection side, - float aX, float aY, float aZ) { - - int tempRange; - - if (this.mMode == 0 || this.mMode == 2) { - tempRange = (int) (this.mMode == 0 ? 4 * GT_Values.V[this.mTier] : 2 * GT_Values.V[this.mTier]); - } else { - tempRange = this.mMode == 1 ? this.mTier * 20 : this.mTier * 10; - } - - if (this.mMode == 2) { - PlayerUtils - .messagePlayer(aPlayer, "Mixed Mode | Local: " + this.mTier * 10 + "m | Long: " + tempRange + "m"); - PlayerUtils.messagePlayer(aPlayer, "Players with access:"); - for (String name : this.getLocalMap() - .keySet()) { - PlayerUtils.messagePlayer(aPlayer, "Local: " + name); - } - for (String name : this.getLongRangeMap() - .keySet()) { - PlayerUtils.messagePlayer(aPlayer, "Long: " + name); - } - } else if (this.mMode == 1) { - PlayerUtils.messagePlayer(aPlayer, "Local Mode: " + this.mTier * 20 + "m"); - PlayerUtils.messagePlayer(aPlayer, "Players with access:"); - for (String name : this.getLocalMap() - .keySet()) { - PlayerUtils.messagePlayer(aPlayer, "" + name); - } - - } else { - PlayerUtils.messagePlayer(aPlayer, "Long-range Mode: " + tempRange + "m"); - PlayerUtils.messagePlayer(aPlayer, "Players with access:"); - for (String name : this.getLongRangeMap() - .keySet()) { - PlayerUtils.messagePlayer(aPlayer, "" + name); - } - } - - return super.onRightclick(aBaseMetaTileEntity, aPlayer, side, aX, aY, aZ); - } - - @Override - public void onServerStart() { - mWirelessChargingMap.clear(); - mLocalChargingMap.clear(); - super.onServerStart(); - } - - @Override - public void onExplosion() { - ChargingHelper.removeEntry(getTileEntityPosition(), this); - super.onExplosion(); - } - - @Override - public void doExplosion(long aExplosionPower) { - ChargingHelper.removeEntry(getTileEntityPosition(), this); - super.doExplosion(aExplosionPower); - } -} diff --git a/gtpp/src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/misc/GMTE_AmazonPackager.java b/gtpp/src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/misc/GMTE_AmazonPackager.java deleted file mode 100644 index 0e71c3b9b1..0000000000 --- a/gtpp/src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/misc/GMTE_AmazonPackager.java +++ /dev/null @@ -1,168 +0,0 @@ -package gtPlusPlus.xmod.gregtech.common.tileentities.machines.multi.misc; - -import static com.gtnewhorizon.structurelib.structure.StructureUtility.ofBlock; -import static com.gtnewhorizon.structurelib.structure.StructureUtility.onElementPass; -import static com.gtnewhorizon.structurelib.structure.StructureUtility.transpose; -import static gregtech.api.enums.GT_HatchElement.Energy; -import static gregtech.api.enums.GT_HatchElement.InputBus; -import static gregtech.api.enums.GT_HatchElement.Maintenance; -import static gregtech.api.enums.GT_HatchElement.Muffler; -import static gregtech.api.enums.GT_HatchElement.OutputBus; -import static gregtech.api.util.GT_StructureUtility.buildHatchAdder; - -import net.minecraft.item.ItemStack; - -import com.gtnewhorizon.structurelib.alignment.constructable.ISurvivalConstructable; -import com.gtnewhorizon.structurelib.structure.IStructureDefinition; -import com.gtnewhorizon.structurelib.structure.ISurvivalBuildEnvironment; -import com.gtnewhorizon.structurelib.structure.StructureDefinition; - -import gregtech.api.enums.TAE; -import gregtech.api.interfaces.IIconContainer; -import gregtech.api.interfaces.metatileentity.IMetaTileEntity; -import gregtech.api.interfaces.tileentity.IGregTechTileEntity; -import gregtech.api.logic.ProcessingLogic; -import gregtech.api.recipe.RecipeMap; -import gregtech.api.recipe.RecipeMaps; -import gregtech.api.util.GT_Multiblock_Tooltip_Builder; -import gregtech.api.util.GT_Utility; -import gtPlusPlus.core.block.ModBlocks; -import gtPlusPlus.core.lib.CORE; -import gtPlusPlus.xmod.gregtech.api.metatileentity.implementations.base.GregtechMeta_MultiBlockBase; -import gtPlusPlus.xmod.gregtech.common.blocks.textures.TexturesGtBlock; - -public class GMTE_AmazonPackager extends GregtechMeta_MultiBlockBase<GMTE_AmazonPackager> - implements ISurvivalConstructable { - - private int mCasing; - - private static IStructureDefinition<GMTE_AmazonPackager> STRUCTURE_DEFINITION = null; - - @Override - public IMetaTileEntity newMetaEntity(IGregTechTileEntity aTileEntity) { - return new GMTE_AmazonPackager(mName); - } - - public GMTE_AmazonPackager(int aID, String aName, String aNameRegional) { - super(aID, aName, aNameRegional); - } - - public GMTE_AmazonPackager(String aName) { - super(aName); - } - - @Override - public String getMachineType() { - return "Packager"; - } - - @Override - public IStructureDefinition<GMTE_AmazonPackager> getStructureDefinition() { - if (STRUCTURE_DEFINITION == null) { - STRUCTURE_DEFINITION = StructureDefinition.<GMTE_AmazonPackager>builder() - .addShape( - mName, - transpose( - new String[][] { { "CCC", "CCC", "CCC" }, { "C~C", "C-C", "CCC" }, { "CCC", "CCC", "CCC" }, })) - .addElement( - 'C', - buildHatchAdder(GMTE_AmazonPackager.class) - .atLeast(InputBus, OutputBus, Maintenance, Energy, Muffler) - .casingIndex(TAE.getIndexFromPage(2, 9)) - .dot(1) - .buildAndChain(onElementPass(x -> ++x.mCasing, ofBlock(ModBlocks.blockCasings3Misc, 9)))) - .build(); - } - return STRUCTURE_DEFINITION; - } - - @Override - protected GT_Multiblock_Tooltip_Builder createTooltip() { - GT_Multiblock_Tooltip_Builder tt = new GT_Multiblock_Tooltip_Builder(); - tt.addMachineType(getMachineType()) - .addInfo("Controller Block for the Amazon Warehouse") - .addInfo("This Multiblock is used for EXTREME packaging requirements") - .addInfo("Dust Schematics are inserted into the input busses") - .addInfo("If inserted into the controller, it is shared across all busses") - .addInfo("1x, 2x, 3x & Other Schematics are to be placed into the controller GUI slot") - .addInfo("500% faster than using single block machines of the same voltage") - .addInfo("Only uses 75% of the EU/t normally required") - .addInfo("Processes 16 items per voltage tier") - .addPollutionAmount(getPollutionPerSecond(null)) - .addSeparator() - .beginStructureBlock(3, 3, 3, true) - .addController("Front center") - .addCasingInfoMin("Supply Depot Casings", 10, false) - .addInputBus("Any casing", 1) - .addOutputBus("Any casing", 1) - .addEnergyHatch("Any casing", 1) - .addMaintenanceHatch("Any casing", 1) - .addMufflerHatch("Any casing", 1) - .toolTipFinisher("GT++"); - return tt; - } - - @Override - protected IIconContainer getActiveOverlay() { - return TexturesGtBlock.Overlay_Machine_Controller_Advanced_Active; - } - - @Override - protected IIconContainer getInactiveOverlay() { - return TexturesGtBlock.Overlay_Machine_Controller_Advanced; - } - - @Override - protected int getCasingTextureId() { - return TAE.getIndexFromPage(2, 9); - } - - @Override - public RecipeMap<?> getRecipeMap() { - return RecipeMaps.packagerRecipes; - } - - @Override - protected ProcessingLogic createProcessingLogic() { - return new ProcessingLogic().setSpeedBonus(1F / 6F) - .setEuModifier(0.75F) - .setMaxParallelSupplier(this::getMaxParallelRecipes); - } - - @Override - public boolean checkMachine(IGregTechTileEntity aBaseMetaTileEntity, ItemStack aStack) { - mCasing = 0; - return checkPiece(mName, 1, 1, 0) && mCasing >= 10 && checkHatch(); - } - - @Override - public int getMaxEfficiency(ItemStack p0) { - return 10000; - } - - @Override - public int getPollutionPerSecond(ItemStack arg0) { - return CORE.ConfigSwitches.pollutionPerSecondMultiPackager; - } - - @Override - public int getMaxParallelRecipes() { - return (16 * GT_Utility.getTier(this.getMaxInputVoltage())); - } - - @Override - public void construct(ItemStack stackSize, boolean hintsOnly) { - buildPiece(mName, stackSize, hintsOnly, 1, 1, 0); - } - - @Override - public int survivalConstruct(ItemStack stackSize, int elementBudget, ISurvivalBuildEnvironment env) { - if (mMachine) return -1; - return survivialBuildPiece(mName, stackSize, 1, 1, 0, elementBudget, env, false, true); - } - - @Override - public boolean supportsInputSeparation() { - return true; - } -} diff --git a/gtpp/src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/processing/GregtechMetaTileEntity_IndustrialAlloySmelter.java b/gtpp/src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/processing/GregtechMetaTileEntity_IndustrialAlloySmelter.java deleted file mode 100644 index e5d138dfda..0000000000 --- a/gtpp/src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/processing/GregtechMetaTileEntity_IndustrialAlloySmelter.java +++ /dev/null @@ -1,223 +0,0 @@ -package gtPlusPlus.xmod.gregtech.common.tileentities.machines.multi.processing; - -import static com.gtnewhorizon.structurelib.structure.StructureUtility.ofBlock; -import static com.gtnewhorizon.structurelib.structure.StructureUtility.onElementPass; -import static com.gtnewhorizon.structurelib.structure.StructureUtility.transpose; -import static gregtech.api.enums.GT_HatchElement.Energy; -import static gregtech.api.enums.GT_HatchElement.InputBus; -import static gregtech.api.enums.GT_HatchElement.Maintenance; -import static gregtech.api.enums.GT_HatchElement.Muffler; -import static gregtech.api.enums.GT_HatchElement.OutputBus; -import static gregtech.api.util.GT_StructureUtility.buildHatchAdder; -import static gregtech.api.util.GT_StructureUtility.ofCoil; - -import net.minecraft.item.ItemStack; - -import org.jetbrains.annotations.NotNull; - -import com.gtnewhorizon.structurelib.alignment.constructable.ISurvivalConstructable; -import com.gtnewhorizon.structurelib.structure.IStructureDefinition; -import com.gtnewhorizon.structurelib.structure.ISurvivalBuildEnvironment; -import com.gtnewhorizon.structurelib.structure.StructureDefinition; - -import gregtech.api.enums.HeatingCoilLevel; -import gregtech.api.enums.TAE; -import gregtech.api.enums.Textures; -import gregtech.api.interfaces.IIconContainer; -import gregtech.api.interfaces.metatileentity.IMetaTileEntity; -import gregtech.api.interfaces.tileentity.IGregTechTileEntity; -import gregtech.api.logic.ProcessingLogic; -import gregtech.api.recipe.RecipeMap; -import gregtech.api.recipe.RecipeMaps; -import gregtech.api.util.GT_Multiblock_Tooltip_Builder; -import gregtech.api.util.GT_OverclockCalculator; -import gregtech.api.util.GT_Recipe; -import gregtech.api.util.GT_Utility; -import gtPlusPlus.core.block.ModBlocks; -import gtPlusPlus.core.lib.CORE; -import gtPlusPlus.xmod.gregtech.api.metatileentity.implementations.base.GregtechMeta_MultiBlockBase; - -public class GregtechMetaTileEntity_IndustrialAlloySmelter extends - GregtechMeta_MultiBlockBase<GregtechMetaTileEntity_IndustrialAlloySmelter> implements ISurvivalConstructable { - - public static int CASING_TEXTURE_ID; - private HeatingCoilLevel mHeatingCapacity; - private int mLevel = 0; - private int mCasing; - private static IStructureDefinition<GregtechMetaTileEntity_IndustrialAlloySmelter> STRUCTURE_DEFINITION = null; - - public GregtechMetaTileEntity_IndustrialAlloySmelter(int aID, String aName, String aNameRegional) { - super(aID, aName, aNameRegional); - CASING_TEXTURE_ID = TAE.getIndexFromPage(2, 1); - } - - public GregtechMetaTileEntity_IndustrialAlloySmelter(String aName) { - super(aName); - CASING_TEXTURE_ID = TAE.getIndexFromPage(2, 1); - } - - @Override - public IMetaTileEntity newMetaEntity(IGregTechTileEntity aTileEntity) { - return new GregtechMetaTileEntity_IndustrialAlloySmelter(this.mName); - } - - @Override - protected IIconContainer getActiveOverlay() { - return Textures.BlockIcons.OVERLAY_FRONT_MULTI_SMELTER_ACTIVE; - } - - @Override - protected IIconContainer getInactiveOverlay() { - return Textures.BlockIcons.OVERLAY_FRONT_MULTI_SMELTER; - } - - @Override - protected int getCasingTextureId() { - return CASING_TEXTURE_ID; - } - - @Override - public RecipeMap<?> getRecipeMap() { - return RecipeMaps.alloySmelterRecipes; - } - - @Override - public boolean isCorrectMachinePart(ItemStack aStack) { - return true; - } - - @Override - public int getMaxEfficiency(ItemStack aStack) { - return 10000; - } - - @Override - public int getPollutionPerSecond(ItemStack aStack) { - return CORE.ConfigSwitches.pollutionPerSecondMultiIndustrialAlloySmelter; - } - - @Override - public int getDamageToComponent(ItemStack aStack) { - return 0; - } - - @Override - public boolean explodesOnComponentBreak(ItemStack aStack) { - return false; - } - - @Override - public String getMachineType() { - return "Alloy Smelter"; - } - - @Override - protected GT_Multiblock_Tooltip_Builder createTooltip() { - GT_Multiblock_Tooltip_Builder tt = new GT_Multiblock_Tooltip_Builder(); - tt.addMachineType(getMachineType()) - .addInfo("Controller Block for the Industrial Alloy Smelter") - .addInfo("Gains one parallel per voltage tier") - .addInfo("Gains one multiplier per coil tier") - .addInfo("Parallel = Tier * Coil Tier") - .addInfo("Gains 5% speed bonus per coil tier") - .addPollutionAmount(getPollutionPerSecond(null)) - .addSeparator() - .beginStructureBlock(3, 5, 3, true) - .addController("Bottom center") - .addCasingInfoMin("Inconel Reinforced Casings", 8, false) - .addOtherStructurePart("Integral Encasement V", "Middle Layer") - .addOtherStructurePart("Heating Coils", "Above and below Integral Encasements") - .addInputBus("Any Inconel Reinforced Casing", 1) - .addOutputBus("Any Inconel Reinforced Casing", 1) - .addEnergyHatch("Any Inconel Reinforced Casing", 1) - .addMaintenanceHatch("Any Inconel Reinforced Casing", 1) - .addMufflerHatch("Any Inconel Reinforced Casing", 1) - .toolTipFinisher(CORE.GT_Tooltip_Builder.get()); - return tt; - } - - @Override - public IStructureDefinition<GregtechMetaTileEntity_IndustrialAlloySmelter> getStructureDefinition() { - if (STRUCTURE_DEFINITION == null) { - STRUCTURE_DEFINITION = StructureDefinition.<GregtechMetaTileEntity_IndustrialAlloySmelter>builder() - .addShape( - mName, - transpose( - new String[][] { { "CCC", "CCC", "CCC" }, { "HHH", "H-H", "HHH" }, { "VVV", "V-V", "VVV" }, - { "HHH", "H-H", "HHH" }, { "C~C", "CCC", "CCC" }, })) - .addElement( - 'C', - buildHatchAdder(GregtechMetaTileEntity_IndustrialAlloySmelter.class) - .atLeast(InputBus, OutputBus, Maintenance, Energy, Muffler) - .casingIndex(CASING_TEXTURE_ID) - .dot(1) - .buildAndChain(onElementPass(x -> ++x.mCasing, ofBlock(ModBlocks.blockCasings3Misc, 1)))) - .addElement( - 'H', - ofCoil( - GregtechMetaTileEntity_IndustrialAlloySmelter::setCoilLevel, - GregtechMetaTileEntity_IndustrialAlloySmelter::getCoilLevel)) - .addElement('V', ofBlock(ModBlocks.blockCasingsTieredGTPP, 4)) - .build(); - } - return STRUCTURE_DEFINITION; - } - - @Override - public void construct(ItemStack stackSize, boolean hintsOnly) { - buildPiece(mName, stackSize, hintsOnly, 1, 4, 0); - } - - @Override - public int survivalConstruct(ItemStack stackSize, int elementBudget, ISurvivalBuildEnvironment env) { - if (mMachine) return -1; - return survivialBuildPiece(mName, stackSize, 1, 4, 0, elementBudget, env, false, true); - } - - @Override - public boolean checkMachine(IGregTechTileEntity aBaseMetaTileEntity, ItemStack aStack) { - mCasing = 0; - mLevel = 0; - setCoilLevel(HeatingCoilLevel.None); - return checkPiece(mName, 1, 4, 0) && mCasing >= 8 - && getCoilLevel() != HeatingCoilLevel.None - && (mLevel = getCoilLevel().getTier() + 1) > 0 - && checkHatch(); - } - - @Override - public int getMaxParallelRecipes() { - return (this.mLevel * GT_Utility.getTier(this.getMaxInputVoltage())); - } - - @Override - protected ProcessingLogic createProcessingLogic() { - return new ProcessingLogic() { - - @NotNull - @Override - protected GT_OverclockCalculator createOverclockCalculator(@NotNull GT_Recipe recipe) { - return super.createOverclockCalculator(recipe).setSpeedBoost(100F / (100F + 5F * mLevel)) - .setHeatOC(true) - .setRecipeHeat(0) - // Need to multiply by 2 because heat OC is done only once every 1800 and this one does it once - // every - // 900 - .setMachineHeat((int) (getCoilLevel().getHeat() * 2)); - } - }.setMaxParallelSupplier(this::getMaxParallelRecipes); - } - - public HeatingCoilLevel getCoilLevel() { - return mHeatingCapacity; - } - - public void setCoilLevel(HeatingCoilLevel aCoilLevel) { - mHeatingCapacity = aCoilLevel; - } - - @Override - public boolean isInputSeparationEnabled() { - return true; - } -} diff --git a/gtpp/src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/processing/GregtechMetaTileEntity_IndustrialArcFurnace.java b/gtpp/src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/processing/GregtechMetaTileEntity_IndustrialArcFurnace.java deleted file mode 100644 index c27422fb93..0000000000 --- a/gtpp/src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/processing/GregtechMetaTileEntity_IndustrialArcFurnace.java +++ /dev/null @@ -1,337 +0,0 @@ -package gtPlusPlus.xmod.gregtech.common.tileentities.machines.multi.processing; - -import static com.gtnewhorizon.structurelib.structure.StructureUtility.ofBlock; -import static com.gtnewhorizon.structurelib.structure.StructureUtility.onElementPass; -import static gregtech.api.enums.GT_HatchElement.Energy; -import static gregtech.api.enums.GT_HatchElement.InputBus; -import static gregtech.api.enums.GT_HatchElement.InputHatch; -import static gregtech.api.enums.GT_HatchElement.Maintenance; -import static gregtech.api.enums.GT_HatchElement.Muffler; -import static gregtech.api.enums.GT_HatchElement.OutputBus; -import static gregtech.api.enums.GT_HatchElement.OutputHatch; -import static gregtech.api.util.GT_StructureUtility.buildHatchAdder; - -import java.util.Arrays; -import java.util.Collection; - -import javax.annotation.Nonnull; - -import net.minecraft.block.Block; -import net.minecraft.entity.player.EntityPlayer; -import net.minecraft.item.ItemStack; -import net.minecraft.nbt.NBTTagCompound; -import net.minecraft.util.EnumChatFormatting; -import net.minecraftforge.common.util.ForgeDirection; - -import com.gtnewhorizon.structurelib.alignment.constructable.ISurvivalConstructable; -import com.gtnewhorizon.structurelib.structure.IStructureDefinition; -import com.gtnewhorizon.structurelib.structure.ISurvivalBuildEnvironment; -import com.gtnewhorizon.structurelib.structure.StructureDefinition; - -import gregtech.api.enums.SoundResource; -import gregtech.api.enums.TAE; -import gregtech.api.interfaces.IIconContainer; -import gregtech.api.interfaces.metatileentity.IMetaTileEntity; -import gregtech.api.interfaces.tileentity.IGregTechTileEntity; -import gregtech.api.logic.ProcessingLogic; -import gregtech.api.recipe.RecipeMap; -import gregtech.api.recipe.RecipeMaps; -import gregtech.api.util.GT_Multiblock_Tooltip_Builder; -import gregtech.api.util.GT_Utility; -import gtPlusPlus.core.block.ModBlocks; -import gtPlusPlus.core.lib.CORE; -import gtPlusPlus.core.util.minecraft.PlayerUtils; -import gtPlusPlus.xmod.gregtech.api.metatileentity.implementations.base.GregtechMeta_MultiBlockBase; -import gtPlusPlus.xmod.gregtech.common.blocks.textures.TexturesGtBlock; - -public class GregtechMetaTileEntity_IndustrialArcFurnace - extends GregtechMeta_MultiBlockBase<GregtechMetaTileEntity_IndustrialArcFurnace> implements ISurvivalConstructable { - - // 862 - private static final int mCasingTextureID = TAE.getIndexFromPage(3, 3); - public static String mCasingName = "Tempered Arc Furnace Casing"; - private boolean mPlasmaMode = false; - private int mSize = 0; - private int mCasing; - private static IStructureDefinition<GregtechMetaTileEntity_IndustrialArcFurnace> STRUCTURE_DEFINITION = null; - - public GregtechMetaTileEntity_IndustrialArcFurnace(final int aID, final String aName, final String aNameRegional) { - super(aID, aName, aNameRegional); - } - - public GregtechMetaTileEntity_IndustrialArcFurnace(final String aName) { - super(aName); - } - - @Override - public IMetaTileEntity newMetaEntity(final IGregTechTileEntity aTileEntity) { - return new GregtechMetaTileEntity_IndustrialArcFurnace(this.mName); - } - - @Override - public String getMachineType() { - return "(Plasma/Electric) Arc Furnace"; - } - - @Override - protected GT_Multiblock_Tooltip_Builder createTooltip() { - GT_Multiblock_Tooltip_Builder tt = new GT_Multiblock_Tooltip_Builder(); - tt.addMachineType(getMachineType()) - .addInfo("Controller Block for Industrial Arc Furnace") - .addInfo("250% faster than using single block machines of the same voltage") - .addInfo("Processes 8 items per voltage tier * W/L") - .addInfo("Right-click controller with a Screwdriver to change modes") - .addInfo("Max Size required to process Plasma recipes") - .addPollutionAmount(getPollutionPerSecond(null)) - .addSeparator() - .addController("Top center") - .addStructureInfo("Size: nxnx3 [WxHxL] (Hollow)") - .addStructureInfo("n can be 3, 5 or 7") - .addCasingInfoMin(mCasingName, 10, false) - .addInputBus("Any Casing", 1) - .addOutputBus("Any Casing", 1) - .addInputHatch("Any Casing", 1) - .addOutputHatch("Any Casing", 1) - .addEnergyHatch("Any Casing", 1) - .addMaintenanceHatch("Any Casing", 1) - .addMufflerHatch("Any Casing", 1) - .toolTipFinisher(CORE.GT_Tooltip_Builder.get()); - return tt; - } - - /** - * The front part of multi. Used to determine the tier, or in other words, determine the size of multi. - */ - private static final String STRUCTURE_PIECE_FRONT = "front"; - /** - * The rest part of multi. - */ - private static final String STRUCTURE_PIECE_REST = "rest"; - private static final int MAX_TIER = 3; - - @Override - public IStructureDefinition<GregtechMetaTileEntity_IndustrialArcFurnace> getStructureDefinition() { - if (STRUCTURE_DEFINITION == null) { - STRUCTURE_DEFINITION = StructureDefinition.<GregtechMetaTileEntity_IndustrialArcFurnace>builder() - .addShape(STRUCTURE_PIECE_FRONT + 1, new String[][] { { "CCC", "C~C", "CCC" } }) - .addShape(STRUCTURE_PIECE_FRONT + 2, new String[][] { { "CCCCC", "C C", "C C", "C C", "CCCCC" } }) - .addShape( - STRUCTURE_PIECE_FRONT + 3, - new String[][] { { "CCCCCCC", "C C", "C C", "C C", "C C", "C C", "CCCCCCC" }, }) - .addShape(STRUCTURE_PIECE_REST + 1, new String[][] { { "CCC", "C-C", "CCC" }, { "CCC", "CCC", "CCC" } }) - .addShape( - STRUCTURE_PIECE_REST + 2, - new String[][] { { "CCCCC", "C---C", "C---C", "C---C", "CCCCC" }, - { "CCCCC", "CCCCC", "CCCCC", "CCCCC", "CCCCC" } }) - .addShape( - STRUCTURE_PIECE_REST + 3, - new String[][] { { "CCCCCCC", "C-----C", "C-----C", "C-----C", "C-----C", "C-----C", "CCCCCCC" }, - { "CCCCCCC", "CCCCCCC", "CCCCCCC", "CCCCCCC", "CCCCCCC", "CCCCCCC", "CCCCCCC" }, }) - .addElement( - 'C', - buildHatchAdder(GregtechMetaTileEntity_IndustrialArcFurnace.class) - .atLeast(InputBus, InputHatch, OutputBus, OutputHatch, Maintenance, Energy, Muffler) - .casingIndex(getCasingTextureIndex()) - .dot(1) - .allowOnly(ForgeDirection.NORTH) - .buildAndChain(onElementPass(x -> ++x.mCasing, ofBlock(ModBlocks.blockCasings4Misc, 3)))) - .build(); - } - return STRUCTURE_DEFINITION; - } - - private int getTierFromHint(ItemStack stackSize) { - if (stackSize.stackSize <= 0 || stackSize.stackSize >= MAX_TIER) { - return MAX_TIER; - } - return stackSize.stackSize; - } - - @Override - public void construct(ItemStack stackSize, boolean hintsOnly) { - int maxTier = getTierFromHint(stackSize); - for (int tier = 1; tier <= maxTier; tier++) { - buildPiece(STRUCTURE_PIECE_FRONT + tier, stackSize, hintsOnly, tier, tier, 0); - } - buildPiece(STRUCTURE_PIECE_REST + maxTier, stackSize, hintsOnly, maxTier, maxTier, -1); - } - - @Override - public int survivalConstruct(ItemStack stackSize, int elementBudget, ISurvivalBuildEnvironment env) { - if (mMachine) return -1; - int maxTier = getTierFromHint(stackSize); - int built; - for (int tier = 1; tier <= maxTier; tier++) { - built = survivialBuildPiece( - STRUCTURE_PIECE_FRONT + tier, - stackSize, - tier, - tier, - 0, - elementBudget, - env, - false, - true); - if (built >= 0) return built; - } - - return survivialBuildPiece( - STRUCTURE_PIECE_REST + maxTier, - stackSize, - maxTier, - maxTier, - -1, - elementBudget, - env, - false, - true); - } - - @Override - public boolean checkMachine(IGregTechTileEntity aBaseMetaTileEntity, ItemStack aStack) { - mCasing = 0; - mSize = 0; - int tier = 0; - while (tier < MAX_TIER && checkPiece(STRUCTURE_PIECE_FRONT + (tier + 1), (tier + 1), (tier + 1), 0)) { - tier++; - } - if (tier <= 0) return false; - if (checkPiece(STRUCTURE_PIECE_REST + tier, tier, tier, -1)) { - mSize = 2 * tier + 1; - return mCasing >= 10 && checkHatch(); - } - return false; - } - - @Override - protected SoundResource getProcessStartSound() { - return SoundResource.IC2_MACHINES_ELECTROFURNACE_LOOP; - } - - @Override - protected IIconContainer getActiveOverlay() { - return TexturesGtBlock.Overlay_Machine_Controller_Default_Active; - } - - @Override - protected IIconContainer getInactiveOverlay() { - return TexturesGtBlock.Overlay_Machine_Controller_Default; - } - - @Override - protected int getCasingTextureId() { - return mCasingTextureID; - } - - @Override - public RecipeMap<?> getRecipeMap() { - return mPlasmaMode ? RecipeMaps.plasmaArcFurnaceRecipes : RecipeMaps.arcFurnaceRecipes; - } - - @Nonnull - @Override - public Collection<RecipeMap<?>> getAvailableRecipeMaps() { - return Arrays.asList(RecipeMaps.arcFurnaceRecipes, RecipeMaps.plasmaArcFurnaceRecipes); - } - - @Override - public int getRecipeCatalystPriority() { - return -1; - } - - @Override - protected ProcessingLogic createProcessingLogic() { - return new ProcessingLogic().setSpeedBonus(1F / 3.5F) - .setMaxParallelSupplier(this::getMaxParallelRecipes); - } - - @Override - public int getMaxParallelRecipes() { - return (this.mSize * 8 * GT_Utility.getTier(this.getMaxInputVoltage())); - } - - @Override - public int getMaxEfficiency(final ItemStack aStack) { - return 10000; - } - - @Override - public int getPollutionPerSecond(final ItemStack aStack) { - return CORE.ConfigSwitches.pollutionPerSecondMultiIndustrialArcFurnace; - } - - @Override - public boolean explodesOnComponentBreak(final ItemStack aStack) { - return false; - } - - public Block getCasingBlock() { - return ModBlocks.blockCasings4Misc; - } - - public byte getCasingMeta() { - return 3; - } - - public byte getCasingTextureIndex() { - return (byte) mCasingTextureID; - } - - @Override - public void onModeChangeByScrewdriver(ForgeDirection side, EntityPlayer aPlayer, float aX, float aY, float aZ) { - if (this.mSize > 5) { - this.mPlasmaMode = !mPlasmaMode; - if (mPlasmaMode) { - PlayerUtils.messagePlayer( - aPlayer, - "[" + EnumChatFormatting.RED - + "MODE" - + EnumChatFormatting.RESET - + "] " - + EnumChatFormatting.LIGHT_PURPLE - + "Plasma" - + EnumChatFormatting.RESET); - } else { - PlayerUtils.messagePlayer( - aPlayer, - "[" + EnumChatFormatting.RED - + "MODE" - + EnumChatFormatting.RESET - + "] " - + EnumChatFormatting.YELLOW - + "Electric" - + EnumChatFormatting.RESET); - } - } else { - PlayerUtils.messagePlayer( - aPlayer, - "[" + EnumChatFormatting.RED - + "MODE" - + EnumChatFormatting.RESET - + "] " - + EnumChatFormatting.GRAY - + "Cannot change mode, structure not large enough." - + EnumChatFormatting.RESET); - } - mLastRecipe = null; - } - - @Override - public void saveNBTData(NBTTagCompound aNBT) { - super.saveNBTData(aNBT); - aNBT.setBoolean("mPlasmaMode", mPlasmaMode); - aNBT.setInteger("mSize", mSize); - } - - @Override - public void loadNBTData(NBTTagCompound aNBT) { - super.loadNBTData(aNBT); - mPlasmaMode = aNBT.getBoolean("mPlasmaMode"); - mSize = aNBT.getInteger("mSize"); - } - - @Override - public void onMachineBlockUpdate() { - mUpdate = 100; - } -} diff --git a/gtpp/src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/processing/GregtechMetaTileEntity_IndustrialCentrifuge.java b/gtpp/src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/processing/GregtechMetaTileEntity_IndustrialCentrifuge.java deleted file mode 100644 index c04620d4b4..0000000000 --- a/gtpp/src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/processing/GregtechMetaTileEntity_IndustrialCentrifuge.java +++ /dev/null @@ -1,228 +0,0 @@ -package gtPlusPlus.xmod.gregtech.common.tileentities.machines.multi.processing; - -import static com.gtnewhorizon.structurelib.structure.StructureUtility.ofBlock; -import static com.gtnewhorizon.structurelib.structure.StructureUtility.onElementPass; -import static com.gtnewhorizon.structurelib.structure.StructureUtility.transpose; -import static gregtech.api.enums.GT_HatchElement.Energy; -import static gregtech.api.enums.GT_HatchElement.InputBus; -import static gregtech.api.enums.GT_HatchElement.InputHatch; -import static gregtech.api.enums.GT_HatchElement.Maintenance; -import static gregtech.api.enums.GT_HatchElement.Muffler; -import static gregtech.api.enums.GT_HatchElement.OutputBus; -import static gregtech.api.enums.GT_HatchElement.OutputHatch; -import static gregtech.api.util.GT_StructureUtility.buildHatchAdder; - -import net.minecraft.block.Block; -import net.minecraft.entity.player.EntityPlayer; -import net.minecraft.item.ItemStack; -import net.minecraft.nbt.NBTTagCompound; -import net.minecraftforge.common.util.ForgeDirection; - -import com.gtnewhorizon.structurelib.alignment.constructable.ISurvivalConstructable; -import com.gtnewhorizon.structurelib.structure.IStructureDefinition; -import com.gtnewhorizon.structurelib.structure.ISurvivalBuildEnvironment; -import com.gtnewhorizon.structurelib.structure.StructureDefinition; - -import gregtech.api.enums.TAE; -import gregtech.api.interfaces.IIconContainer; -import gregtech.api.interfaces.metatileentity.IMetaTileEntity; -import gregtech.api.interfaces.tileentity.IGregTechTileEntity; -import gregtech.api.logic.ProcessingLogic; -import gregtech.api.recipe.RecipeMap; -import gregtech.api.util.GT_Multiblock_Tooltip_Builder; -import gregtech.api.util.GT_Utility; -import gtPlusPlus.api.objects.Logger; -import gtPlusPlus.api.recipe.GTPPRecipeMaps; -import gtPlusPlus.core.block.ModBlocks; -import gtPlusPlus.core.lib.CORE; -import gtPlusPlus.core.util.minecraft.PlayerUtils; -import gtPlusPlus.xmod.gregtech.api.metatileentity.implementations.base.GregtechMeta_MultiBlockBase; -import gtPlusPlus.xmod.gregtech.common.blocks.textures.TexturesGtBlock.CustomIcon; - -public class GregtechMetaTileEntity_IndustrialCentrifuge - extends GregtechMeta_MultiBlockBase<GregtechMetaTileEntity_IndustrialCentrifuge> implements ISurvivalConstructable { - - private boolean mIsAnimated; - private static final CustomIcon frontFaceActive = new CustomIcon("iconsets/LARGECENTRIFUGE_ACTIVE5"); - private static final CustomIcon frontFace = new CustomIcon("iconsets/LARGECENTRIFUGE5"); - private int mCasing; - private static IStructureDefinition<GregtechMetaTileEntity_IndustrialCentrifuge> STRUCTURE_DEFINITION = null; - // public static double recipesComplete = 0; - - public GregtechMetaTileEntity_IndustrialCentrifuge(final int aID, final String aName, final String aNameRegional) { - super(aID, aName, aNameRegional); - mIsAnimated = true; - } - - public GregtechMetaTileEntity_IndustrialCentrifuge(final String aName) { - super(aName); - mIsAnimated = true; - } - - @Override - public IMetaTileEntity newMetaEntity(final IGregTechTileEntity aTileEntity) { - return new GregtechMetaTileEntity_IndustrialCentrifuge(this.mName); - } - - @Override - public String getMachineType() { - return "Centrifuge"; - } - - @Override - protected GT_Multiblock_Tooltip_Builder createTooltip() { - GT_Multiblock_Tooltip_Builder tt = new GT_Multiblock_Tooltip_Builder(); - tt.addMachineType(getMachineType()) - .addInfo("Controller Block for the Industrial Centrifuge") - .addInfo("125% faster than using single block machines of the same voltage") - .addInfo("Disable animations with a screwdriver") - .addInfo("Only uses 90% of the EU/t normally required") - .addInfo("Processes six items per voltage tier") - .addPollutionAmount(getPollutionPerSecond(null)) - .addSeparator() - .beginStructureBlock(3, 3, 3, true) - .addController("Front Center") - .addCasingInfoMin("Centrifuge Casings", 6, false) - .addInputBus("Any Casing", 1) - .addOutputBus("Any Casing", 1) - .addInputHatch("Any Casing", 1) - .addOutputHatch("Any Casing", 1) - .addEnergyHatch("Any Casing", 1) - .addMaintenanceHatch("Any Casing", 1) - .addMufflerHatch("Any Casing", 1) - .toolTipFinisher(CORE.GT_Tooltip_Builder.get()); - return tt; - } - - @Override - public IStructureDefinition<GregtechMetaTileEntity_IndustrialCentrifuge> getStructureDefinition() { - if (STRUCTURE_DEFINITION == null) { - STRUCTURE_DEFINITION = StructureDefinition.<GregtechMetaTileEntity_IndustrialCentrifuge>builder() - .addShape( - mName, - transpose( - new String[][] { { "CCC", "CCC", "CCC" }, { "C~C", "C-C", "CCC" }, { "CCC", "CCC", "CCC" }, })) - .addElement( - 'C', - buildHatchAdder(GregtechMetaTileEntity_IndustrialCentrifuge.class) - .atLeast(InputBus, OutputBus, Maintenance, Energy, Muffler, InputHatch, OutputHatch) - .casingIndex(getCasingTextureIndex()) - .dot(1) - .buildAndChain(onElementPass(x -> ++x.mCasing, ofBlock(ModBlocks.blockCasingsMisc, 0)))) - .build(); - } - return STRUCTURE_DEFINITION; - } - - @Override - public void construct(ItemStack stackSize, boolean hintsOnly) { - buildPiece(mName, stackSize, hintsOnly, 1, 1, 0); - } - - @Override - public int survivalConstruct(ItemStack stackSize, int elementBudget, ISurvivalBuildEnvironment env) { - if (mMachine) return -1; - return survivialBuildPiece(mName, stackSize, 1, 1, 0, elementBudget, env, false, true); - } - - @Override - public boolean checkMachine(IGregTechTileEntity aBaseMetaTileEntity, ItemStack aStack) { - mCasing = 0; - return checkPiece(mName, 1, 1, 0) && mCasing >= 6 && checkHatch(); - } - - @Override - protected IIconContainer getActiveOverlay() { - if (usingAnimations()) { - return frontFaceActive; - } else { - return frontFace; - } - } - - @Override - protected IIconContainer getInactiveOverlay() { - return frontFace; - } - - @Override - protected int getCasingTextureId() { - return TAE.GTPP_INDEX(0); - } - - @Override - public RecipeMap<?> getRecipeMap() { - return GTPPRecipeMaps.centrifugeNonCellRecipes; - } - - @Override - protected ProcessingLogic createProcessingLogic() { - return new ProcessingLogic().setEuModifier(0.9F) - .setSpeedBonus(1F / 2.25F) - .setMaxParallelSupplier(this::getMaxParallelRecipes); - } - - @Override - public int getMaxParallelRecipes() { - return (6 * GT_Utility.getTier(this.getMaxInputVoltage())); - } - - public Block getCasingBlock() { - return ModBlocks.blockCasingsMisc; - } - - public byte getCasingMeta() { - return 0; - } - - public byte getCasingTextureIndex() { - return (byte) TAE.GTPP_INDEX(0); - } - - @Override - public int getMaxEfficiency(final ItemStack aStack) { - return 10000; - } - - @Override - public int getPollutionPerSecond(final ItemStack aStack) { - return CORE.ConfigSwitches.pollutionPerSecondMultiIndustrialCentrifuge; - } - - @Override - public boolean explodesOnComponentBreak(final ItemStack aStack) { - return false; - } - - @Override - public void onModeChangeByScrewdriver(ForgeDirection side, EntityPlayer aPlayer, float aX, float aY, float aZ) { - this.mIsAnimated = !mIsAnimated; - Logger.INFO("Is Centrifuge animated " + this.mIsAnimated); - if (this.mIsAnimated) { - PlayerUtils.messagePlayer(aPlayer, "Using Animated Turbine Texture. "); - } else { - PlayerUtils.messagePlayer(aPlayer, "Using Static Turbine Texture. "); - } - } - - @Override - public void saveNBTData(NBTTagCompound aNBT) { - super.saveNBTData(aNBT); - aNBT.setBoolean("mIsAnimated", mIsAnimated); - } - - @Override - public void loadNBTData(NBTTagCompound aNBT) { - super.loadNBTData(aNBT); - if (aNBT.hasKey("mIsAnimated")) { - mIsAnimated = aNBT.getBoolean("mIsAnimated"); - } else { - mIsAnimated = true; - } - } - - public boolean usingAnimations() { - // Logger.INFO("Is animated? "+this.mIsAnimated); - return this.mIsAnimated; - } -} diff --git a/gtpp/src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/processing/GregtechMetaTileEntity_IndustrialChisel.java b/gtpp/src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/processing/GregtechMetaTileEntity_IndustrialChisel.java deleted file mode 100644 index a9f18dfce8..0000000000 --- a/gtpp/src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/processing/GregtechMetaTileEntity_IndustrialChisel.java +++ /dev/null @@ -1,342 +0,0 @@ -package gtPlusPlus.xmod.gregtech.common.tileentities.machines.multi.processing; - -import static com.gtnewhorizon.structurelib.structure.StructureUtility.ofBlock; -import static com.gtnewhorizon.structurelib.structure.StructureUtility.onElementPass; -import static com.gtnewhorizon.structurelib.structure.StructureUtility.transpose; -import static gregtech.api.enums.GT_HatchElement.Energy; -import static gregtech.api.enums.GT_HatchElement.InputBus; -import static gregtech.api.enums.GT_HatchElement.Maintenance; -import static gregtech.api.enums.GT_HatchElement.Muffler; -import static gregtech.api.enums.GT_HatchElement.OutputBus; -import static gregtech.api.util.GT_StructureUtility.buildHatchAdder; - -import java.util.List; -import java.util.stream.Stream; - -import javax.annotation.Nonnull; -import javax.annotation.Nullable; - -import net.minecraft.init.Blocks; -import net.minecraft.item.ItemStack; -import net.minecraft.util.ResourceLocation; -import net.minecraftforge.fluids.FluidStack; - -import com.gtnewhorizon.structurelib.alignment.constructable.ISurvivalConstructable; -import com.gtnewhorizon.structurelib.structure.IStructureDefinition; -import com.gtnewhorizon.structurelib.structure.ISurvivalBuildEnvironment; -import com.gtnewhorizon.structurelib.structure.StructureDefinition; - -import gregtech.api.enums.SoundResource; -import gregtech.api.interfaces.IIconContainer; -import gregtech.api.interfaces.metatileentity.IMetaTileEntity; -import gregtech.api.interfaces.tileentity.IGregTechTileEntity; -import gregtech.api.logic.ProcessingLogic; -import gregtech.api.metatileentity.implementations.GT_MetaTileEntity_Hatch_InputBus; -import gregtech.api.recipe.RecipeMap; -import gregtech.api.util.GT_Multiblock_Tooltip_Builder; -import gregtech.api.util.GT_Recipe; -import gregtech.api.util.GT_StreamUtil; -import gregtech.api.util.GT_Utility; -import gtPlusPlus.core.block.ModBlocks; -import gtPlusPlus.core.lib.CORE; -import gtPlusPlus.core.util.minecraft.ItemUtils; -import gtPlusPlus.xmod.gregtech.api.metatileentity.implementations.GT_MetaTileEntity_ChiselBus; -import gtPlusPlus.xmod.gregtech.api.metatileentity.implementations.base.GregtechMeta_MultiBlockBase; -import gtPlusPlus.xmod.gregtech.common.blocks.textures.TexturesGtBlock; -import team.chisel.carving.Carving; - -public class GregtechMetaTileEntity_IndustrialChisel - extends GregtechMeta_MultiBlockBase<GregtechMetaTileEntity_IndustrialChisel> implements ISurvivalConstructable { - - private int mCasing; - - private ItemStack target; - private static IStructureDefinition<GregtechMetaTileEntity_IndustrialChisel> STRUCTURE_DEFINITION = null; - private ItemStack mInputCache; - private ItemStack mOutputCache; - private GT_Recipe mCachedRecipe; - - public GregtechMetaTileEntity_IndustrialChisel(int aID, String aName, String aNameRegional) { - super(aID, aName, aNameRegional); - } - - public GregtechMetaTileEntity_IndustrialChisel(String aName) { - super(aName); - } - - @Override - public IMetaTileEntity newMetaEntity(IGregTechTileEntity aTileEntity) { - return new GregtechMetaTileEntity_IndustrialChisel(this.mName); - } - - @Override - public String getMachineType() { - return "Chisel"; - } - - @Override - protected GT_Multiblock_Tooltip_Builder createTooltip() { - GT_Multiblock_Tooltip_Builder tt = new GT_Multiblock_Tooltip_Builder(); - tt.addMachineType(getMachineType()) - .addInfo("Factory Grade Auto Chisel") - .addInfo("Target block goes in Controller slot for common Input Buses") - .addInfo("You can also set a target block in each Chisel Input Bus and use them as an Input Bus") - .addInfo("If no target is provided for common buses, the result of the first chisel is used") - .addInfo("Speed: +200% | EU Usage: 75% | Parallel: Tier x 16") - .addPollutionAmount(getPollutionPerSecond(null)) - .addSeparator() - .beginStructureBlock(3, 3, 3, true) - .addController("Front center") - .addCasingInfoMin("Sturdy Printer Casing", 6, false) - .addInputBus("Any casing", 1) - .addOutputBus("Any casing", 1) - .addEnergyHatch("Any casing", 1) - .addMaintenanceHatch("Any casing", 1) - .addMufflerHatch("Any casing", 1) - .toolTipFinisher(CORE.GT_Tooltip_Builder.get()); - return tt; - } - - @Override - public IStructureDefinition<GregtechMetaTileEntity_IndustrialChisel> getStructureDefinition() { - if (STRUCTURE_DEFINITION == null) { - STRUCTURE_DEFINITION = StructureDefinition.<GregtechMetaTileEntity_IndustrialChisel>builder() - .addShape( - mName, - transpose( - // spotless:off - new String[][] { - { "CCC", "CCC", "CCC" }, - { "C~C", "C-C", "CCC" }, - { "CCC", "CCC", "CCC" }, - })) - // spotless:on - .addElement( - 'C', - buildHatchAdder(GregtechMetaTileEntity_IndustrialChisel.class) - .atLeast(InputBus, OutputBus, Maintenance, Energy, Muffler) - .casingIndex(90) - .dot(1) - .buildAndChain(onElementPass(x -> ++x.mCasing, ofBlock(ModBlocks.blockCasings5Misc, 5)))) - .build(); - } - return STRUCTURE_DEFINITION; - } - - @Override - public void construct(ItemStack stackSize, boolean hintsOnly) { - buildPiece(mName, stackSize, hintsOnly, 1, 1, 0); - } - - @Override - public int survivalConstruct(ItemStack stackSize, int elementBudget, ISurvivalBuildEnvironment env) { - if (mMachine) return -1; - return survivialBuildPiece(mName, stackSize, 1, 1, 0, elementBudget, env, false, true); - } - - @Override - public boolean checkMachine(IGregTechTileEntity aBaseMetaTileEntity, ItemStack aStack) { - mCasing = 0; - return checkPiece(mName, 1, 1, 0) && mCasing >= 6 && checkHatch(); - } - - @Override - protected IIconContainer getActiveOverlay() { - return TexturesGtBlock.Overlay_Machine_Controller_Advanced_Active; - } - - @Override - protected IIconContainer getInactiveOverlay() { - return TexturesGtBlock.Overlay_Machine_Controller_Advanced; - } - - @Override - protected int getCasingTextureId() { - return 90; - } - - @Override - public boolean isCorrectMachinePart(ItemStack aStack) { - return true; - } - - private boolean hasValidCache(ItemStack aStack, ItemStack aSpecialSlot, boolean aClearOnFailure) { - if (mInputCache != null && mOutputCache != null && mCachedRecipe != null) { - if (GT_Utility.areStacksEqual(aStack, mInputCache) - && GT_Utility.areStacksEqual(aSpecialSlot, mOutputCache)) { - return true; - } - } - // clear cache if it was invalid - if (aClearOnFailure) { - mInputCache = null; - mOutputCache = null; - mCachedRecipe = null; - } - return false; - } - - private void cacheItem(ItemStack aInputItem, ItemStack aOutputItem, GT_Recipe aRecipe) { - mInputCache = aInputItem.copy(); - mOutputCache = aOutputItem.copy(); - mCachedRecipe = aRecipe; - } - - // lets make sure the user isn't trying to make something from a block that doesn't have this as a valid target - private static boolean canBeMadeFrom(ItemStack from, ItemStack to) { - List<ItemStack> results = getItemsForChiseling(from); - for (ItemStack s : results) { - if (s.getItem() == to.getItem() && s.getItemDamage() == to.getItemDamage()) { - return true; - } - } - return false; - } - - // lets make sure the user isn't trying to make something from a block that doesn't have this as a valid target - private static boolean hasChiselResults(ItemStack from) { - List<ItemStack> results = getItemsForChiseling(from); - return results.size() > 0; - } - - private static List<ItemStack> getItemsForChiseling(ItemStack aStack) { - return Carving.chisel.getItemsForChiseling(aStack); - } - - private static ItemStack getChiselOutput(ItemStack aInput, ItemStack aTarget) { - ItemStack tOutput; - if (aTarget != null && canBeMadeFrom(aInput, aTarget)) { - tOutput = aTarget; - } else if (aTarget != null && !canBeMadeFrom(aInput, aTarget)) { - tOutput = null; - } else { - tOutput = getItemsForChiseling(aInput).get(0); - } - return tOutput; - } - - private GT_Recipe generateChiselRecipe(ItemStack aInput) { - boolean tIsCached = hasValidCache(aInput, this.target, true); - if (tIsCached || aInput != null && hasChiselResults(aInput)) { - ItemStack tOutput = tIsCached ? mOutputCache.copy() : getChiselOutput(aInput, this.target); - if (tOutput != null) { - if (mCachedRecipe != null && GT_Utility.areStacksEqual(aInput, mInputCache) - && GT_Utility.areStacksEqual(tOutput, mOutputCache)) { - return mCachedRecipe; - } - // We can chisel this - GT_Recipe aRecipe = new GT_Recipe( - false, - new ItemStack[] { ItemUtils.getSimpleStack(aInput, 1) }, - new ItemStack[] { ItemUtils.getSimpleStack(tOutput, 1) }, - null, - new int[] { 10000 }, - new FluidStack[] {}, - new FluidStack[] {}, - 20, - 16, - 0); - - // Cache it - cacheItem(aInput, tOutput, aRecipe); - return aRecipe; - } - } - return null; - } - - private GT_Recipe getRecipe() { - for (GT_MetaTileEntity_Hatch_InputBus bus : this.mInputBusses) { - if (bus instanceof GT_MetaTileEntity_ChiselBus) { // Chisel buses - if (bus.mInventory[bus.getSizeInventory() - 1] == null) continue; - this.target = bus.mInventory[bus.getSizeInventory() - 1]; - - for (int i = bus.getSizeInventory() - 2; i >= 0; i--) { - ItemStack itemsInSlot = bus.mInventory[i]; - if (itemsInSlot != null) { - GT_Recipe tRecipe = generateChiselRecipe(itemsInSlot); - if (tRecipe != null) { - return tRecipe; - } - } - } - } else { - target = this.getControllerSlot(); // Common buses - for (int i = bus.getSizeInventory() - 1; i >= 0; i--) { - ItemStack itemsInSlot = bus.mInventory[i]; - if (itemsInSlot != null) { - GT_Recipe tRecipe = generateChiselRecipe(itemsInSlot); - if (tRecipe != null) { - return tRecipe; - } - } - } - } - - } - return null; - } - - @Override - protected ProcessingLogic createProcessingLogic() { - return new ProcessingLogic() { - - @Nonnull - @Override - protected Stream<GT_Recipe> findRecipeMatches(@Nullable RecipeMap<?> map) { - return GT_StreamUtil.ofNullable(getRecipe()); - } - }.setSpeedBonus(1F / 3F) - .setEuModifier(0.75F) - .setMaxParallelSupplier(this::getMaxParallelRecipes); - } - - @Override - protected void sendStartMultiBlockSoundLoop() { - sendLoopStart(PROCESS_START_SOUND_INDEX); - } - - @Override - public int getMaxParallelRecipes() { - return (16 * GT_Utility.getTier(this.getMaxInputVoltage())); - } - - private static ResourceLocation sChiselSound = null; - - private static ResourceLocation getChiselSound() { - if (sChiselSound == null) { - sChiselSound = new ResourceLocation(Carving.chisel.getVariationSound(Blocks.stone, 0)); - } - return sChiselSound; - } - - @Override - public void doSound(byte aIndex, double aX, double aY, double aZ) { - switch (aIndex) { - case PROCESS_START_SOUND_INDEX -> GT_Utility - .doSoundAtClient(getChiselSound(), getTimeBetweenProcessSounds(), 1.0F, 1.0F, aX, aY, aZ); - case INTERRUPT_SOUND_INDEX -> GT_Utility - .doSoundAtClient(SoundResource.IC2_MACHINES_INTERRUPT_ONE, 100, 1.0F, aX, aY, aZ); - } - } - - @Override - public int getMaxEfficiency(ItemStack aStack) { - return 10000; - } - - @Override - public int getPollutionPerSecond(ItemStack aStack) { - return CORE.ConfigSwitches.pollutionPerSecondMultiIndustrialChisel; - } - - @Override - public int getDamageToComponent(ItemStack aStack) { - return 0; - } - - @Override - public boolean explodesOnComponentBreak(ItemStack aStack) { - return false; - } -} diff --git a/gtpp/src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/processing/GregtechMetaTileEntity_IndustrialCokeOven.java b/gtpp/src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/processing/GregtechMetaTileEntity_IndustrialCokeOven.java deleted file mode 100644 index b71600e3fd..0000000000 --- a/gtpp/src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/processing/GregtechMetaTileEntity_IndustrialCokeOven.java +++ /dev/null @@ -1,209 +0,0 @@ -package gtPlusPlus.xmod.gregtech.common.tileentities.machines.multi.processing; - -import static com.gtnewhorizon.structurelib.structure.StructureUtility.ofBlock; -import static com.gtnewhorizon.structurelib.structure.StructureUtility.ofChain; -import static com.gtnewhorizon.structurelib.structure.StructureUtility.onElementPass; -import static com.gtnewhorizon.structurelib.structure.StructureUtility.transpose; -import static gregtech.api.enums.GT_HatchElement.Energy; -import static gregtech.api.enums.GT_HatchElement.InputBus; -import static gregtech.api.enums.GT_HatchElement.InputHatch; -import static gregtech.api.enums.GT_HatchElement.Maintenance; -import static gregtech.api.enums.GT_HatchElement.Muffler; -import static gregtech.api.enums.GT_HatchElement.OutputBus; -import static gregtech.api.enums.GT_HatchElement.OutputHatch; -import static gregtech.api.util.GT_StructureUtility.buildHatchAdder; - -import net.minecraft.item.ItemStack; - -import com.gtnewhorizon.structurelib.alignment.constructable.ISurvivalConstructable; -import com.gtnewhorizon.structurelib.structure.IStructureDefinition; -import com.gtnewhorizon.structurelib.structure.ISurvivalBuildEnvironment; -import com.gtnewhorizon.structurelib.structure.StructureDefinition; - -import gregtech.api.enums.SoundResource; -import gregtech.api.enums.TAE; -import gregtech.api.interfaces.IIconContainer; -import gregtech.api.interfaces.metatileentity.IMetaTileEntity; -import gregtech.api.interfaces.tileentity.IGregTechTileEntity; -import gregtech.api.logic.ProcessingLogic; -import gregtech.api.recipe.RecipeMap; -import gregtech.api.util.GT_Multiblock_Tooltip_Builder; -import gregtech.api.util.GT_Utility; -import gtPlusPlus.api.recipe.GTPPRecipeMaps; -import gtPlusPlus.core.block.ModBlocks; -import gtPlusPlus.core.lib.CORE; -import gtPlusPlus.xmod.gregtech.api.metatileentity.implementations.base.GregtechMeta_MultiBlockBase; -import gtPlusPlus.xmod.gregtech.common.blocks.textures.TexturesGtBlock; - -public class GregtechMetaTileEntity_IndustrialCokeOven - extends GregtechMeta_MultiBlockBase<GregtechMetaTileEntity_IndustrialCokeOven> implements ISurvivalConstructable { - - private int mLevel = 0; - private int mCasing; - private int mCasing1; - private int mCasing2; - private static IStructureDefinition<GregtechMetaTileEntity_IndustrialCokeOven> STRUCTURE_DEFINITION = null; - - public GregtechMetaTileEntity_IndustrialCokeOven(final int aID, final String aName, final String aNameRegional) { - super(aID, aName, aNameRegional); - } - - public GregtechMetaTileEntity_IndustrialCokeOven(final String aName) { - super(aName); - } - - @Override - public IMetaTileEntity newMetaEntity(final IGregTechTileEntity aTileEntity) { - return new GregtechMetaTileEntity_IndustrialCokeOven(this.mName); - } - - @Override - public String getMachineType() { - return "Coke Oven"; - } - - @Override - protected GT_Multiblock_Tooltip_Builder createTooltip() { - GT_Multiblock_Tooltip_Builder tt = new GT_Multiblock_Tooltip_Builder(); - tt.addMachineType(getMachineType()) - .addInfo("Processes Logs and Coal into Charcoal and Coal Coke.") - .addInfo("Controller Block for the Industrial Coke Oven") - .addInfo("Gain 4% energy discount per voltage tier") - .addInfo("Process 12x materials with Heat Resistant Casings") - .addInfo("Or 24x materials with Heat Proof Casings") - .addPollutionAmount(getPollutionPerSecond(null)) - .addSeparator() - .beginStructureBlock(3, 3, 3, true) - .addController("Front middle at bottom") - .addCasingInfoMin("Structural Coke Oven Casings", 8, false) - .addCasingInfoMin("Heat Resistant/Proof Coke Oven Casings", 8, false) - .addInputBus("Any Structural Coke Oven Casing", 1) - .addOutputBus("Any Structural Coke Oven Casing", 1) - .addInputHatch("Any Structural Coke Oven Casing", 1) - .addOutputHatch("Any Structural Coke Oven Casing", 1) - .addEnergyHatch("Any Structural Coke Oven Casing", 1) - .addMaintenanceHatch("Any Structural Coke Oven Casing", 1) - .addMufflerHatch("Any Structural Coke Oven Casing", 1) - .toolTipFinisher(CORE.GT_Tooltip_Builder.get()); - return tt; - } - - @Override - public IStructureDefinition<GregtechMetaTileEntity_IndustrialCokeOven> getStructureDefinition() { - if (STRUCTURE_DEFINITION == null) { - STRUCTURE_DEFINITION = StructureDefinition.<GregtechMetaTileEntity_IndustrialCokeOven>builder() - .addShape( - mName, - transpose( - new String[][] { { "CCC", "CCC", "CCC" }, { "HHH", "H-H", "HHH" }, { "C~C", "CCC", "CCC" }, })) - .addShape( - mName + "1", - transpose( - new String[][] { { "CCC", "CCC", "CCC" }, { "aaa", "a-a", "aaa" }, { "C~C", "CCC", "CCC" }, })) - .addShape( - mName + "2", - transpose( - new String[][] { { "CCC", "CCC", "CCC" }, { "bbb", "b-b", "bbb" }, { "C~C", "CCC", "CCC" }, })) - .addElement( - 'C', - buildHatchAdder(GregtechMetaTileEntity_IndustrialCokeOven.class) - .atLeast(InputBus, OutputBus, InputHatch, OutputHatch, Maintenance, Energy, Muffler) - .casingIndex(TAE.GTPP_INDEX(1)) - .dot(1) - .buildAndChain(onElementPass(x -> ++x.mCasing, ofBlock(ModBlocks.blockCasingsMisc, 1)))) - .addElement( - 'H', - ofChain( - onElementPass(x -> ++x.mCasing1, ofBlock(ModBlocks.blockCasingsMisc, 2)), - onElementPass(x -> ++x.mCasing2, ofBlock(ModBlocks.blockCasingsMisc, 3)))) - .addElement('a', ofBlock(ModBlocks.blockCasingsMisc, 2)) - .addElement('b', ofBlock(ModBlocks.blockCasingsMisc, 3)) - .build(); - } - return STRUCTURE_DEFINITION; - } - - @Override - public void construct(ItemStack stackSize, boolean hintsOnly) { - if (stackSize.stackSize == 1) buildPiece(mName + "1", stackSize, hintsOnly, 1, 2, 0); - else buildPiece(mName + "2", stackSize, hintsOnly, 1, 2, 0); - } - - @Override - public int survivalConstruct(ItemStack stackSize, int elementBudget, ISurvivalBuildEnvironment env) { - if (mMachine) return -1; - if (stackSize.stackSize == 1) - return survivialBuildPiece(mName + "1", stackSize, 1, 2, 0, elementBudget, env, false, true); - else return survivialBuildPiece(mName + "2", stackSize, 1, 2, 0, elementBudget, env, false, true); - } - - @Override - public boolean checkMachine(IGregTechTileEntity aBaseMetaTileEntity, ItemStack aStack) { - mCasing = 0; - mCasing1 = 0; - mCasing2 = 0; - mLevel = 0; - if (checkPiece(mName, 1, 2, 0)) { - if (mCasing1 == 8) mLevel = 1; - if (mCasing2 == 8) mLevel = 2; - return mLevel > 0 && mCasing >= 8 && checkHatch(); - } - return false; - } - - @Override - protected SoundResource getProcessStartSound() { - return SoundResource.IC2_MACHINES_ELECTROFURNACE_LOOP; - } - - @Override - protected IIconContainer getActiveOverlay() { - return TexturesGtBlock.Overlay_Machine_Controller_Advanced_Active; - } - - @Override - protected IIconContainer getInactiveOverlay() { - return TexturesGtBlock.Overlay_Machine_Controller_Advanced; - } - - @Override - protected int getCasingTextureId() { - return TAE.GTPP_INDEX(1); - } - - @Override - public RecipeMap<?> getRecipeMap() { - return GTPPRecipeMaps.cokeOvenRecipes; - } - - @Override - protected ProcessingLogic createProcessingLogic() { - return new ProcessingLogic().setMaxParallelSupplier(this::getMaxParallelRecipes); - } - - @Override - protected void setupProcessingLogic(ProcessingLogic logic) { - super.setupProcessingLogic(logic); - logic.setEuModifier((100F - (GT_Utility.getTier(getMaxInputVoltage()) * 4)) / 100F); - } - - @Override - public int getMaxParallelRecipes() { - return this.mLevel * 12; - } - - @Override - public int getMaxEfficiency(final ItemStack aStack) { - return 10000; - } - - @Override - public int getPollutionPerSecond(final ItemStack aStack) { - return CORE.ConfigSwitches.pollutionPerSecondMultiIndustrialCokeOven; - } - - @Override - public boolean explodesOnComponentBreak(final ItemStack aStack) { - return false; - } -} diff --git a/gtpp/src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/processing/GregtechMetaTileEntity_IndustrialCuttingMachine.java b/gtpp/src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/processing/GregtechMetaTileEntity_IndustrialCuttingMachine.java deleted file mode 100644 index 295f195d55..0000000000 --- a/gtpp/src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/processing/GregtechMetaTileEntity_IndustrialCuttingMachine.java +++ /dev/null @@ -1,230 +0,0 @@ -package gtPlusPlus.xmod.gregtech.common.tileentities.machines.multi.processing; - -import static com.gtnewhorizon.structurelib.structure.StructureUtility.ofBlock; -import static com.gtnewhorizon.structurelib.structure.StructureUtility.onElementPass; -import static com.gtnewhorizon.structurelib.structure.StructureUtility.transpose; -import static gregtech.api.enums.GT_HatchElement.Energy; -import static gregtech.api.enums.GT_HatchElement.InputBus; -import static gregtech.api.enums.GT_HatchElement.InputHatch; -import static gregtech.api.enums.GT_HatchElement.Maintenance; -import static gregtech.api.enums.GT_HatchElement.Muffler; -import static gregtech.api.enums.GT_HatchElement.OutputBus; -import static gregtech.api.util.GT_StructureUtility.buildHatchAdder; - -import java.util.Arrays; -import java.util.Collection; - -import javax.annotation.Nonnull; - -import net.minecraft.block.Block; -import net.minecraft.entity.player.EntityPlayer; -import net.minecraft.item.ItemStack; -import net.minecraft.nbt.NBTTagCompound; -import net.minecraftforge.common.util.ForgeDirection; - -import com.gtnewhorizon.structurelib.alignment.constructable.ISurvivalConstructable; -import com.gtnewhorizon.structurelib.structure.IStructureDefinition; -import com.gtnewhorizon.structurelib.structure.ISurvivalBuildEnvironment; -import com.gtnewhorizon.structurelib.structure.StructureDefinition; - -import gregtech.api.enums.TAE; -import gregtech.api.interfaces.IIconContainer; -import gregtech.api.interfaces.metatileentity.IMetaTileEntity; -import gregtech.api.interfaces.tileentity.IGregTechTileEntity; -import gregtech.api.logic.ProcessingLogic; -import gregtech.api.recipe.RecipeMap; -import gregtech.api.recipe.RecipeMaps; -import gregtech.api.util.GT_Multiblock_Tooltip_Builder; -import gregtech.api.util.GT_Utility; -import gtPlusPlus.core.block.ModBlocks; -import gtPlusPlus.core.lib.CORE; -import gtPlusPlus.core.util.minecraft.PlayerUtils; -import gtPlusPlus.xmod.gregtech.api.metatileentity.implementations.base.GregtechMeta_MultiBlockBase; -import gtPlusPlus.xmod.gregtech.common.blocks.textures.TexturesGtBlock; - -public class GregtechMetaTileEntity_IndustrialCuttingMachine extends - GregtechMeta_MultiBlockBase<GregtechMetaTileEntity_IndustrialCuttingMachine> implements ISurvivalConstructable { - - private boolean mCuttingMode = true; - private int mCasing; - private static IStructureDefinition<GregtechMetaTileEntity_IndustrialCuttingMachine> STRUCTURE_DEFINITION = null; - - public GregtechMetaTileEntity_IndustrialCuttingMachine(final int aID, final String aName, - final String aNameRegional) { - super(aID, aName, aNameRegional); - } - - public GregtechMetaTileEntity_IndustrialCuttingMachine(final String aName) { - super(aName); - } - - @Override - public IMetaTileEntity newMetaEntity(final IGregTechTileEntity aTileEntity) { - return new GregtechMetaTileEntity_IndustrialCuttingMachine(this.mName); - } - - @Override - public String getMachineType() { - return "Cutting Machine / Slicing Machine"; - } - - @Override - protected GT_Multiblock_Tooltip_Builder createTooltip() { - GT_Multiblock_Tooltip_Builder tt = new GT_Multiblock_Tooltip_Builder(); - tt.addMachineType(getMachineType()) - .addInfo("Controller Block for the Industrial Cutting Factory") - .addInfo("200% faster than using single block machines of the same voltage") - .addInfo("Only uses 75% of the EU/t normally required") - .addInfo("Processes four items per voltage tier") - .addPollutionAmount(getPollutionPerSecond(null)) - .addSeparator() - .beginStructureBlock(3, 3, 5, true) - .addController("Front Center") - .addCasingInfoMin("Cutting Factory Frames", 14, false) - .addInputBus("Any Casing", 1) - .addOutputBus("Any Casing", 1) - .addInputHatch("Any Casing", 1) - .addEnergyHatch("Any Casing", 1) - .addMaintenanceHatch("Any Casing", 1) - .addMufflerHatch("Any Casing", 1) - .toolTipFinisher(CORE.GT_Tooltip_Builder.get()); - return tt; - } - - @Override - public IStructureDefinition<GregtechMetaTileEntity_IndustrialCuttingMachine> getStructureDefinition() { - if (STRUCTURE_DEFINITION == null) { - STRUCTURE_DEFINITION = StructureDefinition.<GregtechMetaTileEntity_IndustrialCuttingMachine>builder() - .addShape( - mName, - transpose( - new String[][] { { "CCC", "CCC", "CCC", "CCC", "CCC" }, { "C~C", "C-C", "C-C", "C-C", "CCC" }, - { "CCC", "CCC", "CCC", "CCC", "CCC" }, })) - .addElement( - 'C', - buildHatchAdder(GregtechMetaTileEntity_IndustrialCuttingMachine.class) - .atLeast(InputBus, InputHatch, OutputBus, Maintenance, Energy, Muffler) - .casingIndex(getCasingTextureIndex()) - .dot(1) - .buildAndChain(onElementPass(x -> ++x.mCasing, ofBlock(ModBlocks.blockCasings2Misc, 13)))) - .build(); - } - return STRUCTURE_DEFINITION; - } - - @Override - public void construct(ItemStack stackSize, boolean hintsOnly) { - buildPiece(mName, stackSize, hintsOnly, 1, 1, 0); - } - - @Override - public int survivalConstruct(ItemStack stackSize, int elementBudget, ISurvivalBuildEnvironment env) { - if (mMachine) return -1; - return survivialBuildPiece(mName, stackSize, 1, 1, 0, elementBudget, env, false, true); - } - - @Override - public boolean checkMachine(IGregTechTileEntity aBaseMetaTileEntity, ItemStack aStack) { - mCasing = 0; - return checkPiece(mName, 1, 1, 0) && mCasing >= 14 && checkHatch(); - } - - @Override - protected IIconContainer getActiveOverlay() { - return TexturesGtBlock.Overlay_Machine_Controller_Default_Active; - } - - @Override - protected IIconContainer getInactiveOverlay() { - return TexturesGtBlock.Overlay_Machine_Controller_Default; - } - - @Override - protected int getCasingTextureId() { - return TAE.GTPP_INDEX(29); - } - - @Override - public RecipeMap<?> getRecipeMap() { - return mCuttingMode ? RecipeMaps.cutterRecipes : RecipeMaps.slicerRecipes; - } - - @Nonnull - @Override - public Collection<RecipeMap<?>> getAvailableRecipeMaps() { - return Arrays.asList(RecipeMaps.cutterRecipes, RecipeMaps.slicerRecipes); - } - - @Override - public int getRecipeCatalystPriority() { - return -1; - } - - @Override - protected ProcessingLogic createProcessingLogic() { - return new ProcessingLogic().setSpeedBonus(1F / 3F) - .setEuModifier(0.75F) - .setMaxParallelSupplier(this::getMaxParallelRecipes); - } - - @Override - public int getMaxParallelRecipes() { - return (4 * GT_Utility.getTier(this.getMaxInputVoltage())); - } - - @Override - public int getMaxEfficiency(final ItemStack aStack) { - return 10000; - } - - @Override - public int getPollutionPerSecond(final ItemStack aStack) { - return CORE.ConfigSwitches.pollutionPerSecondMultiIndustrialCuttingMachine; - } - - @Override - public boolean explodesOnComponentBreak(final ItemStack aStack) { - return false; - } - - @Override - public boolean isInputSeparationEnabled() { - return true; - } - - public Block getCasingBlock() { - return ModBlocks.blockCasings2Misc; - } - - public byte getCasingMeta() { - return 13; - } - - public byte getCasingTextureIndex() { - return (byte) TAE.GTPP_INDEX(29); - } - - @Override - public void onModeChangeByScrewdriver(ForgeDirection side, EntityPlayer aPlayer, float aX, float aY, float aZ) { - mCuttingMode = !mCuttingMode; - String aMode = mCuttingMode ? "Cutting" : "Slicing"; - PlayerUtils.messagePlayer(aPlayer, "Mode: " + aMode); - mLastRecipe = null; - } - - @Override - public void saveNBTData(NBTTagCompound aNBT) { - super.saveNBTData(aNBT); - aNBT.setBoolean("mCuttingMode", mCuttingMode); - } - - @Override - public void loadNBTData(NBTTagCompound aNBT) { - super.loadNBTData(aNBT); - if (aNBT.hasKey("mCuttingMode")) { - mCuttingMode = aNBT.getBoolean("mCuttingMode"); - } else { - mCuttingMode = true; - } - } -} diff --git a/gtpp/src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/processing/GregtechMetaTileEntity_IndustrialDehydrator.java b/gtpp/src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/processing/GregtechMetaTileEntity_IndustrialDehydrator.java deleted file mode 100644 index 9122090f89..0000000000 --- a/gtpp/src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/processing/GregtechMetaTileEntity_IndustrialDehydrator.java +++ /dev/null @@ -1,250 +0,0 @@ -package gtPlusPlus.xmod.gregtech.common.tileentities.machines.multi.processing; - -import static com.gtnewhorizon.structurelib.structure.StructureUtility.ofBlock; -import static com.gtnewhorizon.structurelib.structure.StructureUtility.onElementPass; -import static com.gtnewhorizon.structurelib.structure.StructureUtility.transpose; -import static gregtech.api.enums.GT_HatchElement.Energy; -import static gregtech.api.enums.GT_HatchElement.InputBus; -import static gregtech.api.enums.GT_HatchElement.InputHatch; -import static gregtech.api.enums.GT_HatchElement.Maintenance; -import static gregtech.api.enums.GT_HatchElement.Muffler; -import static gregtech.api.enums.GT_HatchElement.OutputBus; -import static gregtech.api.enums.GT_HatchElement.OutputHatch; -import static gregtech.api.util.GT_StructureUtility.buildHatchAdder; -import static gregtech.api.util.GT_StructureUtility.ofCoil; - -import java.util.Arrays; -import java.util.Collection; - -import javax.annotation.Nonnull; - -import net.minecraft.entity.player.EntityPlayer; -import net.minecraft.item.ItemStack; -import net.minecraft.nbt.NBTTagCompound; -import net.minecraftforge.common.util.ForgeDirection; - -import org.jetbrains.annotations.NotNull; - -import com.gtnewhorizon.structurelib.alignment.constructable.ISurvivalConstructable; -import com.gtnewhorizon.structurelib.structure.IStructureDefinition; -import com.gtnewhorizon.structurelib.structure.ISurvivalBuildEnvironment; -import com.gtnewhorizon.structurelib.structure.StructureDefinition; - -import gregtech.api.enums.HeatingCoilLevel; -import gregtech.api.enums.TAE; -import gregtech.api.interfaces.IIconContainer; -import gregtech.api.interfaces.metatileentity.IMetaTileEntity; -import gregtech.api.interfaces.tileentity.IGregTechTileEntity; -import gregtech.api.logic.ProcessingLogic; -import gregtech.api.recipe.RecipeMap; -import gregtech.api.recipe.check.CheckRecipeResult; -import gregtech.api.recipe.check.CheckRecipeResultRegistry; -import gregtech.api.util.GT_Multiblock_Tooltip_Builder; -import gregtech.api.util.GT_OverclockCalculator; -import gregtech.api.util.GT_Recipe; -import gtPlusPlus.api.recipe.GTPPRecipeMaps; -import gtPlusPlus.core.block.ModBlocks; -import gtPlusPlus.core.lib.CORE; -import gtPlusPlus.core.util.minecraft.PlayerUtils; -import gtPlusPlus.xmod.gregtech.api.metatileentity.implementations.base.GregtechMeta_MultiBlockBase; -import gtPlusPlus.xmod.gregtech.common.blocks.textures.TexturesGtBlock; - -public class GregtechMetaTileEntity_IndustrialDehydrator - extends GregtechMeta_MultiBlockBase<GregtechMetaTileEntity_IndustrialDehydrator> implements ISurvivalConstructable { - - private static int CASING_TEXTURE_ID; - private static String mCasingName = "Vacuum Casing"; - private HeatingCoilLevel mHeatingCapacity; - private boolean mDehydratorMode = false; - private int mCasing; - private static IStructureDefinition<GregtechMetaTileEntity_IndustrialDehydrator> STRUCTURE_DEFINITION = null; - - public GregtechMetaTileEntity_IndustrialDehydrator(int aID, String aName, String aNameRegional) { - super(aID, aName, aNameRegional); - CASING_TEXTURE_ID = TAE.getIndexFromPage(3, 10); - } - - public GregtechMetaTileEntity_IndustrialDehydrator(String aName) { - super(aName); - CASING_TEXTURE_ID = TAE.getIndexFromPage(3, 10); - } - - @Override - public IMetaTileEntity newMetaEntity(IGregTechTileEntity aTileEntity) { - return new GregtechMetaTileEntity_IndustrialDehydrator(mName); - } - - @Override - protected GT_Multiblock_Tooltip_Builder createTooltip() { - GT_Multiblock_Tooltip_Builder tt = new GT_Multiblock_Tooltip_Builder(); - tt.addMachineType(getMachineType()) - .addInfo("Factory Grade Vacuum Furnace") - .addInfo("Can toggle the operation temperature with a Screwdriver") - .addInfo("All Dehydrator recipes are Low Temp recipes") - .addInfo("Speed: +120% | EU Usage: 50% | Parallel: 4") - .addInfo("Each 900K over the min. Heat Capacity grants 5% speedup (multiplicatively)") - .addInfo("Each 1800K over the min. Heat Capacity allows for one upgraded overclock") - .addInfo("Upgraded overclocks reduce recipe time to 25% and increase EU/t to 400%") - .addPollutionAmount(getPollutionPerSecond(null)) - .addSeparator() - .beginStructureBlock(3, 5, 3, true) - .addController("Bottom Center") - .addCasingInfoMin(mCasingName, 5, false) - .addInputBus("Any Casing", 1) - .addOutputBus("Any Casing", 1) - .addInputHatch("Any Casing", 1) - .addOutputHatch("Any Casing", 1) - .addEnergyHatch("Any Casing", 1) - .addMaintenanceHatch("Any Casing", 1) - .addMufflerHatch("Any Casing", 1) - .toolTipFinisher(CORE.GT_Tooltip_Builder.get()); - return tt; - } - - @Override - public IStructureDefinition<GregtechMetaTileEntity_IndustrialDehydrator> getStructureDefinition() { - if (STRUCTURE_DEFINITION == null) { - STRUCTURE_DEFINITION = StructureDefinition.<GregtechMetaTileEntity_IndustrialDehydrator>builder() - .addShape( - mName, - transpose( - new String[][] { { "CCC", "CCC", "CCC" }, { "HHH", "H-H", "HHH" }, { "HHH", "H-H", "HHH" }, - { "HHH", "H-H", "HHH" }, { "C~C", "CCC", "CCC" }, })) - .addElement( - 'C', - buildHatchAdder(GregtechMetaTileEntity_IndustrialDehydrator.class) - .atLeast(InputBus, OutputBus, Maintenance, Energy, Muffler, InputHatch, OutputHatch) - .casingIndex(CASING_TEXTURE_ID) - .dot(1) - .buildAndChain(onElementPass(x -> ++x.mCasing, ofBlock(ModBlocks.blockCasings4Misc, 10)))) - .addElement( - 'H', - ofCoil( - GregtechMetaTileEntity_IndustrialDehydrator::setCoilLevel, - GregtechMetaTileEntity_IndustrialDehydrator::getCoilLevel)) - .build(); - } - return STRUCTURE_DEFINITION; - } - - @Override - public void construct(ItemStack stackSize, boolean hintsOnly) { - buildPiece(mName, stackSize, hintsOnly, 1, 4, 0); - } - - @Override - public int survivalConstruct(ItemStack stackSize, int elementBudget, ISurvivalBuildEnvironment env) { - if (mMachine) return -1; - return survivialBuildPiece(mName, stackSize, 1, 4, 0, elementBudget, env, false, true); - } - - @Override - public boolean checkMachine(IGregTechTileEntity aBaseMetaTileEntity, ItemStack aStack) { - mCasing = 0; - setCoilLevel(HeatingCoilLevel.None); - return checkPiece(mName, 1, 4, 0) && mCasing >= 5 && getCoilLevel() != HeatingCoilLevel.None && checkHatch(); - } - - @Override - protected IIconContainer getActiveOverlay() { - return TexturesGtBlock.Overlay_Machine_Controller_Advanced_Active; - } - - @Override - protected IIconContainer getInactiveOverlay() { - return TexturesGtBlock.Overlay_Machine_Controller_Advanced; - } - - @Override - protected int getCasingTextureId() { - return CASING_TEXTURE_ID; - } - - @Override - public RecipeMap<?> getRecipeMap() { - return mDehydratorMode ? GTPPRecipeMaps.chemicalDehydratorNonCellRecipes : GTPPRecipeMaps.vacuumFurnaceRecipes; - } - - @Nonnull - @Override - public Collection<RecipeMap<?>> getAvailableRecipeMaps() { - return Arrays.asList(GTPPRecipeMaps.chemicalDehydratorNonCellRecipes, GTPPRecipeMaps.vacuumFurnaceRecipes); - } - - @Override - public boolean isCorrectMachinePart(ItemStack aStack) { - return true; - } - - @Override - public int getMaxEfficiency(ItemStack aStack) { - return 10000; - } - - @Override - public int getPollutionPerSecond(ItemStack aStack) { - return CORE.ConfigSwitches.pollutionPerSecondMultiIndustrialDehydrator; - } - - @Override - public String getMachineType() { - return "Vacuum Furnace / Dehydrator"; - } - - @Override - public int getMaxParallelRecipes() { - return 4; - } - - @Override - protected ProcessingLogic createProcessingLogic() { - return new ProcessingLogic() { - - @NotNull - @Override - protected CheckRecipeResult validateRecipe(@NotNull GT_Recipe recipe) { - return recipe.mSpecialValue <= getCoilLevel().getHeat() ? CheckRecipeResultRegistry.SUCCESSFUL - : CheckRecipeResultRegistry.insufficientHeat(recipe.mSpecialValue); - } - - @NotNull - @Override - protected GT_OverclockCalculator createOverclockCalculator(@NotNull GT_Recipe recipe) { - return super.createOverclockCalculator(recipe).setHeatOC(true) - .setHeatDiscount(true) - .setRecipeHeat(recipe.mSpecialValue) - .setMachineHeat((int) getCoilLevel().getHeat()); - } - }.setSpeedBonus(1F / 2.2F) - .setEuModifier(0.5F) - .setMaxParallelSupplier(this::getMaxParallelRecipes); - } - - @Override - public void onModeChangeByScrewdriver(ForgeDirection side, EntityPlayer aPlayer, float aX, float aY, float aZ) { - mDehydratorMode = !mDehydratorMode; - String aMode = mDehydratorMode ? "Dehydrator" : "Vacuum Furnace"; - PlayerUtils.messagePlayer(aPlayer, "Mode: " + aMode); - mLastRecipe = null; - } - - @Override - public void saveNBTData(NBTTagCompound aNBT) { - super.saveNBTData(aNBT); - aNBT.setBoolean("mDehydratorMode", mDehydratorMode); - } - - @Override - public void loadNBTData(NBTTagCompound aNBT) { - super.loadNBTData(aNBT); - mDehydratorMode = aNBT.getBoolean("mDehydratorMode"); - } - - public HeatingCoilLevel getCoilLevel() { - return mHeatingCapacity; - } - - public void setCoilLevel(HeatingCoilLevel aCoilLevel) { - mHeatingCapacity = aCoilLevel; - } -} diff --git a/gtpp/src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/processing/GregtechMetaTileEntity_IndustrialElectrolyzer.java b/gtpp/src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/processing/GregtechMetaTileEntity_IndustrialElectrolyzer.java deleted file mode 100644 index f12007b952..0000000000 --- a/gtpp/src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/processing/GregtechMetaTileEntity_IndustrialElectrolyzer.java +++ /dev/null @@ -1,169 +0,0 @@ -package gtPlusPlus.xmod.gregtech.common.tileentities.machines.multi.processing; - -import static com.gtnewhorizon.structurelib.structure.StructureUtility.ofBlock; -import static com.gtnewhorizon.structurelib.structure.StructureUtility.onElementPass; -import static com.gtnewhorizon.structurelib.structure.StructureUtility.transpose; -import static gregtech.api.enums.GT_HatchElement.Energy; -import static gregtech.api.enums.GT_HatchElement.InputBus; -import static gregtech.api.enums.GT_HatchElement.InputHatch; -import static gregtech.api.enums.GT_HatchElement.Maintenance; -import static gregtech.api.enums.GT_HatchElement.Muffler; -import static gregtech.api.enums.GT_HatchElement.OutputBus; -import static gregtech.api.enums.GT_HatchElement.OutputHatch; -import static gregtech.api.util.GT_StructureUtility.buildHatchAdder; - -import net.minecraft.item.ItemStack; - -import com.gtnewhorizon.structurelib.alignment.constructable.ISurvivalConstructable; -import com.gtnewhorizon.structurelib.structure.IStructureDefinition; -import com.gtnewhorizon.structurelib.structure.ISurvivalBuildEnvironment; -import com.gtnewhorizon.structurelib.structure.StructureDefinition; - -import gregtech.api.enums.TAE; -import gregtech.api.interfaces.IIconContainer; -import gregtech.api.interfaces.metatileentity.IMetaTileEntity; -import gregtech.api.interfaces.tileentity.IGregTechTileEntity; -import gregtech.api.logic.ProcessingLogic; -import gregtech.api.recipe.RecipeMap; -import gregtech.api.util.GT_Multiblock_Tooltip_Builder; -import gregtech.api.util.GT_Utility; -import gtPlusPlus.api.recipe.GTPPRecipeMaps; -import gtPlusPlus.core.block.ModBlocks; -import gtPlusPlus.core.lib.CORE; -import gtPlusPlus.xmod.gregtech.api.metatileentity.implementations.base.GregtechMeta_MultiBlockBase; -import gtPlusPlus.xmod.gregtech.common.blocks.textures.TexturesGtBlock; - -public class GregtechMetaTileEntity_IndustrialElectrolyzer extends - GregtechMeta_MultiBlockBase<GregtechMetaTileEntity_IndustrialElectrolyzer> implements ISurvivalConstructable { - - private int mCasing; - private static IStructureDefinition<GregtechMetaTileEntity_IndustrialElectrolyzer> STRUCTURE_DEFINITION = null; - - public GregtechMetaTileEntity_IndustrialElectrolyzer(final int aID, final String aName, - final String aNameRegional) { - super(aID, aName, aNameRegional); - } - - public GregtechMetaTileEntity_IndustrialElectrolyzer(final String aName) { - super(aName); - } - - @Override - public IMetaTileEntity newMetaEntity(final IGregTechTileEntity aTileEntity) { - return new GregtechMetaTileEntity_IndustrialElectrolyzer(this.mName); - } - - @Override - public String getMachineType() { - return "Electrolyzer"; - } - - @Override - protected GT_Multiblock_Tooltip_Builder createTooltip() { - GT_Multiblock_Tooltip_Builder tt = new GT_Multiblock_Tooltip_Builder(); - tt.addMachineType(getMachineType()) - .addInfo("Controller Block for the Industrial Electrolyzer") - .addInfo("180% faster than using single block machines of the same voltage") - .addInfo("Only uses 90% of the EU/t normally required") - .addInfo("Processes two items per voltage tier") - .addPollutionAmount(getPollutionPerSecond(null)) - .addSeparator() - .beginStructureBlock(3, 3, 3, true) - .addController("Front Center") - .addCasingInfoMin("Electrolyzer Casings", 6, false) - .addInputBus("Any Casing", 1) - .addOutputBus("Any Casing", 1) - .addInputHatch("Any Casing", 1) - .addOutputHatch("Any Casing", 1) - .addEnergyHatch("Any Casing", 1) - .addMaintenanceHatch("Any Casing", 1) - .addMufflerHatch("Any Casing", 1) - .toolTipFinisher(CORE.GT_Tooltip_Builder.get()); - return tt; - } - - @Override - public IStructureDefinition<GregtechMetaTileEntity_IndustrialElectrolyzer> getStructureDefinition() { - if (STRUCTURE_DEFINITION == null) { - STRUCTURE_DEFINITION = StructureDefinition.<GregtechMetaTileEntity_IndustrialElectrolyzer>builder() - .addShape( - mName, - transpose( - new String[][] { { "CCC", "CCC", "CCC" }, { "C~C", "C-C", "CCC" }, { "CCC", "CCC", "CCC" }, })) - .addElement( - 'C', - buildHatchAdder(GregtechMetaTileEntity_IndustrialElectrolyzer.class) - .atLeast(InputBus, OutputBus, Maintenance, Energy, Muffler, InputHatch, OutputHatch) - .casingIndex(TAE.GTPP_INDEX(5)) - .dot(1) - .buildAndChain(onElementPass(x -> ++x.mCasing, ofBlock(ModBlocks.blockCasingsMisc, 5)))) - .build(); - } - return STRUCTURE_DEFINITION; - } - - @Override - public void construct(ItemStack stackSize, boolean hintsOnly) { - buildPiece(mName, stackSize, hintsOnly, 1, 1, 0); - } - - @Override - public int survivalConstruct(ItemStack stackSize, int elementBudget, ISurvivalBuildEnvironment env) { - if (mMachine) return -1; - return survivialBuildPiece(mName, stackSize, 1, 1, 0, elementBudget, env, false, true); - } - - @Override - public boolean checkMachine(IGregTechTileEntity aBaseMetaTileEntity, ItemStack aStack) { - mCasing = 0; - return checkPiece(mName, 1, 1, 0) && mCasing >= 6 && checkHatch(); - } - - @Override - protected IIconContainer getActiveOverlay() { - return TexturesGtBlock.Overlay_Machine_Controller_Default_Active; - } - - @Override - protected IIconContainer getInactiveOverlay() { - return TexturesGtBlock.Overlay_Machine_Controller_Default; - } - - @Override - protected int getCasingTextureId() { - return TAE.GTPP_INDEX(5); - } - - @Override - public RecipeMap<?> getRecipeMap() { - return GTPPRecipeMaps.electrolyzerNonCellRecipes; - } - - @Override - protected ProcessingLogic createProcessingLogic() { - return new ProcessingLogic().setSpeedBonus(1F / 2.8F) - .setEuModifier(0.9F) - .setMaxParallelSupplier(this::getMaxParallelRecipes); - } - - @Override - public int getMaxEfficiency(final ItemStack aStack) { - return 10000; - } - - @Override - public int getPollutionPerSecond(final ItemStack aStack) { - return CORE.ConfigSwitches.pollutionPerSecondMultiIndustrialElectrolyzer; - } - - @Override - public boolean explodesOnComponentBreak(final ItemStack aStack) { - return false; - } - - @Override - public int getMaxParallelRecipes() { - return 2 * GT_Utility.getTier(this.getMaxInputVoltage()); - } - -} diff --git a/gtpp/src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/processing/GregtechMetaTileEntity_IndustrialExtruder.java b/gtpp/src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/processing/GregtechMetaTileEntity_IndustrialExtruder.java deleted file mode 100644 index ea61048f33..0000000000 --- a/gtpp/src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/processing/GregtechMetaTileEntity_IndustrialExtruder.java +++ /dev/null @@ -1,194 +0,0 @@ -package gtPlusPlus.xmod.gregtech.common.tileentities.machines.multi.processing; - -import static com.gtnewhorizon.structurelib.structure.StructureUtility.ofBlock; -import static com.gtnewhorizon.structurelib.structure.StructureUtility.onElementPass; -import static com.gtnewhorizon.structurelib.structure.StructureUtility.transpose; -import static gregtech.api.enums.GT_HatchElement.Energy; -import static gregtech.api.enums.GT_HatchElement.InputBus; -import static gregtech.api.enums.GT_HatchElement.Maintenance; -import static gregtech.api.enums.GT_HatchElement.Muffler; -import static gregtech.api.enums.GT_HatchElement.OutputBus; -import static gregtech.api.util.GT_StructureUtility.buildHatchAdder; - -import net.minecraft.block.Block; -import net.minecraft.item.ItemStack; - -import com.gtnewhorizon.structurelib.alignment.constructable.ISurvivalConstructable; -import com.gtnewhorizon.structurelib.structure.IStructureDefinition; -import com.gtnewhorizon.structurelib.structure.ISurvivalBuildEnvironment; -import com.gtnewhorizon.structurelib.structure.StructureDefinition; - -import gregtech.api.enums.SoundResource; -import gregtech.api.enums.TAE; -import gregtech.api.interfaces.IIconContainer; -import gregtech.api.interfaces.metatileentity.IMetaTileEntity; -import gregtech.api.interfaces.tileentity.IGregTechTileEntity; -import gregtech.api.logic.ProcessingLogic; -import gregtech.api.recipe.RecipeMap; -import gregtech.api.recipe.RecipeMaps; -import gregtech.api.util.GT_Multiblock_Tooltip_Builder; -import gregtech.api.util.GT_Utility; -import gtPlusPlus.core.block.ModBlocks; -import gtPlusPlus.core.lib.CORE; -import gtPlusPlus.xmod.gregtech.api.metatileentity.implementations.base.GregtechMeta_MultiBlockBase; -import gtPlusPlus.xmod.gregtech.common.blocks.textures.TexturesGtBlock; - -public class GregtechMetaTileEntity_IndustrialExtruder - extends GregtechMeta_MultiBlockBase<GregtechMetaTileEntity_IndustrialExtruder> implements ISurvivalConstructable { - - private int mCasing; - private static IStructureDefinition<GregtechMetaTileEntity_IndustrialExtruder> STRUCTURE_DEFINITION = null; - - public GregtechMetaTileEntity_IndustrialExtruder(final int aID, final String aName, final String aNameRegional) { - super(aID, aName, aNameRegional); - } - - public GregtechMetaTileEntity_IndustrialExtruder(final String aName) { - super(aName); - } - - @Override - public IMetaTileEntity newMetaEntity(final IGregTechTileEntity aTileEntity) { - return new GregtechMetaTileEntity_IndustrialExtruder(this.mName); - } - - @Override - public String getMachineType() { - return "Extruder"; - } - - @Override - protected GT_Multiblock_Tooltip_Builder createTooltip() { - GT_Multiblock_Tooltip_Builder tt = new GT_Multiblock_Tooltip_Builder(); - tt.addMachineType(getMachineType()) - .addInfo("Controller Block for the Material Extruder") - .addInfo("250% faster than using single block machines of the same voltage") - .addInfo("Processes four items per voltage tier") - .addInfo("Extrusion Shape for recipe goes in the Input Bus") - .addInfo("Each Input Bus can have a different shape!") - .addInfo("You can use several input buses per multiblock") - .addPollutionAmount(getPollutionPerSecond(null)) - .addSeparator() - .beginStructureBlock(3, 3, 5, true) - .addController("Front Center") - .addCasingInfoMin("Inconel Reinforced Casings", 14, false) - .addInputBus("Any Casing", 1) - .addOutputBus("Any Casing", 1) - .addEnergyHatch("Any Casing", 1) - .addMaintenanceHatch("Any Casing", 1) - .addMufflerHatch("Any Casing", 1) - .toolTipFinisher(CORE.GT_Tooltip_Builder.get()); - return tt; - } - - @Override - public IStructureDefinition<GregtechMetaTileEntity_IndustrialExtruder> getStructureDefinition() { - if (STRUCTURE_DEFINITION == null) { - STRUCTURE_DEFINITION = StructureDefinition.<GregtechMetaTileEntity_IndustrialExtruder>builder() - .addShape( - mName, - transpose( - new String[][] { { "CCC", "CCC", "CCC", "CCC", "CCC" }, { "C~C", "C-C", "C-C", "C-C", "CCC" }, - { "CCC", "CCC", "CCC", "CCC", "CCC" }, })) - .addElement( - 'C', - buildHatchAdder(GregtechMetaTileEntity_IndustrialExtruder.class) - .atLeast(InputBus, OutputBus, Maintenance, Energy, Muffler) - .casingIndex(getCasingTextureIndex()) - .dot(1) - .buildAndChain(onElementPass(x -> ++x.mCasing, ofBlock(getCasingBlock(), getCasingMeta())))) - .build(); - } - return STRUCTURE_DEFINITION; - } - - @Override - public void construct(ItemStack stackSize, boolean hintsOnly) { - buildPiece(mName, stackSize, hintsOnly, 1, 1, 0); - } - - @Override - public int survivalConstruct(ItemStack stackSize, int elementBudget, ISurvivalBuildEnvironment env) { - if (mMachine) return -1; - return survivialBuildPiece(mName, stackSize, 1, 1, 0, elementBudget, env, false, true); - } - - @Override - public boolean checkMachine(IGregTechTileEntity aBaseMetaTileEntity, ItemStack aStack) { - mCasing = 0; - return checkPiece(mName, 1, 1, 0) && mCasing >= 14 && checkHatch(); - } - - @Override - protected SoundResource getProcessStartSound() { - return SoundResource.IC2_MACHINES_COMPRESSOR_OP; - } - - @Override - protected IIconContainer getActiveOverlay() { - return TexturesGtBlock.Overlay_Machine_Controller_Default_Active; - } - - @Override - protected IIconContainer getInactiveOverlay() { - return TexturesGtBlock.Overlay_Machine_Controller_Default; - } - - @Override - protected int getCasingTextureId() { - return TAE.GTPP_INDEX(33); - } - - @Override - public RecipeMap<?> getRecipeMap() { - return RecipeMaps.extruderRecipes; - } - - @Override - public int getRecipeCatalystPriority() { - return -1; - } - - @Override - protected ProcessingLogic createProcessingLogic() { - return new ProcessingLogic().setSpeedBonus(1F / 3.5F) - .setMaxParallelSupplier(this::getMaxParallelRecipes); - } - - @Override - public int getMaxParallelRecipes() { - return (4 * GT_Utility.getTier(this.getMaxInputVoltage())); - } - - @Override - public int getMaxEfficiency(final ItemStack aStack) { - return 10000; - } - - @Override - public int getPollutionPerSecond(final ItemStack aStack) { - return CORE.ConfigSwitches.pollutionPerSecondMultiIndustrialExtruder; - } - - @Override - public boolean explodesOnComponentBreak(final ItemStack aStack) { - return false; - } - - public Block getCasingBlock() { - return ModBlocks.blockCasings3Misc; - } - - public byte getCasingMeta() { - return 1; - } - - public byte getCasingTextureIndex() { - return (byte) TAE.GTPP_INDEX(33); - } - - @Override - public boolean isInputSeparationEnabled() { - return true; - } -} diff --git a/gtpp/src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/processing/GregtechMetaTileEntity_IndustrialFluidHeater.java b/gtpp/src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/processing/GregtechMetaTileEntity_IndustrialFluidHeater.java deleted file mode 100644 index a34532ee83..0000000000 --- a/gtpp/src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/processing/GregtechMetaTileEntity_IndustrialFluidHeater.java +++ /dev/null @@ -1,204 +0,0 @@ -package gtPlusPlus.xmod.gregtech.common.tileentities.machines.multi.processing; - -import static com.gtnewhorizon.structurelib.structure.StructureUtility.ofBlock; -import static com.gtnewhorizon.structurelib.structure.StructureUtility.onElementPass; -import static com.gtnewhorizon.structurelib.structure.StructureUtility.transpose; -import static gregtech.api.enums.GT_HatchElement.Energy; -import static gregtech.api.enums.GT_HatchElement.InputBus; -import static gregtech.api.enums.GT_HatchElement.InputHatch; -import static gregtech.api.enums.GT_HatchElement.Maintenance; -import static gregtech.api.enums.GT_HatchElement.Muffler; -import static gregtech.api.enums.GT_HatchElement.OutputBus; -import static gregtech.api.enums.GT_HatchElement.OutputHatch; -import static gregtech.api.util.GT_StructureUtility.buildHatchAdder; - -import net.minecraft.block.Block; -import net.minecraft.item.ItemStack; - -import com.gtnewhorizon.structurelib.alignment.constructable.ISurvivalConstructable; -import com.gtnewhorizon.structurelib.structure.IStructureDefinition; -import com.gtnewhorizon.structurelib.structure.ISurvivalBuildEnvironment; -import com.gtnewhorizon.structurelib.structure.StructureDefinition; - -import gregtech.api.enums.TAE; -import gregtech.api.interfaces.IIconContainer; -import gregtech.api.interfaces.metatileentity.IMetaTileEntity; -import gregtech.api.interfaces.tileentity.IGregTechTileEntity; -import gregtech.api.logic.ProcessingLogic; -import gregtech.api.recipe.RecipeMap; -import gregtech.api.recipe.RecipeMaps; -import gregtech.api.util.GT_Multiblock_Tooltip_Builder; -import gregtech.api.util.GT_Utility; -import gtPlusPlus.core.block.ModBlocks; -import gtPlusPlus.core.lib.CORE; -import gtPlusPlus.xmod.gregtech.api.metatileentity.implementations.base.GregtechMeta_MultiBlockBase; -import gtPlusPlus.xmod.gregtech.common.blocks.textures.TexturesGtBlock; - -public class GregtechMetaTileEntity_IndustrialFluidHeater extends - GregtechMeta_MultiBlockBase<GregtechMetaTileEntity_IndustrialFluidHeater> implements ISurvivalConstructable { - - private int mCasing1; - private static IStructureDefinition<GregtechMetaTileEntity_IndustrialFluidHeater> STRUCTURE_DEFINITION = null; - - public GregtechMetaTileEntity_IndustrialFluidHeater(final int aID, final String aName, final String aNameRegional) { - super(aID, aName, aNameRegional); - } - - public GregtechMetaTileEntity_IndustrialFluidHeater(final String aName) { - super(aName); - } - - @Override - public IMetaTileEntity newMetaEntity(final IGregTechTileEntity aTileEntity) { - return new GregtechMetaTileEntity_IndustrialFluidHeater(this.mName); - } - - @Override - public String getMachineType() { - return "Fluid Heater"; - } - - @Override - protected GT_Multiblock_Tooltip_Builder createTooltip() { - GT_Multiblock_Tooltip_Builder tt = new GT_Multiblock_Tooltip_Builder(); - tt.addMachineType(getMachineType()) - .addInfo("Controller Block for the Industrial Fluid Heater") - .addInfo("120% faster than using single block machines of the same voltage") - .addInfo("Only uses 90% of the EU/t normally required") - .addInfo("Processes eight items per voltage tier") - .addPollutionAmount(getPollutionPerSecond(null)) - .addSeparator() - .beginStructureBlock(5, 6, 5, true) - .addController("Front Center") - .addCasingInfoMin("Top/Bottom layer: Multi-use Casings", 34, false) - .addCasingInfoMin("Middle layers: Thermal Containment Casing", 47, false) - .addInputBus("Bottom Layer (optional)", 1) - .addInputHatch("Bottom Layer", 1) - .addOutputBus("Top Layer (optional)", 1) - .addOutputHatch("Top Layer", 1) - .addEnergyHatch("Any Multi-use Casing", 1) - .addMaintenanceHatch("Any Multi-use Casing", 1) - .addMufflerHatch("Any Multi-use Casing", 1) - .toolTipFinisher(CORE.GT_Tooltip_Builder.get()); - return tt; - } - - @Override - public IStructureDefinition<GregtechMetaTileEntity_IndustrialFluidHeater> getStructureDefinition() { - if (STRUCTURE_DEFINITION == null) { - STRUCTURE_DEFINITION = StructureDefinition.<GregtechMetaTileEntity_IndustrialFluidHeater>builder() - .addShape( - mName, - transpose( - new String[][] { { " TTT ", "TTTTT", "TTTTT", "TTTTT", " TTT " }, - { " XXX ", "X---X", "X---X", "X---X", " XXX " }, - { " XXX ", "X---X", "X---X", "X---X", " XXX " }, - { " XXX ", "X---X", "X---X", "X---X", " XXX " }, - { " X~X ", "X---X", "X---X", "X---X", " XXX " }, - { " BBB ", "BBBBB", "BBBBB", "BBBBB", " BBB " }, })) - .addElement( - 'B', - buildHatchAdder(GregtechMetaTileEntity_IndustrialFluidHeater.class) - .atLeast(InputBus, InputHatch, Maintenance, Energy, Muffler) - .casingIndex(getCasingTextureIndex()) - .dot(1) - .buildAndChain(onElementPass(x -> ++x.mCasing1, ofBlock(getCasingBlock2(), getCasingMeta2())))) - .addElement('X', ofBlock(getCasingBlock1(), getCasingMeta1())) - .addElement( - 'T', - buildHatchAdder(GregtechMetaTileEntity_IndustrialFluidHeater.class) - .atLeast(OutputBus, OutputHatch, Maintenance, Energy, Muffler) - .casingIndex(getCasingTextureIndex()) - .dot(1) - .buildAndChain(onElementPass(x -> ++x.mCasing1, ofBlock(getCasingBlock2(), getCasingMeta2())))) - .build(); - } - return STRUCTURE_DEFINITION; - } - - @Override - public void construct(ItemStack stackSize, boolean hintsOnly) { - buildPiece(mName, stackSize, hintsOnly, 2, 4, 0); - } - - @Override - public int survivalConstruct(ItemStack stackSize, int elementBudget, ISurvivalBuildEnvironment env) { - if (mMachine) return -1; - return survivialBuildPiece(mName, stackSize, 2, 4, 0, elementBudget, env, false, true); - } - - @Override - public boolean checkMachine(IGregTechTileEntity aBaseMetaTileEntity, ItemStack aStack) { - mCasing1 = 0; - boolean didBuild = checkPiece(mName, 2, 4, 0); - log("Built? " + didBuild + ", " + mCasing1); - return didBuild && mCasing1 >= 34 && checkHatch(); - } - - @Override - protected IIconContainer getActiveOverlay() { - return TexturesGtBlock.Overlay_Machine_Controller_Advanced_Active; - } - - @Override - protected IIconContainer getInactiveOverlay() { - return TexturesGtBlock.Overlay_Machine_Controller_Advanced; - } - - @Override - protected int getCasingTextureId() { - return TAE.getIndexFromPage(0, 1); - } - - @Override - public RecipeMap<?> getRecipeMap() { - return RecipeMaps.fluidHeaterRecipes; - } - - @Override - protected ProcessingLogic createProcessingLogic() { - return new ProcessingLogic().setSpeedBonus(1F / 2.2F) - .setEuModifier(0.9F) - .setMaxParallelSupplier(this::getMaxParallelRecipes); - } - - @Override - public int getMaxParallelRecipes() { - return (8 * GT_Utility.getTier(this.getMaxInputVoltage())); - } - - @Override - public int getMaxEfficiency(final ItemStack aStack) { - return 10000; - } - - @Override - public int getPollutionPerSecond(final ItemStack aStack) { - return CORE.ConfigSwitches.pollutionPerSecondMultiIndustrialThermalCentrifuge; - } - - @Override - public boolean explodesOnComponentBreak(final ItemStack aStack) { - return false; - } - - public Block getCasingBlock1() { - return ModBlocks.blockCasings2Misc; - } - - public byte getCasingMeta1() { - return 11; - } - - public Block getCasingBlock2() { - return ModBlocks.blockCasings3Misc; - } - - public byte getCasingMeta2() { - return 2; - } - - public byte getCasingTextureIndex() { - return (byte) TAE.getIndexFromPage(2, 2); - } -} diff --git a/gtpp/src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/processing/GregtechMetaTileEntity_IndustrialForgeHammer.java b/gtpp/src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/processing/GregtechMetaTileEntity_IndustrialForgeHammer.java deleted file mode 100644 index 8e2f040d75..0000000000 --- a/gtpp/src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/processing/GregtechMetaTileEntity_IndustrialForgeHammer.java +++ /dev/null @@ -1,244 +0,0 @@ -package gtPlusPlus.xmod.gregtech.common.tileentities.machines.multi.processing; - -import static com.gtnewhorizon.structurelib.structure.StructureUtility.ofBlock; -import static com.gtnewhorizon.structurelib.structure.StructureUtility.ofBlocksTiered; -import static com.gtnewhorizon.structurelib.structure.StructureUtility.onElementPass; -import static com.gtnewhorizon.structurelib.structure.StructureUtility.transpose; -import static gregtech.api.enums.GT_HatchElement.Energy; -import static gregtech.api.enums.GT_HatchElement.InputBus; -import static gregtech.api.enums.GT_HatchElement.InputHatch; -import static gregtech.api.enums.GT_HatchElement.Maintenance; -import static gregtech.api.enums.GT_HatchElement.Muffler; -import static gregtech.api.enums.GT_HatchElement.OutputBus; -import static gregtech.api.enums.GT_HatchElement.OutputHatch; -import static gregtech.api.enums.Mods.EnderIO; -import static gregtech.api.enums.Mods.Railcraft; -import static gregtech.api.enums.Mods.ThaumicBases; -import static gregtech.api.util.GT_StructureUtility.buildHatchAdder; - -import java.util.HashMap; -import java.util.List; -import java.util.Map; -import java.util.stream.Collectors; - -import net.minecraft.block.Block; -import net.minecraft.init.Blocks; -import net.minecraft.item.ItemStack; - -import org.apache.commons.lang3.tuple.Pair; - -import com.gtnewhorizon.structurelib.alignment.constructable.ISurvivalConstructable; -import com.gtnewhorizon.structurelib.structure.IStructureDefinition; -import com.gtnewhorizon.structurelib.structure.ISurvivalBuildEnvironment; -import com.gtnewhorizon.structurelib.structure.ITierConverter; -import com.gtnewhorizon.structurelib.structure.StructureDefinition; - -import cpw.mods.fml.common.registry.GameRegistry; -import gregtech.api.enums.SoundResource; -import gregtech.api.enums.TAE; -import gregtech.api.interfaces.IIconContainer; -import gregtech.api.interfaces.metatileentity.IMetaTileEntity; -import gregtech.api.interfaces.tileentity.IGregTechTileEntity; -import gregtech.api.logic.ProcessingLogic; -import gregtech.api.recipe.RecipeMap; -import gregtech.api.recipe.RecipeMaps; -import gregtech.api.util.GT_Multiblock_Tooltip_Builder; -import gregtech.api.util.GT_Utility; -import gtPlusPlus.core.block.ModBlocks; -import gtPlusPlus.core.lib.CORE; -import gtPlusPlus.xmod.gregtech.api.metatileentity.implementations.base.GregtechMeta_MultiBlockBase; -import gtPlusPlus.xmod.gregtech.common.blocks.textures.TexturesGtBlock; - -@SuppressWarnings("SpellCheckingInspection") -public class GregtechMetaTileEntity_IndustrialForgeHammer extends - GregtechMeta_MultiBlockBase<GregtechMetaTileEntity_IndustrialForgeHammer> implements ISurvivalConstructable { - - private int mCasing; - private int mAnvilTier = 0; - private static IStructureDefinition<GregtechMetaTileEntity_IndustrialForgeHammer> STRUCTURE_DEFINITION = null; - - public GregtechMetaTileEntity_IndustrialForgeHammer(final int aID, final String aName, final String aNameRegional) { - super(aID, aName, aNameRegional); - } - - public GregtechMetaTileEntity_IndustrialForgeHammer(final String aName) { - super(aName); - } - - @Override - public IMetaTileEntity newMetaEntity(final IGregTechTileEntity aTileEntity) { - return new GregtechMetaTileEntity_IndustrialForgeHammer(this.mName); - } - - @Override - public String getMachineType() { - return "Forge Hammer"; - } - - @Override - protected GT_Multiblock_Tooltip_Builder createTooltip() { - GT_Multiblock_Tooltip_Builder tt = new GT_Multiblock_Tooltip_Builder(); - tt.addMachineType(getMachineType()) - .addInfo("Controller Block for the Industrial Forge Hammer") - .addInfo("Speed: +100% | EU Usage: 100% | Parallel: Tier x Anvil Tier x 8") - .addInfo("T1 - Vanilla Anvil"); - if (Railcraft.isModLoaded()) { - tt.addInfo("T2 - Steel Anvil"); - } - if (EnderIO.isModLoaded()) { - tt.addInfo("T3 - Dark Steel Anvil"); - } - if (ThaumicBases.isModLoaded()) { - tt.addInfo("T3 - Thaumium Anvil"); - tt.addInfo("T4 - Void Metal Anvil"); - } - - tt.addPollutionAmount(getPollutionPerSecond(null)) - .addSeparator() - .beginStructureBlock(3, 3, 3, true) - .addController("Front Center") - .addCasingInfoMin("Forge Casing", 6, false) - .addInputBus("Any Casing", 1) - .addOutputBus("Any Casing", 1) - .addInputHatch("Any Casing", 1) - .addOutputHatch("Any Casing", 1) - .addEnergyHatch("Any Casing", 1) - .addMaintenanceHatch("Any Casing", 1) - .addMufflerHatch("Any Casing", 1) - .addOtherStructurePart("Anvil", "In the center of 3x3x3 structure", 2) - .toolTipFinisher(CORE.GT_Tooltip_Builder.get()); - return tt; - } - - @Override - public IStructureDefinition<GregtechMetaTileEntity_IndustrialForgeHammer> getStructureDefinition() { - if (STRUCTURE_DEFINITION == null) { - Map<Block, Integer> anvilTiers = new HashMap<>(); - - anvilTiers.put(Blocks.anvil, 1); - - if (Railcraft.isModLoaded()) { - anvilTiers.put(GameRegistry.findBlock(Railcraft.ID, "anvil"), 2); - } - - if (EnderIO.isModLoaded()) { - anvilTiers.put(GameRegistry.findBlock(EnderIO.ID, "blockDarkSteelAnvil"), 3); - } - - if (ThaumicBases.isModLoaded()) { - anvilTiers.put(GameRegistry.findBlock(ThaumicBases.ID, "thaumicAnvil"), 3); - anvilTiers.put(GameRegistry.findBlock(ThaumicBases.ID, "voidAnvil"), 4); - } - - STRUCTURE_DEFINITION = StructureDefinition.<GregtechMetaTileEntity_IndustrialForgeHammer>builder() - .addShape( - mName, - transpose( - new String[][] { { "CCC", "CCC", "CCC" }, { "C~C", "CAC", "CCC" }, { "CCC", "CCC", "CCC" }, })) - .addElement( - 'C', - buildHatchAdder(GregtechMetaTileEntity_IndustrialForgeHammer.class) - .atLeast(InputBus, OutputBus, Maintenance, Energy, Muffler, InputHatch, OutputHatch) - .casingIndex(TAE.getIndexFromPage(1, 11)) - .dot(1) - .buildAndChain(onElementPass(x -> ++x.mCasing, ofBlock(ModBlocks.blockCasings5Misc, 6)))) - .addElement( - 'A', - ofBlocksTiered( - anvilTierConverter(anvilTiers), - getAllAnvilTiers(anvilTiers), - 0, - GregtechMetaTileEntity_IndustrialForgeHammer::setAnvilTier, - GregtechMetaTileEntity_IndustrialForgeHammer::getAnvilTier)) - .build(); - } - return STRUCTURE_DEFINITION; - } - - private static List<Pair<Block, Integer>> getAllAnvilTiers(Map<Block, Integer> anvilTiers) { - return anvilTiers.entrySet() - .stream() - .map(e -> Pair.of(e.getKey(), e.getValue())) - .collect(Collectors.toList()); - } - - private static ITierConverter<Integer> anvilTierConverter(Map<Block, Integer> anvilTiers) { - return (block, meta) -> block == null ? 0 : anvilTiers.getOrDefault(block, 0); - } - - @Override - public void construct(ItemStack stackSize, boolean hintsOnly) { - buildPiece(mName, stackSize, hintsOnly, 1, 1, 0); - } - - @Override - public int survivalConstruct(ItemStack stackSize, int elementBudget, ISurvivalBuildEnvironment env) { - if (mMachine) return -1; - return survivialBuildPiece(mName, stackSize, 1, 1, 0, elementBudget, env, false, true); - } - - @Override - public boolean checkMachine(IGregTechTileEntity aBaseMetaTileEntity, ItemStack aStack) { - mCasing = 0; - return checkPiece(mName, 1, 1, 0) && mCasing >= 6 && checkHatch(); - } - - @Override - protected SoundResource getProcessStartSound() { - return SoundResource.RANDOM_ANVIL_USE; - } - - @Override - protected IIconContainer getActiveOverlay() { - return TexturesGtBlock.Overlay_Machine_Controller_Advanced_Active; - } - - @Override - protected IIconContainer getInactiveOverlay() { - return TexturesGtBlock.Overlay_Machine_Controller_Advanced; - } - - @Override - protected int getCasingTextureId() { - return TAE.getIndexFromPage(1, 11); - } - - @Override - public RecipeMap<?> getRecipeMap() { - return RecipeMaps.hammerRecipes; - } - - @Override - protected ProcessingLogic createProcessingLogic() { - return new ProcessingLogic().setSpeedBonus(1 / 2F) - .setMaxParallelSupplier(this::getMaxParallelRecipes); - } - - @Override - public int getMaxParallelRecipes() { - return (8 * getAnvilTier() * GT_Utility.getTier(this.getMaxInputVoltage())); - } - - @Override - public int getMaxEfficiency(final ItemStack aStack) { - return 10000; - } - - @Override - public int getPollutionPerSecond(final ItemStack aStack) { - return CORE.ConfigSwitches.pollutionPerSecondMultiIndustrialForgeHammer; - } - - @Override - public boolean explodesOnComponentBreak(final ItemStack aStack) { - return false; - } - - private void setAnvilTier(int tier) { - mAnvilTier = tier; - } - - private int getAnvilTier() { - return mAnvilTier; - } -} diff --git a/gtpp/src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/processing/GregtechMetaTileEntity_IndustrialMacerator.java b/gtpp/src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/processing/GregtechMetaTileEntity_IndustrialMacerator.java deleted file mode 100644 index 5591b9fbe8..0000000000 --- a/gtpp/src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/processing/GregtechMetaTileEntity_IndustrialMacerator.java +++ /dev/null @@ -1,458 +0,0 @@ -package gtPlusPlus.xmod.gregtech.common.tileentities.machines.multi.processing; - -import static com.gtnewhorizon.structurelib.structure.StructureUtility.ofBlock; -import static com.gtnewhorizon.structurelib.structure.StructureUtility.ofChain; -import static com.gtnewhorizon.structurelib.structure.StructureUtility.onElementPass; -import static com.gtnewhorizon.structurelib.structure.StructureUtility.transpose; -import static gregtech.api.enums.GT_HatchElement.Energy; -import static gregtech.api.enums.GT_HatchElement.InputBus; -import static gregtech.api.enums.GT_HatchElement.Maintenance; -import static gregtech.api.enums.GT_HatchElement.Muffler; -import static gregtech.api.enums.GT_HatchElement.OutputBus; -import static gregtech.api.util.GT_StructureUtility.buildHatchAdder; - -import java.util.List; -import java.util.Random; - -import net.minecraft.entity.player.EntityPlayer; -import net.minecraft.entity.player.EntityPlayerMP; -import net.minecraft.item.ItemStack; -import net.minecraft.nbt.NBTTagCompound; -import net.minecraft.tileentity.TileEntity; -import net.minecraft.util.EnumChatFormatting; -import net.minecraft.util.StatCollector; -import net.minecraft.world.World; -import net.minecraftforge.common.util.Constants.NBT; -import net.minecraftforge.common.util.ForgeDirection; - -import com.gtnewhorizon.structurelib.alignment.constructable.ISurvivalConstructable; -import com.gtnewhorizon.structurelib.structure.IStructureDefinition; -import com.gtnewhorizon.structurelib.structure.ISurvivalBuildEnvironment; -import com.gtnewhorizon.structurelib.structure.StructureDefinition; - -import gregtech.api.GregTech_API; -import gregtech.api.enums.SoundResource; -import gregtech.api.enums.TAE; -import gregtech.api.interfaces.IIconContainer; -import gregtech.api.interfaces.metatileentity.IMetaTileEntity; -import gregtech.api.interfaces.tileentity.IGregTechTileEntity; -import gregtech.api.logic.ProcessingLogic; -import gregtech.api.recipe.RecipeMap; -import gregtech.api.recipe.RecipeMaps; -import gregtech.api.util.GT_Multiblock_Tooltip_Builder; -import gregtech.api.util.GT_Utility; -import gtPlusPlus.core.block.ModBlocks; -import gtPlusPlus.core.lib.CORE; -import gtPlusPlus.core.util.minecraft.ItemUtils; -import gtPlusPlus.xmod.gregtech.api.enums.GregtechItemList; -import gtPlusPlus.xmod.gregtech.api.metatileentity.implementations.base.GregtechMeta_MultiBlockBase; -import gtPlusPlus.xmod.gregtech.common.blocks.textures.TexturesGtBlock; -import mcp.mobius.waila.api.IWailaConfigHandler; -import mcp.mobius.waila.api.IWailaDataAccessor; - -public class GregtechMetaTileEntity_IndustrialMacerator - extends GregtechMeta_MultiBlockBase<GregtechMetaTileEntity_IndustrialMacerator> implements ISurvivalConstructable { - - private int controllerTier = 1; - private int mCasing; - private int mPerLayer; - private static IStructureDefinition<GregtechMetaTileEntity_IndustrialMacerator> STRUCTURE_DEFINITION = null; - - public GregtechMetaTileEntity_IndustrialMacerator(final int aID, final String aName, final String aNameRegional) { - super(aID, aName, aNameRegional); - } - - public GregtechMetaTileEntity_IndustrialMacerator(final String aName) { - super(aName); - } - - @Override - public IMetaTileEntity newMetaEntity(final IGregTechTileEntity aTileEntity) { - return new GregtechMetaTileEntity_IndustrialMacerator(this.mName); - } - - @Override - public String getMachineType() { - return "Macerator/Pulverizer"; - } - - @Override - protected GT_Multiblock_Tooltip_Builder createTooltip() { - GT_Multiblock_Tooltip_Builder tt = new GT_Multiblock_Tooltip_Builder(); - tt.addMachineType(getMachineType()) - .addInfo("Controller block for the Industrial Maceration Stack") - .addInfo("60% faster than using single block machines of the same voltage") - .addInfo("Maximum of n*tier parallels, LV = Tier 1, MV = Tier 2, etc.") - .addInfo("n=2 initially. n=8 after inserting Maceration Upgrade Chip.") - .addPollutionAmount(getPollutionPerSecond(null)) - .addSeparator() - .beginStructureBlock(3, 6, 3, true) - .addController("Bottom center") - .addCasingInfoMin("Maceration Stack Casings (After upgrade)", 26, false) - .addCasingInfoMin("Stable Titanium Casings (Before upgrade)", 26, false) - .addInputBus("Bottom casing", 1) - .addEnergyHatch("Any casing", 1) - .addMaintenanceHatch("Any casing", 1) - .addOutputBus("One per layer except bottom layer", 2) - .addMufflerHatch("Any casing except bottom layer", 2) - .toolTipFinisher(CORE.GT_Tooltip_Builder.get()); - return tt; - } - - @Override - public IStructureDefinition<GregtechMetaTileEntity_IndustrialMacerator> getStructureDefinition() { - if (STRUCTURE_DEFINITION == null) { - STRUCTURE_DEFINITION = StructureDefinition.<GregtechMetaTileEntity_IndustrialMacerator>builder() - .addShape(mName + "top1", transpose(new String[][] { { "ccc", "ccc", "ccc" }, })) - .addShape(mName + "mid1", transpose(new String[][] { { "ccc", "c-c", "ccc" }, })) - .addShape(mName + "bottom1", transpose(new String[][] { { "b~b", "bbb", "bbb" }, })) - .addShape(mName + "top2", transpose(new String[][] { { "CCC", "CCC", "CCC" }, })) - .addShape(mName + "mid2", transpose(new String[][] { { "CCC", "C-C", "CCC" }, })) - .addShape(mName + "bottom2", transpose(new String[][] { { "B~B", "BBB", "BBB" }, })) - .addElement( - 'C', - ofChain( - buildHatchAdder(GregtechMetaTileEntity_IndustrialMacerator.class).anyOf(OutputBus) - .shouldReject(t -> t.mPerLayer + 1 == t.mOutputBusses.size()) - .disallowOnly(ForgeDirection.UP, ForgeDirection.DOWN) - .casingIndex(TAE.GTPP_INDEX(7)) - .dot(2) - .build(), - buildHatchAdder(GregtechMetaTileEntity_IndustrialMacerator.class) - .atLeast(Energy, Maintenance, Muffler) - .disallowOnly(ForgeDirection.UP, ForgeDirection.DOWN) - .casingIndex(TAE.GTPP_INDEX(7)) - .dot(2) - .build(), - onElementPass(x -> ++x.mCasing, ofBlock(ModBlocks.blockCasingsMisc, 7)))) - .addElement( - 'B', - ofChain( - buildHatchAdder(GregtechMetaTileEntity_IndustrialMacerator.class) - .atLeast(Energy, Maintenance, InputBus) - .disallowOnly(ForgeDirection.UP) - .casingIndex(TAE.GTPP_INDEX(7)) - .dot(2) - .build(), - onElementPass(x -> ++x.mCasing, ofBlock(ModBlocks.blockCasingsMisc, 7)))) - .addElement( - 'c', - ofChain( - buildHatchAdder(GregtechMetaTileEntity_IndustrialMacerator.class).anyOf(OutputBus) - .shouldReject(t -> t.mPerLayer + 1 == t.mOutputBusses.size()) - .disallowOnly(ForgeDirection.UP, ForgeDirection.DOWN) - .casingIndex(GT_Utility.getCasingTextureIndex(GregTech_API.sBlockCasings4, 2)) - .dot(2) - .build(), - buildHatchAdder(GregtechMetaTileEntity_IndustrialMacerator.class) - .atLeast(Energy, Maintenance, Muffler) - .disallowOnly(ForgeDirection.UP, ForgeDirection.DOWN) - .casingIndex(GT_Utility.getCasingTextureIndex(GregTech_API.sBlockCasings4, 2)) - .dot(2) - .build(), - onElementPass(x -> ++x.mCasing, ofBlock(GregTech_API.sBlockCasings4, 2)))) - .addElement( - 'b', - ofChain( - buildHatchAdder(GregtechMetaTileEntity_IndustrialMacerator.class) - .atLeast(Energy, Maintenance, InputBus) - .disallowOnly(ForgeDirection.UP) - .casingIndex(GT_Utility.getCasingTextureIndex(GregTech_API.sBlockCasings4, 2)) - .dot(2) - .build(), - onElementPass(x -> ++x.mCasing, ofBlock(GregTech_API.sBlockCasings4, 2)))) - .build(); - } - return STRUCTURE_DEFINITION; - } - - @Override - public void construct(ItemStack stackSize, boolean hintsOnly) { - buildPiece(mName + "bottom" + controllerTier, stackSize, hintsOnly, 1, 0, 0); - buildPiece(mName + "mid" + controllerTier, stackSize, hintsOnly, 1, 1, 0); - buildPiece(mName + "mid" + controllerTier, stackSize, hintsOnly, 1, 2, 0); - buildPiece(mName + "mid" + controllerTier, stackSize, hintsOnly, 1, 3, 0); - buildPiece(mName + "mid" + controllerTier, stackSize, hintsOnly, 1, 4, 0); - buildPiece(mName + "top" + controllerTier, stackSize, hintsOnly, 1, 5, 0); - } - - @Override - public int survivalConstruct(ItemStack stackSize, int elementBudget, ISurvivalBuildEnvironment env) { - if (mMachine) return -1; - int built; - built = survivialBuildPiece( - mName + "bottom" + controllerTier, - stackSize, - 1, - 0, - 0, - elementBudget, - env, - false, - true); - mPerLayer = 0; - if (built >= 0) return built; - built = survivialBuildPiece( - mName + "mid" + controllerTier, - stackSize, - 1, - 1, - 0, - elementBudget, - env, - false, - true); - mPerLayer = 1; - if (built >= 0) return built; - built = survivialBuildPiece( - mName + "mid" + controllerTier, - stackSize, - 1, - 2, - 0, - elementBudget, - env, - false, - true); - if (built >= 0) return built; - mPerLayer = 2; - built = survivialBuildPiece( - mName + "mid" + controllerTier, - stackSize, - 1, - 3, - 0, - elementBudget, - env, - false, - true); - if (built >= 0) return built; - mPerLayer = 3; - built = survivialBuildPiece( - mName + "mid" + controllerTier, - stackSize, - 1, - 4, - 0, - elementBudget, - env, - false, - true); - if (built >= 0) return built; - mPerLayer = 4; - return survivialBuildPiece(mName + "top" + controllerTier, stackSize, 1, 5, 0, elementBudget, env, false, true); - } - - @Override - public boolean checkMachine(IGregTechTileEntity aBaseMetaTileEntity, ItemStack aStack) { - mCasing = 0; - mPerLayer = 0; - if (checkPiece(mName + "bottom" + controllerTier, 1, 0, 0)) { - while (mPerLayer < 4) { - if (!checkPiece(mName + "mid" + controllerTier, 1, mPerLayer + 1, 0) - || mPerLayer + 1 != mOutputBusses.size()) return false; - mPerLayer++; - } - return checkPiece(mName + "top" + controllerTier, 1, 5, 0) && mOutputBusses.size() == 5 - && mCasing >= 26 - && checkHatch(); - } - return false; - } - - @Override - protected SoundResource getProcessStartSound() { - return SoundResource.IC2_MACHINES_MACERATOR_OP; - } - - @Override - protected IIconContainer getActiveOverlay() { - return TexturesGtBlock.Overlay_MatterFab_Active; - } - - @Override - protected IIconContainer getInactiveOverlay() { - return TexturesGtBlock.Overlay_MatterFab; - } - - @Override - protected int getCasingTextureId() { - return switch (controllerTier) { - case 2 -> TAE.GTPP_INDEX(7); - default -> GT_Utility.getCasingTextureIndex(GregTech_API.sBlockCasings4, 2); - }; - } - - @Override - public RecipeMap<?> getRecipeMap() { - return RecipeMaps.maceratorRecipes; - } - - @Override - public int getRecipeCatalystPriority() { - return -10; - } - - @Override - public void onPreTick(final IGregTechTileEntity aBaseMetaTileEntity, final long aTick) { - super.onPreTick(aBaseMetaTileEntity, aTick); - if ((aBaseMetaTileEntity.isClientSide()) && (aBaseMetaTileEntity.isActive()) - && (aBaseMetaTileEntity.getFrontFacing() != ForgeDirection.UP) - && (aBaseMetaTileEntity.getCoverIDAtSide(ForgeDirection.UP) == 0) - && (!aBaseMetaTileEntity.getOpacityAtSide(ForgeDirection.UP))) { - final Random tRandom = aBaseMetaTileEntity.getWorld().rand; - aBaseMetaTileEntity.getWorld() - .spawnParticle( - "smoke", - (aBaseMetaTileEntity.getXCoord() + 0.8F) - (tRandom.nextFloat() * 0.6F), - aBaseMetaTileEntity.getYCoord() + 0.3f + (tRandom.nextFloat() * 0.2F), - (aBaseMetaTileEntity.getZCoord() + 1.2F) - (tRandom.nextFloat() * 1.6F), - 0.0D, - 0.0D, - 0.0D); - } - } - - @Override - public void onPostTick(IGregTechTileEntity aBaseMetaTileEntity, long aTick) { - super.onPostTick(aBaseMetaTileEntity, aTick); - if (aBaseMetaTileEntity.isServerSide() && aTick % 20 == 0 && controllerTier == 1) { - ItemStack aGuiStack = this.getControllerSlot(); - if (GregtechItemList.Maceration_Upgrade_Chip.isStackEqual(aGuiStack, false, true)) { - controllerTier = 2; - mInventory[1] = ItemUtils.depleteStack(aGuiStack); - markDirty(); - // schedule a structure check - mUpdated = true; - } - } - } - - @Override - public boolean onRightclick(IGregTechTileEntity aBaseMetaTileEntity, EntityPlayer aPlayer, ForgeDirection side, - float aX, float aY, float aZ) { - if (controllerTier == 1 && !aPlayer.isSneaking()) { - ItemStack heldItem = aPlayer.getHeldItem(); - if (GregtechItemList.Maceration_Upgrade_Chip.isStackEqual(heldItem, false, true)) { - controllerTier = 2; - aPlayer.setCurrentItemOrArmor(0, ItemUtils.depleteStack(heldItem)); - if (getBaseMetaTileEntity().isServerSide()) { - markDirty(); - aPlayer.inventory.markDirty(); - // schedule a structure check - mUpdated = true; - } - return true; - } - } - return super.onRightclick(aBaseMetaTileEntity, aPlayer, side, aX, aY, aZ); - } - - @Override - public void onValueUpdate(byte aValue) { - controllerTier = aValue; - } - - @Override - public byte getUpdateData() { - return (byte) controllerTier; - } - - @Override - public void saveNBTData(NBTTagCompound aNBT) { - super.saveNBTData(aNBT); - aNBT.setByte("mTier", (byte) controllerTier); - } - - @Override - public void loadNBTData(NBTTagCompound aNBT) { - super.loadNBTData(aNBT); - if (!aNBT.hasKey("mTier", NBT.TAG_BYTE)) - // we assume old macerators are all T2 variants, as they were made before price reduction and shouldn't need - // to worry about upgrading - controllerTier = 2; - else controllerTier = aNBT.getByte("mTier"); - } - - @Override - public void initDefaultModes(NBTTagCompound aNBT) { - super.initDefaultModes(aNBT); - if (aNBT == null || !aNBT.hasKey("mTier")) { - controllerTier = 1; - } else { - controllerTier = aNBT.getByte("mTier"); - } - } - - @Override - public void setItemNBT(NBTTagCompound aNBT) { - super.setItemNBT(aNBT); - aNBT.setByte("mTier", (byte) controllerTier); - } - - @Override - public void addAdditionalTooltipInformation(ItemStack stack, List<String> tooltip) { - super.addAdditionalTooltipInformation(stack, tooltip); - NBTTagCompound aNBT = stack.getTagCompound(); - int tier; - if (aNBT == null || !aNBT.hasKey("mTier")) { - tier = 1; - } else { - tier = aNBT.getInteger("mTier"); - } - tooltip.add(StatCollector.translateToLocalFormatted("tooltip.large_macerator.tier", tier)); - } - - @Override - protected ProcessingLogic createProcessingLogic() { - return new ProcessingLogic().setSpeedBonus(1F / 1.6F) - .setMaxParallelSupplier(this::getMaxParallelRecipes); - } - - @Override - public int getMaxParallelRecipes() { - final long tVoltage = getMaxInputVoltage(); - final byte tTier = (byte) Math.max(1, GT_Utility.getTier(tVoltage)); - return Math.max(1, (controllerTier == 1 ? 2 : 8) * tTier); - } - - @Override - public int getMaxEfficiency(final ItemStack aStack) { - return 10000; - } - - @Override - public int getPollutionPerSecond(final ItemStack aStack) { - return CORE.ConfigSwitches.pollutionPerSecondMultiIndustrialMacerator; - } - - @Override - public boolean explodesOnComponentBreak(final ItemStack aStack) { - return false; - } - - @Override - public boolean isOverclockerUpgradable() { - return true; - } - - @Override - public void getWailaNBTData(EntityPlayerMP player, TileEntity tile, NBTTagCompound tag, World world, int x, int y, - int z) { - super.getWailaNBTData(player, tile, tag, world, x, y, z); - tag.setInteger("tier", controllerTier); - } - - @Override - public void getWailaBody(ItemStack itemStack, List<String> currentTip, IWailaDataAccessor accessor, - IWailaConfigHandler config) { - super.getWailaBody(itemStack, currentTip, accessor, config); - final NBTTagCompound tag = accessor.getNBTData(); - if (tag.hasKey("tier")) { - currentTip.add( - "Tier: " + EnumChatFormatting.YELLOW - + GT_Utility.formatNumbers(tag.getInteger("tier")) - + EnumChatFormatting.RESET); - } - } -} diff --git a/gtpp/src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/processing/GregtechMetaTileEntity_IndustrialMixer.java b/gtpp/src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/processing/GregtechMetaTileEntity_IndustrialMixer.java deleted file mode 100644 index 3f4c4ccfa4..0000000000 --- a/gtpp/src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/processing/GregtechMetaTileEntity_IndustrialMixer.java +++ /dev/null @@ -1,213 +0,0 @@ -package gtPlusPlus.xmod.gregtech.common.tileentities.machines.multi.processing; - -import static com.gtnewhorizon.structurelib.structure.StructureUtility.ofBlock; -import static com.gtnewhorizon.structurelib.structure.StructureUtility.onElementPass; -import static com.gtnewhorizon.structurelib.structure.StructureUtility.transpose; -import static gregtech.api.enums.GT_HatchElement.Energy; -import static gregtech.api.enums.GT_HatchElement.InputBus; -import static gregtech.api.enums.GT_HatchElement.InputHatch; -import static gregtech.api.enums.GT_HatchElement.Maintenance; -import static gregtech.api.enums.GT_HatchElement.Muffler; -import static gregtech.api.enums.GT_HatchElement.OutputBus; -import static gregtech.api.enums.GT_HatchElement.OutputHatch; -import static gregtech.api.util.GT_StructureUtility.buildHatchAdder; - -import net.minecraft.entity.player.EntityPlayer; -import net.minecraft.item.ItemStack; -import net.minecraft.nbt.NBTTagCompound; -import net.minecraft.util.StatCollector; -import net.minecraftforge.common.util.ForgeDirection; - -import com.gtnewhorizon.structurelib.alignment.constructable.ISurvivalConstructable; -import com.gtnewhorizon.structurelib.structure.IStructureDefinition; -import com.gtnewhorizon.structurelib.structure.ISurvivalBuildEnvironment; -import com.gtnewhorizon.structurelib.structure.StructureDefinition; - -import gregtech.api.GregTech_API; -import gregtech.api.enums.SoundResource; -import gregtech.api.enums.TAE; -import gregtech.api.interfaces.IIconContainer; -import gregtech.api.interfaces.metatileentity.IMetaTileEntity; -import gregtech.api.interfaces.tileentity.IGregTechTileEntity; -import gregtech.api.logic.ProcessingLogic; -import gregtech.api.recipe.RecipeMap; -import gregtech.api.util.GT_Multiblock_Tooltip_Builder; -import gregtech.api.util.GT_Utility; -import gtPlusPlus.api.recipe.GTPPRecipeMaps; -import gtPlusPlus.core.block.ModBlocks; -import gtPlusPlus.core.lib.CORE; -import gtPlusPlus.xmod.gregtech.api.metatileentity.implementations.base.GregtechMeta_MultiBlockBase; -import gtPlusPlus.xmod.gregtech.common.blocks.textures.TexturesGtBlock; - -public class GregtechMetaTileEntity_IndustrialMixer - extends GregtechMeta_MultiBlockBase<GregtechMetaTileEntity_IndustrialMixer> implements ISurvivalConstructable { - - public static int CASING_TEXTURE_ID; - public static String mCasingName = "Multi-Use Casing"; - public static String mCasingName2 = "Titanium Turbine Casing"; - private int mCasing; - private static IStructureDefinition<GregtechMetaTileEntity_IndustrialMixer> STRUCTURE_DEFINITION = null; - - public GregtechMetaTileEntity_IndustrialMixer(final int aID, final String aName, final String aNameRegional) { - super(aID, aName, aNameRegional); - CASING_TEXTURE_ID = TAE.getIndexFromPage(2, 2); - inputSeparation = true; - } - - public GregtechMetaTileEntity_IndustrialMixer(final String aName) { - super(aName); - CASING_TEXTURE_ID = TAE.getIndexFromPage(2, 2); - inputSeparation = true; - } - - @Override - public void loadNBTData(final NBTTagCompound aNBT) { - super.loadNBTData(aNBT); - if (!aNBT.hasKey(INPUT_SEPARATION_NBT_KEY)) { - if (aNBT.hasKey("isBussesSeparate")) { - inputSeparation = aNBT.getBoolean("isBussesSeparate"); - } - // Fallback for existing mixers - else { - inputSeparation = true; - } - } - } - - @Override - public IMetaTileEntity newMetaEntity(final IGregTechTileEntity aTileEntity) { - return new GregtechMetaTileEntity_IndustrialMixer(this.mName); - } - - @Override - public String getMachineType() { - return "Mixer"; - } - - @Override - protected GT_Multiblock_Tooltip_Builder createTooltip() { - GT_Multiblock_Tooltip_Builder tt = new GT_Multiblock_Tooltip_Builder(); - tt.addMachineType(getMachineType()) - .addInfo("Controller Block for the Industrial Mixer") - .addInfo("250% faster than using single block machines of the same voltage") - .addInfo("Processes eight recipes per voltage tier") - .addPollutionAmount(getPollutionPerSecond(null)) - .addSeparator() - .beginStructureBlock(3, 4, 3, false) - .addController("Second Layer Center") - .addCasingInfoMin(mCasingName, 6, false) - .addCasingInfoMin(mCasingName2, 2, false) - .addInputBus("Any Casing", 1) - .addOutputBus("Any Casing", 1) - .addInputHatch("Any Casing", 1) - .addOutputHatch("Any Casing", 1) - .addEnergyHatch("Any Casing", 1) - .addMaintenanceHatch("Any Casing", 1) - .addMufflerHatch("Any Casing", 1) - .toolTipFinisher(CORE.GT_Tooltip_Builder.get()); - return tt; - } - - @Override - public IStructureDefinition<GregtechMetaTileEntity_IndustrialMixer> getStructureDefinition() { - if (STRUCTURE_DEFINITION == null) { - STRUCTURE_DEFINITION = StructureDefinition.<GregtechMetaTileEntity_IndustrialMixer>builder() - .addShape( - mName, - transpose( - new String[][] { { "CCC", "CCC", "CCC" }, { "CCC", "CMC", "CCC" }, { "C~C", "CMC", "CCC" }, - { "CCC", "CCC", "CCC" }, })) - .addElement( - 'C', - buildHatchAdder(GregtechMetaTileEntity_IndustrialMixer.class) - .atLeast(InputBus, OutputBus, Maintenance, Energy, Muffler, InputHatch, OutputHatch) - .casingIndex(CASING_TEXTURE_ID) - .dot(1) - .buildAndChain(onElementPass(x -> ++x.mCasing, ofBlock(ModBlocks.blockCasings3Misc, 2)))) - .addElement('M', ofBlock(GregTech_API.sBlockCasings4, 11)) - .build(); - } - return STRUCTURE_DEFINITION; - } - - @Override - public void construct(ItemStack stackSize, boolean hintsOnly) { - buildPiece(mName, stackSize, hintsOnly, 1, 2, 0); - } - - @Override - public int survivalConstruct(ItemStack stackSize, int elementBudget, ISurvivalBuildEnvironment env) { - if (mMachine) return -1; - return survivialBuildPiece(mName, stackSize, 1, 2, 0, elementBudget, env, false, true); - } - - @Override - public boolean checkMachine(IGregTechTileEntity aBaseMetaTileEntity, ItemStack aStack) { - mCasing = 0; - return checkPiece(mName, 1, 2, 0) && mCasing >= 6 && checkHatch(); - } - - @Override - protected SoundResource getProcessStartSound() { - return SoundResource.IC2_MACHINES_COMPRESSOR_OP; - } - - @Override - protected IIconContainer getActiveOverlay() { - return TexturesGtBlock.Overlay_Machine_Controller_Default_Active; - } - - @Override - protected IIconContainer getInactiveOverlay() { - return TexturesGtBlock.Overlay_Machine_Controller_Default; - } - - @Override - protected int getCasingTextureId() { - return CASING_TEXTURE_ID; - } - - @Override - public RecipeMap<?> getRecipeMap() { - return GTPPRecipeMaps.mixerNonCellRecipes; - } - - @Override - protected ProcessingLogic createProcessingLogic() { - return new ProcessingLogic().setSpeedBonus(1F / 3.5F) - .setMaxParallelSupplier(this::getMaxParallelRecipes); - } - - @Override - public int getMaxParallelRecipes() { - return (8 * GT_Utility.getTier(this.getMaxInputVoltage())); - } - - @Override - public int getMaxEfficiency(final ItemStack aStack) { - return 10000; - } - - @Override - public int getPollutionPerSecond(final ItemStack aStack) { - return CORE.ConfigSwitches.pollutionPerSecondMultiIndustrialMixer; - } - - @Override - public void onModeChangeByScrewdriver(ForgeDirection side, EntityPlayer aPlayer, float aX, float aY, float aZ) { - inputSeparation = !inputSeparation; - GT_Utility.sendChatToPlayer( - aPlayer, - StatCollector.translateToLocal("GT5U.machines.separatebus") + " " + inputSeparation); - } - - @Override - public boolean explodesOnComponentBreak(final ItemStack aStack) { - return false; - } - - @Override - public boolean supportsInputSeparation() { - return true; - } -} diff --git a/gtpp/src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/processing/GregtechMetaTileEntity_IndustrialMolecularTransformer.java b/gtpp/src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/processing/GregtechMetaTileEntity_IndustrialMolecularTransformer.java deleted file mode 100644 index 02b0bcf978..0000000000 --- a/gtpp/src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/processing/GregtechMetaTileEntity_IndustrialMolecularTransformer.java +++ /dev/null @@ -1,241 +0,0 @@ -package gtPlusPlus.xmod.gregtech.common.tileentities.machines.multi.processing; - -import static com.gtnewhorizon.structurelib.structure.StructureUtility.ofBlock; -import static com.gtnewhorizon.structurelib.structure.StructureUtility.onElementPass; -import static gregtech.api.enums.GT_HatchElement.Energy; -import static gregtech.api.enums.GT_HatchElement.InputBus; -import static gregtech.api.enums.GT_HatchElement.Maintenance; -import static gregtech.api.enums.GT_HatchElement.Muffler; -import static gregtech.api.enums.GT_HatchElement.OutputBus; -import static gregtech.api.util.GT_StructureUtility.buildHatchAdder; - -import net.minecraft.block.Block; -import net.minecraft.item.ItemStack; -import net.minecraftforge.common.util.ForgeDirection; - -import com.gtnewhorizon.structurelib.alignment.IAlignmentLimits; -import com.gtnewhorizon.structurelib.alignment.constructable.ISurvivalConstructable; -import com.gtnewhorizon.structurelib.structure.IStructureDefinition; -import com.gtnewhorizon.structurelib.structure.ISurvivalBuildEnvironment; -import com.gtnewhorizon.structurelib.structure.StructureDefinition; - -import gregtech.api.GregTech_API; -import gregtech.api.interfaces.IIconContainer; -import gregtech.api.interfaces.metatileentity.IMetaTileEntity; -import gregtech.api.interfaces.tileentity.IGregTechTileEntity; -import gregtech.api.logic.ProcessingLogic; -import gregtech.api.recipe.RecipeMap; -import gregtech.api.util.GT_Multiblock_Tooltip_Builder; -import gtPlusPlus.api.recipe.GTPPRecipeMaps; -import gtPlusPlus.core.block.ModBlocks; -import gtPlusPlus.core.lib.CORE; -import gtPlusPlus.xmod.gregtech.api.metatileentity.implementations.base.GregtechMeta_MultiBlockBase; -import gtPlusPlus.xmod.gregtech.common.blocks.textures.TexturesGtBlock; - -public class GregtechMetaTileEntity_IndustrialMolecularTransformer - extends GregtechMeta_MultiBlockBase<GregtechMetaTileEntity_IndustrialMolecularTransformer> - implements ISurvivalConstructable { - - private static final int CASING_TEXTURE_ID = 48; - private int mCasing = 0; - - public GregtechMetaTileEntity_IndustrialMolecularTransformer(final int aID, final String aName, - final String aNameRegional) { - super(aID, aName, aNameRegional); - } - - public GregtechMetaTileEntity_IndustrialMolecularTransformer(final String aName) { - super(aName); - } - - @Override - public IMetaTileEntity newMetaEntity(final IGregTechTileEntity aTileEntity) { - return new GregtechMetaTileEntity_IndustrialMolecularTransformer(this.mName); - } - - @Override - public String getMachineType() { - return "Molecular Transformer"; - } - - @Override - protected GT_Multiblock_Tooltip_Builder createTooltip() { - - GT_Multiblock_Tooltip_Builder tt = new GT_Multiblock_Tooltip_Builder(); - tt.addMachineType(getMachineType()) - .addInfo("Changes the structure of items to produce new ones") - .addInfo("Maximum 1x of each bus/hatch.") - .addPollutionAmount(getPollutionPerSecond(null)) - .addSeparator() - .beginStructureBlock(7, 7, 7, false) - .addController("Top Center") - .addCasingInfoMin("Robust Tungstensteel Machine Casing", 40, false) - .addCasingInfoMin("Tungstensteel Coils", 16, false) - .addCasingInfoMin("Molecular Containment Casing", 52, false) - .addCasingInfoMin("High Voltage Current Capacitor", 32, false) - .addCasingInfoMin("Particle Containment Casing", 4, false) - .addCasingInfoMin("Resonance Chamber I", 5, false) - .addCasingInfoMin("Modulator I", 4, false) - .addInputBus("Any Robust Tungstensteel Machine Casing", 1) - .addOutputBus("Any Robust Tungstensteel Machine Casing", 1) - .addEnergyHatch("Any Robust Tungstensteel Machine Casing", 1) - .addMaintenanceHatch("Any Robust Tungstensteel Machine Casing", 1) - .addMufflerHatch("Any Robust Tungstensteel Machine Casing", 1) - .toolTipFinisher(CORE.GT_Tooltip_Builder.get()); - return tt; - } - - private static final String STRUCTURE_PIECE_MAIN = "main"; - private static IStructureDefinition<GregtechMetaTileEntity_IndustrialMolecularTransformer> STRUCTURE_DEFINITION = null; - - @Override - public IStructureDefinition<GregtechMetaTileEntity_IndustrialMolecularTransformer> getStructureDefinition() { - if (STRUCTURE_DEFINITION == null) { - STRUCTURE_DEFINITION = StructureDefinition.<GregtechMetaTileEntity_IndustrialMolecularTransformer>builder() - .addShape( - STRUCTURE_PIECE_MAIN, - (new String[][] { { " ", " ", " xxx ", " x~x ", " xxx ", " ", " " }, - { " ", " xxx ", " xyyyx ", " xyzyx ", " xyyyx ", " xxx ", " " }, - { " ", " xxx ", " xyyyx ", " xyzyx ", " xyyyx ", " xxx ", " " }, - { " ", " xxx ", " xyyyx ", " xyzyx ", " xyyyx ", " xxx ", " " }, - { " t ", " ttxtt ", " tyyyt ", "txyzyxt", " tyyyt ", " ttxtt ", " t " }, - { " c ", " ccecc ", " cxfxc ", "cefefec", " cxfxc ", " ccecc ", " c " }, - { " h ", " hhhhh ", " hhhhh ", "hhhhhhh", " hhhhh ", " hhhhh ", " h " }, })) - .addElement('x', ofBlock(getCasingBlock(), getCasingMeta())) - .addElement('y', ofBlock(getCasingBlock(), getCasingMeta2())) - .addElement('z', ofBlock(getCasingBlock(), getCasingMeta3())) - .addElement('e', ofBlock(getCasingBlock2(), 0)) - .addElement('f', ofBlock(getCasingBlock2(), 4)) - .addElement('c', ofBlock(getCoilBlock(), 3)) - .addElement('t', ofBlock(getCasingBlock3(), getTungstenCasingMeta())) - .addElement( - 'h', - buildHatchAdder(GregtechMetaTileEntity_IndustrialMolecularTransformer.class) - .atLeast(InputBus, OutputBus, Maintenance, Energy, Muffler) - .casingIndex(getCasingTextureIndex()) - .dot(1) - .buildAndChain( - onElementPass(x -> ++x.mCasing, ofBlock(getCasingBlock3(), getTungstenCasingMeta())))) - .build(); - } - return STRUCTURE_DEFINITION; - } - - @Override - public void construct(ItemStack stackSize, boolean hintsOnly) { - buildPiece(STRUCTURE_PIECE_MAIN, stackSize, hintsOnly, 3, 3, 0); - } - - @Override - public int survivalConstruct(ItemStack stackSize, int elementBudget, ISurvivalBuildEnvironment env) { - if (mMachine) return -1; - return survivialBuildPiece(STRUCTURE_PIECE_MAIN, stackSize, 3, 3, 0, elementBudget, env, false, true); - } - - @Override - public boolean checkMachine(IGregTechTileEntity aBaseMetaTileEntity, ItemStack aStack) { - mCasing = 0; - boolean aDidBuild = checkPiece(STRUCTURE_PIECE_MAIN, 3, 3, 0); - if (this.mInputBusses.size() != 1 || this.mOutputBusses.size() != 1 || this.mEnergyHatches.size() != 1) { - return false; - } - // there are 16 slot that only allow casing, so we subtract this from the grand total required - return aDidBuild && mCasing >= 40 - 16 && checkHatch(); - } - - protected static int getCasingTextureIndex() { - return CASING_TEXTURE_ID; - } - - protected static Block getCasingBlock() { - return ModBlocks.blockSpecialMultiCasings; - } - - protected static Block getCasingBlock2() { - return ModBlocks.blockSpecialMultiCasings2; - } - - protected static Block getCasingBlock3() { - return GregTech_API.sBlockCasings4; - } - - protected static Block getCoilBlock() { - return GregTech_API.sBlockCasings5; - } - - protected static int getCasingMeta() { - return 11; - } - - protected static int getCasingMeta2() { - return 12; - } - - protected static int getCasingMeta3() { - return 13; - } - - protected static int getTungstenCasingMeta() { - return 0; - } - - @Override - protected IAlignmentLimits getInitialAlignmentLimits() { - return (d, r, f) -> d == ForgeDirection.UP; - } - - @Override - protected IIconContainer getActiveOverlay() { - return TexturesGtBlock.Overlay_Machine_Controller_Advanced_Active; - } - - @Override - protected IIconContainer getInactiveOverlay() { - return TexturesGtBlock.Overlay_Machine_Controller_Advanced; - } - - @Override - protected int getCasingTextureId() { - return 44; - } - - @Override - public RecipeMap<?> getRecipeMap() { - return GTPPRecipeMaps.molecularTransformerRecipes; - } - - @Override - public boolean isCorrectMachinePart(final ItemStack aStack) { - return true; - } - - @Override - protected ProcessingLogic createProcessingLogic() { - return new ProcessingLogic(); - } - - @Override - public int getMaxParallelRecipes() { - return 1; - } - - @Override - public int getMaxEfficiency(final ItemStack aStack) { - return 10000; - } - - @Override - public int getPollutionPerSecond(final ItemStack aStack) { - return CORE.ConfigSwitches.pollutionPerSecondMultiMolecularTransformer; - } - - @Override - public int getDamageToComponent(final ItemStack aStack) { - return 0; - } - - @Override - public boolean explodesOnComponentBreak(final ItemStack aStack) { - return false; - } -} diff --git a/gtpp/src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/processing/GregtechMetaTileEntity_IndustrialMultiMachine.java b/gtpp/src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/processing/GregtechMetaTileEntity_IndustrialMultiMachine.java deleted file mode 100644 index 52c7736ae3..0000000000 --- a/gtpp/src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/processing/GregtechMetaTileEntity_IndustrialMultiMachine.java +++ /dev/null @@ -1,514 +0,0 @@ -package gtPlusPlus.xmod.gregtech.common.tileentities.machines.multi.processing; - -import static com.gtnewhorizon.structurelib.structure.StructureUtility.ofBlock; -import static com.gtnewhorizon.structurelib.structure.StructureUtility.onElementPass; -import static com.gtnewhorizon.structurelib.structure.StructureUtility.transpose; -import static gregtech.api.enums.GT_HatchElement.Energy; -import static gregtech.api.enums.GT_HatchElement.InputBus; -import static gregtech.api.enums.GT_HatchElement.InputHatch; -import static gregtech.api.enums.GT_HatchElement.Maintenance; -import static gregtech.api.enums.GT_HatchElement.Muffler; -import static gregtech.api.enums.GT_HatchElement.OutputBus; -import static gregtech.api.enums.GT_HatchElement.OutputHatch; -import static gregtech.api.util.GT_StructureUtility.buildHatchAdder; -import static gregtech.api.util.GT_Utility.filterValidMTEs; - -import java.util.ArrayList; -import java.util.Arrays; -import java.util.Collection; -import java.util.List; -import java.util.stream.Stream; - -import javax.annotation.Nonnull; -import javax.annotation.Nullable; - -import net.minecraft.entity.player.EntityPlayer; -import net.minecraft.entity.player.EntityPlayerMP; -import net.minecraft.item.ItemStack; -import net.minecraft.nbt.NBTTagCompound; -import net.minecraft.tileentity.TileEntity; -import net.minecraft.util.EnumChatFormatting; -import net.minecraft.util.StatCollector; -import net.minecraft.world.World; -import net.minecraftforge.common.util.ForgeDirection; -import net.minecraftforge.fluids.FluidStack; - -import com.gtnewhorizon.structurelib.alignment.constructable.ISurvivalConstructable; -import com.gtnewhorizon.structurelib.structure.IStructureDefinition; -import com.gtnewhorizon.structurelib.structure.ISurvivalBuildEnvironment; -import com.gtnewhorizon.structurelib.structure.StructureDefinition; - -import gregtech.api.enums.TAE; -import gregtech.api.interfaces.IIconContainer; -import gregtech.api.interfaces.metatileentity.IMetaTileEntity; -import gregtech.api.interfaces.tileentity.IGregTechTileEntity; -import gregtech.api.logic.ProcessingLogic; -import gregtech.api.metatileentity.implementations.GT_MetaTileEntity_Hatch_Input; -import gregtech.api.metatileentity.implementations.GT_MetaTileEntity_Hatch_InputBus; -import gregtech.api.metatileentity.implementations.GT_MetaTileEntity_Hatch_MultiInput; -import gregtech.api.recipe.RecipeMap; -import gregtech.api.recipe.RecipeMaps; -import gregtech.api.recipe.check.CheckRecipeResult; -import gregtech.api.recipe.check.CheckRecipeResultRegistry; -import gregtech.api.util.GT_LanguageManager; -import gregtech.api.util.GT_Multiblock_Tooltip_Builder; -import gregtech.api.util.GT_Recipe; -import gregtech.api.util.GT_Utility; -import gregtech.common.tileentities.machines.GT_MetaTileEntity_Hatch_CraftingInput_ME; -import gregtech.common.tileentities.machines.GT_MetaTileEntity_Hatch_Input_ME; -import gregtech.common.tileentities.machines.IDualInputHatch; -import gregtech.common.tileentities.machines.IDualInputInventory; -import gtPlusPlus.core.block.ModBlocks; -import gtPlusPlus.core.lib.CORE; -import gtPlusPlus.core.recipe.common.CI; -import gtPlusPlus.core.util.minecraft.ItemUtils; -import gtPlusPlus.core.util.minecraft.PlayerUtils; -import gtPlusPlus.xmod.gregtech.api.metatileentity.implementations.GT_MetaTileEntity_Hatch_Solidifier; -import gtPlusPlus.xmod.gregtech.api.metatileentity.implementations.base.GregtechMeta_MultiBlockBase; -import gtPlusPlus.xmod.gregtech.common.blocks.textures.TexturesGtBlock; -import mcp.mobius.waila.api.IWailaConfigHandler; -import mcp.mobius.waila.api.IWailaDataAccessor; - -public class GregtechMetaTileEntity_IndustrialMultiMachine extends - GregtechMeta_MultiBlockBase<GregtechMetaTileEntity_IndustrialMultiMachine> implements ISurvivalConstructable { - - protected int mInternalMode = 0; - private static final int MODE_COMPRESSOR = 0; - private static final int MODE_LATHE = 1; - private static final int MODE_MAGNETIC = 2; - private static final int MODE_FERMENTER = 3; - private static final int MODE_FLUIDEXTRACT = 4; - private static final int MODE_EXTRACTOR = 5; - private static final int MODE_LASER = 6; - private static final int MODE_AUTOCLAVE = 7; - private static final int MODE_FLUIDSOLIDIFY = 8; - private static final int[][] MODE_MAP = new int[][] { { 0, 1, 2 }, { 3, 4, 5 }, { 6, 7, 8 } }; - public static final String[] aToolTipNames = new String[9]; - private int mCasing; - private static IStructureDefinition<GregtechMetaTileEntity_IndustrialMultiMachine> STRUCTURE_DEFINITION = null; - - static { - for (int id = 0; id < 9; id++) { - RecipeMap<?> recipeMap = getRecipeMap(id); - if (recipeMap != null) { - String aNEI = GT_LanguageManager.getTranslation(getRecipeMap(id).unlocalizedName); - aToolTipNames[id] = aNEI != null ? aNEI : "BAD NEI NAME (Report to Github)"; - } - } - } - - public GregtechMetaTileEntity_IndustrialMultiMachine(final int aID, final String aName, - final String aNameRegional) { - super(aID, aName, aNameRegional); - } - - public GregtechMetaTileEntity_IndustrialMultiMachine(final String aName) { - super(aName); - } - - @Override - public IMetaTileEntity newMetaEntity(final IGregTechTileEntity aTileEntity) { - return new GregtechMetaTileEntity_IndustrialMultiMachine(this.mName); - } - - @Override - public String getMachineType() { - return "Nine in One"; - } - - @Override - protected GT_Multiblock_Tooltip_Builder createTooltip() { - String[] aBuiltStrings = new String[3]; - aBuiltStrings[0] = aToolTipNames[0] + ", " + aToolTipNames[1] + ", " + aToolTipNames[2]; - aBuiltStrings[1] = aToolTipNames[3] + ", " + aToolTipNames[4] + ", " + aToolTipNames[5]; - aBuiltStrings[2] = aToolTipNames[6] + ", " + aToolTipNames[7] + ", " + aToolTipNames[8]; - - GT_Multiblock_Tooltip_Builder tt = new GT_Multiblock_Tooltip_Builder(); - tt.addMachineType(getMachineType()) - .addInfo("Controller Block for the Industrial Multi-Machine") - .addInfo("250% faster than using single block machines of the same voltage") - .addInfo("Only uses 80% of the EU/t normally required") - .addInfo("Processes two items per voltage tier") - .addInfo("Machine Type: Metal - " + EnumChatFormatting.YELLOW + aBuiltStrings[0] + EnumChatFormatting.RESET) - .addInfo("Machine Type: Fluid - " + EnumChatFormatting.YELLOW + aBuiltStrings[1] + EnumChatFormatting.RESET) - .addInfo("Machine Type: Misc - " + EnumChatFormatting.YELLOW + aBuiltStrings[2] + EnumChatFormatting.RESET) - .addInfo("Read Multi-Machine Manual for extra information") - .addInfo( - EnumChatFormatting.AQUA + "You can use Solidifier Hatch to solidify multiple liquids." - + EnumChatFormatting.RESET) - .addPollutionAmount(getPollutionPerSecond(null)) - .addSeparator() - .beginStructureBlock(3, 3, 3, true) - .addController("Front Center") - .addCasingInfoMin("Multi-Use Casings", 6, false) - .addInputBus("Any Casing", 1) - .addOutputBus("Any Casing", 1) - .addInputHatch("Any Casing", 1) - .addOutputHatch("Any Casing", 1) - .addEnergyHatch("Any Casing", 1) - .addMaintenanceHatch("Any Casing", 1) - .addMufflerHatch("Any Casing", 1) - .toolTipFinisher(CORE.GT_Tooltip_Builder.get()); - return tt; - } - - @Override - public IStructureDefinition<GregtechMetaTileEntity_IndustrialMultiMachine> getStructureDefinition() { - if (STRUCTURE_DEFINITION == null) { - STRUCTURE_DEFINITION = StructureDefinition.<GregtechMetaTileEntity_IndustrialMultiMachine>builder() - .addShape( - mName, - transpose( - new String[][] { { "CCC", "CCC", "CCC" }, { "C~C", "C-C", "CCC" }, { "CCC", "CCC", "CCC" }, })) - .addElement( - 'C', - buildHatchAdder(GregtechMetaTileEntity_IndustrialMultiMachine.class) - .atLeast(InputBus, OutputBus, Maintenance, Energy, Muffler, InputHatch, OutputHatch) - .casingIndex(getTextureIndex()) - .dot(1) - .buildAndChain(onElementPass(x -> ++x.mCasing, ofBlock(ModBlocks.blockCasings3Misc, 2)))) - .build(); - } - return STRUCTURE_DEFINITION; - } - - @Override - public void construct(ItemStack stackSize, boolean hintsOnly) { - buildPiece(mName, stackSize, hintsOnly, 1, 1, 0); - } - - @Override - public int survivalConstruct(ItemStack stackSize, int elementBudget, ISurvivalBuildEnvironment env) { - if (mMachine) return -1; - return survivialBuildPiece(mName, stackSize, 1, 1, 0, elementBudget, env, false, true); - } - - @Override - public boolean checkMachine(IGregTechTileEntity aBaseMetaTileEntity, ItemStack aStack) { - mCasing = 0; - return checkPiece(mName, 1, 1, 0) && mCasing >= 6 && checkHatch(); - } - - @Override - protected IIconContainer getActiveOverlay() { - return TexturesGtBlock.Overlay_Machine_Controller_Advanced_Active; - } - - @Override - protected IIconContainer getInactiveOverlay() { - return TexturesGtBlock.Overlay_Machine_Controller_Advanced; - } - - @Override - protected int getCasingTextureId() { - return getTextureIndex(); - } - - @Override - public int getMaxParallelRecipes() { - return (2 * GT_Utility.getTier(this.getMaxInputVoltage())); - } - - @Override - public int getMaxEfficiency(final ItemStack aStack) { - return 10000; - } - - @Override - public int getPollutionPerSecond(final ItemStack aStack) { - if (mInternalMode == 0) { - return CORE.ConfigSwitches.pollutionPerSecondMultiIndustrialMultiMachine_ModeMetal; - } else if (mInternalMode == 1) { - return CORE.ConfigSwitches.pollutionPerSecondMultiIndustrialMultiMachine_ModeFluid; - } else { // config 2 - return CORE.ConfigSwitches.pollutionPerSecondMultiIndustrialMultiMachine_ModeMisc; - } - } - - public int getTextureIndex() { - return TAE.getIndexFromPage(2, 2); - } - - @Override - public boolean explodesOnComponentBreak(final ItemStack aStack) { - return false; - } - - private ItemStack getCircuit(ItemStack[] t) { - for (ItemStack j : t) { - if (j.getItem() == CI.getNumberedCircuit(0) - .getItem()) { - if (j.getItemDamage() >= 20 && j.getItemDamage() <= 22) { - return j; - } - } - } - return null; - } - - private int getCircuitID(ItemStack circuit) { - int H = circuit.getItemDamage(); - int T = (H == 20 ? 0 : (H == 21 ? 1 : (H == 22 ? 2 : -1))); - return MODE_MAP[this.mInternalMode][T]; - } - - @Override - public RecipeMap<?> getRecipeMap() { - return null; - } - - @Nonnull - @Override - public Collection<RecipeMap<?>> getAvailableRecipeMaps() { - return Arrays.asList( - RecipeMaps.compressorRecipes, - RecipeMaps.latheRecipes, - RecipeMaps.polarizerRecipes, - RecipeMaps.fermentingRecipes, - RecipeMaps.fluidExtractionRecipes, - RecipeMaps.extractorRecipes, - RecipeMaps.laserEngraverRecipes, - RecipeMaps.autoclaveRecipes, - RecipeMaps.fluidSolidifierRecipes); - } - - @Override - public int getRecipeCatalystPriority() { - return -10; - } - - private static RecipeMap<?> getRecipeMap(int aMode) { - if (aMode == MODE_COMPRESSOR) { - return RecipeMaps.compressorRecipes; - } else if (aMode == MODE_LATHE) { - return RecipeMaps.latheRecipes; - } else if (aMode == MODE_MAGNETIC) { - return RecipeMaps.polarizerRecipes; - } else if (aMode == MODE_FERMENTER) { - return RecipeMaps.fermentingRecipes; - } else if (aMode == MODE_FLUIDEXTRACT) { - return RecipeMaps.fluidExtractionRecipes; - } else if (aMode == MODE_EXTRACTOR) { - return RecipeMaps.extractorRecipes; - } else if (aMode == MODE_LASER) { - return RecipeMaps.laserEngraverRecipes; - } else if (aMode == MODE_AUTOCLAVE) { - return RecipeMaps.autoclaveRecipes; - } else if (aMode == MODE_FLUIDSOLIDIFY) { - return RecipeMaps.fluidSolidifierRecipes; - } else { - return null; - } - } - - @Override - protected ProcessingLogic createProcessingLogic() { - return new ProcessingLogic() { - - private ItemStack lastCircuit = null; - - @Nonnull - @Override - protected Stream<GT_Recipe> findRecipeMatches(@Nullable RecipeMap<?> map) { - ItemStack circuit = getCircuit(inputItems); - if (circuit == null) { - return Stream.empty(); - } - if (!GT_Utility.areStacksEqual(circuit, lastCircuit)) { - lastRecipe = null; - lastCircuit = circuit; - } - RecipeMap<?> foundMap = getRecipeMap(getCircuitID(circuit)); - if (foundMap == null) { - return Stream.empty(); - } - return super.findRecipeMatches(foundMap); - } - }.setSpeedBonus(1F / 3.5F) - .setEuModifier(0.8F) - .setMaxParallelSupplier(this::getMaxParallelRecipes); - } - - @Override - public void onModeChangeByScrewdriver(ForgeDirection side, EntityPlayer aPlayer, float aX, float aY, float aZ) { - if (mInternalMode < 2) { - mInternalMode++; - } else { - mInternalMode = 0; - } - String mModeString = (mInternalMode == 0 ? "Metal" - : mInternalMode == 1 ? "Fluid" : mInternalMode == 2 ? "Misc." : "null"); - PlayerUtils.messagePlayer(aPlayer, "Multi-Machine is now in " + mModeString + " mode."); - mLastRecipe = null; - } - - @Override - public String[] getInfoData() { - String[] data = super.getInfoData(); - ArrayList<String> mInfo = new ArrayList<>(Arrays.asList(data)); - String mode; - if (mInternalMode == 0) { - mode = StatCollector.translateToLocal("GTPP.multiblock.multimachine.metal"); - } else if (mInternalMode == 1) { - mode = StatCollector.translateToLocal("GTPP.multiblock.multimachine.fluid"); - } else { - mode = StatCollector.translateToLocal("GTPP.multiblock.multimachine.misc"); - } - mInfo.add(mode); - return mInfo.toArray(new String[0]); - } - - @Override - public void saveNBTData(NBTTagCompound aNBT) { - aNBT.setInteger("mInternalMode", mInternalMode); - super.saveNBTData(aNBT); - } - - @Override - public void loadNBTData(NBTTagCompound aNBT) { - this.mInternalMode = aNBT.getInteger("mInternalMode"); - super.loadNBTData(aNBT); - } - - @Override - public boolean isInputSeparationEnabled() { - return true; - } - - @Override - public void getWailaNBTData(EntityPlayerMP player, TileEntity tile, NBTTagCompound tag, World world, int x, int y, - int z) { - super.getWailaNBTData(player, tile, tag, world, x, y, z); - tag.setInteger("mode", mInternalMode); - } - - @Override - protected CheckRecipeResult doCheckRecipe() { - - if (mInternalMode != 2 || !isInputSeparationEnabled()) { - return super.doCheckRecipe(); - } else { - CheckRecipeResult result = CheckRecipeResultRegistry.NO_RECIPE; - - // check crafting input hatches first - if (supportsCraftingMEBuffer()) { - for (IDualInputHatch dualInputHatch : mDualInputHatches) { - for (var it = dualInputHatch.inventories(); it.hasNext();) { - IDualInputInventory slot = it.next(); - processingLogic.setInputItems(slot.getItemInputs()); - processingLogic.setInputFluids(slot.getFluidInputs()); - CheckRecipeResult foundResult = processingLogic.process(); - if (foundResult.wasSuccessful()) { - return foundResult; - } - if (foundResult != CheckRecipeResultRegistry.NO_RECIPE) { - // Recipe failed in interesting way, so remember that and continue searching - result = foundResult; - } - } - } - } - - // Logic for GT_MetaTileEntity_Hatch_Solidifier - for (GT_MetaTileEntity_Hatch_Input solidifierHatch : mInputHatches) { - if (solidifierHatch instanceof GT_MetaTileEntity_Hatch_Solidifier) { - ItemStack mold = ((GT_MetaTileEntity_Hatch_Solidifier) solidifierHatch).getMold(); - FluidStack fluid = solidifierHatch.getFluid(); - - if (mold != null && fluid != null) { - List<ItemStack> inputItems = new ArrayList<>(); - inputItems.add(mold); - inputItems.add(ItemUtils.getGregtechCircuit(22)); - - processingLogic.setInputItems(inputItems.toArray(new ItemStack[0])); - processingLogic.setInputFluids(fluid); - - CheckRecipeResult foundResult = processingLogic.process(); - if (foundResult.wasSuccessful()) { - return foundResult; - } - if (foundResult != CheckRecipeResultRegistry.NO_RECIPE) { - // Recipe failed in interesting way, so remember that and continue searching - result = foundResult; - } - } - } - } - processingLogic.clear(); - processingLogic.setInputFluids(getStoredFluids()); - // Default logic - for (GT_MetaTileEntity_Hatch_InputBus bus : mInputBusses) { - if (bus instanceof GT_MetaTileEntity_Hatch_CraftingInput_ME) { - continue; - } - List<ItemStack> inputItems = new ArrayList<>(); - for (int i = bus.getSizeInventory() - 1; i >= 0; i--) { - ItemStack stored = bus.getStackInSlot(i); - if (stored != null) { - inputItems.add(stored); - } - } - if (canUseControllerSlotForRecipe() && getControllerSlot() != null) { - inputItems.add(getControllerSlot()); - } - processingLogic.setInputItems(inputItems.toArray(new ItemStack[0])); - CheckRecipeResult foundResult = processingLogic.process(); - if (foundResult.wasSuccessful()) { - return foundResult; - } - if (foundResult != CheckRecipeResultRegistry.NO_RECIPE) { - // Recipe failed in interesting way, so remember that and continue searching - result = foundResult; - } - } - - return result; - } - } - - @Override - public ArrayList<FluidStack> getStoredFluids() { - ArrayList<FluidStack> rList = new ArrayList<>(); - for (GT_MetaTileEntity_Hatch_Input tHatch : filterValidMTEs(mInputHatches)) { - if (tHatch instanceof GT_MetaTileEntity_Hatch_Solidifier) { - continue; - } - - setHatchRecipeMap(tHatch); - if (tHatch instanceof GT_MetaTileEntity_Hatch_MultiInput) { - for (FluidStack tFluid : ((GT_MetaTileEntity_Hatch_MultiInput) tHatch).getStoredFluid()) { - if (tFluid != null) { - rList.add(tFluid); - } - } - } else if (tHatch instanceof GT_MetaTileEntity_Hatch_Input_ME) { - if (tHatch.isValid()) { - for (FluidStack fluidStack : ((GT_MetaTileEntity_Hatch_Input_ME) tHatch).getStoredFluids()) { - if (fluidStack == null) continue; - rList.add(fluidStack); - } - } - } else { - if (tHatch.getFillableStack() != null) { - rList.add(tHatch.getFillableStack()); - } - } - } - - return rList; - } - - @Override - public void getWailaBody(ItemStack itemStack, List<String> currentTip, IWailaDataAccessor accessor, - IWailaConfigHandler config) { - super.getWailaBody(itemStack, currentTip, accessor, config); - final NBTTagCompound tag = accessor.getNBTData(); - if (tag.hasKey("mode")) { - currentTip.add("Mode: " + EnumChatFormatting.YELLOW + switch (tag.getInteger("mode")) { - case 1 -> "Fluid"; - case 2 -> "Misc"; - default -> "Metal"; - } + EnumChatFormatting.RESET); - } - } -} diff --git a/gtpp/src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/processing/GregtechMetaTileEntity_IndustrialPlatePress.java b/gtpp/src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/processing/GregtechMetaTileEntity_IndustrialPlatePress.java deleted file mode 100644 index 972cf492b6..0000000000 --- a/gtpp/src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/processing/GregtechMetaTileEntity_IndustrialPlatePress.java +++ /dev/null @@ -1,218 +0,0 @@ -package gtPlusPlus.xmod.gregtech.common.tileentities.machines.multi.processing; - -import static com.gtnewhorizon.structurelib.structure.StructureUtility.ofBlock; -import static com.gtnewhorizon.structurelib.structure.StructureUtility.onElementPass; -import static com.gtnewhorizon.structurelib.structure.StructureUtility.transpose; -import static gregtech.api.enums.GT_HatchElement.Energy; -import static gregtech.api.enums.GT_HatchElement.InputBus; -import static gregtech.api.enums.GT_HatchElement.Maintenance; -import static gregtech.api.enums.GT_HatchElement.Muffler; -import static gregtech.api.enums.GT_HatchElement.OutputBus; -import static gregtech.api.util.GT_StructureUtility.buildHatchAdder; - -import java.util.Arrays; -import java.util.Collection; - -import javax.annotation.Nonnull; - -import net.minecraft.entity.player.EntityPlayer; -import net.minecraft.item.ItemStack; -import net.minecraft.nbt.NBTTagCompound; -import net.minecraftforge.common.util.ForgeDirection; - -import com.gtnewhorizon.structurelib.alignment.constructable.ISurvivalConstructable; -import com.gtnewhorizon.structurelib.structure.IStructureDefinition; -import com.gtnewhorizon.structurelib.structure.ISurvivalBuildEnvironment; -import com.gtnewhorizon.structurelib.structure.StructureDefinition; - -import gregtech.api.enums.SoundResource; -import gregtech.api.interfaces.IIconContainer; -import gregtech.api.interfaces.metatileentity.IMetaTileEntity; -import gregtech.api.interfaces.tileentity.IGregTechTileEntity; -import gregtech.api.logic.ProcessingLogic; -import gregtech.api.recipe.RecipeMap; -import gregtech.api.recipe.RecipeMaps; -import gregtech.api.util.GT_Multiblock_Tooltip_Builder; -import gregtech.api.util.GT_Utility; -import gtPlusPlus.core.block.ModBlocks; -import gtPlusPlus.core.lib.CORE; -import gtPlusPlus.core.util.minecraft.PlayerUtils; -import gtPlusPlus.xmod.gregtech.api.metatileentity.implementations.base.GregtechMeta_MultiBlockBase; -import gtPlusPlus.xmod.gregtech.common.blocks.textures.TexturesGtBlock; - -public class GregtechMetaTileEntity_IndustrialPlatePress - extends GregtechMeta_MultiBlockBase<GregtechMetaTileEntity_IndustrialPlatePress> implements ISurvivalConstructable { - - private boolean mFormingMode = false; - private int mCasing; - private static IStructureDefinition<GregtechMetaTileEntity_IndustrialPlatePress> STRUCTURE_DEFINITION = null; - - public GregtechMetaTileEntity_IndustrialPlatePress(final int aID, final String aName, final String aNameRegional) { - super(aID, aName, aNameRegional); - } - - public GregtechMetaTileEntity_IndustrialPlatePress(final String aName) { - super(aName); - } - - @Override - public IMetaTileEntity newMetaEntity(final IGregTechTileEntity aTileEntity) { - return new GregtechMetaTileEntity_IndustrialPlatePress(this.mName); - } - - @Override - public String getMachineType() { - return "Bending Machine, Forming Press"; - } - - @Override - protected GT_Multiblock_Tooltip_Builder createTooltip() { - GT_Multiblock_Tooltip_Builder tt = new GT_Multiblock_Tooltip_Builder(); - tt.addMachineType(getMachineType()) - .addInfo("Controller Block for Advanced Bending & Forming") - .addInfo("500% faster than using single block machines of the same voltage") - .addInfo("Processes four items per voltage tier") - .addInfo("Circuit for recipe goes in the Input Bus") - .addInfo("Each Input Bus can have a different Circuit/Shape!") - .addPollutionAmount(getPollutionPerSecond(null)) - .addSeparator() - .beginStructureBlock(3, 3, 3, true) - .addController("Front Center") - .addCasingInfoMin("Material Press Machine Casings", 6, false) - .addInputBus("Any Casing", 1) - .addOutputBus("Any Casing", 1) - .addEnergyHatch("Any Casing", 1) - .addMaintenanceHatch("Any Casing", 1) - .addMufflerHatch("Any Casing", 1) - .toolTipFinisher(CORE.GT_Tooltip_Builder.get()); - return tt; - } - - @Override - public IStructureDefinition<GregtechMetaTileEntity_IndustrialPlatePress> getStructureDefinition() { - if (STRUCTURE_DEFINITION == null) { - STRUCTURE_DEFINITION = StructureDefinition.<GregtechMetaTileEntity_IndustrialPlatePress>builder() - .addShape( - mName, - transpose( - new String[][] { { "CCC", "CCC", "CCC" }, { "C~C", "C-C", "CCC" }, { "CCC", "CCC", "CCC" }, })) - .addElement( - 'C', - buildHatchAdder(GregtechMetaTileEntity_IndustrialPlatePress.class) - .atLeast(InputBus, OutputBus, Maintenance, Energy, Muffler) - .casingIndex(50) - .dot(1) - .buildAndChain(onElementPass(x -> ++x.mCasing, ofBlock(ModBlocks.blockCasingsMisc, 4)))) - .build(); - } - return STRUCTURE_DEFINITION; - } - - @Override - public void construct(ItemStack stackSize, boolean hintsOnly) { - buildPiece(mName, stackSize, hintsOnly, 1, 1, 0); - } - - @Override - public int survivalConstruct(ItemStack stackSize, int elementBudget, ISurvivalBuildEnvironment env) { - if (mMachine) return -1; - return survivialBuildPiece(mName, stackSize, 1, 1, 0, elementBudget, env, false, true); - } - - @Override - public boolean checkMachine(IGregTechTileEntity aBaseMetaTileEntity, ItemStack aStack) { - mCasing = 0; - return checkPiece(mName, 1, 1, 0) && mCasing >= 6 && checkHatch(); - } - - @Override - protected SoundResource getProcessStartSound() { - return SoundResource.IC2_MACHINES_COMPRESSOR_OP; - } - - @Override - protected IIconContainer getActiveOverlay() { - return TexturesGtBlock.Overlay_Machine_Controller_Default_Active; - } - - @Override - protected IIconContainer getInactiveOverlay() { - return TexturesGtBlock.Overlay_Machine_Controller_Default; - } - - @Override - protected int getCasingTextureId() { - return 50; - } - - @Override - public RecipeMap<?> getRecipeMap() { - return mFormingMode ? RecipeMaps.formingPressRecipes : RecipeMaps.benderRecipes; - } - - @Nonnull - @Override - public Collection<RecipeMap<?>> getAvailableRecipeMaps() { - return Arrays.asList(RecipeMaps.formingPressRecipes, RecipeMaps.benderRecipes); - } - - @Override - public int getRecipeCatalystPriority() { - return -1; - } - - @Override - protected ProcessingLogic createProcessingLogic() { - return new ProcessingLogic().setSpeedBonus(1F / 6F) - .setMaxParallelSupplier(this::getMaxParallelRecipes); - } - - @Override - public int getMaxParallelRecipes() { - return (4 * GT_Utility.getTier(this.getMaxInputVoltage())); - } - - @Override - public int getMaxEfficiency(final ItemStack aStack) { - return 10000; - } - - @Override - public int getPollutionPerSecond(final ItemStack aStack) { - if (this.mFormingMode) return CORE.ConfigSwitches.pollutionPerSecondMultiIndustrialPlatePress_ModeForming; - return CORE.ConfigSwitches.pollutionPerSecondMultiIndustrialPlatePress_ModeBending; - } - - @Override - public boolean explodesOnComponentBreak(final ItemStack aStack) { - return false; - } - - @Override - public void saveNBTData(NBTTagCompound aNBT) { - aNBT.setBoolean("mFormingMode", mFormingMode); - super.saveNBTData(aNBT); - } - - @Override - public void loadNBTData(NBTTagCompound aNBT) { - mFormingMode = aNBT.getBoolean("mFormingMode"); - super.loadNBTData(aNBT); - } - - @Override - public void onModeChangeByScrewdriver(ForgeDirection side, EntityPlayer aPlayer, float aX, float aY, float aZ) { - mFormingMode = !mFormingMode; - if (mFormingMode) { - PlayerUtils.messagePlayer(aPlayer, "Now running in Forming Press Mode."); - } else { - PlayerUtils.messagePlayer(aPlayer, "Now running in Bending Mode."); - } - mLastRecipe = null; - } - - @Override - public boolean isInputSeparationEnabled() { - return true; - } -} diff --git a/gtpp/src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/processing/GregtechMetaTileEntity_IndustrialSifter.java b/gtpp/src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/processing/GregtechMetaTileEntity_IndustrialSifter.java deleted file mode 100644 index e4dd3d11ba..0000000000 --- a/gtpp/src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/processing/GregtechMetaTileEntity_IndustrialSifter.java +++ /dev/null @@ -1,209 +0,0 @@ -package gtPlusPlus.xmod.gregtech.common.tileentities.machines.multi.processing; - -import static com.gtnewhorizon.structurelib.structure.StructureUtility.ofBlock; -import static com.gtnewhorizon.structurelib.structure.StructureUtility.onElementPass; -import static com.gtnewhorizon.structurelib.structure.StructureUtility.transpose; -import static gregtech.api.enums.GT_HatchElement.Energy; -import static gregtech.api.enums.GT_HatchElement.InputBus; -import static gregtech.api.enums.GT_HatchElement.InputHatch; -import static gregtech.api.enums.GT_HatchElement.Maintenance; -import static gregtech.api.enums.GT_HatchElement.Muffler; -import static gregtech.api.enums.GT_HatchElement.OutputBus; -import static gregtech.api.enums.GT_HatchElement.OutputHatch; -import static gregtech.api.util.GT_StructureUtility.buildHatchAdder; - -import java.util.Random; - -import net.minecraft.item.ItemStack; -import net.minecraftforge.common.util.ForgeDirection; - -import com.gtnewhorizon.structurelib.alignment.constructable.ISurvivalConstructable; -import com.gtnewhorizon.structurelib.structure.IStructureDefinition; -import com.gtnewhorizon.structurelib.structure.ISurvivalBuildEnvironment; -import com.gtnewhorizon.structurelib.structure.StructureDefinition; - -import gregtech.api.enums.TAE; -import gregtech.api.interfaces.IIconContainer; -import gregtech.api.interfaces.metatileentity.IMetaTileEntity; -import gregtech.api.interfaces.tileentity.IGregTechTileEntity; -import gregtech.api.logic.ProcessingLogic; -import gregtech.api.recipe.RecipeMap; -import gregtech.api.recipe.RecipeMaps; -import gregtech.api.util.GT_Multiblock_Tooltip_Builder; -import gregtech.api.util.GT_Utility; -import gtPlusPlus.core.block.ModBlocks; -import gtPlusPlus.core.lib.CORE; -import gtPlusPlus.xmod.gregtech.api.metatileentity.implementations.base.GregtechMeta_MultiBlockBase; -import gtPlusPlus.xmod.gregtech.common.blocks.textures.TexturesGtBlock; - -public class GregtechMetaTileEntity_IndustrialSifter - extends GregtechMeta_MultiBlockBase<GregtechMetaTileEntity_IndustrialSifter> implements ISurvivalConstructable { - - private int mCasing; - private static IStructureDefinition<GregtechMetaTileEntity_IndustrialSifter> STRUCTURE_DEFINITION = null; - - public GregtechMetaTileEntity_IndustrialSifter(final int aID, final String aName, final String aNameRegional) { - super(aID, aName, aNameRegional); - } - - public GregtechMetaTileEntity_IndustrialSifter(final String aName) { - super(aName); - } - - @Override - public IMetaTileEntity newMetaEntity(final IGregTechTileEntity aTileEntity) { - return new GregtechMetaTileEntity_IndustrialSifter(this.mName); - } - - @Override - public String getMachineType() { - return "Sifter"; - } - - @Override - protected GT_Multiblock_Tooltip_Builder createTooltip() { - GT_Multiblock_Tooltip_Builder tt = new GT_Multiblock_Tooltip_Builder(); - tt.addMachineType(getMachineType()) - .addInfo("Controller Block for the Industrial Sifter") - .addInfo("400% faster than single-block machines of the same voltage") - .addInfo("Only uses 75% of the EU/t normally required") - .addInfo("Processes four items per voltage tier") - .addPollutionAmount(getPollutionPerSecond(null)) - .addSeparator() - .beginStructureBlock(5, 3, 5, false) - .addController("Bottom Center") - .addCasingInfoMin("Sieve Grate", 18, false) - .addCasingInfoMin("Sieve Casings", 35, false) - .addInputBus("Any Casing", 1) - .addOutputBus("Any Casing", 1) - .addInputHatch("Any Casing", 1) - .addOutputHatch("Any Casing", 1) - .addEnergyHatch("Any Casing", 1) - .addMaintenanceHatch("Any Casing", 1) - .addMufflerHatch("Any Casing", 1) - .toolTipFinisher(CORE.GT_Tooltip_Builder.get()); - return tt; - } - - @Override - public IStructureDefinition<GregtechMetaTileEntity_IndustrialSifter> getStructureDefinition() { - if (STRUCTURE_DEFINITION == null) { - STRUCTURE_DEFINITION = StructureDefinition.<GregtechMetaTileEntity_IndustrialSifter>builder() - .addShape( - mName, - transpose( - new String[][] { { "CCCCC", "CMMMC", "CMMMC", "CMMMC", "CCCCC" }, - { "CCCCC", "CMMMC", "CMMMC", "CMMMC", "CCCCC" }, - { "CC~CC", "CCCCC", "CCCCC", "CCCCC", "CCCCC" }, })) - .addElement( - 'C', - buildHatchAdder(GregtechMetaTileEntity_IndustrialSifter.class) - .atLeast(InputBus, OutputBus, Maintenance, Energy, Muffler, InputHatch, OutputHatch) - .casingIndex(TAE.GTPP_INDEX(21)) - .dot(1) - .buildAndChain(onElementPass(x -> ++x.mCasing, ofBlock(ModBlocks.blockCasings2Misc, 5)))) - .addElement('M', ofBlock(ModBlocks.blockCasings2Misc, 6)) - .build(); - } - return STRUCTURE_DEFINITION; - } - - @Override - public void construct(ItemStack stackSize, boolean hintsOnly) { - buildPiece(mName, stackSize, hintsOnly, 2, 2, 0); - } - - @Override - public int survivalConstruct(ItemStack stackSize, int elementBudget, ISurvivalBuildEnvironment env) { - if (mMachine) return -1; - return survivialBuildPiece(mName, stackSize, 2, 2, 0, elementBudget, env, false, true); - } - - @Override - public boolean checkMachine(IGregTechTileEntity aBaseMetaTileEntity, ItemStack aStack) { - mCasing = 0; - return checkPiece(mName, 2, 2, 0) && mCasing >= 35 && checkHatch(); - } - - @Override - protected IIconContainer getActiveOverlay() { - return TexturesGtBlock.Overlay_Machine_Controller_Default_Active; - } - - @Override - protected IIconContainer getInactiveOverlay() { - return TexturesGtBlock.Overlay_Machine_Controller_Default; - } - - @Override - protected int getCasingTextureId() { - return TAE.GTPP_INDEX(21); - } - - @Override - public RecipeMap<?> getRecipeMap() { - return RecipeMaps.sifterRecipes; - } - - @Override - public int getRecipeCatalystPriority() { - return -1; - } - - @Override - public void onPreTick(final IGregTechTileEntity aBaseMetaTileEntity, final long aTick) { - super.onPreTick(aBaseMetaTileEntity, aTick); - if ((aBaseMetaTileEntity.isClientSide()) && (aBaseMetaTileEntity.isActive()) - && (aBaseMetaTileEntity.getFrontFacing() != ForgeDirection.UP) - && (aBaseMetaTileEntity.getCoverIDAtSide(ForgeDirection.UP) == 0) - && (!aBaseMetaTileEntity.getOpacityAtSide(ForgeDirection.UP))) { - final Random tRandom = aBaseMetaTileEntity.getWorld().rand; - if (tRandom.nextFloat() > 0.4) return; - - final int xDir = aBaseMetaTileEntity.getBackFacing().offsetX * 2; - final int zDir = aBaseMetaTileEntity.getBackFacing().offsetZ * 2; - - aBaseMetaTileEntity.getWorld() - .spawnParticle( - "smoke", - (aBaseMetaTileEntity.getXCoord() + xDir + 2.1F) - (tRandom.nextFloat() * 3.2F), - aBaseMetaTileEntity.getYCoord() + 2.5f + (tRandom.nextFloat() * 1.2F), - (aBaseMetaTileEntity.getZCoord() + zDir + 2.1F) - (tRandom.nextFloat() * 3.2F), - 0.0, - 0.0, - 0.0); - } - } - - @Override - protected ProcessingLogic createProcessingLogic() { - return new ProcessingLogic().setSpeedBonus(1F / 5F) - .setEuModifier(0.75F) - .setMaxParallelSupplier(this::getMaxParallelRecipes); - } - - @Override - public int getMaxParallelRecipes() { - return (4 * GT_Utility.getTier(this.getMaxInputVoltage())); - } - - @Override - public int getMaxEfficiency(final ItemStack aStack) { - return 10000; - } - - @Override - public int getPollutionPerSecond(final ItemStack aStack) { - return CORE.ConfigSwitches.pollutionPerSecondMultiIndustrialSifter; - } - - @Override - public boolean explodesOnComponentBreak(final ItemStack aStack) { - return false; - } - - @Override - public boolean isOverclockerUpgradable() { - return true; - } -} diff --git a/gtpp/src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/processing/GregtechMetaTileEntity_IndustrialThermalCentrifuge.java b/gtpp/src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/processing/GregtechMetaTileEntity_IndustrialThermalCentrifuge.java deleted file mode 100644 index 14ff4ebb6d..0000000000 --- a/gtpp/src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/processing/GregtechMetaTileEntity_IndustrialThermalCentrifuge.java +++ /dev/null @@ -1,184 +0,0 @@ -package gtPlusPlus.xmod.gregtech.common.tileentities.machines.multi.processing; - -import static com.gtnewhorizon.structurelib.structure.StructureUtility.ofBlock; -import static com.gtnewhorizon.structurelib.structure.StructureUtility.ofChain; -import static com.gtnewhorizon.structurelib.structure.StructureUtility.onElementPass; -import static com.gtnewhorizon.structurelib.structure.StructureUtility.transpose; -import static gregtech.api.enums.GT_HatchElement.Energy; -import static gregtech.api.enums.GT_HatchElement.InputBus; -import static gregtech.api.enums.GT_HatchElement.Maintenance; -import static gregtech.api.enums.GT_HatchElement.Muffler; -import static gregtech.api.enums.GT_HatchElement.OutputBus; -import static gregtech.api.util.GT_StructureUtility.buildHatchAdder; - -import net.minecraft.block.Block; -import net.minecraft.item.ItemStack; - -import com.gtnewhorizon.structurelib.alignment.constructable.ISurvivalConstructable; -import com.gtnewhorizon.structurelib.structure.IStructureDefinition; -import com.gtnewhorizon.structurelib.structure.ISurvivalBuildEnvironment; -import com.gtnewhorizon.structurelib.structure.StructureDefinition; - -import gregtech.api.GregTech_API; -import gregtech.api.enums.TAE; -import gregtech.api.interfaces.IIconContainer; -import gregtech.api.interfaces.metatileentity.IMetaTileEntity; -import gregtech.api.interfaces.tileentity.IGregTechTileEntity; -import gregtech.api.logic.ProcessingLogic; -import gregtech.api.recipe.RecipeMap; -import gregtech.api.recipe.RecipeMaps; -import gregtech.api.util.GT_Multiblock_Tooltip_Builder; -import gregtech.api.util.GT_Utility; -import gtPlusPlus.core.block.ModBlocks; -import gtPlusPlus.core.lib.CORE; -import gtPlusPlus.xmod.gregtech.api.metatileentity.implementations.base.GregtechMeta_MultiBlockBase; -import gtPlusPlus.xmod.gregtech.common.blocks.textures.TexturesGtBlock; - -public class GregtechMetaTileEntity_IndustrialThermalCentrifuge extends - GregtechMeta_MultiBlockBase<GregtechMetaTileEntity_IndustrialThermalCentrifuge> implements ISurvivalConstructable { - - private int mCasing; - private static IStructureDefinition<GregtechMetaTileEntity_IndustrialThermalCentrifuge> STRUCTURE_DEFINITION = null; - - public GregtechMetaTileEntity_IndustrialThermalCentrifuge(final int aID, final String aName, - final String aNameRegional) { - super(aID, aName, aNameRegional); - } - - public GregtechMetaTileEntity_IndustrialThermalCentrifuge(final String aName) { - super(aName); - } - - @Override - public IMetaTileEntity newMetaEntity(final IGregTechTileEntity aTileEntity) { - return new GregtechMetaTileEntity_IndustrialThermalCentrifuge(this.mName); - } - - @Override - public String getMachineType() { - return "Thermal Centrifuge"; - } - - @Override - protected GT_Multiblock_Tooltip_Builder createTooltip() { - GT_Multiblock_Tooltip_Builder tt = new GT_Multiblock_Tooltip_Builder(); - tt.addMachineType(getMachineType()) - .addInfo("Controller Block for the Industrial Thermal Centrifuge") - .addInfo("150% faster than using single block machines of the same voltage") - .addInfo("Only uses 80% of the EU/t normally required") - .addInfo("Processes eight items per voltage tier") - .addPollutionAmount(getPollutionPerSecond(null)) - .addSeparator() - .beginStructureBlock(3, 2, 3, false) - .addController("Front Center") - .addCasingInfoMin("Thermal Processing Casings/Noise Hazard Sign Blocks", 8, false) - .addInputBus("Bottom Casing", 1) - .addOutputBus("Bottom Casing", 1) - .addEnergyHatch("Bottom Casing", 1) - .addMaintenanceHatch("Bottom Casing", 1) - .addMufflerHatch("Bottom Casing", 1) - .toolTipFinisher(CORE.GT_Tooltip_Builder.get()); - return tt; - } - - @Override - public IStructureDefinition<GregtechMetaTileEntity_IndustrialThermalCentrifuge> getStructureDefinition() { - if (STRUCTURE_DEFINITION == null) { - STRUCTURE_DEFINITION = StructureDefinition.<GregtechMetaTileEntity_IndustrialThermalCentrifuge>builder() - .addShape(mName, transpose(new String[][] { { "X~X", "XXX", "XXX" }, { "CCC", "CCC", "CCC" }, })) - .addElement( - 'C', - ofChain( - buildHatchAdder(GregtechMetaTileEntity_IndustrialThermalCentrifuge.class) - .atLeast(InputBus, OutputBus, Maintenance, Energy, Muffler) - .casingIndex(getCasingTextureIndex()) - .dot(1) - .build(), - onElementPass(x -> ++x.mCasing, ofBlock(ModBlocks.blockCasings2Misc, 0)), - onElementPass(x -> ++x.mCasing, ofBlock(GregTech_API.sBlockCasings3, 9)))) - .addElement( - 'X', - ofChain( - onElementPass(x -> ++x.mCasing, ofBlock(ModBlocks.blockCasings2Misc, 0)), - onElementPass(x -> ++x.mCasing, ofBlock(GregTech_API.sBlockCasings3, 9)))) - .build(); - } - return STRUCTURE_DEFINITION; - } - - @Override - public void construct(ItemStack stackSize, boolean hintsOnly) { - buildPiece(mName, stackSize, hintsOnly, 1, 0, 0); - } - - @Override - public int survivalConstruct(ItemStack stackSize, int elementBudget, ISurvivalBuildEnvironment env) { - if (mMachine) return -1; - return survivialBuildPiece(mName, stackSize, 1, 0, 0, elementBudget, env, false, true); - } - - @Override - public boolean checkMachine(IGregTechTileEntity aBaseMetaTileEntity, ItemStack aStack) { - mCasing = 0; - return checkPiece(mName, 1, 0, 0) && mCasing >= 8 && checkHatch(); - } - - @Override - protected IIconContainer getActiveOverlay() { - return TexturesGtBlock.Overlay_Machine_Controller_Default_Active; - } - - @Override - protected IIconContainer getInactiveOverlay() { - return TexturesGtBlock.Overlay_Machine_Controller_Default; - } - - @Override - protected int getCasingTextureId() { - return getCasingTextureIndex(); - } - - @Override - public RecipeMap<?> getRecipeMap() { - return RecipeMaps.thermalCentrifugeRecipes; - } - - @Override - protected ProcessingLogic createProcessingLogic() { - return new ProcessingLogic().setSpeedBonus(1F / 2.5F) - .setEuModifier(0.8F) - .setMaxParallelSupplier(this::getMaxParallelRecipes); - } - - @Override - public int getMaxParallelRecipes() { - return (8 * GT_Utility.getTier(this.getMaxInputVoltage())); - } - - @Override - public int getMaxEfficiency(final ItemStack aStack) { - return 10000; - } - - @Override - public int getPollutionPerSecond(final ItemStack aStack) { - return CORE.ConfigSwitches.pollutionPerSecondMultiIndustrialThermalCentrifuge; - } - - @Override - public boolean explodesOnComponentBreak(final ItemStack aStack) { - return false; - } - - public Block getCasingBlock() { - return ModBlocks.blockCasings2Misc; - } - - public byte getCasingMeta() { - return 0; - } - - public byte getCasingTextureIndex() { - return (byte) TAE.GTPP_INDEX(16); - } -} diff --git a/gtpp/src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/processing/GregtechMetaTileEntity_IndustrialVacuumFreezer.java b/gtpp/src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/processing/GregtechMetaTileEntity_IndustrialVacuumFreezer.java deleted file mode 100644 index aba508e183..0000000000 --- a/gtpp/src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/processing/GregtechMetaTileEntity_IndustrialVacuumFreezer.java +++ /dev/null @@ -1,261 +0,0 @@ -package gtPlusPlus.xmod.gregtech.common.tileentities.machines.multi.processing; - -import static com.gtnewhorizon.structurelib.structure.StructureUtility.ofBlock; -import static com.gtnewhorizon.structurelib.structure.StructureUtility.ofChain; -import static com.gtnewhorizon.structurelib.structure.StructureUtility.onElementPass; -import static com.gtnewhorizon.structurelib.structure.StructureUtility.transpose; -import static gregtech.api.enums.GT_HatchElement.Energy; -import static gregtech.api.enums.GT_HatchElement.InputBus; -import static gregtech.api.enums.GT_HatchElement.InputHatch; -import static gregtech.api.enums.GT_HatchElement.Maintenance; -import static gregtech.api.enums.GT_HatchElement.Muffler; -import static gregtech.api.enums.GT_HatchElement.OutputBus; -import static gregtech.api.enums.GT_HatchElement.OutputHatch; -import static gregtech.api.util.GT_StructureUtility.buildHatchAdder; -import static gregtech.api.util.GT_Utility.filterValidMTEs; - -import java.util.ArrayList; -import java.util.Objects; - -import net.minecraft.item.ItemStack; -import net.minecraftforge.fluids.FluidStack; - -import com.gtnewhorizon.structurelib.alignment.constructable.ISurvivalConstructable; -import com.gtnewhorizon.structurelib.structure.IStructureDefinition; -import com.gtnewhorizon.structurelib.structure.ISurvivalBuildEnvironment; -import com.gtnewhorizon.structurelib.structure.StructureDefinition; - -import gregtech.api.enums.TAE; -import gregtech.api.interfaces.IIconContainer; -import gregtech.api.interfaces.metatileentity.IMetaTileEntity; -import gregtech.api.interfaces.tileentity.IGregTechTileEntity; -import gregtech.api.logic.ProcessingLogic; -import gregtech.api.recipe.RecipeMap; -import gregtech.api.util.GT_Multiblock_Tooltip_Builder; -import gregtech.api.util.shutdown.ShutDownReasonRegistry; -import gtPlusPlus.api.recipe.GTPPRecipeMaps; -import gtPlusPlus.core.block.ModBlocks; -import gtPlusPlus.core.lib.CORE; -import gtPlusPlus.core.util.minecraft.FluidUtils; -import gtPlusPlus.xmod.gregtech.api.metatileentity.implementations.base.GT_MetaTileEntity_Hatch_CustomFluidBase; -import gtPlusPlus.xmod.gregtech.api.metatileentity.implementations.base.GregtechMeta_MultiBlockBase; -import gtPlusPlus.xmod.gregtech.common.blocks.textures.TexturesGtBlock; - -public class GregtechMetaTileEntity_IndustrialVacuumFreezer extends - GregtechMeta_MultiBlockBase<GregtechMetaTileEntity_IndustrialVacuumFreezer> implements ISurvivalConstructable { - - public static int CASING_TEXTURE_ID; - public static String mCryoFuelName = "Gelid Cryotheum"; - public static String mCasingName = "Advanced Cryogenic Casing"; - public static String mHatchName = "Cryotheum Hatch"; - public static FluidStack mFuelStack; - private int mCasing; - private static IStructureDefinition<GregtechMetaTileEntity_IndustrialVacuumFreezer> STRUCTURE_DEFINITION = null; - - private final ArrayList<GT_MetaTileEntity_Hatch_CustomFluidBase> mCryotheumHatches = new ArrayList<>(); - - public GregtechMetaTileEntity_IndustrialVacuumFreezer(final int aID, final String aName, - final String aNameRegional) { - super(aID, aName, aNameRegional); - mFuelStack = FluidUtils.getFluidStack("cryotheum", 1); - CASING_TEXTURE_ID = TAE.getIndexFromPage(2, 10); - } - - public GregtechMetaTileEntity_IndustrialVacuumFreezer(final String aName) { - super(aName); - mFuelStack = FluidUtils.getFluidStack("cryotheum", 1); - CASING_TEXTURE_ID = TAE.getIndexFromPage(2, 10); - } - - @Override - public IMetaTileEntity newMetaEntity(final IGregTechTileEntity aTileEntity) { - return (IMetaTileEntity) new GregtechMetaTileEntity_IndustrialVacuumFreezer(this.mName); - } - - @Override - public String getMachineType() { - return "Vacuum Freezer"; - } - - @Override - protected GT_Multiblock_Tooltip_Builder createTooltip() { - GT_Multiblock_Tooltip_Builder tt = new GT_Multiblock_Tooltip_Builder(); - tt.addMachineType(getMachineType()) - .addInfo("Factory Grade Advanced Vacuum Freezer") - .addInfo("Speed: +100% | EU Usage: 100% | Parallel: 4") - .addInfo("Consumes 20L of " + mCryoFuelName + "/s during operation") - .addInfo("Constructed exactly the same as a normal Vacuum Freezer") - .addPollutionAmount(getPollutionPerSecond(null)) - .addSeparator() - .beginStructureBlock(3, 3, 3, true) - .addController("Front Center") - .addCasingInfoMin(mCasingName, 10, false) - .addInputBus("Any Casing", 1) - .addOutputBus("Any Casing", 1) - .addInputHatch("Any Casing", 1) - .addOutputHatch("Any Casing", 1) - .addEnergyHatch("Any Casing", 1) - .addMufflerHatch("Any Casing", 1) - .addMaintenanceHatch("Any Casing", 1) - .addOtherStructurePart(mHatchName, "Any Casing", 1) - .toolTipFinisher(CORE.GT_Tooltip_Builder.get()); - return tt; - } - - @Override - public IStructureDefinition<GregtechMetaTileEntity_IndustrialVacuumFreezer> getStructureDefinition() { - if (STRUCTURE_DEFINITION == null) { - STRUCTURE_DEFINITION = StructureDefinition.<GregtechMetaTileEntity_IndustrialVacuumFreezer>builder() - .addShape( - mName, - transpose( - new String[][] { { "CCC", "CCC", "CCC" }, { "C~C", "C-C", "CCC" }, { "CCC", "CCC", "CCC" }, })) - .addElement( - 'C', - ofChain( - buildHatchAdder(GregtechMetaTileEntity_IndustrialVacuumFreezer.class) - .adder(GregtechMetaTileEntity_IndustrialVacuumFreezer::addCryotheumHatch) - .hatchId(967) - .shouldReject(t -> !t.mCryotheumHatches.isEmpty()) - .casingIndex(CASING_TEXTURE_ID) - .dot(1) - .build(), - buildHatchAdder(GregtechMetaTileEntity_IndustrialVacuumFreezer.class) - .atLeast(InputBus, OutputBus, Maintenance, Energy, Muffler, InputHatch, OutputHatch) - .casingIndex(CASING_TEXTURE_ID) - .dot(1) - .build(), - onElementPass(x -> ++x.mCasing, ofBlock(ModBlocks.blockCasings3Misc, 10)))) - .build(); - } - return STRUCTURE_DEFINITION; - } - - @Override - public void construct(ItemStack stackSize, boolean hintsOnly) { - buildPiece(mName, stackSize, hintsOnly, 1, 1, 0); - } - - @Override - public int survivalConstruct(ItemStack stackSize, int elementBudget, ISurvivalBuildEnvironment env) { - if (mMachine) return -1; - return survivialBuildPiece(mName, stackSize, 1, 1, 0, elementBudget, env, false, true); - } - - @Override - public boolean checkMachine(IGregTechTileEntity aBaseMetaTileEntity, ItemStack aStack) { - mCasing = 0; - mCryotheumHatches.clear(); - return checkPiece(mName, 1, 1, 0) && mCasing >= 10 && checkHatch(); - } - - @Override - public boolean checkHatch() { - return super.checkHatch() && !mCryotheumHatches.isEmpty(); - } - - private boolean addCryotheumHatch(IGregTechTileEntity aTileEntity, int aBaseCasingIndex) { - if (aTileEntity == null) { - return false; - } else { - IMetaTileEntity aMetaTileEntity = aTileEntity.getMetaTileEntity(); - if (aMetaTileEntity instanceof GT_MetaTileEntity_Hatch_CustomFluidBase - && aMetaTileEntity.getBaseMetaTileEntity() - .getMetaTileID() == 967) { - return addToMachineListInternal(mCryotheumHatches, aTileEntity, aBaseCasingIndex); - } - } - return false; - } - - @Override - public void updateSlots() { - for (GT_MetaTileEntity_Hatch_CustomFluidBase tHatch : filterValidMTEs(mCryotheumHatches)) tHatch.updateSlots(); - super.updateSlots(); - } - - @Override - protected IIconContainer getActiveOverlay() { - return TexturesGtBlock.Overlay_Machine_Controller_Advanced_Active; - } - - @Override - protected IIconContainer getInactiveOverlay() { - return TexturesGtBlock.Overlay_Machine_Controller_Advanced; - } - - @Override - protected int getCasingTextureId() { - return CASING_TEXTURE_ID; - } - - @Override - public RecipeMap<?> getRecipeMap() { - return GTPPRecipeMaps.advancedFreezerRecipes; - } - - @Override - public boolean isCorrectMachinePart(final ItemStack aStack) { - return true; - } - - @Override - protected ProcessingLogic createProcessingLogic() { - return new ProcessingLogic().setSpeedBonus(1F / 2F) - .setMaxParallelSupplier(this::getMaxParallelRecipes); - } - - @Override - public int getMaxParallelRecipes() { - return 4; - } - - @Override - public int getMaxEfficiency(final ItemStack aStack) { - return 10000; - } - - @Override - public int getPollutionPerSecond(final ItemStack aStack) { - return CORE.ConfigSwitches.pollutionPerSecondMultiIndustrialVacuumFreezer; - } - - @Override - public int getDamageToComponent(final ItemStack aStack) { - return 0; - } - - @Override - public boolean explodesOnComponentBreak(final ItemStack aStack) { - return false; - } - - private int mGraceTimer = 2; - - @Override - public void onPostTick(IGregTechTileEntity aBaseMetaTileEntity, long aTick) { - /* - * if (this.getBaseMetaTileEntity().isActive()) { if (!this.depleteInput(mFuelStack.copy())) { - * this.getBaseMetaTileEntity().setActive(false); } } - */ - super.onPostTick(aBaseMetaTileEntity, aTick); - - if (this.mStartUpCheck < 0) { - if (this.mMaxProgresstime > 0 && this.mProgresstime != 0 || this.getBaseMetaTileEntity() - .hasWorkJustBeenEnabled()) { - if (aTick % 10 == 0 || this.getBaseMetaTileEntity() - .hasWorkJustBeenEnabled()) { - if (!this.depleteInputFromRestrictedHatches(this.mCryotheumHatches, 10)) { - if (mGraceTimer-- == 0) { - this.causeMaintenanceIssue(); - this.stopMachine( - ShutDownReasonRegistry - .outOfFluid(Objects.requireNonNull(FluidUtils.getFluidStack("cryotheum", 20)))); - mGraceTimer = 2; - } - } - } - } - } - } -} diff --git a/gtpp/src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/processing/GregtechMetaTileEntity_IndustrialWashPlant.java b/gtpp/src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/processing/GregtechMetaTileEntity_IndustrialWashPlant.java deleted file mode 100644 index a12db63f4e..0000000000 --- a/gtpp/src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/processing/GregtechMetaTileEntity_IndustrialWashPlant.java +++ /dev/null @@ -1,372 +0,0 @@ -package gtPlusPlus.xmod.gregtech.common.tileentities.machines.multi.processing; - -import static com.gtnewhorizon.structurelib.structure.StructureUtility.isAir; -import static com.gtnewhorizon.structurelib.structure.StructureUtility.ofBlock; -import static com.gtnewhorizon.structurelib.structure.StructureUtility.ofBlockAnyMeta; -import static com.gtnewhorizon.structurelib.structure.StructureUtility.ofChain; -import static com.gtnewhorizon.structurelib.structure.StructureUtility.onElementPass; -import static com.gtnewhorizon.structurelib.structure.StructureUtility.transpose; -import static gregtech.api.enums.GT_HatchElement.Energy; -import static gregtech.api.enums.GT_HatchElement.InputBus; -import static gregtech.api.enums.GT_HatchElement.InputHatch; -import static gregtech.api.enums.GT_HatchElement.Maintenance; -import static gregtech.api.enums.GT_HatchElement.Muffler; -import static gregtech.api.enums.GT_HatchElement.OutputBus; -import static gregtech.api.enums.GT_HatchElement.OutputHatch; -import static gregtech.api.util.GT_StructureUtility.buildHatchAdder; - -import java.util.Arrays; -import java.util.Collection; - -import javax.annotation.Nonnull; - -import net.minecraft.block.Block; -import net.minecraft.entity.player.EntityPlayer; -import net.minecraft.init.Blocks; -import net.minecraft.item.ItemStack; -import net.minecraft.nbt.NBTTagCompound; -import net.minecraftforge.common.util.ForgeDirection; -import net.minecraftforge.fluids.FluidStack; - -import org.jetbrains.annotations.NotNull; - -import com.gtnewhorizon.structurelib.alignment.IAlignmentLimits; -import com.gtnewhorizon.structurelib.alignment.constructable.ISurvivalConstructable; -import com.gtnewhorizon.structurelib.structure.IStructureDefinition; -import com.gtnewhorizon.structurelib.structure.ISurvivalBuildEnvironment; -import com.gtnewhorizon.structurelib.structure.StructureDefinition; - -import gregtech.api.enums.TAE; -import gregtech.api.interfaces.IIconContainer; -import gregtech.api.interfaces.metatileentity.IMetaTileEntity; -import gregtech.api.interfaces.tileentity.IGregTechTileEntity; -import gregtech.api.logic.ProcessingLogic; -import gregtech.api.recipe.RecipeMap; -import gregtech.api.recipe.RecipeMaps; -import gregtech.api.recipe.check.CheckRecipeResult; -import gregtech.api.recipe.check.CheckRecipeResultRegistry; -import gregtech.api.recipe.check.SimpleCheckRecipeResult; -import gregtech.api.util.GT_Multiblock_Tooltip_Builder; -import gregtech.api.util.GT_Recipe; -import gregtech.api.util.GT_Utility; -import gtPlusPlus.api.objects.Logger; -import gtPlusPlus.api.recipe.GTPPRecipeMaps; -import gtPlusPlus.core.block.ModBlocks; -import gtPlusPlus.core.lib.CORE; -import gtPlusPlus.core.util.minecraft.FluidUtils; -import gtPlusPlus.core.util.minecraft.PlayerUtils; -import gtPlusPlus.xmod.gregtech.api.metatileentity.implementations.base.GregtechMeta_MultiBlockBase; -import gtPlusPlus.xmod.gregtech.common.blocks.textures.TexturesGtBlock; -import ic2.core.init.BlocksItems; -import ic2.core.init.InternalName; - -public class GregtechMetaTileEntity_IndustrialWashPlant - extends GregtechMeta_MultiBlockBase<GregtechMetaTileEntity_IndustrialWashPlant> implements ISurvivalConstructable { - - private int mMode = 0; - private int mCasing; - private static IStructureDefinition<GregtechMetaTileEntity_IndustrialWashPlant> STRUCTURE_DEFINITION = null; - - public GregtechMetaTileEntity_IndustrialWashPlant(final int aID, final String aName, final String aNameRegional) { - super(aID, aName, aNameRegional); - } - - public GregtechMetaTileEntity_IndustrialWashPlant(final String aName) { - super(aName); - } - - @Override - public IMetaTileEntity newMetaEntity(final IGregTechTileEntity aTileEntity) { - return new GregtechMetaTileEntity_IndustrialWashPlant(this.mName); - } - - @Override - public String getMachineType() { - return "Ore Washer, Simple Washer, Chemical Bath"; - } - - @Override - protected GT_Multiblock_Tooltip_Builder createTooltip() { - GT_Multiblock_Tooltip_Builder tt = new GT_Multiblock_Tooltip_Builder(); - tt.addMachineType(getMachineType()) - .addInfo("Controller Block for the Industrial Wash Plant") - .addInfo("Can be configured with a screwdriver to also do Simple Washer and process Chemical Bathing") - .addInfo("400% faster than using single block machines of the same voltage") - .addInfo("Processes four item per voltage tier") - .addInfo("Always requires an Input Hatch full of water to refill structure") - .addInfo("Need to be filled with water.") - .addInfo("Will automatically fill water from input hatch.") - .addPollutionAmount(getPollutionPerSecond(null)) - .addSeparator() - .beginStructureBlock(5, 3, 7, true) - .addController("Front Center") - .addCasingInfoMin("Wash Plant Casings", 40, false) - .addInputBus("Any Casing", 1) - .addOutputBus("Any Casing", 1) - .addInputHatch("Any Casing", 1) - .addOutputHatch("Any Casing", 1) - .addEnergyHatch("Any Casing", 1) - .addMaintenanceHatch("Any Casing", 1) - .addMufflerHatch("Any Casing", 1) - .toolTipFinisher(CORE.GT_Tooltip_Builder.get()); - return tt; - } - - @Override - public IStructureDefinition<GregtechMetaTileEntity_IndustrialWashPlant> getStructureDefinition() { - if (STRUCTURE_DEFINITION == null) { - STRUCTURE_DEFINITION = StructureDefinition.<GregtechMetaTileEntity_IndustrialWashPlant>builder() - .addShape( - mName, - transpose( - new String[][] { { "CCCCC", "CwwwC", "CwwwC", "CwwwC", "CwwwC", "CwwwC", "CCCCC" }, - { "CC~CC", "CwwwC", "CwwwC", "CwwwC", "CwwwC", "CwwwC", "CCCCC" }, - { "CCCCC", "CCCCC", "CCCCC", "CCCCC", "CCCCC", "CCCCC", "CCCCC" }, })) - .addElement( - 'C', - buildHatchAdder(GregtechMetaTileEntity_IndustrialWashPlant.class) - .atLeast(InputBus, InputHatch, OutputHatch, OutputBus, Maintenance, Energy, Muffler) - .casingIndex(getCasingTextureIndex()) - .dot(1) - .buildAndChain(onElementPass(x -> ++x.mCasing, ofBlock(getCasingBlock(), getCasingMeta())))) - .addElement( - 'w', - ofChain( - isAir(), - ofBlockAnyMeta(Blocks.water), - ofBlockAnyMeta(Blocks.flowing_water), - ofBlockAnyMeta(BlocksItems.getFluidBlock(InternalName.fluidDistilledWater)))) - .build(); - } - return STRUCTURE_DEFINITION; - } - - @Override - public void construct(ItemStack stackSize, boolean hintsOnly) { - buildPiece(mName, stackSize, hintsOnly, 2, 1, 0); - } - - @Override - public int survivalConstruct(ItemStack stackSize, int elementBudget, ISurvivalBuildEnvironment env) { - if (mMachine) return -1; - return survivialBuildPiece(mName, stackSize, 2, 1, 0, elementBudget, env, false, true); - } - - @Override - public boolean checkMachine(IGregTechTileEntity aBaseMetaTileEntity, ItemStack aStack) { - mCasing = 0; - return checkPiece(mName, 2, 1, 0) && mCasing >= 40 && checkHatch(); - } - - @Override - protected IAlignmentLimits getInitialAlignmentLimits() { - // don't rotate a washer, water will flow out. - return (d, r, f) -> d.offsetY == 0 && r.isNotRotated() && !f.isVerticallyFliped(); - } - - @Override - protected IIconContainer getActiveOverlay() { - return TexturesGtBlock.Overlay_Machine_Controller_Default_Active; - } - - @Override - protected IIconContainer getInactiveOverlay() { - return TexturesGtBlock.Overlay_Machine_Controller_Default; - } - - @Override - protected int getCasingTextureId() { - return getCasingTextureIndex(); - } - - @Override - public RecipeMap<?> getRecipeMap() { - return mMode == 0 ? RecipeMaps.oreWasherRecipes - : mMode == 1 ? GTPPRecipeMaps.simpleWasherRecipes : RecipeMaps.chemicalBathRecipes; - } - - @Nonnull - @Override - public Collection<RecipeMap<?>> getAvailableRecipeMaps() { - return Arrays - .asList(RecipeMaps.oreWasherRecipes, GTPPRecipeMaps.simpleWasherRecipes, RecipeMaps.chemicalBathRecipes); - } - - @Override - public int getRecipeCatalystPriority() { - return -10; - } - - @Override - protected ProcessingLogic createProcessingLogic() { - return new ProcessingLogic() { - - @NotNull - @Override - protected CheckRecipeResult validateRecipe(@NotNull GT_Recipe recipe) { - if (checkForWater()) { - return CheckRecipeResultRegistry.SUCCESSFUL; - } - return SimpleCheckRecipeResult.ofFailure("no_water"); - } - }.setSpeedBonus(1F / 5F) - .setMaxParallelSupplier(this::getMaxParallelRecipes); - } - - @Override - public int getMaxParallelRecipes() { - return (4 * GT_Utility.getTier(this.getMaxInputVoltage())); - } - - @Override - public int getMaxEfficiency(final ItemStack aStack) { - return 10000; - } - - @Override - public int getPollutionPerSecond(final ItemStack aStack) { - if (mMode == 2) return CORE.ConfigSwitches.pollutionPerSecondMultiIndustrialWashPlant_ModeChemBath; - return CORE.ConfigSwitches.pollutionPerSecondMultiIndustrialWashPlant_ModeWasher; - } - - @Override - public boolean explodesOnComponentBreak(final ItemStack aStack) { - return false; - } - - public Block getCasingBlock() { - return ModBlocks.blockCasings2Misc; - } - - public byte getCasingMeta() { - return 4; - } - - public byte getCasingTextureIndex() { - return (byte) TAE.GTPP_INDEX(11); - } - - public boolean checkForWater() { - - // Get Facing direction - IGregTechTileEntity aBaseMetaTileEntity = this.getBaseMetaTileEntity(); - int mDirectionX = aBaseMetaTileEntity.getBackFacing().offsetX; - int mCurrentDirectionX; - int mCurrentDirectionZ; - int mOffsetX_Lower = 0; - int mOffsetX_Upper = 0; - int mOffsetZ_Lower = 0; - int mOffsetZ_Upper = 0; - - if (mDirectionX == 0) { - mCurrentDirectionX = 2; - mCurrentDirectionZ = 3; - mOffsetX_Lower = -2; - mOffsetX_Upper = 2; - mOffsetZ_Lower = -3; - mOffsetZ_Upper = 3; - } else { - mCurrentDirectionX = 3; - mCurrentDirectionZ = 2; - mOffsetX_Lower = -3; - mOffsetX_Upper = 3; - mOffsetZ_Lower = -2; - mOffsetZ_Upper = 2; - } - - // if (aBaseMetaTileEntity.fac) - - final int xDir = aBaseMetaTileEntity.getBackFacing().offsetX * mCurrentDirectionX; - final int zDir = aBaseMetaTileEntity.getBackFacing().offsetZ * mCurrentDirectionZ; - - int tAmount = 0; - for (int i = mOffsetX_Lower + 1; i <= mOffsetX_Upper - 1; ++i) { - for (int j = mOffsetZ_Lower + 1; j <= mOffsetZ_Upper - 1; ++j) { - for (int h = 0; h < 2; ++h) { - Block tBlock = aBaseMetaTileEntity.getBlockOffset(xDir + i, h, zDir + j); - byte tMeta = aBaseMetaTileEntity.getMetaIDOffset(xDir + i, h, zDir + j); - if (tBlock == Blocks.air || tBlock == Blocks.flowing_water || tBlock == Blocks.water) { - if (this.getStoredFluids() != null) { - for (FluidStack stored : this.getStoredFluids()) { - if (stored.isFluidEqual(FluidUtils.getFluidStack("water", 1))) { - if (stored.amount >= 1000) { - // Utils.LOG_WARNING("Going to try swap an air block for water from inut bus."); - stored.amount -= 1000; - Block fluidUsed = null; - if (tBlock == Blocks.air || tBlock == Blocks.flowing_water) { - fluidUsed = Blocks.water; - } - if (tBlock == Blocks.water) { - fluidUsed = BlocksItems.getFluidBlock(InternalName.fluidDistilledWater); - } - aBaseMetaTileEntity.getWorld() - .setBlock( - aBaseMetaTileEntity.getXCoord() + xDir + i, - aBaseMetaTileEntity.getYCoord() + h, - aBaseMetaTileEntity.getZCoord() + zDir + j, - fluidUsed); - } - } - } - } - } - if (tBlock == Blocks.water) { - ++tAmount; - // Utils.LOG_WARNING("Found Water"); - } else if (tBlock == BlocksItems.getFluidBlock(InternalName.fluidDistilledWater)) { - ++tAmount; - ++tAmount; - // Utils.LOG_WARNING("Found Distilled Water"); - } - } - } - } - - boolean isValidWater = tAmount >= 45; - if (isValidWater) { - Logger.WARNING("Filled structure."); - } else { - Logger.WARNING("Did not fill structure."); - } - return isValidWater; - } - - @Override - public void saveNBTData(NBTTagCompound aNBT) { - aNBT.setInteger("mMode", mMode); - super.saveNBTData(aNBT); - } - - @Override - public void loadNBTData(NBTTagCompound aNBT) { - if (aNBT.hasKey("mChemicalMode")) { - boolean aTempMode = aNBT.getBoolean("mChemicalMode"); - if (aTempMode) { - mMode = 2; - } else { - mMode = 0; - } - aNBT.removeTag("mChemicalMode"); - } - if (aNBT.hasKey("mMode")) { - mMode = aNBT.getInteger("mMode"); - } - super.loadNBTData(aNBT); - } - - @Override - public void onModeChangeByScrewdriver(ForgeDirection side, EntityPlayer aPlayer, float aX, float aY, float aZ) { - mMode++; - if (mMode > 2) { - mMode = 0; - } - if (mMode == 0) { - PlayerUtils.messagePlayer(aPlayer, "Wash Plant is now running in Ore Washer Mode."); - } else if (mMode == 1) { - PlayerUtils.messagePlayer(aPlayer, "Wash Plant is now running in Simple Washer Mode."); - } else { - PlayerUtils.messagePlayer(aPlayer, "Wash Plant is now running in Chemical Bath Mode."); - } - mLastRecipe = null; - } -} diff --git a/gtpp/src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/processing/GregtechMetaTileEntity_IndustrialWireMill.java b/gtpp/src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/processing/GregtechMetaTileEntity_IndustrialWireMill.java deleted file mode 100644 index 15ae5a96f8..0000000000 --- a/gtpp/src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/processing/GregtechMetaTileEntity_IndustrialWireMill.java +++ /dev/null @@ -1,215 +0,0 @@ -package gtPlusPlus.xmod.gregtech.common.tileentities.machines.multi.processing; - -import static com.gtnewhorizon.structurelib.structure.StructureUtility.ofBlock; -import static com.gtnewhorizon.structurelib.structure.StructureUtility.onElementPass; -import static com.gtnewhorizon.structurelib.structure.StructureUtility.transpose; -import static gregtech.api.enums.GT_HatchElement.Energy; -import static gregtech.api.enums.GT_HatchElement.InputBus; -import static gregtech.api.enums.GT_HatchElement.Maintenance; -import static gregtech.api.enums.GT_HatchElement.Muffler; -import static gregtech.api.enums.GT_HatchElement.OutputBus; -import static gregtech.api.util.GT_StructureUtility.buildHatchAdder; - -import net.minecraft.block.Block; -import net.minecraft.entity.player.EntityPlayer; -import net.minecraft.item.ItemStack; -import net.minecraft.nbt.NBTTagCompound; -import net.minecraft.util.ChatComponentTranslation; -import net.minecraftforge.common.util.ForgeDirection; - -import com.gtnewhorizon.structurelib.alignment.constructable.ISurvivalConstructable; -import com.gtnewhorizon.structurelib.structure.IStructureDefinition; -import com.gtnewhorizon.structurelib.structure.ISurvivalBuildEnvironment; -import com.gtnewhorizon.structurelib.structure.StructureDefinition; - -import gregtech.api.enums.SoundResource; -import gregtech.api.enums.TAE; -import gregtech.api.interfaces.IIconContainer; -import gregtech.api.interfaces.metatileentity.IMetaTileEntity; -import gregtech.api.interfaces.tileentity.IGregTechTileEntity; -import gregtech.api.logic.ProcessingLogic; -import gregtech.api.recipe.RecipeMap; -import gregtech.api.recipe.RecipeMaps; -import gregtech.api.util.GT_Multiblock_Tooltip_Builder; -import gregtech.api.util.GT_Utility; -import gtPlusPlus.core.block.ModBlocks; -import gtPlusPlus.core.lib.CORE; -import gtPlusPlus.xmod.gregtech.api.metatileentity.implementations.base.GregtechMeta_MultiBlockBase; -import gtPlusPlus.xmod.gregtech.common.blocks.textures.TexturesGtBlock; - -public class GregtechMetaTileEntity_IndustrialWireMill - extends GregtechMeta_MultiBlockBase<GregtechMetaTileEntity_IndustrialWireMill> implements ISurvivalConstructable { - - private int mCasing; - private static IStructureDefinition<GregtechMetaTileEntity_IndustrialWireMill> STRUCTURE_DEFINITION = null; - - public GregtechMetaTileEntity_IndustrialWireMill(final int aID, final String aName, final String aNameRegional) { - super(aID, aName, aNameRegional); - inputSeparation = true; - } - - public GregtechMetaTileEntity_IndustrialWireMill(final String aName) { - super(aName); - inputSeparation = true; - } - - @Override - public IMetaTileEntity newMetaEntity(final IGregTechTileEntity aTileEntity) { - return new GregtechMetaTileEntity_IndustrialWireMill(this.mName); - } - - @Override - public String getMachineType() { - return "Wiremill"; - } - - @Override - protected GT_Multiblock_Tooltip_Builder createTooltip() { - GT_Multiblock_Tooltip_Builder tt = new GT_Multiblock_Tooltip_Builder(); - tt.addMachineType(getMachineType()) - .addInfo("Controller Block for the Industrial Wire Factory") - .addInfo("200% faster than using single block machines of the same voltage") - .addInfo("Only uses 75% of the EU/t normally required") - .addInfo("Processes four items per voltage tier") - .addPollutionAmount(getPollutionPerSecond(null)) - .addSeparator() - .beginStructureBlock(3, 3, 5, true) - .addController("Front Center") - .addCasingInfoMin("Wire Factory Casings", 14, false) - .addInputBus("Any Casing", 1) - .addOutputBus("Any Casing", 1) - .addEnergyHatch("Any Casing", 1) - .addMaintenanceHatch("Any Casing", 1) - .addMufflerHatch("Any Casing", 1) - .toolTipFinisher(CORE.GT_Tooltip_Builder.get()); - return tt; - } - - @Override - public IStructureDefinition<GregtechMetaTileEntity_IndustrialWireMill> getStructureDefinition() { - if (STRUCTURE_DEFINITION == null) { - STRUCTURE_DEFINITION = StructureDefinition.<GregtechMetaTileEntity_IndustrialWireMill>builder() - .addShape( - mName, - transpose( - new String[][] { { "CCC", "CCC", "CCC", "CCC", "CCC" }, { "C~C", "C-C", "C-C", "C-C", "CCC" }, - { "CCC", "CCC", "CCC", "CCC", "CCC" }, })) - .addElement( - 'C', - buildHatchAdder(GregtechMetaTileEntity_IndustrialWireMill.class) - .atLeast(InputBus, OutputBus, Maintenance, Energy, Muffler) - .casingIndex(getCasingTextureIndex()) - .dot(1) - .buildAndChain(onElementPass(x -> ++x.mCasing, ofBlock(getCasingBlock(), getCasingMeta())))) - .build(); - } - return STRUCTURE_DEFINITION; - } - - @Override - public void construct(ItemStack stackSize, boolean hintsOnly) { - buildPiece(mName, stackSize, hintsOnly, 1, 1, 0); - } - - @Override - public int survivalConstruct(ItemStack stackSize, int elementBudget, ISurvivalBuildEnvironment env) { - if (mMachine) return -1; - return survivialBuildPiece(mName, stackSize, 1, 1, 0, elementBudget, env, false, true); - } - - @Override - public boolean checkMachine(IGregTechTileEntity aBaseMetaTileEntity, ItemStack aStack) { - mCasing = 0; - return checkPiece(mName, 1, 1, 0) && mCasing >= 14 && checkHatch(); - } - - @Override - protected SoundResource getProcessStartSound() { - return SoundResource.IC2_MACHINES_RECYCLER_OP; - } - - @Override - protected IIconContainer getActiveOverlay() { - return TexturesGtBlock.Overlay_Machine_Controller_Default_Active; - } - - @Override - protected IIconContainer getInactiveOverlay() { - return TexturesGtBlock.Overlay_Machine_Controller_Default; - } - - @Override - protected int getCasingTextureId() { - return TAE.GTPP_INDEX(6); - } - - @Override - public RecipeMap<?> getRecipeMap() { - return RecipeMaps.wiremillRecipes; - } - - @Override - public int getRecipeCatalystPriority() { - return -1; - } - - @Override - protected ProcessingLogic createProcessingLogic() { - return new ProcessingLogic().setSpeedBonus(1F / 3F) - .setEuModifier(0.75F) - .setMaxParallelSupplier(this::getMaxParallelRecipes); - } - - @Override - public void onModeChangeByScrewdriver(ForgeDirection side, EntityPlayer aPlayer, float aX, float aY, float aZ) { - inputSeparation = !inputSeparation; - aPlayer.addChatMessage( - new ChatComponentTranslation( - inputSeparation ? "interaction.separateBusses.enabled" : "interaction.separateBusses.disabled")); - } - - @Override - public void loadNBTData(NBTTagCompound aNBT) { - super.loadNBTData(aNBT); - if (!aNBT.hasKey(INPUT_SEPARATION_NBT_KEY)) { - inputSeparation = aNBT.getBoolean("isBussesSeparate"); - } - } - - @Override - public int getMaxParallelRecipes() { - return (4 * GT_Utility.getTier(this.getMaxInputVoltage())); - } - - @Override - public int getMaxEfficiency(final ItemStack aStack) { - return 10000; - } - - @Override - public int getPollutionPerSecond(final ItemStack aStack) { - return CORE.ConfigSwitches.pollutionPerSecondMultiIndustrialWireMill; - } - - @Override - public boolean explodesOnComponentBreak(final ItemStack aStack) { - return false; - } - - public Block getCasingBlock() { - return ModBlocks.blockCasingsMisc; - } - - public byte getCasingMeta() { - return 6; - } - - public byte getCasingTextureIndex() { - return (byte) TAE.GTPP_INDEX(6); - } - - @Override - public boolean supportsInputSeparation() { - return true; - } -} diff --git a/gtpp/src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/processing/GregtechMetaTileEntity_IsaMill.java b/gtpp/src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/processing/GregtechMetaTileEntity_IsaMill.java deleted file mode 100644 index c14cae9b88..0000000000 --- a/gtpp/src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/processing/GregtechMetaTileEntity_IsaMill.java +++ /dev/null @@ -1,529 +0,0 @@ -package gtPlusPlus.xmod.gregtech.common.tileentities.machines.multi.processing; - -import static com.gtnewhorizon.structurelib.structure.StructureUtility.ofBlock; -import static com.gtnewhorizon.structurelib.structure.StructureUtility.ofChain; -import static com.gtnewhorizon.structurelib.structure.StructureUtility.onElementPass; -import static com.gtnewhorizon.structurelib.structure.StructureUtility.transpose; -import static gregtech.api.enums.GT_HatchElement.Energy; -import static gregtech.api.enums.GT_HatchElement.InputBus; -import static gregtech.api.enums.GT_HatchElement.InputHatch; -import static gregtech.api.enums.GT_HatchElement.Maintenance; -import static gregtech.api.enums.GT_HatchElement.Muffler; -import static gregtech.api.enums.GT_HatchElement.OutputBus; -import static gregtech.api.enums.GT_HatchElement.OutputHatch; -import static gregtech.api.util.GT_StructureUtility.buildHatchAdder; -import static gregtech.api.util.GT_Utility.filterValidMTEs; - -import java.util.ArrayList; -import java.util.HashSet; -import java.util.List; - -import net.minecraft.block.Block; -import net.minecraft.entity.EntityLivingBase; -import net.minecraft.entity.player.EntityPlayer; -import net.minecraft.item.ItemStack; -import net.minecraft.nbt.NBTTagCompound; -import net.minecraft.util.DamageSource; -import net.minecraft.world.World; -import net.minecraft.world.chunk.Chunk; -import net.minecraftforge.common.util.ForgeDirection; - -import org.jetbrains.annotations.NotNull; - -import com.gtnewhorizon.structurelib.alignment.constructable.ISurvivalConstructable; -import com.gtnewhorizon.structurelib.structure.IStructureDefinition; -import com.gtnewhorizon.structurelib.structure.ISurvivalBuildEnvironment; -import com.gtnewhorizon.structurelib.structure.StructureDefinition; - -import gregtech.api.enums.TAE; -import gregtech.api.interfaces.IIconContainer; -import gregtech.api.interfaces.metatileentity.IMetaTileEntity; -import gregtech.api.interfaces.tileentity.IGregTechTileEntity; -import gregtech.api.logic.ProcessingLogic; -import gregtech.api.recipe.RecipeMap; -import gregtech.api.recipe.check.CheckRecipeResult; -import gregtech.api.recipe.check.CheckRecipeResultRegistry; -import gregtech.api.recipe.check.SimpleCheckRecipeResult; -import gregtech.api.util.GT_Multiblock_Tooltip_Builder; -import gregtech.api.util.GT_Recipe; -import gregtech.api.util.GT_Utility; -import gtPlusPlus.api.objects.Logger; -import gtPlusPlus.api.objects.data.AutoMap; -import gtPlusPlus.api.objects.minecraft.BlockPos; -import gtPlusPlus.api.recipe.GTPPRecipeMaps; -import gtPlusPlus.core.block.ModBlocks; -import gtPlusPlus.core.item.chemistry.general.ItemGenericChemBase; -import gtPlusPlus.core.lib.CORE; -import gtPlusPlus.core.util.math.MathUtils; -import gtPlusPlus.core.util.minecraft.EntityUtils; -import gtPlusPlus.core.util.minecraft.ItemUtils; -import gtPlusPlus.core.util.minecraft.PlayerUtils; -import gtPlusPlus.xmod.gregtech.api.metatileentity.implementations.base.GregtechMeta_MultiBlockBase; -import gtPlusPlus.xmod.gregtech.api.metatileentity.implementations.nbthandlers.GT_MetaTileEntity_Hatch_MillingBalls; -import gtPlusPlus.xmod.gregtech.common.blocks.textures.TexturesGtBlock.CustomIcon; - -public class GregtechMetaTileEntity_IsaMill extends GregtechMeta_MultiBlockBase<GregtechMetaTileEntity_IsaMill> - implements ISurvivalConstructable { - - protected boolean boostEu = false; - private int mCasing; - private static IStructureDefinition<GregtechMetaTileEntity_IsaMill> STRUCTURE_DEFINITION = null; - - private static final IIconContainer frontFaceActive = new CustomIcon("iconsets/Grinder/GRINDER_ACTIVE5"); - private static final IIconContainer frontFace = new CustomIcon("iconsets/Grinder/GRINDER5"); - - private final ArrayList<GT_MetaTileEntity_Hatch_MillingBalls> mMillingBallBuses = new ArrayList<>(); - private static final DamageSource mIsaMillDamageSource = new DamageSource("gtpp.grinder").setDamageBypassesArmor(); - - public GregtechMetaTileEntity_IsaMill(int aID, String aName, String aNameRegional) { - super(aID, aName, aNameRegional); - } - - public GregtechMetaTileEntity_IsaMill(String aName) { - super(aName); - } - - @Override - protected GT_Multiblock_Tooltip_Builder createTooltip() { - GT_Multiblock_Tooltip_Builder tt = new GT_Multiblock_Tooltip_Builder(); - tt.addMachineType(getMachineType()) - .addInfo("Controller Block for the Large Grinding Machine") - .addInfo("Grind ores.") - .addPollutionAmount(getPollutionPerSecond(null)) - .addSeparator() - .beginStructureBlock(3, 3, 7, false) - .addController("Front Center") - .addCasingInfoMin("IsaMill Exterior Casing", 40, false) - .addOtherStructurePart("IsaMill Gearbox", "5x, Inner Blocks") - .addOtherStructurePart("IsaMill Piping", "8x, ring around controller") - .addStructureInfo("IsaMill Pipings must not be obstructed in front (only air blocks)") - .addOtherStructurePart("Milling Ball Hatch", "Any Casing") - .addInputBus("Any Casing", 1) - .addOutputBus("Any Casing", 1) - .addEnergyHatch("Any Casing", 1) - .addMaintenanceHatch("Any Casing", 1) - .addMufflerHatch("Any Casing", 1) - .toolTipFinisher(CORE.GT_Tooltip_Builder.get()); - return tt; - } - - @Override - public IStructureDefinition<GregtechMetaTileEntity_IsaMill> getStructureDefinition() { - if (STRUCTURE_DEFINITION == null) { - STRUCTURE_DEFINITION = StructureDefinition.<GregtechMetaTileEntity_IsaMill>builder() - .addShape( - mName, - transpose( - new String[][] { { "DDD", "CCC", "CCC", "CCC", "CCC", "CCC", "CCC" }, - { "D~D", "CGC", "CGC", "CGC", "CGC", "CGC", "CCC" }, - { "DDD", "CCC", "CCC", "CCC", "CCC", "CCC", "CCC" }, })) - .addElement( - 'C', - ofChain( - buildHatchAdder(GregtechMetaTileEntity_IsaMill.class) - .adder(GregtechMetaTileEntity_IsaMill::addMillingBallsHatch) - .hatchClass(GT_MetaTileEntity_Hatch_MillingBalls.class) - .shouldReject(t -> !t.mMillingBallBuses.isEmpty()) - .casingIndex(getCasingTextureIndex()) - .dot(1) - .build(), - buildHatchAdder(GregtechMetaTileEntity_IsaMill.class) - .atLeast(InputBus, OutputBus, InputHatch, OutputHatch, Maintenance, Energy, Muffler) - .casingIndex(getCasingTextureIndex()) - .dot(1) - .build(), - onElementPass(x -> ++x.mCasing, ofBlock(getCasingBlock(), getCasingMeta())))) - .addElement('D', ofBlock(getIntakeBlock(), getIntakeMeta())) - .addElement('G', ofBlock(getGearboxBlock(), getGearboxMeta())) - .build(); - } - return STRUCTURE_DEFINITION; - } - - @Override - public void construct(ItemStack stackSize, boolean hintsOnly) { - buildPiece(mName, stackSize, hintsOnly, 1, 1, 0); - } - - @Override - public int survivalConstruct(ItemStack stackSize, int elementBudget, ISurvivalBuildEnvironment env) { - if (mMachine) return -1; - return survivialBuildPiece(mName, stackSize, 1, 1, 0, elementBudget, env, false, true); - } - - @Override - public boolean checkMachine(IGregTechTileEntity aBaseMetaTileEntity, ItemStack aStack) { - mCasing = 0; - mMillingBallBuses.clear(); - return checkPiece(mName, 1, 1, 0) && mCasing >= 48 - 8 && checkHatch(); - } - - @Override - public boolean checkHatch() { - return super.checkHatch() && mMillingBallBuses.size() == 1; - } - - @Override - protected IIconContainer getActiveOverlay() { - return frontFaceActive; - } - - @Override - protected IIconContainer getInactiveOverlay() { - return frontFace; - } - - @Override - protected int getCasingTextureId() { - return TAE.GTPP_INDEX(2); - } - - @Override - public boolean isCorrectMachinePart(ItemStack aStack) { - return getMaxEfficiency(aStack) > 0; - } - - private boolean addMillingBallsHatch(IGregTechTileEntity aTileEntity, int aBaseCasingIndex) { - if (aTileEntity == null) { - return false; - } else { - IMetaTileEntity aMetaTileEntity = aTileEntity.getMetaTileEntity(); - if (aMetaTileEntity instanceof GT_MetaTileEntity_Hatch_MillingBalls) { - return addToMachineListInternal(mMillingBallBuses, aMetaTileEntity, aBaseCasingIndex); - } - } - return false; - } - - @Override - public boolean addToMachineList(IGregTechTileEntity aTileEntity, int aBaseCasingIndex) { - - final IMetaTileEntity aMetaTileEntity = aTileEntity.getMetaTileEntity(); - if (aMetaTileEntity == null) { - return false; - } - if (aMetaTileEntity instanceof GT_MetaTileEntity_Hatch_MillingBalls) { - log("Found GT_MetaTileEntity_Hatch_MillingBalls"); - return addToMachineListInternal(mMillingBallBuses, aMetaTileEntity, aBaseCasingIndex); - } - return super.addToMachineList(aTileEntity, aBaseCasingIndex); - } - - @Override - public RecipeMap<?> getRecipeMap() { - return GTPPRecipeMaps.millingRecipes; - } - - @Override - public void onPostTick(IGregTechTileEntity aBaseMetaTileEntity, long aTick) { - if (aBaseMetaTileEntity.isServerSide()) { - if (this.mUpdate == 1 || this.mStartUpCheck == 1) { - this.mMillingBallBuses.clear(); - } - } - if (aTick % 20 == 0 && isMachineRunning()) { - checkForEntities(aBaseMetaTileEntity, aTick); - } - super.onPostTick(aBaseMetaTileEntity, aTick); - } - - private final AutoMap<BlockPos> mFrontBlockPosCache = new AutoMap<>(); - - public void checkForEntities(IGregTechTileEntity aBaseMetaTileEntity, long aTime) { - - if (aTime % 100 == 0) { - mFrontBlockPosCache.clear(); - } - if (mFrontBlockPosCache.isEmpty()) { - ForgeDirection tSide = aBaseMetaTileEntity.getBackFacing(); - int aTileX = aBaseMetaTileEntity.getXCoord(); - int aTileY = aBaseMetaTileEntity.getYCoord(); - int aTileZ = aBaseMetaTileEntity.getZCoord(); - boolean xFacing = tSide.offsetX != 0; - boolean zFacing = tSide.offsetZ != 0; - - // Check Casings - int aDepthOffset = (tSide == ForgeDirection.NORTH || tSide == ForgeDirection.WEST) ? 1 : -1; - for (int aHorizontalOffset = -1; aHorizontalOffset < 2; aHorizontalOffset++) { - for (int aVerticalOffset = -1; aVerticalOffset < 2; aVerticalOffset++) { - int aX = !xFacing ? (aTileX + aHorizontalOffset) : (aTileX + aDepthOffset); - int aY = aTileY + aVerticalOffset; - int aZ = !zFacing ? (aTileZ + aHorizontalOffset) : (aTileZ + aDepthOffset); - mFrontBlockPosCache.add(new BlockPos(aX, aY, aZ, aBaseMetaTileEntity.getWorld())); - } - } - } - - AutoMap<EntityLivingBase> aEntities = getEntities(mFrontBlockPosCache, aBaseMetaTileEntity.getWorld()); - if (!aEntities.isEmpty()) { - for (EntityLivingBase aFoundEntity : aEntities) { - if (aFoundEntity instanceof EntityPlayer aPlayer) { - if (PlayerUtils.isCreative(aPlayer) || !PlayerUtils.canTakeDamage(aPlayer)) { - continue; - } else { - if (aFoundEntity.getHealth() > 0) { - EntityUtils.doDamage(aFoundEntity, mIsaMillDamageSource, getPlayerDamageValue(aPlayer, 10)); - if ((aBaseMetaTileEntity.isClientSide()) && (aBaseMetaTileEntity.isActive())) { - generateParticles(aFoundEntity); - } - } - } - } else if (aFoundEntity.getHealth() > 0) { - EntityUtils.doDamage( - aFoundEntity, - mIsaMillDamageSource, - Math.max(1, (int) (aFoundEntity.getMaxHealth() / 3))); - if ((aBaseMetaTileEntity.isClientSide()) && (aBaseMetaTileEntity.isActive())) { - generateParticles(aFoundEntity); - } - } - } - } - } - - // 20 armor points add 80% damage reduction, more points add more damage reduction - private int getPlayerDamageValue(EntityPlayer player, int damage) { - int armorValue = player.getTotalArmorValue(); - int reducedDamage = (int) (damage - damage * (armorValue * 0.04)); - return Math.max(reducedDamage, 0); - } - - private static AutoMap<EntityLivingBase> getEntities(AutoMap<BlockPos> aPositionsToCheck, World aWorld) { - AutoMap<EntityLivingBase> aEntities = new AutoMap<>(); - HashSet<Chunk> aChunksToCheck = new HashSet<>(); - if (!aPositionsToCheck.isEmpty()) { - Chunk aLocalChunk; - for (BlockPos aPos : aPositionsToCheck) { - aLocalChunk = aWorld.getChunkFromBlockCoords(aPos.xPos, aPos.zPos); - aChunksToCheck.add(aLocalChunk); - } - } - if (!aChunksToCheck.isEmpty()) { - AutoMap<EntityLivingBase> aEntitiesFound = new AutoMap<>(); - for (Chunk aChunk : aChunksToCheck) { - if (aChunk.isChunkLoaded) { - List[] aEntityLists = aChunk.entityLists; - for (List aEntitySubList : aEntityLists) { - for (Object aEntity : aEntitySubList) { - if (aEntity instanceof EntityLivingBase aPlayer) { - aEntitiesFound.add(aPlayer); - } - } - } - } - } - if (!aEntitiesFound.isEmpty()) { - for (EntityLivingBase aEntity : aEntitiesFound) { - BlockPos aPlayerPos = EntityUtils.findBlockPosOfEntity(aEntity); - for (BlockPos aBlockSpaceToCheck : aPositionsToCheck) { - if (aBlockSpaceToCheck.equals(aPlayerPos)) { - aEntities.add(aEntity); - } - } - } - } - } - return aEntities; - } - - private static void generateParticles(EntityLivingBase aEntity) { - BlockPos aPlayerPosBottom = EntityUtils.findBlockPosOfEntity(aEntity); - BlockPos aPlayerPosTop = aPlayerPosBottom.getUp(); - AutoMap<BlockPos> aEntityPositions = new AutoMap<>(); - aEntityPositions.add(aPlayerPosBottom); - aEntityPositions.add(aPlayerPosTop); - for (int i = 0; i < 64; i++) { - BlockPos aEffectPos = aEntityPositions.get(aEntity.height > 1f ? MathUtils.randInt(0, 1) : 0); - float aOffsetX = MathUtils.randFloat(-0.35f, 0.35f); - float aOffsetY = MathUtils.randFloat(-0.25f, 0.35f); - float aOffsetZ = MathUtils.randFloat(-0.35f, 0.35f); - aEntity.worldObj.spawnParticle( - "reddust", - aEffectPos.xPos + aOffsetX, - aEffectPos.yPos + 0.3f + aOffsetY, - aEffectPos.zPos + aOffsetZ, - 0.0D, - 0.0D, - 0.0D); - } - } - - public Block getCasingBlock() { - return ModBlocks.blockCasings5Misc; - } - - public byte getCasingMeta() { - return 0; - } - - public Block getIntakeBlock() { - return ModBlocks.blockCasings5Misc; - } - - public byte getIntakeMeta() { - return 1; - } - - public Block getGearboxBlock() { - return ModBlocks.blockCasings5Misc; - } - - public byte getGearboxMeta() { - return 2; - } - - public byte getCasingTextureIndex() { - return 66; - } - - @Override - public IMetaTileEntity newMetaEntity(IGregTechTileEntity aTileEntity) { - return new GregtechMetaTileEntity_IsaMill(this.mName); - } - - @Override - public void saveNBTData(NBTTagCompound aNBT) { - super.saveNBTData(aNBT); - } - - @Override - public void loadNBTData(NBTTagCompound aNBT) { - super.loadNBTData(aNBT); - } - - @Override - public int getDamageToComponent(ItemStack aStack) { - return 1; - } - - @Override - public int getMaxEfficiency(ItemStack aStack) { - return 10000; - } - - @Override - public int getPollutionPerSecond(ItemStack aStack) { - return CORE.ConfigSwitches.pollutionPerSecondMultiIsaMill; - } - - @Override - public boolean explodesOnComponentBreak(ItemStack aStack) { - return false; - } - - @Override - public String[] getExtraInfoData() { - return new String[] { "IsaMill Grinding Machine", "Current Efficiency: " + (mEfficiency / 100) + "%", - getIdealStatus() == getRepairStatus() ? "No Maintainance issues" : "Needs Maintainance" }; - } - - @Override - public boolean isGivingInformation() { - return true; - } - - @Override - public String getMachineType() { - return "Grinding Machine"; - } - - @Override - public int getMaxParallelRecipes() { - return 1; - } - - /* - * Milling Ball Handling - */ - - @Override - public ArrayList<ItemStack> getStoredInputs() { - ArrayList<ItemStack> tItems = super.getStoredInputs(); - for (GT_MetaTileEntity_Hatch_MillingBalls tHatch : filterValidMTEs(mMillingBallBuses)) { - AutoMap<ItemStack> aHatchContent = tHatch.getContentUsageSlots(); - if (!aHatchContent.isEmpty()) { - tItems.addAll(aHatchContent); - } - } - return tItems; - } - - public int getMaxBallDurability(ItemStack aStack) { - return ItemGenericChemBase.getMaxBallDurability(aStack); - } - - private ItemStack findMillingBall(ItemStack[] aItemInputs) { - if (mMillingBallBuses.size() != 1) { - return null; - } else { - GT_MetaTileEntity_Hatch_MillingBalls aBus = mMillingBallBuses.get(0); - if (aBus != null) { - AutoMap<ItemStack> aAvailableItems = aBus.getContentUsageSlots(); - if (!aAvailableItems.isEmpty()) { - for (final ItemStack aInput : aItemInputs) { - if (ItemUtils.isMillingBall(aInput)) { - for (ItemStack aBall : aAvailableItems) { - if (GT_Utility.areStacksEqual(aBall, aInput, true)) { - Logger.INFO("Found a valid milling ball to use."); - return aBall; - } - } - } - } - } - } - } - return null; - } - - private void damageMillingBall(ItemStack aStack) { - if (MathUtils.randFloat(0, 10000000) / 10000000f < (1.2f - (0.2 * 1))) { - int damage = getMillingBallDamage(aStack) + 1; - log("damage milling ball " + damage); - if (damage >= getMaxBallDurability(aStack)) { - log("consuming milling ball"); - aStack.stackSize -= 1; - } else { - setDamage(aStack, damage); - } - } else { - log("not damaging milling ball"); - } - } - - private int getMillingBallDamage(ItemStack aStack) { - return ItemGenericChemBase.getMillingBallDamage(aStack); - } - - private void setDamage(ItemStack aStack, int aAmount) { - ItemGenericChemBase.setMillingBallDamage(aStack, aAmount); - } - - @Override - protected ProcessingLogic createProcessingLogic() { - return new ProcessingLogic() { - - ItemStack millingBall; - - @NotNull - @Override - protected CheckRecipeResult validateRecipe(@NotNull GT_Recipe recipe) { - millingBall = findMillingBall(inputItems); - if (millingBall == null) { - return SimpleCheckRecipeResult.ofFailure("no_milling_ball"); - } - return CheckRecipeResultRegistry.SUCCESSFUL; - } - - @NotNull - @Override - public CheckRecipeResult process() { - CheckRecipeResult result = super.process(); - if (result.wasSuccessful()) { - damageMillingBall(millingBall); - } - return result; - } - }.enablePerfectOverclock(); - } -} diff --git a/gtpp/src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/processing/GregtechMetaTileEntity_NuclearSaltProcessingPlant.java b/gtpp/src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/processing/GregtechMetaTileEntity_NuclearSaltProcessingPlant.java deleted file mode 100644 index 6d1593bec9..0000000000 --- a/gtpp/src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/processing/GregtechMetaTileEntity_NuclearSaltProcessingPlant.java +++ /dev/null @@ -1,224 +0,0 @@ -package gtPlusPlus.xmod.gregtech.common.tileentities.machines.multi.processing; - -import static com.gtnewhorizon.structurelib.structure.StructureUtility.ofBlock; -import static com.gtnewhorizon.structurelib.structure.StructureUtility.onElementPass; -import static com.gtnewhorizon.structurelib.structure.StructureUtility.transpose; -import static gregtech.api.enums.GT_HatchElement.Energy; -import static gregtech.api.enums.GT_HatchElement.InputBus; -import static gregtech.api.enums.GT_HatchElement.InputHatch; -import static gregtech.api.enums.GT_HatchElement.Maintenance; -import static gregtech.api.enums.GT_HatchElement.Muffler; -import static gregtech.api.enums.GT_HatchElement.OutputBus; -import static gregtech.api.enums.GT_HatchElement.OutputHatch; -import static gregtech.api.util.GT_StructureUtility.buildHatchAdder; - -import net.minecraft.item.ItemStack; - -import com.gtnewhorizon.structurelib.alignment.constructable.ISurvivalConstructable; -import com.gtnewhorizon.structurelib.structure.IStructureDefinition; -import com.gtnewhorizon.structurelib.structure.ISurvivalBuildEnvironment; -import com.gtnewhorizon.structurelib.structure.StructureDefinition; - -import gregtech.api.GregTech_API; -import gregtech.api.enums.TAE; -import gregtech.api.enums.Textures; -import gregtech.api.interfaces.IIconContainer; -import gregtech.api.interfaces.tileentity.IGregTechTileEntity; -import gregtech.api.logic.ProcessingLogic; -import gregtech.api.metatileentity.MetaTileEntity; -import gregtech.api.recipe.RecipeMap; -import gregtech.api.util.GT_Multiblock_Tooltip_Builder; -import gregtech.api.util.GT_Recipe; -import gregtech.api.util.GT_Utility; -import gtPlusPlus.api.recipe.GTPPRecipeMaps; -import gtPlusPlus.core.block.ModBlocks; -import gtPlusPlus.core.lib.CORE; -import gtPlusPlus.xmod.gregtech.api.metatileentity.implementations.base.GregtechMeta_MultiBlockBase; - -public class GregtechMetaTileEntity_NuclearSaltProcessingPlant extends - GregtechMeta_MultiBlockBase<GregtechMetaTileEntity_NuclearSaltProcessingPlant> implements ISurvivalConstructable { - - protected GT_Recipe lastRecipeToBuffer; - private int casing; - private static IStructureDefinition<GregtechMetaTileEntity_NuclearSaltProcessingPlant> STRUCTURE_DEFINITION = null; - - public GregtechMetaTileEntity_NuclearSaltProcessingPlant(int aID, String aName, String aNameRegional) { - super(aID, aName, aNameRegional); - } - - public GregtechMetaTileEntity_NuclearSaltProcessingPlant(String mName) { - super(mName); - } - - @Override - public String getMachineType() { - return "Reactor Processing Unit, Cold Trap"; - } - - @Override - public MetaTileEntity newMetaEntity(IGregTechTileEntity tileEntity) { - return new GregtechMetaTileEntity_NuclearSaltProcessingPlant(this.mName); - } - - @Override - public int getMaxEfficiency(ItemStack itemStack) { - return 10000; - } - - @Override - public int getPollutionPerSecond(ItemStack aStack) { - return CORE.ConfigSwitches.pollutionPerSecondMultiAutoCrafter; - } - - @Override - protected GT_Multiblock_Tooltip_Builder createTooltip() { - GT_Multiblock_Tooltip_Builder tt = new GT_Multiblock_Tooltip_Builder(); - tt.addMachineType(getMachineType()) - .addInfo("Controller Block for the Nuclear Salt Processing Plant") - .addInfo("Processes depleted nuclear salts that come from the LFTR") - .addInfo("Handles the recipes of the Reactor Processor Unit and Cold Trap") - .addInfo("Only Thermally Insulated Casings can be replaced with hatches") - .addInfo("Mufflers on top, Energy Hatches on bottom, exactly 2 of each are required") - .addInfo("Maintenance Hatch goes on the back, opposite of the controller block") - .addInfo("Inputs go on the left side of the multi, outputs on the right side") - .addInfo("150% faster than using single block machines of the same voltage") - .addInfo("Processes two items per voltage tier") - .addPollutionAmount(getPollutionPerSecond(null)) - .addSeparator() - .beginStructureBlock(3, 3, 3, true) - .addController("Front Center") - .addCasingInfoMin("IV Machine Casing", 58, false) - .addCasingInfoMin("Thermally Insulated Casing", 1, false) - .addInputBus("Left Half", 2) - .addInputHatch("Left Half", 2) - .addOutputBus("Right Half", 3) - .addOutputHatch("Right Half", 3) - .addMufflerHatch("Top Side, 2 Required", 4) - .addEnergyHatch("Bottom Side, 2 Required", 5) - .addMaintenanceHatch("Back Side, Opposite of Controller", 6) - .toolTipFinisher(CORE.GT_Tooltip_Builder.get()); - return tt; - } - - @Override - protected IIconContainer getActiveOverlay() { - return Textures.BlockIcons.OVERLAY_FRONT_DISASSEMBLER_ACTIVE; - } - - @Override - protected IIconContainer getInactiveOverlay() { - return Textures.BlockIcons.OVERLAY_FRONT_DISASSEMBLER; - } - - @Override - protected int getCasingTextureId() { - return TAE.getIndexFromPage(0, 10); - } - - @Override - public IStructureDefinition<GregtechMetaTileEntity_NuclearSaltProcessingPlant> getStructureDefinition() { - if (STRUCTURE_DEFINITION == null) { - STRUCTURE_DEFINITION = StructureDefinition.<GregtechMetaTileEntity_NuclearSaltProcessingPlant>builder() - .addShape( - mName, - transpose( - new String[][] { { "AAA AAA", "ADA ADA", "AAA AAA" }, - { "ABBA ACCA", "B AAA C", "ABBA ACCA" }, { "ABBB~CCCA", "B C", "ABBBFCCCA" }, - { "ABBA ACCA", "B AAA C", "ABBA ACCA" }, { "AAA AAA", "AEA AEA", "AAA AAA" } })) - .addElement('A', ofBlock(GregTech_API.sBlockCasings1, 5)) - .addElement( - 'B', - buildHatchAdder(GregtechMetaTileEntity_NuclearSaltProcessingPlant.class) - .atLeast(InputBus, InputHatch) - .casingIndex(TAE.getIndexFromPage(0, 10)) - .dot(2) - .buildAndChain(onElementPass(x -> ++x.casing, ofBlock(ModBlocks.blockSpecialMultiCasings, 8)))) - .addElement( - 'C', - buildHatchAdder(GregtechMetaTileEntity_NuclearSaltProcessingPlant.class) - .atLeast(OutputBus, OutputHatch) - .casingIndex(TAE.getIndexFromPage(0, 10)) - .dot(3) - .buildAndChain(onElementPass(x -> ++x.casing, ofBlock(ModBlocks.blockSpecialMultiCasings, 8)))) - .addElement( - 'D', - buildHatchAdder(GregtechMetaTileEntity_NuclearSaltProcessingPlant.class).atLeast(Muffler) - .casingIndex(TAE.getIndexFromPage(0, 10)) - .dot(4) - .buildAndChain(onElementPass(x -> ++x.casing, ofBlock(ModBlocks.blockSpecialMultiCasings, 8)))) - .addElement( - 'E', - buildHatchAdder(GregtechMetaTileEntity_NuclearSaltProcessingPlant.class).atLeast(Energy) - .casingIndex(TAE.getIndexFromPage(0, 10)) - .dot(5) - .buildAndChain(onElementPass(x -> ++x.casing, ofBlock(ModBlocks.blockSpecialMultiCasings, 8)))) - .addElement( - 'F', - buildHatchAdder(GregtechMetaTileEntity_NuclearSaltProcessingPlant.class).atLeast(Maintenance) - .casingIndex(TAE.getIndexFromPage(0, 10)) - .dot(6) - .buildAndChain(onElementPass(x -> ++x.casing, ofBlock(ModBlocks.blockSpecialMultiCasings, 8)))) - .build(); - } - return STRUCTURE_DEFINITION; - } - - @Override - public void construct(ItemStack itemStack, boolean hintsOnly) { - buildPiece(mName, itemStack, hintsOnly, 4, 2, 0); - } - - @Override - public int survivalConstruct(ItemStack itemStack, int elementBudget, ISurvivalBuildEnvironment env) { - if (mMachine) return -1; - return survivialBuildPiece(mName, itemStack, 4, 2, 0, elementBudget, env, false, true); - } - - @Override - public boolean checkMachine(IGregTechTileEntity baseMetaTileEntity, ItemStack itemStack) { - casing = 0; - return checkPiece(mName, 4, 2, 0) && checkHatch(); - } - - @Override - public boolean checkHatch() { - return mEnergyHatches.size() == 2 && mMufflerHatches.size() == 2 && super.checkHatch(); - } - - @Override - public RecipeMap<?> getRecipeMap() { - return GTPPRecipeMaps.nuclearSaltProcessingPlantRecipes; - } - - @Override - protected ProcessingLogic createProcessingLogic() { - return new ProcessingLogic().setSpeedBonus(1F / 2.5F) - .setMaxParallelSupplier(this::getMaxParallelRecipes); - } - - @Override - public int getMaxParallelRecipes() { - return 2 * (Math.max(1, GT_Utility.getTier(getMaxInputVoltage()))); - } - - @Override - public String[] getExtraInfoData() { - final String running = (this.mMaxProgresstime > 0 ? "Salt Plant running" : "Salt Plant stopped"); - final String maintenance = (this.getIdealStatus() == this.getRepairStatus() ? "No Maintenance issues" - : "Needs Maintenance"); - String tSpecialText; - - if (lastRecipeToBuffer != null && lastRecipeToBuffer.mOutputs[0].getDisplayName() != null) { - tSpecialText = "Currently processing: " + lastRecipeToBuffer.mOutputs[0].getDisplayName(); - } else { - tSpecialText = "Currently processing: Nothing"; - } - - return new String[] { "Nuclear Salt Processing Plant", running, maintenance, tSpecialText }; - } - - @Override - public boolean supportsInputSeparation() { - return true; - } -} diff --git a/gtpp/src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/processing/GregtechMetaTileEntity_SpargeTower.java b/gtpp/src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/processing/GregtechMetaTileEntity_SpargeTower.java deleted file mode 100644 index 5f4203b99e..0000000000 --- a/gtpp/src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/processing/GregtechMetaTileEntity_SpargeTower.java +++ /dev/null @@ -1,507 +0,0 @@ -package gtPlusPlus.xmod.gregtech.common.tileentities.machines.multi.processing; - -import static com.gtnewhorizon.structurelib.structure.StructureUtility.isAir; -import static com.gtnewhorizon.structurelib.structure.StructureUtility.ofBlock; -import static com.gtnewhorizon.structurelib.structure.StructureUtility.ofChain; -import static com.gtnewhorizon.structurelib.structure.StructureUtility.onElementPass; -import static com.gtnewhorizon.structurelib.structure.StructureUtility.transpose; -import static gregtech.api.enums.GT_HatchElement.Energy; -import static gregtech.api.enums.GT_HatchElement.InputBus; -import static gregtech.api.enums.GT_HatchElement.InputHatch; -import static gregtech.api.enums.GT_HatchElement.Maintenance; -import static gregtech.api.enums.GT_HatchElement.OutputHatch; -import static gregtech.api.util.GT_StructureUtility.buildHatchAdder; -import static gregtech.api.util.GT_StructureUtility.ofHatchAdder; - -import java.util.ArrayList; -import java.util.List; - -import net.minecraft.entity.player.EntityPlayer; -import net.minecraft.item.ItemStack; -import net.minecraft.nbt.NBTTagCompound; -import net.minecraftforge.common.util.ForgeDirection; -import net.minecraftforge.fluids.FluidStack; - -import org.jetbrains.annotations.NotNull; - -import com.gtnewhorizon.structurelib.alignment.IAlignmentLimits; -import com.gtnewhorizon.structurelib.alignment.constructable.ISurvivalConstructable; -import com.gtnewhorizon.structurelib.structure.IStructureDefinition; -import com.gtnewhorizon.structurelib.structure.ISurvivalBuildEnvironment; -import com.gtnewhorizon.structurelib.structure.StructureDefinition; - -import gregtech.api.interfaces.IHatchElement; -import gregtech.api.interfaces.IIconContainer; -import gregtech.api.interfaces.fluid.IFluidStore; -import gregtech.api.interfaces.metatileentity.IMetaTileEntity; -import gregtech.api.interfaces.tileentity.IGregTechTileEntity; -import gregtech.api.metatileentity.implementations.GT_MetaTileEntity_Hatch_Output; -import gregtech.api.recipe.RecipeMap; -import gregtech.api.recipe.check.CheckRecipeResult; -import gregtech.api.recipe.check.CheckRecipeResultRegistry; -import gregtech.api.util.GT_Multiblock_Tooltip_Builder; -import gregtech.api.util.GT_Recipe; -import gregtech.api.util.GT_Utility; -import gregtech.api.util.GasSpargingRecipe; -import gregtech.api.util.GasSpargingRecipeMap; -import gtPlusPlus.api.objects.Logger; -import gtPlusPlus.api.recipe.GTPPRecipeMaps; -import gtPlusPlus.core.block.ModBlocks; -import gtPlusPlus.core.lib.CORE; -import gtPlusPlus.core.util.math.MathUtils; -import gtPlusPlus.core.util.minecraft.PlayerUtils; -import gtPlusPlus.xmod.gregtech.api.metatileentity.implementations.base.GregtechMeta_MultiBlockBase; -import gtPlusPlus.xmod.gregtech.common.blocks.textures.TexturesGtBlock; - -public class GregtechMetaTileEntity_SpargeTower extends GregtechMeta_MultiBlockBase<GregtechMetaTileEntity_SpargeTower> - implements ISurvivalConstructable { - - protected static final String STRUCTURE_PIECE_BASE = "base"; - protected static final String STRUCTURE_PIECE_LAYER = "layer"; - protected static final String STRUCTURE_PIECE_LAYER_HINT = "layerHint"; - protected static final String STRUCTURE_PIECE_TOP_HINT = "topHint"; - private static final IStructureDefinition<GregtechMetaTileEntity_SpargeTower> STRUCTURE_DEFINITION; - - static { - IHatchElement<GregtechMetaTileEntity_SpargeTower> layeredOutputHatch = OutputHatch - .withCount(GregtechMetaTileEntity_SpargeTower::getCurrentLayerOutputHatchCount) - .withAdder(GregtechMetaTileEntity_SpargeTower::addLayerOutputHatch); - STRUCTURE_DEFINITION = StructureDefinition.<GregtechMetaTileEntity_SpargeTower>builder() - .addShape(STRUCTURE_PIECE_BASE, transpose(new String[][] { { "b~b", "bbb", "bbb" }, })) - .addShape(STRUCTURE_PIECE_LAYER, transpose(new String[][] { { "lll", "lcl", "lll" } })) - .addShape(STRUCTURE_PIECE_LAYER_HINT, transpose(new String[][] { { "lll", "l-l", "lll" } })) - .addShape(STRUCTURE_PIECE_TOP_HINT, transpose(new String[][] { { "lll", "lll", "lll" } })) - .addElement( - 'b', - buildHatchAdder(GregtechMetaTileEntity_SpargeTower.class) - .atLeast(Energy, InputHatch, InputBus, Maintenance) - .disallowOnly(ForgeDirection.UP) - .casingIndex(getCasingIndex()) - .dot(1) - .buildAndChain( - onElementPass( - GregtechMetaTileEntity_SpargeTower::onCasingFound, - ofBlock(ModBlocks.blockCasings5Misc, 4)))) - .addElement( - 'l', - ofChain( - buildHatchAdder(GregtechMetaTileEntity_SpargeTower.class).atLeast(layeredOutputHatch) - .disallowOnly(ForgeDirection.UP, ForgeDirection.DOWN) - .casingIndex(getCasingIndex()) - .dot(2) - .build(), - ofHatchAdder(GregtechMetaTileEntity_SpargeTower::addEnergyInputToMachineList, getCasingIndex(), 2), - ofHatchAdder(GregtechMetaTileEntity_SpargeTower::addMaintenanceToMachineList, getCasingIndex(), 2), - onElementPass( - GregtechMetaTileEntity_SpargeTower::onCasingFound, - ofBlock(ModBlocks.blockCasings5Misc, 4)))) - .addElement( - 'c', - ofChain( - onElementPass( - t -> t.onTopLayerFound(false), - ofHatchAdder(GregtechMetaTileEntity_SpargeTower::addOutputToMachineList, getCasingIndex(), 3)), - onElementPass( - t -> t.onTopLayerFound(false), - ofHatchAdder( - GregtechMetaTileEntity_SpargeTower::addMaintenanceToMachineList, - getCasingIndex(), - 3)), - onElementPass(t -> t.onTopLayerFound(true), ofBlock(ModBlocks.blockCasings5Misc, 4)), - isAir())) - .build(); - } - - protected final List<List<GT_MetaTileEntity_Hatch_Output>> mOutputHatchesByLayer = new ArrayList<>(); - protected int mHeight; - protected int mCasing; - protected boolean mTopLayerFound; - - public GregtechMetaTileEntity_SpargeTower(int aID, String aName, String aNameRegional) { - super(aID, aName, aNameRegional); - } - - public GregtechMetaTileEntity_SpargeTower(String aName) { - super(aName); - } - - public static int getCasingIndex() { - return 68; - } - - @Override - public IMetaTileEntity newMetaEntity(IGregTechTileEntity aTileEntity) { - return new GregtechMetaTileEntity_SpargeTower(this.mName); - } - - @Override - protected GT_Multiblock_Tooltip_Builder createTooltip() { - final GT_Multiblock_Tooltip_Builder tt = new GT_Multiblock_Tooltip_Builder(); - tt.addMachineType("Gas Sparge Tower") - .addInfo("Controller block for the Sparging Tower") - .addInfo("Runs gases through depleted molten salts to extract precious fluids") - .addInfo("Works the same way as the Distillation Tower, but with a fixed height of 8") - .addInfo("Fluids are only put out at the correct height") - .addInfo("The correct height equals the slot number in the NEI recipe") - .addSeparator() - .beginStructureBlock(3, 8, 3, true) - .addController("Front bottom") - .addOtherStructurePart("Sparge Tower Exterior Casing", "45 (minimum)") - .addEnergyHatch("Any casing", 1, 2) - .addMaintenanceHatch("Any casing", 1, 2, 3) - .addInputHatch("2x Input Hatches (Any bottom layer casing)", 1) - .addOutputHatch("6x Output Hatches (At least one per layer except bottom layer)", 2, 3) - .toolTipFinisher(CORE.GT_Tooltip_Builder.get()); - return tt; - } - - @Override - protected IIconContainer getActiveOverlay() { - return TexturesGtBlock.Overlay_Machine_Controller_Advanced_Active; - } - - @Override - protected IIconContainer getInactiveOverlay() { - return TexturesGtBlock.Overlay_Machine_Controller_Advanced; - } - - @Override - protected int getCasingTextureId() { - return getCasingIndex(); - } - - @Override - public RecipeMap<?> getRecipeMap() { - if (GTPPRecipeMaps.spargeTowerFakeRecipes.getAllRecipes() - .isEmpty()) { - generateRecipes(); - } - return GTPPRecipeMaps.spargeTowerFakeRecipes; - } - - private static boolean generateRecipes() { - for (GasSpargingRecipe aRecipe : GasSpargingRecipeMap.mRecipes) { - GT_Recipe newRecipe = new GT_Recipe( - false, - new ItemStack[] {}, - new ItemStack[] {}, - null, - null, - aRecipe.mFluidInputs.clone(), - new FluidStack[] {}, - aRecipe.mDuration, - aRecipe.mEUt, - 0); - GTPPRecipeMaps.spargeTowerFakeRecipes.add(newRecipe); - } - return !GTPPRecipeMaps.spargeTowerFakeRecipes.getAllRecipes() - .isEmpty(); - } - - @Override - public boolean isCorrectMachinePart(ItemStack aStack) { - return true; - } - - @Override - public @NotNull CheckRecipeResult checkProcessing() { - ArrayList<FluidStack> tFluidList = getStoredFluids(); - long tVoltage = GT_Utility.roundUpVoltage(this.getMaxInputVoltage()); - byte tTier = (byte) Math.max(0, GT_Utility.getTier(tVoltage)); - FluidStack[] tFluids = tFluidList.toArray(new FluidStack[0]); - if (tFluids.length > 0) { - GT_Recipe tRecipe = getRecipeMap() - .findRecipe(getBaseMetaTileEntity(), false, gregtech.api.enums.GT_Values.V[tTier], tFluids); - if (tRecipe != null) { - FluidStack[] possibleOutputs = getPossibleByproductsOfSparge( - tRecipe.mFluidInputs[0], - tRecipe.mFluidInputs[1]).toArray(new FluidStack[0]); - if (canOutputAll(possibleOutputs) && tRecipe.isRecipeInputEqual(true, tFluids)) { - this.mEfficiency = (10000 - (getIdealStatus() - getRepairStatus()) * 1000); - this.mEfficiencyIncrease = 10000; - - calculateOverclockedNessMulti((long) tRecipe.mEUt, tRecipe.mDuration, 1, tVoltage); - mMaxProgresstime = Math.max(1, mMaxProgresstime); - ArrayList<FluidStack> aFluidOutputs = getByproductsOfSparge( - tRecipe.mFluidInputs[0], - tRecipe.mFluidInputs[1]); - this.mOutputFluids = aFluidOutputs.toArray(new FluidStack[0]); - updateSlots(); - - if (lEUt > 0) { - lEUt = (-lEUt); - } - - return CheckRecipeResultRegistry.SUCCESSFUL; - } - } - } - this.lEUt = 0; - this.mEfficiency = 0; - return CheckRecipeResultRegistry.NO_RECIPE; - } - - private static List<FluidStack> getPossibleByproductsOfSparge(final FluidStack aSpargeGas, - final FluidStack aSpentFuel) { - GasSpargingRecipe aSpargeRecipe = GasSpargingRecipeMap.findRecipe(aSpargeGas, aSpentFuel); - ArrayList<FluidStack> aOutputGases = new ArrayList<>(); - if (aSpargeRecipe == null) { - return aOutputGases; - } - - aOutputGases.add(aSpargeRecipe.mOutputSpargedFuel.copy()); - ArrayList<FluidStack> aTempMap = new ArrayList<>(); - for (int i = 2; i < aSpargeRecipe.mFluidOutputs.length; i++) { - int aGasAmount = aSpargeRecipe.mMaxOutputQuantity[i - 2] / 100; - FluidStack aOutput = aSpargeRecipe.mFluidOutputs[i].copy(); - FluidStack aSpargeOutput = null; - if (aGasAmount > 0) { - aSpargeOutput = new FluidStack(aOutput.getFluid(), aGasAmount); - } - aTempMap.add(aSpargeOutput); - } - aOutputGases.add(new FluidStack(aSpargeRecipe.mInputGas.getFluid(), aSpargeRecipe.mInputGas.amount)); - aOutputGases.addAll(aTempMap); - return aOutputGases; - } - - private static ArrayList<FluidStack> getByproductsOfSparge(final FluidStack aSpargeGas, - final FluidStack aSpentFuel) { - GasSpargingRecipe aSpargeRecipe = GasSpargingRecipeMap.findRecipe(aSpargeGas, aSpentFuel); - ArrayList<FluidStack> aOutputGases = new ArrayList<>(); - if (aSpargeRecipe == null) { - Logger.INFO("Did not find sparge recipe!"); - return aOutputGases; - } - int aSpargeGasAmount = aSpargeRecipe.mInputGas.amount; - - aOutputGases.add(aSpargeRecipe.mOutputSpargedFuel.copy()); - ArrayList<FluidStack> aTempMap = new ArrayList<>(); - for (int i = 2; i < aSpargeRecipe.mFluidOutputs.length; i++) { - int aGasAmount = MathUtils.randInt(0, (aSpargeRecipe.mMaxOutputQuantity[i - 2] / 100)); - FluidStack aOutput = aSpargeRecipe.mFluidOutputs[i].copy(); - aSpargeGasAmount -= aGasAmount; - FluidStack aSpargeOutput = null; - if (aGasAmount > 0) { - aSpargeOutput = new FluidStack(aOutput.getFluid(), aGasAmount); - } - aTempMap.add(aSpargeOutput); - } - Logger.INFO("Sparge gas left: " + aSpargeGasAmount); - if (aSpargeGasAmount > 0) { - aOutputGases.add(new FluidStack(aSpargeRecipe.mInputGas.getFluid(), aSpargeGasAmount)); - } - // Logger.INFO("Sparge Outputs: "+ItemUtils.getArrayStackNames(aTempMap)); - aOutputGases.addAll(aTempMap); - Logger.INFO("Sparge output size: " + aOutputGases.size()); - // Logger.INFO("Output of sparging: "+ItemUtils.getArrayStackNames(aOutputGases)); - return aOutputGases; - } - - protected void onCasingFound() { - mCasing++; - } - - protected void onTopLayerFound(boolean aIsCasing) { - mTopLayerFound = true; - if (aIsCasing) { - onCasingFound(); - } - } - - protected int getCurrentLayerOutputHatchCount() { - return mOutputHatchesByLayer.size() < mHeight || mHeight <= 0 ? 0 - : mOutputHatchesByLayer.get(mHeight - 1) - .size(); - } - - protected boolean addLayerOutputHatch(IGregTechTileEntity aTileEntity, int aBaseCasingIndex) { - if (aTileEntity == null || aTileEntity.isDead() - || !(aTileEntity.getMetaTileEntity() instanceof GT_MetaTileEntity_Hatch_Output tHatch)) { - Logger.INFO("Bad Output Hatch"); - return false; - } - while (mOutputHatchesByLayer.size() < mHeight) { - mOutputHatchesByLayer.add(new ArrayList<>()); - } - tHatch.updateTexture(aBaseCasingIndex); - boolean addedHatch = mOutputHatchesByLayer.get(mHeight - 1) - .add(tHatch); - Logger.INFO("Added Hatch: " + addedHatch); - return addedHatch; - } - - @Override - public List<? extends IFluidStore> getFluidOutputSlots(FluidStack[] toOutput) { - return getFluidOutputSlotsByLayer(toOutput, mOutputHatchesByLayer); - } - - @Override - protected IAlignmentLimits getInitialAlignmentLimits() { - // don't rotate a freaking tower, it won't work - return (d, r, f) -> d.offsetY == 0 && r.isNotRotated() && !f.isVerticallyFliped(); - } - - @Override - public IStructureDefinition<GregtechMetaTileEntity_SpargeTower> getStructureDefinition() { - return STRUCTURE_DEFINITION; - } - - @Override - public boolean checkMachine(IGregTechTileEntity aBaseMetaTileEntity, ItemStack aStack) { - // reset - mOutputHatchesByLayer.forEach(List::clear); - mHeight = 1; - mTopLayerFound = false; - mCasing = 0; - - // check base - if (!checkPiece(STRUCTURE_PIECE_BASE, 1, 0, 0)) { - Logger.INFO("Bad Base. Height: " + mHeight); - return false; - } - - // check each layer - while (mHeight < 8 && checkPiece(STRUCTURE_PIECE_LAYER, 1, mHeight, 0) && !mTopLayerFound) { - if (mOutputHatchesByLayer.get(mHeight - 1) - .isEmpty()) { - // layer without output hatch - Logger.INFO("Height: " + mHeight + " - Missing output on " + (mHeight - 1)); - return false; - } - // not top - mHeight++; - } - - // validate final invariants... - Logger.INFO("Height: " + mHeight); - Logger.INFO("Casings: " + mCasing); - Logger.INFO("Required: " + (7 * mHeight - 5)); - Logger.INFO("Found Top: " + mTopLayerFound); - return mCasing >= 45 && mTopLayerFound && mMaintenanceHatches.size() == 1; - } - - @Override - public int getMaxEfficiency(ItemStack aStack) { - return 10000; - } - - @Override - public int getPollutionPerTick(ItemStack aStack) { - return 0; - } - - @Override - public int getDamageToComponent(ItemStack aStack) { - return 0; - } - - @Override - public boolean explodesOnComponentBreak(ItemStack aStack) { - return false; - } - - @Override - protected void addFluidOutputs(FluidStack[] mOutputFluids2) { - for (int i = 0; i < mOutputFluids2.length && i < mOutputHatchesByLayer.size(); i++) { - FluidStack tStack = mOutputFluids2[i] != null ? mOutputFluids2[i].copy() : null; - if (tStack == null) { - continue; - } - if (!dumpFluid(mOutputHatchesByLayer.get(i), tStack, true)) { - dumpFluid(mOutputHatchesByLayer.get(i), tStack, false); - } - } - } - - @Override - public void construct(ItemStack stackSize, boolean hintsOnly) { - buildPiece(STRUCTURE_PIECE_BASE, stackSize, hintsOnly, 1, 0, 0); - int tTotalHeight = 8; // min 2 output layer, so at least 1 + 2 height - for (int i = 1; i < tTotalHeight - 1; i++) { - buildPiece(STRUCTURE_PIECE_LAYER_HINT, stackSize, hintsOnly, 1, i, 0); - } - buildPiece(STRUCTURE_PIECE_TOP_HINT, stackSize, hintsOnly, 1, tTotalHeight - 1, 0); - } - - @Override - public int survivalConstruct(ItemStack stackSize, int elementBudget, ISurvivalBuildEnvironment env) { - if (mMachine) return -1; - mHeight = 0; - int built = survivialBuildPiece(STRUCTURE_PIECE_BASE, stackSize, 1, 0, 0, elementBudget, env, false, true); - if (built >= 0) return built; - int tTotalHeight = 8; // min 2 output layer, so at least 1 + 2 height - for (int i = 1; i < tTotalHeight - 1; i++) { - mHeight = i; - built = survivialBuildPiece( - STRUCTURE_PIECE_LAYER_HINT, - stackSize, - 1, - i, - 0, - elementBudget, - env, - false, - true); - if (built >= 0) return built; - } - mHeight = tTotalHeight - 1; - return survivialBuildPiece( - STRUCTURE_PIECE_TOP_HINT, - stackSize, - 1, - tTotalHeight - 1, - 0, - elementBudget, - env, - false, - true); - } - - @Override - public String getMachineType() { - return "Gas Sparger"; - } - - @Override - public int getMaxParallelRecipes() { - return 1; - } - - @Override - public boolean onPlungerRightClick(EntityPlayer aPlayer, ForgeDirection side, float aX, float aY, float aZ) { - int aLayerIndex = 0; - PlayerUtils - .messagePlayer(aPlayer, "Trying to clear " + mOutputHatchesByLayer.size() + " layers of output hatches."); - for (List<GT_MetaTileEntity_Hatch_Output> layer : this.mOutputHatchesByLayer) { - int aHatchIndex = 0; - for (GT_MetaTileEntity_Hatch_Output hatch : layer) { - if (hatch.mFluid != null) { - PlayerUtils.messagePlayer( - aPlayer, - "Clearing " + hatch.mFluid.amount - + "L of " - + hatch.mFluid.getLocalizedName() - + " from hatch " - + aHatchIndex - + " on layer " - + aLayerIndex - + "."); - hatch.mFluid = null; - } - aHatchIndex++; - } - aLayerIndex++; - } - return aLayerIndex > 0; - } - - @Override - public void loadNBTData(NBTTagCompound aNBT) { - super.loadNBTData(aNBT); - // Ensure that lEUt is negative from loaded NBT data, since this multi consumes EU - if (lEUt > 0) { - lEUt = (-lEUt); - } - } -} diff --git a/gtpp/src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/processing/advanced/GregtechMetaTileEntity_Adv_DistillationTower.java b/gtpp/src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/processing/advanced/GregtechMetaTileEntity_Adv_DistillationTower.java deleted file mode 100644 index 8296b8e7cb..0000000000 --- a/gtpp/src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/processing/advanced/GregtechMetaTileEntity_Adv_DistillationTower.java +++ /dev/null @@ -1,491 +0,0 @@ -package gtPlusPlus.xmod.gregtech.common.tileentities.machines.multi.processing.advanced; - -import static com.gtnewhorizon.structurelib.structure.StructureUtility.isAir; -import static com.gtnewhorizon.structurelib.structure.StructureUtility.ofBlock; -import static com.gtnewhorizon.structurelib.structure.StructureUtility.ofChain; -import static com.gtnewhorizon.structurelib.structure.StructureUtility.onElementPass; -import static com.gtnewhorizon.structurelib.structure.StructureUtility.transpose; -import static gregtech.api.enums.GT_HatchElement.Energy; -import static gregtech.api.enums.GT_HatchElement.InputBus; -import static gregtech.api.enums.GT_HatchElement.InputHatch; -import static gregtech.api.enums.GT_HatchElement.Maintenance; -import static gregtech.api.enums.GT_HatchElement.Muffler; -import static gregtech.api.enums.GT_HatchElement.OutputBus; -import static gregtech.api.enums.GT_HatchElement.OutputHatch; -import static gregtech.api.util.GT_StructureUtility.buildHatchAdder; -import static gregtech.api.util.GT_StructureUtility.ofHatchAdder; - -import java.util.ArrayList; -import java.util.Arrays; -import java.util.Collection; -import java.util.List; - -import javax.annotation.Nonnull; - -import net.minecraft.entity.player.EntityPlayer; -import net.minecraft.item.ItemStack; -import net.minecraft.nbt.NBTTagCompound; -import net.minecraft.util.StatCollector; -import net.minecraftforge.common.util.ForgeDirection; -import net.minecraftforge.fluids.FluidStack; - -import com.gtnewhorizon.structurelib.alignment.IAlignmentLimits; -import com.gtnewhorizon.structurelib.alignment.constructable.ISurvivalConstructable; -import com.gtnewhorizon.structurelib.structure.IStructureDefinition; -import com.gtnewhorizon.structurelib.structure.ISurvivalBuildEnvironment; -import com.gtnewhorizon.structurelib.structure.StructureDefinition; - -import gregtech.api.GregTech_API; -import gregtech.api.enums.Textures; -import gregtech.api.interfaces.IHatchElement; -import gregtech.api.interfaces.IIconContainer; -import gregtech.api.interfaces.fluid.IFluidStore; -import gregtech.api.interfaces.metatileentity.IMetaTileEntity; -import gregtech.api.interfaces.tileentity.IGregTechTileEntity; -import gregtech.api.logic.ProcessingLogic; -import gregtech.api.metatileentity.implementations.GT_MetaTileEntity_Hatch_Output; -import gregtech.api.recipe.RecipeMap; -import gregtech.api.recipe.RecipeMaps; -import gregtech.api.util.GT_Multiblock_Tooltip_Builder; -import gregtech.api.util.GT_Utility; -import gregtech.common.tileentities.machines.GT_MetaTileEntity_Hatch_Output_ME; -import gtPlusPlus.core.lib.CORE; -import gtPlusPlus.core.util.minecraft.ItemUtils; -import gtPlusPlus.core.util.minecraft.PlayerUtils; -import gtPlusPlus.xmod.gregtech.api.enums.GregtechItemList; -import gtPlusPlus.xmod.gregtech.api.metatileentity.implementations.base.GregtechMeta_MultiBlockBase; - -public class GregtechMetaTileEntity_Adv_DistillationTower extends - GregtechMeta_MultiBlockBase<GregtechMetaTileEntity_Adv_DistillationTower> implements ISurvivalConstructable { - - private Mode mMode = Mode.DistillationTower; - private boolean mUpgraded = false; - - protected static final String STRUCTURE_PIECE_BASE = "base"; - protected static final String STRUCTURE_PIECE_LAYER = "layer"; - protected static final String STRUCTURE_PIECE_LAYER_HINT = "layerHint"; - protected static final String STRUCTURE_PIECE_TOP_HINT = "topHint"; - - protected final List<List<GT_MetaTileEntity_Hatch_Output>> mOutputHatchesByLayer = new ArrayList<>(); - protected int mHeight; - protected int mCasing; - protected boolean mTopLayerFound; - - private static IStructureDefinition<GregtechMetaTileEntity_Adv_DistillationTower> STRUCTURE_DEFINITION = null; - - public GregtechMetaTileEntity_Adv_DistillationTower(int aID, String aName, String aNameRegional) { - super(aID, aName, aNameRegional); - } - - public GregtechMetaTileEntity_Adv_DistillationTower(String aName) { - super(aName); - } - - @Override - public IMetaTileEntity newMetaEntity(IGregTechTileEntity aTileEntity) { - return new GregtechMetaTileEntity_Adv_DistillationTower(this.mName); - } - - @Override - public IStructureDefinition<GregtechMetaTileEntity_Adv_DistillationTower> getStructureDefinition() { - if (STRUCTURE_DEFINITION == null) { - IHatchElement<GregtechMetaTileEntity_Adv_DistillationTower> layeredOutputHatch = OutputHatch - .withCount(GregtechMetaTileEntity_Adv_DistillationTower::getCurrentLayerOutputHatchCount) - .withAdder(GregtechMetaTileEntity_Adv_DistillationTower::addLayerOutputHatch); - STRUCTURE_DEFINITION = StructureDefinition.<GregtechMetaTileEntity_Adv_DistillationTower>builder() - .addShape(STRUCTURE_PIECE_BASE, transpose(new String[][] { { "b~b", "bbb", "bbb" }, })) - .addShape(STRUCTURE_PIECE_LAYER, transpose(new String[][] { { "lll", "lcl", "lll" }, })) - .addShape(STRUCTURE_PIECE_LAYER_HINT, transpose(new String[][] { { "lll", "l-l", "lll" }, })) - .addShape(STRUCTURE_PIECE_TOP_HINT, transpose(new String[][] { { "ttt", "ttt", "ttt" }, })) - .addElement( - 'b', - ofChain( - buildHatchAdder(GregtechMetaTileEntity_Adv_DistillationTower.class) - .atLeast(Energy, OutputBus, InputHatch, InputBus, Maintenance) - .disallowOnly(ForgeDirection.UP) - .casingIndex(getCasingTextureId()) - .dot(1) - .build(), - ofBlock(GregTech_API.sBlockCasings4, 1))) - .addElement( - 'l', - ofChain( - buildHatchAdder(GregtechMetaTileEntity_Adv_DistillationTower.class) - .atLeast(layeredOutputHatch, Energy, Maintenance) - .disallowOnly(ForgeDirection.UP, ForgeDirection.DOWN) - .casingIndex(getCasingTextureId()) - .dot(2) - .build(), - ofHatchAdder( - GregtechMetaTileEntity_Adv_DistillationTower::addMufflerToMachineList, - getCasingTextureId(), - 3), - ofBlock(GregTech_API.sBlockCasings4, 1))) - .addElement( - 'c', - ofChain( - onElementPass( - GregtechMetaTileEntity_Adv_DistillationTower::onTopLayerFound, - ofHatchAdder( - GregtechMetaTileEntity_Adv_DistillationTower::addMufflerToMachineList, - getCasingTextureId(), - 3)), - onElementPass( - GregtechMetaTileEntity_Adv_DistillationTower::onTopLayerFound, - ofHatchAdder( - GregtechMetaTileEntity_Adv_DistillationTower::addOutputToMachineList, - getCasingTextureId(), - 3)), - onElementPass( - GregtechMetaTileEntity_Adv_DistillationTower::onTopLayerFound, - ofHatchAdder( - GregtechMetaTileEntity_Adv_DistillationTower::addMaintenanceToMachineList, - getCasingTextureId(), - 3)), - onElementPass( - GregtechMetaTileEntity_Adv_DistillationTower::onTopLayerFound, - ofBlock(GregTech_API.sBlockCasings4, 1)), - isAir())) - .addElement( - 't', - buildHatchAdder(GregtechMetaTileEntity_Adv_DistillationTower.class) - .atLeast(layeredOutputHatch, Muffler) - .disallowOnly(ForgeDirection.DOWN) - .casingIndex(getCasingTextureId()) - .dot(2) - .buildAndChain(GregTech_API.sBlockCasings4, 1)) - .build(); - } - return STRUCTURE_DEFINITION; - } - - protected int getCurrentLayerOutputHatchCount() { - return mOutputHatchesByLayer.size() < mHeight || mHeight <= 0 ? 0 - : mOutputHatchesByLayer.get(mHeight - 1) - .size(); - } - - protected boolean addLayerOutputHatch(IGregTechTileEntity aTileEntity, int aBaseCasingIndex) { - if (aTileEntity == null || aTileEntity.isDead() - || !(aTileEntity.getMetaTileEntity() instanceof GT_MetaTileEntity_Hatch_Output tHatch)) return false; - while (mOutputHatchesByLayer.size() < mHeight) mOutputHatchesByLayer.add(new ArrayList<>()); - tHatch.updateTexture(aBaseCasingIndex); - return mOutputHatchesByLayer.get(mHeight - 1) - .add(tHatch) && mOutputHatches.add(tHatch); - } - - protected void onTopLayerFound() { - mTopLayerFound = true; - } - - @Override - protected GT_Multiblock_Tooltip_Builder createTooltip() { - GT_Multiblock_Tooltip_Builder tt = new GT_Multiblock_Tooltip_Builder(); - tt.addMachineType(getMachineType()) - .addInfo("Controller Block for the Advanced Distillation Tower") - .addInfo("Use 85% less energy in distillery mode") - .addInfo("250%/100% faster in DT/distillery mode") - .addInfo("Right click the controller with screwdriver to change mode.") - .addInfo("Max parallel dictated by tower tier and mode") - .addInfo("DTower Mode: T1=4, T2=12") - .addInfo("Distilery Mode: Tower Tier * (4*InputTier)") - .addInfo("Distilery Mode require a full height tower") - .addPollutionAmount(getPollutionPerSecond(null)) - .addSeparator() - .addCasingInfoMin("Clean Stainless Steel Machine Casing", 7, false) - .addInputBus("Bottom Casing", 1) - .addOutputBus("Bottom Casing", 1) - .addInputHatch("Bottom Casing", 1) - .addMaintenanceHatch("Any Casing", 1) - .addEnergyHatch("Any Casing", 1) - .addOutputHatch("One per layer except bottom", 2) - .addMufflerHatch("Top Casing", 3) - .toolTipFinisher(CORE.GT_Tooltip_Builder.get()); - return tt; - } - - @Override - public void construct(ItemStack stackSize, boolean hintsOnly) { - buildPiece(STRUCTURE_PIECE_BASE, stackSize, hintsOnly, 1, 0, 0); - int tTotalHeight = Math.min(12, stackSize.stackSize + 2); // min 2 output layer, so at least 1 + 2 height - for (int i = 1; i < tTotalHeight - 1; i++) { - buildPiece(STRUCTURE_PIECE_LAYER_HINT, stackSize, hintsOnly, 1, i, 0); - } - buildPiece(STRUCTURE_PIECE_TOP_HINT, stackSize, hintsOnly, 1, tTotalHeight - 1, 0); - } - - @Override - public int survivalConstruct(ItemStack stackSize, int elementBudget, ISurvivalBuildEnvironment env) { - mHeight = 0; - int built = survivialBuildPiece(STRUCTURE_PIECE_BASE, stackSize, 1, 0, 0, elementBudget, env, false, true); - if (built >= 0) return built; - int tTotalHeight = Math.min(12, stackSize.stackSize + 2); // min 2 output layer, so at least 1 + 2 height - for (int i = 1; i < tTotalHeight - 1; i++) { - mHeight = i; - built = survivialBuildPiece( - STRUCTURE_PIECE_LAYER_HINT, - stackSize, - 1, - i, - 0, - elementBudget, - env, - false, - true); - if (built >= 0) return built; - } - mHeight = tTotalHeight - 1; - return survivialBuildPiece( - STRUCTURE_PIECE_TOP_HINT, - stackSize, - 1, - tTotalHeight - 1, - 0, - elementBudget, - env, - false, - true); - } - - @Override - public boolean checkMachine(IGregTechTileEntity aBaseMetaTileEntity, ItemStack aStack) { - // reset - mOutputHatchesByLayer.forEach(List::clear); - mHeight = 1; - mTopLayerFound = false; - - // check base - if (!checkPiece(STRUCTURE_PIECE_BASE, 1, 0, 0)) return false; - - // check each layer - while (mHeight < 12) { - if (!checkPiece(STRUCTURE_PIECE_LAYER, 1, mHeight, 0)) { - return false; - } - if (mOutputHatchesByLayer.size() < mHeight || mOutputHatchesByLayer.get(mHeight - 1) - .isEmpty()) - // layer without output hatch - return false; - if (mTopLayerFound || !mMufflerHatches.isEmpty()) { - break; - } - // not top - mHeight++; - } - boolean check = mTopLayerFound && mHeight >= 2 && checkHatch(); - if (check && mHeight < 11) { - // force the mode to DT if not in full height - mMode = Mode.DistillationTower; - mLastRecipe = null; - } - return check; - } - - @Override - public RecipeMap<?> getRecipeMap() { - return mMode.getRecipeMap(); - } - - @Nonnull - @Override - public Collection<RecipeMap<?>> getAvailableRecipeMaps() { - return Arrays.asList(RecipeMaps.distilleryRecipes, RecipeMaps.distillationTowerRecipes); - } - - @Override - public boolean isCorrectMachinePart(ItemStack aStack) { - return true; - } - - @Override - protected IAlignmentLimits getInitialAlignmentLimits() { - // don't rotate a freaking tower, it won't work - return (d, r, f) -> d.offsetY == 0 && r.isNotRotated() && !f.isVerticallyFliped(); - } - - @Override - public int getMaxEfficiency(ItemStack aStack) { - return 10000; - } - - @Override - public int getPollutionPerSecond(ItemStack aStack) { - if (this.mMode == Mode.Distillery) - return CORE.ConfigSwitches.pollutionPerSecondMultiAdvDistillationTower_ModeDistillery; - return CORE.ConfigSwitches.pollutionPerSecondMultiAdvDistillationTower_ModeDT; - } - - @Override - public void saveNBTData(NBTTagCompound aNBT) { - aNBT.setByte("mMode", (byte) mMode.ordinal()); - aNBT.setBoolean("mUpgraded", mUpgraded); - super.saveNBTData(aNBT); - } - - @Override - public void loadNBTData(NBTTagCompound aNBT) { - mMode = Mode.values()[aNBT.getByte("mMode")]; - mUpgraded = aNBT.getBoolean("mUpgraded"); - super.loadNBTData(aNBT); - } - - @Override - public void onModeChangeByScrewdriver(ForgeDirection side, EntityPlayer aPlayer, float aX, float aY, float aZ) { - if (mHeight < 11) { - PlayerUtils.messagePlayer(aPlayer, "Cannot switch mode if not in full height."); - return; - } - mMode = mMode.next(); - PlayerUtils.messagePlayer(aPlayer, "Now running in " + mMode + " Mode."); - mLastRecipe = null; - } - - @Override - public int getDamageToComponent(ItemStack aStack) { - return 0; - } - - @Override - public boolean explodesOnComponentBreak(ItemStack aStack) { - return false; - } - - @Override - public boolean addOutput(FluidStack aLiquid) { - if (aLiquid == null) return false; - FluidStack copiedFluidStack = aLiquid.copy(); - for (List<GT_MetaTileEntity_Hatch_Output> hatches : mOutputHatchesByLayer) { - if (dumpFluid(hatches, copiedFluidStack, true)) return true; - } - for (List<GT_MetaTileEntity_Hatch_Output> hatches : mOutputHatchesByLayer) { - if (dumpFluid(hatches, copiedFluidStack, false)) return true; - } - return false; - } - - @Override - protected void addFluidOutputs(FluidStack[] mOutputFluids2) { - if (mMode == Mode.DistillationTower) { - // dt mode - for (int i = 0; i < mOutputFluids2.length && i < mOutputHatchesByLayer.size(); i++) { - FluidStack tStack = mOutputFluids2[i].copy(); - if (!dumpFluid(mOutputHatchesByLayer.get(i), tStack, true)) - dumpFluid(mOutputHatchesByLayer.get(i), tStack, false); - } - } else { - // distillery mode - for (FluidStack outputFluidStack : mOutputFluids2) { - addOutput(outputFluidStack); - } - } - } - - @Override - public List<? extends IFluidStore> getFluidOutputSlots(FluidStack[] toOutput) { - return getFluidOutputSlotsByLayer(toOutput, mOutputHatchesByLayer); - } - - @Override - public String getMachineType() { - return "Distillery, Distillation Tower"; - } - - @Override - protected ProcessingLogic createProcessingLogic() { - return new ProcessingLogic().setMaxParallelSupplier(this::getMaxParallelRecipes); - } - - @Override - protected void setupProcessingLogic(ProcessingLogic logic) { - super.setupProcessingLogic(logic); - logic.setEuModifier(mMode == Mode.Distillery ? 0.15F : 1F); - logic.setSpeedBonus(mMode == Mode.Distillery ? 1F / 2F : 1F / 3.5F); - } - - @Override - public int getMaxParallelRecipes() { - return switch (mMode) { - case DistillationTower -> getTierOfTower() == 1 ? 4 : getTierOfTower() == 2 ? 12 : 0; - case Distillery -> getTierOfTower() * (4 * GT_Utility.getTier(this.getMaxInputVoltage())); - default -> 0; - }; - } - - private int getTierOfTower() { - return mUpgraded ? 2 : 1; - } - - @Override - protected IIconContainer getActiveOverlay() { - return Textures.BlockIcons.OVERLAY_FRONT_DISTILLATION_TOWER_ACTIVE; - } - - @Override - protected IIconContainer getInactiveOverlay() { - return Textures.BlockIcons.OVERLAY_FRONT_DISTILLATION_TOWER; - } - - @Override - protected int getCasingTextureId() { - return 49; - } - - @Override - public void onPostTick(IGregTechTileEntity aBaseMetaTileEntity, long aTick) { - super.onPostTick(aBaseMetaTileEntity, aTick); - if (aTick % 20 == 0 && !mUpgraded) { - ItemStack aGuiStack = this.getControllerSlot(); - if (aGuiStack != null) { - if (GT_Utility.areStacksEqual(aGuiStack, GregtechItemList.Distillus_Upgrade_Chip.get(1))) { - this.mUpgraded = true; - mInventory[1] = ItemUtils.depleteStack(aGuiStack); - } - } - } - } - - @Override - public boolean canDumpFluidToME() { - // All fluids can be dumped to ME only if each layer contains a ME Output Hatch. - return this.mOutputHatchesByLayer.stream() - .allMatch( - tLayerOutputHatches -> tLayerOutputHatches.stream() - .anyMatch(tHatch -> tHatch instanceof GT_MetaTileEntity_Hatch_Output_ME)); - } - - @Override - public void setItemNBT(NBTTagCompound aNBT) { - aNBT.setBoolean("mUpgraded", mUpgraded); - super.setItemNBT(aNBT); - } - - @Override - public void addAdditionalTooltipInformation(ItemStack stack, List<String> tooltip) { - super.addAdditionalTooltipInformation(stack, tooltip); - NBTTagCompound aNBT = stack.getTagCompound(); - if (aNBT != null && aNBT.hasKey("mUpgraded")) { - tooltip.add(StatCollector.translateToLocal("tooltip.large_distill_tower.upgraded")); - } - } - - private enum Mode { - - DistillationTower(RecipeMaps.distillationTowerRecipes), - Distillery(RecipeMaps.distilleryRecipes),; - - static final Mode[] VALUES = values(); - private final RecipeMap<?> recipeMap; - - Mode(RecipeMap<?> recipeMap) { - this.recipeMap = recipeMap; - } - - public RecipeMap<?> getRecipeMap() { - return recipeMap; - } - - public Mode next() { - return VALUES[(ordinal() + 1) % VALUES.length]; - } - } -} diff --git a/gtpp/src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/processing/advanced/GregtechMetaTileEntity_Adv_EBF.java b/gtpp/src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/processing/advanced/GregtechMetaTileEntity_Adv_EBF.java deleted file mode 100644 index 89c219c14e..0000000000 --- a/gtpp/src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/processing/advanced/GregtechMetaTileEntity_Adv_EBF.java +++ /dev/null @@ -1,333 +0,0 @@ -package gtPlusPlus.xmod.gregtech.common.tileentities.machines.multi.processing.advanced; - -import static com.gtnewhorizon.structurelib.structure.StructureUtility.ofBlock; -import static com.gtnewhorizon.structurelib.structure.StructureUtility.ofChain; -import static com.gtnewhorizon.structurelib.structure.StructureUtility.onElementPass; -import static com.gtnewhorizon.structurelib.structure.StructureUtility.transpose; -import static gregtech.api.enums.GT_HatchElement.Energy; -import static gregtech.api.enums.GT_HatchElement.InputBus; -import static gregtech.api.enums.GT_HatchElement.InputHatch; -import static gregtech.api.enums.GT_HatchElement.Maintenance; -import static gregtech.api.enums.GT_HatchElement.Muffler; -import static gregtech.api.enums.GT_HatchElement.OutputBus; -import static gregtech.api.enums.GT_HatchElement.OutputHatch; -import static gregtech.api.util.GT_StructureUtility.buildHatchAdder; -import static gregtech.api.util.GT_StructureUtility.ofCoil; -import static gregtech.api.util.GT_Utility.filterValidMTEs; - -import java.util.ArrayList; -import java.util.Objects; - -import net.minecraft.entity.player.EntityPlayer; -import net.minecraft.item.ItemStack; -import net.minecraft.nbt.NBTTagCompound; -import net.minecraft.util.ChatComponentTranslation; -import net.minecraft.util.EnumChatFormatting; -import net.minecraft.util.StatCollector; -import net.minecraftforge.common.util.ForgeDirection; - -import org.jetbrains.annotations.NotNull; - -import com.gtnewhorizon.structurelib.alignment.constructable.ISurvivalConstructable; -import com.gtnewhorizon.structurelib.structure.IStructureDefinition; -import com.gtnewhorizon.structurelib.structure.ISurvivalBuildEnvironment; -import com.gtnewhorizon.structurelib.structure.StructureDefinition; - -import gregtech.api.enums.HeatingCoilLevel; -import gregtech.api.enums.TAE; -import gregtech.api.interfaces.IIconContainer; -import gregtech.api.interfaces.metatileentity.IMetaTileEntity; -import gregtech.api.interfaces.tileentity.IGregTechTileEntity; -import gregtech.api.logic.ProcessingLogic; -import gregtech.api.recipe.RecipeMap; -import gregtech.api.recipe.RecipeMaps; -import gregtech.api.recipe.check.CheckRecipeResult; -import gregtech.api.recipe.check.CheckRecipeResultRegistry; -import gregtech.api.util.GT_Multiblock_Tooltip_Builder; -import gregtech.api.util.GT_OverclockCalculator; -import gregtech.api.util.GT_Recipe; -import gregtech.api.util.GT_Utility; -import gregtech.api.util.shutdown.ShutDownReasonRegistry; -import gtPlusPlus.core.block.ModBlocks; -import gtPlusPlus.core.lib.CORE; -import gtPlusPlus.core.util.minecraft.FluidUtils; -import gtPlusPlus.xmod.gregtech.api.metatileentity.implementations.base.GT_MetaTileEntity_Hatch_CustomFluidBase; -import gtPlusPlus.xmod.gregtech.api.metatileentity.implementations.base.GregtechMeta_MultiBlockBase; -import gtPlusPlus.xmod.gregtech.common.blocks.textures.TexturesGtBlock; - -public class GregtechMetaTileEntity_Adv_EBF extends GregtechMeta_MultiBlockBase<GregtechMetaTileEntity_Adv_EBF> - implements ISurvivalConstructable { - - public static int CASING_TEXTURE_ID; - public static String mHotFuelName = "Blazing Pyrotheum"; - public static String mCasingName = "Volcanus Casing"; - public static String mHatchName = "Pyrotheum Hatch"; - private static IStructureDefinition<GregtechMetaTileEntity_Adv_EBF> STRUCTURE_DEFINITION = null; - private int mCasing; - private final ArrayList<GT_MetaTileEntity_Hatch_CustomFluidBase> mPyrotheumHatches = new ArrayList<>(); - - private HeatingCoilLevel mHeatingCapacity = HeatingCoilLevel.None; - - public GregtechMetaTileEntity_Adv_EBF(int aID, String aName, String aNameRegional) { - super(aID, aName, aNameRegional); - CASING_TEXTURE_ID = TAE.getIndexFromPage(2, 11); - } - - public GregtechMetaTileEntity_Adv_EBF(String aName) { - super(aName); - CASING_TEXTURE_ID = TAE.getIndexFromPage(2, 11); - } - - @Override - public String getMachineType() { - return "Blast Furnace"; - } - - @Override - public IMetaTileEntity newMetaEntity(IGregTechTileEntity aTileEntity) { - return new GregtechMetaTileEntity_Adv_EBF(this.mName); - } - - @Override - protected GT_Multiblock_Tooltip_Builder createTooltip() { - GT_Multiblock_Tooltip_Builder tt = new GT_Multiblock_Tooltip_Builder(); - tt.addMachineType(getMachineType()) - .addInfo("Factory Grade Advanced Blast Furnace") - .addInfo("Speed: +120% | EU Usage: 90% | Parallel: 8") - .addInfo("Consumes 10L of " + mHotFuelName + " per second during operation") - .addInfo("Constructed exactly the same as a normal EBF") - .addPollutionAmount(getPollutionPerSecond(null)) - .addSeparator() - .addController("Bottom center") - .addCasingInfoMin(mCasingName, 8, false) - .addInputHatch("Any Casing", 1) - .addInputBus("Any Casing", 1) - .addOutputBus("Any Casing", 1) - .addOutputHatch("Any Casing", 1) - .addEnergyHatch("Any Casing", 1) - .addMufflerHatch("Any Casing", 1) - .addMaintenanceHatch("Any Casing", 1) - .addOtherStructurePart(mHatchName, "Any Casing", 1) - .toolTipFinisher(CORE.GT_Tooltip_Builder.get()); - return tt; - } - - @Override - public String[] getExtraInfoData() { - return new String[] { StatCollector.translateToLocal("GT5U.EBF.heat") + ": " - + EnumChatFormatting.GREEN - + GT_Utility.formatNumbers(mHeatingCapacity.getHeat()) - + EnumChatFormatting.RESET - + " K" }; - } - - @Override - public IStructureDefinition<GregtechMetaTileEntity_Adv_EBF> getStructureDefinition() { - if (STRUCTURE_DEFINITION == null) { - STRUCTURE_DEFINITION = StructureDefinition.<GregtechMetaTileEntity_Adv_EBF>builder() - .addShape( - mName, - transpose( - new String[][] { { "CCC", "CCC", "CCC" }, { "HHH", "H-H", "HHH" }, { "HHH", "H-H", "HHH" }, - { "C~C", "CCC", "CCC" }, })) - .addElement( - 'C', - ofChain( - buildHatchAdder(GregtechMetaTileEntity_Adv_EBF.class) - .adder(GregtechMetaTileEntity_Adv_EBF::addPyrotheumHatch) - .hatchId(968) - .shouldReject(x -> !x.mPyrotheumHatches.isEmpty()) - .casingIndex(CASING_TEXTURE_ID) - .dot(1) - .build(), - buildHatchAdder(GregtechMetaTileEntity_Adv_EBF.class) - .atLeast(InputBus, OutputBus, Maintenance, Energy, Muffler, InputHatch, OutputHatch) - .casingIndex(CASING_TEXTURE_ID) - .dot(1) - .build(), - onElementPass(x -> ++x.mCasing, ofBlock(ModBlocks.blockCasings3Misc, 11)))) - .addElement( - 'H', - ofCoil(GregtechMetaTileEntity_Adv_EBF::setCoilLevel, GregtechMetaTileEntity_Adv_EBF::getCoilLevel)) - .build(); - } - return STRUCTURE_DEFINITION; - } - - @Override - public void construct(ItemStack stackSize, boolean hintsOnly) { - buildPiece(mName, stackSize, hintsOnly, 1, 3, 0); - } - - @Override - public int survivalConstruct(ItemStack stackSize, int elementBudget, ISurvivalBuildEnvironment env) { - if (mMachine) return -1; - return survivialBuildPiece(mName, stackSize, 1, 3, 0, elementBudget, env, false, true); - } - - @Override - public boolean checkMachine(IGregTechTileEntity aBaseMetaTileEntity, ItemStack aStack) { - mCasing = 0; - mPyrotheumHatches.clear(); - setCoilLevel(HeatingCoilLevel.None); - return checkPiece(mName, 1, 3, 0) && mCasing >= 8 && getCoilLevel() != HeatingCoilLevel.None && checkHatch(); - } - - @Override - public boolean checkHatch() { - return super.checkHatch() && !mPyrotheumHatches.isEmpty(); - } - - private boolean addPyrotheumHatch(IGregTechTileEntity aTileEntity, int aBaseCasingIndex) { - if (aTileEntity == null) { - return false; - } else { - IMetaTileEntity aMetaTileEntity = aTileEntity.getMetaTileEntity(); - if (aMetaTileEntity instanceof GT_MetaTileEntity_Hatch_CustomFluidBase - && aMetaTileEntity.getBaseMetaTileEntity() - .getMetaTileID() == 968) { - return addToMachineListInternal(mPyrotheumHatches, aTileEntity, aBaseCasingIndex); - } - } - return false; - } - - @Override - public void updateSlots() { - for (GT_MetaTileEntity_Hatch_CustomFluidBase tHatch : filterValidMTEs(mPyrotheumHatches)) tHatch.updateSlots(); - super.updateSlots(); - } - - @Override - protected IIconContainer getActiveOverlay() { - return TexturesGtBlock.Overlay_Machine_Controller_Advanced_Active; - } - - @Override - protected IIconContainer getInactiveOverlay() { - return TexturesGtBlock.Overlay_Machine_Controller_Advanced; - } - - @Override - protected int getCasingTextureId() { - return CASING_TEXTURE_ID; - } - - @Override - public RecipeMap<?> getRecipeMap() { - return RecipeMaps.blastFurnaceRecipes; - } - - @Override - public int getRecipeCatalystPriority() { - return -1; - } - - @Override - public boolean isCorrectMachinePart(ItemStack aStack) { - return true; - } - - @Override - protected ProcessingLogic createProcessingLogic() { - return new ProcessingLogic() { - - @NotNull - @Override - protected CheckRecipeResult validateRecipe(@NotNull GT_Recipe recipe) { - return recipe.mSpecialValue <= getCoilLevel().getHeat() ? CheckRecipeResultRegistry.SUCCESSFUL - : CheckRecipeResultRegistry.insufficientHeat(recipe.mSpecialValue); - } - - @NotNull - @Override - protected GT_OverclockCalculator createOverclockCalculator(@NotNull GT_Recipe recipe) { - return super.createOverclockCalculator(recipe).setHeatOC(true) - .setHeatDiscount(true) - .setRecipeHeat(recipe.mSpecialValue) - .setMachineHeat((int) getCoilLevel().getHeat()); - } - }.setSpeedBonus(1F / 2.2F) - .setEuModifier(0.9F) - .setMaxParallelSupplier(this::getMaxParallelRecipes); - } - - @Override - public int getMaxEfficiency(ItemStack aStack) { - return 10000; - } - - @Override - public int getPollutionPerSecond(ItemStack aStack) { - return CORE.ConfigSwitches.pollutionPerSecondMultiAdvEBF; - } - - @Override - public int getDamageToComponent(ItemStack aStack) { - return 0; - } - - @Override - public boolean explodesOnComponentBreak(ItemStack aStack) { - return false; - } - - private int mGraceTimer = 2; - - @Override - public void onPostTick(IGregTechTileEntity aBaseMetaTileEntity, long aTick) { - super.onPostTick(aBaseMetaTileEntity, aTick); - // Try dry Pyrotheum after all other logic - if (this.mStartUpCheck < 0) { - if (this.mMaxProgresstime > 0 && this.mProgresstime != 0 || this.getBaseMetaTileEntity() - .hasWorkJustBeenEnabled()) { - if (aTick % 10 == 0 || this.getBaseMetaTileEntity() - .hasWorkJustBeenEnabled()) { - if (!this.depleteInputFromRestrictedHatches(this.mPyrotheumHatches, 5)) { - if (mGraceTimer-- == 0) { - this.causeMaintenanceIssue(); - this.stopMachine( - ShutDownReasonRegistry - .outOfFluid(Objects.requireNonNull(FluidUtils.getFluidStack("pyrotheum", 10)))); - mGraceTimer = 2; - } - } - } - } - } - } - - @Override - public int getMaxParallelRecipes() { - return 8; - } - - @Override - public void onModeChangeByScrewdriver(ForgeDirection side, EntityPlayer aPlayer, float aX, float aY, float aZ) { - inputSeparation = !inputSeparation; - aPlayer.addChatMessage( - new ChatComponentTranslation( - inputSeparation ? "interaction.separateBusses.enabled" : "interaction.separateBusses.disabled")); - } - - @Override - public void loadNBTData(NBTTagCompound aNBT) { - super.loadNBTData(aNBT); - if (!aNBT.hasKey(INPUT_SEPARATION_NBT_KEY)) { - inputSeparation = aNBT.getBoolean("isBussesSeparate"); - } - } - - public HeatingCoilLevel getCoilLevel() { - return mHeatingCapacity; - } - - public void setCoilLevel(HeatingCoilLevel aCoilLevel) { - mHeatingCapacity = aCoilLevel; - } - - @Override - public boolean supportsInputSeparation() { - return true; - } -} diff --git a/gtpp/src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/processing/advanced/GregtechMetaTileEntity_Adv_Fusion_MK4.java b/gtpp/src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/processing/advanced/GregtechMetaTileEntity_Adv_Fusion_MK4.java deleted file mode 100644 index 0981a34b85..0000000000 --- a/gtpp/src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/processing/advanced/GregtechMetaTileEntity_Adv_Fusion_MK4.java +++ /dev/null @@ -1,200 +0,0 @@ -package gtPlusPlus.xmod.gregtech.common.tileentities.machines.multi.processing.advanced; - -import java.lang.reflect.Method; - -import net.minecraft.block.Block; -import net.minecraftforge.common.util.ForgeDirection; - -import gregtech.api.enums.Dyes; -import gregtech.api.enums.TAE; -import gregtech.api.enums.Textures; -import gregtech.api.interfaces.IIconContainer; -import gregtech.api.interfaces.ITexture; -import gregtech.api.interfaces.tileentity.IGregTechTileEntity; -import gregtech.api.logic.ProcessingLogic; -import gregtech.api.metatileentity.MetaTileEntity; -import gregtech.api.metatileentity.implementations.GT_MetaTileEntity_Hatch; -import gregtech.api.metatileentity.implementations.GT_MetaTileEntity_Hatch_Energy; -import gregtech.api.metatileentity.implementations.GT_MetaTileEntity_Hatch_Input; -import gregtech.api.metatileentity.implementations.GT_MetaTileEntity_Hatch_Output; -import gregtech.api.objects.GT_RenderedTexture; -import gregtech.api.objects.overclockdescriber.OverclockDescriber; -import gregtech.api.render.TextureFactory; -import gregtech.api.util.AdvancedFusionOverclockDescriber; -import gregtech.api.util.GT_Multiblock_Tooltip_Builder; -import gregtech.common.tileentities.machines.multi.GT_MetaTileEntity_FusionComputer; -import gtPlusPlus.core.block.ModBlocks; -import gtPlusPlus.core.lib.CORE; -import gtPlusPlus.core.util.reflect.ReflectionUtils; -import gtPlusPlus.xmod.gregtech.common.blocks.textures.TexturesGtBlock; - -public class GregtechMetaTileEntity_Adv_Fusion_MK4 extends GT_MetaTileEntity_FusionComputer { - - public static final Method mUpdateHatchTexture; - - static { - mUpdateHatchTexture = ReflectionUtils.getMethod(GT_MetaTileEntity_Hatch.class, "updateTexture", int.class); - } - - public GregtechMetaTileEntity_Adv_Fusion_MK4(int aID, String aName, String aNameRegional) { - super(aID, aName, aNameRegional); - } - - public GregtechMetaTileEntity_Adv_Fusion_MK4(String aName) { - super(aName); - } - - @Override - protected OverclockDescriber createOverclockDescriber() { - return new AdvancedFusionOverclockDescriber((byte) tier(), capableStartupCanonical()); - } - - @Override - protected GT_Multiblock_Tooltip_Builder createTooltip() { - GT_Multiblock_Tooltip_Builder tt = new GT_Multiblock_Tooltip_Builder(); - tt.addMachineType("Fusion Reactor") - .addInfo("HARNESSING THE POWER OF A BLUE GIANT") - .addInfo("Controller block for the Fusion Reactor Mk IV") - .addInfo("131072EU/t and 320M EU capacity per Energy Hatch") - .addInfo("If the recipe has a startup cost greater than the") - .addInfo("number of energy hatches * cap, you can't do it") - .addInfo("Performs 4/4 overclocks") - .addSeparator() - .beginStructureBlock(15, 3, 15, false) - .addController("See diagram when placed") - .addCasingInfoMin("Fusion Machine Casings MK III", 79, false) - .addStructureInfo("Cover the coils with casing") - .addOtherStructurePart("Advanced Fusion Coils", "Center part of the ring") - .addEnergyHatch("1-16, Specified casings", 2) - .addInputHatch("2-16, Specified casings", 1) - .addOutputHatch("1-16, Specified casings", 3) - .addStructureInfo("ALL Hatches must be UHV or better") - .toolTipFinisher(CORE.GT_Tooltip_Builder.get()); - return tt; - } - - @Override - public int tier() { - return 9; - } - - @Override - public long maxEUStore() { - return (640010000L * 4) * (Math.min(16, this.mEnergyHatches.size())) / 8L; - } - - @Override - public long capableStartupCanonical() { - return 5_120_000_000L; - } - - @Override - public int getRecipeCatalystPriority() { - return -1; - } - - @Override - public MetaTileEntity newMetaEntity(IGregTechTileEntity aTileEntity) { - return new GregtechMetaTileEntity_Adv_Fusion_MK4(mName); - } - - @Override - public Block getCasing() { - return getFusionCoil(); - } - - @Override - public int getCasingMeta() { - return 12; - } - - @Override - public Block getFusionCoil() { - return ModBlocks.blockCasings3Misc; - } - - @Override - public int getFusionCoilMeta() { - return 13; - } - - @Override - protected ProcessingLogic createProcessingLogic() { - return super.createProcessingLogic().setOverclock(2, 2); - } - - @Override - public ITexture[] getTexture(final IGregTechTileEntity aBaseMetaTileEntity, final ForgeDirection side, - final ForgeDirection facing, final int aColorIndex, final boolean aActive, final boolean aRedstone) { - if (side == facing) { - return new ITexture[] { - new GT_RenderedTexture( - Textures.BlockIcons.MACHINE_CASING_FUSION_GLASS, - Dyes.getModulation(-1, Dyes._NULL.mRGBa)), - TextureFactory.builder() - .addIcon(this.getIconOverlay()) - .extFacing() - .build() }; - } else if (!aActive) { - return new ITexture[] { new GT_RenderedTexture( - Textures.BlockIcons.MACHINE_CASING_FUSION_GLASS, - Dyes.getModulation(-1, Dyes._NULL.mRGBa)) }; - } else { - return new ITexture[] { new GT_RenderedTexture( - TexturesGtBlock.TEXTURE_CASING_FUSION_CASING_ULTRA, - Dyes.getModulation(-1, Dyes._NULL.mRGBa)) }; - } - } - - @Override - public ITexture getTextureOverlay() { - return new GT_RenderedTexture( - this.getBaseMetaTileEntity() - .isActive() ? TexturesGtBlock.Casing_Machine_Screen_3 : TexturesGtBlock.Casing_Machine_Screen_1); - } - - public IIconContainer getIconOverlay() { - return this.getBaseMetaTileEntity() - .isActive() ? TexturesGtBlock.Casing_Machine_Screen_3 : TexturesGtBlock.Casing_Machine_Screen_1; - } - - @Override - public boolean turnCasingActive(final boolean status) { - try { - if (this.mEnergyHatches != null) { - for (final GT_MetaTileEntity_Hatch_Energy hatch : this.mEnergyHatches) { - mUpdateHatchTexture.invoke(hatch, (status ? TAE.getIndexFromPage(2, 14) : 53)); - } - } - if (this.mOutputHatches != null) { - for (final GT_MetaTileEntity_Hatch_Output hatch2 : this.mOutputHatches) { - mUpdateHatchTexture.invoke(hatch2, (status ? TAE.getIndexFromPage(2, 14) : 53)); - } - } - if (this.mInputHatches != null) { - for (final GT_MetaTileEntity_Hatch_Input hatch3 : this.mInputHatches) { - mUpdateHatchTexture.invoke(hatch3, (status ? TAE.getIndexFromPage(2, 14) : 53)); - } - } - } catch (Throwable t) { - return false; - } - return true; - } - - @Override - public String[] getInfoData() { - String tier = "IV"; - float plasmaOut = 0; - int powerRequired = 0; - if (this.mLastRecipe != null) { - powerRequired = this.mLastRecipe.mEUt; - if (this.mLastRecipe.getFluidOutput(0) != null) { - plasmaOut = (float) this.mLastRecipe.getFluidOutput(0).amount / (float) this.mLastRecipe.mDuration; - } - } - - return new String[] { "Fusion Reactor MK " + tier, "EU Required: " + powerRequired + "EU/t", - "Stored EU: " + mEUStore + " / " + maxEUStore(), "Plasma Output: " + plasmaOut + "L/t" }; - } -} diff --git a/gtpp/src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/processing/advanced/GregtechMetaTileEntity_Adv_Fusion_MK5.java b/gtpp/src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/processing/advanced/GregtechMetaTileEntity_Adv_Fusion_MK5.java deleted file mode 100644 index b2c2e5eb27..0000000000 --- a/gtpp/src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/processing/advanced/GregtechMetaTileEntity_Adv_Fusion_MK5.java +++ /dev/null @@ -1,200 +0,0 @@ -package gtPlusPlus.xmod.gregtech.common.tileentities.machines.multi.processing.advanced; - -import java.lang.reflect.Method; - -import net.minecraft.block.Block; -import net.minecraftforge.common.util.ForgeDirection; - -import gregtech.api.enums.Dyes; -import gregtech.api.enums.TAE; -import gregtech.api.enums.Textures; -import gregtech.api.interfaces.IIconContainer; -import gregtech.api.interfaces.ITexture; -import gregtech.api.interfaces.tileentity.IGregTechTileEntity; -import gregtech.api.logic.ProcessingLogic; -import gregtech.api.metatileentity.MetaTileEntity; -import gregtech.api.metatileentity.implementations.GT_MetaTileEntity_Hatch; -import gregtech.api.metatileentity.implementations.GT_MetaTileEntity_Hatch_Energy; -import gregtech.api.metatileentity.implementations.GT_MetaTileEntity_Hatch_Input; -import gregtech.api.metatileentity.implementations.GT_MetaTileEntity_Hatch_Output; -import gregtech.api.objects.GT_RenderedTexture; -import gregtech.api.objects.overclockdescriber.OverclockDescriber; -import gregtech.api.render.TextureFactory; -import gregtech.api.util.AdvancedFusionOverclockDescriber; -import gregtech.api.util.GT_Multiblock_Tooltip_Builder; -import gregtech.common.tileentities.machines.multi.GT_MetaTileEntity_FusionComputer; -import gtPlusPlus.core.block.ModBlocks; -import gtPlusPlus.core.lib.CORE; -import gtPlusPlus.core.util.reflect.ReflectionUtils; -import gtPlusPlus.xmod.gregtech.common.blocks.textures.TexturesGtBlock; - -public class GregtechMetaTileEntity_Adv_Fusion_MK5 extends GT_MetaTileEntity_FusionComputer { - - public static final Method mUpdateHatchTexture; - - static { - mUpdateHatchTexture = ReflectionUtils.getMethod(GT_MetaTileEntity_Hatch.class, "updateTexture", int.class); - } - - public GregtechMetaTileEntity_Adv_Fusion_MK5(int aID, String aName, String aNameRegional) { - super(aID, aName, aNameRegional); - } - - public GregtechMetaTileEntity_Adv_Fusion_MK5(String aName) { - super(aName); - } - - @Override - protected OverclockDescriber createOverclockDescriber() { - return new AdvancedFusionOverclockDescriber((byte) tier(), capableStartupCanonical()); - } - - @Override - protected GT_Multiblock_Tooltip_Builder createTooltip() { - GT_Multiblock_Tooltip_Builder tt = new GT_Multiblock_Tooltip_Builder(); - tt.addMachineType("Fusion Reactor") - .addInfo("HARNESSING THE POWER OF A NEUTRON STAR") - .addInfo("Controller block for the Fusion Reactor Mk V") - .addInfo("524,288EU/t and 1.28B EU capacity per Energy Hatch") - .addInfo("If the recipe has a startup cost greater than the") - .addInfo("number of energy hatches * cap, you can't do it") - .addInfo("Performs 4/4 overclocks") - .addSeparator() - .beginStructureBlock(15, 3, 15, false) - .addController("See diagram when placed") - .addCasingInfoMin("Fusion Machine Casings MK IV", 79, false) - .addStructureInfo("Cover the coils with casing") - .addOtherStructurePart("Advanced Fusion Coils II", "Center part of the ring") - .addEnergyHatch("1-16, Specified casings", 2) - .addInputHatch("2-16, Specified casings", 1) - .addOutputHatch("1-16, Specified casings", 3) - .addStructureInfo("ALL Hatches must be UEV or better") - .toolTipFinisher(CORE.GT_Tooltip_Builder.get()); - return tt; - } - - @Override - public int tier() { - return 10; - } - - @Override - public long maxEUStore() { - return (640010000L * 16) * (Math.min(16, this.mEnergyHatches.size())) / 8L; - } - - @Override - public long capableStartupCanonical() { - return 20_480_000_000L; - } - - @Override - public int getRecipeCatalystPriority() { - return -1; - } - - @Override - public MetaTileEntity newMetaEntity(IGregTechTileEntity aTileEntity) { - return new GregtechMetaTileEntity_Adv_Fusion_MK5(mName); - } - - @Override - public Block getCasing() { - return getFusionCoil(); - } - - @Override - public int getCasingMeta() { - return 0; - } - - @Override - public Block getFusionCoil() { - return ModBlocks.blockCasings6Misc; - } - - @Override - public int getFusionCoilMeta() { - return 1; - } - - @Override - protected ProcessingLogic createProcessingLogic() { - return super.createProcessingLogic().setOverclock(2, 2); - } - - @Override - public ITexture[] getTexture(final IGregTechTileEntity aBaseMetaTileEntity, final ForgeDirection side, - final ForgeDirection facing, final int aColorIndex, final boolean aActive, final boolean aRedstone) { - if (side == facing) { - return new ITexture[] { - new GT_RenderedTexture( - Textures.BlockIcons.MACHINE_CASING_FUSION_GLASS, - Dyes.getModulation(-1, Dyes._NULL.mRGBa)), - TextureFactory.builder() - .addIcon(this.getIconOverlay()) - .extFacing() - .build() }; - } else if (!aActive) { - return new ITexture[] { new GT_RenderedTexture( - Textures.BlockIcons.MACHINE_CASING_FUSION_GLASS, - Dyes.getModulation(-1, Dyes._NULL.mRGBa)) }; - } else { - return new ITexture[] { new GT_RenderedTexture( - TexturesGtBlock.TEXTURE_CASING_FUSION_CASING_HYPER, - Dyes.getModulation(-1, Dyes._NULL.mRGBa)) }; - } - } - - @Override - public ITexture getTextureOverlay() { - return new GT_RenderedTexture( - this.getBaseMetaTileEntity() - .isActive() ? TexturesGtBlock.Casing_Machine_Screen_Rainbow : TexturesGtBlock.Casing_Machine_Screen_1); - } - - public IIconContainer getIconOverlay() { - return this.getBaseMetaTileEntity() - .isActive() ? TexturesGtBlock.Casing_Machine_Screen_Rainbow : TexturesGtBlock.Casing_Machine_Screen_1; - } - - @Override - public boolean turnCasingActive(final boolean status) { - try { - if (this.mEnergyHatches != null) { - for (final GT_MetaTileEntity_Hatch_Energy hatch : this.mEnergyHatches) { - mUpdateHatchTexture.invoke(hatch, (status ? TAE.getIndexFromPage(3, 6) : 53)); - } - } - if (this.mOutputHatches != null) { - for (final GT_MetaTileEntity_Hatch_Output hatch2 : this.mOutputHatches) { - mUpdateHatchTexture.invoke(hatch2, (status ? TAE.getIndexFromPage(3, 6) : 53)); - } - } - if (this.mInputHatches != null) { - for (final GT_MetaTileEntity_Hatch_Input hatch3 : this.mInputHatches) { - mUpdateHatchTexture.invoke(hatch3, (status ? TAE.getIndexFromPage(3, 6) : 53)); - } - } - } catch (Throwable t) { - return false; - } - return true; - } - - @Override - public String[] getInfoData() { - String tier = "V"; - float plasmaOut = 0; - int powerRequired = 0; - if (this.mLastRecipe != null) { - powerRequired = this.mLastRecipe.mEUt; - if (this.mLastRecipe.getFluidOutput(0) != null) { - plasmaOut = (float) this.mLastRecipe.getFluidOutput(0).amount / (float) this.mLastRecipe.mDuration; - } - } - - return new String[] { "Fusion Reactor MK " + tier, "EU Required: " + powerRequired + "EU/t", - "Stored EU: " + mEUStore + " / " + maxEUStore(), "Plasma Output: " + plasmaOut + "L/t" }; - } -} diff --git a/gtpp/src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/processing/advanced/GregtechMetaTileEntity_Adv_HeatExchanger.java b/gtpp/src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/processing/advanced/GregtechMetaTileEntity_Adv_HeatExchanger.java deleted file mode 100644 index e4340c4d28..0000000000 --- a/gtpp/src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/processing/advanced/GregtechMetaTileEntity_Adv_HeatExchanger.java +++ /dev/null @@ -1,414 +0,0 @@ -package gtPlusPlus.xmod.gregtech.common.tileentities.machines.multi.processing.advanced; - -import static com.gtnewhorizon.structurelib.structure.StructureUtility.ofBlock; -import static com.gtnewhorizon.structurelib.structure.StructureUtility.ofChain; -import static com.gtnewhorizon.structurelib.structure.StructureUtility.onElementPass; -import static com.gtnewhorizon.structurelib.structure.StructureUtility.transpose; -import static gregtech.api.util.GT_StructureUtility.ofHatchAdder; - -import net.minecraft.block.Block; -import net.minecraft.item.ItemStack; -import net.minecraft.nbt.NBTTagCompound; -import net.minecraft.util.EnumChatFormatting; -import net.minecraft.util.StatCollector; -import net.minecraftforge.fluids.FluidRegistry; -import net.minecraftforge.fluids.FluidStack; - -import org.jetbrains.annotations.NotNull; - -import com.gtnewhorizon.structurelib.alignment.IAlignmentLimits; -import com.gtnewhorizon.structurelib.structure.IStructureDefinition; -import com.gtnewhorizon.structurelib.structure.StructureDefinition; - -import gregtech.api.GregTech_API; -import gregtech.api.enums.TAE; -import gregtech.api.interfaces.IIconContainer; -import gregtech.api.interfaces.metatileentity.IMetaTileEntity; -import gregtech.api.interfaces.tileentity.IGregTechTileEntity; -import gregtech.api.metatileentity.implementations.GT_MetaTileEntity_Hatch; -import gregtech.api.metatileentity.implementations.GT_MetaTileEntity_Hatch_Input; -import gregtech.api.metatileentity.implementations.GT_MetaTileEntity_Hatch_Output; -import gregtech.api.recipe.check.CheckRecipeResult; -import gregtech.api.recipe.check.CheckRecipeResultRegistry; -import gregtech.api.util.GT_Log; -import gregtech.api.util.GT_ModHandler; -import gregtech.api.util.GT_Multiblock_Tooltip_Builder; -import gregtech.api.util.GT_Utility; -import gtPlusPlus.core.block.ModBlocks; -import gtPlusPlus.core.block.base.BasicBlock.BlockTypes; -import gtPlusPlus.core.block.base.BlockBaseModular; -import gtPlusPlus.core.lib.CORE; -import gtPlusPlus.core.material.ALLOY; -import gtPlusPlus.xmod.gregtech.api.metatileentity.implementations.base.GregtechMeta_MultiBlockBase; -import gtPlusPlus.xmod.gregtech.common.blocks.textures.TexturesGtBlock; - -public class GregtechMetaTileEntity_Adv_HeatExchanger - extends GregtechMeta_MultiBlockBase<GregtechMetaTileEntity_Adv_HeatExchanger> { - - private static final int CASING_INDEX = TAE.getIndexFromPage(1, 12); - private static final String STRUCTURE_PIECE_MAIN = "main"; - - private static final IStructureDefinition<GregtechMetaTileEntity_Adv_HeatExchanger> STRUCTURE_DEFINITION = StructureDefinition - .<GregtechMetaTileEntity_Adv_HeatExchanger>builder() - .addShape( - STRUCTURE_PIECE_MAIN, - transpose( - new String[][] { { " ccc ", "cCCCc", "cCCCc", "cCCCc", " ccc " }, - { " ccc ", "cPPPc", "cPPPc", "cPPPc", " ccc " }, { " ccc ", "cPPPc", "cPPPc", "cPPPc", " ccc " }, - { " ccc ", "cPPPc", "cPPPc", "cPPPc", " ccc " }, { " ccc ", "cPPPc", "cPPPc", "cPPPc", " ccc " }, - { " c~c ", "cPPPc", "cPPPc", "cPPPc", " ccc " }, { " hhh ", "hHHHh", "hHHHh", "hHHHh", " hhh " }, - { " f f ", "f f", " ", "f f", " f f " }, - { " f f ", "f f", " ", "f f", " f f " }, })) - .addElement('P', ofBlock(GregTech_API.sBlockCasings2, 15)) - .addElement('f', ofBlock(getFrame(), 0)) - .addElement( - 'C', - ofChain( - ofHatchAdder( - GregtechMetaTileEntity_Adv_HeatExchanger::addColdFluidOutputToMachineList, - CASING_INDEX, - 2), - onElementPass( - GregtechMetaTileEntity_Adv_HeatExchanger::onCasingAdded, - ofBlock(ModBlocks.blockSpecialMultiCasings, 14)))) - .addElement( - 'H', - ofChain( - ofHatchAdder(GregtechMetaTileEntity_Adv_HeatExchanger::addHotFluidInputToMachineList, CASING_INDEX, 3), - onElementPass( - GregtechMetaTileEntity_Adv_HeatExchanger::onCasingAdded, - ofBlock(ModBlocks.blockSpecialMultiCasings, 14)))) - .addElement( - 'h', - ofChain( - ofHatchAdder(GregtechMetaTileEntity_Adv_HeatExchanger::addInputToMachineList, CASING_INDEX, 1), - ofHatchAdder(GregtechMetaTileEntity_Adv_HeatExchanger::addOutputToMachineList, CASING_INDEX, 1), - ofHatchAdder(GregtechMetaTileEntity_Adv_HeatExchanger::addMaintenanceToMachineList, CASING_INDEX, 1), - onElementPass( - GregtechMetaTileEntity_Adv_HeatExchanger::onCasingAdded, - ofBlock(ModBlocks.blockSpecialMultiCasings, 14)))) - .addElement( - 'c', - ofChain( - onElementPass( - GregtechMetaTileEntity_Adv_HeatExchanger::onCasingAdded, - ofBlock(ModBlocks.blockSpecialMultiCasings, 14)))) - .build(); - public static float penalty_per_config = 0.015f; // penalize 1.5% efficiency per circuitry level (1-25) - - private GT_MetaTileEntity_Hatch_Input mInputHotFluidHatch; - private GT_MetaTileEntity_Hatch_Output mOutputColdFluidHatch; - private boolean superheated = false; - private int superheated_threshold = 0; - private float water; - private int mCasingAmount; - - public GregtechMetaTileEntity_Adv_HeatExchanger(int aID, String aName, String aNameRegional) { - super(aID, aName, aNameRegional); - } - - public GregtechMetaTileEntity_Adv_HeatExchanger(String aName) { - super(aName); - } - - @Override - protected GT_Multiblock_Tooltip_Builder createTooltip() { - final GT_Multiblock_Tooltip_Builder tt = new GT_Multiblock_Tooltip_Builder(); - tt.addMachineType(getMachineType()) - .addInfo("Controller Block for the XL Heat Exchanger") - .addInfo("More complicated than a Fusion Reactor. Seriously") - .addInfo("But you know this by now, right?") - .addInfo("Works as fast as 32 Large Heat Exchangers") - .addSeparator() - .addInfo("Inputs are Hot Coolant or Lava") - .addInfo("Outputs Coolant or Pahoehoe Lava and SH Steam/Steam") - .addInfo("Outputs SH Steam if input flow is equal to or above a certain value:") - .addInfo("Hot Coolant: 25,600 L/s, maximum 51,200 L/s, max output 10,240,000 SH Steam/s") - .addInfo("Lava: 32,000 L/s, maximum 64,000 L/s, max output 5,120,000 SH Steam/s") - .addInfo("A circuit in the controller lowers the SH Steam threshold and efficiency") - .addInfo("3.75% reduction and 1.5% efficiency loss per circuit config over 1") - .addSeparator() - .beginStructureBlock(5, 9, 5, false) - .addController("Front bottom") - .addCasingInfoMin("Reinforced Heat Exchanger Casing", 90, false) - .addOtherStructurePart("Tungstensteel Pipe Casing", "Center 3x5x3 (45 blocks)") - .addMaintenanceHatch("Any casing", 1) - .addInputHatch("Hot fluid, bottom center", 2) - .addInputHatch("Distilled water, any bottom layer casing", 1) - .addOutputHatch("Cold fluid, top center", 3) - .addOutputHatch("Steam/SH Steam, any bottom layer casing", 1) - .toolTipFinisher(CORE.GT_Tooltip_Builder.get()); - return tt; - } - - @Override - public void loadNBTData(NBTTagCompound aNBT) { - superheated = aNBT.getBoolean("superheated"); - super.loadNBTData(aNBT); - } - - @Override - public void saveNBTData(NBTTagCompound aNBT) { - aNBT.setBoolean("superheated", superheated); - super.saveNBTData(aNBT); - } - - @Override - protected IIconContainer getActiveOverlay() { - return TexturesGtBlock.Overlay_Machine_Controller_Advanced_Active; - } - - @Override - protected IIconContainer getInactiveOverlay() { - return TexturesGtBlock.Overlay_Machine_Controller_Advanced; - } - - @Override - protected int getCasingTextureId() { - return CASING_INDEX; - } - - @Override - public boolean isCorrectMachinePart(ItemStack aStack) { - return true; - } - - @Override - protected IAlignmentLimits getInitialAlignmentLimits() { - return (d, r, f) -> !r.isUpsideDown() && !f.isVerticallyFliped(); - } - - @Override - public @NotNull CheckRecipeResult checkProcessing() { - if (mInputHotFluidHatch.getFluid() == null) return CheckRecipeResultRegistry.SUCCESSFUL; - - int fluidAmountToConsume = mInputHotFluidHatch.getFluidAmount(); // how much fluid is in hatch - - // The XL LHE works as fast as 32 regular LHEs. These are the comments from the original LHE, - // with changes where the values needed to change for the 32x speed multiplier - superheated_threshold = 128000; // default: must have 4000L -> 128000L per second to generate superheated steam - float efficiency = 1f; // default: operate at 100% efficiency with no integrated circuitry - int shs_reduction_per_config = 4800; // reduce threshold 150L -> 4800L per second per circuitry level (1-25) - float steam_output_multiplier = 20f; // default: multiply output by 4 * 10 (boosted x5) - float penalty = 0.0f; // penalty to apply to output based on circuitry level (1-25). - boolean do_lava = false; - - // Do we have an integrated circuit with a valid configuration? - if (mInventory[1] != null && mInventory[1].getUnlocalizedName() - .startsWith("gt.integrated_circuit")) { - int circuit_config = mInventory[1].getItemDamage(); - if (circuit_config >= 1 && circuit_config <= 25) { - // If so, apply the penalty and reduced threshold. - penalty = (circuit_config - 1) * penalty_per_config; - superheated_threshold -= (shs_reduction_per_config * (circuit_config - 1)); - } - } - efficiency -= penalty; - - // If we're working with lava, adjust the threshold and multipliers accordingly. - if (GT_ModHandler.isLava(mInputHotFluidHatch.getFluid())) { - steam_output_multiplier /= 5f; // lava is not boosted - superheated_threshold /= 4f; // unchanged - do_lava = true; - } else if (mInputHotFluidHatch.getFluid() - .isFluidEqual(FluidRegistry.getFluidStack("ic2hotcoolant", 1))) { - steam_output_multiplier /= 2f; // was boosted x2 on top of x5 -> total x10 -> nerf with this code back - // to 5x - superheated_threshold /= 5f; // 10x smaller since the Hot Things production in reactor is the same. - } else { - // If we're working with neither, fail out - superheated_threshold = 0; - return CheckRecipeResultRegistry.NO_RECIPE; - } - - superheated = fluidAmountToConsume >= superheated_threshold; // set the internal superheated flag if we have - // enough hot fluid. Used in the - // onRunningTick method. - fluidAmountToConsume = Math.min(fluidAmountToConsume, superheated_threshold * 2); // Don't consume too much hot - // fluid per second, maximum - // is 2x SH threshold. - mInputHotFluidHatch.drain(fluidAmountToConsume, true); - this.mMaxProgresstime = 20; - this.lEUt = (long) (fluidAmountToConsume * steam_output_multiplier * efficiency); - if (do_lava) { - mOutputColdFluidHatch.fill(FluidRegistry.getFluidStack("ic2pahoehoelava", fluidAmountToConsume), true); - } else { - mOutputColdFluidHatch.fill(FluidRegistry.getFluidStack("ic2coolant", fluidAmountToConsume), true); - } - this.mEfficiencyIncrease = 80; - return CheckRecipeResultRegistry.SUCCESSFUL; - } - - private int useWater(float input) { - water = water + input; - int usage = (int) water; - water = water - usage; - return usage; - } - - @Override - public boolean onRunningTick(ItemStack aStack) { - if (this.lEUt > 0) { - int tGeneratedEU = (int) (this.lEUt * 2L * this.mEfficiency / 10000L); // APPROXIMATELY how much steam to - // generate. - if (tGeneratedEU > 0) { - - if (superheated) tGeneratedEU /= 2; // We produce half as much superheated steam if necessary - - int distilledConsumed = useWater(tGeneratedEU / 160f); // how much distilled water to consume - // tGeneratedEU = distilledConsumed * 160; // EXACTLY how much steam to generate, producing a perfect - // 1:160 ratio with distilled water consumption - - FluidStack distilledStack = GT_ModHandler.getDistilledWater(distilledConsumed); - if (depleteInput(distilledStack)) // Consume the distilled water - { - if (superheated) { - addOutput(FluidRegistry.getFluidStack("ic2superheatedsteam", tGeneratedEU)); // Generate - // superheated - // steam - } else { - addOutput(GT_ModHandler.getSteam(tGeneratedEU)); // Generate regular steam - } - } else { - GT_Log.exp.println(this.mName + " had no more Distilled water!"); - explodeMultiblock(); // Generate crater - } - } - return true; - } - return true; - } - - @Override - public IStructureDefinition<GregtechMetaTileEntity_Adv_HeatExchanger> getStructureDefinition() { - return STRUCTURE_DEFINITION; - } - - private void onCasingAdded() { - mCasingAmount++; - } - - @Override - public boolean checkMachine(IGregTechTileEntity aBaseMetaTileEntity, ItemStack aStack) { - mOutputColdFluidHatch = null; - mInputHotFluidHatch = null; - mCasingAmount = 0; - return checkPiece(STRUCTURE_PIECE_MAIN, 2, 5, 0) && mCasingAmount >= 90 && mMaintenanceHatches.size() == 1; - } - - public boolean addColdFluidOutputToMachineList(IGregTechTileEntity aTileEntity, int aBaseCasingIndex) { - if (aTileEntity == null) return false; - IMetaTileEntity aMetaTileEntity = aTileEntity.getMetaTileEntity(); - if (aMetaTileEntity == null) return false; - if (aMetaTileEntity instanceof GT_MetaTileEntity_Hatch_Output) { - ((GT_MetaTileEntity_Hatch) aMetaTileEntity).updateTexture(aBaseCasingIndex); - mOutputColdFluidHatch = (GT_MetaTileEntity_Hatch_Output) aMetaTileEntity; - return true; - } - return false; - } - - public boolean addHotFluidInputToMachineList(IGregTechTileEntity aTileEntity, int aBaseCasingIndex) { - if (aTileEntity == null) return false; - IMetaTileEntity aMetaTileEntity = aTileEntity.getMetaTileEntity(); - if (aMetaTileEntity == null) return false; - if (aMetaTileEntity instanceof GT_MetaTileEntity_Hatch_Input) { - ((GT_MetaTileEntity_Hatch) aMetaTileEntity).updateTexture(aBaseCasingIndex); - ((GT_MetaTileEntity_Hatch_Input) aMetaTileEntity).mRecipeMap = getRecipeMap(); - mInputHotFluidHatch = (GT_MetaTileEntity_Hatch_Input) aMetaTileEntity; - return true; - } - return false; - } - - @Override - public int getMaxEfficiency(ItemStack aStack) { - return 10000; - } - - @Override - public int getDamageToComponent(ItemStack aStack) { - return 0; - } - - @Override - public boolean explodesOnComponentBreak(ItemStack aStack) { - return false; - } - - @Override - public IMetaTileEntity newMetaEntity(IGregTechTileEntity aTileEntity) { - return new GregtechMetaTileEntity_Adv_HeatExchanger(this.mName); - } - - @Override - public boolean isGivingInformation() { - return super.isGivingInformation(); - } - - @Override - public String[] getExtraInfoData() { - return new String[] { - StatCollector.translateToLocal("GT5U.multiblock.Progress") + ": " - + EnumChatFormatting.GREEN - + GT_Utility.formatNumbers(mProgresstime / 20) - + EnumChatFormatting.RESET - + " s / " - + EnumChatFormatting.YELLOW - + GT_Utility.formatNumbers(mMaxProgresstime / 20) - + EnumChatFormatting.RESET - + " s", - StatCollector.translateToLocal("GT5U.multiblock.usage") + " " - + StatCollector.translateToLocal("GT5U.LHE.steam") - + ": " - + (superheated ? EnumChatFormatting.RED : EnumChatFormatting.YELLOW) - + GT_Utility.formatNumbers(superheated ? -2 * lEUt : -lEUt) - + EnumChatFormatting.RESET - + " EU/t", - StatCollector.translateToLocal("GT5U.multiblock.problems") + ": " - + EnumChatFormatting.RED - + (getIdealStatus() - getRepairStatus()) - + EnumChatFormatting.RESET - + " " - + StatCollector.translateToLocal("GT5U.multiblock.efficiency") - + ": " - + EnumChatFormatting.YELLOW - + mEfficiency / 100.0F - + EnumChatFormatting.RESET - + " %", - StatCollector.translateToLocal("GT5U.LHE.superheated") + ": " - + (superheated ? EnumChatFormatting.RED : EnumChatFormatting.BLUE) - + superheated - + EnumChatFormatting.RESET, - StatCollector.translateToLocal("GT5U.LHE.superheated") + " " - + StatCollector.translateToLocal("GT5U.LHE.threshold") - + ": " - + EnumChatFormatting.GREEN - + GT_Utility.formatNumbers(superheated_threshold) - + EnumChatFormatting.RESET }; - } - - @Override - public void construct(ItemStack stackSize, boolean hintsOnly) { - buildPiece(STRUCTURE_PIECE_MAIN, stackSize, hintsOnly, 2, 5, 0); - } - - @Override - public String getMachineType() { - return "Heat Exchanger"; - } - - @Override - public int getMaxParallelRecipes() { - return 0; - } - - private static Block sFrame; - - public static Block getFrame() { - if (sFrame == null) { - sFrame = BlockBaseModular.getMaterialBlock(ALLOY.TALONITE, BlockTypes.FRAME); - } - return sFrame; - } -} diff --git a/gtpp/src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/processing/advanced/GregtechMetaTileEntity_Adv_Implosion.java b/gtpp/src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/processing/advanced/GregtechMetaTileEntity_Adv_Implosion.java deleted file mode 100644 index 432ce23e74..0000000000 --- a/gtpp/src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/processing/advanced/GregtechMetaTileEntity_Adv_Implosion.java +++ /dev/null @@ -1,177 +0,0 @@ -package gtPlusPlus.xmod.gregtech.common.tileentities.machines.multi.processing.advanced; - -import static com.gtnewhorizon.structurelib.structure.StructureUtility.ofBlock; -import static com.gtnewhorizon.structurelib.structure.StructureUtility.ofChain; -import static com.gtnewhorizon.structurelib.structure.StructureUtility.onElementPass; -import static com.gtnewhorizon.structurelib.structure.StructureUtility.transpose; -import static gregtech.api.GregTech_API.sBlockCasings4; -import static gregtech.api.enums.GT_HatchElement.Energy; -import static gregtech.api.enums.GT_HatchElement.InputBus; -import static gregtech.api.enums.GT_HatchElement.Maintenance; -import static gregtech.api.enums.GT_HatchElement.Muffler; -import static gregtech.api.enums.GT_HatchElement.OutputBus; -import static gregtech.api.util.GT_StructureUtility.buildHatchAdder; - -import net.minecraft.item.ItemStack; - -import com.gtnewhorizon.structurelib.structure.IStructureDefinition; -import com.gtnewhorizon.structurelib.structure.StructureDefinition; - -import gregtech.api.enums.SoundResource; -import gregtech.api.interfaces.IIconContainer; -import gregtech.api.interfaces.metatileentity.IMetaTileEntity; -import gregtech.api.interfaces.tileentity.IGregTechTileEntity; -import gregtech.api.logic.ProcessingLogic; -import gregtech.api.recipe.RecipeMap; -import gregtech.api.recipe.RecipeMaps; -import gregtech.api.util.GT_Multiblock_Tooltip_Builder; -import gregtech.api.util.GT_Utility; -import gtPlusPlus.core.lib.CORE; -import gtPlusPlus.xmod.gregtech.api.metatileentity.implementations.base.GregtechMeta_MultiBlockBase; -import gtPlusPlus.xmod.gregtech.common.blocks.textures.TexturesGtBlock; - -public class GregtechMetaTileEntity_Adv_Implosion - extends GregtechMeta_MultiBlockBase<GregtechMetaTileEntity_Adv_Implosion> { - - private int mCasing; - private static IStructureDefinition<GregtechMetaTileEntity_Adv_Implosion> STRUCTURE_DEFINITION = null; - - public GregtechMetaTileEntity_Adv_Implosion(int aID, String aName, String aNameRegional) { - super(aID, aName, aNameRegional); - } - - public GregtechMetaTileEntity_Adv_Implosion(String aName) { - super(aName); - } - - @Override - public IMetaTileEntity newMetaEntity(IGregTechTileEntity aTileEntity) { - return new GregtechMetaTileEntity_Adv_Implosion(this.mName); - } - - @Override - public String getMachineType() { - return "Implosion Compressor"; - } - - @Override - protected GT_Multiblock_Tooltip_Builder createTooltip() { - GT_Multiblock_Tooltip_Builder tt = new GT_Multiblock_Tooltip_Builder(); - tt.addMachineType(getMachineType()) - .addInfo("Factory Grade Advanced Implosion Compressor") - .addInfo("Speed: +100% | EU Usage: 100% | Parallel: ((Tier/2)+1)") - .addInfo("Constructed exactly the same as a normal Implosion Compressor") - .addPollutionAmount(getPollutionPerSecond(null)) - .addSeparator() - .beginStructureBlock(3, 3, 3, true) - .addController("Front center") - .addCasingInfoMin("Robust TungstenSteel Casing", 10, false) - .addInputBus("Any casing", 1) - .addOutputBus("Any casing", 1) - .addEnergyHatch("Any casing", 1) - .addMaintenanceHatch("Any casing", 1) - .addMufflerHatch("Any casing", 1) - .toolTipFinisher(CORE.GT_Tooltip_Builder.get()); - return tt; - } - - @Override - public IStructureDefinition<GregtechMetaTileEntity_Adv_Implosion> getStructureDefinition() { - if (STRUCTURE_DEFINITION == null) { - STRUCTURE_DEFINITION = StructureDefinition.<GregtechMetaTileEntity_Adv_Implosion>builder() - .addShape( - mName, - transpose( - new String[][] { { "CCC", "CCC", "CCC" }, { "C~C", "C-C", "CCC" }, { "CCC", "CCC", "CCC" }, })) - .addElement( - 'C', - ofChain( - buildHatchAdder(GregtechMetaTileEntity_Adv_Implosion.class) - .atLeast(InputBus, OutputBus, Maintenance, Energy, Muffler) - .casingIndex(48) - .dot(1) - .build(), - onElementPass(x -> ++x.mCasing, ofBlock(sBlockCasings4, 0)))) - .build(); - } - return STRUCTURE_DEFINITION; - } - - @Override - public void construct(ItemStack stackSize, boolean hintsOnly) { - buildPiece(mName, stackSize, hintsOnly, 1, 1, 0); - } - - @Override - public boolean checkMachine(IGregTechTileEntity aBaseMetaTileEntity, ItemStack aStack) { - mCasing = 0; - return checkPiece(mName, 1, 1, 0) && mCasing >= 10 && checkHatch(); - } - - @Override - protected IIconContainer getActiveOverlay() { - return TexturesGtBlock.Overlay_Machine_Controller_Advanced_Active; - } - - @Override - protected IIconContainer getInactiveOverlay() { - return TexturesGtBlock.Overlay_Machine_Controller_Advanced; - } - - @Override - protected int getCasingTextureId() { - return 48; - } - - @Override - public RecipeMap<?> getRecipeMap() { - return RecipeMaps.implosionRecipes; - } - - @Override - public int getRecipeCatalystPriority() { - return -1; - } - - @Override - public boolean isCorrectMachinePart(ItemStack aStack) { - return true; - } - - @Override - protected ProcessingLogic createProcessingLogic() { - return new ProcessingLogic().setSpeedBonus(1F / 2F) - .setMaxParallelSupplier(this::getMaxParallelRecipes); - } - - @Override - protected SoundResource getProcessStartSound() { - return SoundResource.RANDOM_EXPLODE; - } - - @Override - public int getMaxEfficiency(ItemStack aStack) { - return 10000; - } - - @Override - public int getPollutionPerSecond(ItemStack aStack) { - return CORE.ConfigSwitches.pollutionPerSecondMultiAdvImplosion; - } - - @Override - public int getDamageToComponent(ItemStack aStack) { - return 0; - } - - @Override - public boolean explodesOnComponentBreak(ItemStack aStack) { - return false; - } - - @Override - public int getMaxParallelRecipes() { - return (GT_Utility.getTier(this.getMaxInputVoltage()) / 2 + 1); - } - -} diff --git a/gtpp/src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/processing/steam/GregtechMetaTileEntity_SteamCompressor.java b/gtpp/src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/processing/steam/GregtechMetaTileEntity_SteamCompressor.java deleted file mode 100644 index 0845c7f061..0000000000 --- a/gtpp/src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/processing/steam/GregtechMetaTileEntity_SteamCompressor.java +++ /dev/null @@ -1,156 +0,0 @@ -package gtPlusPlus.xmod.gregtech.common.tileentities.machines.multi.processing.steam; - -import static com.gtnewhorizon.structurelib.structure.StructureUtility.ofBlock; -import static com.gtnewhorizon.structurelib.structure.StructureUtility.ofChain; -import static com.gtnewhorizon.structurelib.structure.StructureUtility.onElementPass; -import static com.gtnewhorizon.structurelib.structure.StructureUtility.transpose; -import static gregtech.api.GregTech_API.sBlockCasings1; -import static gregtech.api.util.GT_StructureUtility.buildHatchAdder; - -import javax.annotation.Nonnull; - -import net.minecraft.item.ItemStack; - -import org.jetbrains.annotations.NotNull; - -import com.gtnewhorizon.structurelib.alignment.constructable.ISurvivalConstructable; -import com.gtnewhorizon.structurelib.structure.IStructureDefinition; -import com.gtnewhorizon.structurelib.structure.ISurvivalBuildEnvironment; -import com.gtnewhorizon.structurelib.structure.StructureDefinition; - -import gregtech.api.enums.Textures; -import gregtech.api.interfaces.metatileentity.IMetaTileEntity; -import gregtech.api.interfaces.tileentity.IGregTechTileEntity; -import gregtech.api.logic.ProcessingLogic; -import gregtech.api.objects.GT_RenderedTexture; -import gregtech.api.recipe.RecipeMap; -import gregtech.api.recipe.RecipeMaps; -import gregtech.api.util.GT_Multiblock_Tooltip_Builder; -import gregtech.api.util.GT_OverclockCalculator; -import gregtech.api.util.GT_Recipe; -import gtPlusPlus.core.lib.CORE; -import gtPlusPlus.xmod.gregtech.api.metatileentity.implementations.base.GregtechMeta_SteamMultiBase; - -public class GregtechMetaTileEntity_SteamCompressor - extends GregtechMeta_SteamMultiBase<GregtechMetaTileEntity_SteamCompressor> implements ISurvivalConstructable { - - private String mCasingName = "Bronze Plated Bricks"; - private static IStructureDefinition<GregtechMetaTileEntity_SteamCompressor> STRUCTURE_DEFINITION = null; - private int mCasing; - - public GregtechMetaTileEntity_SteamCompressor(String aName) { - super(aName); - } - - public GregtechMetaTileEntity_SteamCompressor(int aID, String aName, String aNameRegional) { - super(aID, aName, aNameRegional); - } - - @Override - public IMetaTileEntity newMetaEntity(IGregTechTileEntity arg0) { - return new GregtechMetaTileEntity_SteamCompressor(this.mName); - } - - @Override - protected GT_RenderedTexture getFrontOverlay() { - return new GT_RenderedTexture(Textures.BlockIcons.OVERLAY_FRONT_STEAM_COMPRESSOR); - } - - @Override - protected GT_RenderedTexture getFrontOverlayActive() { - return new GT_RenderedTexture(Textures.BlockIcons.OVERLAY_FRONT_STEAM_COMPRESSOR_ACTIVE); - } - - @Override - public String getMachineType() { - return "Compressor"; - } - - @Override - protected GT_Multiblock_Tooltip_Builder createTooltip() { - GT_Multiblock_Tooltip_Builder tt = new GT_Multiblock_Tooltip_Builder(); - tt.addMachineType(getMachineType()) - .addInfo("Controller Block for the Steam Compressor") - .addInfo("33.3% faster than using a single block Steam Compressor.") - .addInfo("Uses only 66.6% of the steam/s compared to a single block Steam Compressor.") - .addInfo("Compresses up to " + getMaxParallelRecipes() + " things at a time") - .addSeparator() - .beginStructureBlock(3, 3, 4, true) - .addController("Front center") - .addCasingInfoMin(mCasingName, 28, false) - .addOtherStructurePart(TT_steaminputbus, "Any casing", 1) - .addOtherStructurePart(TT_steamoutputbus, "Any casing", 1) - .addOtherStructurePart(TT_steamhatch, "Any casing", 1) - .toolTipFinisher(CORE.GT_Tooltip_Builder.get()); - return tt; - } - - @Override - public IStructureDefinition<GregtechMetaTileEntity_SteamCompressor> getStructureDefinition() { - if (STRUCTURE_DEFINITION == null) { - STRUCTURE_DEFINITION = StructureDefinition.<GregtechMetaTileEntity_SteamCompressor>builder() - .addShape( - mName, - transpose( - new String[][] { { "CCC", "CCC", "CCC", "CCC" }, { "C~C", "C-C", "C-C", "CCC" }, - { "CCC", "CCC", "CCC", "CCC" }, })) - .addElement( - 'C', - ofChain( - buildSteamInput(GregtechMetaTileEntity_SteamCompressor.class).casingIndex(10) - .dot(1) - .build(), - buildHatchAdder(GregtechMetaTileEntity_SteamCompressor.class) - .atLeast(SteamHatchElement.InputBus_Steam, SteamHatchElement.OutputBus_Steam) - .casingIndex(10) - .dot(1) - .build(), - onElementPass(x -> ++x.mCasing, ofBlock(sBlockCasings1, 10)))) - .build(); - } - return STRUCTURE_DEFINITION; - } - - @Override - public void construct(ItemStack stackSize, boolean hintsOnly) { - buildPiece(mName, stackSize, hintsOnly, 1, 1, 0); - } - - @Override - public int survivalConstruct(ItemStack stackSize, int elementBudget, ISurvivalBuildEnvironment env) { - return survivialBuildPiece(mName, stackSize, 1, 1, 0, elementBudget, env, false, true); - } - - @Override - public boolean checkMachine(IGregTechTileEntity aBaseMetaTileEntity, ItemStack aStack) { - mCasing = 0; - fixAllMaintenanceIssue(); - return checkPiece(mName, 1, 1, 0) && mCasing >= 28; - } - - @Override - public int getMaxParallelRecipes() { - return 8; - } - - @Override - public RecipeMap<?> getRecipeMap() { - return RecipeMaps.compressorRecipes; - } - - // note that a basic steam machine has .setEUtDiscount(2F).setSpeedBoost(2F). So these are bonuses. - @Override - protected ProcessingLogic createProcessingLogic() { - return new ProcessingLogic() { - - @Override - @Nonnull - protected GT_OverclockCalculator createOverclockCalculator(@NotNull GT_Recipe recipe) { - return GT_OverclockCalculator.ofNoOverclock(recipe) - .setEUtDiscount(1.33F) - .setSpeedBoost(1.5F); - } - }.setMaxParallel(getMaxParallelRecipes()); - } - -} diff --git a/gtpp/src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/processing/steam/GregtechMetaTileEntity_SteamMacerator.java b/gtpp/src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/processing/steam/GregtechMetaTileEntity_SteamMacerator.java deleted file mode 100644 index dce362fa14..0000000000 --- a/gtpp/src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/processing/steam/GregtechMetaTileEntity_SteamMacerator.java +++ /dev/null @@ -1,165 +0,0 @@ -package gtPlusPlus.xmod.gregtech.common.tileentities.machines.multi.processing.steam; - -import static com.gtnewhorizon.structurelib.structure.StructureUtility.ofBlock; -import static com.gtnewhorizon.structurelib.structure.StructureUtility.ofChain; -import static com.gtnewhorizon.structurelib.structure.StructureUtility.onElementPass; -import static com.gtnewhorizon.structurelib.structure.StructureUtility.transpose; -import static gregtech.api.GregTech_API.sBlockCasings1; -import static gregtech.api.util.GT_StructureUtility.buildHatchAdder; - -import javax.annotation.Nonnull; - -import net.minecraft.item.ItemStack; - -import org.jetbrains.annotations.NotNull; - -import com.gtnewhorizon.structurelib.alignment.constructable.ISurvivalConstructable; -import com.gtnewhorizon.structurelib.structure.IStructureDefinition; -import com.gtnewhorizon.structurelib.structure.ISurvivalBuildEnvironment; -import com.gtnewhorizon.structurelib.structure.StructureDefinition; - -import gregtech.api.enums.ItemList; -import gregtech.api.enums.Textures; -import gregtech.api.interfaces.metatileentity.IMetaTileEntity; -import gregtech.api.interfaces.tileentity.IGregTechTileEntity; -import gregtech.api.logic.ProcessingLogic; -import gregtech.api.objects.GT_RenderedTexture; -import gregtech.api.recipe.RecipeMap; -import gregtech.api.recipe.RecipeMaps; -import gregtech.api.util.GT_Multiblock_Tooltip_Builder; -import gregtech.api.util.GT_OverclockCalculator; -import gregtech.api.util.GT_Recipe; -import gtPlusPlus.core.lib.CORE; -import gtPlusPlus.xmod.gregtech.api.metatileentity.implementations.base.GregtechMeta_SteamMultiBase; - -public class GregtechMetaTileEntity_SteamMacerator - extends GregtechMeta_SteamMultiBase<GregtechMetaTileEntity_SteamMacerator> implements ISurvivalConstructable { - - private String mCasingName = "Bronze Plated Bricks"; - private static IStructureDefinition<GregtechMetaTileEntity_SteamMacerator> STRUCTURE_DEFINITION = null; - private int mCasing; - - public GregtechMetaTileEntity_SteamMacerator(String aName) { - super(aName); - } - - public GregtechMetaTileEntity_SteamMacerator(int aID, String aName, String aNameRegional) { - super(aID, aName, aNameRegional); - } - - @Override - public IMetaTileEntity newMetaEntity(IGregTechTileEntity arg0) { - return new GregtechMetaTileEntity_SteamMacerator(this.mName); - } - - @Override - protected GT_RenderedTexture getFrontOverlay() { - return new GT_RenderedTexture(Textures.BlockIcons.OVERLAY_TOP_STEAM_MACERATOR); - } - - @Override - protected GT_RenderedTexture getFrontOverlayActive() { - return new GT_RenderedTexture(Textures.BlockIcons.OVERLAY_TOP_STEAM_MACERATOR_ACTIVE); - } - - @Override - public String getMachineType() { - return "Macerator"; - } - - @Override - protected GT_Multiblock_Tooltip_Builder createTooltip() { - if (mCasingName.contains("gt.blockcasings")) { - mCasingName = ItemList.Casing_BronzePlatedBricks.get(1) - .getDisplayName(); - } - GT_Multiblock_Tooltip_Builder tt = new GT_Multiblock_Tooltip_Builder(); - tt.addMachineType(getMachineType()) - .addInfo("Controller Block for the Steam Macerator") - .addInfo("33.3% faster than using a single block Steam Macerator.") - .addInfo("Uses only 66.6% of the steam/s required compared to a single block Steam Macerator.") - .addInfo("Macerates up to " + getMaxParallelRecipes() + " things at a time") - .addSeparator() - .beginStructureBlock(3, 3, 3, true) - .addController("Front center") - .addCasingInfoMin(mCasingName, 14, false) - .addOtherStructurePart(TT_steaminputbus, "Any casing", 1) - .addOtherStructurePart(TT_steamoutputbus, "Any casing", 1) - .addOtherStructurePart(TT_steamhatch, "Any casing", 1) - .toolTipFinisher(CORE.GT_Tooltip_Builder.get()); - return tt; - } - - @Override - public IStructureDefinition<GregtechMetaTileEntity_SteamMacerator> getStructureDefinition() { - if (STRUCTURE_DEFINITION == null) { - STRUCTURE_DEFINITION = StructureDefinition.<GregtechMetaTileEntity_SteamMacerator>builder() - .addShape( - mName, - transpose( - new String[][] { { "CCC", "CCC", "CCC" }, { "C~C", "C-C", "CCC" }, { "CCC", "CCC", "CCC" }, })) - .addElement( - 'C', - ofChain( - buildSteamInput(GregtechMetaTileEntity_SteamMacerator.class).casingIndex(10) - .dot(1) - .build(), - buildHatchAdder(GregtechMetaTileEntity_SteamMacerator.class) - .atLeast(SteamHatchElement.InputBus_Steam, SteamHatchElement.OutputBus_Steam) - .casingIndex(10) - .dot(1) - .build(), - onElementPass(x -> ++x.mCasing, ofBlock(sBlockCasings1, 10)))) - .build(); - } - return STRUCTURE_DEFINITION; - } - - @Override - public void construct(ItemStack stackSize, boolean hintsOnly) { - buildPiece(mName, stackSize, hintsOnly, 1, 1, 0); - } - - @Override - public int survivalConstruct(ItemStack stackSize, int elementBudget, ISurvivalBuildEnvironment env) { - return survivialBuildPiece(mName, stackSize, 1, 1, 0, elementBudget, env, false, true); - } - - @Override - public boolean checkMachine(IGregTechTileEntity aBaseMetaTileEntity, ItemStack aStack) { - mCasing = 0; - fixAllMaintenanceIssue(); - return checkPiece(mName, 1, 1, 0) && mCasing >= 14; - } - - @Override - public int getMaxParallelRecipes() { - return 8; - } - - @Override - public RecipeMap<?> getRecipeMap() { - return RecipeMaps.maceratorRecipes; - } - - // note that a basic steam machine has .setEUtDiscount(2F).setSpeedBoost(2F). So these are bonuses. - @Override - protected ProcessingLogic createProcessingLogic() { - return new ProcessingLogic() { - - @Override - @Nonnull - protected GT_OverclockCalculator createOverclockCalculator(@NotNull GT_Recipe recipe) { - return GT_OverclockCalculator.ofNoOverclock(recipe) - .setEUtDiscount(1.33F) - .setSpeedBoost(1.5F); - } - - }.setMaxParallel(getMaxParallelRecipes()); - } - - @Override - public int getItemOutputLimit() { - return 1; - } -} diff --git a/gtpp/src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/production/GT4Entity_AutoCrafter.java b/gtpp/src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/production/GT4Entity_AutoCrafter.java deleted file mode 100644 index 6cae5e4bcd..0000000000 --- a/gtpp/src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/production/GT4Entity_AutoCrafter.java +++ /dev/null @@ -1,196 +0,0 @@ -package gtPlusPlus.xmod.gregtech.common.tileentities.machines.multi.production; - -import static com.gtnewhorizon.structurelib.structure.StructureUtility.ofBlock; -import static com.gtnewhorizon.structurelib.structure.StructureUtility.onElementPass; -import static com.gtnewhorizon.structurelib.structure.StructureUtility.transpose; -import static gregtech.api.enums.GT_HatchElement.Energy; -import static gregtech.api.enums.GT_HatchElement.InputBus; -import static gregtech.api.enums.GT_HatchElement.InputHatch; -import static gregtech.api.enums.GT_HatchElement.Maintenance; -import static gregtech.api.enums.GT_HatchElement.Muffler; -import static gregtech.api.enums.GT_HatchElement.OutputBus; -import static gregtech.api.util.GT_StructureUtility.buildHatchAdder; - -import net.minecraft.item.ItemStack; - -import com.gtnewhorizon.structurelib.alignment.constructable.ISurvivalConstructable; -import com.gtnewhorizon.structurelib.structure.IStructureDefinition; -import com.gtnewhorizon.structurelib.structure.ISurvivalBuildEnvironment; -import com.gtnewhorizon.structurelib.structure.StructureDefinition; - -import gregtech.api.enums.TAE; -import gregtech.api.enums.Textures; -import gregtech.api.interfaces.IIconContainer; -import gregtech.api.interfaces.tileentity.IGregTechTileEntity; -import gregtech.api.logic.ProcessingLogic; -import gregtech.api.metatileentity.MetaTileEntity; -import gregtech.api.recipe.RecipeMap; -import gregtech.api.recipe.RecipeMaps; -import gregtech.api.util.GT_Multiblock_Tooltip_Builder; -import gregtech.api.util.GT_Recipe; -import gregtech.api.util.GT_Utility; -import gtPlusPlus.core.block.ModBlocks; -import gtPlusPlus.core.lib.CORE; -import gtPlusPlus.xmod.gregtech.api.metatileentity.implementations.base.GregtechMeta_MultiBlockBase; - -public class GT4Entity_AutoCrafter extends GregtechMeta_MultiBlockBase<GT4Entity_AutoCrafter> - implements ISurvivalConstructable { - - protected GT_Recipe lastRecipeToBuffer; - private int casing; - private static IStructureDefinition<GT4Entity_AutoCrafter> STRUCTURE_DEFINITION = null; - - public GT4Entity_AutoCrafter(int aID, String aName, String aNameRegional) { - super(aID, aName, aNameRegional); - } - - public GT4Entity_AutoCrafter(String mName) { - super(mName); - } - - @Override - public String getMachineType() { - return "Assembler"; - } - - @Override - public MetaTileEntity newMetaEntity(IGregTechTileEntity tileEntity) { - return new GT4Entity_AutoCrafter(this.mName); - } - - @Override - public boolean isCorrectMachinePart(ItemStack aStack) { - return true; - } - - @Override - public int getDamageToComponent(ItemStack aStack) { - return 0; - } - - @Override - public boolean explodesOnComponentBreak(ItemStack aStack) { - return false; - } - - @Override - public int getMaxEfficiency(ItemStack itemStack) { - return 10000; - } - - @Override - public int getPollutionPerSecond(ItemStack aStack) { - return CORE.ConfigSwitches.pollutionPerSecondMultiAutoCrafter; - } - - @Override - protected GT_Multiblock_Tooltip_Builder createTooltip() { - GT_Multiblock_Tooltip_Builder tt = new GT_Multiblock_Tooltip_Builder(); - tt.addMachineType(getMachineType()) - .addInfo("Highly Advanced Assembling Machine") - .addInfo("200% faster than using single block machines of the same voltage") - .addInfo("Processes two items per voltage tier") - .addPollutionAmount(getPollutionPerSecond(null)) - .addSeparator() - .beginStructureBlock(3, 3, 3, true) - .addController("Front Center") - .addCasingInfoRange("Bulk Production Frame", 10, 25, false) - .addInputBus("Any Casing", 1) - .addOutputBus("Any Casing", 1) - .addInputHatch("Any Casing", 1) - .addEnergyHatch("Any Casing", 1) - .addMaintenanceHatch("Any Casing", 1) - .addMufflerHatch("Any Casing", 1) - .toolTipFinisher(CORE.GT_Tooltip_Builder.get()); - return tt; - } - - @Override - protected IIconContainer getActiveOverlay() { - return Textures.BlockIcons.OVERLAY_FRONT_DISASSEMBLER_ACTIVE; - } - - @Override - protected IIconContainer getInactiveOverlay() { - return Textures.BlockIcons.OVERLAY_FRONT_DISASSEMBLER; - } - - @Override - protected int getCasingTextureId() { - return TAE.getIndexFromPage(0, 10); - } - - @Override - public IStructureDefinition<GT4Entity_AutoCrafter> getStructureDefinition() { - if (STRUCTURE_DEFINITION == null) { - STRUCTURE_DEFINITION = StructureDefinition.<GT4Entity_AutoCrafter>builder() - .addShape( - mName, - transpose( - new String[][] { { "CCC", "CCC", "CCC" }, { "C~C", "C-C", "CCC" }, { "CCC", "CCC", "CCC" }, })) - .addElement( - 'C', - buildHatchAdder(GT4Entity_AutoCrafter.class) - .atLeast(InputBus, OutputBus, InputHatch, Maintenance, Energy, Muffler) - .casingIndex(TAE.getIndexFromPage(0, 10)) - .dot(1) - .buildAndChain(onElementPass(x -> ++x.casing, ofBlock(ModBlocks.blockCasings2Misc, 12)))) - .build(); - } - return STRUCTURE_DEFINITION; - } - - @Override - public void construct(ItemStack itemStack, boolean hintsOnly) { - buildPiece(mName, itemStack, hintsOnly, 1, 1, 0); - } - - @Override - public int survivalConstruct(ItemStack itemStack, int elementBudget, ISurvivalBuildEnvironment env) { - if (mMachine) return -1; - return survivialBuildPiece(mName, itemStack, 1, 1, 0, elementBudget, env, false, true); - } - - @Override - public boolean checkMachine(IGregTechTileEntity baseMetaTileEntity, ItemStack itemStack) { - casing = 0; - return checkPiece(mName, 1, 1, 0) && casing >= 10 && checkHatch(); - } - - @Override - public RecipeMap<?> getRecipeMap() { - return RecipeMaps.assemblerRecipes; - } - - @Override - protected ProcessingLogic createProcessingLogic() { - return new ProcessingLogic().setSpeedBonus(1F / 3F) - .setMaxParallelSupplier(this::getMaxParallelRecipes); - } - - @Override - public int getMaxParallelRecipes() { - return 2 * (Math.max(1, GT_Utility.getTier(getMaxInputVoltage()))); - } - - @Override - public String[] getExtraInfoData() { - final String running = (this.mMaxProgresstime > 0 ? "Auto-Crafter running" : "Auto-Crafter stopped"); - final String maintenance = (this.getIdealStatus() == this.getRepairStatus() ? "No Maintenance issues" - : "Needs Maintenance"); - String tSpecialText; - - if (lastRecipeToBuffer != null && lastRecipeToBuffer.mOutputs[0].getDisplayName() != null) { - tSpecialText = "Currently processing: " + lastRecipeToBuffer.mOutputs[0].getDisplayName(); - } else { - tSpecialText = "Currently processing: Nothing"; - } - - return new String[] { "Large Scale Auto-Assembler v1.01c", running, maintenance, tSpecialText }; - } - - @Override - public boolean supportsInputSeparation() { - return true; - } -} diff --git a/gtpp/src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/production/GT4Entity_ThermalBoiler.java b/gtpp/src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/production/GT4Entity_ThermalBoiler.java deleted file mode 100644 index b7a4afb878..0000000000 --- a/gtpp/src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/production/GT4Entity_ThermalBoiler.java +++ /dev/null @@ -1,353 +0,0 @@ -package gtPlusPlus.xmod.gregtech.common.tileentities.machines.multi.production; - -import static com.gtnewhorizon.structurelib.structure.StructureUtility.ofBlock; -import static com.gtnewhorizon.structurelib.structure.StructureUtility.onElementPass; -import static com.gtnewhorizon.structurelib.structure.StructureUtility.transpose; -import static gregtech.api.enums.GT_HatchElement.InputBus; -import static gregtech.api.enums.GT_HatchElement.InputHatch; -import static gregtech.api.enums.GT_HatchElement.Maintenance; -import static gregtech.api.enums.GT_HatchElement.Muffler; -import static gregtech.api.enums.GT_HatchElement.OutputBus; -import static gregtech.api.enums.GT_HatchElement.OutputHatch; -import static gregtech.api.util.GT_StructureUtility.buildHatchAdder; - -import java.util.stream.Stream; - -import javax.annotation.Nonnull; -import javax.annotation.Nullable; - -import net.minecraft.init.Blocks; -import net.minecraft.item.Item; -import net.minecraft.item.ItemStack; -import net.minecraftforge.fluids.Fluid; -import net.minecraftforge.fluids.FluidRegistry; -import net.minecraftforge.fluids.FluidStack; - -import org.jetbrains.annotations.NotNull; - -import com.gtnewhorizon.structurelib.alignment.constructable.ISurvivalConstructable; -import com.gtnewhorizon.structurelib.structure.IStructureDefinition; -import com.gtnewhorizon.structurelib.structure.ISurvivalBuildEnvironment; -import com.gtnewhorizon.structurelib.structure.StructureDefinition; - -import gregtech.api.enums.GT_Values; -import gregtech.api.enums.ItemList; -import gregtech.api.enums.TAE; -import gregtech.api.interfaces.IIconContainer; -import gregtech.api.interfaces.tileentity.IGregTechTileEntity; -import gregtech.api.logic.ProcessingLogic; -import gregtech.api.metatileentity.MetaTileEntity; -import gregtech.api.recipe.RecipeMap; -import gregtech.api.recipe.check.CheckRecipeResult; -import gregtech.api.util.GT_Log; -import gregtech.api.util.GT_Multiblock_Tooltip_Builder; -import gregtech.api.util.GT_ParallelHelper; -import gregtech.api.util.GT_Recipe; -import gtPlusPlus.api.recipe.GTPPRecipeMaps; -import gtPlusPlus.core.block.ModBlocks; -import gtPlusPlus.core.lib.CORE; -import gtPlusPlus.core.util.minecraft.FluidUtils; -import gtPlusPlus.xmod.gregtech.api.metatileentity.implementations.base.GregtechMeta_MultiBlockBase; -import gtPlusPlus.xmod.gregtech.common.blocks.textures.TexturesGtBlock; - -public class GT4Entity_ThermalBoiler extends GregtechMeta_MultiBlockBase<GT4Entity_ThermalBoiler> - implements ISurvivalConstructable { - - private int mCasing; - private static IStructureDefinition<GT4Entity_ThermalBoiler> STRUCTURE_DEFINITION = null; - - private static final int lavaFilterResilience = 30; // Damage lava filter with 1/n probability every operation. - private int dryHeatCounter = 0; // Counts up to dryHeatMaximum to check for explosion conditions. - private static final int dryHeatMaximum = 10; // 10 consecutive operations without water = BOOM - - private static final Item itemLavaFilter = ItemList.Component_LavaFilter.getItem(); - private static final Item itemObsidian = Item.getItemFromBlock(Blocks.obsidian); - private static final Fluid fluidWater = FluidRegistry.WATER; - private static final Fluid fluidDistilledWater = FluidUtils.getDistilledWater(1) - .getFluid(); - private static final Fluid fluidSteam = FluidUtils.getSteam(1) - .getFluid(); - private static final Fluid fluidSHSteam = FluidUtils.getSuperHeatedSteam(1) - .getFluid(); - - public GT4Entity_ThermalBoiler(int aID, String aName, String aNameRegional) { - super(aID, aName, aNameRegional); - } - - public GT4Entity_ThermalBoiler(String mName) { - super(mName); - } - - @Override - public MetaTileEntity newMetaEntity(IGregTechTileEntity aTileEntity) { - return new GT4Entity_ThermalBoiler(this.mName); - } - - @Override - public String getMachineType() { - return "Boiler"; - } - - @Override - public int getDamageToComponent(ItemStack aStack) { - return (aStack != null && aStack.getItem() == itemLavaFilter) ? 1 : 0; - } - - @Override - public RecipeMap<?> getRecipeMap() { - return GTPPRecipeMaps.thermalBoilerRecipes; - } - - @Override - protected boolean filtersFluid() { - return false; - } - - @Override - public boolean supportsVoidProtection() { - return true; - } - - @Override - public boolean supportsBatchMode() { - return false; - } - - @Override - protected ProcessingLogic createProcessingLogic() { - return new ProcessingLogic() { - - // Only test against the first fluid input in the recipe. - // We still want to run if we lack water (and subsequently explode). - @NotNull - @Override - protected Stream<GT_Recipe> findRecipeMatches(@Nullable RecipeMap<?> map) { - if (lastRecipe != null && depleteInput(lastRecipe.mFluidInputs[0], true)) { - return Stream.of(lastRecipe); - } - if (map == null) { - return Stream.empty(); - } - return map.getAllRecipes() - .stream() - .filter(recipe -> depleteInput(recipe.mFluidInputs[0], true)); - } - - @NotNull - @Override - protected GT_ParallelHelper createParallelHelper(@Nonnull GT_Recipe recipe) { - GT_Recipe adjustedRecipe = recipe.copy(); - - // Hack the recipe logic to not consume water, so that we can explode. - for (FluidStack inputFluid : adjustedRecipe.mFluidInputs) { - if (inputFluid != null - && (inputFluid.getFluid() == fluidWater || inputFluid.getFluid() == fluidDistilledWater)) { - inputFluid.amount = 0; - } - } - - // If we don't have a lava filter, remove non-obsidian outputs - // so that output space for them is not required if void protection is on. - if (!findLavaFilter()) { - for (ItemStack outputItem : adjustedRecipe.mOutputs) { - if (outputItem != null && outputItem.getItem() != itemObsidian) { - outputItem.stackSize = 0; - } - } - } - return super.createParallelHelper(adjustedRecipe); - } - }; - } - - @Override - public @NotNull CheckRecipeResult checkProcessing() { - // super.checkProcessing() instantly sets efficiency to maximum, override this. - int efficiency = mEfficiency; - CheckRecipeResult result = super.checkProcessing(); - if (result.wasSuccessful()) { - mEfficiency = efficiency; - mEfficiencyIncrease = mMaxProgresstime * getEfficiencyIncrease(); - - // Adjust steam output based on efficiency. - if (mOutputFluids != null) { - for (FluidStack outputFluid : mOutputFluids) { - if (outputFluid != null - && (outputFluid.getFluid() == fluidSteam || outputFluid.getFluid() == fluidSHSteam)) { - - // Purely for display reasons, we don't actually make any EU. - if (outputFluid.getFluid() == fluidSteam) { - lEUt = outputFluid.amount / mMaxProgresstime / 2; - } else { - lEUt = outputFluid.amount / mMaxProgresstime; - } - - // Adjust steam output based on efficiency. - // TODO: This is not reflected in the GUI while the player has it open?? - if (mEfficiency < getMaxEfficiency(null)) { - outputFluid.amount = Math - .max(1, (outputFluid.amount * mEfficiency) / getMaxEfficiency(null)); - } - - // Consume water to run recipe. - if (!useWater(outputFluid.amount)) { - outputFluid.amount = 0; - lEUt = 0; - } - } - } - } - - // Remove non-obsidian outputs if we can't damage lava filter. - if (mOutputItems != null && mOutputItems.length > 0) { - if (!damageLavaFilter()) { - for (ItemStack outputItem : mOutputItems) { - if (outputItem != null && outputItem.getItem() != itemObsidian) { - outputItem.stackSize = 0; - } - } - } - } - } - return result; - } - - private boolean findLavaFilter() { - if (getControllerSlot() == null) { - for (var bus : mInputBusses) { - for (ItemStack stack : bus.mInventory) { - if (stack != null && stack.getItem() == itemLavaFilter) { - setGUIItemStack(stack); - return true; - } - } - } - return false; - } else { - return getControllerSlot().getItem() == itemLavaFilter; - } - } - - private boolean damageLavaFilter() { - if (!findLavaFilter()) return false; - if (getBaseMetaTileEntity().getRandomNumber(lavaFilterResilience) > 0) return true; - - ItemStack filter = getControllerSlot(); - if (filter.attemptDamageItem(1, getBaseMetaTileEntity().getWorld().rand)) { - mInventory[1] = null; - } - return true; - } - - private boolean useWater(int steamAmount) { - // Round up to not dupe decimal amounts of water. - int waterAmount = Math.floorDiv(steamAmount + GT_Values.STEAM_PER_WATER - 1, GT_Values.STEAM_PER_WATER); - if (depleteInput(FluidUtils.getWater(waterAmount)) || depleteInput(FluidUtils.getDistilledWater(waterAmount))) { - dryHeatCounter = 0; - return true; - } else { - // Add some leniency with explosions. - if (dryHeatCounter < dryHeatMaximum) { - ++dryHeatCounter; - } else { - GT_Log.exp.println(this.mName + " was too hot and had no more Water!"); - explodeMultiblock(); // Generate crater - } - return false; - } - } - - @Override - public int getMaxParallelRecipes() { - return 1; - } - - public int getEfficiencyIncrease() { - return 12; - } - - @Override - public int getMaxEfficiency(ItemStack aStack) { - return 10000; - } - - @Override - public int getPollutionPerSecond(ItemStack aStack) { - return CORE.ConfigSwitches.pollutionPerSecondMultiThermalBoiler; - } - - @Override - protected GT_Multiblock_Tooltip_Builder createTooltip() { - GT_Multiblock_Tooltip_Builder tt = new GT_Multiblock_Tooltip_Builder(); - tt.addMachineType(getMachineType()) - .addInfo("Thermal Boiler Controller") - .addInfo("Converts Water & Heat into Steam") - .addInfo("Filters raw materials from lava") - .addInfo("Explodes if water is not supplied") - .addInfo("Consult user manual for more information") - .addPollutionAmount(getPollutionPerSecond(null)) - .beginStructureBlock(3, 3, 3, true) - .addController("Front Center") - .addCasingInfoMin("Thermal Containment Casings", 10, false) - .addInputBus("Any Casing", 1) - .addOutputBus("Any Casing", 1) - .addInputHatch("Any Casing", 1) - .addOutputHatch("Any Casing", 1) - .addMaintenanceHatch("Any Casing", 1) - .addMufflerHatch("Any Casing", 1) - .toolTipFinisher(CORE.GT_Tooltip_Builder.get()); - return tt; - } - - @Override - protected IIconContainer getActiveOverlay() { - return TexturesGtBlock.Overlay_Machine_Controller_Advanced_Active; - } - - @Override - protected IIconContainer getInactiveOverlay() { - return TexturesGtBlock.Overlay_Machine_Controller_Advanced; - } - - @Override - protected int getCasingTextureId() { - return TAE.GTPP_INDEX(1); - } - - @Override - public IStructureDefinition<GT4Entity_ThermalBoiler> getStructureDefinition() { - if (STRUCTURE_DEFINITION == null) { - STRUCTURE_DEFINITION = StructureDefinition.<GT4Entity_ThermalBoiler>builder() - .addShape( - mName, - transpose( - new String[][] { { "CCC", "CCC", "CCC" }, { "C~C", "C-C", "CCC" }, { "CCC", "CCC", "CCC" }, })) - .addElement( - 'C', - buildHatchAdder(GT4Entity_ThermalBoiler.class) - .atLeast(InputBus, OutputBus, InputHatch, OutputHatch, Maintenance, Muffler) - .casingIndex(TAE.getIndexFromPage(0, 1)) - .dot(1) - .buildAndChain(onElementPass(x -> ++x.mCasing, ofBlock(ModBlocks.blockCasings2Misc, 11)))) - .build(); - } - return STRUCTURE_DEFINITION; - } - - @Override - public void construct(ItemStack stackSize, boolean hintsOnly) { - buildPiece(mName, stackSize, hintsOnly, 1, 1, 0); - } - - @Override - public int survivalConstruct(ItemStack stackSize, int elementBudget, ISurvivalBuildEnvironment env) { - if (mMachine) return -1; - return survivialBuildPiece(mName, stackSize, 1, 1, 0, elementBudget, env, false, true); - } - - @Override - public boolean checkMachine(IGregTechTileEntity aBaseMetaTileEntity, ItemStack aStack) { - mCasing = 0; - return checkPiece(mName, 1, 1, 0) && mCasing >= 10 && checkHatch(); - } -} diff --git a/gtpp/src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/production/GregtechMTE_ElementalDuplicator.java b/gtpp/src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/production/GregtechMTE_ElementalDuplicator.java deleted file mode 100644 index d835d9be4c..0000000000 --- a/gtpp/src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/production/GregtechMTE_ElementalDuplicator.java +++ /dev/null @@ -1,352 +0,0 @@ -package gtPlusPlus.xmod.gregtech.common.tileentities.machines.multi.production; - -import static com.gtnewhorizon.structurelib.structure.StructureUtility.lazy; -import static com.gtnewhorizon.structurelib.structure.StructureUtility.ofBlock; -import static com.gtnewhorizon.structurelib.structure.StructureUtility.ofChain; -import static com.gtnewhorizon.structurelib.structure.StructureUtility.onElementPass; -import static gregtech.api.enums.GT_HatchElement.Energy; -import static gregtech.api.enums.GT_HatchElement.InputHatch; -import static gregtech.api.enums.GT_HatchElement.Maintenance; -import static gregtech.api.enums.GT_HatchElement.Muffler; -import static gregtech.api.enums.GT_HatchElement.OutputBus; -import static gregtech.api.enums.GT_HatchElement.OutputHatch; -import static gregtech.api.util.GT_StructureUtility.buildHatchAdder; -import static gregtech.api.util.GT_Utility.filterValidMTEs; - -import java.util.ArrayList; -import java.util.Collections; - -import net.minecraft.block.Block; -import net.minecraft.item.ItemStack; -import net.minecraftforge.common.util.ForgeDirection; - -import com.gtnewhorizon.structurelib.alignment.IAlignmentLimits; -import com.gtnewhorizon.structurelib.alignment.constructable.ISurvivalConstructable; -import com.gtnewhorizon.structurelib.structure.IStructureDefinition; -import com.gtnewhorizon.structurelib.structure.ISurvivalBuildEnvironment; -import com.gtnewhorizon.structurelib.structure.StructureDefinition; - -import gregtech.api.enums.TAE; -import gregtech.api.interfaces.IIconContainer; -import gregtech.api.interfaces.metatileentity.IMetaTileEntity; -import gregtech.api.interfaces.tileentity.IGregTechTileEntity; -import gregtech.api.logic.ProcessingLogic; -import gregtech.api.recipe.RecipeMap; -import gregtech.api.recipe.RecipeMaps; -import gregtech.api.util.GT_Multiblock_Tooltip_Builder; -import gregtech.api.util.GT_Utility; -import gtPlusPlus.core.block.ModBlocks; -import gtPlusPlus.core.lib.CORE; -import gtPlusPlus.xmod.gregtech.api.metatileentity.implementations.GT_MetaTileEntity_Hatch_ElementalDataOrbHolder; -import gtPlusPlus.xmod.gregtech.api.metatileentity.implementations.base.GregtechMeta_MultiBlockBase; -import gtPlusPlus.xmod.gregtech.common.blocks.textures.TexturesGtBlock; - -public class GregtechMTE_ElementalDuplicator extends GregtechMeta_MultiBlockBase<GregtechMTE_ElementalDuplicator> - implements ISurvivalConstructable { - - private final ArrayList<GT_MetaTileEntity_Hatch_ElementalDataOrbHolder> mReplicatorDataOrbHatches = new ArrayList<>(); - private static final int CASING_TEXTURE_ID = TAE.getIndexFromPage(0, 3); - private int mCasing = 0; - - public GregtechMTE_ElementalDuplicator(final int aID, final String aName, final String aNameRegional) { - super(aID, aName, aNameRegional); - } - - public GregtechMTE_ElementalDuplicator(final String aName) { - super(aName); - } - - @Override - public IMetaTileEntity newMetaEntity(final IGregTechTileEntity aTileEntity) { - return new GregtechMTE_ElementalDuplicator(this.mName); - } - - @Override - public String getMachineType() { - return "Replicator"; - } - - @Override - protected GT_Multiblock_Tooltip_Builder createTooltip() { - - GT_Multiblock_Tooltip_Builder tt = new GT_Multiblock_Tooltip_Builder(); - tt.addMachineType(getMachineType()) - .addInfo("Produces Elemental Material from UU Matter") - .addInfo("Speed: +100% | EU Usage: 100% | Parallel: 8 * Tier") - .addInfo("Maximum 1x of each bus/hatch.") - .addInfo("Requires circuit 1-16 in your Data Orb Repository") - .addInfo("depending on what Data Orb you want to prioritize") - .addPollutionAmount(getPollutionPerSecond(null)) - .addSeparator() - .beginStructureBlock(9, 6, 9, true) - .addController("Top Center") - .addCasingInfoMin("Elemental Confinement Shell", 138, false) - .addCasingInfoMin("Matter Fabricator Casing", 24, false) - .addCasingInfoMin("Particle Containment Casing", 24, false) - .addCasingInfoMin("Matter Generation Coil", 24, false) - .addCasingInfoMin("High Voltage Current Capacitor", 20, false) - .addCasingInfoMin("Resonance Chamber III", 24, false) - .addCasingInfoMin("Modulator III", 16, false) - .addOtherStructurePart("Data Orb Repository", "1x", 1) - .addInputHatch("Any 1 dot hint", 1) - .addOutputBus("Any 1 dot hint", 1) - .addOutputHatch("Any 1 dot hint", 1) - .addEnergyHatch("Any 1 dot hint", 1) - .addMaintenanceHatch("Any 1 dot hint", 1) - .addMufflerHatch("Any 1 dot hint", 1) - .toolTipFinisher(CORE.GT_Tooltip_Builder.get()); - return tt; - } - - private static final String STRUCTURE_PIECE_MAIN = "main"; - private static IStructureDefinition<GregtechMTE_ElementalDuplicator> STRUCTURE_DEFINITION = null; - - @Override - public IStructureDefinition<GregtechMTE_ElementalDuplicator> getStructureDefinition() { - if (STRUCTURE_DEFINITION == null) { - STRUCTURE_DEFINITION = StructureDefinition.<GregtechMTE_ElementalDuplicator>builder() - - // h = Hatch - // c = Casing - - // a = MF Casing 1 - // b = Matter Gen Coil - - // d = Current Capacitor - // e = Particle - - // f = Resonance III - // g = Modulator III - - .addShape( - STRUCTURE_PIECE_MAIN, - (new String[][] { - { " ccc ", " ccccc ", " ccccccc ", "ccchhhccc", "ccch~hccc", "ccchhhccc", " ccccccc ", - " ccccc ", " ccc " }, - { " cac ", " abfba ", " abfgfba ", "cbfgdgfbc", "afgdddgfa", "cbfgdgfbc", " abfgfba ", - " abfba ", " cac " }, - { " cec ", " e e ", " e e ", "c d c", "e ddd e", "c d c", " e e ", - " e e ", " cec " }, - { " cec ", " e e ", " e e ", "c d c", "e ddd e", "c d c", " e e ", - " e e ", " cec " }, - { " cac ", " abfba ", " abfgfba ", "cbfgdgfbc", "afgdddgfa", "cbfgdgfbc", " abfgfba ", - " abfba ", " cac " }, - { " ccc ", " ccccc ", " ccccccc ", "ccchhhccc", "ccchhhccc", "ccchhhccc", " ccccccc ", - " ccccc ", " ccc " }, })) - .addElement('a', ofBlock(getCasingBlock4(), getCasingMeta6())) - .addElement('b', ofBlock(getCasingBlock4(), getCasingMeta7())) - .addElement('d', ofBlock(getCasingBlock2(), getCasingMeta2())) - .addElement('e', ofBlock(getCasingBlock2(), getCasingMeta3())) - .addElement('f', ofBlock(getCasingBlock3(), getCasingMeta4())) - .addElement('g', ofBlock(getCasingBlock3(), getCasingMeta5())) - .addElement('c', lazy(t -> onElementPass(x -> ++x.mCasing, ofBlock(getCasingBlock(), getCasingMeta())))) - .addElement( - 'h', - lazy( - t -> ofChain( - buildHatchAdder(GregtechMTE_ElementalDuplicator.class) - .atLeast(InputHatch, OutputBus, OutputHatch, Maintenance, Muffler, Energy) - .casingIndex(getCasingTextureIndex()) - .dot(1) - .build(), - buildHatchAdder(GregtechMTE_ElementalDuplicator.class) - .hatchClass(GT_MetaTileEntity_Hatch_ElementalDataOrbHolder.class) - .shouldReject(x -> x.mReplicatorDataOrbHatches.size() >= 1) - .adder(GregtechMTE_ElementalDuplicator::addDataOrbHatch) - .casingIndex(getCasingTextureIndex()) - .dot(1) - .build(), - onElementPass(x -> ++x.mCasing, ofBlock(getCasingBlock(), getCasingMeta()))))) - .build(); - } - return STRUCTURE_DEFINITION; - } - - @Override - public void construct(ItemStack stackSize, boolean hintsOnly) { - buildPiece(STRUCTURE_PIECE_MAIN, stackSize, hintsOnly, 4, 4, 0); - } - - @Override - public boolean checkMachine(IGregTechTileEntity aBaseMetaTileEntity, ItemStack aStack) { - mCasing = 0; - boolean aDidBuild = checkPiece(STRUCTURE_PIECE_MAIN, 4, 4, 0); - if (this.mInputHatches.size() != 1 || (this.mOutputBusses.size() != 1 && this.mOutputHatches.size() != 0) - || this.mEnergyHatches.size() != 1 - || this.mReplicatorDataOrbHatches.size() != 1) { - return false; - } - log("Casings: " + mCasing); - return aDidBuild && mCasing >= 138 && checkHatch(); - } - - @Override - public int survivalConstruct(ItemStack itemStack, int elementBudget, ISurvivalBuildEnvironment env) { - if (mMachine) return -1; - return survivialBuildPiece(STRUCTURE_PIECE_MAIN, itemStack, 4, 4, 0, elementBudget, env, false, true); - } - - protected static int getCasingTextureIndex() { - return CASING_TEXTURE_ID; - } - - protected static Block getCasingBlock() { - return ModBlocks.blockCasings5Misc; - } - - protected static Block getCasingBlock2() { - return ModBlocks.blockSpecialMultiCasings; - } - - protected static Block getCasingBlock3() { - return ModBlocks.blockSpecialMultiCasings2; - } - - protected static Block getCasingBlock4() { - return ModBlocks.blockCasingsMisc; - } - - protected static int getCasingMeta() { - return 3; - } - - protected static int getCasingMeta2() { - return 12; - } - - protected static int getCasingMeta3() { - return 13; - } - - protected static int getCasingMeta4() { - return 2; - } - - protected static int getCasingMeta5() { - return 6; - } - - protected static int getCasingMeta6() { - return 9; - } - - protected static int getCasingMeta7() { - return 8; - } - - private boolean addDataOrbHatch(IGregTechTileEntity aTileEntity, int aBaseCasingIndex) { - if (aTileEntity == null) { - return false; - } else { - IMetaTileEntity aMetaTileEntity = aTileEntity.getMetaTileEntity(); - if (aMetaTileEntity == null) { - return false; - } - if (aMetaTileEntity instanceof GT_MetaTileEntity_Hatch_ElementalDataOrbHolder) { - try { - return addToMachineListInternal(mReplicatorDataOrbHatches, aMetaTileEntity, aBaseCasingIndex); - } catch (Throwable t) { - t.printStackTrace(); - } - } - } - return false; - } - - @Override - protected IAlignmentLimits getInitialAlignmentLimits() { - return (d, r, f) -> d == ForgeDirection.UP; - } - - @Override - protected IIconContainer getActiveOverlay() { - return TexturesGtBlock.Overlay_Machine_Controller_Advanced_Active; - } - - @Override - protected IIconContainer getInactiveOverlay() { - return TexturesGtBlock.Overlay_Machine_Controller_Advanced; - } - - @Override - protected int getCasingTextureId() { - return CASING_TEXTURE_ID; - } - - @Override - public RecipeMap<?> getRecipeMap() { - return RecipeMaps.replicatorRecipes; - } - - @Override - public boolean isCorrectMachinePart(final ItemStack aStack) { - return true; - } - - @Override - protected ProcessingLogic createProcessingLogic() { - return new ProcessingLogic().setSpeedBonus(1F / 2F) - .enablePerfectOverclock() - .setMaxParallelSupplier(this::getMaxParallelRecipes); - } - - @Override - protected void setupProcessingLogic(ProcessingLogic logic) { - super.setupProcessingLogic(logic); - for (GT_MetaTileEntity_Hatch_ElementalDataOrbHolder hatch : filterValidMTEs(mReplicatorDataOrbHatches)) { - ItemStack orb = hatch.getOrbByCircuit(); - logic.setSpecialSlotItem(orb); - break; - } - } - - @Override - public int getMaxParallelRecipes() { - return (8 * GT_Utility.getTier(this.getMaxInputVoltage())); - } - - @Override - public int getMaxEfficiency(final ItemStack aStack) { - return 10000; - } - - @Override - public int getPollutionPerSecond(final ItemStack aStack) { - return CORE.ConfigSwitches.pollutionPerSecondMultiMolecularTransformer; - } - - @Override - public int getDamageToComponent(final ItemStack aStack) { - return 0; - } - - @Override - public boolean explodesOnComponentBreak(final ItemStack aStack) { - return false; - } - - @Override - public void onPostTick(IGregTechTileEntity aBaseMetaTileEntity, long aTick) { - if (aBaseMetaTileEntity.isServerSide()) { - if (this.mUpdate == 1 || this.mStartUpCheck == 1) { - this.mReplicatorDataOrbHatches.clear(); - } - } - super.onPostTick(aBaseMetaTileEntity, aTick); - } - - @Override - public ArrayList<ItemStack> getStoredInputs() { - ArrayList<ItemStack> tItems = super.getStoredInputs(); - for (GT_MetaTileEntity_Hatch_ElementalDataOrbHolder tHatch : filterValidMTEs(mReplicatorDataOrbHatches)) { - tItems.add(tHatch.getOrbByCircuit()); - } - tItems.removeAll(Collections.singleton(null)); - return tItems; - } - - @Override - public boolean doesBindPlayerInventory() { - return false; - } -} diff --git a/gtpp/src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/production/GregtechMTE_FrothFlotationCell.java b/gtpp/src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/production/GregtechMTE_FrothFlotationCell.java deleted file mode 100644 index 8f807b94fd..0000000000 --- a/gtpp/src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/production/GregtechMTE_FrothFlotationCell.java +++ /dev/null @@ -1,287 +0,0 @@ -package gtPlusPlus.xmod.gregtech.common.tileentities.machines.multi.production; - -import static com.gtnewhorizon.structurelib.structure.StructureUtility.ofBlock; -import static com.gtnewhorizon.structurelib.structure.StructureUtility.onElementPass; -import static gregtech.api.enums.GT_HatchElement.Energy; -import static gregtech.api.enums.GT_HatchElement.InputBus; -import static gregtech.api.enums.GT_HatchElement.InputHatch; -import static gregtech.api.enums.GT_HatchElement.Maintenance; -import static gregtech.api.enums.GT_HatchElement.OutputHatch; -import static gregtech.api.util.GT_StructureUtility.buildHatchAdder; - -import java.util.List; -import java.util.Objects; - -import net.minecraft.item.ItemStack; -import net.minecraft.nbt.NBTTagCompound; -import net.minecraft.util.StatCollector; -import net.minecraftforge.common.util.Constants; -import net.minecraftforge.common.util.ForgeDirection; - -import org.jetbrains.annotations.NotNull; - -import com.gtnewhorizon.structurelib.alignment.IAlignmentLimits; -import com.gtnewhorizon.structurelib.alignment.constructable.ISurvivalConstructable; -import com.gtnewhorizon.structurelib.structure.IStructureDefinition; -import com.gtnewhorizon.structurelib.structure.ISurvivalBuildEnvironment; -import com.gtnewhorizon.structurelib.structure.StructureDefinition; -import com.gtnewhorizons.modularui.api.screen.ModularWindow; -import com.gtnewhorizons.modularui.api.screen.UIBuildContext; -import com.gtnewhorizons.modularui.common.widget.FakeSyncWidget; - -import gregtech.api.enums.SoundResource; -import gregtech.api.enums.TAE; -import gregtech.api.interfaces.IIconContainer; -import gregtech.api.interfaces.metatileentity.IMetaTileEntity; -import gregtech.api.interfaces.tileentity.IGregTechTileEntity; -import gregtech.api.logic.ProcessingLogic; -import gregtech.api.recipe.RecipeMap; -import gregtech.api.recipe.check.CheckRecipeResult; -import gregtech.api.recipe.check.CheckRecipeResultRegistry; -import gregtech.api.recipe.check.SimpleCheckRecipeResult; -import gregtech.api.util.GT_Multiblock_Tooltip_Builder; -import gregtech.api.util.GT_Recipe; -import gtPlusPlus.api.recipe.GTPPRecipeMaps; -import gtPlusPlus.core.block.ModBlocks; -import gtPlusPlus.core.lib.CORE; -import gtPlusPlus.core.material.Material; -import gtPlusPlus.xmod.gregtech.api.metatileentity.implementations.base.GregtechMeta_MultiBlockBase; -import gtPlusPlus.xmod.gregtech.common.blocks.textures.TexturesGtBlock; -import gtPlusPlus.xmod.gregtech.common.helpers.FlotationRecipeHandler; - -public class GregtechMTE_FrothFlotationCell extends GregtechMeta_MultiBlockBase<GregtechMTE_FrothFlotationCell> - implements ISurvivalConstructable { - - private int mCasing; - private static IStructureDefinition<GregtechMTE_FrothFlotationCell> STRUCTURE_DEFINITION = null; - - public GregtechMTE_FrothFlotationCell(final int aID, final String aName, final String aNameRegional) { - super(aID, aName, aNameRegional); - } - - public GregtechMTE_FrothFlotationCell(final String aName) { - super(aName); - } - - @Override - public IMetaTileEntity newMetaEntity(final IGregTechTileEntity aTileEntity) { - return new GregtechMTE_FrothFlotationCell(this.mName); - } - - @Override - public String getMachineType() { - return "Flotation Cell"; - } - - @Override - protected GT_Multiblock_Tooltip_Builder createTooltip() { - GT_Multiblock_Tooltip_Builder tt = new GT_Multiblock_Tooltip_Builder(); - tt.addMachineType(getMachineType()) - .addInfo("Process that milled ore!") - .addInfo("You can only ever process one type of material per controller") - .addPollutionAmount(getPollutionPerSecond(null)) - .addSeparator() - .beginStructureBlock(7, 9, 7, true) - .addController("Front Center") - .addCasingInfoMin("Inconel Reinforced Casing", 68, false) - .addCasingInfoMin("Flotation Casing", 52, false) - .addInputBus("Bottom Casing", 1) - .addInputHatch("Bottom Casing", 1) - .addOutputHatch("Bottom Casing", 1) - .addEnergyHatch("Bottom Casing", 1) - .addMaintenanceHatch("Bottom Casing", 1) - .toolTipFinisher(CORE.GT_Tooltip_Builder.get()); - return tt; - } - - @Override - protected SoundResource getProcessStartSound() { - return SoundResource.IC2_MACHINES_ELECTROFURNACE_LOOP; - } - - @Override - protected IIconContainer getActiveOverlay() { - return TexturesGtBlock.Overlay_Machine_Controller_Default_Active; - } - - @Override - protected IIconContainer getInactiveOverlay() { - return TexturesGtBlock.Overlay_Machine_Controller_Default; - } - - @Override - protected int getCasingTextureId() { - return TAE.getIndexFromPage(2, 1); - } - - @Override - public RecipeMap<?> getRecipeMap() { - return GTPPRecipeMaps.flotationCellRecipes; - } - - @Override - public int getMaxParallelRecipes() { - return 1; - } - - @Override - public IStructureDefinition<GregtechMTE_FrothFlotationCell> getStructureDefinition() { - if (STRUCTURE_DEFINITION == null) { - STRUCTURE_DEFINITION = StructureDefinition.<GregtechMTE_FrothFlotationCell>builder() - .addShape( - mName, - new String[][] { { " ", " ", " X ", " X~X ", " X ", " ", " " }, - { " ", " F ", " FFF ", " FF FF ", " FFF ", " F ", " " }, - { " ", " F ", " F F ", " F F ", " F F ", " F ", " " }, - { " ", " F ", " F F ", " F F ", " F F ", " F ", " " }, - { " ", " F ", " F F ", " F F ", " F F ", " F ", " " }, - { " ", " F ", " F F ", " F F ", " F F ", " F ", " " }, - { " ", " F ", " F F ", " F F ", " F F ", " F ", " " }, - { " CCC ", " CCCCC ", "CCCCCCC", "CCCCCCC", "CCCCCCC", " CCCCC ", " CCC " }, - { " CCC ", " CCCCC ", "CCCCCCC", "CCCCCCC", "CCCCCCC", " CCCCC ", " CCC " }, }) - .addElement( - 'C', - buildHatchAdder(GregtechMTE_FrothFlotationCell.class) - .atLeast(InputBus, InputHatch, OutputHatch, Maintenance, Energy) - .casingIndex(getCasingTextureId()) - .dot(1) - .buildAndChain(onElementPass(x -> ++x.mCasing, ofBlock(ModBlocks.blockCasings3Misc, 1)))) - .addElement('F', ofBlock(ModBlocks.blockSpecialMultiCasings, 9)) - .addElement('X', ofBlock(ModBlocks.blockCasings3Misc, 1)) - .build(); - } - return STRUCTURE_DEFINITION; - } - - @Override - public void construct(ItemStack stackSize, boolean hintsOnly) { - buildPiece(mName, stackSize, hintsOnly, 3, 3, 0); - } - - @Override - public int survivalConstruct(ItemStack stackSize, int elementBudget, ISurvivalBuildEnvironment env) { - if (mMachine) return -1; - return survivialBuildPiece(mName, stackSize, 3, 3, 0, elementBudget, env, false, true); - } - - @Override - public boolean checkMachine(IGregTechTileEntity aBaseMetaTileEntity, ItemStack aStack) { - mCasing = 0; - return checkPiece(mName, 3, 3, 0) && mCasing >= 68 - 4 && checkHatch(); - } - - @Override - protected IAlignmentLimits getInitialAlignmentLimits() { - return (d, r, f) -> d == ForgeDirection.UP; - } - - @Override - public int getMaxEfficiency(final ItemStack aStack) { - return 10000; - } - - @Override - public int getPollutionPerSecond(final ItemStack aStack) { - return CORE.ConfigSwitches.pollutionPerSecondMultiFrothFlotationCell; - } - - @Override - public boolean explodesOnComponentBreak(final ItemStack aStack) { - return false; - } - - @Override - protected ProcessingLogic createProcessingLogic() { - return new ProcessingLogic() { - - @NotNull - @Override - protected CheckRecipeResult validateRecipe(@NotNull GT_Recipe recipe) { - /* - * Material checks Makes sure we can only ever use one type of material in this flotation cell. We used - * to depend on Alk's hash, but it's unreliable and user-hostile So we're using unlocalized name of - * material now. - */ - Material foundMaterial = FlotationRecipeHandler - .getMaterialOfMilledProduct(FlotationRecipeHandler.findMilledStack(recipe)); - String foundMaterialName = null; - if (foundMaterial != null) { - foundMaterialName = foundMaterial.getUnlocalizedName(); - } - - if (foundMaterialName == null) { - return CheckRecipeResultRegistry.NO_RECIPE; - } - - // Set material locked for this controller - if (lockedMaterialName == null) { - lockedMaterialName = foundMaterialName; - } - - // Check material match - if (!Objects.equals(lockedMaterialName, foundMaterialName)) { - return SimpleCheckRecipeResult.ofFailure("machine_locked_to_different_recipe"); - } - return CheckRecipeResultRegistry.SUCCESSFUL; - } - }.enablePerfectOverclock(); - } - - /* - * Handle NBT - */ - - private String lockedMaterialName = null; - - @Override - public void setItemNBT(NBTTagCompound aNBT) { - if (lockedMaterialName != null) { - aNBT.setString("lockedMaterialName", lockedMaterialName); - } - super.setItemNBT(aNBT); - } - - @Override - public void saveNBTData(NBTTagCompound aNBT) { - super.saveNBTData(aNBT); - if (lockedMaterialName != null) { - aNBT.setString("lockedMaterialName", lockedMaterialName); - } - } - - @Override - public void loadNBTData(NBTTagCompound aNBT) { - super.loadNBTData(aNBT); - if (aNBT.hasKey("lockedMaterialName", Constants.NBT.TAG_STRING)) { - lockedMaterialName = aNBT.getString("lockedMaterialName"); - } - } - - @Override - public void addAdditionalTooltipInformation(ItemStack stack, List<String> tooltip) { - if (stack.hasTagCompound() && stack.getTagCompound() - .hasKey("lockedMaterialName")) { - tooltip.add( - StatCollector.translateToLocal("tooltip.flotationCell.lockedTo") + " " - + StatCollector.translateToLocal( - stack.getTagCompound() - .getString("lockedMaterialName"))); - } - } - - @Override - public String[] getExtraInfoData() { - return new String[] { "Locked material: " + lockedMaterialName }; - } - - @Override - public boolean isRecipeLockingEnabled() { - return lockedMaterialName != null && !lockedMaterialName.equals(""); - } - - @Override - public void addUIWidgets(ModularWindow.Builder builder, UIBuildContext buildContext) { - super.addUIWidgets(builder, buildContext); - builder.widget(new FakeSyncWidget.StringSyncer(() -> lockedMaterialName, val -> lockedMaterialName = val)); - } -} diff --git a/gtpp/src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/production/GregtechMTE_NuclearReactor.java b/gtpp/src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/production/GregtechMTE_NuclearReactor.java deleted file mode 100644 index 2faccc9697..0000000000 --- a/gtpp/src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/production/GregtechMTE_NuclearReactor.java +++ /dev/null @@ -1,524 +0,0 @@ -package gtPlusPlus.xmod.gregtech.common.tileentities.machines.multi.production; - -import static com.gtnewhorizon.structurelib.structure.StructureUtility.ofBlock; -import static com.gtnewhorizon.structurelib.structure.StructureUtility.ofChain; -import static com.gtnewhorizon.structurelib.structure.StructureUtility.onElementPass; -import static com.gtnewhorizon.structurelib.structure.StructureUtility.transpose; -import static gregtech.api.enums.GT_HatchElement.Dynamo; -import static gregtech.api.enums.GT_HatchElement.InputHatch; -import static gregtech.api.enums.GT_HatchElement.Maintenance; -import static gregtech.api.enums.GT_HatchElement.Muffler; -import static gregtech.api.enums.GT_HatchElement.OutputHatch; -import static gregtech.api.util.GT_StructureUtility.buildHatchAdder; -import static gregtech.api.util.GT_StructureUtility.filterByMTETier; - -import net.minecraft.item.ItemStack; -import net.minecraft.nbt.NBTTagCompound; -import net.minecraftforge.common.util.ForgeDirection; -import net.minecraftforge.fluids.FluidStack; - -import org.jetbrains.annotations.NotNull; - -import com.gtnewhorizon.structurelib.alignment.constructable.ISurvivalConstructable; -import com.gtnewhorizon.structurelib.structure.IStructureDefinition; -import com.gtnewhorizon.structurelib.structure.ISurvivalBuildEnvironment; -import com.gtnewhorizon.structurelib.structure.StructureDefinition; - -import gregtech.api.enums.TAE; -import gregtech.api.enums.Textures; -import gregtech.api.interfaces.ITexture; -import gregtech.api.interfaces.metatileentity.IMetaTileEntity; -import gregtech.api.interfaces.tileentity.IGregTechTileEntity; -import gregtech.api.logic.ProcessingLogic; -import gregtech.api.metatileentity.MetaTileEntity; -import gregtech.api.metatileentity.implementations.GT_MetaTileEntity_Hatch_Dynamo; -import gregtech.api.metatileentity.implementations.GT_MetaTileEntity_Hatch_Input; -import gregtech.api.metatileentity.implementations.GT_MetaTileEntity_Hatch_Maintenance; -import gregtech.api.metatileentity.implementations.GT_MetaTileEntity_Hatch_Muffler; -import gregtech.api.metatileentity.implementations.GT_MetaTileEntity_Hatch_Output; -import gregtech.api.objects.GT_ItemStack; -import gregtech.api.recipe.RecipeMap; -import gregtech.api.recipe.check.CheckRecipeResult; -import gregtech.api.recipe.check.CheckRecipeResultRegistry; -import gregtech.api.recipe.check.SimpleCheckRecipeResult; -import gregtech.api.render.TextureFactory; -import gregtech.api.util.GT_Multiblock_Tooltip_Builder; -import gregtech.api.util.GT_OverclockCalculator; -import gregtech.api.util.GT_Recipe; -import gregtech.api.util.shutdown.ShutDownReasonRegistry; -import gtPlusPlus.api.recipe.GTPPRecipeMaps; -import gtPlusPlus.core.block.ModBlocks; -import gtPlusPlus.core.lib.CORE; -import gtPlusPlus.core.material.ELEMENT; -import gtPlusPlus.core.material.nuclear.NUCLIDE; -import gtPlusPlus.core.util.math.MathUtils; -import gtPlusPlus.xmod.gregtech.api.metatileentity.implementations.base.GregtechMeta_MultiBlockBase; - -public class GregtechMTE_NuclearReactor extends GregtechMeta_MultiBlockBase<GregtechMTE_NuclearReactor> - implements ISurvivalConstructable { - - protected int mFuelRemaining = 0; - - private int mCasing; - private static IStructureDefinition<GregtechMTE_NuclearReactor> STRUCTURE_DEFINITION = null; - - public GregtechMTE_NuclearReactor(final int aID, final String aName, final String aNameRegional) { - super(aID, aName, aNameRegional); - } - - public GregtechMTE_NuclearReactor(final String aName) { - super(aName); - } - - @Override - public long maxEUStore() { - return (640000000L * (Math.min(16, this.mEnergyHatches.size()))) / 16L; - } - - @Override - public String getMachineType() { - return "Reactor"; - } - - @Override - public RecipeMap<?> getRecipeMap() { - return GTPPRecipeMaps.liquidFluorineThoriumReactorRecipes; - } - - @Override - protected GT_Multiblock_Tooltip_Builder createTooltip() { - GT_Multiblock_Tooltip_Builder tt = new GT_Multiblock_Tooltip_Builder(); - tt.addMachineType(getMachineType()) - .addInfo("Controller Block for the Liquid Fluoride Thorium Reactor.") - .addInfo("Produces energy and new elements from Radioactive Beta Decay!") - .addInfo("Input LFTB and a molten salt as fuel, and match the 4 Buffered Dynamo Hatches:") - .addInfo("LFTR Fuel 1 (4 EV Hatches), LFTR Fuel 2 (4 IV Hatches), LFTR Fuel 3 (4 LuV Hatches)") - .addInfo("If using better hatches for a worse fuel, only 1 hatch will output EU") - .addInfo("Outputs U233 every 10 seconds, on average, while the reactor is running") - .addInfo("Check NEI to see the other 3 outputs - they differ between fuels") - .addPollutionAmount(getPollutionPerSecond(null)) - .addSeparator() - .beginStructureBlock(7, 4, 7, true) - .addController("Bottom Center") - .addCasingInfoMin("Hastelloy-N Reactor Casing", 27, false) - .addCasingInfoMin("Zeron-100 Reactor Shielding", 26, false) - .addInputHatch("Top or bottom layer edges", 1) - .addOutputHatch("Top or bottom layer edges", 1) - .addDynamoHatch("Top or bottom layer edges", 1) - .addMaintenanceHatch("Top or bottom layer edges", 1) - .addMufflerHatch("Top 3x3", 2) - .addStructureInfo("All dynamos must be between EV and LuV tier.") - .addStructureInfo("All other hatches must be IV+ tier.") - .addStructureInfo("4x Output Hatches or 1x Output Hatch (ME), 1+ Input Hatches, 4x Dynamo Hatches") - .addStructureInfo("2x Maintenance Hatches, 4x Mufflers") - .toolTipFinisher(CORE.GT_Tooltip_Builder.get()); - return tt; - } - - @Override - public String[] getExtraInfoData() { - final String tRunning = (this.mMaxProgresstime > 0 ? "Reactor running" : "Reactor stopped"); - final String tMaintainance = (this.getIdealStatus() == this.getRepairStatus() ? "No Maintainance issues" - : "Needs Maintainance"); - - return new String[] { "Liquid Fluoride Thorium Reactor", tRunning, tMaintainance, - "Current Output: " + this.lEUt + " EU/t", "Fuel Remaining: " + this.mFuelRemaining + " Litres", - "Current Efficiency: " + (this.mEfficiency / 5) + "%", "Current Efficiency (Raw): " + (this.mEfficiency), - "It requires you to have 100% Efficiency." }; - } - - @Override - public boolean allowCoverOnSide(final ForgeDirection side, final GT_ItemStack aStack) { - return side != this.getBaseMetaTileEntity() - .getFrontFacing(); - } - - @Override - public ITexture[] getTexture(final IGregTechTileEntity aBaseMetaTileEntity, final ForgeDirection side, - final ForgeDirection facing, final int aColorIndex, final boolean aActive, final boolean aRedstone) { - boolean aWarmedUp = this.mEfficiency == this.getMaxEfficiency(null); - if (!aBaseMetaTileEntity.isActive() || !aWarmedUp) { - if (side == facing) { - if (aActive) return new ITexture[] { Textures.BlockIcons.getCasingTextureForId(TAE.GTPP_INDEX(12)), - TextureFactory.builder() - .addIcon(Textures.BlockIcons.OVERLAY_FRONT_REPLICATOR_ACTIVE) - .extFacing() - .build() }; - return new ITexture[] { Textures.BlockIcons.getCasingTextureForId(TAE.GTPP_INDEX(12)), - TextureFactory.builder() - .addIcon(Textures.BlockIcons.OVERLAY_FRONT_REPLICATOR) - .extFacing() - .build() }; - } - return new ITexture[] { Textures.BlockIcons.getCasingTextureForId(TAE.GTPP_INDEX(12)) }; - } else if (aBaseMetaTileEntity.isActive() && aWarmedUp) { - if (side == facing) { - if (aActive) return new ITexture[] { Textures.BlockIcons.getCasingTextureForId(TAE.GTPP_INDEX(13)), - TextureFactory.builder() - .addIcon(Textures.BlockIcons.OVERLAY_FRONT_REPLICATOR_ACTIVE) - .extFacing() - .build() }; - return new ITexture[] { Textures.BlockIcons.getCasingTextureForId(TAE.GTPP_INDEX(13)), - TextureFactory.builder() - .addIcon(Textures.BlockIcons.OVERLAY_FRONT_REPLICATOR) - .extFacing() - .build() }; - } - return new ITexture[] { Textures.BlockIcons.getCasingTextureForId(TAE.GTPP_INDEX(13)) }; - } - return new ITexture[] { Textures.BlockIcons.getCasingTextureForId(TAE.GTPP_INDEX(12)) }; - } - - public final boolean addNuclearReactorEdgeList(IGregTechTileEntity aTileEntity, int aBaseCasingIndex) { - if (aTileEntity == null) { - return false; - } else { - IMetaTileEntity aMetaTileEntity = aTileEntity.getMetaTileEntity(); - if (aMetaTileEntity instanceof GT_MetaTileEntity_Hatch_Maintenance) { - return addToMachineList(aTileEntity, aBaseCasingIndex); - } else if (aMetaTileEntity instanceof GT_MetaTileEntity_Hatch_Dynamo dynamo - && dynamo.getTierForStructure() >= 4 - && dynamo.getTierForStructure() <= 6) { - return addToMachineList(aTileEntity, aBaseCasingIndex); - } else if (aMetaTileEntity instanceof GT_MetaTileEntity_Hatch_Input hatch - && hatch.getTierForStructure() >= 5) { - return addToMachineList(aTileEntity, aBaseCasingIndex); - } else if (aMetaTileEntity instanceof GT_MetaTileEntity_Hatch_Output hatch - && hatch.getTierForStructure() >= 5) { - return addToMachineList(aTileEntity, aBaseCasingIndex); - } - } - return false; - } - - public final boolean addNuclearReactorTopList(IGregTechTileEntity aTileEntity, int aBaseCasingIndex) { - if (aTileEntity == null) { - return false; - } else { - IMetaTileEntity aMetaTileEntity = aTileEntity.getMetaTileEntity(); - if (aMetaTileEntity instanceof GT_MetaTileEntity_Hatch_Muffler hatch && hatch.getTierForStructure() >= 5) { - return addToMachineList(aTileEntity, aBaseCasingIndex); - } - } - return false; - } - - @Override - public IStructureDefinition<GregtechMTE_NuclearReactor> getStructureDefinition() { - if (STRUCTURE_DEFINITION == null) { - STRUCTURE_DEFINITION = StructureDefinition.<GregtechMTE_NuclearReactor>builder() - .addShape( - mName, - transpose( - new String[][] { - { "CCCCCCC", "COOOOOC", "COXXXOC", "COXXXOC", "COXXXOC", "COOOOOC", "CCCCCCC" }, - { "GGGGGGG", "G-----G", "G-----G", "G-----G", "G-----G", "G-----G", "GGGGGGG" }, - { "GGGGGGG", "G-----G", "G-----G", "G-----G", "G-----G", "G-----G", "GGGGGGG" }, - { "CCC~CCC", "COOOOOC", "COOOOOC", "COOOOOC", "COOOOOC", "COOOOOC", "CCCCCCC" }, })) - .addElement( - 'C', - ofChain( - buildHatchAdder(GregtechMTE_NuclearReactor.class).atLeast(Maintenance) - .casingIndex(TAE.GTPP_INDEX(12)) - .dot(1) - .build(), - buildHatchAdder(GregtechMTE_NuclearReactor.class).atLeast(InputHatch, OutputHatch) - .adder(GregtechMTE_NuclearReactor::addNuclearReactorEdgeList) - .hatchItemFilterAnd(t -> filterByMTETier(5, Integer.MAX_VALUE)) - .casingIndex(TAE.GTPP_INDEX(12)) - .dot(1) - .build(), - buildHatchAdder(GregtechMTE_NuclearReactor.class).atLeast(Dynamo) - .adder(GregtechMTE_NuclearReactor::addNuclearReactorEdgeList) - .hatchItemFilterAnd(t -> filterByMTETier(4, 6)) - .casingIndex(TAE.GTPP_INDEX(12)) - .dot(1) - .build(), - onElementPass(x -> ++x.mCasing, ofBlock(ModBlocks.blockCasingsMisc, 12)))) - .addElement( - 'X', - buildHatchAdder(GregtechMTE_NuclearReactor.class).atLeast(Muffler) - .adder(GregtechMTE_NuclearReactor::addNuclearReactorTopList) - .hatchItemFilterAnd(t -> filterByMTETier(5, Integer.MAX_VALUE)) - .casingIndex(TAE.GTPP_INDEX(12)) - .dot(1) - .buildAndChain(onElementPass(x -> ++x.mCasing, ofBlock(ModBlocks.blockCasingsMisc, 12)))) - .addElement('O', ofBlock(ModBlocks.blockCasingsMisc, 12)) - .addElement('G', ofBlock(ModBlocks.blockCasingsMisc, 13)) - .build(); - } - return STRUCTURE_DEFINITION; - } - - @Override - public void construct(ItemStack stackSize, boolean hintsOnly) { - buildPiece(mName, stackSize, hintsOnly, 3, 3, 0); - } - - @Override - public int survivalConstruct(ItemStack stackSize, int elementBudget, ISurvivalBuildEnvironment env) { - if (mMachine) return -1; - return survivialBuildPiece(mName, stackSize, 3, 3, 0, elementBudget, env, false, true); - } - - @Override - public boolean checkMachine(IGregTechTileEntity aBaseMetaTileEntity, ItemStack aStack) { - mCasing = 0; - if (checkPiece(mName, 3, 3, 0) && mCasing >= 27) { - if ((mOutputHatches.size() >= 3 || canDumpFluidToME()) && mInputHatches.size() >= 1 - && mDynamoHatches.size() == 4 - && mMufflerHatches.size() == 4 - && mMaintenanceHatches.size() == 2) { - fixAllMaintenanceIssue(); - this.turnCasingActive(false); - return true; - } - } - return false; - } - - // Alk's Life Lessons from Greg. - /* - * [23:41:15] <GregoriusTechneticies> xdir and zdir are x2 and not x3 [23:41:26] <GregoriusTechneticies> thats you - * issue [23:44:33] <Alkalus> mmm? [23:44:49] <Alkalus> Should they be x3? [23:44:50] <GregoriusTechneticies> you - * just do a x2, what is for a 5x5 multiblock [23:45:01] <GregoriusTechneticies> x3 is for a 7x7 one [23:45:06] - * <Alkalus> I have no idea what that value does, tbh.. [23:45:15] <GregoriusTechneticies> its the offset [23:45:23] - * <Alkalus> Debugging checkMachine has been a pain and I usually trash designs that don't work straight up.. - * [23:45:28] <GregoriusTechneticies> it determines the horizontal middle of the multiblock [23:45:47] - * <GregoriusTechneticies> which is in your case THREE blocks away from the controller [23:45:51] <Alkalus> Ahh - * [23:45:57] <GregoriusTechneticies> and not 2 [23:46:06] <Alkalus> Noted, thanks :D - */ - - @Override - public boolean isCorrectMachinePart(final ItemStack aStack) { - return true; - } - - @Override - public int getMaxEfficiency(final ItemStack aStack) { - return 10000; - } - - @Override - public int getPollutionPerTick(final ItemStack aStack) { - return 0; - } - - @Override - public int getDamageToComponent(final ItemStack aStack) { - return 0; - } - - @Override - public boolean explodesOnComponentBreak(final ItemStack aStack) { - return true; - } - - @Override - public IMetaTileEntity newMetaEntity(final IGregTechTileEntity aTileEntity) { - return new GregtechMTE_NuclearReactor(this.mName); - } - - public boolean turnCasingActive(final boolean status) { - // TODO - if (this.mDynamoHatches != null) { - for (final GT_MetaTileEntity_Hatch_Dynamo hatch : this.mDynamoHatches) { - hatch.updateTexture(status ? TAE.GTPP_INDEX(13) : TAE.GTPP_INDEX(12)); - } - } - if (this.mMufflerHatches != null) { - for (final GT_MetaTileEntity_Hatch_Muffler hatch : this.mMufflerHatches) { - hatch.updateTexture(status ? TAE.GTPP_INDEX(13) : TAE.GTPP_INDEX(12)); - } - } - if (this.mOutputHatches != null) { - for (final GT_MetaTileEntity_Hatch_Output hatch : this.mOutputHatches) { - hatch.updateTexture(status ? TAE.GTPP_INDEX(13) : TAE.GTPP_INDEX(12)); - } - } - if (this.mInputHatches != null) { - for (final GT_MetaTileEntity_Hatch_Input hatch : this.mInputHatches) { - hatch.updateTexture(status ? TAE.GTPP_INDEX(13) : TAE.GTPP_INDEX(12)); - } - } - if (this.mMaintenanceHatches != null) { - for (final GT_MetaTileEntity_Hatch_Maintenance hatch : this.mMaintenanceHatches) { - hatch.updateTexture(status ? TAE.GTPP_INDEX(13) : TAE.GTPP_INDEX(12)); - } - } - return true; - } - - @Override - protected ProcessingLogic createProcessingLogic() { - return new ProcessingLogic() { - - @NotNull - @Override - protected GT_OverclockCalculator createOverclockCalculator(@NotNull GT_Recipe recipe) { - return GT_OverclockCalculator.ofNoOverclock(recipe.mSpecialValue * 4L, recipe.mDuration); - } - - @NotNull - @Override - public CheckRecipeResult process() { - CheckRecipeResult result = super.process(); - if (!result.wasSuccessful()) { - resetMultiProcessing(); - } - return result; - } - - @NotNull - @Override - protected CheckRecipeResult validateRecipe(@NotNull GT_Recipe recipe) { - mFuelRemaining = 0; - int li2bef4 = 0; - FluidStack aFuelFluid = null; - for (FluidStack aFluidInput : recipe.mFluidInputs) { - if (!aFluidInput.getFluid() - .equals(NUCLIDE.Li2BeF4.getFluid())) { - aFuelFluid = aFluidInput; - break; - } - } - if (aFuelFluid != null) { - for (FluidStack fluidStack : getStoredFluids()) { - if (fluidStack.isFluidEqual(aFuelFluid)) { - mFuelRemaining += fluidStack.amount; - } else if (fluidStack.getFluid() - .equals(NUCLIDE.Li2BeF4.getFluid())) { - li2bef4 += fluidStack.amount; - } - } - } - if (mFuelRemaining < 100) { - return CheckRecipeResultRegistry.NO_FUEL_FOUND; - } - if (li2bef4 < 200) { - return SimpleCheckRecipeResult.ofFailure("no_li2bef4"); - } - return CheckRecipeResultRegistry.SUCCESSFUL; - } - }; - } - - protected void resetMultiProcessing() { - this.mEfficiency = 0; - this.mLastRecipe = null; - stopMachine(ShutDownReasonRegistry.NONE); - } - - @Override - public @NotNull CheckRecipeResult checkProcessing() { - // Warm up for 4~ minutes - if (mEfficiency < this.getMaxEfficiency(null)) { - this.mMaxProgresstime = 1; - this.mEfficiencyIncrease = 2; - return SimpleCheckRecipeResult.ofSuccess("warm_up"); - } - CheckRecipeResult result = super.checkProcessing(); - if (result.wasSuccessful()) { - // We produce EU, so we negate the value, if negative - if (lEUt < 0) { - lEUt = -lEUt; - } - } - return result; - } - - @Override - public int getMaxParallelRecipes() { - return 1; - } - - @Override - public void explodeMultiblock() { - this.mInventory[1] = null; - long explodevalue = MathUtils.randLong(Integer.MAX_VALUE, 8589934588L); - for (final MetaTileEntity tTileEntity : this.mInputBusses) { - explodevalue = MathUtils.randLong(Integer.MAX_VALUE, 8589934588L); - tTileEntity.getBaseMetaTileEntity() - .doExplosion(explodevalue); - } - for (final MetaTileEntity tTileEntity : this.mOutputBusses) { - explodevalue = MathUtils.randLong(Integer.MAX_VALUE, 8589934588L); - tTileEntity.getBaseMetaTileEntity() - .doExplosion(explodevalue); - } - for (final MetaTileEntity tTileEntity : this.mInputHatches) { - explodevalue = MathUtils.randLong(Integer.MAX_VALUE, 8589934588L); - tTileEntity.getBaseMetaTileEntity() - .doExplosion(explodevalue); - } - for (final MetaTileEntity tTileEntity : this.mOutputHatches) { - explodevalue = MathUtils.randLong(Integer.MAX_VALUE, 8589934588L); - tTileEntity.getBaseMetaTileEntity() - .doExplosion(explodevalue); - } - for (final MetaTileEntity tTileEntity : this.mDynamoHatches) { - explodevalue = MathUtils.randLong(Integer.MAX_VALUE, 8589934588L); - tTileEntity.getBaseMetaTileEntity() - .doExplosion(explodevalue); - } - for (final MetaTileEntity tTileEntity : this.mMufflerHatches) { - explodevalue = MathUtils.randLong(Integer.MAX_VALUE, 8589934588L); - tTileEntity.getBaseMetaTileEntity() - .doExplosion(explodevalue); - } - for (final MetaTileEntity tTileEntity : this.mEnergyHatches) { - explodevalue = MathUtils.randLong(Integer.MAX_VALUE, 8589934588L); - tTileEntity.getBaseMetaTileEntity() - .doExplosion(explodevalue); - } - for (final MetaTileEntity tTileEntity : this.mMaintenanceHatches) { - explodevalue = MathUtils.randLong(Integer.MAX_VALUE, 8589934588L); - tTileEntity.getBaseMetaTileEntity() - .doExplosion(explodevalue); - } - explodevalue = MathUtils.randLong(Integer.MAX_VALUE, 8589934588L); - this.getBaseMetaTileEntity() - .doExplosion(explodevalue); - } - - @Override - public void onPostTick(IGregTechTileEntity aBaseMetaTileEntity, long aTick) { - if (aBaseMetaTileEntity.getWorld().isRemote) { - if (aBaseMetaTileEntity.isActive()) { - // Set casings active if we're warmed up. - if (this.mEfficiency == this.getMaxEfficiency(null)) { - this.turnCasingActive(true); - } else { - this.turnCasingActive(false); - } - } else { - this.turnCasingActive(false); - } - } - super.onPostTick(aBaseMetaTileEntity, aTick); - } - - @Override - public boolean onRunningTick(ItemStack aStack) { - // See if we're warmed up. - if (this.mEfficiency == this.getMaxEfficiency(null)) { - // Try output some Uranium-233 - if (MathUtils.randInt(1, 300) == 1) { - this.addOutput(ELEMENT.getInstance().URANIUM233.getFluidStack(MathUtils.randInt(1, 10))); - } - } - return super.onRunningTick(aStack); - } - - @Override - public void saveNBTData(NBTTagCompound aNBT) { - aNBT.setInteger("mFuelRemaining", this.mFuelRemaining); - super.saveNBTData(aNBT); - } - - @Override - public void loadNBTData(NBTTagCompound aNBT) { - this.mFuelRemaining = aNBT.getInteger("mFuelRemaining"); - super.loadNBTData(aNBT); - } -} diff --git a/gtpp/src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/production/GregtechMetaTileEntityTreeFarm.java b/gtpp/src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/production/GregtechMetaTileEntityTreeFarm.java deleted file mode 100644 index 0441907f40..0000000000 --- a/gtpp/src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/production/GregtechMetaTileEntityTreeFarm.java +++ /dev/null @@ -1,809 +0,0 @@ -package gtPlusPlus.xmod.gregtech.common.tileentities.machines.multi.production; - -import static com.gtnewhorizon.structurelib.structure.StructureUtility.ofBlock; -import static com.gtnewhorizon.structurelib.structure.StructureUtility.onElementPass; -import static com.gtnewhorizon.structurelib.structure.StructureUtility.transpose; -import static gregtech.api.enums.GT_HatchElement.Energy; -import static gregtech.api.enums.GT_HatchElement.InputBus; -import static gregtech.api.enums.GT_HatchElement.InputHatch; -import static gregtech.api.enums.GT_HatchElement.Maintenance; -import static gregtech.api.enums.GT_HatchElement.Muffler; -import static gregtech.api.enums.GT_HatchElement.OutputBus; -import static gregtech.api.enums.GT_HatchElement.OutputHatch; -import static gregtech.api.util.GT_StructureUtility.buildHatchAdder; -import static gregtech.api.util.GT_Utility.filterValidMTEs; -import static gtPlusPlus.xmod.gregtech.api.metatileentity.implementations.base.GregtechMeta_MultiBlockBase.GTPPHatchElement.TTEnergy; - -import java.util.ArrayList; -import java.util.EnumMap; -import java.util.HashMap; -import java.util.List; - -import javax.annotation.Nonnull; - -import net.minecraft.init.Items; -import net.minecraft.item.Item; -import net.minecraft.item.ItemShears; -import net.minecraft.item.ItemStack; -import net.minecraft.util.EnumChatFormatting; -import net.minecraftforge.fluids.FluidStack; - -import com.gtnewhorizon.structurelib.alignment.constructable.ISurvivalConstructable; -import com.gtnewhorizon.structurelib.structure.IStructureDefinition; -import com.gtnewhorizon.structurelib.structure.ISurvivalBuildEnvironment; -import com.gtnewhorizon.structurelib.structure.StructureDefinition; - -import forestry.api.arboriculture.IToolGrafter; -import forestry.api.arboriculture.ITree; -import forestry.api.arboriculture.TreeManager; -import gregtech.api.enums.GT_Values; -import gregtech.api.enums.Mods; -import gregtech.api.enums.TAE; -import gregtech.api.interfaces.IIconContainer; -import gregtech.api.interfaces.metatileentity.IMetaTileEntity; -import gregtech.api.interfaces.tileentity.IGregTechTileEntity; -import gregtech.api.items.GT_MetaGenerated_Tool; -import gregtech.api.logic.ProcessingLogic; -import gregtech.api.metatileentity.implementations.GT_MetaTileEntity_Hatch_InputBus; -import gregtech.api.recipe.RecipeMap; -import gregtech.api.recipe.check.CheckRecipeResult; -import gregtech.api.recipe.check.CheckRecipeResultRegistry; -import gregtech.api.recipe.check.SimpleCheckRecipeResult; -import gregtech.api.util.GT_ModHandler; -import gregtech.api.util.GT_Multiblock_Tooltip_Builder; -import gregtech.api.util.GT_Recipe; -import gregtech.api.util.GT_Utility; -import gregtech.api.util.VoidProtectionHelper; -import gregtech.common.items.GT_MetaGenerated_Tool_01; -import gregtech.common.tileentities.machines.GT_MetaTileEntity_Hatch_InputBus_ME; -import gtPlusPlus.api.objects.Logger; -import gtPlusPlus.api.recipe.GTPPRecipeMaps; -import gtPlusPlus.core.block.ModBlocks; -import gtPlusPlus.core.lib.CORE; -import gtPlusPlus.core.util.minecraft.ItemUtils; -import gtPlusPlus.xmod.gregtech.api.metatileentity.implementations.base.GregtechMeta_MultiBlockBase; -import gtPlusPlus.xmod.gregtech.common.blocks.textures.TexturesGtBlock; -import gtPlusPlus.xmod.gregtech.common.items.MetaGeneratedGregtechTools; - -public class GregtechMetaTileEntityTreeFarm extends GregtechMeta_MultiBlockBase<GregtechMetaTileEntityTreeFarm> - implements ISurvivalConstructable { - - public static int CASING_TEXTURE_ID; - private static final int TICKS_PER_OPERATION = 100; - private static final int TOOL_DAMAGE_PER_OPERATION = 1; - private static final int TOOL_CHARGE_PER_OPERATION = 32; - - private int mCasing; - public static String mCasingName = "Sterile Farm Casing"; - private static IStructureDefinition<GregtechMetaTileEntityTreeFarm> STRUCTURE_DEFINITION = null; - - public GregtechMetaTileEntityTreeFarm(final int aID, final String aName, final String aNameRegional) { - super(aID, aName, aNameRegional); - CASING_TEXTURE_ID = TAE.getIndexFromPage(1, 15); - } - - public GregtechMetaTileEntityTreeFarm(final String aName) { - super(aName); - CASING_TEXTURE_ID = TAE.getIndexFromPage(1, 15); - } - - @Override - public IMetaTileEntity newMetaEntity(final IGregTechTileEntity aTileEntity) { - return new GregtechMetaTileEntityTreeFarm(this.mName); - } - - @Override - public String getMachineType() { - return "Tree Farm"; - } - - @Override - protected GT_Multiblock_Tooltip_Builder createTooltip() { - GT_Multiblock_Tooltip_Builder tt = new GT_Multiblock_Tooltip_Builder(); - tt.addMachineType(getMachineType()) - .addInfo("Controller block for the Tree Growth Simulator") - .addInfo("Farms and harvests trees using EU") - .addInfo("Place a sapling in the controller slot") - .addInfo("Place a tool in an input bus") - .addInfo("Different tools are required for different outputs") - .addInfo("Advanced tools multiply output amount") - .addInfo(" Logs: Saw (1x), Buzzsaw (2x), Chainsaw (4x)") - .addInfo(" Saplings: Branch Cutter (1x), Grafter (3x)") - .addInfo(" Leaves: Shears (1x), Wire Cutter (2x), Automatic Snips (4x)") - .addInfo(" Fruit: Knife (1x)") - .addInfo("Multiple tools can be used at the same time") - .addSeparator() - .addInfo("Work time is fixed at 5 seconds") - .addInfo("Energy input tier multiplies output further") - .addInfo("Output multiplier is equal to: 2*tier^2 - 2*tier + 5") - .addPollutionAmount(getPollutionPerSecond(null)) - .addSeparator() - .beginStructureBlock(3, 3, 3, true) - .addController("Front center") - .addCasingInfoMin(mCasingName, 8, false) - .addInputBus("Any casing", 1) - .addStructureInfo( - EnumChatFormatting.YELLOW + "Stocking Input Busses and Crafting Input Busses/Buffers are not allowed!") - .addOutputBus("Any casing", 1) - .addEnergyHatch("Any casing", 1) - .addMaintenanceHatch("Any casing", 1) - .addMufflerHatch("Any casing", 1) - .toolTipFinisher(CORE.GT_Tooltip_Builder.get()); - return tt; - } - - @Override - protected IIconContainer getActiveOverlay() { - return TexturesGtBlock.Overlay_Machine_Controller_Advanced_Active; - } - - @Override - protected IIconContainer getInactiveOverlay() { - return TexturesGtBlock.Overlay_Machine_Controller_Advanced; - } - - @Override - protected int getCasingTextureId() { - return CASING_TEXTURE_ID; - } - - @Override - public boolean checkMachine(IGregTechTileEntity aBaseMetaTileEntity, ItemStack aStack) { - mCasing = 0; - return checkPiece(mName, 1, 1, 0) && mCasing >= 8 && checkHatch(); - } - - @Override - public boolean addInputBusToMachineList(IGregTechTileEntity aTileEntity, int aBaseCasingIndex) { - // Tools from a stocking inout bus can not be damaged, this would cause an infinite durability exploit. - // Therefore disallow ME input bus. - if (aTileEntity == null) return false; - IMetaTileEntity aMetaTileEntity = aTileEntity.getMetaTileEntity(); - if (aMetaTileEntity == null) return false; - if (aMetaTileEntity instanceof GT_MetaTileEntity_Hatch_InputBus_ME) return false; - return super.addInputBusToMachineList(aTileEntity, aBaseCasingIndex); - } - - @Override - public boolean supportsCraftingMEBuffer() { - return false; - } - - @Override - public int getMaxParallelRecipes() { - return 1; - } - - @Override - public boolean supportsBatchMode() { - // Batch mode would not do anything, processing time is fixed at 100 ticks. - return false; - } - - @Override - public boolean isBatchModeEnabled() { - return false; - } - - @Override - public int getMaxEfficiency(final ItemStack aStack) { - return 10000; - } - - @Override - public int getPollutionPerSecond(final ItemStack aStack) { - return CORE.ConfigSwitches.pollutionPerSecondMultiTreeFarm; - } - - @Override - public boolean explodesOnComponentBreak(final ItemStack aStack) { - return false; - } - - @Override - public IStructureDefinition<GregtechMetaTileEntityTreeFarm> getStructureDefinition() { - if (STRUCTURE_DEFINITION == null) { - STRUCTURE_DEFINITION = StructureDefinition.<GregtechMetaTileEntityTreeFarm>builder() - .addShape( - mName, - transpose( - new String[][] { { "CCC", "CCC", "CCC" }, { "C~C", "C-C", "CCC" }, { "CCC", "CCC", "CCC" }, })) - .addElement( - 'C', - buildHatchAdder(GregtechMetaTileEntityTreeFarm.class) - .atLeast( - InputHatch, - OutputHatch, - InputBus, - OutputBus, - Maintenance, - Energy.or(TTEnergy), - Muffler) - .casingIndex(CASING_TEXTURE_ID) - .dot(1) - .buildAndChain(onElementPass(x -> ++x.mCasing, ofBlock(ModBlocks.blockCasings2Misc, 15)))) - .build(); - } - return STRUCTURE_DEFINITION; - } - - @Override - public void construct(ItemStack stackSize, boolean hintsOnly) { - buildPiece(mName, stackSize, hintsOnly, 1, 1, 0); - } - - @Override - public int survivalConstruct(ItemStack stackSize, int elementBudget, ISurvivalBuildEnvironment env) { - if (mMachine) return -1; - return survivialBuildPiece(mName, stackSize, 1, 1, 0, elementBudget, env, false, true); - } - - /* Processing logic. */ - - @Override - public boolean isCorrectMachinePart(final ItemStack aStack) { - if (aStack == null) return false; - if (isValidSapling(aStack)) return true; - /* - * In previous versions, a saw used to go in the controller slot. We do not want an update to stop processing of - * a machine set up like this. Instead, a sapling is placed in this slot at the start of the next operation. - */ - if (aStack.getItem() instanceof GT_MetaGenerated_Tool_01) return true; - return false; - } - - @Override - public RecipeMap<?> getRecipeMap() { - // Only for NEI, not used in processing logic. - return GTPPRecipeMaps.treeGrowthSimulatorFakeRecipes; - } - - /** - * Valid processing modes (types of output) for the Tree Growth Simulator. - */ - public enum Mode { - LOG, - SAPLING, - LEAVES, - FRUIT - } - - /** - * Edit this to change relative yields for different modes. For example, logs are output at 5 times the rate of - * saplings. - */ - private static final EnumMap<Mode, Integer> modeMultiplier = new EnumMap<>(Mode.class); - static { - modeMultiplier.put(Mode.LOG, 5); - modeMultiplier.put(Mode.SAPLING, 1); - modeMultiplier.put(Mode.LEAVES, 2); - modeMultiplier.put(Mode.FRUIT, 1); - } - - /** - * Return the output multiplier for a given power tier. - * - * @param tier Power tier the machine runs on. - * @return Factor to multiply all outputs by. - */ - private static int getTierMultiplier(int tier) { - /* - * Where does this formula come from? [12:57 AM] boubou_19: i did. Basically Pandoro measured the output of a - * WA-ed farming station for each tier of WA, then i computed the Lagrange interpolating polynomial of his - * dataset, which gave this - */ - return (2 * (tier * tier)) - (2 * tier) + 5; - } - - /** - * Key of this map is the registry name of the sapling, followed by ":", and the sapling's metadata value. - * <p> - * The value of the map is a list of products by {@link Mode}. Products for some modes can be null if the tree does - * not produce anything in that mode (for example, it has no fruit). - */ - public static final HashMap<String, EnumMap<Mode, ItemStack>> treeProductsMap = new HashMap<>(); - - @Override - public ProcessingLogic createProcessingLogic() { - return new ProcessingLogic() { - - @Override - @Nonnull - public CheckRecipeResult process() { - if (inputItems == null) { - inputItems = new ItemStack[0]; - } - if (inputFluids == null) { - inputFluids = new FluidStack[0]; - } - - ItemStack sapling = findSapling(); - if (sapling == null) return SimpleCheckRecipeResult.ofFailure("no_sapling"); - - EnumMap<Mode, ItemStack> outputPerMode = getOutputsForSapling(sapling); - if (outputPerMode == null) { - // This should usually not be possible, outputs for all valid saplings should be defined. - Logger.INFO("No output found for sapling: " + sapling.getDisplayName()); - return SimpleCheckRecipeResult.ofFailure("no_output_for_sapling"); - } - - int tier = Math.max(1, GT_Utility.getTier(availableVoltage * availableAmperage)); - int tierMultiplier = getTierMultiplier(tier); - - List<ItemStack> outputs = new ArrayList<>(); - for (Mode mode : Mode.values()) { - ItemStack output = outputPerMode.get(mode); - if (output == null) continue; // This sapling has no output in this mode. - - // Find a tool to use in this mode. - int toolMultiplier = useToolForMode(mode); - if (toolMultiplier < 0) continue; // No valid tool for this mode found. - - // Increase output by the relevant multipliers. - ItemStack out = output.copy(); - out.stackSize *= tierMultiplier * modeMultiplier.get(mode) * toolMultiplier; - outputs.add(out); - } - - if (outputs.isEmpty()) { - // No outputs can be produced using the tools we have available. - return SimpleCheckRecipeResult.ofFailure("no_tools"); - } - - outputItems = outputs.toArray(new ItemStack[0]); - - VoidProtectionHelper voidProtection = new VoidProtectionHelper().setMachine(machine) - .setItemOutputs(outputItems) - .build(); - if (voidProtection.isItemFull()) { - return CheckRecipeResultRegistry.ITEM_OUTPUT_FULL; - } - - duration = TICKS_PER_OPERATION; - calculatedEut = GT_Values.VP[tier]; - - return SimpleCheckRecipeResult.ofSuccess("growing_trees"); - } - }; - } - - /* Handling tools. */ - - /** - * Attempts to find a tool appropriate for the given mode, and damage/discharge it by one use. - * - * @param mode The mode to use. This specifies which tools are valid. - * @return Production multiplier based on the tool used, or -1 if no appropriate tool was found. - */ - private int useToolForMode(Mode mode) { - for (ItemStack stack : getStoredInputs()) { - int toolMultiplier = getToolMultiplier(stack, mode); - if (toolMultiplier < 0) continue; - boolean canDamage = GT_ModHandler - .damageOrDechargeItem(stack, TOOL_DAMAGE_PER_OPERATION, TOOL_CHARGE_PER_OPERATION, null); - if (canDamage) { - // Tool was used. - if (GT_ModHandler.isElectricItem(stack) - && !GT_ModHandler.canUseElectricItem(stack, TOOL_CHARGE_PER_OPERATION)) { - // Tool is out of charge, move it to output. - depleteInput(stack); - addOutput(stack); - } - return toolMultiplier; - } else { - // Correct item type, but the tool could not be used. - depleteInput(stack); - addOutput(stack); - } - - } - return -1; - } - - /** - * Calculate output multiplier for a given tool and mode. - * - * @param toolStack The tool to use. - * @param mode The mode to use. - * @return Output multiplier for the given tool used in the given mode. If the tool is not appropriate for this - * mode, returns -1. - */ - public static int getToolMultiplier(ItemStack toolStack, Mode mode) { - Item tool = toolStack.getItem(); - switch (mode) { - case LOG: - if (tool instanceof GT_MetaGenerated_Tool_01) { - switch (toolStack.getItemDamage()) { - case GT_MetaGenerated_Tool_01.SAW: - case GT_MetaGenerated_Tool_01.POCKET_SAW: - case GT_MetaGenerated_Tool_01.POCKET_MULTITOOL: - return 1; - case GT_MetaGenerated_Tool_01.BUZZSAW_LV: - case GT_MetaGenerated_Tool_01.BUZZSAW_MV: - case GT_MetaGenerated_Tool_01.BUZZSAW_HV: - return 2; - case GT_MetaGenerated_Tool_01.CHAINSAW_LV: - case GT_MetaGenerated_Tool_01.CHAINSAW_MV: - case GT_MetaGenerated_Tool_01.CHAINSAW_HV: - return 4; - } - } - break; - - case SAPLING: - if (tool instanceof GT_MetaGenerated_Tool_01) { - switch (toolStack.getItemDamage()) { - case GT_MetaGenerated_Tool_01.BRANCHCUTTER: - case GT_MetaGenerated_Tool_01.POCKET_BRANCHCUTTER: - case GT_MetaGenerated_Tool_01.POCKET_MULTITOOL: - return 1; - } - } - if (tool instanceof IToolGrafter && tool.isDamageable()) { - return 3; - } - break; - - case LEAVES: - // Do not allow unbreakable tools. Operation should have a running cost. - if (tool instanceof ItemShears && tool.isDamageable()) { - return 1; - } - if (tool instanceof GT_MetaGenerated_Tool_01) { - switch (toolStack.getItemDamage()) { - case GT_MetaGenerated_Tool_01.POCKET_MULTITOOL: - return 1; - case GT_MetaGenerated_Tool_01.WIRECUTTER: - case GT_MetaGenerated_Tool_01.POCKET_WIRECUTTER: - return 2; - } - } - if (tool instanceof MetaGeneratedGregtechTools) { - if (toolStack.getItemDamage() == MetaGeneratedGregtechTools.ELECTRIC_SNIPS) { - return 4; - } - } - break; - - case FRUIT: - if (tool instanceof GT_MetaGenerated_Tool_01) { - switch (toolStack.getItemDamage()) { - case GT_MetaGenerated_Tool_01.KNIFE: - case GT_MetaGenerated_Tool_01.POCKET_KNIFE: - case GT_MetaGenerated_Tool_01.POCKET_MULTITOOL: - return 1; - } - } - break; - } - - // No valid tool was found. - return -1; - } - - /* Handling saplings. */ - - /** - * Finds a valid sapling from input buses, and places it into the controller slot. - * - * @return The sapling that was found (now in the controller slot). - */ - private ItemStack findSapling() { - ItemStack controllerSlot = getControllerSlot(); - - if (isValidSapling(controllerSlot)) { - return controllerSlot; - } - - if (controllerSlot != null) { - // Non-sapling item in controller slot. This could be a saw from an older version of the TGS. - // We first try to swap it with a sapling from an input bus to not interrupt existing setups. - if (!legacyToolSwap()) { - // Swap failed, output whatever is blocking the slot. - addOutput(controllerSlot); - mInventory[1] = null; - } - } - - // Here controller slot is empty, find a valid sapling to use. - for (ItemStack stack : getStoredInputs()) { - if (isValidSapling(stack)) { - mInventory[1] = stack.splitStack(1); - return mInventory[1]; - } - } - - // No saplings were found. - return null; - } - - /** - * In previous versions, the saw used to be placed in the controller slot and the sapling into an input bus. We do - * not want to break existing setups like this, so we attempt to swap the two if possible. - * - * @return True on success, false otherwise. - */ - private boolean legacyToolSwap() { - ItemStack controllerSlot = getControllerSlot(); - if (controllerSlot == null || !(controllerSlot.getItem() instanceof GT_MetaGenerated_Tool_01)) return false; - - for (GT_MetaTileEntity_Hatch_InputBus inputBus : filterValidMTEs(mInputBusses)) { - ItemStack[] inventory = inputBus.getRealInventory(); - for (int slot = 0; slot < inventory.length; ++slot) { - if (isValidSapling(inventory[slot])) { - // Do the swap. - mInventory[1] = inventory[slot]; - inventory[slot] = controllerSlot; - inputBus.updateSlots(); - return true; - } - } - } - return false; - } - - /** - * Check if an ItemStack is a sapling that can be farmed. - * - * @param stack An ItemStack. - * @return True if stack is a valid sapling that can be farmed. - */ - private boolean isValidSapling(ItemStack stack) { - if (stack == null) return false; - String registryName = Item.itemRegistry.getNameForObject(stack.getItem()); - return treeProductsMap.containsKey(registryName + ":" + stack.getItemDamage()) - || "Forestry:sapling".equals(registryName); - } - - /** - * Get a list of possible outputs for a sapling, for each mode. This is either recovered from - * {@link #treeProductsMap}, or generated from stats of Forestry saplings. - * - * @param sapling A sapling to farm. - * @return A map of outputs for each mode. Outputs for some modes might be null. - */ - private static EnumMap<Mode, ItemStack> getOutputsForSapling(ItemStack sapling) { - String registryName = Item.itemRegistry.getNameForObject(sapling.getItem()); - if ("Forestry:sapling".equals(registryName)) { - return getOutputsForForestrySapling(sapling); - } else { - return treeProductsMap.get(registryName + ":" + sapling.getItemDamage()); - } - } - - /** - * Calculate outputs for Forestry saplings. Default amounts stored in {@link #treeProductsMap} are adjusted based - * the genetics of the input sapling. - * <p> - * Relevant stats: - * <ul> - * <li>height, girth: Affects log output.</li> - * <li>fertility (called Saplings in game): Affects sapling output.</li> - * <li>yield: Affects fruit output.</li> - * </ul> - * See {@link forestry.core.genetics.alleles.EnumAllele} for detailed numeric values for each allele. - * - * @param sapling A sapling to farm. Must be a Forestry sapling with a valid genome. - * @return A map of outputs for each mode. Outputs for some modes might be null. - */ - private static EnumMap<Mode, ItemStack> getOutputsForForestrySapling(ItemStack sapling) { - ITree tree = TreeManager.treeRoot.getMember(sapling); - if (tree == null) return null; - - String speciesUUID = tree.getIdent(); - - EnumMap<Mode, ItemStack> defaultMap = treeProductsMap.get("Forestry:sapling:" + speciesUUID); - if (defaultMap == null) return null; - - // We need to make a new map so that we don't modify the stored amounts of outputs. - EnumMap<Mode, ItemStack> adjustedMap = new EnumMap<>(Mode.class); - - ItemStack log = defaultMap.get(Mode.LOG); - if (log != null) { - double height = Math.max( - 3 * (tree.getGenome() - .getHeight() - 1), - 0) + 1; - double girth = tree.getGenome() - .getGirth(); - - log = log.copy(); - log.stackSize = (int) (log.stackSize * height * girth); - adjustedMap.put(Mode.LOG, log); - } - - ItemStack saplingOut = defaultMap.get(Mode.SAPLING); - if (saplingOut != null) { - // Lowest = 0.01 ... Average = 0.05 ... Highest = 0.3 - double fertility = tree.getGenome() - .getFertility() * 10; - - // Return a copy of the *input* sapling, retaining its genetics. - int stackSize = Math.max(1, (int) (saplingOut.stackSize * fertility)); - saplingOut = sapling.copy(); - saplingOut.stackSize = stackSize; - adjustedMap.put(Mode.SAPLING, saplingOut); - } - - ItemStack leaves = defaultMap.get(Mode.LEAVES); - if (leaves != null) { - adjustedMap.put(Mode.LEAVES, leaves.copy()); - } - - ItemStack fruit = defaultMap.get(Mode.FRUIT); - if (fruit != null) { - // Lowest = 0.025 ... Average = 0.2 ... Highest = 0.4 - double yield = tree.getGenome() - .getYield() * 10; - - fruit = fruit.copy(); - fruit.stackSize = (int) (fruit.stackSize * yield); - adjustedMap.put(Mode.FRUIT, fruit); - } - - return adjustedMap; - } - - /* Recipe registration. */ - - /** - * Registers outputs for a sapling. This method assumes that output in mode SAPLING is the same as the input - * sapling. Output amount is further modified by mode, machine tier, and tool used. Recipes are added in - * {@link gtPlusPlus.xmod.gregtech.loaders.recipe.RecipeLoader_TreeFarm}. - * - * @param sapling The input sapling to farm, and also the output in mode SAPLING. - * @param log ItemStack to output in mode LOG. - * @param leaves ItemStack to output in mode LEAVES. - * @param fruit ItemStack to output in mode FRUIT. - */ - public static void registerTreeProducts(ItemStack sapling, ItemStack log, ItemStack leaves, ItemStack fruit) { - registerTreeProducts(sapling, log, sapling, leaves, fruit); - } - - /** - * Registers outputs for a sapling. Output amount is further modified by mode, machine tier, and tool used. Recipes - * are added in {@link gtPlusPlus.xmod.gregtech.loaders.recipe.RecipeLoader_TreeFarm}. - * - * @param saplingIn The input sapling to farm. - * @param log ItemStack to output in mode LOG. - * @param saplingOut ItemStack to output in mode SAPLING. - * @param leaves ItemStack to output in mode LEAVES. - * @param fruit ItemStack to output in mode FRUIT. - */ - public static void registerTreeProducts(ItemStack saplingIn, ItemStack log, ItemStack saplingOut, ItemStack leaves, - ItemStack fruit) { - String key = Item.itemRegistry.getNameForObject(saplingIn.getItem()) + ":" + saplingIn.getItemDamage(); - EnumMap<Mode, ItemStack> map = new EnumMap<>(Mode.class); - if (log != null) map.put(Mode.LOG, log); - if (saplingOut != null) map.put(Mode.SAPLING, saplingOut); - if (leaves != null) map.put(Mode.LEAVES, leaves); - if (fruit != null) map.put(Mode.FRUIT, fruit); - treeProductsMap.put(key, map); - - if (!addFakeRecipeToNEI(saplingIn, log, saplingOut, leaves, fruit)) { - Logger.INFO("Registering NEI fake recipe for " + key + " failed!"); - } - } - - /** - * For Forestry trees, the output amounts depend on the genetics of the sapling. Here we register only the types of - * items to output. In {@link #getOutputsForForestrySapling(ItemStack)} these outputs are then multiplied according - * to the stats of the real sapling that is in the controller slot. - */ - public static void registerForestryTree(String speciesUID, ItemStack sapling, ItemStack log, ItemStack leaves, - ItemStack fruit) { - String key = "Forestry:sapling:" + speciesUID; - EnumMap<Mode, ItemStack> map = new EnumMap<>(Mode.class); - map.put(Mode.LOG, log); - map.put(Mode.SAPLING, sapling); - map.put(Mode.LEAVES, leaves); - map.put(Mode.FRUIT, fruit); - treeProductsMap.put(key, map); - - // In the NEI recipe we want to display outputs adjusted for the default genetics of this tree type. - // To do this we use the same method as when calculating real outputs. - map = getOutputsForForestrySapling(sapling); - if (map == null) { - Logger.INFO("Could not create Forestry tree output map for " + speciesUID); - return; - } - addFakeRecipeToNEI( - sapling, - map.get(Mode.LOG), - map.get(Mode.SAPLING), - map.get(Mode.LEAVES), - map.get(Mode.FRUIT)); - } - - /** - * This array is used to get the rotating display of items in NEI showing all possible tools for a given mode. - */ - private static final ItemStack[][] altToolsForNEI; - static { - GT_MetaGenerated_Tool toolInstance = GT_MetaGenerated_Tool_01.INSTANCE; - altToolsForNEI = new ItemStack[][] { - // Mode.LOG - { toolInstance.getToolWithStats(GT_MetaGenerated_Tool_01.SAW, 1, null, null, null), - toolInstance.getToolWithStats(GT_MetaGenerated_Tool_01.POCKET_SAW, 1, null, null, null), - toolInstance.getToolWithStats(GT_MetaGenerated_Tool_01.BUZZSAW_LV, 1, null, null, null), - toolInstance.getToolWithStats(GT_MetaGenerated_Tool_01.CHAINSAW_LV, 1, null, null, null), - toolInstance.getToolWithStats(GT_MetaGenerated_Tool_01.BUZZSAW_MV, 1, null, null, null), - toolInstance.getToolWithStats(GT_MetaGenerated_Tool_01.CHAINSAW_MV, 1, null, null, null), - toolInstance.getToolWithStats(GT_MetaGenerated_Tool_01.BUZZSAW_HV, 1, null, null, null), - toolInstance.getToolWithStats(GT_MetaGenerated_Tool_01.CHAINSAW_HV, 1, null, null, null), }, - // Mode.SAPLING - { toolInstance.getToolWithStats(GT_MetaGenerated_Tool_01.BRANCHCUTTER, 1, null, null, null), - toolInstance.getToolWithStats(GT_MetaGenerated_Tool_01.POCKET_BRANCHCUTTER, 1, null, null, null), - GT_ModHandler.getModItem(Mods.Forestry.ID, "grafter", 1, 0), }, - // Mode.LEAVES - { new ItemStack(Items.shears), - toolInstance.getToolWithStats(GT_MetaGenerated_Tool_01.WIRECUTTER, 1, null, null, null), - toolInstance.getToolWithStats(GT_MetaGenerated_Tool_01.POCKET_WIRECUTTER, 1, null, null, null), - MetaGeneratedGregtechTools.getInstance() - .getToolWithStats(MetaGeneratedGregtechTools.ELECTRIC_SNIPS, 1, null, null, null), }, - // Mode.FRUIT - { toolInstance.getToolWithStats(GT_MetaGenerated_Tool_01.KNIFE, 1, null, null, null), - toolInstance.getToolWithStats(GT_MetaGenerated_Tool_01.POCKET_KNIFE, 1, null, null, null), } }; - } - - /** - * Add a recipe for this tree to NEI. These recipes are only used in NEI, they are never used for processing logic. - * - * @return True if the recipe was added successfully. - */ - public static boolean addFakeRecipeToNEI(ItemStack saplingIn, ItemStack log, ItemStack saplingOut, ItemStack leaves, - ItemStack fruit) { - int recipeCount = GTPPRecipeMaps.treeGrowthSimulatorFakeRecipes.getAllRecipes() - .size(); - - // Sapling goes into the "special" slot. - ItemStack specialStack = saplingIn.copy(); - specialStack.stackSize = 0; - - /* - * Calculate the correct amount of outputs for each mode. The amount displayed in NEI should take into account - * the mode multiplier, but not tool/tier multipliers as those can change dynamically. If the sapling has an - * output in this mode, also add the tools usable for this mode as inputs. - */ - ItemStack[][] inputStacks = new ItemStack[Mode.values().length][]; - ItemStack[] outputStacks = new ItemStack[Mode.values().length]; - - for (Mode mode : Mode.values()) { - ItemStack output = switch (mode) { - case LOG -> log; - case SAPLING -> saplingOut; - case LEAVES -> leaves; - case FRUIT -> fruit; - }; - if (output != null) { - int ordinal = mode.ordinal(); - inputStacks[ordinal] = altToolsForNEI[ordinal]; - outputStacks[ordinal] = output.copy(); - outputStacks[ordinal].stackSize *= modeMultiplier.get(mode); - } - } - - Logger.INFO( - "Adding Tree Growth Simulation NEI recipe for " + specialStack.getDisplayName() - + " -> " - + ItemUtils.getArrayStackNames(outputStacks)); - - GTPPRecipeMaps.treeGrowthSimulatorFakeRecipes.addFakeRecipe( - false, - new GT_Recipe.GT_Recipe_WithAlt( - false, - null, // All inputs are taken from aAtl argument. - outputStacks, - specialStack, - null, - null, - null, - TICKS_PER_OPERATION, - 0, - recipeCount, // special value, also sorts recipes correctly in order of addition. - inputStacks)); - - return GTPPRecipeMaps.treeGrowthSimulatorFakeRecipes.getAllRecipes() - .size() > recipeCount; - } -} diff --git a/gtpp/src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/production/GregtechMetaTileEntity_AlloyBlastSmelter.java b/gtpp/src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/production/GregtechMetaTileEntity_AlloyBlastSmelter.java deleted file mode 100644 index 580efdcdab..0000000000 --- a/gtpp/src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/production/GregtechMetaTileEntity_AlloyBlastSmelter.java +++ /dev/null @@ -1,235 +0,0 @@ -package gtPlusPlus.xmod.gregtech.common.tileentities.machines.multi.production; - -import static com.gtnewhorizon.structurelib.structure.StructureUtility.ofBlock; -import static com.gtnewhorizon.structurelib.structure.StructureUtility.onElementPass; -import static com.gtnewhorizon.structurelib.structure.StructureUtility.transpose; -import static gregtech.api.enums.GT_HatchElement.Energy; -import static gregtech.api.enums.GT_HatchElement.InputBus; -import static gregtech.api.enums.GT_HatchElement.InputHatch; -import static gregtech.api.enums.GT_HatchElement.Maintenance; -import static gregtech.api.enums.GT_HatchElement.Muffler; -import static gregtech.api.enums.GT_HatchElement.OutputBus; -import static gregtech.api.enums.GT_HatchElement.OutputHatch; -import static gregtech.api.util.GT_StructureUtility.buildHatchAdder; - -import net.minecraft.entity.player.EntityPlayer; -import net.minecraft.item.Item; -import net.minecraft.item.ItemStack; -import net.minecraft.nbt.NBTTagCompound; -import net.minecraft.util.StatCollector; -import net.minecraftforge.common.util.ForgeDirection; - -import com.gtnewhorizon.structurelib.alignment.constructable.ISurvivalConstructable; -import com.gtnewhorizon.structurelib.structure.IStructureDefinition; -import com.gtnewhorizon.structurelib.structure.ISurvivalBuildEnvironment; -import com.gtnewhorizon.structurelib.structure.StructureDefinition; - -import gregtech.api.enums.SoundResource; -import gregtech.api.enums.TAE; -import gregtech.api.interfaces.IIconContainer; -import gregtech.api.interfaces.metatileentity.IMetaTileEntity; -import gregtech.api.interfaces.tileentity.IGregTechTileEntity; -import gregtech.api.logic.ProcessingLogic; -import gregtech.api.recipe.RecipeMap; -import gregtech.api.util.GT_Multiblock_Tooltip_Builder; -import gregtech.api.util.GT_Utility; -import gtPlusPlus.api.objects.Logger; -import gtPlusPlus.api.recipe.GTPPRecipeMaps; -import gtPlusPlus.core.block.ModBlocks; -import gtPlusPlus.core.lib.CORE; -import gtPlusPlus.core.recipe.common.CI; -import gtPlusPlus.xmod.gregtech.api.metatileentity.implementations.base.GregtechMeta_MultiBlockBase; -import gtPlusPlus.xmod.gregtech.common.blocks.textures.TexturesGtBlock; - -public class GregtechMetaTileEntity_AlloyBlastSmelter - extends GregtechMeta_MultiBlockBase<GregtechMetaTileEntity_AlloyBlastSmelter> implements ISurvivalConstructable { - - private int mMode = 0; - private boolean isUsingControllerCircuit = false; - private static Item circuit; - private int mCasing; - private static IStructureDefinition<GregtechMetaTileEntity_AlloyBlastSmelter> STRUCTURE_DEFINITION = null; - - public GregtechMetaTileEntity_AlloyBlastSmelter(final int aID, final String aName, final String aNameRegional) { - super(aID, aName, aNameRegional); - } - - public GregtechMetaTileEntity_AlloyBlastSmelter(final String aName) { - super(aName); - } - - @Override - public IMetaTileEntity newMetaEntity(final IGregTechTileEntity aTileEntity) { - return new GregtechMetaTileEntity_AlloyBlastSmelter(this.mName); - } - - @Override - public String getMachineType() { - return "Fluid Alloy Cooker"; - } - - @Override - public void loadNBTData(final NBTTagCompound aNBT) { - super.loadNBTData(aNBT); - if (aNBT.hasKey("isBussesSeparate")) { - inputSeparation = aNBT.getBoolean("isBussesSeparate"); - } - } - - @Override - protected GT_Multiblock_Tooltip_Builder createTooltip() { - GT_Multiblock_Tooltip_Builder tt = new GT_Multiblock_Tooltip_Builder(); - tt.addMachineType(getMachineType()) - .addInfo("Controller Block for the Alloy Blast Smelter") - .addInfo("20% Faster than the Electric Blast Furnace") - .addInfo("Allows Complex GT++ alloys to be created") - .addInfo("Accepts only one Energy Hatch") - .addInfo("Circuit for recipe goes in the Input Bus or GUI slot") - .addPollutionAmount(getPollutionPerSecond(null)) - .addSeparator() - .beginStructureBlock(3, 4, 3, true) - .addController("Bottom Center") - .addCasingInfoMin("Blast Smelter Casings", 5, false) - .addCasingInfoMin("Blast Smelter Heat Containment Coils", 16, false) - .addInputBus("Any Casing", 1) - .addInputHatch("Any Casing", 1) - .addOutputHatch("Any Casing", 1) - .addEnergyHatch("Any Casing", 1) - .addMaintenanceHatch("Any Casing", 1) - .addMufflerHatch("Any Casing", 1) - .toolTipFinisher(CORE.GT_Tooltip_Builder.get()); - return tt; - } - - @Override - public IStructureDefinition<GregtechMetaTileEntity_AlloyBlastSmelter> getStructureDefinition() { - if (STRUCTURE_DEFINITION == null) { - STRUCTURE_DEFINITION = StructureDefinition.<GregtechMetaTileEntity_AlloyBlastSmelter>builder() - .addShape( - mName, - transpose( - new String[][] { { "CCC", "CCC", "CCC" }, { "HHH", "H-H", "HHH" }, { "HHH", "H-H", "HHH" }, - { "C~C", "CCC", "CCC" }, })) - .addElement( - 'C', - buildHatchAdder(GregtechMetaTileEntity_AlloyBlastSmelter.class) - .atLeast(InputBus, InputHatch, OutputBus, OutputHatch, Maintenance, Energy, Muffler) - .casingIndex(TAE.GTPP_INDEX(15)) - .dot(1) - .buildAndChain(onElementPass(x -> ++x.mCasing, ofBlock(ModBlocks.blockCasingsMisc, 15)))) - .addElement('H', ofBlock(ModBlocks.blockCasingsMisc, 14)) - .build(); - } - return STRUCTURE_DEFINITION; - } - - @Override - public void construct(ItemStack stackSize, boolean hintsOnly) { - buildPiece(mName, stackSize, hintsOnly, 1, 3, 0); - } - - @Override - public int survivalConstruct(ItemStack stackSize, int elementBudget, ISurvivalBuildEnvironment env) { - if (mMachine) return -1; - return survivialBuildPiece(mName, stackSize, 1, 3, 0, elementBudget, env, false, true); - } - - @Override - public boolean checkMachine(IGregTechTileEntity aBaseMetaTileEntity, ItemStack aStack) { - mCasing = 0; - return checkPiece(mName, 1, 3, 0) && mCasing >= 5 && mEnergyHatches.size() == 1 && checkHatch(); - } - - @Override - protected SoundResource getProcessStartSound() { - return SoundResource.IC2_MACHINES_INDUCTION_LOOP; - } - - @Override - protected IIconContainer getActiveOverlay() { - return TexturesGtBlock.Overlay_Machine_Controller_Advanced_Active; - } - - @Override - protected IIconContainer getInactiveOverlay() { - return TexturesGtBlock.Overlay_Machine_Controller_Advanced; - } - - @Override - protected int getCasingTextureId() { - return TAE.GTPP_INDEX(15); - } - - @Override - public RecipeMap<?> getRecipeMap() { - return GTPPRecipeMaps.alloyBlastSmelterRecipes; - } - - @Override - public boolean isCorrectMachinePart(final ItemStack aStack) { - if (this.getBaseMetaTileEntity() - .isServerSide()) { - // Get Controller Circuit - if (circuit == null) { - circuit = CI.getNumberedCircuit(0) - .getItem(); - } - if (aStack != null && aStack.getItem() == circuit) { - this.mMode = aStack.getItemDamage(); - return this.isUsingControllerCircuit = true; - } else { - if (aStack == null) { - this.isUsingControllerCircuit = false; - return true; // Allowed empty - } - Logger.WARNING("Not circuit in GUI inputs."); - return this.isUsingControllerCircuit = false; - } - } - Logger.WARNING("No Circuit, clientside."); - return this.isUsingControllerCircuit = false; - } - - @Override - protected ProcessingLogic createProcessingLogic() { - return new ProcessingLogic(); - } - - @Override - public void onModeChangeByScrewdriver(ForgeDirection side, EntityPlayer aPlayer, float aX, float aY, float aZ) { - inputSeparation = !inputSeparation; - GT_Utility.sendChatToPlayer( - aPlayer, - StatCollector.translateToLocal("GT5U.machines.separatebus") + " " + inputSeparation); - } - - @Override - public int getMaxParallelRecipes() { - return 1; - } - - @Override - public int getMaxEfficiency(final ItemStack aStack) { - return 10000; - } - - @Override - public int getPollutionPerSecond(final ItemStack aStack) { - return CORE.ConfigSwitches.pollutionPerSecondMultiABS; - } - - @Override - public int getDamageToComponent(final ItemStack aStack) { - return 0; - } - - @Override - public boolean explodesOnComponentBreak(final ItemStack aStack) { - return false; - } - - @Override - public boolean supportsInputSeparation() { - return true; - } -} diff --git a/gtpp/src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/production/GregtechMetaTileEntity_Cyclotron.java b/gtpp/src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/production/GregtechMetaTileEntity_Cyclotron.java deleted file mode 100644 index 5861885bd0..0000000000 --- a/gtpp/src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/production/GregtechMetaTileEntity_Cyclotron.java +++ /dev/null @@ -1,331 +0,0 @@ -package gtPlusPlus.xmod.gregtech.common.tileentities.machines.multi.production; - -import static com.gtnewhorizon.structurelib.structure.StructureUtility.ofBlock; -import static com.gtnewhorizon.structurelib.structure.StructureUtility.onElementPass; -import static com.gtnewhorizon.structurelib.structure.StructureUtility.transpose; -import static gregtech.api.enums.GT_HatchElement.Energy; -import static gregtech.api.enums.GT_HatchElement.InputBus; -import static gregtech.api.enums.GT_HatchElement.InputHatch; -import static gregtech.api.enums.GT_HatchElement.Maintenance; -import static gregtech.api.enums.GT_HatchElement.Muffler; -import static gregtech.api.enums.GT_HatchElement.OutputBus; -import static gregtech.api.enums.GT_HatchElement.OutputHatch; -import static gregtech.api.util.GT_StructureUtility.buildHatchAdder; - -import net.minecraft.block.Block; -import net.minecraft.item.ItemStack; -import net.minecraft.nbt.NBTTagCompound; -import net.minecraftforge.common.util.ForgeDirection; - -import org.jetbrains.annotations.NotNull; - -import com.gtnewhorizon.structurelib.alignment.constructable.ISurvivalConstructable; -import com.gtnewhorizon.structurelib.structure.IStructureDefinition; -import com.gtnewhorizon.structurelib.structure.ISurvivalBuildEnvironment; -import com.gtnewhorizon.structurelib.structure.StructureDefinition; - -import gregtech.api.enums.SoundResource; -import gregtech.api.interfaces.IIconContainer; -import gregtech.api.interfaces.tileentity.IGregTechTileEntity; -import gregtech.api.logic.ProcessingLogic; -import gregtech.api.metatileentity.MetaTileEntity; -import gregtech.api.metatileentity.implementations.GT_MetaTileEntity_Hatch_OutputBus; -import gregtech.api.objects.GT_ItemStack; -import gregtech.api.recipe.RecipeMap; -import gregtech.api.recipe.check.CheckRecipeResult; -import gregtech.api.util.GT_Multiblock_Tooltip_Builder; -import gtPlusPlus.api.recipe.GTPPRecipeMaps; -import gtPlusPlus.core.block.ModBlocks; -import gtPlusPlus.core.item.chemistry.IonParticles; -import gtPlusPlus.core.lib.CORE; -import gtPlusPlus.core.util.math.MathUtils; -import gtPlusPlus.xmod.gregtech.api.metatileentity.implementations.base.GregtechMeta_MultiBlockBase; -import gtPlusPlus.xmod.gregtech.common.blocks.textures.TexturesGtBlock; - -public class GregtechMetaTileEntity_Cyclotron extends GregtechMeta_MultiBlockBase<GregtechMetaTileEntity_Cyclotron> - implements ISurvivalConstructable { - - private int mCasing; - private static IStructureDefinition<GregtechMetaTileEntity_Cyclotron> STRUCTURE_DEFINITION = null; - - public GregtechMetaTileEntity_Cyclotron(int aID, String aName, String aNameRegional, int tier) { - super(aID, aName, aNameRegional); - } - - public GregtechMetaTileEntity_Cyclotron(String aName) { - super(aName); - } - - @Override - public String getMachineType() { - return "Particle Accelerator"; - } - - public int tier() { - return 5; - } - - @Override - public long maxEUStore() { - return 1800000000L; - } - - @Override - public MetaTileEntity newMetaEntity(final IGregTechTileEntity aTileEntity) { - return new GregtechMetaTileEntity_Cyclotron(this.mName); - } - - @Override - public boolean allowCoverOnSide(ForgeDirection side, GT_ItemStack aStack) { - return side != getBaseMetaTileEntity().getFrontFacing(); - } - - @Override - public void saveNBTData(NBTTagCompound aNBT) { - super.saveNBTData(aNBT); - } - - @Override - public void loadNBTData(NBTTagCompound aNBT) { - super.loadNBTData(aNBT); - } - - @Override - public IStructureDefinition<GregtechMetaTileEntity_Cyclotron> getStructureDefinition() { - if (STRUCTURE_DEFINITION == null) { - STRUCTURE_DEFINITION = StructureDefinition.<GregtechMetaTileEntity_Cyclotron>builder() - .addShape( - mName, - transpose( - new String[][] { - { " ", " hhh ", " hh hh ", " h h ", - " h h ", " h h ", " h h ", " h h ", - " h h ", " h h ", " h h ", " h h ", - " hh hh ", " hhh ", " ", }, - { " hhh ", " hhccchh ", " hcchhhcch ", " hchh hhch ", - " hch hch ", " hch hch ", "hch hch", "hch hch", - "hch hch", " hch hch ", " hch hch ", " hchh hhch ", - " hcch~hcch ", " hhccchh ", " hhh ", }, - { " ", " hhh ", " hh hh ", " h h ", - " h h ", " h h ", " h h ", " h h ", - " h h ", " h h ", " h h ", " h h ", - " hh hh ", " hhh ", " ", } })) - .addElement( - 'h', - buildHatchAdder(GregtechMetaTileEntity_Cyclotron.class) - .atLeast(InputBus, OutputBus, Maintenance, Energy, Muffler, InputHatch, OutputHatch) - .casingIndex(44) - .dot(1) - .buildAndChain(onElementPass(x -> ++x.mCasing, ofBlock(getCasingBlock(), getCasingMeta())))) - .addElement('c', ofBlock(getCyclotronCoil(), getCyclotronCoilMeta())) - .build(); - } - return STRUCTURE_DEFINITION; - } - - @Override - public void construct(ItemStack stackSize, boolean hintsOnly) { - buildPiece(mName, stackSize, hintsOnly, 7, 1, 12); - } - - @Override - public int survivalConstruct(ItemStack stackSize, int elementBudget, ISurvivalBuildEnvironment env) { - if (mMachine) return -1; - return survivialBuildPiece(mName, stackSize, 7, 1, 12, elementBudget, env, false, true); - } - - @Override - protected SoundResource getProcessStartSound() { - return SoundResource.GT_MACHINES_FUSION_LOOP; - } - - @Override - public boolean checkMachine(IGregTechTileEntity aBaseMetaTileEntity, ItemStack aStack) { - mCasing = 0; - return checkPiece(mName, 7, 1, 12) && mCasing >= 40 && checkHatch(); - } - - public Block getCasingBlock() { - return ModBlocks.blockCasings2Misc; - } - - public int getCasingMeta() { - return 10; - } - - public Block getCyclotronCoil() { - return ModBlocks.blockCasings2Misc; - } - - public int getCyclotronCoilMeta() { - return 9; - } - - @Override - protected GT_Multiblock_Tooltip_Builder createTooltip() { - GT_Multiblock_Tooltip_Builder tt = new GT_Multiblock_Tooltip_Builder(); - tt.addMachineType(getMachineType()) - .addInfo("Super Magnetic Speed Shooter") - .addSeparator() - .addInfo("Particles are accelerated over 186 revolutions to 80% light speed") - .addInfo("Can produce a continuous beam current of 2.2 mA at 590 MeV") - .addInfo("Which will be extracted from the Isochronous Cyclotron") - .addSeparator() - .addInfo("Consists of the same layout as a Fusion Reactor") - .addInfo("Any external casing can be a hatch/bus, unlike Fusion") - .addInfo("Cyclotron Machine Casings around Cyclotron Coil Blocks") - .addInfo("All Hatches must be IV or better") - .addPollutionAmount(getPollutionPerSecond(null)) - .addSeparator() - .addCasingInfoMin("Cyclotron Machine Casings", 40, false) - .addCasingInfoMin("Cyclotron Coil", 32, false) - .addInputBus("Any Casing", 1) - .addOutputBus("Any Casing", 1) - .addInputHatch("Any Casing", 1) - .addOutputHatch("Any Casing", 1) - .addEnergyHatch("Any Casing", 1) - .addMaintenanceHatch("Any Casing", 1) - .addMufflerHatch("Any Casing", 1) - .toolTipFinisher(CORE.GT_Tooltip_Builder.get()); - return tt; - } - - @Override - protected IIconContainer getActiveOverlay() { - return getIconOverlay(); - } - - @Override - protected IIconContainer getInactiveOverlay() { - return getIconOverlay(); - } - - @Override - protected int getCasingTextureId() { - return 44; - } - - public IIconContainer getIconOverlay() { - if (this.getBaseMetaTileEntity() - .isActive()) { - return TexturesGtBlock.Overlay_MatterFab_Active_Animated; - } - return TexturesGtBlock.Overlay_MatterFab_Animated; - } - - @Override - public boolean isCorrectMachinePart(ItemStack aStack) { - return true; - } - - @Override - public RecipeMap<?> getRecipeMap() { - return GTPPRecipeMaps.cyclotronRecipes; - } - - @Override - protected ProcessingLogic createProcessingLogic() { - return new ProcessingLogic() { - - @NotNull - @Override - public CheckRecipeResult process() { - fixAllMaintenanceIssue(); - CheckRecipeResult result = super.process(); - if (result.wasSuccessful()) { - for (ItemStack s : outputItems) { - if (s != null) { - if (s.getItem() instanceof IonParticles) { - long aCharge = IonParticles.getChargeState(s); - if (aCharge == 0) { - IonParticles.setChargeState( - s, - MathUtils.getRandomFromArray( - new int[] { -5, -5, -4, -4, -4, -3, -3, -3, -3, -3, -2, -2, -2, -2, -2, -2, - -2, -1, -1, -1, -1, -1, -1, -1, -1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, - 1, 1, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 3, 3, 3, 3, 3, 3, 3, 4, 4, 4, 4, - 5, 5, 5, 6, 6 })); - } - } - } - } - } - return result; - } - }; - } - - @Override - public int getMaxParallelRecipes() { - return 1; - } - - @Override - public boolean onRunningTick(ItemStack aStack) { - if (this.mOutputBusses.size() > 0) { - for (GT_MetaTileEntity_Hatch_OutputBus g : this.mOutputBusses) { - if (g != null) { - for (ItemStack s : g.mInventory) { - if (s != null) { - if (s.getItem() instanceof IonParticles) { - long aCharge = IonParticles.getChargeState(s); - if (aCharge == 0) { - IonParticles.setChargeState( - s, - MathUtils.getRandomFromArray( - new int[] { -5, -5, -4, -4, -4, -3, -3, -3, -3, -3, -2, -2, -2, -2, -2, -2, - -2, -1, -1, -1, -1, -1, -1, -1, -1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, - 1, 1, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 3, 3, 3, 3, 3, 3, 3, 4, 4, 4, 4, - 5, 5, 5, 6, 6 })); - } - } - } - } - } - } - } - this.fixAllMaintenanceIssue(); - return super.onRunningTick(aStack); - } - - @Override - public int getMaxEfficiency(ItemStack aStack) { - return 10000; - } - - @Override - public int getPollutionPerSecond(ItemStack aStack) { - return CORE.ConfigSwitches.pollutionPerSecondMultiCyclotron; - } - - @Override - public int getDamageToComponent(ItemStack aStack) { - return 0; - } - - @Override - public boolean explodesOnComponentBreak(ItemStack aStack) { - return false; - } - - @Override - public String[] getExtraInfoData() { - String tier = tier() == 5 ? "I" : "II"; - float plasmaOut = 0; - int powerRequired = 0; - if (this.mLastRecipe != null) { - powerRequired = this.mLastRecipe.mEUt; - if (this.mLastRecipe.getFluidOutput(0) != null) { - plasmaOut = (float) this.mLastRecipe.getFluidOutput(0).amount / (float) this.mLastRecipe.mDuration; - } - } - - return new String[] { "COMET - Compact Cyclotron MK " + tier, "EU Required: " + powerRequired + "EU/t", - "Stored EU: " + this.getEUVar() + " / " + maxEUStore() }; - } - - @Override - public boolean doesBindPlayerInventory() { - return false; - } -} diff --git a/gtpp/src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/production/GregtechMetaTileEntity_IndustrialFishingPond.java b/gtpp/src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/production/GregtechMetaTileEntity_IndustrialFishingPond.java deleted file mode 100644 index 78e4a17274..0000000000 --- a/gtpp/src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/production/GregtechMetaTileEntity_IndustrialFishingPond.java +++ /dev/null @@ -1,489 +0,0 @@ -package gtPlusPlus.xmod.gregtech.common.tileentities.machines.multi.production; - -import static com.gtnewhorizon.structurelib.structure.StructureUtility.ofBlock; -import static com.gtnewhorizon.structurelib.structure.StructureUtility.onElementPass; -import static com.gtnewhorizon.structurelib.structure.StructureUtility.transpose; -import static gregtech.api.enums.GT_HatchElement.Energy; -import static gregtech.api.enums.GT_HatchElement.InputBus; -import static gregtech.api.enums.GT_HatchElement.InputHatch; -import static gregtech.api.enums.GT_HatchElement.Maintenance; -import static gregtech.api.enums.GT_HatchElement.Muffler; -import static gregtech.api.enums.GT_HatchElement.OutputBus; -import static gregtech.api.util.GT_StructureUtility.buildHatchAdder; -import static gtPlusPlus.core.util.data.ArrayUtils.removeNulls; - -import java.util.HashMap; -import java.util.Map; - -import net.minecraft.block.Block; -import net.minecraft.init.Blocks; -import net.minecraft.item.Item; -import net.minecraft.item.ItemStack; -import net.minecraft.util.WeightedRandomFishable; -import net.minecraftforge.fluids.FluidStack; - -import org.jetbrains.annotations.NotNull; - -import com.gtnewhorizon.structurelib.alignment.IAlignmentLimits; -import com.gtnewhorizon.structurelib.alignment.constructable.ISurvivalConstructable; -import com.gtnewhorizon.structurelib.structure.IStructureDefinition; -import com.gtnewhorizon.structurelib.structure.ISurvivalBuildEnvironment; -import com.gtnewhorizon.structurelib.structure.StructureDefinition; - -import gregtech.api.enums.TAE; -import gregtech.api.enums.Textures; -import gregtech.api.interfaces.IIconContainer; -import gregtech.api.interfaces.metatileentity.IMetaTileEntity; -import gregtech.api.interfaces.tileentity.IGregTechTileEntity; -import gregtech.api.recipe.RecipeMap; -import gregtech.api.recipe.check.CheckRecipeResult; -import gregtech.api.recipe.check.CheckRecipeResultRegistry; -import gregtech.api.recipe.check.SimpleCheckRecipeResult; -import gregtech.api.util.FishPondFakeRecipe; -import gregtech.api.util.GT_Multiblock_Tooltip_Builder; -import gregtech.api.util.GT_OverclockCalculator; -import gregtech.api.util.GT_ParallelHelper; -import gregtech.api.util.GT_Recipe; -import gregtech.api.util.GT_Utility; -import gtPlusPlus.api.objects.data.AutoMap; -import gtPlusPlus.api.recipe.GTPPRecipeMaps; -import gtPlusPlus.core.block.ModBlocks; -import gtPlusPlus.core.lib.CORE; -import gtPlusPlus.core.recipe.common.CI; -import gtPlusPlus.core.util.math.MathUtils; -import gtPlusPlus.core.util.minecraft.FluidUtils; -import gtPlusPlus.core.util.minecraft.ItemUtils; -import gtPlusPlus.core.util.reflect.ReflectionUtils; -import gtPlusPlus.xmod.gregtech.api.metatileentity.implementations.base.GregtechMeta_MultiBlockBase; -import ic2.core.init.BlocksItems; -import ic2.core.init.InternalName; - -public class GregtechMetaTileEntity_IndustrialFishingPond extends - GregtechMeta_MultiBlockBase<GregtechMetaTileEntity_IndustrialFishingPond> implements ISurvivalConstructable { - - private boolean isUsingControllerCircuit = false; - private static final Item circuit = CI.getNumberedCircuit(0) - .getItem(); - private int mCasing; - private static IStructureDefinition<GregtechMetaTileEntity_IndustrialFishingPond> STRUCTURE_DEFINITION = null; - private static final Class<?> cofhWater; - - static { - cofhWater = ReflectionUtils.getClass("cofh.asmhooks.block.BlockWater"); - } - - public GregtechMetaTileEntity_IndustrialFishingPond(final int aID, final String aName, final String aNameRegional) { - super(aID, aName, aNameRegional); - } - - public GregtechMetaTileEntity_IndustrialFishingPond(final String aName) { - super(aName); - } - - @Override - public IMetaTileEntity newMetaEntity(final IGregTechTileEntity aTileEntity) { - return new GregtechMetaTileEntity_IndustrialFishingPond(this.mName); - } - - @Override - public String getMachineType() { - return "Fish Trap"; - } - - @Override - protected GT_Multiblock_Tooltip_Builder createTooltip() { - GT_Multiblock_Tooltip_Builder tt = new GT_Multiblock_Tooltip_Builder(); - tt.addMachineType(getMachineType()) - .addInfo("Controller Block for the Fishing Pond") - .addInfo("Can process (Tier + 1) * 2 recipes") - .addInfo("Put a numbered circuit into the input bus.") - .addInfo("Circuit 14 for Fish") - .addInfo("Circuit 15 for Junk") - .addInfo("Circuit 16 for Treasure") - .addInfo("Need to be filled with water.") - .addInfo("Will automatically fill water from input hatch.") - .addPollutionAmount(getPollutionPerSecond(null)) - .addSeparator() - .beginStructureBlock(9, 3, 9, true) - .addController("Front Center") - .addCasingInfoMin("Aquatic Casings", 64, false) - .addInputBus("Any Casing", 1) - .addOutputBus("Any Casing", 1) - .addInputHatch("Any Casing", 1) - .addEnergyHatch("Any Casing", 1) - .addMaintenanceHatch("Any Casing", 1) - .addMufflerHatch("Any Casing", 1) - .toolTipFinisher(CORE.GT_Tooltip_Builder.get()); - return tt; - } - - @Override - protected IAlignmentLimits getInitialAlignmentLimits() { - return (d, r, f) -> d.offsetY == 0 && r.isNotRotated() && !f.isVerticallyFliped(); - } - - @Override - public IStructureDefinition<GregtechMetaTileEntity_IndustrialFishingPond> getStructureDefinition() { - if (STRUCTURE_DEFINITION == null) { - STRUCTURE_DEFINITION = StructureDefinition.<GregtechMetaTileEntity_IndustrialFishingPond>builder() - .addShape( - mName, - transpose( - new String[][] { - { "XXXXXXXXX", "X X", "X X", "X X", "X X", "X X", "X X", - "X X", "XXXXXXXXX" }, - { "XXXX~XXXX", "X X", "X X", "X X", "X X", "X X", "X X", - "X X", "XXXXXXXXX" }, - { "XXXXXXXXX", "XXXXXXXXX", "XXXXXXXXX", "XXXXXXXXX", "XXXXXXXXX", "XXXXXXXXX", "XXXXXXXXX", - "XXXXXXXXX", "XXXXXXXXX" }, })) - .addElement( - 'X', - buildHatchAdder(GregtechMetaTileEntity_IndustrialFishingPond.class) - .atLeast(InputBus, OutputBus, Maintenance, Energy, Muffler, InputHatch) - .casingIndex(getCasingTextureIndex()) - .dot(1) - .buildAndChain(onElementPass(x -> ++x.mCasing, ofBlock(getCasingBlock(), getCasingMeta())))) - .build(); - } - return STRUCTURE_DEFINITION; - } - - @Override - public void construct(ItemStack stackSize, boolean hintsOnly) { - buildPiece(mName, stackSize, hintsOnly, 4, 1, 0); - } - - @Override - public int survivalConstruct(ItemStack stackSize, int elementBudget, ISurvivalBuildEnvironment env) { - if (mMachine) return -1; - return survivialBuildPiece(mName, stackSize, 4, 1, 0, elementBudget, env, false, true); - } - - @Override - public boolean checkMachine(IGregTechTileEntity aBaseMetaTileEntity, ItemStack aStack) { - mCasing = 0; - return checkPiece(mName, 4, 1, 0) && mCasing >= 64 && checkHatch(); - } - - @Override - protected IIconContainer getActiveOverlay() { - return Textures.BlockIcons.OVERLAY_FRONT_VACUUM_FREEZER_ACTIVE; - } - - @Override - protected IIconContainer getInactiveOverlay() { - return Textures.BlockIcons.OVERLAY_FRONT_VACUUM_FREEZER; - } - - @Override - protected int getCasingTextureId() { - return getCasingTextureIndex(); - } - - @Override - public RecipeMap<?> getRecipeMap() { - return GTPPRecipeMaps.fishPondRecipes; - } - - @Override - protected boolean filtersFluid() { - return false; - } - - @Override - public @NotNull CheckRecipeResult checkProcessing() { - ItemStack controllerStack = getControllerSlot(); - if (controllerStack != null) { - if (controllerStack.getItem() == circuit) { - this.isUsingControllerCircuit = true; - this.mMode = controllerStack.getItemDamage(); - } else { - this.isUsingControllerCircuit = false; - } - } else { - this.isUsingControllerCircuit = false; - } - if (!hasGenerateRecipes) { - generateRecipes(); - } - if (!checkForWater()) { - return SimpleCheckRecipeResult.ofFailure("no_water"); - } - ItemStack[] tItemInputs = getStoredInputs().toArray(new ItemStack[0]); - FluidStack[] tFluidInputs = getStoredFluids().toArray(new FluidStack[0]); - - if (!isUsingControllerCircuit && tItemInputs.length == 0) { - return CheckRecipeResultRegistry.NO_RECIPE; - } - - long tEnergy = getMaxInputEnergy(); - - getCircuit(tItemInputs); - - ItemStack[] mFishOutput = generateLoot(this.mMode); - mFishOutput = removeNulls(mFishOutput); - GT_Recipe g = new GT_Recipe( - true, - new ItemStack[] {}, - mFishOutput, - null, - new int[] {}, - tFluidInputs, - null, - 200, - 16, - 0); - GT_OverclockCalculator calculator = new GT_OverclockCalculator().setRecipeEUt(g.mEUt) - .setEUt(tEnergy) - .setDuration(g.mDuration); - GT_ParallelHelper helper = new GT_ParallelHelper().setRecipe(g) - .setItemInputs(tItemInputs) - .setFluidInputs(tFluidInputs) - .setAvailableEUt(tEnergy) - .setMaxParallel(getMaxParallelRecipes()) - .setConsumption(true) - .setOutputCalculation(true) - .setMachine(this) - .enableBatchMode(batchMode ? 128 : 1) - .setCalculator(calculator); - - helper.build(); - - if (helper.getCurrentParallel() == 0) { - return CheckRecipeResultRegistry.ITEM_OUTPUT_FULL; - } - - this.mEfficiency = (10000 - (getIdealStatus() - getRepairStatus()) * 1000); - this.mEfficiencyIncrease = 10000; - - lEUt = -calculator.getConsumption(); - mMaxProgresstime = (int) Math.ceil(calculator.getDuration() * helper.getDurationMultiplierDouble()); - - mOutputItems = helper.getItemOutputs(); - mOutputFluids = null; - updateSlots(); - - return CheckRecipeResultRegistry.SUCCESSFUL; - } - - @Override - public int getMaxParallelRecipes() { - return (2 * (GT_Utility.getTier(this.getMaxInputVoltage()) + 1)); - } - - @Override - public int getMaxEfficiency(final ItemStack aStack) { - return 10000; - } - - @Override - public int getPollutionPerSecond(final ItemStack aStack) { - return CORE.ConfigSwitches.pollutionPerSecondMultiIndustrialFishingPond; - } - - @Override - public boolean explodesOnComponentBreak(final ItemStack aStack) { - return false; - } - - public Block getCasingBlock() { - return ModBlocks.blockCasings3Misc; - } - - public byte getCasingMeta() { - return 0; - } - - public int getCasingTextureIndex() { - return TAE.GTPP_INDEX(32); - } - - public boolean checkForWater() { - - // Get Facing direction - IGregTechTileEntity aBaseMetaTileEntity = this.getBaseMetaTileEntity(); - int mDirectionX = aBaseMetaTileEntity.getBackFacing().offsetX; - int mCurrentDirectionX; - int mCurrentDirectionZ; - int mOffsetX_Lower = 0; - int mOffsetX_Upper = 0; - int mOffsetZ_Lower = 0; - int mOffsetZ_Upper = 0; - - mCurrentDirectionX = 4; - mCurrentDirectionZ = 4; - - mOffsetX_Lower = -4; - mOffsetX_Upper = 4; - mOffsetZ_Lower = -4; - mOffsetZ_Upper = 4; - - // if (aBaseMetaTileEntity.fac) - - final int xDir = aBaseMetaTileEntity.getBackFacing().offsetX * mCurrentDirectionX; - final int zDir = aBaseMetaTileEntity.getBackFacing().offsetZ * mCurrentDirectionZ; - - int tAmount = 0; - for (int i = mOffsetX_Lower + 1; i <= mOffsetX_Upper - 1; ++i) { - for (int j = mOffsetZ_Lower + 1; j <= mOffsetZ_Upper - 1; ++j) { - for (int h = 0; h < 2; h++) { - Block tBlock = aBaseMetaTileEntity.getBlockOffset(xDir + i, h, zDir + j); - byte tMeta = aBaseMetaTileEntity.getMetaIDOffset(xDir + i, h, zDir + j); - if (isNotStaticWater(tBlock, tMeta)) { - if (this.getStoredFluids() != null) { - for (FluidStack stored : this.getStoredFluids()) { - if (stored.isFluidEqual(FluidUtils.getFluidStack("water", 1))) { - if (stored.amount >= 1000) { - // Utils.LOG_WARNING("Going to try swap an air block for water from inut bus."); - stored.amount -= 1000; - Block fluidUsed = Blocks.water; - aBaseMetaTileEntity.getWorld() - .setBlock( - aBaseMetaTileEntity.getXCoord() + xDir + i, - aBaseMetaTileEntity.getYCoord() + h, - aBaseMetaTileEntity.getZCoord() + zDir + j, - fluidUsed); - } - } - } - } - } - tBlock = aBaseMetaTileEntity.getBlockOffset(xDir + i, h, zDir + j); - if (tBlock == Blocks.water || tBlock == Blocks.flowing_water) { - ++tAmount; - } - } - } - } - - return tAmount >= 60; - } - - private boolean isNotStaticWater(Block block, byte meta) { - return block == Blocks.air || block == Blocks.flowing_water - || block == BlocksItems.getFluidBlock(InternalName.fluidDistilledWater) - || (cofhWater != null && cofhWater.isAssignableFrom(block.getClass()) && meta != 0); - } - - private static AutoMap<AutoMap<WeightedRandomFishable>> categories = new AutoMap<>(); - private static AutoMap<WeightedRandomFishable> categoryFish = new AutoMap<>(); - private static AutoMap<WeightedRandomFishable> categoryJunk = new AutoMap<>(); - private static AutoMap<WeightedRandomFishable> categoryLoot = new AutoMap<>(); - private static boolean hasGenerateRecipes = false; - private int mMode = 14; - private int mMax = 8; - - private void generateRecipes() { - if (hasGenerateRecipes) return; - - categories.put(categoryFish); - categories.put(categoryJunk); - categories.put(categoryLoot); - for (WeightedRandomFishable h : FishPondFakeRecipe.fish) { - categoryFish.put(h); - } - for (WeightedRandomFishable h : FishPondFakeRecipe.junk) { - categoryJunk.put(h); - } - for (WeightedRandomFishable h : FishPondFakeRecipe.treasure) { - categoryLoot.put(h); - } - hasGenerateRecipes = true; - } - - private int getCircuit(ItemStack[] t) { - if (!this.isUsingControllerCircuit) { - for (ItemStack j : t) { - if (j.getItem() == CI.getNumberedCircuit(0) - .getItem()) { - // Fish - if (j.getItemDamage() == 14) { - mMax = 8 + (this.getMaxParallelRecipes() - 2); - this.mMode = 14; - break; - } - // Junk - else if (j.getItemDamage() == 15) { - this.mMode = 15; - mMax = 4; - break; - } - // Loot - else if (j.getItemDamage() == 16) { - this.mMode = 16; - mMax = 4; - break; - } else { - this.mMode = 0; - mMax = 0; - break; - } - } else { - this.mMode = 0; - mMax = 0; - break; - } - } - } - return this.mMode; - } - - // reflection map - private static Map<WeightedRandomFishable, ItemStack> reflectiveFishMap = new HashMap<>(); - - private ItemStack reflectiveFish(WeightedRandomFishable y) { - if (reflectiveFishMap.containsKey(y)) { - return reflectiveFishMap.get(y); - } - ItemStack t; - try { - t = (ItemStack) ReflectionUtils.getField(WeightedRandomFishable.class, "field_150711_b") - .get(y); - ItemStack k = ItemUtils.getSimpleStack(t, 1); - reflectiveFishMap.put(y, k); - return t; - } catch (IllegalArgumentException | IllegalAccessException e) {} - return null; - } - - private ItemStack[] generateLoot(int mode) { - ItemStack[] mFishOutput = new ItemStack[this.mMax]; - if (this.mMode == 14) { - for (int k = 0; k < this.mMax; k++) { - if (mFishOutput[k] == null) for (WeightedRandomFishable g : categoryFish.values()) { - if (MathUtils.randInt(0, (65 - getMaxParallelRecipes())) <= 2) { - ItemStack t = reflectiveFish(g); - if (t != null) { - mFishOutput[k] = ItemUtils.getSimpleStack(t, 1); - } - } - } - } - } else if (this.mMode == 15) { - for (int k = 0; k < this.mMax; k++) { - if (mFishOutput[k] == null) for (WeightedRandomFishable g : categoryJunk.values()) { - if (MathUtils.randInt(0, 100) <= 1) { - ItemStack t = reflectiveFish(g); - if (t != null) { - mFishOutput[k] = ItemUtils.getSimpleStack(t, 1); - } - } - } - } - } else if (this.mMode == 16) { - for (int k = 0; k < this.mMax; k++) { - if (mFishOutput[k] == null) for (WeightedRandomFishable g : categoryLoot.values()) { - if (MathUtils.randInt(0, 1000) <= 2) { - ItemStack t = reflectiveFish(g); - if (t != null) { - mFishOutput[k] = ItemUtils.getSimpleStack(t, 1); - } - } - } - } - } else { - mFishOutput = null; - } - return mFishOutput; - } -} diff --git a/gtpp/src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/production/GregtechMetaTileEntity_IndustrialRockBreaker.java b/gtpp/src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/production/GregtechMetaTileEntity_IndustrialRockBreaker.java deleted file mode 100644 index e7e74ac061..0000000000 --- a/gtpp/src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/production/GregtechMetaTileEntity_IndustrialRockBreaker.java +++ /dev/null @@ -1,367 +0,0 @@ -package gtPlusPlus.xmod.gregtech.common.tileentities.machines.multi.production; - -import static com.gtnewhorizon.structurelib.structure.StructureUtility.ofBlock; -import static com.gtnewhorizon.structurelib.structure.StructureUtility.onElementPass; -import static com.gtnewhorizon.structurelib.structure.StructureUtility.transpose; -import static gregtech.api.enums.GT_HatchElement.Energy; -import static gregtech.api.enums.GT_HatchElement.InputBus; -import static gregtech.api.enums.GT_HatchElement.InputHatch; -import static gregtech.api.enums.GT_HatchElement.Maintenance; -import static gregtech.api.enums.GT_HatchElement.Muffler; -import static gregtech.api.enums.GT_HatchElement.OutputBus; -import static gregtech.api.util.GT_StructureUtility.buildHatchAdder; - -import java.util.ArrayList; - -import net.minecraft.init.Blocks; -import net.minecraft.item.ItemStack; -import net.minecraftforge.fluids.FluidRegistry; -import net.minecraftforge.fluids.FluidStack; - -import org.jetbrains.annotations.NotNull; - -import com.gtnewhorizon.structurelib.alignment.constructable.ISurvivalConstructable; -import com.gtnewhorizon.structurelib.structure.IStructureDefinition; -import com.gtnewhorizon.structurelib.structure.ISurvivalBuildEnvironment; -import com.gtnewhorizon.structurelib.structure.StructureDefinition; - -import gregtech.api.enums.Materials; -import gregtech.api.enums.OrePrefixes; -import gregtech.api.enums.SoundResource; -import gregtech.api.enums.TAE; -import gregtech.api.interfaces.IIconContainer; -import gregtech.api.interfaces.metatileentity.IMetaTileEntity; -import gregtech.api.interfaces.tileentity.IGregTechTileEntity; -import gregtech.api.recipe.RecipeMap; -import gregtech.api.recipe.RecipeMaps; -import gregtech.api.recipe.check.CheckRecipeResult; -import gregtech.api.recipe.check.CheckRecipeResultRegistry; -import gregtech.api.recipe.check.SimpleCheckRecipeResult; -import gregtech.api.util.GT_LanguageManager; -import gregtech.api.util.GT_Multiblock_Tooltip_Builder; -import gregtech.api.util.GT_OreDictUnificator; -import gregtech.api.util.GT_OverclockCalculator; -import gregtech.api.util.GT_ParallelHelper; -import gregtech.api.util.GT_Recipe; -import gregtech.api.util.GT_Utility; -import gtPlusPlus.core.block.ModBlocks; -import gtPlusPlus.core.lib.CORE; -import gtPlusPlus.core.recipe.common.CI; -import gtPlusPlus.core.util.minecraft.ItemUtils; -import gtPlusPlus.xmod.gregtech.api.metatileentity.implementations.base.GregtechMeta_MultiBlockBase; -import gtPlusPlus.xmod.gregtech.common.blocks.textures.TexturesGtBlock; - -public class GregtechMetaTileEntity_IndustrialRockBreaker extends - GregtechMeta_MultiBlockBase<GregtechMetaTileEntity_IndustrialRockBreaker> implements ISurvivalConstructable { - - private int mCasing; - private static IStructureDefinition<GregtechMetaTileEntity_IndustrialRockBreaker> STRUCTURE_DEFINITION = null; - - public GregtechMetaTileEntity_IndustrialRockBreaker(final int aID, final String aName, final String aNameRegional) { - super(aID, aName, aNameRegional); - } - - public GregtechMetaTileEntity_IndustrialRockBreaker(final String aName) { - super(aName); - } - - @Override - public IMetaTileEntity newMetaEntity(final IGregTechTileEntity aTileEntity) { - return new GregtechMetaTileEntity_IndustrialRockBreaker(this.mName); - } - - @Override - public String getMachineType() { - return "Rock Breaker"; - } - - private static final String casingBaseName = GT_LanguageManager.getTranslation("gtplusplus.blockcasings.2.0.name"); - private static final String casingMiddleName = GT_LanguageManager - .getTranslation("gtplusplus.blockcasings.2.11.name"); - private static final String anyBaseCasing = "Any " + casingBaseName; - - @Override - protected GT_Multiblock_Tooltip_Builder createTooltip() { - GT_Multiblock_Tooltip_Builder tt = new GT_Multiblock_Tooltip_Builder(); - tt.addMachineType(getMachineType()) - .addInfo("Controller Block for the Industrial Rock Breaker") - .addInfo("Speed: +200% | EU Usage: 75% | Parallel: Tier x 8") - .addInfo("Circuit goes in the GUI slot") - .addInfo("1 = cobble, 2 = stone, 3 = obsidian") - .addInfo("Supply Water/Lava") - .addPollutionAmount(getPollutionPerSecond(null)) - .addSeparator() - .beginStructureBlock(3, 4, 3, true) - .addController("Bottom Center") - .addCasingInfoMin(casingBaseName, 9, false) - .addCasingInfoExactly(casingMiddleName, 16, false) - .addInputBus(anyBaseCasing, 1) - .addInputHatch(anyBaseCasing, 1) - .addOutputBus(anyBaseCasing, 1) - .addEnergyHatch(anyBaseCasing, 1) - .addMaintenanceHatch(anyBaseCasing, 1) - .addMufflerHatch(anyBaseCasing, 1) - .toolTipFinisher(CORE.GT_Tooltip_Builder.get()); - return tt; - } - - @Override - public IStructureDefinition<GregtechMetaTileEntity_IndustrialRockBreaker> getStructureDefinition() { - if (STRUCTURE_DEFINITION == null) { - STRUCTURE_DEFINITION = StructureDefinition.<GregtechMetaTileEntity_IndustrialRockBreaker>builder() - .addShape( - mName, - transpose( - new String[][] { { "CCC", "CCC", "CCC" }, { "HHH", "H-H", "HHH" }, { "HHH", "H-H", "HHH" }, - { "C~C", "CCC", "CCC" }, })) - .addElement( - 'C', - buildHatchAdder(GregtechMetaTileEntity_IndustrialRockBreaker.class) - .atLeast(InputBus, InputHatch, OutputBus, Maintenance, Energy, Muffler) - .casingIndex(TAE.GTPP_INDEX(16)) - .dot(1) - .buildAndChain(onElementPass(x -> ++x.mCasing, ofBlock(ModBlocks.blockCasings2Misc, 0)))) - .addElement('H', ofBlock(ModBlocks.blockCasings2Misc, 11)) - .build(); - } - return STRUCTURE_DEFINITION; - } - - @Override - public void construct(ItemStack stackSize, boolean hintsOnly) { - buildPiece(mName, stackSize, hintsOnly, 1, 3, 0); - } - - @Override - public int survivalConstruct(ItemStack stackSize, int elementBudget, ISurvivalBuildEnvironment env) { - if (mMachine) return -1; - return survivialBuildPiece(mName, stackSize, 1, 3, 0, elementBudget, env, false, true); - } - - @Override - public boolean checkMachine(IGregTechTileEntity aBaseMetaTileEntity, ItemStack aStack) { - mCasing = 0; - boolean aCheckPiece = checkPiece(mName, 1, 3, 0); - boolean aCasingCount = mCasing >= 9; - boolean aCheckHatch = checkHatch(); - log("" + aCheckPiece + ", " + aCasingCount + ", " + aCheckHatch); - return aCheckPiece && aCasingCount && aCheckHatch; - } - - @Override - protected SoundResource getProcessStartSound() { - return SoundResource.IC2_MACHINES_INDUCTION_LOOP; - } - - @Override - protected IIconContainer getActiveOverlay() { - return TexturesGtBlock.Overlay_Machine_Controller_Advanced_Active; - } - - @Override - protected IIconContainer getInactiveOverlay() { - return TexturesGtBlock.Overlay_Machine_Controller_Advanced; - } - - @Override - protected int getCasingTextureId() { - return TAE.GTPP_INDEX(16); - } - - @Override - public RecipeMap<?> getRecipeMap() { - return RecipeMaps.rockBreakerFakeRecipes; - } - - @Override - protected boolean filtersFluid() { - return false; - } - - @Override - public boolean isCorrectMachinePart(final ItemStack aStack) { - return true; - } - - private static GT_Recipe sRecipe_Cobblestone; - private static GT_Recipe sRecipe_SmoothStone; - private static GT_Recipe sRecipe_Redstone; - - private static void generateRecipes() { - sRecipe_Cobblestone = new GT_Recipe( - false, - new ItemStack[] { CI.getNumberedCircuit(1) }, - new ItemStack[] { ItemUtils.getSimpleStack(Blocks.cobblestone) }, - null, - new int[] { 10000 }, - null, - null, - 16, - 32, - 0); - sRecipe_SmoothStone = new GT_Recipe( - false, - new ItemStack[] { CI.getNumberedCircuit(2) }, - new ItemStack[] { ItemUtils.getSimpleStack(Blocks.stone) }, - null, - new int[] { 10000 }, - null, - null, - 16, - 32, - 0); - sRecipe_Redstone = new GT_Recipe( - false, - new ItemStack[] { CI.getNumberedCircuit(3), - GT_OreDictUnificator.get(OrePrefixes.dust, Materials.Redstone, 1L) }, - new ItemStack[] { ItemUtils.getSimpleStack(Blocks.obsidian) }, - null, - new int[] { 10000 }, - null, - null, - 128, - 32, - 0); - } - - @Override - public @NotNull CheckRecipeResult checkProcessing() { - ArrayList<FluidStack> aFluids = this.getStoredFluids(); - if (aFluids.isEmpty()) { - return CheckRecipeResultRegistry.NO_RECIPE; - } - - boolean aHasWater = false; - boolean aHasLava = false; - for (FluidStack aFluid : aFluids) { - if (aFluid.getFluid() == FluidRegistry.WATER) { - aHasWater = true; - } else if (aFluid.getFluid() == FluidRegistry.LAVA) { - aHasLava = true; - } - } - ArrayList<ItemStack> aItems = this.getStoredInputs(); - boolean aHasRedstone = false; - if (!aItems.isEmpty()) { - for (ItemStack aItem : aItems) { - if (GT_Utility - .areStacksEqual(aItem, GT_OreDictUnificator.get(OrePrefixes.dust, Materials.Redstone, 1L))) { - aHasRedstone = true; - break; - } - } - } - - if (!aHasWater) { - return SimpleCheckRecipeResult.ofFailure("no_water"); - } - if (!aHasLava) { - return SimpleCheckRecipeResult.ofFailure("no_lava"); - } - ItemStack aGuiCircuit = this.getControllerSlot(); - if (!ItemUtils.isControlCircuit(aGuiCircuit)) { - return CheckRecipeResultRegistry.NO_RECIPE; - } - - if (sRecipe_Cobblestone == null || sRecipe_SmoothStone == null || sRecipe_Redstone == null) { - generateRecipes(); - } - - int aCircuit = aGuiCircuit.getItemDamage(); - - GT_Recipe tRecipe = null; - switch (aCircuit) { - case 1 -> tRecipe = sRecipe_Cobblestone; - case 2 -> tRecipe = sRecipe_SmoothStone; - case 3 -> { - if (aHasRedstone) { - tRecipe = sRecipe_Redstone; - } - } - } - - if (tRecipe == null) { - return CheckRecipeResultRegistry.NO_RECIPE; - } - - ItemStack[] aItemInputs = aItems.toArray(new ItemStack[0]); - FluidStack[] aFluidInputs = new FluidStack[] {}; - - long tEnergy = getMaxInputEnergy(); - // Remember last recipe - an optimization for findRecipe() - this.mLastRecipe = tRecipe; - - GT_ParallelHelper helper = new GT_ParallelHelper().setRecipe(tRecipe) - .setItemInputs(aItemInputs) - .setFluidInputs(aFluidInputs) - .setAvailableEUt(tEnergy) - .setMaxParallel(getMaxParallelRecipes()) - .setConsumption(true) - .setOutputCalculation(true) - .setEUtModifier(0.75F) - .setMachine(this); - - if (batchMode) { - helper.enableBatchMode(128); - } - - helper.build(); - - if (helper.getCurrentParallel() == 0) { - return CheckRecipeResultRegistry.ITEM_OUTPUT_FULL; - } - - this.mEfficiency = (10000 - (getIdealStatus() - getRepairStatus()) * 1000); - this.mEfficiencyIncrease = 10000; - - GT_OverclockCalculator calculator = new GT_OverclockCalculator().setRecipeEUt(tRecipe.mEUt) - .setEUt(tEnergy) - .setDuration(tRecipe.mDuration) - .setEUtDiscount(0.75F) - .setSpeedBoost(1F / 3F) - .setParallel((int) Math.floor(helper.getCurrentParallel() / helper.getDurationMultiplierDouble())) - .calculate(); - lEUt = -calculator.getConsumption(); - mMaxProgresstime = (int) Math.ceil(calculator.getDuration() * helper.getDurationMultiplierDouble()); - - mOutputItems = helper.getItemOutputs(); - mOutputFluids = helper.getFluidOutputs(); - updateSlots(); - return CheckRecipeResultRegistry.SUCCESSFUL; - - } - - @Override - public int getMaxParallelRecipes() { - return (8 * GT_Utility.getTier(this.getMaxInputVoltage())); - } - - @Override - public int getMaxEfficiency(final ItemStack aStack) { - return 10000; - } - - @Override - public int getPollutionPerSecond(final ItemStack aStack) { - return CORE.ConfigSwitches.pollutionPerSecondMultiIndustrialRockBreaker; - } - - @Override - public int getDamageToComponent(final ItemStack aStack) { - return 0; - } - - @Override - public boolean explodesOnComponentBreak(final ItemStack aStack) { - return false; - } - - @Override - public ArrayList<ItemStack> getStoredInputs() { - ArrayList<ItemStack> aInputs = super.getStoredInputs(); - if (this.getControllerSlot() != null) { - aInputs.add(this.getControllerSlot()); - } - return aInputs; - } -} diff --git a/gtpp/src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/production/GregtechMetaTileEntity_LargeRocketEngine.java b/gtpp/src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/production/GregtechMetaTileEntity_LargeRocketEngine.java deleted file mode 100644 index e77ac454ee..0000000000 --- a/gtpp/src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/production/GregtechMetaTileEntity_LargeRocketEngine.java +++ /dev/null @@ -1,524 +0,0 @@ -package gtPlusPlus.xmod.gregtech.common.tileentities.machines.multi.production; - -import static com.gtnewhorizon.structurelib.structure.StructureUtility.ofBlock; -import static com.gtnewhorizon.structurelib.structure.StructureUtility.onElementPass; -import static com.gtnewhorizon.structurelib.structure.StructureUtility.transpose; -import static gregtech.api.enums.GT_HatchElement.Dynamo; -import static gregtech.api.enums.GT_HatchElement.InputBus; -import static gregtech.api.enums.GT_HatchElement.InputHatch; -import static gregtech.api.enums.GT_HatchElement.Maintenance; -import static gregtech.api.enums.GT_HatchElement.Muffler; -import static gregtech.api.util.GT_StructureUtility.buildHatchAdder; -import static gregtech.api.util.GT_Utility.filterValidMTEs; -import static gtPlusPlus.xmod.gregtech.api.metatileentity.implementations.base.GregtechMeta_MultiBlockBase.GTPPHatchElement.AirIntake; -import static gtPlusPlus.xmod.gregtech.api.metatileentity.implementations.base.GregtechMeta_MultiBlockBase.GTPPHatchElement.TTDynamo; - -import java.util.ArrayList; - -import net.minecraft.block.Block; -import net.minecraft.item.ItemStack; -import net.minecraft.nbt.NBTTagCompound; -import net.minecraftforge.fluids.Fluid; -import net.minecraftforge.fluids.FluidStack; - -import org.jetbrains.annotations.NotNull; - -import com.google.common.collect.ImmutableMap; -import com.gtnewhorizon.structurelib.alignment.constructable.ISurvivalConstructable; -import com.gtnewhorizon.structurelib.structure.IStructureDefinition; -import com.gtnewhorizon.structurelib.structure.ISurvivalBuildEnvironment; -import com.gtnewhorizon.structurelib.structure.StructureDefinition; - -import gregtech.api.enums.GT_Values; -import gregtech.api.enums.TAE; -import gregtech.api.interfaces.IIconContainer; -import gregtech.api.interfaces.metatileentity.IMetaTileEntity; -import gregtech.api.interfaces.tileentity.IGregTechTileEntity; -import gregtech.api.metatileentity.implementations.GT_MetaTileEntity_Hatch; -import gregtech.api.recipe.RecipeMap; -import gregtech.api.recipe.check.CheckRecipeResult; -import gregtech.api.recipe.check.CheckRecipeResultRegistry; -import gregtech.api.recipe.check.SimpleCheckRecipeResult; -import gregtech.api.util.GT_Multiblock_Tooltip_Builder; -import gregtech.api.util.GT_Recipe; -import gregtech.api.util.shutdown.ShutDownReasonRegistry; -import gtPlusPlus.api.recipe.GTPPRecipeMaps; -import gtPlusPlus.core.block.ModBlocks; -import gtPlusPlus.core.item.chemistry.RocketFuels; -import gtPlusPlus.core.lib.CORE; -import gtPlusPlus.core.material.MISC_MATERIALS; -import gtPlusPlus.core.util.minecraft.FluidUtils; -import gtPlusPlus.xmod.gregtech.api.metatileentity.implementations.GT_MetaTileEntity_Hatch_AirIntake; -import gtPlusPlus.xmod.gregtech.api.metatileentity.implementations.base.GregtechMeta_MultiBlockBase; -import gtPlusPlus.xmod.gregtech.common.blocks.textures.TexturesGtBlock; - -public class GregtechMetaTileEntity_LargeRocketEngine - extends GregtechMeta_MultiBlockBase<GregtechMetaTileEntity_LargeRocketEngine> implements ISurvivalConstructable { - - protected int fuelConsumption; - protected int fuelValue; - protected int fuelRemaining; - protected int freeFuelTicks = 0; - protected int euProduction = 0; - protected boolean boostEu; - - public static String mLubricantName = "Carbon Dioxide"; - public static String mCoolantName = "Liquid Hydrogen"; - - public static String mCasingName = "Turbodyne Casing"; - public static String mIntakeHatchName = "Tungstensteel Turbine Casing"; - public static String mGearboxName = "Inconel Reinforced Casing"; - - private static Fluid sAirFluid = null; - private static FluidStack sAirFluidStack = null; - - private int mCasing; - private static IStructureDefinition<GregtechMetaTileEntity_LargeRocketEngine> STRUCTURE_DEFINITION = null; - - private static final int CASING_ID = TAE.getIndexFromPage(3, 11); - - public GregtechMetaTileEntity_LargeRocketEngine(final int aID, final String aName, final String aNameRegional) { - super(aID, aName, aNameRegional); - this.fuelConsumption = 0; - this.fuelValue = 0; - this.fuelRemaining = 0; - this.boostEu = false; - setAir(); - } - - public GregtechMetaTileEntity_LargeRocketEngine(final String aName) { - super(aName); - this.fuelConsumption = 0; - this.fuelValue = 0; - this.fuelRemaining = 0; - this.boostEu = false; - setAir(); - } - - @Override - protected GT_Multiblock_Tooltip_Builder createTooltip() { - GT_Multiblock_Tooltip_Builder tt = new GT_Multiblock_Tooltip_Builder(); - tt.addMachineType(getMachineType()) - .addInfo("Controller Block for the Large Rocket Engine") - .addInfo("Generating Power from Rocket Fuels - Supports TecTech Multi-Amp Dynamos!") - .addInfo("Supply GT++ Rocket Fuels and 1000L of " + mLubricantName + " per hour") - .addInfo("Produces as much energy as you put fuel in, with optional boosting") - .addInfo("This multi doesn't accept fluids if not enabled - enable it first!") - .addInfo("Consumes 2000L/s of air and pollutes 1500 gibbl/s per 16384 eu/t produced") - .addInfo("Place 1-8 Air Intake Hatches on the sides to maintain Air input") - .addInfo("If it runs out of air, it will shut down and have to be manually restarted") - .addInfo("Supply 3L of " + mCoolantName + " per second, per 1000 EU/t to boost") - .addInfo("Takes 3x the amount of " + mLubricantName + " and maintains efficiency") - .addInfo("Fuel efficiency starts at ~160%, falls more slowly at higher EU/t if boosted") - .addInfo("If producing more than 30k EU/t, fuel efficiency will be lower:") - .addInfo("(These thresholds are 3x higher when boosted, boosted values displayed second)") - .addInfo("- 75% of max fuel efficiency at 53k or 159k EU/t output energy") - .addInfo("- 50% of max fuel efficiency at 69k or 207k EU/t output energy") - .addInfo("- 25% of max fuel efficiency at 98k or 294k EU/t output energy") - .addInfo("formula: x = input of energy (30000^(1/3)/ x^(1/3)) * (80000^(1/3)/ x^(1/3))") - .addSeparator() - .beginStructureBlock(3, 3, 10, false) - .addController("Front Center") - .addCasingInfoMin(mCasingName, 64, false) - .addCasingInfoMin(mGearboxName, 8, false) - .addStructureHint("Air Intake Hatch", 1) - .addInputBus("Side center line", 1) - .addInputHatch("Side center line", 1) - .addMaintenanceHatch("Any Block Touching Inconel Reinforced Casing", 1) - .addDynamoHatch("Top center line", 2) - .addMufflerHatch("Back Center", 3) - .toolTipFinisher(CORE.GT_Tooltip_Builder.get()); - return tt; - } - - @Override - public IStructureDefinition<GregtechMetaTileEntity_LargeRocketEngine> getStructureDefinition() { - if (this.STRUCTURE_DEFINITION == null) { - this.STRUCTURE_DEFINITION = StructureDefinition.<GregtechMetaTileEntity_LargeRocketEngine>builder() - .addShape( - this.mName, - transpose( - new String[][] { { "CTC", "CTC", "CTC", "CTC", "CTC", "CTC", "CTC", "CTC", "CTC", "CTC" }, - { "C~C", "SIS", "SIS", "SIS", "SIS", "SIS", "SIS", "SIS", "SIS", "CMC" }, - { "CCC", "CSC", "CSC", "CSC", "CSC", "CSC", "CSC", "CSC", "CSC", "CCC" }, })) - .addElement('C', ofBlock(getCasingBlock(), getCasingMeta())) - .addElement('I', ofBlock(getGearboxBlock(), getGearboxMeta())) - // side - .addElement( - 'S', - buildHatchAdder(GregtechMetaTileEntity_LargeRocketEngine.class) - .atLeast(ImmutableMap.of(AirIntake, 8, InputBus, 1, InputHatch, 3, Maintenance, 1)) - .casingIndex(getCasingTextureIndex()) - .dot(1) - .buildAndChain(onElementPass(x -> ++x.mCasing, ofBlock(getCasingBlock(), getCasingMeta())))) - // top - .addElement( - 'T', - buildHatchAdder(GregtechMetaTileEntity_LargeRocketEngine.class) - .atLeast(ImmutableMap.of(AirIntake, 8, Dynamo.or(TTDynamo), 1, Maintenance, 1)) - .casingIndex(getCasingTextureIndex()) - .dot(2) - .buildAndChain(onElementPass(x -> ++x.mCasing, ofBlock(getCasingBlock(), getCasingMeta())))) - .addElement('M', Muffler.newAny(getCasingTextureIndex(), 3)) - .build(); - } - return this.STRUCTURE_DEFINITION; - } - - @Override - public void construct(ItemStack stackSize, boolean hintsOnly) { - buildPiece(this.mName, stackSize, hintsOnly, 1, 1, 0); - } - - @Override - public int survivalConstruct(ItemStack stackSize, int elementBudget, ISurvivalBuildEnvironment env) { - if (mMachine) return -1; - return survivialBuildPiece(mName, stackSize, 1, 1, 0, elementBudget, env, false, true); - } - - @Override - public boolean checkMachine(IGregTechTileEntity aBaseMetaTileEntity, ItemStack aStack) { - this.mCasing = 0; - this.mTecTechDynamoHatches.clear(); - this.mAllDynamoHatches.clear(); - this.mAirIntakes.clear(); - return checkPiece(this.mName, 1, 1, 0) && this.mCasing >= 64 - 48 - && this.mAirIntakes.size() >= 1 - && checkHatch(); - } - - @Override - protected IIconContainer getActiveOverlay() { - return TexturesGtBlock.Overlay_Machine_Controller_Advanced_Active; - } - - @Override - protected IIconContainer getInactiveOverlay() { - return TexturesGtBlock.Overlay_Machine_Controller_Advanced; - } - - @Override - protected int getCasingTextureId() { - return CASING_ID; - } - - @Override - public boolean isCorrectMachinePart(final ItemStack aStack) { - return this.getMaxEfficiency(aStack) > 0; - } - - public static void setAir() { - if (sAirFluidStack == null) { - sAirFluidStack = FluidUtils.getFluidStack("air", 1); - } - if (sAirFluid == null && sAirFluidStack != null) { - sAirFluid = sAirFluidStack.getFluid(); - } - } - - public int getAir() { - setAir(); - if (this.mAirIntakes.isEmpty() || this.mAirIntakes.size() <= 0) { - return 0; - } else { - int totalAir = 0; - for (GT_MetaTileEntity_Hatch_AirIntake u : this.mAirIntakes) { - if (u != null && u.mFluid != null) { - FluidStack f = u.mFluid; - if (f.isFluidEqual(sAirFluidStack)) { - totalAir += f.amount; - } - } - } - return totalAir; - } - } - - @Override - public RecipeMap<?> getRecipeMap() { - return GTPPRecipeMaps.rocketFuels; - } - - @Override - public @NotNull CheckRecipeResult checkProcessing() { - final ArrayList<FluidStack> tFluids = this.getStoredFluids(); - this.clearRecipeMapForAllInputHatches(); - int aircount = getAir(); - int aAirToConsume = this.euProduction / 100; - if (aircount < aAirToConsume) { - stopMachine(ShutDownReasonRegistry.outOfFluid(new FluidStack(sAirFluid, aAirToConsume))); - return SimpleCheckRecipeResult.ofFailure("no_air"); - } else { - int aTotalAir = 0; - for (GT_MetaTileEntity_Hatch_AirIntake aAirHatch : this.mAirIntakes) { - if (aAirHatch.mFluid != null) { - aTotalAir += aAirHatch.getFluidAmount(); - } - } - if (aTotalAir >= aAirToConsume) { - int aSplitAmount = (aAirToConsume / this.mAirIntakes.size()); - if (aSplitAmount > 0) { - for (GT_MetaTileEntity_Hatch_AirIntake aAirHatch : mAirIntakes) { - boolean hasIntakeAir = aAirHatch.drain(aSplitAmount, true) != null; - if (!hasIntakeAir) { - this.freeFuelTicks = 0; - return SimpleCheckRecipeResult.ofFailure("no_air"); - } - } - } - } - } - // reset fuel ticks in case it does not reset when it stops - if (this.freeFuelTicks != 0 && this.mProgresstime == 0 && this.mEfficiency == 0) this.freeFuelTicks = 0; - - if (tFluids.size() > 0 && getRecipeMap() != null) { - if (this.mRuntime % 72 == 0) { - if (!consumeCO2()) { - this.freeFuelTicks = 0; - return SimpleCheckRecipeResult.ofFailure("no_co2"); - } - } - if (this.freeFuelTicks == 0) { - this.boostEu = consumeLOH(); - } - for (final FluidStack hatchFluid1 : tFluids) { - if (hatchFluid1.isFluidEqual(sAirFluidStack)) { - continue; - } - if (this.freeFuelTicks == 0) { - for (final GT_Recipe aFuel : getRecipeMap().getAllRecipes()) { - final FluidStack tLiquid; - tLiquid = aFuel.mFluidInputs[0]; - if (hatchFluid1.isFluidEqual(tLiquid)) { - if (!consumeFuel(aFuel, hatchFluid1.amount)) { - continue; - } - this.fuelValue = aFuel.mSpecialValue * 3; - this.fuelRemaining = hatchFluid1.amount; - this.lEUt = ((this.mEfficiency < 2000) ? 0 : GT_Values.V[5] << 1); - this.mProgresstime = 1; - this.mMaxProgresstime = 1; - this.mEfficiencyIncrease = this.euProduction / 2000; - return CheckRecipeResultRegistry.GENERATING; - } - } - } else { - this.mEfficiencyIncrease = this.euProduction / 2000; - this.freeFuelTicks--; - this.lEUt = ((this.mEfficiency < 1000) ? 0 : GT_Values.V[5] << 1); - this.mProgresstime = 1; - this.mMaxProgresstime = 1; - return CheckRecipeResultRegistry.GENERATING; - } - } - } - this.lEUt = 0; - this.mEfficiency = 0; - this.freeFuelTicks = 0; - return CheckRecipeResultRegistry.NO_FUEL_FOUND; - } - - /** - * Consumes Fuel if required. Free Fuel Ticks are handled here. - * - * @param aFuel - * @return - */ - public boolean consumeFuel(GT_Recipe aFuel, int amount) { - amount *= this.boostEu ? 0.3 : 0.9; - this.freeFuelTicks = 0; - int value = aFuel.mSpecialValue * 3; - int energy = value * amount; - if (amount < 5) return false; - FluidStack tLiquid = FluidUtils.getFluidStack(aFuel.mFluidInputs[0], (this.boostEu ? amount * 3 : amount)); - if (!this.depleteInput(tLiquid)) { - return false; - } else { - this.fuelConsumption = this.boostEu ? amount * 3 : amount; - this.freeFuelTicks = 20; - setEUProduction(energy); - return true; - } - } - - public void setEUProduction(int energy) { - energy /= 20; - double energyEfficiency; - double tDivideEnergy = Math.cbrt(energy); - if (energy > 30000) { - // cbrt(30 000) / - energyEfficiency = (31.072325 / tDivideEnergy); - if (energy >= 80000) - // cbrt(80 000) / - energyEfficiency *= (43.0886938 / tDivideEnergy); - energyEfficiency *= energy; - } else { - energyEfficiency = energy; - } - this.euProduction = (int) (energyEfficiency); - if (this.boostEu) this.euProduction *= 3; - } - - public boolean consumeCO2() { - return this.depleteInput(MISC_MATERIALS.CARBON_DIOXIDE.getFluidStack(this.boostEu ? 3 : 1)) - || this.depleteInput(FluidUtils.getFluidStack("carbondioxide", (this.boostEu ? 3 : 1))); - } - - public boolean consumeLOH() { - int LOHamount = (3 * this.euProduction) / 1000; - return this.depleteInput(FluidUtils.getFluidStack(RocketFuels.Liquid_Hydrogen, LOHamount)); // (40 * ((long) - // euProduction / - // 10000)) - } - - @Override - public boolean addEnergyOutput(long aEU) { - if (aEU <= 0) { - return true; - } - if (this.mAllDynamoHatches.size() > 0) { - return addEnergyOutputMultipleDynamos(aEU, true); - } - return false; - } - - @Override - public boolean addEnergyOutputMultipleDynamos(long aEU, boolean aAllowMixedVoltageDynamos) { - int injected = 0; - long totalOutput = 0; - long aFirstVoltageFound = -1; - boolean aFoundMixedDynamos = false; - for (GT_MetaTileEntity_Hatch aDynamo : filterValidMTEs(this.mAllDynamoHatches)) { - long aVoltage = aDynamo.maxEUOutput(); - long aTotal = aDynamo.maxAmperesOut() * aVoltage; - // Check against voltage to check when hatch mixing - if (aFirstVoltageFound == -1) { - aFirstVoltageFound = aVoltage; - } else { - if (aFirstVoltageFound != aVoltage) { - aFoundMixedDynamos = true; - } - } - totalOutput += aTotal; - } - - if (totalOutput < aEU || (aFoundMixedDynamos && !aAllowMixedVoltageDynamos)) { - explodeMultiblock(); - return false; - } - - long leftToInject; - long aVoltage; - int aAmpsToInject; - int aRemainder; - - for (GT_MetaTileEntity_Hatch aDynamo : filterValidMTEs(this.mAllDynamoHatches)) { - leftToInject = aEU - injected; - aVoltage = aDynamo.maxEUOutput(); - aAmpsToInject = (int) (leftToInject / aVoltage); - aRemainder = (int) (leftToInject - (aAmpsToInject * aVoltage)); - long powerGain; - for (int i = 0; i < Math.min(aDynamo.maxAmperesOut(), aAmpsToInject + 1); i++) { - if (i == Math.min(aDynamo.maxAmperesOut(), aAmpsToInject)) { - powerGain = aRemainder; - } else { - powerGain = aVoltage; - } - aDynamo.getBaseMetaTileEntity() - .increaseStoredEnergyUnits(powerGain, false); - injected += powerGain; - } - } - return injected > 0; - } - - public Block getCasingBlock() { - return ModBlocks.blockCasings4Misc; - } - - public byte getCasingMeta() { - return 11; - } - - public Block getGearboxBlock() { - return ModBlocks.blockCasings3Misc; - } - - public byte getGearboxMeta() { - return 1; - } - - public byte getCasingTextureIndex() { - return (byte) CASING_ID; - } - - @Override - public IMetaTileEntity newMetaEntity(final IGregTechTileEntity aTileEntity) { - return new GregtechMetaTileEntity_LargeRocketEngine(this.mName); - } - - @Override - public void saveNBTData(final NBTTagCompound aNBT) { - aNBT.setInteger("freeFuelTicks", this.freeFuelTicks); - aNBT.setInteger("euProduction", this.euProduction); - super.saveNBTData(aNBT); - } - - @Override - public void loadNBTData(final NBTTagCompound aNBT) { - super.loadNBTData(aNBT); - this.freeFuelTicks = aNBT.getInteger("freeFuelTicks"); - this.euProduction = aNBT.getInteger("euProduction"); - } - - @Override - public int getDamageToComponent(final ItemStack aStack) { - return 1; - } - - @Override - public int getMaxEfficiency(final ItemStack aStack) { - return this.euProduction; - } - - @Override - public int getPollutionPerTick(final ItemStack aStack) { - return 75 * (this.euProduction / 10000); - } - - @Override - public boolean explodesOnComponentBreak(final ItemStack aStack) { - return true; - } - - @Override - public String[] getExtraInfoData() { - return new String[] { "Rocket Engine", "Current Air: " + getAir(), - "Current Pollution: " + getPollutionPerTick(null), - "Time until next fuel consumption: " + this.freeFuelTicks, - "Current Output: " + this.lEUt * this.mEfficiency / 10000 + " EU/t", - "Fuel Consumption: " + (this.fuelConsumption) + "L/s", "Fuel Value: " + this.fuelValue + " EU/L", - "Fuel Remaining: " + this.fuelRemaining + " Litres", "Current Efficiency: " + this.mEfficiency / 100 + "%", - (this.getIdealStatus() == this.getRepairStatus()) ? "No Maintainance issues" : "Needs Maintainance" }; - } - - @Override - public boolean isGivingInformation() { - return true; - } - - @Override - public String getMachineType() { - return "Rocket Engine"; - } - - @Override - public int getMaxParallelRecipes() { - return 1; - } - - @Override - public boolean doesBindPlayerInventory() { - return false; - } -} diff --git a/gtpp/src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/production/GregtechMetaTileEntity_LargeSemifluidGenerator.java b/gtpp/src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/production/GregtechMetaTileEntity_LargeSemifluidGenerator.java deleted file mode 100644 index 4403779d09..0000000000 --- a/gtpp/src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/production/GregtechMetaTileEntity_LargeSemifluidGenerator.java +++ /dev/null @@ -1,332 +0,0 @@ -package gtPlusPlus.xmod.gregtech.common.tileentities.machines.multi.production; - -import static com.gtnewhorizon.structurelib.structure.StructureUtility.ofBlock; -import static com.gtnewhorizon.structurelib.structure.StructureUtility.onElementPass; -import static com.gtnewhorizon.structurelib.structure.StructureUtility.transpose; -import static gregtech.api.enums.GT_HatchElement.Dynamo; -import static gregtech.api.enums.GT_HatchElement.InputHatch; -import static gregtech.api.enums.GT_HatchElement.Maintenance; -import static gregtech.api.enums.GT_HatchElement.Muffler; -import static gregtech.api.util.GT_StructureUtility.buildHatchAdder; -import static gtPlusPlus.xmod.gregtech.api.metatileentity.implementations.base.GregtechMeta_MultiBlockBase.GTPPHatchElement.TTDynamo; - -import java.util.ArrayList; - -import net.minecraft.block.Block; -import net.minecraft.item.ItemStack; -import net.minecraft.nbt.NBTTagCompound; -import net.minecraftforge.fluids.FluidStack; - -import org.jetbrains.annotations.NotNull; - -import com.gtnewhorizon.structurelib.alignment.constructable.ISurvivalConstructable; -import com.gtnewhorizon.structurelib.structure.IStructureDefinition; -import com.gtnewhorizon.structurelib.structure.ISurvivalBuildEnvironment; -import com.gtnewhorizon.structurelib.structure.StructureDefinition; - -import gregtech.api.GregTech_API; -import gregtech.api.enums.Materials; -import gregtech.api.enums.Textures; -import gregtech.api.interfaces.IIconContainer; -import gregtech.api.interfaces.metatileentity.IMetaTileEntity; -import gregtech.api.interfaces.tileentity.IGregTechTileEntity; -import gregtech.api.metatileentity.implementations.GT_MetaTileEntity_Hatch_Dynamo; -import gregtech.api.metatileentity.implementations.GT_MetaTileEntity_Hatch_Input; -import gregtech.api.metatileentity.implementations.GT_MetaTileEntity_Hatch_Maintenance; -import gregtech.api.metatileentity.implementations.GT_MetaTileEntity_Hatch_Muffler; -import gregtech.api.recipe.check.CheckRecipeResult; -import gregtech.api.recipe.check.CheckRecipeResultRegistry; -import gregtech.api.recipe.check.SimpleCheckRecipeResult; -import gregtech.api.util.GT_Multiblock_Tooltip_Builder; -import gregtech.api.util.GT_Recipe; -import gtPlusPlus.api.recipe.GTPPRecipeMaps; -import gtPlusPlus.core.lib.CORE; -import gtPlusPlus.xmod.gregtech.api.metatileentity.implementations.base.GregtechMeta_MultiBlockBase; - -public class GregtechMetaTileEntity_LargeSemifluidGenerator extends - GregtechMeta_MultiBlockBase<GregtechMetaTileEntity_LargeSemifluidGenerator> implements ISurvivalConstructable { - - private int mCasing; - private static IStructureDefinition<GregtechMetaTileEntity_LargeSemifluidGenerator> STRUCTURE_DEFINITION = null; - - protected int fuelConsumption = 0; - protected int fuelValue = 0; - protected int fuelRemaining = 0; - protected boolean boostEu = false; - - public GregtechMetaTileEntity_LargeSemifluidGenerator(int aID, String aName, String aNameRegional) { - super(aID, aName, aNameRegional); - } - - public GregtechMetaTileEntity_LargeSemifluidGenerator(String aName) { - super(aName); - } - - @Override - protected GT_Multiblock_Tooltip_Builder createTooltip() { - GT_Multiblock_Tooltip_Builder tt = new GT_Multiblock_Tooltip_Builder(); - tt.addMachineType(getMachineType()) - .addInfo("Controller Block for the Large Semifluid Generator") - .addInfo("Engine Intake Casings must not be obstructed in front (only air blocks)") - .addInfo("Supply Semifluid Fuels and 2000L of Lubricant per hour to run.") - .addInfo("Supply 80L of Oxygen per second to boost output (optional).") - .addInfo("Default: Produces 2048EU/t at 100% efficiency") - .addInfo("Boosted: Produces 6144EU/t at 150% efficiency") - .addPollutionAmount(getPollutionPerSecond(null)) - .addSeparator() - .beginStructureBlock(3, 3, 4, false) - .addController("Front Center") - .addCasingInfoMin("Stable Titanium Machine Casing", 16, false) - .addCasingInfoMin("Steel Gear Box Machine Casing", 2, false) - .addCasingInfoMin("Engine Intake Machine Casing", 8, false) - .addInputHatch("Any Casing", 1) - .addMaintenanceHatch("Any Casing", 1) - .addMufflerHatch("Any Casing", 1) - .addDynamoHatch("Back Center", 2) - .toolTipFinisher(CORE.GT_Tooltip_Builder.get()); - return tt; - } - - @Override - protected IIconContainer getActiveOverlay() { - return Textures.BlockIcons.OVERLAY_FRONT_DIESEL_ENGINE_ACTIVE; - } - - @Override - protected IIconContainer getInactiveOverlay() { - return Textures.BlockIcons.OVERLAY_FRONT_DIESEL_ENGINE; - } - - @Override - protected int getCasingTextureId() { - return 50; - } - - @Override - public boolean isCorrectMachinePart(ItemStack aStack) { - return getMaxEfficiency(aStack) > 0; - } - - @Override - public @NotNull CheckRecipeResult checkProcessing() { - ArrayList<FluidStack> tFluids = getStoredFluids(); - - // Check for lubricant and oxygen first, so we can compute costs ahead of time. - // This will allow us to check costs without needing to actually try to deplete fluids - // (wasting earlier fluids in the check if later fluids turn out to be insufficient). - FluidStack lubricant = Materials.Lubricant.getFluid(0L); - FluidStack oxygen = Materials.Oxygen.getGas(0L); - for (FluidStack hatchFluid : tFluids) { - if (hatchFluid.isFluidEqual(lubricant)) { - lubricant.amount = Math.max(lubricant.amount, hatchFluid.amount); - } else if (hatchFluid.isFluidEqual(oxygen)) { - oxygen.amount = Math.max(oxygen.amount, hatchFluid.amount); - } - } - boostEu = oxygen.amount >= 4L; - long lubricantCost = boostEu ? 2L : 1L; - if (lubricant.amount < lubricantCost) { - return SimpleCheckRecipeResult.ofFailure("no_lubricant"); - } - - for (FluidStack hatchFluid : tFluids) { // Loops through hatches - GT_Recipe aFuel = GTPPRecipeMaps.semiFluidFuels.getBackend() - .findFuel(hatchFluid); - if (aFuel == null) { - // Not a valid semi-fluid fuel. - continue; - } - - int newEUt = boostEu ? 4096 : 2048; - fuelConsumption = newEUt / aFuel.mSpecialValue; // Calc fuel consumption - FluidStack tLiquid = new FluidStack(hatchFluid.getFluid(), fuelConsumption); - if (depleteInput(tLiquid)) { // Deplete that amount - // We checked beforehand, so both of these depletions should succeed. - // But check the return values anyway just to be safe. - if (boostEu) { - if (!depleteInput(Materials.Oxygen.getGas(4L))) { - return SimpleCheckRecipeResult.ofFailure("no_oxygen"); - } - } - // Deplete Lubricant. 2000L should = 1 hour of runtime (if baseEU = 2048) - if (mRuntime % 72 == 0 || mRuntime == 0) { - if (!depleteInput(Materials.Lubricant.getFluid(lubricantCost))) { - return SimpleCheckRecipeResult.ofFailure("no_lubricant"); - } - } - - fuelValue = aFuel.mSpecialValue; - fuelRemaining = hatchFluid.amount; // Record available fuel - this.lEUt = mEfficiency < 2000 ? 0 : newEUt; // Output 0 if startup is less than 20% - this.mProgresstime = 1; - this.mMaxProgresstime = 1; - this.mEfficiencyIncrease = 15; - return CheckRecipeResultRegistry.GENERATING; - } - } - - this.lEUt = 0; - this.mEfficiency = 0; - return CheckRecipeResultRegistry.NO_FUEL_FOUND; - } - - @Override - public IStructureDefinition<GregtechMetaTileEntity_LargeSemifluidGenerator> getStructureDefinition() { - if (STRUCTURE_DEFINITION == null) { - STRUCTURE_DEFINITION = StructureDefinition.<GregtechMetaTileEntity_LargeSemifluidGenerator>builder() - .addShape( - mName, - transpose( - new String[][] { { "III", "CCC", "CCC", "CCC" }, { "I~I", "CGC", "CGC", "CMC" }, - { "III", "CCC", "CCC", "CCC" }, })) - .addElement( - 'C', - buildHatchAdder(GregtechMetaTileEntity_LargeSemifluidGenerator.class) - .atLeast(Muffler, InputHatch, Maintenance) - .casingIndex(getCasingTextureIndex()) - .dot(1) - .buildAndChain(onElementPass(x -> ++x.mCasing, ofBlock(getCasingBlock(), getCasingMeta())))) - .addElement('G', ofBlock(getGearboxBlock(), getGearboxMeta())) - .addElement('I', ofBlock(getIntakeBlock(), getIntakeMeta())) - .addElement( - 'M', - Dynamo.or(TTDynamo) - .newAny(getCasingTextureIndex(), 2)) - .build(); - } - return STRUCTURE_DEFINITION; - } - - @Override - public void construct(ItemStack stackSize, boolean hintsOnly) { - buildPiece(mName, stackSize, hintsOnly, 1, 1, 0); - } - - @Override - public int survivalConstruct(ItemStack stackSize, int elementBudget, ISurvivalBuildEnvironment env) { - if (mMachine) return -1; - return survivialBuildPiece(mName, stackSize, 1, 1, 0, elementBudget, env, false, true); - } - - @Override - public boolean checkMachine(IGregTechTileEntity aBaseMetaTileEntity, ItemStack aStack) { - mCasing = 0; - mDynamoHatches.clear(); - return checkPiece(mName, 1, 1, 0) && mCasing >= 16 && checkHatch(); - } - - public final boolean addLargeSemifluidGeneratorList(IGregTechTileEntity aTileEntity, int aBaseCasingIndex) { - if (aTileEntity == null) { - return false; - } else { - IMetaTileEntity aMetaTileEntity = aTileEntity.getMetaTileEntity(); - if (aMetaTileEntity instanceof GT_MetaTileEntity_Hatch_Maintenance) { - return addToMachineList(aTileEntity, aBaseCasingIndex); - } else if (aMetaTileEntity instanceof GT_MetaTileEntity_Hatch_Muffler) { - return addToMachineList(aTileEntity, aBaseCasingIndex); - } else if (aMetaTileEntity instanceof GT_MetaTileEntity_Hatch_Input) { - return addToMachineList(aTileEntity, aBaseCasingIndex); - } - } - return false; - } - - public final boolean addLargeSemifluidGeneratorBackList(IGregTechTileEntity aTileEntity, int aBaseCasingIndex) { - if (aTileEntity == null) { - return false; - } else { - IMetaTileEntity aMetaTileEntity = aTileEntity.getMetaTileEntity(); - if (aMetaTileEntity instanceof GT_MetaTileEntity_Hatch_Dynamo || this.isThisHatchMultiDynamo(aTileEntity)) { - return addToMachineList(aTileEntity, aBaseCasingIndex); - } - } - return false; - } - - public Block getCasingBlock() { - return GregTech_API.sBlockCasings4; - } - - public byte getCasingMeta() { - return 2; - } - - public Block getIntakeBlock() { - return GregTech_API.sBlockCasings4; - } - - public byte getIntakeMeta() { - return 13; - } - - public Block getGearboxBlock() { - return GregTech_API.sBlockCasings2; - } - - public byte getGearboxMeta() { - return 3; - } - - public byte getCasingTextureIndex() { - return 50; - } - - @Override - public IMetaTileEntity newMetaEntity(IGregTechTileEntity aTileEntity) { - return new GregtechMetaTileEntity_LargeSemifluidGenerator(this.mName); - } - - @Override - public void saveNBTData(NBTTagCompound aNBT) { - super.saveNBTData(aNBT); - } - - @Override - public void loadNBTData(NBTTagCompound aNBT) { - super.loadNBTData(aNBT); - } - - @Override - public int getDamageToComponent(ItemStack aStack) { - return 1; - } - - @Override - public int getMaxEfficiency(ItemStack aStack) { - return boostEu ? 15000 : 10000; - } - - @Override - public int getPollutionPerSecond(ItemStack aStack) { - return CORE.ConfigSwitches.pollutionPerSecondMultiLargeSemiFluidGenerator; - } - - @Override - public boolean explodesOnComponentBreak(ItemStack aStack) { - return true; - } - - @Override - public String[] getExtraInfoData() { - return new String[] { "Large Semifluid Generator", "Current Output: " + lEUt * mEfficiency / 10000 + " EU/t", - "Fuel Consumption: " + fuelConsumption + "L/t", "Fuel Value: " + fuelValue + " EU/L", - "Fuel Remaining: " + fuelRemaining + " Litres", "Current Efficiency: " + (mEfficiency / 100) + "%", - getIdealStatus() == getRepairStatus() ? "No Maintainance issues" : "Needs Maintainance" }; - } - - @Override - public boolean isGivingInformation() { - return true; - } - - @Override - public String getMachineType() { - return "Semifluid Generator"; - } - - @Override - public int getMaxParallelRecipes() { - return 0; - } - -} diff --git a/gtpp/src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/production/GregtechMetaTileEntity_MassFabricator.java b/gtpp/src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/production/GregtechMetaTileEntity_MassFabricator.java deleted file mode 100644 index 69042b7982..0000000000 --- a/gtpp/src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/production/GregtechMetaTileEntity_MassFabricator.java +++ /dev/null @@ -1,337 +0,0 @@ -package gtPlusPlus.xmod.gregtech.common.tileentities.machines.multi.production; - -import static com.gtnewhorizon.structurelib.structure.StructureUtility.ofBlock; -import static com.gtnewhorizon.structurelib.structure.StructureUtility.onElementPass; -import static com.gtnewhorizon.structurelib.structure.StructureUtility.transpose; -import static gregtech.api.enums.GT_HatchElement.Energy; -import static gregtech.api.enums.GT_HatchElement.InputBus; -import static gregtech.api.enums.GT_HatchElement.InputHatch; -import static gregtech.api.enums.GT_HatchElement.Maintenance; -import static gregtech.api.enums.GT_HatchElement.Muffler; -import static gregtech.api.enums.GT_HatchElement.OutputBus; -import static gregtech.api.enums.GT_HatchElement.OutputHatch; -import static gregtech.api.util.GT_StructureUtility.buildHatchAdder; - -import java.util.Arrays; -import java.util.Collection; -import java.util.stream.Stream; - -import javax.annotation.Nonnull; -import javax.annotation.Nullable; - -import net.minecraft.entity.player.EntityPlayer; -import net.minecraft.item.ItemStack; -import net.minecraft.nbt.NBTTagCompound; -import net.minecraftforge.common.util.ForgeDirection; -import net.minecraftforge.fluids.FluidStack; - -import org.jetbrains.annotations.NotNull; - -import com.gtnewhorizon.structurelib.alignment.constructable.ISurvivalConstructable; -import com.gtnewhorizon.structurelib.structure.IStructureDefinition; -import com.gtnewhorizon.structurelib.structure.ISurvivalBuildEnvironment; -import com.gtnewhorizon.structurelib.structure.StructureDefinition; - -import gregtech.api.enums.ConfigCategories; -import gregtech.api.enums.Materials; -import gregtech.api.enums.TAE; -import gregtech.api.interfaces.IIconContainer; -import gregtech.api.interfaces.metatileentity.IMetaTileEntity; -import gregtech.api.interfaces.tileentity.IGregTechTileEntity; -import gregtech.api.logic.ProcessingLogic; -import gregtech.api.recipe.RecipeMap; -import gregtech.api.recipe.RecipeMaps; -import gregtech.api.recipe.check.CheckRecipeResult; -import gregtech.api.recipe.check.CheckRecipeResultRegistry; -import gregtech.api.recipe.check.SimpleCheckRecipeResult; -import gregtech.api.util.GT_Config; -import gregtech.api.util.GT_ModHandler; -import gregtech.api.util.GT_Multiblock_Tooltip_Builder; -import gregtech.api.util.GT_Recipe; -import gregtech.api.util.GT_Utility; -import gtPlusPlus.api.recipe.GTPPRecipeMaps; -import gtPlusPlus.core.block.ModBlocks; -import gtPlusPlus.core.lib.CORE; -import gtPlusPlus.core.util.minecraft.ItemUtils; -import gtPlusPlus.core.util.minecraft.MaterialUtils; -import gtPlusPlus.core.util.minecraft.PlayerUtils; -import gtPlusPlus.xmod.gregtech.api.metatileentity.implementations.base.GregtechMeta_MultiBlockBase; -import gtPlusPlus.xmod.gregtech.common.blocks.textures.TexturesGtBlock; - -public class GregtechMetaTileEntity_MassFabricator - extends GregtechMeta_MultiBlockBase<GregtechMetaTileEntity_MassFabricator> implements ISurvivalConstructable { - - public static int sUUAperUUM = 1; - public static int sUUASpeedBonus = 4; - public static int sDurationMultiplier = 3200; - - public static String mCasingName1 = "Matter Fabricator Casing"; - public static String mCasingName2 = "Containment Casing"; - public static String mCasingName3 = "Matter Generation Coil"; - - private int mMode = 0; - - private static final int MODE_SCRAP = 1; - private static final int MODE_UU = 0; - - public static boolean sRequiresUUA = false; - private static final FluidStack[] mUU = new FluidStack[2]; - private static final ItemStack[] mScrap = new ItemStack[2]; - - private int mCasing; - private static IStructureDefinition<GregtechMetaTileEntity_MassFabricator> STRUCTURE_DEFINITION = null; - - public GregtechMetaTileEntity_MassFabricator(final int aID, final String aName, final String aNameRegional) { - super(aID, aName, aNameRegional); - } - - public GregtechMetaTileEntity_MassFabricator(final String aName) { - super(aName); - } - - @Override - public String getMachineType() { - return "Mass Fabricator / Recycler"; - } - - @Override - protected GT_Multiblock_Tooltip_Builder createTooltip() { - GT_Multiblock_Tooltip_Builder tt = new GT_Multiblock_Tooltip_Builder(); - tt.addMachineType(getMachineType()) - .addInfo("Controller Block for the Matter Fabricator") - .addInfo("Speed: +0% | EU Usage: 80%") - .addInfo("Parallel: Scrap = 64 | UU = 8 * Tier") - .addInfo("Produces UU-A, UU-M & Scrap") - .addInfo("Change mode with screwdriver") - .addPollutionAmount(getPollutionPerSecond(null)) - .addSeparator() - .beginStructureBlock(5, 4, 5, true) - .addController("Front Center") - .addCasingInfoMin(mCasingName3, 9, false) - .addCasingInfoMin(mCasingName2, 24, false) - .addCasingInfoMin(mCasingName1, 36, false) - .addInputBus("Any Casing", 1) - .addOutputBus("Any Casing", 1) - .addInputHatch("Any Casing", 1) - .addOutputHatch("Any Casing", 1) - .addEnergyHatch("Any Casing", 1) - .addMaintenanceHatch("Any Casing", 1) - .addMufflerHatch("Any Casing", 1) - .toolTipFinisher(CORE.GT_Tooltip_Builder.get()); - return tt; - } - - @Override - protected IIconContainer getActiveOverlay() { - return TexturesGtBlock.Overlay_MatterFab_Active_Animated; - } - - @Override - protected IIconContainer getInactiveOverlay() { - return TexturesGtBlock.Overlay_MatterFab_Animated; - } - - @Override - protected int getCasingTextureId() { - return TAE.GTPP_INDEX(9); - } - - @Override - public void onConfigLoad(final GT_Config aConfig) { - super.onConfigLoad(aConfig); - sDurationMultiplier = aConfig - .get(ConfigCategories.machineconfig, "Massfabricator.UUM_Duration_Multiplier", sDurationMultiplier); - sUUAperUUM = aConfig.get(ConfigCategories.machineconfig, "Massfabricator.UUA_per_UUM", sUUAperUUM); - sUUASpeedBonus = aConfig.get(ConfigCategories.machineconfig, "Massfabricator.UUA_Speed_Bonus", sUUASpeedBonus); - sRequiresUUA = aConfig.get(ConfigCategories.machineconfig, "Massfabricator.UUA_Requirement", sRequiresUUA); - // Materials.UUAmplifier.mChemicalFormula = ("Mass Fabricator Eff/Speed Bonus: x" + sUUASpeedBonus); - } - - public static boolean sInit = false; - - public static void init() { - if (!sInit) { - if (mScrap[0] == null) { - mScrap[0] = ItemUtils.getSimpleStack(ItemUtils.getItemFromFQRN("IC2:itemScrap")); - } - if (mScrap[1] == null) { - mScrap[1] = ItemUtils.getSimpleStack(ItemUtils.getItemFromFQRN("IC2:itemScrapbox")); - } - if (mUU[0] == null) { - mUU[0] = Materials.UUAmplifier.getFluid(100); - } - if (mUU[1] == null) { - mUU[1] = Materials.UUMatter.getFluid(100); - } - sInit = true; - } - } - - @Override - public IStructureDefinition<GregtechMetaTileEntity_MassFabricator> getStructureDefinition() { - if (STRUCTURE_DEFINITION == null) { - STRUCTURE_DEFINITION = StructureDefinition.<GregtechMetaTileEntity_MassFabricator>builder() - .addShape( - mName, - transpose( - new String[][] { { "CCCCC", "CCCCC", "CCCCC", "CCCCC", "CCCCC" }, - { "CGGGC", "G---G", "G---G", "G---G", "CGGGC" }, - { "CGGGC", "G---G", "G---G", "G---G", "CGGGC" }, - { "CC~CC", "CHHHC", "CHHHC", "CHHHC", "CCCCC" }, })) - .addElement( - 'C', - buildHatchAdder(GregtechMetaTileEntity_MassFabricator.class) - .atLeast(InputBus, OutputBus, InputHatch, OutputHatch, Maintenance, Energy, Muffler) - .casingIndex(TAE.GTPP_INDEX(9)) - .dot(1) - .buildAndChain(onElementPass(x -> ++x.mCasing, ofBlock(ModBlocks.blockCasingsMisc, 9)))) - .addElement('H', ofBlock(ModBlocks.blockCasingsMisc, 8)) - .addElement('G', ofBlock(ModBlocks.blockCasings3Misc, 15)) - .build(); - } - return STRUCTURE_DEFINITION; - } - - @Override - public void construct(ItemStack stackSize, boolean hintsOnly) { - buildPiece(mName, stackSize, hintsOnly, 2, 3, 0); - } - - @Override - public int survivalConstruct(ItemStack stackSize, int elementBudget, ISurvivalBuildEnvironment env) { - if (mMachine) return -1; - return survivialBuildPiece(mName, stackSize, 2, 3, 0, elementBudget, env, false, true); - } - - @Override - public boolean checkMachine(IGregTechTileEntity aBaseMetaTileEntity, ItemStack aStack) { - mCasing = 0; - return checkPiece(mName, 2, 3, 0) && mCasing >= 36 && checkHatch(); - } - - @Override - public int getMaxEfficiency(final ItemStack aStack) { - return 10000; - } - - @Override - public int getPollutionPerSecond(final ItemStack aStack) { - return CORE.ConfigSwitches.pollutionPerSecondMultiMassFabricator; - } - - @Override - public boolean explodesOnComponentBreak(final ItemStack aStack) { - return false; - } - - @Override - public IMetaTileEntity newMetaEntity(final IGregTechTileEntity aTileEntity) { - return new GregtechMetaTileEntity_MassFabricator(this.mName); - } - - /** - * Special Recipe Handling - */ - @Override - public RecipeMap<?> getRecipeMap() { - return this.mMode == MODE_SCRAP ? RecipeMaps.recyclerRecipes : GTPPRecipeMaps.multiblockMassFabricatorRecipes; - } - - @Nonnull - @Override - public Collection<RecipeMap<?>> getAvailableRecipeMaps() { - return Arrays.asList(RecipeMaps.recyclerRecipes, GTPPRecipeMaps.multiblockMassFabricatorRecipes); - } - - @Override - protected ProcessingLogic createProcessingLogic() { - return new ProcessingLogic() { - - @NotNull - @Override - public CheckRecipeResult process() { - init(); - return super.process(); - } - - @NotNull - @Override - protected CheckRecipeResult validateRecipe(@NotNull GT_Recipe recipe) { - if (mMode == MODE_SCRAP) { - if (recipe.mOutputs == null) { - return SimpleCheckRecipeResult.ofSuccess("no_scrap"); - } - } - return CheckRecipeResultRegistry.SUCCESSFUL; - } - - @Nonnull - @Override - protected Stream<GT_Recipe> findRecipeMatches(@Nullable RecipeMap<?> map) { - if (mMode == MODE_SCRAP) { - if (inputItems != null) { - for (ItemStack item : inputItems) { - if (item == null || item.stackSize == 0) continue; - ItemStack aPotentialOutput = GT_ModHandler - .getRecyclerOutput(GT_Utility.copyAmount(1, item), 0); - GT_Recipe recipe = new GT_Recipe( - false, - new ItemStack[] { GT_Utility.copyAmount(1, item) }, - aPotentialOutput == null ? null : new ItemStack[] { aPotentialOutput }, - null, - new int[] { 2000 }, - null, - null, - 40, - MaterialUtils.getVoltageForTier(1), - 0); - return Stream.of(recipe); - } - } - return Stream.empty(); - } - return super.findRecipeMatches(map); - } - }.setEuModifier(0.8F) - .setMaxParallelSupplier(this::getMaxParallelRecipes); - } - - @Override - protected void setupProcessingLogic(ProcessingLogic logic) { - super.setupProcessingLogic(logic); - logic.enablePerfectOverclock(); - } - - @Override - public int getMaxParallelRecipes() { - return this.mMode == MODE_SCRAP ? 64 : 8 * (Math.max(1, GT_Utility.getTier(getMaxInputVoltage()))); - } - - @Override - public void onModeChangeByScrewdriver(ForgeDirection side, EntityPlayer aPlayer, float aX, float aY, float aZ) { - int aMode = this.mMode + 1; - if (aMode > 1) { - this.mMode = MODE_UU; - PlayerUtils.messagePlayer(aPlayer, "Mode [" + this.mMode + "]: Matter/AmpliFabricator"); - } else if (aMode == 1) { - this.mMode = MODE_SCRAP; - PlayerUtils.messagePlayer(aPlayer, "Mode [" + this.mMode + "]: Recycler"); - } else { - this.mMode = MODE_SCRAP; - PlayerUtils.messagePlayer(aPlayer, "Mode [" + this.mMode + "]: Recycler"); - } - mLastRecipe = null; - } - - @Override - public void saveNBTData(NBTTagCompound aNBT) { - aNBT.setInteger("mMode", mMode); - super.saveNBTData(aNBT); - } - - @Override - public void loadNBTData(NBTTagCompound aNBT) { - mMode = aNBT.getInteger("mMode"); - super.loadNBTData(aNBT); - } -} diff --git a/gtpp/src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/production/GregtechMetaTileEntity_QuantumForceTransformer.java b/gtpp/src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/production/GregtechMetaTileEntity_QuantumForceTransformer.java deleted file mode 100644 index bd5e579cd2..0000000000 --- a/gtpp/src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/production/GregtechMetaTileEntity_QuantumForceTransformer.java +++ /dev/null @@ -1,939 +0,0 @@ -package gtPlusPlus.xmod.gregtech.common.tileentities.machines.multi.production; - -import static com.gtnewhorizon.structurelib.structure.StructureUtility.lazy; -import static com.gtnewhorizon.structurelib.structure.StructureUtility.ofBlock; -import static com.gtnewhorizon.structurelib.structure.StructureUtility.onElementPass; -import static com.gtnewhorizon.structurelib.structure.StructureUtility.withChannel; -import static gregtech.api.enums.GT_HatchElement.Energy; -import static gregtech.api.enums.GT_HatchElement.ExoticEnergy; -import static gregtech.api.enums.GT_HatchElement.InputBus; -import static gregtech.api.enums.GT_HatchElement.InputHatch; -import static gregtech.api.enums.GT_HatchElement.Maintenance; -import static gregtech.api.enums.GT_HatchElement.OutputBus; -import static gregtech.api.enums.GT_HatchElement.OutputHatch; -import static gregtech.api.util.GT_OreDictUnificator.getAssociation; -import static gregtech.api.util.GT_ParallelHelper.addFluidsLong; -import static gregtech.api.util.GT_ParallelHelper.addItemsLong; -import static gregtech.api.util.GT_ParallelHelper.calculateChancedOutputMultiplier; -import static gregtech.api.util.GT_RecipeBuilder.BUCKETS; -import static gregtech.api.util.GT_RecipeBuilder.INGOTS; -import static gregtech.api.util.GT_StructureUtility.buildHatchAdder; - -import java.util.ArrayList; -import java.util.Arrays; -import java.util.List; - -import javax.annotation.Nonnull; - -import net.minecraft.block.Block; -import net.minecraft.client.renderer.RenderBlocks; -import net.minecraft.client.renderer.Tessellator; -import net.minecraft.entity.player.EntityPlayer; -import net.minecraft.item.ItemStack; -import net.minecraft.nbt.NBTTagCompound; -import net.minecraft.util.EnumChatFormatting; -import net.minecraft.util.IIcon; -import net.minecraft.util.StatCollector; -import net.minecraft.world.IBlockAccess; -import net.minecraftforge.common.util.ForgeDirection; -import net.minecraftforge.fluids.Fluid; -import net.minecraftforge.fluids.FluidStack; - -import org.apache.commons.lang3.tuple.Pair; -import org.jetbrains.annotations.NotNull; - -import com.gtnewhorizon.structurelib.alignment.constructable.ISurvivalConstructable; -import com.gtnewhorizon.structurelib.structure.IStructureDefinition; -import com.gtnewhorizon.structurelib.structure.ISurvivalBuildEnvironment; -import com.gtnewhorizon.structurelib.structure.ITierConverter; -import com.gtnewhorizon.structurelib.structure.StructureDefinition; -import com.gtnewhorizon.structurelib.structure.StructureUtility; - -import cpw.mods.fml.relauncher.Side; -import cpw.mods.fml.relauncher.SideOnly; -import gregtech.api.enums.GT_Values; -import gregtech.api.enums.Materials; -import gregtech.api.enums.TAE; -import gregtech.api.enums.Textures; -import gregtech.api.interfaces.IIconContainer; -import gregtech.api.interfaces.ITexture; -import gregtech.api.interfaces.metatileentity.IMetaTileEntity; -import gregtech.api.interfaces.tileentity.IGregTechTileEntity; -import gregtech.api.logic.ProcessingLogic; -import gregtech.api.metatileentity.implementations.GT_MetaTileEntity_ExtendedPowerMultiBlockBase; -import gregtech.api.metatileentity.implementations.GT_MetaTileEntity_Hatch; -import gregtech.api.metatileentity.implementations.GT_MetaTileEntity_Hatch_Input; -import gregtech.api.objects.ItemData; -import gregtech.api.recipe.RecipeMap; -import gregtech.api.recipe.check.CheckRecipeResult; -import gregtech.api.recipe.check.CheckRecipeResultRegistry; -import gregtech.api.recipe.check.SimpleCheckRecipeResult; -import gregtech.api.render.TextureFactory; -import gregtech.api.util.GT_Multiblock_Tooltip_Builder; -import gregtech.api.util.GT_ParallelHelper; -import gregtech.api.util.GT_Recipe; -import gregtech.api.util.GT_Utility; -import gregtech.api.util.shutdown.ShutDownReasonRegistry; -import gtPlusPlus.api.recipe.GTPPRecipeMaps; -import gtPlusPlus.core.block.ModBlocks; -import gtPlusPlus.core.material.ELEMENT; -import gtPlusPlus.core.util.minecraft.ItemUtils; -import gtPlusPlus.xmod.gregtech.common.blocks.textures.TexturesGtBlock; - -@SuppressWarnings("SpellCheckingInspection") -public class GregtechMetaTileEntity_QuantumForceTransformer - extends GT_MetaTileEntity_ExtendedPowerMultiBlockBase<GregtechMetaTileEntity_QuantumForceTransformer> - implements ISurvivalConstructable { - - private int mCasing; - protected int mCraftingTier = 0; - protected int mFocusingTier = 0; - protected int mMaxParallel = 0; - private boolean mFluidMode = false, doFermium = false, doNeptunium = false; - private static final Fluid mNeptunium = ELEMENT.getInstance().NEPTUNIUM.getPlasma(); - private static final Fluid mFermium = ELEMENT.getInstance().FERMIUM.getPlasma(); - private static final String MAIN_PIECE = "main"; - private GT_MetaTileEntity_Hatch_Input mNeptuniumHatch; - private GT_MetaTileEntity_Hatch_Input mFermiumHatch; - private static final IStructureDefinition<GregtechMetaTileEntity_QuantumForceTransformer> STRUCTURE_DEFINITION = StructureDefinition - .<GregtechMetaTileEntity_QuantumForceTransformer>builder() - .addShape( - MAIN_PIECE, - new String[][] { // A - 142, B - 234, C - 177, D - 96, E - 224, H - 36, M - 21 - { " ", " ", " ", " ", " ", - " ", " ", " ", " ", " ", - " ", " ", " ", " BAB ", " BBBBABBBB ", - " BAAAAAAAB ", " BABBABBAB ", " BA AB ", " A A ", " A A ", - " A A " }, - { " ", " ", " ", " ", " ", - " ", " ", " ", " ", " ", - " ", " ", " BAB ", " AAABBBAAA ", " BAAAAAAAAAB ", - " B B ", " A A ", " A A ", " ", " ", - " " }, - { " ", " ", " ", " ", " ", - " ", " ", " ", " ", " ", - " ", " BAB ", " AA AA ", " AA AA ", " BAA AAB ", - " B B ", " A A ", " A A ", " ", " ", - " " }, - { " ", " ", " ", " ", " ", - " ", " ", " ", " ", " ", - " ", " BAAAB ", " AA AA ", " AA AA ", "BAA AAB", - "B B", "A A", "A A", "A A", "A A", - "A A" }, - { " TTT ", " EEE ", " EEE ", " EEE ", " DDD ", - " EEE ", " DDD ", " EEE ", " EEE ", " EEE ", - " DDD ", " BAEEEAB ", " AA EEE AA ", " A EEE A ", "BA DDD AB", - "B EEE B", "B DDD B", " EEE ", " EEE ", " EEE ", - " Z~X " }, - { " TTTTT ", " ECCCE ", " ECCCE ", " ECCCE ", " D D ", - " ECCCE ", " D D ", " ECCCE ", " ECCCE ", " ECCCE ", - " D D ", " BAECCCEAB ", " A ECCCE A ", " A ECCCE A ", "BA D D AB", - "B ECCCE B", "B D D B", "B ECCCE B", " ECCCE ", " ECCCE ", - " HHHHH " }, - { " TTTTTTT ", " ECCCCCE ", " EC CE ", " EC CE ", " D D ", - " EC CE ", " D D ", " EC CE ", " EC CE ", " EC CE ", - " D D ", " BAEC CEAB ", " B EC CE B ", "BB EC CE BB", "BA D D AB", - "A EC CE A", "A D D A", "A EC CE A", " EC CE ", " EC CE ", - " HHHHHHH " }, - { " TTTTTTT ", " ECCCCCE ", " EC CE ", " EC CE ", " D D ", - " EC CE ", " D D ", " EC CE ", " EC CE ", " EC CE ", - " D D ", " AAEC CEAA ", " A EC CE A ", "AB EC CE BA", "AA D D AA", - "A EC CE A", "A D D A", " EC CE ", " EC CE ", " EC CE ", - " HHHHHHH " }, - { " TTTTTTT ", " ECCCCCE ", " EC CE ", " EC CE ", " D D ", - " EC CE ", " D D ", " EC CE ", " EC CE ", " EC CE ", - " D D ", " BAEC CEAB ", " B EC CE B ", "BB EC CE BB", "BA D D AB", - "A EC CE A", "A D D A", "A EC CE A", " EC CE ", " EC CE ", - " HHHHHHH " }, - { " TTTTT ", " ECCCE ", " ECCCE ", " ECCCE ", " D D ", - " ECCCE ", " D D ", " ECCCE ", " ECCCE ", " ECCCE ", - " D D ", " BAECCCEAB ", " A ECCCE A ", " A ECCCE A ", "BA D D AB", - "B ECCCE B", "B D D B", "B ECCCE B", " ECCCE ", " ECCCE ", - " HHHHH " }, - { " TTT ", " EEE ", " EEE ", " EEE ", " DDD ", - " EEE ", " DDD ", " EEE ", " EEE ", " EEE ", - " DDD ", " BAEEEAB ", " AA EEE AA ", " A EEE A ", "BA DDD AB", - "B EEE B", "B DDD B", " EEE ", " EEE ", " EEE ", - " HHH " }, - { " ", " ", " ", " ", " ", - " ", " ", " ", " ", " ", - " ", " BAAAB ", " AA AA ", " AA AA ", "BAA AAB", - "B B", "A A", "A A", "A A", "A A", - "A A" }, - { " ", " ", " ", " ", " ", - " ", " ", " ", " ", " ", - " ", " BAB ", " AA AA ", " AA AA ", " BAA AAB ", - " B B ", " A A ", " A A ", " ", " ", - " " }, - { " ", " ", " ", " ", " ", - " ", " ", " ", " ", " ", - " ", " ", " BAB ", " AAABBBAAA ", " BAAAAAAAAAB ", - " B B ", " A A ", " A A ", " ", " ", - " " }, - { " ", " ", " ", " ", " ", - " ", " ", " ", " ", " ", - " ", " ", " ", " BAB ", " BBBBABBBB ", - " BBBAAABBB ", " ABBAAABBA ", " A BA AB A ", " A A ", " A A ", - " A A " }, }) - .addElement( - 'A', - withChannel( - "manipulator", - StructureUtility.ofBlocksTiered( - craftingTierConverter(), - getAllCraftingTiers(), - 0, - GregtechMetaTileEntity_QuantumForceTransformer::setCraftingTier, - GregtechMetaTileEntity_QuantumForceTransformer::getCraftingTier))) - .addElement( - 'B', - withChannel( - "shielding", - StructureUtility.ofBlocksTiered( - focusingTierConverter(), - getAllFocusingTiers(), - 0, - GregtechMetaTileEntity_QuantumForceTransformer::setFocusingTier, - GregtechMetaTileEntity_QuantumForceTransformer::getFocusingTier))) - .addElement('C', ofBlock(ModBlocks.blockCasings4Misc, 4)) - .addElement('D', ofBlock(ModBlocks.blockCasings2Misc, 12)) - .addElement('E', lazy(t -> ofBlock(t.getCasingBlock1(), t.getCasingMeta1()))) - .addElement( - 'H', - buildHatchAdder(GregtechMetaTileEntity_QuantumForceTransformer.class) - .atLeast(InputBus, InputHatch, Maintenance, Energy.or(ExoticEnergy)) - .casingIndex(TAE.getIndexFromPage(0, 10)) - .dot(4) - .buildAndChain(onElementPass(x -> ++x.mCasing, ofBlock(ModBlocks.blockCasings2Misc, 12)))) - .addElement( - 'T', - buildHatchAdder(GregtechMetaTileEntity_QuantumForceTransformer.class) - .atLeast(OutputBus, OutputHatch, Maintenance) - .casingIndex(TAE.getIndexFromPage(0, 10)) - .dot(5) - .buildAndChain(onElementPass(x -> ++x.mCasing, ofBlock(ModBlocks.blockCasings2Misc, 12)))) - .addElement( - 'Z', - buildHatchAdder(GregtechMetaTileEntity_QuantumForceTransformer.class) - .hatchClass(GT_MetaTileEntity_Hatch_Input.class) - .adder(GregtechMetaTileEntity_QuantumForceTransformer::addNeptuniumHatch) - .casingIndex(TAE.getIndexFromPage(0, 10)) - .dot(5) - .buildAndChain(onElementPass(x -> ++x.mCasing, ofBlock(ModBlocks.blockCasings2Misc, 12)))) - .addElement( - 'X', - buildHatchAdder(GregtechMetaTileEntity_QuantumForceTransformer.class) - .hatchClass(GT_MetaTileEntity_Hatch_Input.class) - .adder(GregtechMetaTileEntity_QuantumForceTransformer::addFermiumHatch) - .casingIndex(TAE.getIndexFromPage(0, 10)) - .dot(5) - .buildAndChain(onElementPass(x -> ++x.mCasing, ofBlock(ModBlocks.blockCasings2Misc, 12)))) - .build(); - - public GregtechMetaTileEntity_QuantumForceTransformer(final int aID, final String aName, - final String aNameRegional) { - super(aID, aName, aNameRegional); - } - - public GregtechMetaTileEntity_QuantumForceTransformer(final String aName) { - super(aName); - } - - @Override - public IMetaTileEntity newMetaEntity(final IGregTechTileEntity aTileEntity) { - return new GregtechMetaTileEntity_QuantumForceTransformer(this.mName); - } - - @Override - protected GT_Multiblock_Tooltip_Builder createTooltip() { - GT_Multiblock_Tooltip_Builder tt = new GT_Multiblock_Tooltip_Builder(); - tt.addMachineType("Quantum Force Transformer") - .addInfo("Controller Block for the Quantum Force Transformer") - .addInfo("Allows Complex chemical lines to be performed instantly in one step") - .addInfo("Every recipe requires a catalyst, each catalyst adds 1 parallel and lasts forever") - .addInfo("Accepts TecTech Energy and Laser Hatches") - .addInfo("All inputs go on the bottom, all outputs go on the top") - .addInfo("Put a circuit in the controller to specify the focused output") - .addInfo("Check NEI to see the order of outputs, and which circuit number you need.") - .addInfo("If separate input busses are enabled put the circuit in the circuit slot of the bus") - .addInfo("Uses FocusTier*4*sqrt(parallels) Neptunium Plasma if focusing") - .addInfo("Can use FocusTier*4*sqrt(parallels) Fermium Plasma for additional chance output") - .addInfo("Use a screwdriver to enable Fluid mode") - .addInfo( - "Fluid mode turns all possible outputs into their fluid variant, those which can't are left as they were.") - .addInfo("This multi gets improved when all casings of some types are upgraded") - .addInfo("Casing functions:") - .addInfo("Pulse Manipulators: Recipe Tier Allowed (check NEI for the tier of each recipe)") - .addInfo("Shielding Cores: Focusing Tier (equal to or higher than recipe tier to allow focus)") - .addPollutionAmount(getPollutionPerSecond(null)) - .addSeparator() - .beginStructureBlock(15, 21, 15, true) - .addController("Bottom Center") - .addCasingInfoMin("Bulk Production Frame", 80, false) - .addCasingInfoMin("Quantum Force Conductor", 177, false) - .addCasingInfoMin("Force Field Glass", 224, false) - .addCasingInfoMin("Pulse Manipulators", 236, true) - .addCasingInfoMin("Shielding Cores", 142, true) - .addInputBus(EnumChatFormatting.BLUE + "Bottom" + EnumChatFormatting.GRAY + " Layer", 4) - .addInputHatch(EnumChatFormatting.BLUE + "Bottom" + EnumChatFormatting.GRAY + " Layer", 4) - .addOutputHatch(EnumChatFormatting.AQUA + "Top" + EnumChatFormatting.GRAY + " Layer", 5) - .addOutputBus(EnumChatFormatting.AQUA + "Top" + EnumChatFormatting.GRAY + " Layer", 5) - .addEnergyHatch(EnumChatFormatting.BLUE + "Bottom" + EnumChatFormatting.GRAY + " Layer", 4) - .addMaintenanceHatch( - EnumChatFormatting.BLUE + "Bottom" - + EnumChatFormatting.GRAY - + " or " - + EnumChatFormatting.AQUA - + "Top" - + EnumChatFormatting.GRAY - + " Layer", - 4, - 5) - .addStructureInfo( - EnumChatFormatting.WHITE + "Neptunium Plasma Hatch: " - + EnumChatFormatting.GREEN - + "Left" - + EnumChatFormatting.GRAY - + " side of Controller") - .addStructureInfo( - EnumChatFormatting.WHITE + "Fermium Plasma Hatch: " - + EnumChatFormatting.DARK_GREEN - + "Right" - + EnumChatFormatting.GRAY - + " side of Controller") - .toolTipFinisher( - GT_Values.AuthorBlueWeabo + EnumChatFormatting.RESET - + EnumChatFormatting.GREEN - + " + Steelux" - + EnumChatFormatting.RESET - + " - [GT++]"); - return tt; - } - - @Override - public IStructureDefinition<GregtechMetaTileEntity_QuantumForceTransformer> getStructureDefinition() { - return STRUCTURE_DEFINITION; - } - - @Override - public boolean checkMachine(IGregTechTileEntity aBaseMetaTileEntity, ItemStack aStack) { - this.mCasing = 0; - this.mCraftingTier = 0; - this.mFocusingTier = 0; - if (!checkPiece(MAIN_PIECE, 7, 20, 4)) { - return false; - } - - if (mMaintenanceHatches.size() != 1 || mOutputBusses.isEmpty() || mOutputHatches.isEmpty()) { - return false; - } - - return checkExoticAndNormalEnergyHatches(); - } - - @Override - public void construct(ItemStack stackSize, boolean hintsOnly) { - buildPiece(MAIN_PIECE, stackSize, hintsOnly, 7, 20, 4); - } - - @Override - public int survivalConstruct(ItemStack stackSize, int elementBudget, ISurvivalBuildEnvironment env) { - if (mMachine) return -1; - return survivialBuildPiece(MAIN_PIECE, stackSize, 7, 20, 4, elementBudget, env, false, true); - } - - public static List<Pair<Block, Integer>> getAllCraftingTiers() { - return new ArrayList<>() { - - { - add(Pair.of(ModBlocks.blockCasings5Misc, 7)); - add(Pair.of(ModBlocks.blockCasings5Misc, 8)); - add(Pair.of(ModBlocks.blockCasings5Misc, 9)); - add(Pair.of(ModBlocks.blockCasings5Misc, 10)); - } - }; - } - - public static List<Pair<Block, Integer>> getAllFocusingTiers() { - return new ArrayList<>() { - - { - add(Pair.of(ModBlocks.blockCasings5Misc, 11)); - add(Pair.of(ModBlocks.blockCasings5Misc, 12)); - add(Pair.of(ModBlocks.blockCasings5Misc, 13)); - add(Pair.of(ModBlocks.blockCasings5Misc, 14)); - } - }; - } - - public static ITierConverter<Integer> craftingTierConverter() { - return (block, meta) -> { - if (block == null) { - return -1; - } else if (block == ModBlocks.blockCasings5Misc) { // Resonance Chambers - switch (meta) { - case 7 -> { - return 1; - } - case 8 -> { - return 2; - } - case 9 -> { - return 3; - } - case 10 -> { - return 4; - } - } - } - return -1; - }; - } - - public static ITierConverter<Integer> focusingTierConverter() { - return (block, meta) -> { - if (block == null) { - return -1; - } else if (block == ModBlocks.blockCasings5Misc) { // Generation Coils - switch (meta) { - case 11 -> { - return 1; - } - case 12 -> { - return 2; - } - case 13 -> { - return 3; - } - case 14 -> { - return 4; - } - } - } - return -1; - }; - } - - private void setCraftingTier(int tier) { - mCraftingTier = tier; - } - - private void setFocusingTier(int tier) { - mFocusingTier = tier; - } - - private int getCraftingTier() { - return mCraftingTier; - } - - private int getFocusingTier() { - return mFocusingTier; - } - - protected IIconContainer getActiveOverlay() { - return TexturesGtBlock.Overlay_Machine_Controller_Advanced_Active; - } - - protected IIconContainer getInactiveOverlay() { - return TexturesGtBlock.Overlay_Machine_Controller_Advanced; - } - - protected int getCasingTextureId() { - return TAE.getIndexFromPage(0, 10); - } - - @Override - public RecipeMap<?> getRecipeMap() { - return GTPPRecipeMaps.quantumForceTransformerRecipes; - } - - @Override - public boolean isCorrectMachinePart(final ItemStack aStack) { - return true; - } - - @Override - protected ProcessingLogic createProcessingLogic() { - return new ProcessingLogic() { - - private int[] chances; - private FluidStack[] fluidModeItems; - - @NotNull - @Override - protected CheckRecipeResult validateRecipe(@NotNull GT_Recipe recipe) { - if (recipe.mSpecialValue > getCraftingTier()) { - return CheckRecipeResultRegistry.insufficientMachineTier(recipe.mSpecialValue); - } - ItemStack catalyst = null; - for (ItemStack item : recipe.mInputs) { - if (ItemUtils.isCatalyst(item)) { - catalyst = item; - break; - } - } - - if (catalyst == null) { - return SimpleCheckRecipeResult.ofFailure("no_catalyst"); - } - - maxParallel = 0; - for (ItemStack item : inputItems) { - if (ItemUtils.isCatalyst(item) && item.isItemEqual(catalyst)) { - maxParallel += item.stackSize; - } - } - - mMaxParallel = maxParallel; - doFermium = false; - doNeptunium = false; - - if (recipe.mSpecialValue <= getFocusingTier()) { - if (drain(mFermiumHatch, new FluidStack(mFermium, 1), false)) { - doFermium = true; - } - if (drain(mNeptuniumHatch, new FluidStack(mNeptunium, 1), false)) { - doNeptunium = true; - } - } - - chances = getOutputChances(recipe, doNeptunium ? findProgrammedCircuitNumber() : -1); - - // Handle Fluid Mode. Add fluid that item can be turned into to fluidModeItems. - // null if Fluid Mode is disabled or item cannot be turned into fluid. - fluidModeItems = new FluidStack[recipe.mOutputs.length]; - if (mFluidMode) { - for (int i = 0; i < recipe.mOutputs.length; i++) { - ItemStack item = recipe.getOutput(i); - if (item == null) continue; - ItemData data = getAssociation(item); - Materials mat = data == null ? null : data.mMaterial.mMaterial; - if (mat != null) { - if (mat.mStandardMoltenFluid != null) { - fluidModeItems[i] = mat.getMolten(INGOTS); - } else if (mat.mFluid != null) { - fluidModeItems[i] = mat.getFluid(BUCKETS); - } - } - } - } - - return CheckRecipeResultRegistry.SUCCESSFUL; - } - - @NotNull - @Override - public GT_ParallelHelper createParallelHelper(@Nonnull GT_Recipe recipe) { - return super.createParallelHelper(recipe).setCustomItemOutputCalculation(parallel -> { - ArrayList<ItemStack> items = new ArrayList<>(); - - for (int i = 0; i < recipe.mOutputs.length; i++) { - ItemStack item = recipe.getOutput(i); - if (item == null || fluidModeItems[i] != null) continue; - ItemStack itemToAdd = item.copy(); - double outputMultiplier = calculateChancedOutputMultiplier(chances[i], parallel); - long itemAmount = (long) (item.stackSize * outputMultiplier); - addItemsLong(items, itemToAdd, itemAmount); - } - - return items.toArray(new ItemStack[0]); - }) - .setCustomFluidOutputCalculation(parallel -> { - ArrayList<FluidStack> fluids = new ArrayList<>(); - - if (mFluidMode) { - for (int i = 0; i < recipe.mOutputs.length; i++) { - FluidStack fluid = fluidModeItems[i]; - if (fluid == null) continue; - FluidStack fluidToAdd = fluid.copy(); - double outputMultiplier = calculateChancedOutputMultiplier(chances[i], parallel); - int itemAmount = recipe.mOutputs[i].stackSize; - long fluidAmount = (long) (fluidToAdd.amount * outputMultiplier * itemAmount); - addFluidsLong(fluids, fluidToAdd, fluidAmount); - } - } - - for (int i = 0; i < recipe.mFluidOutputs.length; i++) { - FluidStack fluid = recipe.getFluidOutput(i); - if (fluid == null) continue; - FluidStack fluidToAdd = fluid.copy(); - double outputMultiplier = calculateChancedOutputMultiplier( - chances[i + recipe.mOutputs.length], - parallel); - long fluidAmount = (long) (fluidToAdd.amount * outputMultiplier); - addFluidsLong(fluids, fluidToAdd, fluidAmount); - } - - return fluids.toArray(new FluidStack[0]); - }); - } - - private int findProgrammedCircuitNumber() { - if (isInputSeparationEnabled()) { - for (ItemStack stack : inputItems) { - if (GT_Utility.isAnyIntegratedCircuit(stack)) { - return stack.getItemDamage() - 1; - } - } - return -1; - } else { - final ItemStack controllerStack = getControllerSlot(); - return GT_Utility.isAnyIntegratedCircuit(controllerStack) ? controllerStack.getItemDamage() - 1 - : -1; - } - } - }; - } - - @Override - protected void setProcessingLogicPower(ProcessingLogic logic) { - logic.setAvailableVoltage(getAverageInputVoltage()); - logic.setAvailableAmperage(getMaxInputAmps()); - } - - private byte runningTick = 0; - - @Override - public boolean onRunningTick(ItemStack aStack) { - if (!super.onRunningTick(aStack)) { - return false; - } - - if (runningTick % 20 == 0) { - int amount = (int) (getFocusingTier() * 4 - * Math.sqrt(Math.min(mMaxParallel, processingLogic.getCurrentParallels()))); - if (doFermium) { - FluidStack fermiumToConsume = new FluidStack(mFermium, amount); - if (!drain(mFermiumHatch, fermiumToConsume, true)) { - doFermium = false; - stopMachine(ShutDownReasonRegistry.outOfFluid(fermiumToConsume)); - return false; - } - } - - if (doNeptunium) { - FluidStack neptuniumToConsume = new FluidStack(mNeptunium, amount); - if (!drain(mNeptuniumHatch, neptuniumToConsume, true)) { - doNeptunium = false; - stopMachine(ShutDownReasonRegistry.outOfFluid(neptuniumToConsume)); - return false; - } - } - - runningTick = 1; - } else { - runningTick++; - } - - return true; - } - - @Override - public void onPostTick(IGregTechTileEntity aBaseMetaTileEntity, long aTick) { - super.onPostTick(aBaseMetaTileEntity, aTick); - if (aBaseMetaTileEntity.isServerSide()) { - // TODO: Look for proper fix - // Updates every 30 sec - if (mUpdate <= -550) mUpdate = 50; - } - } - - @Override - public int getMaxEfficiency(final ItemStack aStack) { - return 10000; - } - - @Override - public int getPollutionPerSecond(final ItemStack aStack) { - return 0; - } - - @Override - public int getDamageToComponent(final ItemStack aStack) { - return 0; - } - - @Override - public boolean explodesOnComponentBreak(final ItemStack aStack) { - return false; - } - - private int[] getOutputChances(GT_Recipe tRecipe, int aChanceIncreased) { - int difference = getFocusingTier() - tRecipe.mSpecialValue; - int aOutputsAmount = tRecipe.mOutputs.length + tRecipe.mFluidOutputs.length; - int aChancePerOutput = 10000 / aOutputsAmount; - int[] tChances = new int[aOutputsAmount]; - Arrays.fill(tChances, aChancePerOutput); - - switch (difference) { - case 0 -> { - for (int i = 0; i < tChances.length; i++) { - if (doNeptunium) { - if (i == aChanceIncreased) { - tChances[i] += aChancePerOutput / 2 * (aOutputsAmount - 1); - } else { - tChances[i] /= 2; - } - } - - if (doFermium) { - tChances[i] += (10000 - tChances[i]) / 4; - } - } - } - case 1 -> { - for (int i = 0; i < tChances.length; i++) { - if (doNeptunium) { - if (i == aChanceIncreased) { - tChances[i] += aChancePerOutput * 3 / 4 * (aOutputsAmount - 1); - } else { - tChances[i] /= 4; - } - } - - if (doFermium) { - tChances[i] += (10000 - tChances[i]) / 3; - } - } - } - case 2, 3 -> { - for (int i = 0; i < tChances.length; i++) { - if (doNeptunium) { - if (i == aChanceIncreased) { - tChances[i] = 10000; - } else { - tChances[i] = 0; - } - } - - if (doFermium) { - tChances[i] += (10000 - tChances[i]) / 2; - } - } - } - } - return tChances; - } - - @Override - public void onScrewdriverRightClick(ForgeDirection side, EntityPlayer aPlayer, float aX, float aY, float aZ) { - mFluidMode = !mFluidMode; - GT_Utility.sendChatToPlayer( - aPlayer, - StatCollector.translateToLocal("miscutils.machines.QFTFluidMode") + " " + mFluidMode); - } - - public boolean addNeptuniumHatch(IGregTechTileEntity aTileEntity, short aBaseCasingIndex) { - if (aTileEntity == null) return false; - IMetaTileEntity aMetaTileEntity = aTileEntity.getMetaTileEntity(); - if (aMetaTileEntity == null) return false; - if (aMetaTileEntity instanceof GT_MetaTileEntity_Hatch_Input) { - ((GT_MetaTileEntity_Hatch) aMetaTileEntity).updateTexture(aBaseCasingIndex); - ((GT_MetaTileEntity_Hatch_Input) aMetaTileEntity).mRecipeMap = null; - mNeptuniumHatch = (GT_MetaTileEntity_Hatch_Input) aMetaTileEntity; - return true; - } - return false; - } - - public boolean addFermiumHatch(IGregTechTileEntity aTileEntity, short aBaseCasingIndex) { - if (aTileEntity == null) return false; - IMetaTileEntity aMetaTileEntity = aTileEntity.getMetaTileEntity(); - if (aMetaTileEntity == null) return false; - if (aMetaTileEntity instanceof GT_MetaTileEntity_Hatch_Input) { - ((GT_MetaTileEntity_Hatch) aMetaTileEntity).updateTexture(aBaseCasingIndex); - ((GT_MetaTileEntity_Hatch_Input) aMetaTileEntity).mRecipeMap = null; - mFermiumHatch = (GT_MetaTileEntity_Hatch_Input) aMetaTileEntity; - return true; - } - return false; - } - - public Block getCasingBlock1() { - return ModBlocks.blockCasings5Misc; - } - - public byte getCasingMeta1() { - return 15; - } - - @Override - public void saveNBTData(NBTTagCompound aNBT) { - aNBT.setBoolean("mFluidMode", mFluidMode); - aNBT.setBoolean("doFermium", doFermium); - aNBT.setBoolean("doNeptunium", doNeptunium); - aNBT.setInteger("mMaxParallel", mMaxParallel); - super.saveNBTData(aNBT); - } - - @Override - public void loadNBTData(NBTTagCompound aNBT) { - super.loadNBTData(aNBT); - if (!aNBT.hasKey(INPUT_SEPARATION_NBT_KEY)) { - inputSeparation = aNBT.getBoolean("mSeparateInputBusses"); - } - if (!aNBT.hasKey(BATCH_MODE_NBT_KEY)) { - batchMode = aNBT.getBoolean("mBatchMode"); - } - mFluidMode = aNBT.getBoolean("mFluidMode"); - doFermium = aNBT.getBoolean("doFermium"); - doNeptunium = aNBT.getBoolean("doNeptunium"); - mMaxParallel = aNBT.getInteger("mMaxParallel"); - } - - @Override - public ITexture[] getTexture(IGregTechTileEntity aBaseMetaTileEntity, ForgeDirection side, ForgeDirection facing, - int aColorIndex, boolean aActive, boolean aRedstone) { - if (side == facing) { - if (aActive) return new ITexture[] { getCasingTexture(), TextureFactory.builder() - .addIcon(getActiveOverlay()) - .extFacing() - .build() }; - return new ITexture[] { getCasingTexture(), TextureFactory.builder() - .addIcon(getInactiveOverlay()) - .extFacing() - .build() }; - } - return new ITexture[] { getCasingTexture() }; - } - - private ITexture getCasingTexture() { - return Textures.BlockIcons.getCasingTextureForId(getCasingTextureId()); - } - - @SideOnly(Side.CLIENT) - private void renderForceField(double x, double y, double z, int side, double minU, double maxU, double minV, - double maxV) { - // spotless:off - Tessellator tes = Tessellator.instance; - switch (side) { - case 0 -> { - tes.addVertexWithUV(x + 3, y, z + 7, maxU, maxV); - tes.addVertexWithUV(x + 3, y + 4, z + 7, maxU, minV); - tes.addVertexWithUV(x - 3, y + 4, z + 7, minU, minV); - tes.addVertexWithUV(x - 3, y, z + 7, minU, maxV); - tes.addVertexWithUV(x - 3, y, z + 7, minU, maxV); - tes.addVertexWithUV(x - 3, y + 4, z + 7, minU, minV); - tes.addVertexWithUV(x + 3, y + 4, z + 7, maxU, minV); - tes.addVertexWithUV(x + 3, y, z + 7, maxU, maxV); - } - case 1 -> { - tes.addVertexWithUV(x + 7, y, z + 4, maxU, maxV); - tes.addVertexWithUV(x + 7, y + 4, z + 4, maxU, minV); - tes.addVertexWithUV(x + 7, y + 4, z - 4, minU, minV); - tes.addVertexWithUV(x + 7, y, z - 4, minU, maxV); - tes.addVertexWithUV(x + 7, y, z - 4, minU, maxV); - tes.addVertexWithUV(x + 7, y + 4, z - 4, minU, minV); - tes.addVertexWithUV(x + 7, y + 4, z + 4, maxU, minV); - tes.addVertexWithUV(x + 7, y, z + 4, maxU, maxV); - } - case 2 -> { - tes.addVertexWithUV(x + 3, y, z - 7, maxU, maxV); - tes.addVertexWithUV(x + 3, y + 4, z - 7, maxU, minV); - tes.addVertexWithUV(x - 3, y + 4, z - 7, minU, minV); - tes.addVertexWithUV(x - 3, y, z - 7, minU, maxV); - tes.addVertexWithUV(x - 3, y, z - 7, minU, maxV); - tes.addVertexWithUV(x - 3, y + 4, z - 7, minU, minV); - tes.addVertexWithUV(x + 3, y + 4, z - 7, maxU, minV); - tes.addVertexWithUV(x + 3, y, z - 7, maxU, maxV); - } - case 3 -> { - tes.addVertexWithUV(x - 7, y, z + 4, maxU, maxV); - tes.addVertexWithUV(x - 7, y + 4, z + 4, maxU, minV); - tes.addVertexWithUV(x - 7, y + 4, z - 4, minU, minV); - tes.addVertexWithUV(x - 7, y, z - 4, minU, maxV); - tes.addVertexWithUV(x - 7, y, z - 4, minU, maxV); - tes.addVertexWithUV(x - 7, y + 4, z - 4, minU, minV); - tes.addVertexWithUV(x - 7, y + 4, z + 4, maxU, minV); - tes.addVertexWithUV(x - 7, y, z + 4, maxU, maxV); - } - case 4 -> { - tes.addVertexWithUV(x - 3, y, z + 7, maxU, maxV); - tes.addVertexWithUV(x - 3, y + 4, z + 7, maxU, minV); - tes.addVertexWithUV(x - 7, y + 4, z + 4, minU, minV); - tes.addVertexWithUV(x - 7, y, z + 4, minU, maxV); - tes.addVertexWithUV(x - 7, y, z + 4, minU, maxV); - tes.addVertexWithUV(x - 7, y + 4, z + 4, minU, minV); - tes.addVertexWithUV(x - 3, y + 4, z + 7, maxU, minV); - tes.addVertexWithUV(x - 3, y, z + 7, maxU, maxV); - } - case 5 -> { - tes.addVertexWithUV(x - 3, y, z - 7, maxU, maxV); - tes.addVertexWithUV(x - 3, y + 4, z - 7, maxU, minV); - tes.addVertexWithUV(x - 7, y + 4, z - 4, minU, minV); - tes.addVertexWithUV(x - 7, y, z - 4, minU, maxV); - tes.addVertexWithUV(x - 7, y, z - 4, minU, maxV); - tes.addVertexWithUV(x - 7, y + 4, z - 4, minU, minV); - tes.addVertexWithUV(x - 3, y + 4, z - 7, maxU, minV); - tes.addVertexWithUV(x - 3, y, z - 7, maxU, maxV); - } - case 6 -> { - tes.addVertexWithUV(x + 3, y, z + 7, maxU, maxV); - tes.addVertexWithUV(x + 3, y + 4, z + 7, maxU, minV); - tes.addVertexWithUV(x + 7, y + 4, z + 4, minU, minV); - tes.addVertexWithUV(x + 7, y, z + 4, minU, maxV); - tes.addVertexWithUV(x + 7, y, z + 4, minU, maxV); - tes.addVertexWithUV(x + 7, y + 4, z + 4, minU, minV); - tes.addVertexWithUV(x + 3, y + 4, z + 7, maxU, minV); - tes.addVertexWithUV(x + 3, y, z + 7, maxU, maxV); - } - case 7 -> { - tes.addVertexWithUV(x + 3, y, z - 7, maxU, maxV); - tes.addVertexWithUV(x + 3, y + 4, z - 7, maxU, minV); - tes.addVertexWithUV(x + 7, y + 4, z - 4, minU, minV); - tes.addVertexWithUV(x + 7, y, z - 4, minU, maxV); - tes.addVertexWithUV(x + 7, y, z - 4, minU, maxV); - tes.addVertexWithUV(x + 7, y + 4, z - 4, minU, minV); - tes.addVertexWithUV(x + 3, y + 4, z - 7, maxU, minV); - tes.addVertexWithUV(x + 3, y, z - 7, maxU, maxV); - } - } - } - - @SideOnly(Side.CLIENT) - @Override - public boolean renderInWorld(IBlockAccess aWorld, int x, int y, int z, Block block, RenderBlocks renderer) { - Tessellator tes = Tessellator.instance; - IIcon forceField = TexturesGtBlock.ForceField.getIcon(); - if (getBaseMetaTileEntity().isActive()) { - double minU = forceField.getMinU(); - double maxU = forceField.getMaxU(); - double minV = forceField.getMinV(); - double maxV = forceField.getMaxV(); - double xBaseOffset = 3 * getExtendedFacing().getRelativeBackInWorld().offsetX; - double zBaseOffset = 3 * getExtendedFacing().getRelativeBackInWorld().offsetZ; - tes.setColorOpaque_F(1f, 1f, 1f); - tes.setBrightness(15728880); - //Center O: 0, 0 1 ------- 8 - //Corner 1: 7, -2 / \ - //Corner 2: 3, -6 2 / \ 7 - //Corner 3: -2, -6 | | - //Corner 4: -6, -2 | O | - //Corner 5: -6, 3 | | - //Corner 6: -2, 7 3 \ / 6 - //Corner 7: 3, 7 \ / - //Corner 8: 7, 3 4 ------- 5 - renderForceField(x + xBaseOffset + 0.5, y, z + zBaseOffset + 0.5, 0, minU, maxU, minV, maxV); - renderForceField(x + xBaseOffset + 0.5, y, z + zBaseOffset + 0.5, 1, minU, maxU, minV, maxV); - renderForceField(x + xBaseOffset + 0.5, y, z + zBaseOffset + 0.5, 2, minU, maxU, minV, maxV); - renderForceField(x + xBaseOffset + 0.5, y, z + zBaseOffset + 0.5, 3, minU, maxU, minV, maxV); - renderForceField(x + xBaseOffset + 0.5, y, z + zBaseOffset + 0.5, 4, minU, maxU, minV, maxV); - renderForceField(x + xBaseOffset + 0.5, y, z + zBaseOffset + 0.5, 5, minU, maxU, minV, maxV); - renderForceField(x + xBaseOffset + 0.5, y, z + zBaseOffset + 0.5, 6, minU, maxU, minV, maxV); - renderForceField(x + xBaseOffset + 0.5, y, z + zBaseOffset + 0.5, 7, minU, maxU, minV, maxV); - } - // Needs to be false to render the controller - return false; - //spotless:on - } - - @Override - public boolean supportsInputSeparation() { - return true; - } - - @Override - public boolean supportsBatchMode() { - return true; - } -} diff --git a/gtpp/src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/production/GregtechMetaTileEntity_Refinery.java b/gtpp/src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/production/GregtechMetaTileEntity_Refinery.java deleted file mode 100644 index 8a6564858e..0000000000 --- a/gtpp/src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/production/GregtechMetaTileEntity_Refinery.java +++ /dev/null @@ -1,220 +0,0 @@ -package gtPlusPlus.xmod.gregtech.common.tileentities.machines.multi.production; - -import static com.gtnewhorizon.structurelib.structure.StructureUtility.ofBlock; -import static com.gtnewhorizon.structurelib.structure.StructureUtility.ofChain; -import static com.gtnewhorizon.structurelib.structure.StructureUtility.onElementPass; -import static com.gtnewhorizon.structurelib.structure.StructureUtility.transpose; -import static gregtech.api.enums.GT_HatchElement.Energy; -import static gregtech.api.enums.GT_HatchElement.InputHatch; -import static gregtech.api.enums.GT_HatchElement.Maintenance; -import static gregtech.api.enums.GT_HatchElement.Muffler; -import static gregtech.api.enums.GT_HatchElement.OutputBus; -import static gregtech.api.enums.GT_HatchElement.OutputHatch; -import static gregtech.api.util.GT_StructureUtility.buildHatchAdder; -import static gregtech.api.util.GT_StructureUtility.filterByMTETier; - -import net.minecraft.item.ItemStack; - -import com.gtnewhorizon.structurelib.alignment.constructable.ISurvivalConstructable; -import com.gtnewhorizon.structurelib.structure.IStructureDefinition; -import com.gtnewhorizon.structurelib.structure.ISurvivalBuildEnvironment; -import com.gtnewhorizon.structurelib.structure.StructureDefinition; - -import gregtech.api.enums.TAE; -import gregtech.api.enums.Textures; -import gregtech.api.interfaces.IIconContainer; -import gregtech.api.interfaces.metatileentity.IMetaTileEntity; -import gregtech.api.interfaces.tileentity.IGregTechTileEntity; -import gregtech.api.logic.ProcessingLogic; -import gregtech.api.metatileentity.implementations.GT_MetaTileEntity_Hatch_Muffler; -import gregtech.api.recipe.RecipeMap; -import gregtech.api.util.GT_Multiblock_Tooltip_Builder; -import gtPlusPlus.api.recipe.GTPPRecipeMaps; -import gtPlusPlus.core.block.ModBlocks; -import gtPlusPlus.core.lib.CORE; -import gtPlusPlus.xmod.gregtech.api.metatileentity.implementations.base.GregtechMeta_MultiBlockBase; - -public class GregtechMetaTileEntity_Refinery extends GregtechMeta_MultiBlockBase<GregtechMetaTileEntity_Refinery> - implements ISurvivalConstructable { - - private int mCasing; - private static IStructureDefinition<GregtechMetaTileEntity_Refinery> STRUCTURE_DEFINITION = null; - - public GregtechMetaTileEntity_Refinery(final int aID, final String aName, final String aNameRegional) { - super(aID, aName, aNameRegional); - } - - public GregtechMetaTileEntity_Refinery(final String aName) { - super(aName); - } - - @Override - public String getMachineType() { - return "Fuel Refinery"; - } - - @Override - protected GT_Multiblock_Tooltip_Builder createTooltip() { - GT_Multiblock_Tooltip_Builder tt = new GT_Multiblock_Tooltip_Builder(); - tt.addMachineType(getMachineType()) - .addInfo("Controller Block for the Fission Fuel Processing Unit") - .addInfo("Refines fluorides and Uranium into nuclear fuel for the LFTR") - .addInfo("LFTR Fuel 2 and Fuel 3 have alternative, much more efficient recipes") - .addInfo("However, they require fission breeding outputs from the LFTR itself") - .addInfo("Only one Energy Hatch is allowed per Processing Unit") - .addInfo("All recipe times in this multi are very long, watch out!") - .addPollutionAmount(getPollutionPerSecond(null)) - .addSeparator() - .beginStructureBlock(3, 9, 3, false) - .addController("Bottom Center") - .addCasingInfoMin("Hastelloy-X Structural Block", 7, false) - .addCasingInfoMin("Incoloy-DS Fluid Containment Block", 5, false) - .addCasingInfoMin("Zeron-100 Reactor Shielding", 4, false) - .addCasingInfoMin("Hastelloy-N Sealant Blocks", 17, false) - .addInputHatch("Base platform", 1) - .addOutputHatch("Base platform", 1) - .addMufflerHatch("Base platform", 1) - .addMaintenanceHatch("Base platform", 1) - .addEnergyHatch("Base platform", 1) - .addStructureInfo("Muffler's Tier must be IV+") - .addStructureInfo("2-4x Input Hatches, 1-2x Output Hatches") - .addStructureInfo("1x Muffler, 1x Maintenance Hatch, 1x Energy Hatch") - .toolTipFinisher(CORE.GT_Tooltip_Builder.get()); - return tt; - } - - @Override - protected IIconContainer getActiveOverlay() { - return Textures.BlockIcons.OVERLAY_FRONT_MULTI_SMELTER_ACTIVE; - } - - @Override - protected IIconContainer getInactiveOverlay() { - return Textures.BlockIcons.OVERLAY_FRONT_MULTI_SMELTER; - } - - @Override - protected int getCasingTextureId() { - return TAE.GTPP_INDEX(18); - } - - @Override - public RecipeMap<?> getRecipeMap() { - return GTPPRecipeMaps.fissionFuelProcessingRecipes; - } - - @Override - protected ProcessingLogic createProcessingLogic() { - return new ProcessingLogic(); - } - - @Override - public int getMaxParallelRecipes() { - return 1; - } - - @Override - public boolean addMufflerToMachineList(IGregTechTileEntity aTileEntity, int aBaseCasingIndex) { - if (aTileEntity == null) { - return false; - } else { - IMetaTileEntity aMetaTileEntity = aTileEntity.getMetaTileEntity(); - if (aMetaTileEntity instanceof GT_MetaTileEntity_Hatch_Muffler - && ((GT_MetaTileEntity_Hatch_Muffler) aMetaTileEntity).mTier >= 5) { - return addToMachineList(aTileEntity, aBaseCasingIndex); - } - } - return false; - } - - @Override - public IStructureDefinition<GregtechMetaTileEntity_Refinery> getStructureDefinition() { - if (STRUCTURE_DEFINITION == null) { - STRUCTURE_DEFINITION = StructureDefinition.<GregtechMetaTileEntity_Refinery>builder() - .addShape( - mName, - transpose( - new String[][] { { " ", " N ", " " }, { " N ", "NIN", " N " }, { " N ", "NIN", " N " }, - { " N ", "NIN", " N " }, { " Z ", "ZIZ", " Z " }, { " N ", "NIN", " N " }, - { "XXX", "XXX", "XXX" }, { "X~X", "XXX", "XXX" }, })) - .addElement( - 'X', - ofChain( - buildHatchAdder(GregtechMetaTileEntity_Refinery.class) - .atLeast(Energy, Maintenance, OutputHatch, OutputBus, InputHatch) - .casingIndex(TAE.GTPP_INDEX(18)) - .dot(1) - .build(), - buildHatchAdder(GregtechMetaTileEntity_Refinery.class).atLeast(Muffler) - .adder(GregtechMetaTileEntity_Refinery::addMufflerToMachineList) - .hatchItemFilterAnd(t -> filterByMTETier(6, Integer.MAX_VALUE)) - .casingIndex(TAE.GTPP_INDEX(18)) - .dot(1) - .build(), - onElementPass(x -> ++x.mCasing, ofBlock(ModBlocks.blockCasings2Misc, 2)))) - .addElement('I', ofBlock(ModBlocks.blockCasings2Misc, 3)) - .addElement('N', ofBlock(ModBlocks.blockCasings2Misc, 1)) - .addElement('Z', ofBlock(ModBlocks.blockCasingsMisc, 13)) - .build(); - } - return STRUCTURE_DEFINITION; - } - - @Override - public void construct(ItemStack stackSize, boolean hintsOnly) { - buildPiece(mName, stackSize, hintsOnly, 1, 7, 0); - } - - @Override - public int survivalConstruct(ItemStack stackSize, int elementBudget, ISurvivalBuildEnvironment env) { - if (mMachine) return -1; - return survivialBuildPiece(mName, stackSize, 1, 7, 0, elementBudget, env, false, true); - } - - @Override - public boolean checkMachine(IGregTechTileEntity aBaseMetaTileEntity, ItemStack aStack) { - mCasing = 0; - if (checkPiece(mName, 1, 7, 0) && mCasing >= 7) { - if (this.mInputHatches.size() >= 2 && this.mInputHatches.size() <= 4 - && this.mOutputHatches.size() >= 1 - && this.mOutputHatches.size() <= 2 - && this.mMufflerHatches.size() == 1 - && this.mMaintenanceHatches.size() == 1 - && this.mEnergyHatches.size() == 1) { - this.resetRecipeMapForAllInputHatches(this.getRecipeMap()); - return true; - } - } - return false; - } - - @Override - public boolean isCorrectMachinePart(final ItemStack aStack) { - return true; - } - - @Override - public int getMaxEfficiency(final ItemStack aStack) { - return 10000; - } - - @Override - public int getPollutionPerSecond(final ItemStack aStack) { - return CORE.ConfigSwitches.pollutionPerSecondMultiRefinery; - } - - @Override - public int getDamageToComponent(final ItemStack aStack) { - return 0; - } - - @Override - public boolean explodesOnComponentBreak(final ItemStack aStack) { - return false; - } - - @Override - public IMetaTileEntity newMetaEntity(final IGregTechTileEntity aTileEntity) { - return new GregtechMetaTileEntity_Refinery(this.mName); - } -} diff --git a/gtpp/src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/production/GregtechMetaTileEntity_SolarTower.java b/gtpp/src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/production/GregtechMetaTileEntity_SolarTower.java deleted file mode 100644 index 0395ab5a01..0000000000 --- a/gtpp/src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/production/GregtechMetaTileEntity_SolarTower.java +++ /dev/null @@ -1,675 +0,0 @@ -package gtPlusPlus.xmod.gregtech.common.tileentities.machines.multi.production; - -import static com.gtnewhorizon.structurelib.structure.StructureUtility.lazy; -import static com.gtnewhorizon.structurelib.structure.StructureUtility.ofBlock; -import static com.gtnewhorizon.structurelib.structure.StructureUtility.onElementPass; -import static gregtech.api.enums.GT_HatchElement.InputHatch; -import static gregtech.api.enums.GT_HatchElement.Maintenance; -import static gregtech.api.enums.GT_HatchElement.OutputHatch; -import static gregtech.api.util.GT_StructureUtility.buildHatchAdder; - -import java.util.ArrayList; - -import net.minecraft.block.Block; -import net.minecraft.entity.player.EntityPlayer; -import net.minecraft.item.ItemStack; -import net.minecraft.nbt.NBTTagCompound; -import net.minecraft.world.World; -import net.minecraftforge.common.util.ForgeDirection; -import net.minecraftforge.fluids.Fluid; -import net.minecraftforge.fluids.FluidStack; - -import org.jetbrains.annotations.NotNull; - -import com.gtnewhorizon.structurelib.alignment.IAlignmentLimits; -import com.gtnewhorizon.structurelib.alignment.constructable.ISurvivalConstructable; -import com.gtnewhorizon.structurelib.structure.IStructureDefinition; -import com.gtnewhorizon.structurelib.structure.ISurvivalBuildEnvironment; -import com.gtnewhorizon.structurelib.structure.StructureDefinition; - -import gregtech.api.enums.SoundResource; -import gregtech.api.enums.TAE; -import gregtech.api.enums.Textures; -import gregtech.api.interfaces.ITexture; -import gregtech.api.interfaces.metatileentity.IMetaTileEntity; -import gregtech.api.interfaces.tileentity.IGregTechTileEntity; -import gregtech.api.recipe.RecipeMap; -import gregtech.api.recipe.check.CheckRecipeResult; -import gregtech.api.recipe.check.CheckRecipeResultRegistry; -import gregtech.api.render.TextureFactory; -import gregtech.api.util.GT_Multiblock_Tooltip_Builder; -import gregtech.api.util.GT_Utility; -import gtPlusPlus.api.recipe.GTPPRecipeMaps; -import gtPlusPlus.core.block.ModBlocks; -import gtPlusPlus.core.lib.CORE; -import gtPlusPlus.core.material.MISC_MATERIALS; -import gtPlusPlus.core.util.minecraft.FluidUtils; -import gtPlusPlus.xmod.gregtech.api.metatileentity.implementations.base.GregtechMeta_MultiBlockBase; -import gtPlusPlus.xmod.gregtech.common.blocks.textures.TexturesGtBlock; -import gtPlusPlus.xmod.gregtech.common.tileentities.misc.TileEntitySolarHeater; - -public class GregtechMetaTileEntity_SolarTower extends GregtechMeta_MultiBlockBase<GregtechMetaTileEntity_SolarTower> - implements ISurvivalConstructable { - - // 862 - private static final int mCasingTextureID = TAE.getIndexFromPage(3, 9); - private int mHeatLevel = 0; - private int mCasing1; - private int mCasing2; - private int mCasing3; - private int mCasing4; - - public ArrayList<TileEntitySolarHeater> mSolarHeaters = new ArrayList<>(); - - public GregtechMetaTileEntity_SolarTower(final int aID, final String aName, final String aNameRegional) { - super(aID, aName, aNameRegional); - } - - public GregtechMetaTileEntity_SolarTower(final String aName) { - super(aName); - } - - @Override - public IMetaTileEntity newMetaEntity(final IGregTechTileEntity aTileEntity) { - return new GregtechMetaTileEntity_SolarTower(this.mName); - } - - @Override - public String getMachineType() { - return "Solar Tower"; - } - - @Override - protected final GT_Multiblock_Tooltip_Builder createTooltip() { - GT_Multiblock_Tooltip_Builder tt = new GT_Multiblock_Tooltip_Builder(); - tt.addMachineType(getMachineType()) - .addInfo("Contributing Green Energy towards the future") - .addInfo("Surround with rings of Solar Reflectors") - .addInfo("The Reflectors increase the internal heat value of the Tower (see below for formula)") - .addInfo("Each Reflector ring increases tier, the first ring is required for the Tower to work") - .addInfo("Input: " + MISC_MATERIALS.SOLAR_SALT_COLD.getLocalizedName()) - .addInfo("Output: " + MISC_MATERIALS.SOLAR_SALT_HOT.getLocalizedName()) - .addInfo("Every cycle (10 seconds), heat increases and all the Cold Solar Salt is heated") - .addInfo("Converting Cold to Hot Solar Salt reduces heat, equal to the amount converted") - .addInfo("This conversion only happens if heat >= 30000 and controller efficiency = 100%") - .addInfo("If there's more Cold Salt than heat, all the heat is used up and returns to 0") - .addInfo("The heat increase is most efficient at exactly half of maximum heat") - .addInfo("Minimum efficiency at 0 or 100000 heat, maximum efficiency at 50000") - .addInfo("Heat Efficiency formula: ( 7000 - [|currentHeat - 50000| ^ 0.8]) / 7000") - .addInfo("Heat gain per cycle: numberHeaters * heatEfficiency * (10 + bonus)") - .addInfo("Bonus: 1 ring = +1, 2 rings = +2, 3 rings = +4, 4 rings = +8, 5 rings = +16") - .addInfo("Total number of reflectors based on how many rings are built:") - .addInfo("1 ring = 36, 2 rings = 88, 3 rings = 156, 4 rings = 240, 5 rings = 340") - .addSeparator() - .beginVariableStructureBlock(15, 31, 28, 28, 15, 31, false) - .addController("Top Middle") - .addCasingInfoMin("Structural Solar Casing", 229, false) - .addCasingInfoMin("Thermally Insulated Casing", 60, false) - .addCasingInfoMin("Salt Containment Casing", 66, false) - .addCasingInfoMin("Thermal Containment Casing", 60, false) - .addInputHatch("Any 2 dot hint(min 1)", 2) - .addOutputHatch("Any 2 dot hint(min 1)", 2) - .addMaintenanceHatch("Any 2 dot hint", 2) - .toolTipFinisher(CORE.GT_Tooltip_Builder.get()); - return tt; - } - - private static final String STRUCTURE_PIECE_BASE = "base"; - private static final String STRUCTURE_PIECE_TOWER = "tower"; - private static final String STRUCTURE_PIECE_TOP = "top"; - - private static final String[] STRUCTURE_PIECE_SOLAR_HEATER_RING = { "ring1", "ring2", "ring3", "ring4", "ring5" }; - private static final String SOLAR_HEATER_RING_1 = STRUCTURE_PIECE_SOLAR_HEATER_RING[0]; - private static final String SOLAR_HEATER_RING_2 = STRUCTURE_PIECE_SOLAR_HEATER_RING[1]; - private static final String SOLAR_HEATER_RING_3 = STRUCTURE_PIECE_SOLAR_HEATER_RING[2]; - private static final String SOLAR_HEATER_RING_4 = STRUCTURE_PIECE_SOLAR_HEATER_RING[3]; - private static final String SOLAR_HEATER_RING_5 = STRUCTURE_PIECE_SOLAR_HEATER_RING[4]; - - private static final ClassValue<IStructureDefinition<GregtechMetaTileEntity_SolarTower>> STRUCTURE_DEFINITION = new ClassValue<>() { - - @Override - protected IStructureDefinition<GregtechMetaTileEntity_SolarTower> computeValue(Class<?> type) { - return StructureDefinition.<GregtechMetaTileEntity_SolarTower>builder() - - // s = salt - // c = thermal containment - // i = thermal insulated - // t = solar structural - // h = hatch - // g = solar heater - - .addShape( - STRUCTURE_PIECE_TOP, - (new String[][] { { " ", " ", " ~ ", " ", " " }, - { " ", " s ", " sss ", " s ", " " }, - { " c ", " ccc ", "ccscc", " ccc ", " c " }, - { " c ", " ccc ", "ccscc", " ccc ", " c " }, - { " c ", " ccc ", "ccscc", " ccc ", " c " }, - { " c ", " ccc ", "ccscc", " ccc ", " c " }, - { " c ", " ccc ", "ccscc", " ccc ", " c " }, })) - .addShape( - STRUCTURE_PIECE_TOWER, - (new String[][] { { " i ", "isi", " i " }, { " i ", "isi", " i " }, { " i ", "isi", " i " }, - { " i ", "isi", " i " }, { " i ", "isi", " i " }, { " i ", "isi", " i " }, - { " i ", "isi", " i " }, { " i ", "isi", " i " }, { " i ", "isi", " i " }, - { " i ", "isi", " i " }, { " i ", "isi", " i " }, { " i ", "isi", " i " }, - { " i ", "isi", " i " }, { " i ", "isi", " i " }, { " i ", "isi", " i " }, })) - .addShape( - STRUCTURE_PIECE_BASE, - (new String[][] { - { " ", " ", " t ", " ttt ", " ttstt ", " ttssstt ", - " ttstt ", " ttt ", " t ", " ", " " }, - { " ", " ", " t ", " ttt ", " tssst ", " ttssstt ", - " tssst ", " ttt ", " t ", " ", " " }, - { " ", " t ", " ttt ", " ttttt ", " ttssstt ", " tttsssttt ", - " ttssstt ", " ttttt ", " ttt ", " t ", " " }, - { " ", " t ", " ttt ", " ttttt ", " ttssstt ", " tttsssttt ", - " ttssstt ", " ttttt ", " ttt ", " t ", " " }, - { " hhh ", " ttttt ", " ttttttt ", " ttttttttt ", "htttsssttth", "htttsssttth", - "htttsssttth", " ttttttttt ", " ttttttt ", " ttttt ", " hhh " }, - { " hhh ", " ttttt ", " ttttttt ", " ttttttttt ", "httttttttth", "httttttttth", - "httttttttth", " ttttttttt ", " ttttttt ", " ttttt ", " hhh " }, })) - .addShape( - SOLAR_HEATER_RING_1, - (new String[][] { { " ggggg ", " g g ", " g g ", " g g ", - " g g ", "g g", "g g", "g g", "g g", - "g g", " g g ", " g g ", " g g ", " g g ", - " ggggg ", } })) - .addShape( - SOLAR_HEATER_RING_2, - (new String[][] { - { " ggggggggg ", " g g ", " g g ", " g g ", - " g g ", "g g", "g g", "g g", - "g g", "g g", "g g", "g g", - "g g", "g g", " g g ", " g g ", - " g g ", " g g ", " ggggggggg ", } })) - .addShape( - SOLAR_HEATER_RING_3, - (new String[][] { { " ggggggggggggg ", " g g ", " g g ", - " g g ", " g g ", "g g", - "g g", "g g", "g g", - "g g", "g g", "g g", - "g g", "g g", "g g", - "g g", "g g", "g g", - " g g ", " g g ", " g g ", - " g g ", " ggggggggggggg ", } })) - .addShape( - SOLAR_HEATER_RING_4, - (new String[][] { { " ggggggggggggggggg ", " g g ", - " g g ", " g g ", " g g ", - "g g", "g g", "g g", - "g g", "g g", "g g", - "g g", "g g", "g g", - "g g", "g g", "g g", - "g g", "g g", "g g", - "g g", "g g", " g g ", - " g g ", " g g ", " g g ", - " ggggggggggggggggg ", } })) - .addShape( - SOLAR_HEATER_RING_5, - (new String[][] { { " ggggggggggggggggggggg ", " g g ", - " g g ", " g g ", - " g g ", "g g", - "g g", "g g", - "g g", "g g", - "g g", "g g", - "g g", "g g", - "g g", "g g", - "g g", "g g", - "g g", "g g", - "g g", "g g", - "g g", "g g", - "g g", "g g", - " g g ", " g g ", - " g g ", " g g ", - " ggggggggggggggggggggg ", } })) - .addElement( - 'g', - lazy( - t -> buildHatchAdder(GregtechMetaTileEntity_SolarTower.class) - .hatchClass(TileEntitySolarHeater.class) - .adder(GregtechMetaTileEntity_SolarTower::addSolarHeater) - // Use a positive casing index to make adder builder happy - .casingIndex(1) - .dot(1) - .continueIfSuccess() - .build())) - .addElement( - 't', - lazy(t -> onElementPass(x -> ++x.mCasing1, ofBlock(t.getCasingBlock(), t.getCasingMeta())))) - .addElement( - 'i', - lazy(t -> onElementPass(x -> ++x.mCasing2, ofBlock(t.getCasingBlock(), t.getCasingMeta2())))) - .addElement( - 's', - lazy(t -> onElementPass(x -> ++x.mCasing3, ofBlock(t.getCasingBlock(), t.getCasingMeta3())))) - .addElement( - 'c', - lazy(t -> onElementPass(x -> ++x.mCasing4, ofBlock(t.getCasingBlock2(), t.getCasingMeta4())))) - .addElement( - 'h', - lazy( - t -> buildHatchAdder(GregtechMetaTileEntity_SolarTower.class) - .atLeast(InputHatch, OutputHatch, Maintenance) - .casingIndex(t.getCasingTextureIndex()) - .dot(2) - .buildAndChain( - onElementPass(x -> ++x.mCasing1, ofBlock(t.getCasingBlock(), t.getCasingMeta()))))) - .build(); - } - }; - - @Override - public boolean checkMachine(IGregTechTileEntity aBaseMetaTileEntity, ItemStack aStack) { - resetSolarHeaters(); - this.mMaintenanceHatches.clear(); - this.mInputHatches.clear(); - this.mOutputHatches.clear(); - mCasing1 = 0; - mCasing2 = 0; - mCasing3 = 0; - mCasing4 = 0; - - boolean aStructureTop = checkPiece(STRUCTURE_PIECE_TOP, 2, 2, 0); - log("Top Check: " + aStructureTop); - boolean aStructureTower = checkPiece(STRUCTURE_PIECE_TOWER, 1, 1, -7); - log("Tower Check: " + aStructureTower); - boolean aStructureBase = checkPiece(STRUCTURE_PIECE_BASE, 5, 5, -22); - log("Base Check: " + aStructureBase); - boolean aCasingCount1 = mCasing1 >= 229; - boolean aCasingCount2 = mCasing2 == 60; - boolean aCasingCount3 = mCasing3 == 66; - boolean aCasingCount4 = mCasing4 == 60; - boolean aAllStructure = aStructureTop && aStructureTower && aStructureBase; - boolean aAllCasings = aCasingCount1 && aCasingCount2 && aCasingCount3 && aCasingCount4; - if (!aAllCasings || !aAllStructure - || mMaintenanceHatches.size() != 1 - || mInputHatches.size() < 1 - || mOutputHatches.size() < 1) { - log( - "Bad Hatches - Solar Heaters: " + mSolarHeaters.size() - + ", Maint: " - + mMaintenanceHatches.size() - + ", Input Hatches: " - + mInputHatches.size() - + ", Output Hatches: " - + mOutputHatches.size() - + ", Top: " - + aStructureTop - + ", Tower: " - + aStructureTower - + ", Base: " - + aStructureBase - + ", Casing Count: " - + aCasingCount1 - + " | Found: " - + mCasing1 - + ", Casing Count: " - + aCasingCount2 - + " | Found: " - + mCasing2 - + ", Casing Count: " - + aCasingCount3 - + " | Found: " - + mCasing3 - + ", Casing Count: " - + aCasingCount4 - + " | Found: " - + mCasing4); - return false; - } - log( - "Built " + this.getLocalName() - + " with " - + mCasing1 - + " Structural Solar casings, " - + mCasing2 - + " Thermally Insulated casings, " - + mCasing3 - + " Salt Containment casings, " - + mCasing4 - + " Thermal Containment casings."); - return aAllCasings && aAllStructure; - } - - @Override - public void construct(ItemStack stackSize, boolean hintsOnly) { - // Tower - buildPiece(STRUCTURE_PIECE_TOP, stackSize, hintsOnly, 2, 2, 0); - buildPiece(STRUCTURE_PIECE_TOWER, stackSize, hintsOnly, 1, 1, -7); - buildPiece(STRUCTURE_PIECE_BASE, stackSize, hintsOnly, 5, 5, -22); - - // Solar Heaters - if (stackSize.stackSize >= 1) { - buildPiece(SOLAR_HEATER_RING_1, stackSize, hintsOnly, 7, 7, -27); - if (stackSize.stackSize >= 2) { - buildPiece(SOLAR_HEATER_RING_2, stackSize, hintsOnly, 9, 9, -27); - if (stackSize.stackSize >= 3) { - buildPiece(SOLAR_HEATER_RING_3, stackSize, hintsOnly, 11, 11, -27); - if (stackSize.stackSize >= 4) { - buildPiece(SOLAR_HEATER_RING_4, stackSize, hintsOnly, 13, 13, -27); - if (stackSize.stackSize >= 5) { - buildPiece(SOLAR_HEATER_RING_5, stackSize, hintsOnly, 15, 15, -27); - } - } - } - } - } - } - - @Override - public int survivalConstruct(ItemStack stackSize, int elementBudget, ISurvivalBuildEnvironment env) { - int built; - int realBudget = elementBudget >= 200 ? elementBudget : Math.min(200, elementBudget * 2); - // Tower - built = survivialBuildPiece(STRUCTURE_PIECE_TOP, stackSize, 2, 2, 0, realBudget, env, false, true); - if (built >= 0) return built; - built = survivialBuildPiece(STRUCTURE_PIECE_TOWER, stackSize, 1, 1, -7, realBudget, env, false, true); - if (built >= 0) return built; - built = survivialBuildPiece(STRUCTURE_PIECE_BASE, stackSize, 5, 5, -22, realBudget, env, false, true); - if (built >= 0) return built; - - // Solar Heaters - if (stackSize.stackSize < 1) return -1; - built = survivialBuildPiece(SOLAR_HEATER_RING_1, stackSize, 7, 7, -27, realBudget, env, false, true); - if (built >= 0) return built; - if (stackSize.stackSize < 2) return -1; - built = survivialBuildPiece(SOLAR_HEATER_RING_2, stackSize, 9, 9, -27, realBudget, env, false, true); - if (built >= 0) return built; - if (stackSize.stackSize < 3) return -1; - built = survivialBuildPiece(SOLAR_HEATER_RING_3, stackSize, 11, 11, -27, realBudget, env, false, true); - if (built >= 0) return built; - if (stackSize.stackSize < 4) return -1; - built = survivialBuildPiece(SOLAR_HEATER_RING_4, stackSize, 13, 13, -27, realBudget, env, false, true); - if (built >= 0) return built; - if (stackSize.stackSize < 5) return -1; - return survivialBuildPiece(SOLAR_HEATER_RING_5, stackSize, 15, 15, -27, realBudget, env, false, true); - } - - @Override - public IStructureDefinition<GregtechMetaTileEntity_SolarTower> getStructureDefinition() { - return STRUCTURE_DEFINITION.get(getClass()); - } - - @Override - protected SoundResource getProcessStartSound() { - return SoundResource.IC2_MACHINES_MAGNETIZER_LOOP; - } - - @Override - public ITexture[] getTexture(final IGregTechTileEntity aBaseMetaTileEntity, final ForgeDirection side, - final ForgeDirection facing, final int aColorIndex, final boolean aActive, final boolean aRedstone) { - if (side == ForgeDirection.DOWN || side == ForgeDirection.UP) { - if (aActive) return new ITexture[] { Textures.BlockIcons.getCasingTextureForId(TAE.GTPP_INDEX(12)), - TextureFactory.builder() - .addIcon(TexturesGtBlock.Overlay_Machine_Controller_Default_Active) - .extFacing() - .build() }; - return new ITexture[] { Textures.BlockIcons.getCasingTextureForId(TAE.GTPP_INDEX(12)), - TextureFactory.builder() - .addIcon(TexturesGtBlock.Overlay_Machine_Controller_Default) - .extFacing() - .build() }; - } - return new ITexture[] { Textures.BlockIcons.getCasingTextureForId(TAE.GTPP_INDEX(12)) }; - } - - @Override - public RecipeMap<?> getRecipeMap() { - // Only for visual - return GTPPRecipeMaps.solarTowerRecipes; - } - - private int getHeaterTier() { - int aSolarHeaterCounter = this.mSolarHeaters.size(); - if (aSolarHeaterCounter > 0) { - if (aSolarHeaterCounter == 36) { - return 1; - } else if (aSolarHeaterCounter == 88) { - return 2; - } else if (aSolarHeaterCounter == 156) { - return 4; - } else if (aSolarHeaterCounter == 240) { - return 8; - } else if (aSolarHeaterCounter == 340) { - return 16; - } - } - return 0; - } - - private int getHeaterCountForTier(int aTier) { - return switch (aTier) { - case 1 -> 36; - case 2 -> 88; - case 4 -> 156; - case 8 -> 240; - case 16 -> 340; - default -> 0; - }; - } - - public boolean getConnectedSolarReflectors() { - - resetSolarHeaters(); - int aRing = 1; - - if (this.mSolarHeaters.size() < 36) { - // 15x15 - boolean aRing1 = checkPiece(SOLAR_HEATER_RING_1, 7, 7, -27); - if (aRing1) { - // log("Found Ring: "+(aRing++)+", Total: "+this.mSolarHeaters.size()); - } - } - if (this.mSolarHeaters.size() < 88) { - // 17x17 - boolean aRing2 = checkPiece(SOLAR_HEATER_RING_2, 9, 9, -27); - if (aRing2) { - // log("Found Ring: "+(aRing++)+", Total: "+this.mSolarHeaters.size()); - } - } - if (this.mSolarHeaters.size() < 156) { - // 19x19 - boolean aRing3 = checkPiece(SOLAR_HEATER_RING_3, 11, 11, -27); - if (aRing3) { - // log("Found Ring: "+(aRing++)+", Total: "+this.mSolarHeaters.size()); - } - } - if (this.mSolarHeaters.size() < 240) { - // 21x21 - boolean aRing4 = checkPiece(SOLAR_HEATER_RING_4, 13, 13, -27); - if (aRing4) { - // log("Found Ring: "+(aRing++)+", Total: "+this.mSolarHeaters.size()); - } - } - if (this.mSolarHeaters.size() < 340) { - // 23x23 - boolean aRing5 = checkPiece(SOLAR_HEATER_RING_5, 15, 15, -27); - if (aRing5) { - // log("Found Ring: "+(aRing++)+", Total: "+this.mSolarHeaters.size()); - } - } - return mSolarHeaters.size() > 0; - } - - private boolean addSolarHeater(IGregTechTileEntity aTileEntity, int a) { - if (aTileEntity == null) { - return false; - } else { - IMetaTileEntity aMetaTileEntity = aTileEntity.getMetaTileEntity(); - if (aMetaTileEntity instanceof TileEntitySolarHeater mTile) { - if (!mTile.hasSolarTower() && mTile.canSeeSky()) { - // Logger.INFO("Found Solar Reflector, Injecting Data."); - mTile.setSolarTower(this); - return this.mSolarHeaters.add(mTile); - } - } - } - return false; - } - - @Override - protected IAlignmentLimits getInitialAlignmentLimits() { - return (d, r, f) -> d == ForgeDirection.UP; - } - - private Fluid mColdSalt = null; - private Fluid mHotSalt = null; - - @Override - public @NotNull CheckRecipeResult checkProcessing() { - this.mEfficiencyIncrease = 100; - this.mMaxProgresstime = 200; - - if (this.mSolarHeaters.isEmpty() || this.mSolarHeaters.size() < 340 - || this.getTotalRuntimeInTicks() % 200 == 0) { - getConnectedSolarReflectors(); - } - - int aTier = getHeaterTier(); - int aHeaters = getHeaterCountForTier(aTier); - - // Original formula was (-Math.pow(this.mHeatLevel - 50000, 0.8) + 7000) / 7000 - // However, negative numbers to the power of a non-integer result in NaN, by default - // Max efficiency is 1, at mHeatLevel = 50000, and it lowers at the same rate if going above or below this heat - // Min efficiency is 0.179, at mHeatLevel = 0 or 100000 - double aEfficiency = (-Math.pow(Math.abs(this.mHeatLevel - 50000), 0.8) + 7000) / 7000; - - World w = this.getBaseMetaTileEntity() - .getWorld(); - - // Manage Heat every 10s - // Add Heat First, if sources available and it's daytime, heat gain is halved if raining - if (w != null) { - if (aHeaters > 0 && w.isDaytime()) { - if (w.isRaining() && this.getBaseMetaTileEntity() - .getBiome().rainfall > 0.0F) { - this.mHeatLevel += GT_Utility.safeInt((long) ((aHeaters / 2) * aEfficiency * (10 + aTier))); - } else { - this.mHeatLevel += GT_Utility.safeInt((long) (aHeaters * aEfficiency * (10 + aTier))); - } - } - - // Remove Heat, based on time of day - if (mHeatLevel > 0) { - if (mHeatLevel > 100000) { - this.mHeatLevel = 100000; - } else { - this.mHeatLevel -= 10; - } - } - } - - if (this.mEfficiency == this.getMaxEfficiency(null) && this.mHeatLevel >= 30000) { - if (mColdSalt == null) { - mColdSalt = MISC_MATERIALS.SOLAR_SALT_COLD.getFluid(); - } - if (mHotSalt == null) { - mHotSalt = MISC_MATERIALS.SOLAR_SALT_HOT.getFluid(); - } - ArrayList<FluidStack> aFluids = this.getStoredFluids(); - for (FluidStack aFluid : aFluids) { - if (aFluid.getFluid() - .equals(mColdSalt)) { - int aFluidAmount = Math.min(aFluid.amount, this.mHeatLevel); - - this.mHeatLevel -= aFluidAmount; - this.depleteInput(FluidUtils.getFluidStack(mColdSalt, aFluidAmount)); - this.addOutput(FluidUtils.getFluidStack(mHotSalt, aFluidAmount)); - this.mHeatLevel = Math.max(this.mHeatLevel, 0); - - break; - } - } - } - - return CheckRecipeResultRegistry.GENERATING; - } - - @Override - public int getMaxParallelRecipes() { - return 1; - } - - @Override - public int getMaxEfficiency(final ItemStack aStack) { - return 10000; - } - - @Override - public int getPollutionPerTick(final ItemStack aStack) { - return 0; - } - - @Override - public boolean explodesOnComponentBreak(final ItemStack aStack) { - return false; - } - - public Block getCasingBlock() { - return ModBlocks.blockSpecialMultiCasings; - } - - public Block getCasingBlock2() { - return ModBlocks.blockCasings2Misc; - } - - public byte getCasingMeta() { - return 6; - } - - public byte getCasingMeta2() { - return 8; - } - - public byte getCasingMeta3() { - return 7; - } - - public byte getCasingMeta4() { - return 11; - } - - public byte getCasingTextureIndex() { - return (byte) mCasingTextureID; - } - - @Override - public void onModeChangeByScrewdriver(ForgeDirection side, EntityPlayer aPlayer, float aX, float aY, float aZ) {} - - @Override - public void saveNBTData(NBTTagCompound aNBT) { - super.saveNBTData(aNBT); - aNBT.setInteger("mHeatLevel", mHeatLevel); - } - - @Override - public void loadNBTData(NBTTagCompound aNBT) { - super.loadNBTData(aNBT); - mHeatLevel = aNBT.getInteger("mHeatLevel"); - } - - @Override - public void onRemoval() { - resetSolarHeaters(); - super.onRemoval(); - } - - private void resetSolarHeaters() { - for (TileEntitySolarHeater aTile : this.mSolarHeaters) { - aTile.clearSolarTower(); - } - this.mSolarHeaters.clear(); - } - - @Override - public String[] getExtraInfoData() { - return new String[] { "Internal Heat Level: " + this.mHeatLevel, - "Connected Solar Reflectors: " + this.mSolarHeaters.size() }; - } - - @Override - public boolean doesBindPlayerInventory() { - return false; - } -} diff --git a/gtpp/src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/production/algae/GregtechMTE_AlgaePondBase.java b/gtpp/src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/production/algae/GregtechMTE_AlgaePondBase.java deleted file mode 100644 index 8a3442b5e7..0000000000 --- a/gtpp/src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/production/algae/GregtechMTE_AlgaePondBase.java +++ /dev/null @@ -1,376 +0,0 @@ -package gtPlusPlus.xmod.gregtech.common.tileentities.machines.multi.production.algae; - -import static com.gtnewhorizon.structurelib.structure.StructureUtility.ofBlock; -import static com.gtnewhorizon.structurelib.structure.StructureUtility.ofChain; -import static com.gtnewhorizon.structurelib.structure.StructureUtility.onElementPass; -import static com.gtnewhorizon.structurelib.structure.StructureUtility.transpose; -import static gregtech.api.enums.GT_HatchElement.InputBus; -import static gregtech.api.enums.GT_HatchElement.InputHatch; -import static gregtech.api.enums.GT_HatchElement.OutputBus; -import static gregtech.api.util.GT_StructureUtility.buildHatchAdder; - -import java.util.stream.Stream; - -import javax.annotation.Nonnull; -import javax.annotation.Nullable; - -import net.minecraft.block.Block; -import net.minecraft.init.Blocks; -import net.minecraft.item.ItemStack; -import net.minecraftforge.fluids.FluidStack; - -import org.jetbrains.annotations.NotNull; - -import com.gtnewhorizon.structurelib.alignment.IAlignmentLimits; -import com.gtnewhorizon.structurelib.alignment.constructable.ISurvivalConstructable; -import com.gtnewhorizon.structurelib.structure.IStructureDefinition; -import com.gtnewhorizon.structurelib.structure.ISurvivalBuildEnvironment; -import com.gtnewhorizon.structurelib.structure.StructureDefinition; - -import gregtech.api.GregTech_API; -import gregtech.api.enums.SoundResource; -import gregtech.api.enums.TAE; -import gregtech.api.interfaces.IIconContainer; -import gregtech.api.interfaces.metatileentity.IMetaTileEntity; -import gregtech.api.interfaces.tileentity.IGregTechTileEntity; -import gregtech.api.logic.ProcessingLogic; -import gregtech.api.recipe.RecipeMap; -import gregtech.api.recipe.check.CheckRecipeResult; -import gregtech.api.recipe.check.CheckRecipeResultRegistry; -import gregtech.api.recipe.check.SimpleCheckRecipeResult; -import gregtech.api.util.GT_Multiblock_Tooltip_Builder; -import gregtech.api.util.GT_Recipe; -import gregtech.api.util.GT_StreamUtil; -import gregtech.api.util.GT_Utility; -import gtPlusPlus.api.objects.Logger; -import gtPlusPlus.core.block.ModBlocks; -import gtPlusPlus.core.item.chemistry.AgriculturalChem; -import gtPlusPlus.core.lib.CORE; -import gtPlusPlus.core.util.minecraft.FluidUtils; -import gtPlusPlus.core.util.minecraft.ItemUtils; -import gtPlusPlus.core.util.reflect.ReflectionUtils; -import gtPlusPlus.xmod.gregtech.api.metatileentity.implementations.base.GregtechMeta_MultiBlockBase; -import gtPlusPlus.xmod.gregtech.common.blocks.textures.TexturesGtBlock; -import gtPlusPlus.xmod.gregtech.loaders.recipe.RecipeLoader_AlgaeFarm; -import ic2.core.init.BlocksItems; -import ic2.core.init.InternalName; - -public class GregtechMTE_AlgaePondBase extends GregtechMeta_MultiBlockBase<GregtechMTE_AlgaePondBase> - implements ISurvivalConstructable { - - private int mLevel = -1; - private int mCasing; - private static IStructureDefinition<GregtechMTE_AlgaePondBase> STRUCTURE_DEFINITION = null; - private int checkMeta; - private int minTierOfHatch; - private static final Class<?> cofhWater; - - static { - cofhWater = ReflectionUtils.getClass("cofh.asmhooks.block.BlockWater"); - } - - public GregtechMTE_AlgaePondBase(final int aID, final String aName, final String aNameRegional) { - super(aID, aName, aNameRegional); - } - - public GregtechMTE_AlgaePondBase(final String aName) { - super(aName); - } - - @Override - public IMetaTileEntity newMetaEntity(final IGregTechTileEntity aTileEntity) { - return new GregtechMTE_AlgaePondBase(this.mName); - } - - @Override - public String getMachineType() { - return "Algae Pond"; - } - - @Override - protected GT_Multiblock_Tooltip_Builder createTooltip() { - GT_Multiblock_Tooltip_Builder tt = new GT_Multiblock_Tooltip_Builder(); - tt.addMachineType(getMachineType()) - .addInfo("Grows Algae!") - .addInfo("Controller Block for the Algae Farm") - .addInfo("Provide compost to boost production by one tier") - .addInfo("Does not require power or maintenance") - .addInfo("All Machine Casings must be the same tier, this dictates machine speed.") - .addInfo("All Buses/Hatches must, at least, match the tier of the Casings") - .addInfo("Fill Input Hatch with Water to fill the inside of the multiblock.") - .addPollutionAmount(getPollutionPerSecond(null)) - .addSeparator() - .beginStructureBlock(9, 3, 9, true) - .addController("Front Center") - .addCasingInfoMin("Machine Casings", 64, true) - .addCasingInfoMin("Sterile Farm Casings", 64, false) - .addInputBus("Any Casing", 1) - .addOutputBus("Any Casing", 1) - .addInputHatch("Any Casing", 1) - .toolTipFinisher(CORE.GT_Tooltip_Builder.get()); - return tt; - } - - public void setMeta(int meta) { - checkMeta = meta; - } - - public int getMeta() { - return checkMeta; - } - - @Override - public IStructureDefinition<GregtechMTE_AlgaePondBase> getStructureDefinition() { - if (STRUCTURE_DEFINITION == null) { - STRUCTURE_DEFINITION = StructureDefinition.<GregtechMTE_AlgaePondBase>builder() - .addShape( - mName, - transpose( - new String[][] { - { "XXXXXXXXX", "X X", "X X", "X X", "X X", "X X", "X X", - "X X", "XXXXXXXXX" }, - { "XXXXXXXXX", "X X", "X X", "X X", "X X", "X X", "X X", - "X X", "XXXXXXXXX" }, - { "CCCC~CCCC", "CCCCCCCCC", "CCCCCCCCC", "CCCCCCCCC", "CCCCCCCCC", "CCCCCCCCC", "CCCCCCCCC", - "CCCCCCCCC", "CCCCCCCCC" }, })) - .addElement( - 'C', - ofChain( - buildHatchAdder(GregtechMTE_AlgaePondBase.class).atLeast(InputHatch, InputBus, OutputBus) - .casingIndex(TAE.getIndexFromPage(1, 15)) - .dot(1) - .build(), - onElementPass( - x -> ++x.mCasing, - addTieredBlock( - GregTech_API.sBlockCasings1, - GregtechMTE_AlgaePondBase::setMeta, - GregtechMTE_AlgaePondBase::getMeta, - 10)))) - .addElement('X', ofBlock(ModBlocks.blockCasings2Misc, 15)) - .build(); - } - return STRUCTURE_DEFINITION; - } - - @Override - public void construct(ItemStack stackSize, boolean hintsOnly) { - buildPiece(mName, stackSize, hintsOnly, 4, 2, 0); - } - - @Override - public int survivalConstruct(ItemStack stackSize, int elementBudget, ISurvivalBuildEnvironment env) { - if (mMachine) return -1; - return survivialBuildPiece(mName, stackSize, 4, 2, 0, elementBudget, env, false, true); - } - - @Override - public boolean checkMachine(IGregTechTileEntity aBaseMetaTileEntity, ItemStack aStack) { - mCasing = 0; - mLevel = 0; - checkMeta = 0; - minTierOfHatch = 100; - if (checkPiece(mName, 4, 2, 0) && mCasing >= 64 && checkMeta > 0) { - mLevel = checkMeta - 1; - return mLevel <= minTierOfHatch; - } - return false; - } - - @Override - protected IAlignmentLimits getInitialAlignmentLimits() { - return (d, r, f) -> d.offsetY == 0 && r.isNotRotated() && !f.isVerticallyFliped(); - } - - @Override - protected SoundResource getProcessStartSound() { - return SoundResource.IC2_MACHINES_ELECTROFURNACE_LOOP; - } - - @Override - protected IIconContainer getActiveOverlay() { - return TexturesGtBlock.Overlay_Machine_Controller_Default_Active; - } - - @Override - protected IIconContainer getInactiveOverlay() { - return TexturesGtBlock.Overlay_Machine_Controller_Default; - } - - @Override - protected int getCasingTextureId() { - int aID = TAE.getIndexFromPage(1, 15); - if (mLevel > -1) { - aID = mLevel; - } - return aID; - } - - @Override - public int getMaxParallelRecipes() { - return 2; - } - - public boolean checkForWater() { - - // Get Facing direction - IGregTechTileEntity aBaseMetaTileEntity = this.getBaseMetaTileEntity(); - int mDirectionX = aBaseMetaTileEntity.getBackFacing().offsetX; - int mCurrentDirectionX; - int mCurrentDirectionZ; - int mOffsetX_Lower = 0; - int mOffsetX_Upper = 0; - int mOffsetZ_Lower = 0; - int mOffsetZ_Upper = 0; - - mCurrentDirectionX = 4; - mCurrentDirectionZ = 4; - - mOffsetX_Lower = -4; - mOffsetX_Upper = 4; - mOffsetZ_Lower = -4; - mOffsetZ_Upper = 4; - - // if (aBaseMetaTileEntity.fac) - - final int xDir = aBaseMetaTileEntity.getBackFacing().offsetX * mCurrentDirectionX; - final int zDir = aBaseMetaTileEntity.getBackFacing().offsetZ * mCurrentDirectionZ; - - int tAmount = 0; - for (int i = mOffsetX_Lower + 1; i <= mOffsetX_Upper - 1; ++i) { - for (int j = mOffsetZ_Lower + 1; j <= mOffsetZ_Upper - 1; ++j) { - for (int h = 0; h < 2; h++) { - Block tBlock = aBaseMetaTileEntity.getBlockOffset(xDir + i, h, zDir + j); - byte tMeta = aBaseMetaTileEntity.getMetaIDOffset(xDir + i, h, zDir + j); - if (isNotStaticWater(tBlock, tMeta)) { - if (this.getStoredFluids() != null) { - for (FluidStack stored : this.getStoredFluids()) { - if (stored.isFluidEqual(FluidUtils.getFluidStack("water", 1))) { - if (stored.amount >= 1000) { - // Utils.LOG_WARNING("Going to try swap an air block for water from inut bus."); - stored.amount -= 1000; - Block fluidUsed = Blocks.water; - aBaseMetaTileEntity.getWorld() - .setBlock( - aBaseMetaTileEntity.getXCoord() + xDir + i, - aBaseMetaTileEntity.getYCoord() + h, - aBaseMetaTileEntity.getZCoord() + zDir + j, - fluidUsed); - } - } - } - } - } - tBlock = aBaseMetaTileEntity.getBlockOffset(xDir + i, h, zDir + j); - if (tBlock == Blocks.water || tBlock == Blocks.flowing_water) { - ++tAmount; - // Logger.INFO("Found Water"); - } - } - } - } - - boolean isValidWater = tAmount >= 49; - - if (isValidWater) { - Logger.INFO("Filled structure."); - return true; - } else { - return false; - } - } - - private boolean isNotStaticWater(Block block, byte meta) { - return block == Blocks.air || block == Blocks.flowing_water - || block == BlocksItems.getFluidBlock(InternalName.fluidDistilledWater) - || (cofhWater != null && cofhWater.isAssignableFrom(block.getClass()) && meta != 0); - } - - @Override - public int getMaxEfficiency(final ItemStack aStack) { - return 10000; - } - - @Override - public int getPollutionPerSecond(final ItemStack aStack) { - return CORE.ConfigSwitches.pollutionPerSecondMultiAlgaePond; - } - - @Override - public boolean explodesOnComponentBreak(final ItemStack aStack) { - return false; - } - - @Override - public void onPostTick(IGregTechTileEntity aBaseMetaTileEntity, long aTick) { - super.onPostTick(aBaseMetaTileEntity, aTick); - } - - @Override - public void onPreTick(IGregTechTileEntity aBaseMetaTileEntity, long aTick) { - super.onPreTick(aBaseMetaTileEntity, aTick); - this.fixAllMaintenanceIssue(); - // Silly Client Syncing - if (aBaseMetaTileEntity.isClientSide()) { - this.mLevel = getCasingTier(); - } - } - - @Override - protected ProcessingLogic createProcessingLogic() { - return new ProcessingLogic() { - - @Nonnull - @Override - protected Stream<GT_Recipe> findRecipeMatches(@Nullable RecipeMap<?> map) { - return GT_StreamUtil - .ofNullable(RecipeLoader_AlgaeFarm.getTieredRecipeFromCache(mLevel, isUsingCompost(inputItems))); - } - - @NotNull - @Override - protected CheckRecipeResult validateRecipe(@NotNull GT_Recipe recipe) { - if (!checkForWater()) { - return SimpleCheckRecipeResult.ofFailure("no_water"); - } - return CheckRecipeResultRegistry.SUCCESSFUL; - } - }.setEuModifier(0F) - .setMaxParallelSupplier(this::getMaxParallelRecipes); - } - - private boolean isUsingCompost(ItemStack[] aItemInputs) { - ItemStack aCompost = ItemUtils.getSimpleStack(AgriculturalChem.mCompost, 1); - for (ItemStack i : aItemInputs) { - if (GT_Utility.areStacksEqual(aCompost, i)) { - if (i.stackSize >= RecipeLoader_AlgaeFarm.compostForTier(mLevel)) { - return true; - } - } - } - return false; - } - - private int getCasingTier() { - if (this.getBaseMetaTileEntity() - .getWorld() == null) { - return 0; - } - try { - Block aInitStructureCheck; - int aInitStructureCheckMeta; - IGregTechTileEntity aBaseMetaTileEntity = this.getBaseMetaTileEntity(); - int xDir = aBaseMetaTileEntity.getBackFacing().offsetX; - int zDir = aBaseMetaTileEntity.getBackFacing().offsetZ; - aInitStructureCheck = aBaseMetaTileEntity.getBlockOffset(xDir, -1, zDir); - aInitStructureCheckMeta = aBaseMetaTileEntity.getMetaIDOffset(xDir, -1, zDir); - if (aInitStructureCheck == GregTech_API.sBlockCasings1) { - return aInitStructureCheckMeta; - } - return 0; - } catch (Throwable t) { - t.printStackTrace(); - return 0; - } - } -} diff --git a/gtpp/src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/production/chemplant/GregtechMTE_ChemicalPlant.java b/gtpp/src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/production/chemplant/GregtechMTE_ChemicalPlant.java deleted file mode 100644 index 30d2f75457..0000000000 --- a/gtpp/src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/production/chemplant/GregtechMTE_ChemicalPlant.java +++ /dev/null @@ -1,676 +0,0 @@ -package gtPlusPlus.xmod.gregtech.common.tileentities.machines.multi.production.chemplant; - -import static com.gtnewhorizon.structurelib.structure.StructureUtility.ofChain; -import static com.gtnewhorizon.structurelib.structure.StructureUtility.transpose; -import static com.gtnewhorizon.structurelib.structure.StructureUtility.withChannel; -import static gregtech.api.enums.GT_HatchElement.InputBus; -import static gregtech.api.enums.GT_HatchElement.InputHatch; -import static gregtech.api.enums.GT_HatchElement.Maintenance; -import static gregtech.api.enums.GT_HatchElement.OutputBus; -import static gregtech.api.enums.GT_HatchElement.OutputHatch; -import static gregtech.api.util.GT_StructureUtility.buildHatchAdder; -import static gregtech.api.util.GT_StructureUtility.filterByMTETier; -import static gregtech.api.util.GT_StructureUtility.ofCoil; -import static gregtech.api.util.GT_Utility.filterValidMTEs; - -import java.util.ArrayList; -import java.util.Arrays; -import java.util.HashMap; -import java.util.stream.Collectors; -import java.util.stream.IntStream; - -import javax.annotation.Nonnull; -import javax.annotation.Nullable; - -import net.minecraft.block.Block; -import net.minecraft.item.ItemStack; -import net.minecraft.nbt.NBTTagCompound; -import net.minecraft.world.World; - -import org.jetbrains.annotations.NotNull; - -import com.gtnewhorizon.structurelib.StructureLibAPI; -import com.gtnewhorizon.structurelib.alignment.constructable.ISurvivalConstructable; -import com.gtnewhorizon.structurelib.structure.AutoPlaceEnvironment; -import com.gtnewhorizon.structurelib.structure.IStructureDefinition; -import com.gtnewhorizon.structurelib.structure.IStructureElement; -import com.gtnewhorizon.structurelib.structure.ISurvivalBuildEnvironment; -import com.gtnewhorizon.structurelib.structure.StructureDefinition; -import com.gtnewhorizon.structurelib.structure.StructureUtility; - -import gregtech.api.GregTech_API; -import gregtech.api.enums.HeatingCoilLevel; -import gregtech.api.enums.SoundResource; -import gregtech.api.interfaces.IIconContainer; -import gregtech.api.interfaces.metatileentity.IMetaTileEntity; -import gregtech.api.interfaces.tileentity.IGregTechTileEntity; -import gregtech.api.logic.ProcessingLogic; -import gregtech.api.metatileentity.GregTechTileClientEvents; -import gregtech.api.metatileentity.implementations.GT_MetaTileEntity_Hatch; -import gregtech.api.metatileentity.implementations.GT_MetaTileEntity_Hatch_Energy; -import gregtech.api.metatileentity.implementations.GT_MetaTileEntity_Hatch_Input; -import gregtech.api.metatileentity.implementations.GT_MetaTileEntity_Hatch_InputBus; -import gregtech.api.metatileentity.implementations.GT_MetaTileEntity_Hatch_Maintenance; -import gregtech.api.metatileentity.implementations.GT_MetaTileEntity_Hatch_Output; -import gregtech.api.metatileentity.implementations.GT_MetaTileEntity_Hatch_OutputBus; -import gregtech.api.metatileentity.implementations.GT_MetaTileEntity_TieredMachineBlock; -import gregtech.api.recipe.RecipeMap; -import gregtech.api.recipe.check.CheckRecipeResult; -import gregtech.api.recipe.check.CheckRecipeResultRegistry; -import gregtech.api.recipe.check.SimpleCheckRecipeResult; -import gregtech.api.util.GT_Multiblock_Tooltip_Builder; -import gregtech.api.util.GT_Recipe; -import gregtech.api.util.GT_Utility; -import gregtech.common.tileentities.machines.IDualInputHatch; -import gtPlusPlus.api.objects.data.AutoMap; -import gtPlusPlus.api.objects.data.Triplet; -import gtPlusPlus.api.recipe.GTPPRecipeMaps; -import gtPlusPlus.core.item.chemistry.general.ItemGenericChemBase; -import gtPlusPlus.core.lib.CORE; -import gtPlusPlus.core.recipe.common.CI; -import gtPlusPlus.core.util.math.MathUtils; -import gtPlusPlus.core.util.minecraft.ItemUtils; -import gtPlusPlus.xmod.gregtech.api.metatileentity.implementations.base.GregtechMeta_MultiBlockBase; -import gtPlusPlus.xmod.gregtech.api.metatileentity.implementations.nbthandlers.GT_MetaTileEntity_Hatch_Catalysts; -import gtPlusPlus.xmod.gregtech.common.blocks.textures.TexturesGtBlock; - -public class GregtechMTE_ChemicalPlant extends GregtechMeta_MultiBlockBase<GregtechMTE_ChemicalPlant> - implements ISurvivalConstructable { - - private int mSolidCasingTier = 0; - private int mMachineCasingTier = 0; - private int mPipeCasingTier = 0; - private int mCoilTier = 0; - private HeatingCoilLevel checkCoil; - private int[] checkCasing = new int[8]; - private int checkMachine; - private int checkPipe; - private int maxTierOfHatch; - private int mCasing; - private static IStructureDefinition<GregtechMTE_ChemicalPlant> STRUCTURE_DEFINITION = null; - - private final ArrayList<GT_MetaTileEntity_Hatch_Catalysts> mCatalystBuses = new ArrayList<>(); - - private static final HashMap<Integer, Triplet<Block, Integer, Integer>> mTieredBlockRegistry = new HashMap<>(); - - public GregtechMTE_ChemicalPlant(final int aID, final String aName, final String aNameRegional) { - super(aID, aName, aNameRegional); - } - - public GregtechMTE_ChemicalPlant(final String aName) { - super(aName); - } - - public static boolean registerMachineCasingForTier(int aTier, Block aBlock, int aMeta, int aCasingTextureID) { - Triplet<Block, Integer, Integer> aCasingData = new Triplet<>(aBlock, aMeta, aCasingTextureID); - if (mTieredBlockRegistry.containsKey(aTier)) { - CORE.crash( - "Tried to register a Machine casing for tier " + aTier - + " to the Chemical Plant, however this tier already contains one."); - } - mTieredBlockRegistry.put(aTier, aCasingData); - return true; - } - - private static int getCasingTextureIdForTier(int aTier) { - if (!mTieredBlockRegistry.containsKey(aTier)) { - return 10; - } - int aCasingID = mTieredBlockRegistry.get(aTier) - .getValue_3(); - // Logger.INFO("Found casing texture ID "+aCasingID+" for tier "+aTier); - return aCasingID; - } - - @Override - public IMetaTileEntity newMetaEntity(final IGregTechTileEntity aTileEntity) { - return new GregtechMTE_ChemicalPlant(this.mName); - } - - @Override - public String getMachineType() { - return "Chemical Plant"; - } - - @Override - protected GT_Multiblock_Tooltip_Builder createTooltip() { - GT_Multiblock_Tooltip_Builder tt = new GT_Multiblock_Tooltip_Builder(); - tt.addMachineType(getMachineType()) - .addInfo("Controller Block for the Chemical Plant") - .addInfo("Heavy Industry, now right at your doorstep!") - .addInfo("Please read the user manual for more information on construction and usage") - .addSeparator() - .addController("Bottom Center") - .addStructureHint("Catalyst Housing", 1) - .addInputBus("Bottom Casing", 1) - .addOutputBus("Bottom Casing", 1) - .addInputHatch("Bottom Casing", 1) - .addOutputHatch("Bottom Casing", 1) - .addEnergyHatch("Bottom Casing", 1) - .addMaintenanceHatch("Bottom Casing", 1) - .addSubChannelUsage("casing", "metal machine casing") - .addSubChannelUsage("machine", "tier machine casing") - .addSubChannelUsage("coil", "heating coil blocks") - .addSubChannelUsage("pipe", "pipe casing blocks") - .toolTipFinisher(CORE.GT_Tooltip_Builder.get()); - return tt; - } - - public void setMachineMeta(int meta) { - checkMachine = meta; - } - - public int getMachineMeta() { - return checkMachine; - } - - public void setPipeMeta(int meta) { - checkPipe = meta; - } - - public int getPipeMeta() { - return checkPipe; - } - - public void setCoilMeta(HeatingCoilLevel meta) { - checkCoil = meta; - } - - public HeatingCoilLevel getCoilMeta() { - return checkCoil; - } - - @Override - public IStructureDefinition<GregtechMTE_ChemicalPlant> getStructureDefinition() { - if (STRUCTURE_DEFINITION == null) { - IStructureElement<GregtechMTE_ChemicalPlant> allCasingsElement = withChannel( - "casing", - ofChain( - IntStream.range(0, 8) - .mapToObj(GregtechMTE_ChemicalPlant::ofSolidCasing) - .collect(Collectors.toList()))); - STRUCTURE_DEFINITION = StructureDefinition.<GregtechMTE_ChemicalPlant>builder() - .addShape( - mName, - transpose( - new String[][] { - { "XXXXXXX", "XXXXXXX", "XXXXXXX", "XXXXXXX", "XXXXXXX", "XXXXXXX", "XXXXXXX" }, - { "X X", " MMMMM ", " MHHHM ", " MHHHM ", " MHHHM ", " MMMMM ", "X X" }, - { "X X", " ", " PPP ", " PPP ", " PPP ", " ", "X X" }, - { "X X", " ", " HHH ", " HHH ", " HHH ", " ", "X X" }, - { "X X", " ", " PPP ", " PPP ", " PPP ", " ", "X X" }, - { "X X", " MMMMM ", " MHHHM ", " MHHHM ", " MHHHM ", " MMMMM ", "X X" }, - { "CCC~CCC", "CMMMMMC", "CMMMMMC", "CMMMMMC", "CMMMMMC", "CMMMMMC", "CCCCCCC" }, })) - .addElement( - 'C', - ofChain( - buildHatchAdder(GregtechMTE_ChemicalPlant.class).atLeast(Maintenance) - .casingIndex(getCasingTextureID()) - .dot(1) - .build(), - buildHatchAdder(GregtechMTE_ChemicalPlant.class) - .atLeast(InputHatch, OutputHatch, InputBus, OutputBus) - .adder(GregtechMTE_ChemicalPlant::addChemicalPlantList) - .hatchItemFilterAnd( - (t, s) -> filterByMTETier( - Integer.MIN_VALUE, - s.stackSize >= 10 ? Integer.MAX_VALUE : s.stackSize)) - .casingIndex(getCasingTextureID()) - .dot(1) - .build(), - buildHatchAdder(GregtechMTE_ChemicalPlant.class) - .hatchClass(GT_MetaTileEntity_Hatch_Catalysts.class) - .shouldReject(t -> t.mCatalystBuses.size() >= 1) - .adder(GregtechMTE_ChemicalPlant::addChemicalPlantList) - .casingIndex(getCasingTextureID()) - .dot(1) - .build(), - allCasingsElement)) - .addElement('X', allCasingsElement) - .addElement( - 'M', - withChannel( - "machine", - addTieredBlock( - GregTech_API.sBlockCasings1, - GregtechMTE_ChemicalPlant::setMachineMeta, - GregtechMTE_ChemicalPlant::getMachineMeta, - 10))) - .addElement( - 'H', - withChannel( - "coil", - ofCoil(GregtechMTE_ChemicalPlant::setCoilMeta, GregtechMTE_ChemicalPlant::getCoilMeta))) - .addElement( - 'P', - withChannel( - "pipe", - addTieredBlock( - GregTech_API.sBlockCasings2, - GregtechMTE_ChemicalPlant::setPipeMeta, - GregtechMTE_ChemicalPlant::getPipeMeta, - 12, - 16))) - .build(); - } - return STRUCTURE_DEFINITION; - } - - private static IStructureElement<GregtechMTE_ChemicalPlant> ofSolidCasing(int aIndex) { - return new IStructureElement<GregtechMTE_ChemicalPlant>() { - - @Override - public boolean check(GregtechMTE_ChemicalPlant t, World world, int x, int y, int z) { - if (check(aIndex, world, x, y, z)) { - t.checkCasing[aIndex]++; - t.mCasing++; - return true; - } else return false; - } - - private boolean check(int aIndex, World world, int x, int y, int z) { - Block block = world.getBlock(x, y, z); - int meta = world.getBlockMetadata(x, y, z); - Block target = mTieredBlockRegistry.get(aIndex) - .getValue_1(); - int targetMeta = mTieredBlockRegistry.get(aIndex) - .getValue_2(); - return target.equals(block) && meta == targetMeta; - } - - int getIndex(int size) { - if (size > 8) size = 8; - return size - 1; - } - - @Override - public boolean spawnHint(GregtechMTE_ChemicalPlant t, World world, int x, int y, int z, ItemStack trigger) { - StructureLibAPI.hintParticle( - world, - x, - y, - z, - mTieredBlockRegistry.get(getIndex(trigger.stackSize)) - .getValue_1(), - mTieredBlockRegistry.get(getIndex(trigger.stackSize)) - .getValue_2()); - return true; - } - - @Override - public boolean placeBlock(GregtechMTE_ChemicalPlant t, World world, int x, int y, int z, - ItemStack trigger) { - return world.setBlock( - x, - y, - z, - mTieredBlockRegistry.get(getIndex(trigger.stackSize)) - .getValue_1(), - mTieredBlockRegistry.get(getIndex(trigger.stackSize)) - .getValue_2(), - 3); - } - - @Nullable - @Override - public BlocksToPlace getBlocksToPlace(GregtechMTE_ChemicalPlant gregtechMTE_chemicalPlant, World world, - int x, int y, int z, ItemStack trigger, AutoPlaceEnvironment env) { - return BlocksToPlace.create( - mTieredBlockRegistry.get(getIndex(trigger.stackSize)) - .getValue_1(), - mTieredBlockRegistry.get(getIndex(trigger.stackSize)) - .getValue_2()); - } - - @Override - public PlaceResult survivalPlaceBlock(GregtechMTE_ChemicalPlant t, World world, int x, int y, int z, - ItemStack trigger, AutoPlaceEnvironment env) { - if (check(getIndex(trigger.stackSize), world, x, y, z)) return PlaceResult.SKIP; - return StructureUtility.survivalPlaceBlock( - mTieredBlockRegistry.get(getIndex(trigger.stackSize)) - .getValue_1(), - mTieredBlockRegistry.get(getIndex(trigger.stackSize)) - .getValue_2(), - world, - x, - y, - z, - env.getSource(), - env.getActor(), - env.getChatter()); - } - }; - } - - @Override - public void construct(ItemStack stackSize, boolean hintsOnly) { - buildPiece(mName, stackSize, hintsOnly, 3, 6, 0); - } - - @Override - public int survivalConstruct(ItemStack stackSize, int elementBudget, ISurvivalBuildEnvironment env) { - if (mMachine) return -1; - return survivialBuildPiece(mName, stackSize, 3, 6, 0, elementBudget, env, false, true); - } - - @Override - public boolean checkMachine(IGregTechTileEntity aBaseMetaTileEntity, ItemStack aStack) { - mCasing = 0; - for (int i = 0; i < 8; i++) { - checkCasing[i] = 0; - } - checkPipe = 0; - checkMachine = 0; - mSolidCasingTier = 0; - mMachineCasingTier = 0; - mPipeCasingTier = 0; - mCoilTier = 0; - maxTierOfHatch = 0; - mCatalystBuses.clear(); - setCoilMeta(HeatingCoilLevel.None); - if (checkPiece(mName, 3, 6, 0) && mCasing >= 70) { - for (int i = 0; i < 8; i++) { - if (checkCasing[i] == mCasing) { - mSolidCasingTier = i; - } else if (checkCasing[i] > 0) return false; - } - mMachineCasingTier = checkMachine - 1; - mPipeCasingTier = checkPipe - 12; - mCoilTier = checkCoil.getTier(); - getBaseMetaTileEntity().sendBlockEvent(GregTechTileClientEvents.CHANGE_CUSTOM_DATA, getUpdateData()); - updateHatchTexture(); - return (mMachineCasingTier >= 9 || mMachineCasingTier >= maxTierOfHatch) && mCatalystBuses.size() <= 1; - } - return false; - } - - public void updateHatchTexture() { - for (GT_MetaTileEntity_Hatch h : mCatalystBuses) h.updateTexture(getCasingTextureID()); - for (IDualInputHatch h : mDualInputHatches) h.updateTexture(getCasingTextureID()); - for (GT_MetaTileEntity_Hatch h : mInputBusses) h.updateTexture(getCasingTextureID()); - for (GT_MetaTileEntity_Hatch h : mMaintenanceHatches) h.updateTexture(getCasingTextureID()); - for (GT_MetaTileEntity_Hatch h : mEnergyHatches) h.updateTexture(getCasingTextureID()); - for (GT_MetaTileEntity_Hatch h : mOutputBusses) h.updateTexture(getCasingTextureID()); - for (GT_MetaTileEntity_Hatch h : mInputHatches) h.updateTexture(getCasingTextureID()); - for (GT_MetaTileEntity_Hatch h : mOutputHatches) h.updateTexture(getCasingTextureID()); - } - - public final boolean addChemicalPlantList(IGregTechTileEntity aTileEntity, int aBaseCasingIndex) { - if (aTileEntity == null) { - return false; - } else { - IMetaTileEntity aMetaTileEntity = aTileEntity.getMetaTileEntity(); - if (aMetaTileEntity instanceof GT_MetaTileEntity_Hatch_Catalysts) { - return addToMachineList(aTileEntity, aBaseCasingIndex); - } else if (aMetaTileEntity instanceof GT_MetaTileEntity_Hatch_InputBus) { - maxTierOfHatch = Math.max(maxTierOfHatch, ((GT_MetaTileEntity_Hatch_InputBus) aMetaTileEntity).mTier); - return addToMachineList(aTileEntity, aBaseCasingIndex); - } else if (aMetaTileEntity instanceof GT_MetaTileEntity_Hatch_Maintenance) { - return addToMachineList(aTileEntity, aBaseCasingIndex); - } else if (aMetaTileEntity instanceof GT_MetaTileEntity_Hatch_Energy) { - maxTierOfHatch = Math.max(maxTierOfHatch, ((GT_MetaTileEntity_Hatch_Energy) aMetaTileEntity).mTier); - return addToMachineList(aTileEntity, aBaseCasingIndex); - } else if (aMetaTileEntity instanceof GT_MetaTileEntity_Hatch_OutputBus) { - maxTierOfHatch = Math.max(maxTierOfHatch, ((GT_MetaTileEntity_Hatch_OutputBus) aMetaTileEntity).mTier); - return addToMachineList(aTileEntity, aBaseCasingIndex); - } else if (aMetaTileEntity instanceof GT_MetaTileEntity_Hatch_Input) { - maxTierOfHatch = Math.max(maxTierOfHatch, ((GT_MetaTileEntity_Hatch_Input) aMetaTileEntity).mTier); - return addToMachineList(aTileEntity, aBaseCasingIndex); - } else if (aMetaTileEntity instanceof GT_MetaTileEntity_Hatch_Output) { - maxTierOfHatch = Math.max(maxTierOfHatch, ((GT_MetaTileEntity_Hatch_Output) aMetaTileEntity).mTier); - return addToMachineList(aTileEntity, aBaseCasingIndex); - } - } - return false; - } - - @Override - protected SoundResource getProcessStartSound() { - return SoundResource.IC2_MACHINES_ELECTROFURNACE_LOOP; - } - - @Override - protected IIconContainer getActiveOverlay() { - return TexturesGtBlock.Overlay_Machine_Controller_Advanced_Active; - } - - @Override - protected IIconContainer getInactiveOverlay() { - return TexturesGtBlock.Overlay_Machine_Controller_Advanced; - } - - @Override - protected int getCasingTextureId() { - return getCasingTextureID(); - } - - @Override - public RecipeMap<?> getRecipeMap() { - return GTPPRecipeMaps.chemicalPlantRecipes; - } - - @Override - public int getMaxParallelRecipes() { - return 2 * getPipeCasingTier(); - } - - private int getSolidCasingTier() { - return this.mSolidCasingTier; - } - - private int getMachineCasingTier() { - return mMachineCasingTier; - } - - private int getPipeCasingTier() { - return mPipeCasingTier; - } - - private int getCasingTextureID() { - // Check the Tier Client Side - int aTier = mSolidCasingTier; - return getCasingTextureIdForTier(aTier); - } - - public boolean addToMachineList(IGregTechTileEntity aTileEntity) { - int aMaxTier = getMachineCasingTier(); - final IMetaTileEntity aMetaTileEntity = aTileEntity.getMetaTileEntity(); - if (aMetaTileEntity instanceof GT_MetaTileEntity_TieredMachineBlock aMachineBlock) { - int aTileTier = aMachineBlock.mTier; - if (aTileTier > aMaxTier) { - log("Hatch tier too high."); - return false; - } else { - return addToMachineList(aTileEntity, getCasingTextureID()); - } - } else { - log("Bad Tile Entity being added to hatch map."); // Shouldn't ever happen, but.. ya know.. - return false; - } - } - - @Override - public void saveNBTData(NBTTagCompound aNBT) { - super.saveNBTData(aNBT); - aNBT.setInteger("mSolidCasingTier", this.mSolidCasingTier); - aNBT.setInteger("mMachineCasingTier", this.mMachineCasingTier); - aNBT.setInteger("mPipeCasingTier", this.mPipeCasingTier); - aNBT.setInteger("mCoilTier", this.mCoilTier); - } - - @Override - public void loadNBTData(NBTTagCompound aNBT) { - super.loadNBTData(aNBT); - mSolidCasingTier = aNBT.getInteger("mSolidCasingTier"); - mMachineCasingTier = aNBT.getInteger("mMachineCasingTier"); - mPipeCasingTier = aNBT.getInteger("mPipeCasingTier"); - mCoilTier = aNBT.getInteger("mCoilTier"); - } - - @Override - public boolean addToMachineList(IGregTechTileEntity aTileEntity, int aBaseCasingIndex) { - final IMetaTileEntity aMetaTileEntity = aTileEntity.getMetaTileEntity(); - if (aMetaTileEntity == null) { - return false; - } - if (aMetaTileEntity instanceof GT_MetaTileEntity_Hatch_Catalysts) { - log("Found GT_MetaTileEntity_Hatch_Catalysts"); - return addToMachineListInternal(mCatalystBuses, aMetaTileEntity, aBaseCasingIndex); - } - return super.addToMachineList(aTileEntity, aBaseCasingIndex); - } - - @Override - public int getMaxEfficiency(final ItemStack aStack) { - return 10000; - } - - @Override - public int getPollutionPerTick(final ItemStack aStack) { - return 0; - } - - @Override - public boolean explodesOnComponentBreak(final ItemStack aStack) { - return false; - } - - public int getMaxCatalystDurability() { - return 50; - } - - @Override - public byte getUpdateData() { - return (byte) mSolidCasingTier; - } - - @Override - public void receiveClientEvent(byte aEventID, byte aValue) { - super.receiveClientEvent(aEventID, aValue); - if (aEventID == GregTechTileClientEvents.CHANGE_CUSTOM_DATA && (aValue & 0x80) == 0) { - // received an update data from above method - // if no &0x80 clause it might catch the noop texture page event - mSolidCasingTier = aValue; - } - } - - private void damageCatalyst(@Nonnull ItemStack aStack, int minParallel) { - // Awakened Draconium Coils with Tungstensteel Pipe Casings (or above) no longer consume catalysts. - if (!isCatalystDamageable()) return; - for (int i = 0; i < minParallel; i++) { - if (MathUtils.randFloat(0, 10000000) / 10000000f < (1.2f - (0.2 * this.mPipeCasingTier))) { - int damage = getDamage(aStack) + 1; - if (damage >= getMaxCatalystDurability()) { - addOutput(CI.getEmptyCatalyst(1)); - aStack.stackSize -= 1; - return; - } else { - setDamage(aStack, damage); - } - } - } - } - - private boolean isCatalystDamageable() { - return this.mCoilTier < 10 || this.mPipeCasingTier < 4; - } - - @Override - protected ProcessingLogic createProcessingLogic() { - return new ProcessingLogic() { - - ItemStack catalyst; - - @NotNull - @Override - protected CheckRecipeResult validateRecipe(@NotNull GT_Recipe recipe) { - if (recipe.mSpecialValue > mSolidCasingTier) { - return CheckRecipeResultRegistry.insufficientMachineTier(recipe.mSpecialValue + 1); - } - // checks if it has a catalyst - ItemStack catalystInRecipe = null; - for (ItemStack item : recipe.mInputs) { - if (ItemUtils.isCatalyst(item)) { - catalystInRecipe = item; - break; - } - } - - if (catalystInRecipe != null) { - catalyst = findCatalyst(getCatalystInputs().toArray(new ItemStack[0]), catalystInRecipe); - if (catalyst == null) { - return SimpleCheckRecipeResult.ofFailure("no_catalyst"); - } - } - return CheckRecipeResultRegistry.SUCCESSFUL; - } - - @NotNull - @Override - public CheckRecipeResult process() { - ArrayList<ItemStack> inputItemsList = new ArrayList<>(Arrays.asList(inputItems)); - inputItemsList.addAll(getCatalystInputs()); - inputItems = inputItemsList.toArray(new ItemStack[0]); - return super.process(); - } - - @NotNull - @Override - protected CheckRecipeResult onRecipeStart(@NotNull GT_Recipe recipe) { - if (catalyst != null) { - damageCatalyst(catalyst, getCurrentParallels()); - } - return super.onRecipeStart(recipe); - } - }.setMaxParallelSupplier(this::getMaxParallelRecipes); - } - - @Override - protected void setupProcessingLogic(ProcessingLogic logic) { - super.setupProcessingLogic(logic); - // Same speed bonus as pyro oven - logic.setSpeedBonus(2F / (1 + this.mCoilTier)); - } - - @Override - public void updateSlots() { - super.updateSlots(); - for (GT_MetaTileEntity_Hatch_Catalysts h : mCatalystBuses) { - h.updateSlots(); - h.tryFillUsageSlots(); - } - } - - private ItemStack findCatalyst(ItemStack[] aItemInputs, ItemStack catalyst) { - if (aItemInputs != null) { - for (ItemStack item : aItemInputs) { - if (GT_Utility.areStacksEqual(item, catalyst, true)) { - return item; - } - } - } - return null; - } - - private int getDamage(@Nonnull ItemStack aStack) { - return ItemGenericChemBase.getCatalystDamage(aStack); - } - - private void setDamage(@Nonnull ItemStack aStack, int aAmount) { - ItemGenericChemBase.setCatalystDamage(aStack, aAmount); - } - - /* - * Catalyst Handling - */ - public ArrayList<ItemStack> getCatalystInputs() { - ArrayList<ItemStack> tItems = new ArrayList<>(); - for (GT_MetaTileEntity_Hatch_Catalysts tHatch : filterValidMTEs(mCatalystBuses)) { - AutoMap<ItemStack> aHatchContent = tHatch.getContentUsageSlots(); - if (!aHatchContent.isEmpty()) { - tItems.addAll(aHatchContent); - } - } - return tItems; - } -} diff --git a/gtpp/src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/production/mega/GregTechMetaTileEntity_MegaAlloyBlastSmelter.java b/gtpp/src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/production/mega/GregTechMetaTileEntity_MegaAlloyBlastSmelter.java deleted file mode 100644 index 1679629c88..0000000000 --- a/gtpp/src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/production/mega/GregTechMetaTileEntity_MegaAlloyBlastSmelter.java +++ /dev/null @@ -1,468 +0,0 @@ -package gtPlusPlus.xmod.gregtech.common.tileentities.machines.multi.production.mega; - -import static com.gtnewhorizon.structurelib.structure.StructureUtility.ofBlock; -import static com.gtnewhorizon.structurelib.structure.StructureUtility.ofChain; -import static com.gtnewhorizon.structurelib.structure.StructureUtility.onElementPass; -import static com.gtnewhorizon.structurelib.structure.StructureUtility.withChannel; -import static gregtech.api.enums.GT_HatchElement.Energy; -import static gregtech.api.enums.GT_HatchElement.ExoticEnergy; -import static gregtech.api.enums.GT_HatchElement.InputBus; -import static gregtech.api.enums.GT_HatchElement.InputHatch; -import static gregtech.api.enums.GT_HatchElement.Maintenance; -import static gregtech.api.enums.GT_HatchElement.Muffler; -import static gregtech.api.enums.GT_HatchElement.OutputBus; -import static gregtech.api.enums.GT_HatchElement.OutputHatch; -import static gregtech.api.util.GT_StructureUtility.buildHatchAdder; -import static gregtech.api.util.GT_StructureUtility.ofCoil; -import static gregtech.api.util.GT_Utility.filterValidMTEs; - -import java.util.ArrayList; -import java.util.List; - -import net.minecraft.entity.player.EntityPlayer; -import net.minecraft.item.ItemStack; -import net.minecraft.nbt.NBTTagCompound; -import net.minecraft.util.EnumChatFormatting; -import net.minecraft.util.StatCollector; -import net.minecraftforge.common.util.ForgeDirection; - -import org.jetbrains.annotations.NotNull; - -import com.github.bartimaeusnek.bartworks.API.BorosilicateGlass; -import com.gtnewhorizon.structurelib.alignment.constructable.ISurvivalConstructable; -import com.gtnewhorizon.structurelib.structure.IStructureDefinition; -import com.gtnewhorizon.structurelib.structure.ISurvivalBuildEnvironment; -import com.gtnewhorizon.structurelib.structure.StructureDefinition; - -import gregtech.api.enums.GT_Values; -import gregtech.api.enums.HeatingCoilLevel; -import gregtech.api.enums.TAE; -import gregtech.api.enums.Textures; -import gregtech.api.interfaces.ITexture; -import gregtech.api.interfaces.metatileentity.IMetaTileEntity; -import gregtech.api.interfaces.tileentity.IGregTechTileEntity; -import gregtech.api.logic.ProcessingLogic; -import gregtech.api.metatileentity.implementations.GT_MetaTileEntity_ExtendedPowerMultiBlockBase; -import gregtech.api.metatileentity.implementations.GT_MetaTileEntity_Hatch; -import gregtech.api.recipe.RecipeMap; -import gregtech.api.recipe.check.CheckRecipeResult; -import gregtech.api.recipe.check.CheckRecipeResultRegistry; -import gregtech.api.render.TextureFactory; -import gregtech.api.util.GT_Multiblock_Tooltip_Builder; -import gregtech.api.util.GT_OverclockCalculator; -import gregtech.api.util.GT_Recipe; -import gregtech.api.util.GT_Utility; -import gtPlusPlus.api.recipe.GTPPRecipeMaps; -import gtPlusPlus.core.block.ModBlocks; -import gtPlusPlus.xmod.gregtech.common.blocks.textures.TexturesGtBlock; - -public class GregTechMetaTileEntity_MegaAlloyBlastSmelter - extends GT_MetaTileEntity_ExtendedPowerMultiBlockBase<GregTechMetaTileEntity_MegaAlloyBlastSmelter> - implements ISurvivalConstructable { - - private static final int MAX_PARALLELS = 256; - private HeatingCoilLevel coilLevel; - private byte glassTier = -1; - private boolean hasNormalCoils; - - private static final IStructureDefinition<GregTechMetaTileEntity_MegaAlloyBlastSmelter> STRUCTURE_DEFINITION = StructureDefinition - .<GregTechMetaTileEntity_MegaAlloyBlastSmelter>builder() - .addShape( - "main", - new String[][] { - { " ", " ", " ", " ", " ", " ", - " ", " ", " ", " ", " ", " ", - " ", " DDDDD ", " CCCCC ", " AEEEA ", " AE~EA ", " AEEEA ", - " CCCCC ", " ZZZZZ " }, - { " DDDDD ", " AAAAA ", " AAAAA ", " AAAAA ", " AAAAA ", " AAAAA ", - " AAAAA ", " AAAAA ", " AAAAA ", " AAAAA ", " AAAAA ", " AAAAA ", - " DDDDD ", " D D ", " C C ", " A A ", " A A ", " A A ", - " C C ", " ZZZZZZZ " }, - { " DDDDDDD ", " ABBBBBA ", " ABBBBBA ", " ABBBBBA ", " ABBBBBA ", " ABBBBBA ", - " ABBBBBA ", " ABBBBBA ", " ABBBBBA ", " ABBBBBA ", " ABBBBBA ", " ABBBBBA ", - " DBBBBBD ", " D BBBBB D ", " C BBBBB C ", " A BBBBB A ", " A BBBBB A ", " A BBBBB A ", - " C BBBBB C ", " ZZZZZZZZZ " }, - { " DDDDDDDDD ", " AB BA ", " AB BA ", " AB BA ", " AB BA ", " AB BA ", - " AB BA ", " AB BA ", " AB BA ", " AB BA ", " AB BA ", " AB BA ", - " DB BD ", "D B B D", "C B B C", "A B B A", "A B B A", "A B B A", - "C B B C", "ZZZZZZZZZZZ" }, - { " DDDDDDDDD ", " AB BA ", " AB BA ", " AB BA ", " AB BA ", " AB BA ", - " AB BA ", " AB BA ", " AB BA ", " AB BA ", " AB BA ", " AB BA ", - " DB BD ", "D B B D", "C B B C", "A B B A", "A B B A", "A B B A", - "C B B C", "ZZZZZZZZZZZ" }, - { " DDDDFDDDD ", " AB BA ", " AB BA ", " AB BA ", " AB BA ", " AB BA ", - " AB BA ", " AB BA ", " AB BA ", " AB BA ", " AB BA ", " AB BA ", - " DB BD ", "D B B D", "C B B C", "A B B A", "A B B A", "A B B A", - "C B B C", "ZZZZZZZZZZZ" }, - { " DDDDDDDDD ", " AB BA ", " AB BA ", " AB BA ", " AB BA ", " AB BA ", - " AB BA ", " AB BA ", " AB BA ", " AB BA ", " AB BA ", " AB BA ", - " DB BD ", "D B B D", "C B B C", "A B B A", "A B B A", "A B B A", - "C B B C", "ZZZZZZZZZZZ" }, - { " DDDDDDDDD ", " AB BA ", " AB BA ", " AB BA ", " AB BA ", " AB BA ", - " AB BA ", " AB BA ", " AB BA ", " AB BA ", " AB BA ", " AB BA ", - " DB BD ", "D B B D", "C B B C", "A B B A", "A B B A", "A B B A", - "C B B C", "ZZZZZZZZZZZ" }, - { " DDDDDDD ", " ABBBBBA ", " ABBBBBA ", " ABBBBBA ", " ABBBBBA ", " ABBBBBA ", - " ABBBBBA ", " ABBBBBA ", " ABBBBBA ", " ABBBBBA ", " ABBBBBA ", " ABBBBBA ", - " DBBBBBD ", " D BBBBB D ", " C BBBBB C ", " A BBBBB A ", " A BBBBB A ", " A BBBBB A ", - " C BBBBB C ", " ZZZZZZZZZ " }, - { " DDDDD ", " AAAAA ", " AAAAA ", " AAAAA ", " AAAAA ", " AAAAA ", - " AAAAA ", " AAAAA ", " AAAAA ", " AAAAA ", " AAAAA ", " AAAAA ", - " DDDDD ", " D D ", " C C ", " A A ", " A A ", " A A ", - " C C ", " ZZZZZZZ " }, - { " ", " ", " ", " ", " ", " ", - " ", " ", " ", " ", " ", " ", - " ", " DDDDD ", " CCCCC ", " AAAAA ", " AAAAA ", " AAAAA ", - " CCCCC ", " ZZZZZ " } }) - .addElement( - 'B', - withChannel( - "coil", - ofChain( - onElementPass( - te -> te.hasNormalCoils = false, - ofCoil( - GregTechMetaTileEntity_MegaAlloyBlastSmelter::setCoilLevel, - GregTechMetaTileEntity_MegaAlloyBlastSmelter::getCoilLevel)), - onElementPass(te -> te.hasNormalCoils = true, ofBlock(ModBlocks.blockCasingsMisc, 14))))) - - .addElement( - 'Z', - buildHatchAdder(GregTechMetaTileEntity_MegaAlloyBlastSmelter.class) - .atLeast(InputHatch, OutputHatch, InputBus, OutputBus, Energy, ExoticEnergy) - .casingIndex(TAE.GTPP_INDEX(15)) - .dot(1) - .buildAndChain(ofBlock(ModBlocks.blockCasingsMisc, 15))) - .addElement( - 'E', - buildHatchAdder(GregTechMetaTileEntity_MegaAlloyBlastSmelter.class).atLeast(Maintenance) - .casingIndex(TAE.GTPP_INDEX(15)) - .dot(2) - .buildAndChain(ofBlock(ModBlocks.blockCasingsMisc, 15))) - .addElement('D', ofBlock(ModBlocks.blockCasingsMisc, 15)) - .addElement('C', ofBlock(ModBlocks.blockCasingsMisc, 14)) - .addElement( - 'A', - withChannel( - "glass", - BorosilicateGlass.ofBoroGlass((byte) -1, (te, t) -> te.glassTier = t, te -> te.glassTier))) - .addElement('F', Muffler.newAny(TAE.GTPP_INDEX(15), 3)) - .build(); - - public GregTechMetaTileEntity_MegaAlloyBlastSmelter(int aID, String aName, String aNameRegional) { - super(aID, aName, aNameRegional); - } - - public GregTechMetaTileEntity_MegaAlloyBlastSmelter(String aName) { - super(aName); - } - - @Override - public boolean isCorrectMachinePart(ItemStack aStack) { - return true; - } - - @Override - protected ProcessingLogic createProcessingLogic() { - return new ProcessingLogic() { - - @NotNull - @Override - protected CheckRecipeResult validateRecipe(@NotNull GT_Recipe recipe) { - if (glassTier < GT_Utility.getTier(recipe.mEUt)) { - return CheckRecipeResultRegistry.insufficientMachineTier(GT_Utility.getTier(recipe.mEUt)); - } - return CheckRecipeResultRegistry.SUCCESSFUL; - } - - @NotNull - @Override - protected GT_OverclockCalculator createOverclockCalculator(@NotNull GT_Recipe recipe) { - return super.createOverclockCalculator(recipe) - .setSpeedBoost((float) (1.0 - getCoilDiscount(coilLevel))); - } - }.setMaxParallel(MAX_PARALLELS); - } - - @Override - protected void setProcessingLogicPower(ProcessingLogic logic) { - logic.setAvailableVoltage(getMaxInputEu()); - logic.setAvailableAmperage(1); - } - - @Override - public boolean addOutputToMachineList(IGregTechTileEntity aTileEntity, int aBaseCasingIndex) { - boolean exotic = addExoticEnergyInputToMachineList(aTileEntity, aBaseCasingIndex); - return super.addToMachineList(aTileEntity, aBaseCasingIndex) || exotic; - } - - @Override - public boolean checkMachine(IGregTechTileEntity aBaseMetaTileEntity, ItemStack aStack) { - glassTier = -1; - coilLevel = HeatingCoilLevel.None; - if (!checkPiece("main", 5, 16, 0)) return false; - if (hasNormalCoils) coilLevel = HeatingCoilLevel.None; - if (mMaintenanceHatches.size() != 1) return false; - if (mMufflerHatches.size() != 1) return false; - if (this.glassTier < 10 && !getExoticAndNormalEnergyHatchList().isEmpty()) { - for (GT_MetaTileEntity_Hatch hatchEnergy : getExoticAndNormalEnergyHatchList()) { - if (this.glassTier < hatchEnergy.mTier) { - return false; - } - } - } - // Disallow lasers if the glass is below UV tier - if (glassTier < 8) { - for (GT_MetaTileEntity_Hatch hatchEnergy : getExoticEnergyHatches()) { - if (hatchEnergy.getConnectionType() == GT_MetaTileEntity_Hatch.ConnectionType.LASER) { - return false; - } - } - } - return true; - } - - @Override - public int getMaxEfficiency(ItemStack aStack) { - return 10000; - } - - @Override - public int getDamageToComponent(ItemStack aStack) { - return 0; - } - - @Override - public boolean explodesOnComponentBreak(ItemStack aStack) { - return false; - } - - public double getCoilDiscount(HeatingCoilLevel lvl) { - // Since there are only 14 tiers (starting from 0), this is what the function is. - double unRounded = (lvl != null ? lvl.getTier() : 0) / 130.0D; - if (unRounded < 0) return 1F; - double rounded = Math.floor(unRounded * 1000) / 1000; - - return Math.max(0, rounded); - } - - @Override - public void explodeMultiblock() { - super.explodeMultiblock(); - } - - @Override - public List<GT_MetaTileEntity_Hatch> getExoticAndNormalEnergyHatchList() { - List<GT_MetaTileEntity_Hatch> tHatches = new ArrayList<>(); - tHatches.addAll(mExoticEnergyHatches); - tHatches.addAll(mEnergyHatches); - return tHatches; - } - - @Override - public void construct(ItemStack stackSize, boolean hintsOnly) { - buildPiece("main", stackSize, hintsOnly, 5, 16, 0); - } - - @Override - public IStructureDefinition<GregTechMetaTileEntity_MegaAlloyBlastSmelter> getStructureDefinition() { - return STRUCTURE_DEFINITION; - } - - @Override - protected GT_Multiblock_Tooltip_Builder createTooltip() { - GT_Multiblock_Tooltip_Builder tt = new GT_Multiblock_Tooltip_Builder(); - tt.addMachineType("Fluid Alloy Cooker") - .addInfo("Controller block for the Mega Alloy Blast Smelter") - .addInfo( - "Runs the same recipes as the normal ABS, except with up to " + EnumChatFormatting.BOLD - + EnumChatFormatting.UNDERLINE - + MAX_PARALLELS - + EnumChatFormatting.RESET - + EnumChatFormatting.GRAY - + " parallels.") - .addInfo("Every coil tier above cupronickel grants a speed bonus, based on this function:") - .addInfo("Bonus = TIER / 150, rounded to the nearest thousandth.") - .addInfo( - EnumChatFormatting.ITALIC - + "Can also use normal ABS coils in their place instead, if you don't like the bonuses :)" - + EnumChatFormatting.RESET - + EnumChatFormatting.GRAY) - .addInfo("The glass limits the tier of the energy hatch. UEV glass unlocks all tiers.") - .addInfo("UV glass required for TecTech laser hatches.") - .addInfo( - EnumChatFormatting.ITALIC + "\"all it does is make metals hot\"" - + EnumChatFormatting.RESET - + EnumChatFormatting.GRAY) - .beginStructureBlock(11, 20, 11, false) - .addStructureInfo("This structure is too complex! See schematic for details.") - .addMaintenanceHatch("Around the controller", 2) - .addOtherStructurePart("Input Bus, Output Bus, Input Hatch, Output Bus, Energy Hatch", "Bottom Casing", 1) - .addMufflerHatch("1 in the center of the top layer", 3) - .toolTipFinisher( - EnumChatFormatting.AQUA + "MadMan310 " - + EnumChatFormatting.GRAY - + "via " - + EnumChatFormatting.RED - + "GT++"); - return tt; - } - - @Override - public String[] getInfoData() { - long storedEnergy = 0; - long maxEnergy = 0; - int paras = getBaseMetaTileEntity().isActive() ? processingLogic.getCurrentParallels() : 0; - int discountP = (int) (getCoilDiscount(coilLevel) * 1000) / 10; - - for (GT_MetaTileEntity_Hatch tHatch : filterValidMTEs(mExoticEnergyHatches)) { - storedEnergy += tHatch.getBaseMetaTileEntity() - .getStoredEU(); - maxEnergy += tHatch.getBaseMetaTileEntity() - .getEUCapacity(); - } - - return new String[] { "------------ Critical Information ------------", - StatCollector.translateToLocal("GT5U.multiblock.Progress") + ": " - + EnumChatFormatting.GREEN - + GT_Utility.formatNumbers(mProgresstime) - + EnumChatFormatting.RESET - + "t / " - + EnumChatFormatting.YELLOW - + GT_Utility.formatNumbers(mMaxProgresstime) - + EnumChatFormatting.RESET - + "t", - StatCollector.translateToLocal("GT5U.multiblock.energy") + ": " - + EnumChatFormatting.GREEN - + GT_Utility.formatNumbers(storedEnergy) - + EnumChatFormatting.RESET - + " EU / " - + EnumChatFormatting.YELLOW - + GT_Utility.formatNumbers(maxEnergy) - + EnumChatFormatting.RESET - + " EU", - StatCollector.translateToLocal("GT5U.multiblock.usage") + ": " - + EnumChatFormatting.RED - + GT_Utility.formatNumbers(-lEUt) - + EnumChatFormatting.RESET - + " EU/t", - StatCollector.translateToLocal("GT5U.multiblock.mei") + ": " - + EnumChatFormatting.YELLOW - + GT_Utility.formatNumbers(getAverageInputVoltage()) - + EnumChatFormatting.RESET - + " EU/t(*" - + EnumChatFormatting.YELLOW - + GT_Utility.formatNumbers(getMaxInputAmps()) - + EnumChatFormatting.RESET - + "A) " - + StatCollector.translateToLocal("GT5U.machines.tier") - + ": " - + EnumChatFormatting.YELLOW - + GT_Values.VN[GT_Utility.getTier(getAverageInputVoltage())] - + EnumChatFormatting.RESET, - "Parallels: " + EnumChatFormatting.BLUE + paras + EnumChatFormatting.RESET, - "Coil Discount: " + EnumChatFormatting.BLUE + discountP + "%" + EnumChatFormatting.RESET, - "-----------------------------------------" }; - } - - @Override - public IMetaTileEntity newMetaEntity(IGregTechTileEntity aTileEntity) { - return new GregTechMetaTileEntity_MegaAlloyBlastSmelter(this.mName); - } - - @Override - public ITexture[] getTexture(IGregTechTileEntity aBaseMetaTileEntity, ForgeDirection side, ForgeDirection facing, - int aColorIndex, boolean aActive, boolean aRedstone) { - if (side == facing) { - if (aActive) { - return new ITexture[] { Textures.BlockIcons.getCasingTextureForId(TAE.GTPP_INDEX(15)), - TextureFactory.builder() - .addIcon(TexturesGtBlock.Overlay_Machine_Controller_Advanced_Active) - .extFacing() - .build() }; - } - return new ITexture[] { Textures.BlockIcons.getCasingTextureForId(TAE.GTPP_INDEX(15)), - TextureFactory.builder() - .addIcon(TexturesGtBlock.Overlay_Machine_Controller_Advanced) - .extFacing() - .build() }; - } - return new ITexture[] { Textures.BlockIcons.getCasingTextureForId(TAE.GTPP_INDEX(15)) }; - } - - @Override - public RecipeMap<?> getRecipeMap() { - return GTPPRecipeMaps.alloyBlastSmelterRecipes; - } - - public HeatingCoilLevel getCoilLevel() { - return coilLevel; - } - - public void setCoilLevel(HeatingCoilLevel coilLevel) { - this.coilLevel = coilLevel; - } - - @Override - public final void onScrewdriverRightClick(ForgeDirection side, EntityPlayer aPlayer, float aX, float aY, float aZ) { - if (aPlayer.isSneaking()) { - // Lock to single recipe - super.onScrewdriverRightClick(side, aPlayer, aX, aY, aZ); - } else { - inputSeparation = !inputSeparation; - GT_Utility.sendChatToPlayer( - aPlayer, - StatCollector.translateToLocal("GT5U.machines.separatebus") + " " + inputSeparation); - } - } - - @Override - public boolean onWireCutterRightClick(ForgeDirection side, ForgeDirection wrenchingSide, EntityPlayer aPlayer, - float aX, float aY, float aZ, ItemStack aTool) { - if (aPlayer.isSneaking()) { - batchMode = !batchMode; - if (batchMode) { - GT_Utility.sendChatToPlayer(aPlayer, "Batch recipes."); - } else { - GT_Utility.sendChatToPlayer(aPlayer, "Don't batch recipes."); - } - } - - return true; - } - - @Override - public int getPollutionPerSecond(ItemStack aStack) { - return 102400; - } - - @Override - public int survivalConstruct(ItemStack stackSize, int elementBudget, ISurvivalBuildEnvironment env) { - return survivialBuildPiece("main", stackSize, 5, 16, 0, elementBudget, env, false, true); - } - - @Override - public void loadNBTData(NBTTagCompound aNBT) { - super.loadNBTData(aNBT); - this.glassTier = aNBT.getByte("glassTier"); - if (!aNBT.hasKey(INPUT_SEPARATION_NBT_KEY)) { - inputSeparation = aNBT.getBoolean("separateBusses"); - } - } - - @Override - public void saveNBTData(NBTTagCompound aNBT) { - aNBT.setByte("glassTier", glassTier); - super.saveNBTData(aNBT); - } - - @Override - public boolean supportsInputSeparation() { - return true; - } - - @Override - public boolean supportsBatchMode() { - return true; - } -} diff --git a/gtpp/src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/production/turbines/GT_MTE_LargeTurbine_Gas.java b/gtpp/src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/production/turbines/GT_MTE_LargeTurbine_Gas.java deleted file mode 100644 index 84fac40265..0000000000 --- a/gtpp/src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/production/turbines/GT_MTE_LargeTurbine_Gas.java +++ /dev/null @@ -1,208 +0,0 @@ -package gtPlusPlus.xmod.gregtech.common.tileentities.machines.multi.production.turbines; - -import static gtPlusPlus.core.lib.CORE.RANDOM; - -import java.util.ArrayList; -import java.util.HashSet; -import java.util.List; - -import net.minecraft.item.ItemStack; -import net.minecraft.nbt.NBTTagCompound; -import net.minecraftforge.fluids.Fluid; -import net.minecraftforge.fluids.FluidStack; - -import org.jetbrains.annotations.NotNull; - -import gregtech.api.enums.Materials; -import gregtech.api.interfaces.ITexture; -import gregtech.api.interfaces.metatileentity.IMetaTileEntity; -import gregtech.api.interfaces.tileentity.IGregTechTileEntity; -import gregtech.api.objects.GT_RenderedTexture; -import gregtech.api.recipe.RecipeMap; -import gregtech.api.recipe.RecipeMaps; -import gregtech.api.recipe.check.CheckRecipeResult; -import gregtech.api.recipe.check.SimpleCheckRecipeResult; -import gregtech.api.recipe.maps.FuelBackend; -import gregtech.api.util.GT_Recipe; -import gregtech.api.util.GT_Utility; -import gtPlusPlus.xmod.gregtech.common.blocks.textures.TexturesGtBlock; - -@SuppressWarnings("deprecation") -public class GT_MTE_LargeTurbine_Gas extends GregtechMetaTileEntity_LargerTurbineBase { - - private static final HashSet<Fluid> BLACKLIST = new HashSet<>(); - - static { - BLACKLIST.add( - Materials.Benzene.getFluid(0) - .getFluid()); - } - - public GT_MTE_LargeTurbine_Gas(int aID, String aName, String aNameRegional) { - super(aID, aName, aNameRegional); - } - - public GT_MTE_LargeTurbine_Gas(String aName) { - super(aName); - } - - @Override - public IMetaTileEntity newMetaEntity(IGregTechTileEntity aTileEntity) { - return new GT_MTE_LargeTurbine_Gas(mName); - } - - @Override - public int getCasingMeta() { - return 3; - } - - @Override - public int getCasingTextureIndex() { - return 58; - } - - @Override - protected boolean requiresOutputHatch() { - return false; - } - - @Override - public int getPollutionPerSecond(ItemStack aStack) { - return 4000; - } - - @Override - public int getFuelValue(FluidStack aLiquid) { - if (aLiquid == null) { - return 0; - } - GT_Recipe tFuel = getRecipeMap().getBackend() - .findFuel(aLiquid); - if (tFuel != null) { - return tFuel.mSpecialValue; - } - return 0; - } - - @Override - public RecipeMap<FuelBackend> getRecipeMap() { - return RecipeMaps.gasTurbineFuels; - } - - @Override - public int getRecipeCatalystPriority() { - return -20; - } - - @Override - protected boolean filtersFluid() { - return false; - } - - @Override - public @NotNull CheckRecipeResult checkProcessing() { - List<FluidStack> fluids = getStoredFluids(); - for (FluidStack fluid : fluids) { - if (fluid != null && BLACKLIST.contains(fluid.getFluid())) { - return SimpleCheckRecipeResult.ofFailure("fuel_blacklisted"); - } - } - return super.checkProcessing(); - } - - @Override - long fluidIntoPower(ArrayList<FluidStack> aFluids, long aOptFlow, int aBaseEff, float[] flowMultipliers) { - if (aFluids.size() >= 1) { - int tEU = 0; - int actualOptimalFlow = 0; - FluidStack firstFuelType = new FluidStack(aFluids.get(0), 0); // Identify a SINGLE type of fluid to process. - // Doesn't matter which one. Ignore the rest! - int fuelValue = getFuelValue(firstFuelType); - // log("Fuel Value of "+aFluids.get(0).getLocalizedName()+" is "+fuelValue+"eu"); - if (aOptFlow < fuelValue) { - // turbine too weak and/or fuel too powerful - // at least consume 1L - this.realOptFlow = 1; - // wastes the extra fuel and generate aOptFlow directly - depleteInput(new FluidStack(firstFuelType, 1)); - this.storedFluid += 1; - return GT_Utility.safeInt((long) aOptFlow * (long) aBaseEff / 10000L); - } - - actualOptimalFlow = GT_Utility.safeInt((long) (aOptFlow * (double) flowMultipliers[1] / fuelValue)); - this.realOptFlow = actualOptimalFlow; - - int remainingFlow = GT_Utility.safeInt((long) (actualOptimalFlow * 1.25f)); // Allowed to use up to 125% of - // optimal flow. Variable - // required outside of loop for - // multi-hatch scenarios. - int flow = 0; - int totalFlow = 0; - - storedFluid = 0; - for (FluidStack aFluid : aFluids) { - if (aFluid.isFluidEqual(firstFuelType)) { - flow = Math.min(aFluid.amount, remainingFlow); // try to use up to 125% of optimal flow w/o - // exceeding remainingFlow - depleteInput(new FluidStack(aFluid, flow)); // deplete that amount - this.storedFluid += aFluid.amount; - remainingFlow -= flow; // track amount we're allowed to continue depleting from hatches - totalFlow += flow; // track total input used - } - } - if (totalFlow <= 0) return 0; - tEU = GT_Utility.safeInt((long) totalFlow * fuelValue); - - if (totalFlow == actualOptimalFlow) { - tEU = GT_Utility.safeInt((long) tEU * (long) aBaseEff / 10000L); - } else { - float efficiency = 1.0f - Math.abs((totalFlow - actualOptimalFlow) / (float) actualOptimalFlow); - tEU *= efficiency; - tEU = GT_Utility.safeInt((long) tEU * (long) aBaseEff / 10000L); - } - - return tEU; - } - return 0; - } - - @Override - public int getDamageToComponent(ItemStack aStack) { - return (RANDOM.nextInt(4) == 0) ? 0 : 1; - } - - @Override - public void saveNBTData(NBTTagCompound aNBT) { - super.saveNBTData(aNBT); - } - - @Override - public void loadNBTData(NBTTagCompound aNBT) { - super.loadNBTData(aNBT); - } - - @Override - public String getMachineType() { - return "Large Gas Turbine"; - } - - @Override - protected String getTurbineType() { - return "Gas"; - } - - @Override - protected String getCasingName() { - return "Reinforced Gas Turbine Casing"; - } - - @Override - protected ITexture getTextureFrontFace() { - return new GT_RenderedTexture(TexturesGtBlock.Overlay_Machine_Controller_Advanced); - } - - @Override - protected ITexture getTextureFrontFaceActive() { - return new GT_RenderedTexture(TexturesGtBlock.Overlay_Machine_Controller_Advanced_Active); - } -} diff --git a/gtpp/src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/production/turbines/GT_MTE_LargeTurbine_Plasma.java b/gtpp/src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/production/turbines/GT_MTE_LargeTurbine_Plasma.java deleted file mode 100644 index db99b52be1..0000000000 --- a/gtpp/src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/production/turbines/GT_MTE_LargeTurbine_Plasma.java +++ /dev/null @@ -1,314 +0,0 @@ -package gtPlusPlus.xmod.gregtech.common.tileentities.machines.multi.production.turbines; - -import java.util.ArrayList; -import java.util.HashSet; - -import net.minecraft.item.ItemStack; -import net.minecraftforge.fluids.Fluid; -import net.minecraftforge.fluids.FluidRegistry; -import net.minecraftforge.fluids.FluidStack; - -import org.jetbrains.annotations.NotNull; - -import gregtech.api.interfaces.ITexture; -import gregtech.api.interfaces.metatileentity.IMetaTileEntity; -import gregtech.api.interfaces.tileentity.IGregTechTileEntity; -import gregtech.api.items.GT_MetaGenerated_Tool; -import gregtech.api.objects.GT_RenderedTexture; -import gregtech.api.recipe.RecipeMap; -import gregtech.api.recipe.RecipeMaps; -import gregtech.api.recipe.check.CheckRecipeResult; -import gregtech.api.recipe.check.CheckRecipeResultRegistry; -import gregtech.api.recipe.check.SimpleCheckRecipeResult; -import gregtech.api.recipe.maps.FuelBackend; -import gregtech.api.util.GT_Recipe; -import gregtech.api.util.GT_Utility; -import gregtech.api.util.shutdown.ShutDownReasonRegistry; -import gtPlusPlus.core.util.math.MathUtils; -import gtPlusPlus.xmod.gregtech.api.metatileentity.implementations.GT_MetaTileEntity_Hatch_Turbine; -import gtPlusPlus.xmod.gregtech.common.blocks.textures.TexturesGtBlock; - -@SuppressWarnings("deprecation") -public class GT_MTE_LargeTurbine_Plasma extends GregtechMetaTileEntity_LargerTurbineBase { - - private static final HashSet<Fluid> BLACKLIST = new HashSet<>(); - - public GT_MTE_LargeTurbine_Plasma(int aID, String aName, String aNameRegional) { - super(aID, aName, aNameRegional); - } - - public GT_MTE_LargeTurbine_Plasma(String aName) { - super(aName); - } - - @Override - public IMetaTileEntity newMetaEntity(IGregTechTileEntity aTileEntity) { - return new GT_MTE_LargeTurbine_Plasma(mName); - } - - @Override - public int getCasingMeta() { - return 4; - } - - @Override - public int getCasingTextureIndex() { - return 60; - } - - @Override - protected boolean requiresOutputHatch() { - return true; - } - - @Override - public int getPollutionPerSecond(ItemStack aStack) { - return 0; - } - - @Override - public int getFuelValue(FluidStack aLiquid) { - if (aLiquid == null) { - return 0; - } - GT_Recipe tFuel = getRecipeMap().getBackend() - .findFuel(aLiquid); - if (tFuel != null) { - return tFuel.mSpecialValue; - } - return 0; - } - - @Override - public RecipeMap<FuelBackend> getRecipeMap() { - return RecipeMaps.plasmaFuels; - } - - @Override - public int getRecipeCatalystPriority() { - return -20; - } - - @Override - protected boolean filtersFluid() { - return false; - } - - @Override - public @NotNull CheckRecipeResult checkProcessing() { - - try { - ArrayList<GT_MetaTileEntity_Hatch_Turbine> aEmptyTurbineRotorHatches = getEmptyTurbineAssemblies(); - if (aEmptyTurbineRotorHatches.size() > 0) { - hatch: for (GT_MetaTileEntity_Hatch_Turbine aHatch : aEmptyTurbineRotorHatches) { - ArrayList<ItemStack> aTurbines = getAllBufferedTurbines(); - for (ItemStack aTurbineItem : aTurbines) { - if (aTurbineItem == null) { - continue; - } - if (aHatch.insertTurbine(aTurbineItem.copy())) { - depleteTurbineFromStock(aTurbineItem); - continue hatch; - } - } - } - } - - if (getEmptyTurbineAssemblies().size() > 0 || !areAllTurbinesTheSame()) { - stopMachine(ShutDownReasonRegistry.NO_TURBINE); - return CheckRecipeResultRegistry.NO_TURBINE_FOUND; - } - - ArrayList<FluidStack> tFluids = getStoredFluids(); - - if (tFluids.size() > 0) { - for (FluidStack fluid : tFluids) { - if (fluid != null && BLACKLIST.contains(fluid.getFluid())) { - return SimpleCheckRecipeResult.ofFailure("fuel_blacklisted"); - } - } - if (baseEff == 0 || optFlow == 0 - || counter >= 512 - || this.getBaseMetaTileEntity() - .hasWorkJustBeenEnabled() - || this.getBaseMetaTileEntity() - .hasInventoryBeenModified()) { - counter = 0; - - float aTotalBaseEff = 0; - float aTotalOptimalFlow = 0; - - ItemStack aStack = getFullTurbineAssemblies().get(0) - .getTurbine(); - aTotalBaseEff += GT_Utility.safeInt( - (long) ((5F + ((GT_MetaGenerated_Tool) aStack.getItem()).getToolCombatDamage(aStack)) * 1000F)); - aTotalOptimalFlow += GT_Utility.safeInt( - (long) Math.max( - Float.MIN_NORMAL, - ((GT_MetaGenerated_Tool) aStack.getItem()).getToolStats(aStack) - .getSpeedMultiplier() * GT_MetaGenerated_Tool.getPrimaryMaterial(aStack).mToolSpeed - * 50)); - - // Calculate total EU/t (as shown on turbine tooltip (Fast mode doesn't affect)) - double aEUPerTurbine = aTotalOptimalFlow * 40 - * 0.0105 - * GT_MetaGenerated_Tool.getPrimaryMaterial(aStack).mPlasmaMultiplier - * (50.0f + (10.0f * ((GT_MetaGenerated_Tool) aStack.getItem()).getToolCombatDamage(aStack))); - aTotalOptimalFlow *= getSpeedMultiplier(); - - if (aTotalOptimalFlow < 0) { - aTotalOptimalFlow = 100; - } - - flowMultipliers[0] = GT_MetaGenerated_Tool.getPrimaryMaterial(aStack).mSteamMultiplier; - flowMultipliers[1] = GT_MetaGenerated_Tool.getPrimaryMaterial(aStack).mGasMultiplier; - flowMultipliers[2] = GT_MetaGenerated_Tool.getPrimaryMaterial(aStack).mPlasmaMultiplier; - baseEff = MathUtils.roundToClosestInt(aTotalBaseEff); - optFlow = MathUtils.roundToClosestInt(aTotalOptimalFlow); - euPerTurbine = MathUtils.roundToClosestInt(aEUPerTurbine); - if (optFlow <= 0 || baseEff <= 0) { - stopMachine(ShutDownReasonRegistry.NONE); // in case the turbine got removed - return CheckRecipeResultRegistry.NO_FUEL_FOUND; - } - } else { - counter++; - } - } - - // How much the turbine should be producing with this flow - long newPower = fluidIntoPower(tFluids, optFlow, baseEff, flowMultipliers); - - // Reduce produced power depending on the ratio between fuel value and turbine EU/t with the following - // formula: - // EU/t = EU/t * MIN(1, ( ( (FuelValue / 200) ^ 2 ) / EUPerTurbine)) - int fuelValue = 0; - if (tFluids.size() > 0) { - fuelValue = getFuelValue(new FluidStack(tFluids.get(0), 0)); - } - float magicValue = (fuelValue * 0.005f) * (fuelValue * 0.005f); - float efficiencyLoss = Math.min(1.0f, magicValue / euPerTurbine); - newPower *= efficiencyLoss; - - long difference = newPower - this.lEUt; // difference between current output and new output - - // Magic numbers: can always change by at least 10 eu/t, but otherwise by at most 1 percent of the - // difference in power level (per tick) - // This is how much the turbine can actually change during this tick - int maxChangeAllowed = Math.max(10, GT_Utility.safeInt((long) Math.abs(difference) / 100)); - - if (Math.abs(difference) > maxChangeAllowed) { // If this difference is too big, use the maximum allowed - // change - int change = maxChangeAllowed * (difference > 0 ? 1 : -1); // Make the change positive or negative. - this.lEUt += change; // Apply the change - } else { - this.lEUt = newPower; - } - if (this.lEUt <= 0) { - this.lEUt = 0; - this.mEfficiency = 0; - return CheckRecipeResultRegistry.NO_FUEL_FOUND; - } else { - this.mMaxProgresstime = 20; - this.mEfficiencyIncrease = 10; - // Overvoltage is handled inside the MultiBlockBase when pushing out to dynamos. no need to do it here. - // Play sounds (GT++ addition - GT multiblocks play no sounds) - enableAllTurbineHatches(); - return CheckRecipeResultRegistry.GENERATING; - } - } catch (Throwable t) { - t.printStackTrace(); - } - return CheckRecipeResultRegistry.NO_FUEL_FOUND; - } - - @Override - long fluidIntoPower(ArrayList<FluidStack> aFluids, long aOptFlow, int aBaseEff, float[] flowMultipliers) { - if (aFluids.size() >= 1) { - aOptFlow *= 800; // CHANGED THINGS HERE, check recipe runs once per 20 ticks - int tEU = 0; - - int actualOptimalFlow = 0; - - FluidStack firstFuelType = new FluidStack(aFluids.get(0), 0); // Identify a SINGLE type of fluid to process. - // Doesn't matter which one. Ignore the rest! - int fuelValue = getFuelValue(firstFuelType); - actualOptimalFlow = GT_Utility - .safeInt((long) Math.ceil((double) aOptFlow * (double) flowMultipliers[2] / (double) fuelValue)); - this.realOptFlow = actualOptimalFlow; // For scanner info - - int remainingFlow = GT_Utility.safeInt((long) (actualOptimalFlow * 1.25f)); // Allowed to use up to 125% of - // optimal flow. Variable - // required outside of loop for - // multi-hatch scenarios. - int flow = 0; - int totalFlow = 0; - - storedFluid = 0; - for (FluidStack aFluid : aFluids) { - if (aFluid.isFluidEqual(firstFuelType)) { - flow = Math.min(aFluid.amount, remainingFlow); // try to use up w/o exceeding remainingFlow - depleteInput(new FluidStack(aFluid, flow)); // deplete that amount - this.storedFluid += aFluid.amount; - remainingFlow -= flow; // track amount we're allowed to continue depleting from hatches - totalFlow += flow; // track total input used - } - } - String fn = FluidRegistry.getFluidName(firstFuelType); - String[] nameSegments = fn.split("\\.", 2); - if (nameSegments.length == 2) { - String outputName = nameSegments[1]; - FluidStack output = FluidRegistry.getFluidStack(outputName, totalFlow); - if (output == null) { - output = FluidRegistry.getFluidStack("molten." + outputName, totalFlow); - } - if (output != null) { - addOutput(output); - } - } - if (totalFlow <= 0) return 0; - tEU = GT_Utility.safeInt((long) ((fuelValue / 20D) * (double) totalFlow)); - - if (totalFlow == actualOptimalFlow) { - tEU = GT_Utility.safeInt((long) (aBaseEff / 10000D * tEU)); - } else { - double efficiency = 1.0D - Math.abs((totalFlow - actualOptimalFlow) / (float) actualOptimalFlow); - - tEU = (int) (tEU * efficiency); - tEU = GT_Utility.safeInt((long) (aBaseEff / 10000D * tEU)); - } - - return tEU; - } - return 0; - } - - @Override - public int getDamageToComponent(ItemStack aStack) { - return 1; - } - - @Override - public String getMachineType() { - return "Large Plasma Turbine"; - } - - @Override - protected String getTurbineType() { - return "Plasma"; - } - - @Override - protected String getCasingName() { - return "Reinforced Plasma Turbine Casing"; - } - - @Override - protected ITexture getTextureFrontFace() { - return new GT_RenderedTexture(TexturesGtBlock.Overlay_Machine_Controller_Advanced); - } - - @Override - protected ITexture getTextureFrontFaceActive() { - return new GT_RenderedTexture(TexturesGtBlock.Overlay_Machine_Controller_Advanced_Active); - } -} diff --git a/gtpp/src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/production/turbines/GT_MTE_LargeTurbine_SCSteam.java b/gtpp/src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/production/turbines/GT_MTE_LargeTurbine_SCSteam.java deleted file mode 100644 index 7ee40757fd..0000000000 --- a/gtpp/src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/production/turbines/GT_MTE_LargeTurbine_SCSteam.java +++ /dev/null @@ -1,126 +0,0 @@ -package gtPlusPlus.xmod.gregtech.common.tileentities.machines.multi.production.turbines; - -import java.util.ArrayList; - -import net.minecraft.item.ItemStack; -import net.minecraftforge.fluids.FluidRegistry; -import net.minecraftforge.fluids.FluidStack; - -import gregtech.api.interfaces.ITexture; -import gregtech.api.interfaces.metatileentity.IMetaTileEntity; -import gregtech.api.interfaces.tileentity.IGregTechTileEntity; -import gregtech.api.render.TextureFactory; -import gregtech.api.util.GT_ModHandler; -import gregtech.api.util.GT_Utility; -import gtPlusPlus.core.util.math.MathUtils; -import gtPlusPlus.xmod.gregtech.common.blocks.textures.TexturesGtBlock; - -public class GT_MTE_LargeTurbine_SCSteam extends GregtechMetaTileEntity_LargerTurbineBase { - - public GT_MTE_LargeTurbine_SCSteam(int aID, String aName, String aNameRegional) { - super(aID, aName, aNameRegional); - } - - public GT_MTE_LargeTurbine_SCSteam(String aName) { - super(aName); - } - - @Override - public IMetaTileEntity newMetaEntity(IGregTechTileEntity aTileEntity) { - return new GT_MTE_LargeTurbine_SCSteam(mName); - } - - @Override - public int getCasingMeta() { - return 15; - } - - @Override - public int getCasingTextureIndex() { - return 1538; - } - - @Override - protected boolean requiresOutputHatch() { - return true; - } - - @Override - public int getPollutionPerSecond(ItemStack aStack) { - return 0; - } - - @Override - public int getFuelValue(FluidStack aLiquid) { - return 0; - } - - @Override - long fluidIntoPower(ArrayList<FluidStack> aFluids, long aOptFlow, int aBaseEff, float[] flowMultipliers) { - int tEU = 0; - int totalFlow = 0; // Byproducts are based on actual flow - int flow = 0; - // Variable required outside of loop for - // multi-hatch scenarios. - this.realOptFlow = aOptFlow; - // this.realOptFlow = (double) aOptFlow * (double) flowMultipliers[0]; - // Will there be an multiplier for SC? - int remainingFlow = MathUtils.safeInt((long) (realOptFlow * 1.25f)); // Allowed to use up to - // 125% of optimal flow. - - storedFluid = 0; - FluidStack tSCSteam = FluidRegistry.getFluidStack("supercriticalsteam", 1); - for (int i = 0; i < aFluids.size() && remainingFlow > 0; i++) { - if (GT_Utility.areFluidsEqual(aFluids.get(i), tSCSteam, true)) { - flow = Math.min(aFluids.get(i).amount, remainingFlow); // try to use up w/o exceeding remainingFlow - depleteInput(new FluidStack(aFluids.get(i), flow)); // deplete that amount - this.storedFluid += aFluids.get(i).amount; - remainingFlow -= flow; // track amount we're allowed to continue depleting from hatches - totalFlow += flow; // track total input used - } - } - if (totalFlow <= 0) return 0; - tEU = totalFlow; - addOutput(GT_ModHandler.getSteam(totalFlow)); - if (totalFlow != realOptFlow) { - float efficiency = 1.0f - Math.abs((totalFlow - (float) realOptFlow) / (float) realOptFlow); - // if(totalFlow>aOptFlow){efficiency = 1.0f;} - tEU *= efficiency; - tEU = Math.max(1, MathUtils.safeInt((long) tEU * (long) aBaseEff / 10000L)); - } else { - tEU = MathUtils.safeInt((long) tEU * (long) aBaseEff / 10000L); - } - - return tEU * 100L; - } - - @Override - public int getDamageToComponent(ItemStack aStack) { - return 8; - } - - @Override - public String getMachineType() { - return "Large Supercritical Steam Turbine"; - } - - @Override - protected String getTurbineType() { - return "Supercritical Steam"; - } - - @Override - protected String getCasingName() { - return "Reinforced SC Turbine Casing"; - } - - @Override - protected ITexture getTextureFrontFace() { - return TextureFactory.of(TexturesGtBlock.Overlay_Machine_Controller_Advanced); - } - - @Override - protected ITexture getTextureFrontFaceActive() { - return TextureFactory.of(TexturesGtBlock.Overlay_Machine_Controller_Advanced_Active); - } -} diff --git a/gtpp/src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/production/turbines/GT_MTE_LargeTurbine_SHSteam.java b/gtpp/src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/production/turbines/GT_MTE_LargeTurbine_SHSteam.java deleted file mode 100644 index d1346d3a51..0000000000 --- a/gtpp/src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/production/turbines/GT_MTE_LargeTurbine_SHSteam.java +++ /dev/null @@ -1,204 +0,0 @@ -package gtPlusPlus.xmod.gregtech.common.tileentities.machines.multi.production.turbines; - -import java.util.ArrayList; - -import net.minecraft.entity.player.EntityPlayer; -import net.minecraft.item.ItemStack; -import net.minecraft.nbt.NBTTagCompound; -import net.minecraftforge.common.util.ForgeDirection; -import net.minecraftforge.fluids.FluidStack; - -import gregtech.GT_Mod; -import gregtech.api.interfaces.ITexture; -import gregtech.api.interfaces.metatileentity.IMetaTileEntity; -import gregtech.api.interfaces.tileentity.IGregTechTileEntity; -import gregtech.api.objects.GT_RenderedTexture; -import gregtech.api.util.GT_ModHandler; -import gregtech.api.util.GT_Utility; -import gtPlusPlus.core.lib.CORE; -import gtPlusPlus.core.util.math.MathUtils; -import gtPlusPlus.core.util.minecraft.PlayerUtils; -import gtPlusPlus.xmod.gregtech.common.blocks.textures.TexturesGtBlock; - -@SuppressWarnings("deprecation") -public class GT_MTE_LargeTurbine_SHSteam extends GregtechMetaTileEntity_LargerTurbineBase { - - public boolean achievement = false; - private boolean looseFit = false; - - public GT_MTE_LargeTurbine_SHSteam(int aID, String aName, String aNameRegional) { - super(aID, aName, aNameRegional); - } - - public GT_MTE_LargeTurbine_SHSteam(String aName) { - super(aName); - } - - @Override - public IMetaTileEntity newMetaEntity(IGregTechTileEntity aTileEntity) { - return new GT_MTE_LargeTurbine_SHSteam(mName); - } - - @Override - public int getCasingMeta() { - return 2; - } - - @Override - public int getCasingTextureIndex() { - return 59; - } - - @Override - protected boolean requiresOutputHatch() { - return true; - } - - @Override - public int getPollutionPerSecond(ItemStack aStack) { - return 0; - } - - @Override - public int getFuelValue(FluidStack aLiquid) { - return 0; - } - - @Override - long fluidIntoPower(ArrayList<FluidStack> aFluids, long aOptFlow, int aBaseEff, float[] flowMultipliers) { - if (looseFit) { - aOptFlow *= 4; - if (aBaseEff > 10000) { - aOptFlow *= Math.pow(1.1f, ((aBaseEff - 7500) / 10000F) * 20f); - aBaseEff = 7500; - } else if (aBaseEff > 7500) { - aOptFlow *= Math.pow(1.1f, ((aBaseEff - 7500) / 10000F) * 20f); - aBaseEff *= 0.75f; - } else { - aBaseEff *= 0.75f; - } - } - // prevent overflow like that in SC Steam - long tEU = 0; - int totalFlow = 0; // Byproducts are based on actual flow - int flow = 0; - - // Variable required outside of loop for - // multi-hatch scenarios. - this.realOptFlow = aOptFlow * flowMultipliers[0]; - - int remainingFlow = MathUtils.safeInt((long) (realOptFlow * 1.25f)); // Allowed to use up to - // 125% of optimal flow. - - storedFluid = 0; - for (int i = 0; i < aFluids.size() && remainingFlow > 0; i++) { - String fluidName = aFluids.get(i) - .getFluid() - .getUnlocalizedName(aFluids.get(i)); - if (fluidName.equals("ic2.fluidSuperheatedSteam")) { - flow = Math.min(aFluids.get(i).amount, remainingFlow); // try to use up w/o exceeding remainingFlow - depleteInput(new FluidStack(aFluids.get(i), flow)); // deplete that amount - this.storedFluid += aFluids.get(i).amount; - remainingFlow -= flow; // track amount we're allowed to continue depleting from hatches - totalFlow += flow; // track total input used - if (!achievement) { - try { - GT_Mod.achievements.issueAchievement( - this.getBaseMetaTileEntity() - .getWorld() - .getPlayerEntityByName( - this.getBaseMetaTileEntity() - .getOwnerName()), - "efficientsteam"); - } catch (Exception e) {} - achievement = true; - } - } else if (fluidName.equals("fluid.steam") || fluidName.equals("ic2.fluidSteam") - || fluidName.equals("fluid.mfr.steam.still.name")) { - depleteInput(new FluidStack(aFluids.get(i), aFluids.get(i).amount)); - } - } - if (totalFlow <= 0) return 0; - tEU = totalFlow; - addOutput(GT_ModHandler.getSteam(totalFlow)); - if (totalFlow != realOptFlow) { - float efficiency = 1.0f - Math.abs((totalFlow - (float) realOptFlow) / (float) realOptFlow); - // if(totalFlow>aOptFlow){efficiency = 1.0f;} - tEU *= efficiency; - tEU = Math.max(1L, tEU * aBaseEff / 10000L); - } else { - tEU = tEU * aBaseEff / 10000L; - } - - return tEU; - } - - @Override - public void onModeChangeByScrewdriver(ForgeDirection side, EntityPlayer aPlayer, float aX, float aY, float aZ) { - // Using a screwdriver to change modes should allow for any combination of Slow/Fast and Tight/Loose Mode - // Whenever there's a mode switch, there will be two messages on the player chat - // The two messages specify which two modes the turbine is on after the change - // (Tight/Loose changes on every action, Slow/Fast changes every other action, all pairs are cycled this way) - if (side == getBaseMetaTileEntity().getFrontFacing()) { - looseFit ^= true; - GT_Utility.sendChatToPlayer( - aPlayer, - looseFit ? "Fitting is Loose (Higher Flow)" : "Fitting is Tight (Higher Efficiency)"); - } - - if (looseFit) { - super.onModeChangeByScrewdriver(side, aPlayer, aX, aY, aZ); - } else if (mFastMode) { - PlayerUtils.messagePlayer(aPlayer, "Running in Fast (48x) Mode."); - } else { - PlayerUtils.messagePlayer(aPlayer, "Running in Slow (16x) Mode."); - } - } - - @Override - public int getDamageToComponent(ItemStack aStack) { - return (looseFit && CORE.RANDOM.nextInt(4) == 0) ? 0 : 1; - } - - @Override - public boolean isLooseMode() { - return looseFit; - } - - @Override - public void saveNBTData(NBTTagCompound aNBT) { - super.saveNBTData(aNBT); - aNBT.setBoolean("turbineFitting", looseFit); - } - - @Override - public void loadNBTData(NBTTagCompound aNBT) { - super.loadNBTData(aNBT); - looseFit = aNBT.getBoolean("turbineFitting"); - } - - @Override - public String getMachineType() { - return "Large Super-heated Steam Turbine"; - } - - @Override - protected String getTurbineType() { - return "Super-heated Steam"; - } - - @Override - protected String getCasingName() { - return "Reinforced HP Steam Turbine Casing"; - } - - @Override - protected ITexture getTextureFrontFace() { - return new GT_RenderedTexture(TexturesGtBlock.Overlay_Machine_Controller_Advanced); - } - - @Override - protected ITexture getTextureFrontFaceActive() { - return new GT_RenderedTexture(TexturesGtBlock.Overlay_Machine_Controller_Advanced_Active); - } -} diff --git a/gtpp/src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/production/turbines/GT_MTE_LargeTurbine_Steam.java b/gtpp/src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/production/turbines/GT_MTE_LargeTurbine_Steam.java deleted file mode 100644 index c882b84aab..0000000000 --- a/gtpp/src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/production/turbines/GT_MTE_LargeTurbine_Steam.java +++ /dev/null @@ -1,215 +0,0 @@ -package gtPlusPlus.xmod.gregtech.common.tileentities.machines.multi.production.turbines; - -import static gtPlusPlus.core.lib.CORE.RANDOM; - -import java.util.ArrayList; - -import net.minecraft.entity.player.EntityPlayer; -import net.minecraft.item.ItemStack; -import net.minecraft.nbt.NBTTagCompound; -import net.minecraftforge.common.util.ForgeDirection; -import net.minecraftforge.fluids.FluidStack; - -import gregtech.GT_Mod; -import gregtech.api.interfaces.ITexture; -import gregtech.api.interfaces.metatileentity.IMetaTileEntity; -import gregtech.api.interfaces.tileentity.IGregTechTileEntity; -import gregtech.api.objects.GT_RenderedTexture; -import gregtech.api.util.GT_ModHandler; -import gregtech.api.util.GT_Utility; -import gtPlusPlus.core.util.math.MathUtils; -import gtPlusPlus.core.util.minecraft.PlayerUtils; -import gtPlusPlus.xmod.gregtech.common.blocks.textures.TexturesGtBlock; - -@SuppressWarnings("deprecation") -public class GT_MTE_LargeTurbine_Steam extends GregtechMetaTileEntity_LargerTurbineBase { - - private float water; - private boolean achievement = false; - private boolean looseFit = false; - - public GT_MTE_LargeTurbine_Steam(int aID, String aName, String aNameRegional) { - super(aID, aName, aNameRegional); - } - - public GT_MTE_LargeTurbine_Steam(String aName) { - super(aName); - } - - @Override - public IMetaTileEntity newMetaEntity(IGregTechTileEntity aTileEntity) { - return new GT_MTE_LargeTurbine_Steam(mName); - } - - @Override - public int getCasingMeta() { - return 1; - } - - @Override - public int getCasingTextureIndex() { - return 16; - } - - @Override - protected boolean requiresOutputHatch() { - return true; - } - - @Override - public int getPollutionPerSecond(ItemStack aStack) { - return 0; - } - - private int useWater(float input) { - water = water + input; - int usage = (int) water; - water = water - usage; - return usage; - } - - @Override - public int getFuelValue(FluidStack aLiquid) { - return 0; - } - - @Override - long fluidIntoPower(ArrayList<FluidStack> aFluids, long aOptFlow, int aBaseEff, float[] flowMultipliers) { - if (looseFit) { - aOptFlow *= 4; - if (aBaseEff > 10000) { - aOptFlow *= Math.pow(1.1f, ((aBaseEff - 7500) / 10000F) * 20f); - aBaseEff = 7500; - } else if (aBaseEff > 7500) { - aOptFlow *= Math.pow(1.1f, ((aBaseEff - 7500) / 10000F) * 20f); - aBaseEff *= 0.75f; - } else { - aBaseEff *= 0.75f; - } - } - // prevent overflow like that in SC Steam - long tEU = 0; - int totalFlow = 0; // Byproducts are based on actual flow - int flow = 0; - - // Variable required outside of loop for - // multi-hatch scenarios. - this.realOptFlow = aOptFlow * flowMultipliers[0]; - - int remainingFlow = MathUtils.safeInt((long) (realOptFlow * 1.25f)); // Allowed to - // use up to - // 125% of - // optimal flow. - - storedFluid = 0; - for (int i = 0; i < aFluids.size() && remainingFlow > 0; i++) { // loop through each hatch; extract inputs and - // track totals. - String fluidName = aFluids.get(i) - .getFluid() - .getUnlocalizedName(aFluids.get(i)); - if (fluidName.equals("fluid.steam") || fluidName.equals("ic2.fluidSteam") - || fluidName.equals("fluid.mfr.steam.still.name")) { - flow = Math.min(aFluids.get(i).amount, remainingFlow); // try to use up w/o exceeding remainingFlow - depleteInput(new FluidStack(aFluids.get(i), flow)); // deplete that amount - this.storedFluid += aFluids.get(i).amount; - remainingFlow -= flow; // track amount we're allowed to continue depleting from hatches - totalFlow += flow; // track total input used - if (!achievement) { - GT_Mod.achievements.issueAchievement( - this.getBaseMetaTileEntity() - .getWorld() - .getPlayerEntityByName( - this.getBaseMetaTileEntity() - .getOwnerName()), - "muchsteam"); - achievement = true; - } - } else if (fluidName.equals("ic2.fluidSuperheatedSteam")) { - depleteInput(new FluidStack(aFluids.get(i), aFluids.get(i).amount)); - } - } - if (totalFlow <= 0) return 0; - tEU = totalFlow; - int waterToOutput = useWater(totalFlow / 160.0f); - addOutput(GT_ModHandler.getDistilledWater(waterToOutput)); - if (totalFlow != realOptFlow) { - float efficiency = 1.0f - Math.abs((totalFlow - (float) realOptFlow) / (float) realOptFlow); - // if(totalFlow>aOptFlow){efficiency = 1.0f;} - tEU *= efficiency; - tEU = Math.max(1L, tEU * aBaseEff / 20000L); - } else { - tEU = tEU * aBaseEff / 20000L; - } - - return tEU; - } - - @Override - public void onModeChangeByScrewdriver(ForgeDirection side, EntityPlayer aPlayer, float aX, float aY, float aZ) { - // Using a screwdriver to change modes should allow for any combination of Slow/Fast and Tight/Loose Mode - // Whenever there's a mode switch, there will be two messages on the player chat - // The two messages specify which two modes the turbine is on after the change - // (Tight/Loose changes on every action, Slow/Fast changes every other action, all pairs are cycled this way) - if (side == getBaseMetaTileEntity().getFrontFacing()) { - looseFit ^= true; - GT_Utility.sendChatToPlayer( - aPlayer, - looseFit ? "Fitting: Loose - More Flow" : "Fitting: Tight - More Efficiency"); - } - - if (looseFit) { - super.onModeChangeByScrewdriver(side, aPlayer, aX, aY, aZ); - } else if (mFastMode) { - PlayerUtils.messagePlayer(aPlayer, "Running in Fast (48x) Mode."); - } else { - PlayerUtils.messagePlayer(aPlayer, "Running in Slow (16x) Mode."); - } - } - - @Override - public int getDamageToComponent(ItemStack aStack) { - return (looseFit && RANDOM.nextInt(4) == 0) ? 0 : 1; - } - - @Override - public boolean isLooseMode() { - return looseFit; - } - - @Override - public void saveNBTData(NBTTagCompound aNBT) { - super.saveNBTData(aNBT); - aNBT.setBoolean("turbineFitting", looseFit); - } - - @Override - public void loadNBTData(NBTTagCompound aNBT) { - super.loadNBTData(aNBT); - looseFit = aNBT.getBoolean("turbineFitting"); - } - - @Override - public String getMachineType() { - return "Large Steam Turbine"; - } - - @Override - protected String getTurbineType() { - return "Steam"; - } - - @Override - protected String getCasingName() { - return "Reinforced Steam Turbine Casing"; - } - - @Override - protected ITexture getTextureFrontFace() { - return new GT_RenderedTexture(TexturesGtBlock.Overlay_Machine_Controller_Advanced); - } - - @Override - protected ITexture getTextureFrontFaceActive() { - return new GT_RenderedTexture(TexturesGtBlock.Overlay_Machine_Controller_Advanced_Active); - } -} diff --git a/gtpp/src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/production/turbines/GregtechMetaTileEntity_LargerTurbineBase.java b/gtpp/src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/production/turbines/GregtechMetaTileEntity_LargerTurbineBase.java deleted file mode 100644 index eec137cea2..0000000000 --- a/gtpp/src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/production/turbines/GregtechMetaTileEntity_LargerTurbineBase.java +++ /dev/null @@ -1,893 +0,0 @@ -package gtPlusPlus.xmod.gregtech.common.tileentities.machines.multi.production.turbines; - -import static com.gtnewhorizon.structurelib.structure.StructureUtility.lazy; -import static com.gtnewhorizon.structurelib.structure.StructureUtility.ofBlock; -import static gregtech.api.enums.GT_HatchElement.Dynamo; -import static gregtech.api.enums.GT_HatchElement.InputBus; -import static gregtech.api.enums.GT_HatchElement.InputHatch; -import static gregtech.api.enums.GT_HatchElement.Maintenance; -import static gregtech.api.enums.GT_HatchElement.Muffler; -import static gregtech.api.enums.GT_HatchElement.OutputHatch; -import static gregtech.api.util.GT_StructureUtility.buildHatchAdder; -import static gregtech.api.util.GT_Utility.filterValidMTEs; -import static gtPlusPlus.xmod.gregtech.api.metatileentity.implementations.base.GregtechMeta_MultiBlockBase.GTPPHatchElement.TTDynamo; - -import java.util.ArrayList; - -import net.minecraft.block.Block; -import net.minecraft.entity.player.EntityPlayer; -import net.minecraft.item.ItemStack; -import net.minecraft.nbt.NBTTagCompound; -import net.minecraft.util.EnumChatFormatting; -import net.minecraft.util.StatCollector; -import net.minecraftforge.common.util.ForgeDirection; -import net.minecraftforge.fluids.FluidStack; - -import org.jetbrains.annotations.NotNull; - -import com.gtnewhorizon.structurelib.alignment.IAlignmentLimits; -import com.gtnewhorizon.structurelib.alignment.constructable.ISurvivalConstructable; -import com.gtnewhorizon.structurelib.structure.IStructureDefinition; -import com.gtnewhorizon.structurelib.structure.ISurvivalBuildEnvironment; -import com.gtnewhorizon.structurelib.structure.StructureDefinition; - -import gregtech.api.enums.Materials; -import gregtech.api.enums.Textures; -import gregtech.api.interfaces.ITexture; -import gregtech.api.interfaces.metatileentity.IMetaTileEntity; -import gregtech.api.interfaces.tileentity.IGregTechTileEntity; -import gregtech.api.items.GT_MetaGenerated_Tool; -import gregtech.api.metatileentity.implementations.GT_MetaTileEntity_Hatch; -import gregtech.api.metatileentity.implementations.GT_MetaTileEntity_Hatch_Dynamo; -import gregtech.api.metatileentity.implementations.GT_MetaTileEntity_Hatch_InputBus; -import gregtech.api.metatileentity.implementations.GT_MetaTileEntity_Hatch_Muffler; -import gregtech.api.recipe.check.CheckRecipeResult; -import gregtech.api.recipe.check.CheckRecipeResultRegistry; -import gregtech.api.util.GT_Multiblock_Tooltip_Builder; -import gregtech.api.util.GT_Utility; -import gregtech.api.util.shutdown.ShutDownReason; -import gregtech.api.util.shutdown.ShutDownReasonRegistry; -import gtPlusPlus.api.objects.Logger; -import gtPlusPlus.api.objects.data.AutoMap; -import gtPlusPlus.api.objects.minecraft.BlockPos; -import gtPlusPlus.core.block.ModBlocks; -import gtPlusPlus.core.lib.CORE; -import gtPlusPlus.core.util.math.MathUtils; -import gtPlusPlus.core.util.minecraft.PlayerUtils; -import gtPlusPlus.core.util.minecraft.gregtech.PollutionUtils; -import gtPlusPlus.xmod.gregtech.api.metatileentity.implementations.GT_MetaTileEntity_Hatch_Turbine; -import gtPlusPlus.xmod.gregtech.api.metatileentity.implementations.base.GregtechMeta_MultiBlockBase; - -public abstract class GregtechMetaTileEntity_LargerTurbineBase - extends GregtechMeta_MultiBlockBase<GregtechMetaTileEntity_LargerTurbineBase> implements ISurvivalConstructable { - - protected int baseEff = 0; - protected long optFlow = 0; - protected long euPerTurbine = 0; - protected double realOptFlow = 0; - protected int storedFluid = 0; - protected int counter = 0; - protected boolean mFastMode = false; - protected double mufflerReduction = 1; - protected float[] flowMultipliers = new float[] { 1, 1, 1 }; - - public ITexture frontFace; - public ITexture frontFaceActive; - - public ArrayList<GT_MetaTileEntity_Hatch_Turbine> mTurbineRotorHatches = new ArrayList<>(); - - public GregtechMetaTileEntity_LargerTurbineBase(int aID, String aName, String aNameRegional) { - super(aID, aName, aNameRegional); - frontFace = getTextureFrontFace(); - frontFaceActive = getTextureFrontFaceActive(); - } - - public GregtechMetaTileEntity_LargerTurbineBase(String aName) { - super(aName); - frontFace = getTextureFrontFace(); - frontFaceActive = getTextureFrontFaceActive(); - } - - protected abstract ITexture getTextureFrontFace(); - - protected abstract ITexture getTextureFrontFaceActive(); - - protected abstract String getTurbineType(); - - protected abstract String getCasingName(); - - protected abstract boolean requiresOutputHatch(); - - @Override - protected final GT_Multiblock_Tooltip_Builder createTooltip() { - GT_Multiblock_Tooltip_Builder tt = new GT_Multiblock_Tooltip_Builder(); - tt.addMachineType(getMachineType()) - .addInfo("Controller Block for the XL " + getTurbineType() + " Turbine") - .addInfo("Runs as fast as 16 Large Turbines of the same type, takes the space of 12") - .addInfo("Right-click with screwdriver to enable Fast Mode, to run it even faster") - .addInfo("Optimal flow will increase or decrease accordingly on mode switch") - .addInfo("Fast Mode increases speed to 48x instead of 16x, with some penalties") - .addInfo("Maintenance problems and turbine damage happen 12x as often in Fast Mode"); - if (getTurbineType().contains("Steam")) { - tt.addInfo("XL Steam Turbines can use Loose Mode with either Slow or Fast Mode"); - } - if (getTurbineType().equals("Plasma")) { - tt.addInfo("Plasma fuel efficiency is lower for high tier turbines when using low-grade plasmas") - .addInfo("Efficiency = ((FuelValue / 200,000)^2) / (EU per Turbine)"); - } - tt.addPollutionAmount(getPollutionPerSecond(null)) - .addInfo("Pollution is 3x higher in Fast Mode") - .addSeparator() - .beginStructureBlock(7, 9, 7, false) - .addController("Top Middle") - .addCasingInfoMin(getCasingName(), 360, false) - .addCasingInfoMin("Rotor Shaft", 30, false) - .addOtherStructurePart("Rotor Assembly", "Any 1 dot hint", 1) - .addInputBus("Any 4 dot hint (min 1)", 4) - .addInputHatch("Any 4 dot hint(min 1)", 4); - if (requiresOutputHatch()) { - tt.addOutputHatch("Any 4 dot hint(min 1)", 4); - } - tt.addDynamoHatch("Any 4 dot hint(min 1)", 4) - .addMaintenanceHatch("Any 4 dot hint(min 1)", 4); - if (requiresMufflers()) { - tt.addMufflerHatch("Any 7 dot hint (x4)", 7); - } - tt.toolTipFinisher(CORE.GT_Tooltip_Builder.get()); - return tt; - } - - private static final String STRUCTURE_PIECE_MAIN = "main"; - private static final ClassValue<IStructureDefinition<GregtechMetaTileEntity_LargerTurbineBase>> STRUCTURE_DEFINITION = new ClassValue<>() { - - @Override - @SuppressWarnings("SpellCheckingInspection") - protected IStructureDefinition<GregtechMetaTileEntity_LargerTurbineBase> computeValue(Class<?> type) { - return StructureDefinition.<GregtechMetaTileEntity_LargerTurbineBase>builder() - // c = turbine casing - // s = turbine shaft - // t = turbine housing - // h = dynamo/maint - // m = muffler - .addShape( - STRUCTURE_PIECE_MAIN, - (new String[][] { { "ccchccc", "ccccccc", "ccmmmcc", "ccm~mcc", "ccmmmcc", "ccccccc", "ccchccc" }, - { "ctchctc", "cscccsc", "cscccsc", "cscccsc", "cscccsc", "cscccsc", "ctchctc" }, - { "ccchccc", "ccccccc", "ccccccc", "ccccccc", "ccccccc", "ccccccc", "ccchccc" }, - { "ccchccc", "ccccccc", "ccccccc", "ccccccc", "ccccccc", "ccccccc", "ccchccc" }, - { "ctchctc", "cscccsc", "cscccsc", "cscccsc", "cscccsc", "cscccsc", "ctchctc" }, - { "ccchccc", "ccccccc", "ccccccc", "ccccccc", "ccccccc", "ccccccc", "ccchccc" }, - { "ccchccc", "ccccccc", "ccccccc", "ccccccc", "ccccccc", "ccccccc", "ccchccc" }, - { "ctchctc", "cscccsc", "cscccsc", "cscccsc", "cscccsc", "cscccsc", "ctchctc" }, - { "ccchccc", "ccccccc", "ccccccc", "ccccccc", "ccccccc", "ccccccc", "ccchccc" }, })) - .addElement('c', lazy(t -> ofBlock(t.getCasingBlock(), t.getCasingMeta()))) - .addElement('s', lazy(t -> ofBlock(t.getShaftBlock(), t.getTurbineShaftMeta()))) - .addElement( - 't', - lazy( - t -> buildHatchAdder(GregtechMetaTileEntity_LargerTurbineBase.class) - .adder(GregtechMetaTileEntity_LargerTurbineBase::addTurbineHatch) - .hatchClass(GT_MetaTileEntity_Hatch_Turbine.class) - .casingIndex(t.getCasingTextureIndex()) - .dot(1) - .build())) - .addElement( - 'h', - lazy( - t -> buildHatchAdder(GregtechMetaTileEntity_LargerTurbineBase.class) - .atLeast(InputBus, InputHatch, OutputHatch, Dynamo.or(TTDynamo), Maintenance) - .casingIndex(t.getCasingTextureIndex()) - .dot(4) - .buildAndChain(t.getCasingBlock(), t.getCasingMeta()))) - .addElement( - 'm', - lazy( - t -> buildHatchAdder(GregtechMetaTileEntity_LargerTurbineBase.class).atLeast(Muffler) - .casingIndex(t.getCasingTextureIndex()) - .dot(7) - .buildAndChain(t.getCasingBlock(), t.getCasingMeta()))) - .build(); - } - }; - - @Override - public IStructureDefinition<GregtechMetaTileEntity_LargerTurbineBase> getStructureDefinition() { - return STRUCTURE_DEFINITION.get(getClass()); - } - - private boolean requiresMufflers() { - if (!PollutionUtils.isPollutionEnabled()) { - return false; - } - return getPollutionPerSecond(null) > 0; - } - - public final double getMufflerReduction() { - double totalReduction = 0; - for (GT_MetaTileEntity_Hatch_Muffler tHatch : filterValidMTEs(mMufflerHatches)) { - totalReduction += ((double) tHatch.calculatePollutionReduction(100)) / 100; - } - return totalReduction / 4; - } - - @Override - public void clearHatches() { - super.clearHatches(); - mTurbineRotorHatches.clear(); - } - - @Override - public boolean checkMachine(IGregTechTileEntity aBaseMetaTileEntity, ItemStack aStack) { - // we do not check for casing count here. the bare minimal is 372 but we only require 360 - boolean aStructure = checkPiece(STRUCTURE_PIECE_MAIN, 3, 3, 0); - log("Structure Check: " + aStructure); - if (mTurbineRotorHatches.size() != 12 || mMaintenanceHatches.size() != 1 - || (mDynamoHatches.size() < 1 && mTecTechDynamoHatches.size() < 1) - || (requiresMufflers() && mMufflerHatches.size() != 4) - || mInputBusses.size() < 1 - || mInputHatches.size() < 1 - || (requiresOutputHatch() && mOutputHatches.size() < 1)) { - log( - "Bad Hatches - Turbine Housings: " + mTurbineRotorHatches.size() - + ", Maint: " - + mMaintenanceHatches.size() - + ", Dynamo: " - + mDynamoHatches.size() - + ", Muffler: " - + mMufflerHatches.size() - + ", Input Buses: " - + mInputBusses.size() - + ", Input Hatches: " - + mInputHatches.size() - + ", Output Hatches: " - + mOutputHatches.size()); - return false; - } - mufflerReduction = getMufflerReduction(); - return aStructure; - } - - @Override - public void construct(ItemStack stackSize, boolean hintsOnly) { - buildPiece(STRUCTURE_PIECE_MAIN, stackSize, hintsOnly, 3, 3, 0); - } - - @Override - public int survivalConstruct(ItemStack stackSize, int elementBudget, ISurvivalBuildEnvironment env) { - if (mMachine) return -1; - int realBudget = elementBudget >= 200 ? elementBudget : Math.min(200, elementBudget * 2); - return survivialBuildPiece(STRUCTURE_PIECE_MAIN, stackSize, 3, 3, 0, realBudget, env, false, true); - } - - public boolean addTurbineHatch(final IGregTechTileEntity aTileEntity, final int aBaseCasingIndex) { - if (aTileEntity == null) { - return false; - } - final IMetaTileEntity aMetaTileEntity = aTileEntity.getMetaTileEntity(); - if (aMetaTileEntity == null) { - return false; - } - if (aMetaTileEntity instanceof GT_MetaTileEntity_Hatch_Turbine aTurbineHatch) { - log("Found GT_MetaTileEntity_Hatch_Turbine"); - updateTexture(aTileEntity, aBaseCasingIndex); - IGregTechTileEntity g = this.getBaseMetaTileEntity(); - if (aTurbineHatch.setController(new BlockPos(g.getXCoord(), g.getYCoord(), g.getZCoord(), g.getWorld()))) { - boolean aDidAdd = this.mTurbineRotorHatches.add(aTurbineHatch); - Logger.INFO("Injected Controller into Turbine Assembly. Found: " + this.mTurbineRotorHatches.size()); - return aDidAdd; - } else { - Logger.INFO("Failed to inject controller into Turbine Assembly Hatch."); - } - } - log("Bad Turbine Housing"); - return false; - } - - @Override - public boolean isCorrectMachinePart(ItemStack aStack) { - return getMaxEfficiency(aStack) > 0; - } - - public Block getCasingBlock() { - return ModBlocks.blockSpecialMultiCasings; - } - - public final Block getShaftBlock() { - return ModBlocks.blockSpecialMultiCasings; - } - - public abstract int getCasingMeta(); - - public byte getTurbineShaftMeta() { - return 0; - } - - public abstract int getCasingTextureIndex(); - - public abstract int getFuelValue(FluidStack aLiquid); - - public static boolean isValidTurbine(ItemStack aTurbine) { - return (aTurbine != null && aTurbine.getItem() instanceof GT_MetaGenerated_Tool - && aTurbine.getItemDamage() >= 170 - && aTurbine.getItemDamage() <= 176); - } - - protected ArrayList<ItemStack> getAllBufferedTurbines() { - startRecipeProcessing(); - ArrayList<ItemStack> aTurbinesInStorage = new ArrayList<>(); - for (ItemStack aStack : getStoredInputs()) { - if (isValidTurbine(aStack)) { - int stackSize = aStack.stackSize; - while (stackSize > 0) { - int tmpStackSize = Math.min(stackSize, aStack.getMaxStackSize()); - ItemStack copy = aStack.copy(); - copy.stackSize = tmpStackSize; - aTurbinesInStorage.add(copy); - stackSize -= tmpStackSize; - } - } - } - endRecipeProcessing(); - return aTurbinesInStorage; - } - - public boolean areAllTurbinesTheSame() { - ArrayList<GT_MetaTileEntity_Hatch_Turbine> aTurbineAssemblies = getFullTurbineAssemblies(); - if (aTurbineAssemblies.size() < 12) { - log("Found " + aTurbineAssemblies.size() + ", expected 12."); - return false; - } - AutoMap<Materials> aTurbineMats = new AutoMap<>(); - AutoMap<Integer> aTurbineSizes = new AutoMap<>(); - for (GT_MetaTileEntity_Hatch_Turbine aHatch : aTurbineAssemblies) { - aTurbineMats.add(GT_MetaGenerated_Tool.getPrimaryMaterial(aHatch.getTurbine())); - aTurbineSizes.add(getTurbineSize(aHatch.getTurbine())); - } - Materials aBaseMat = aTurbineMats.get(0); - int aBaseSize = aTurbineSizes.get(0); - for (int aSize : aTurbineSizes) { - if (aBaseSize != aSize) { - return false; - } - } - for (Materials aMat : aTurbineMats) { - if (aBaseMat != aMat) { - return false; - } - } - return true; - } - - public static int getTurbineSize(ItemStack aTurbine) { - if (isValidTurbine(aTurbine)) { - if (aTurbine.getItemDamage() >= 170 && aTurbine.getItemDamage() < 172) { - return 1; - } else if (aTurbine.getItemDamage() >= 172 && aTurbine.getItemDamage() < 174) { - return 2; - } else if (aTurbine.getItemDamage() >= 174 && aTurbine.getItemDamage() < 176) { - return 3; - } else if (aTurbine.getItemDamage() >= 176 && aTurbine.getItemDamage() < 178) { - return 4; - } - } - return 0; - } - - public static String getTurbineSizeString(int aSize) { - return switch (aSize) { - case 1 -> "Small Turbine"; - case 2 -> "Turbine"; - case 3 -> "Large Turbine"; - case 4 -> "Huge Turbine"; - default -> ""; - }; - } - - protected ArrayList<GT_MetaTileEntity_Hatch_Turbine> getEmptyTurbineAssemblies() { - ArrayList<GT_MetaTileEntity_Hatch_Turbine> aEmptyTurbineRotorHatches = new ArrayList<>(); - // log("Checking "+mTurbineRotorHatches.size()+" Assemblies for empties."); - for (GT_MetaTileEntity_Hatch_Turbine aTurbineHatch : this.mTurbineRotorHatches) { - if (!aTurbineHatch.hasTurbine()) { - aEmptyTurbineRotorHatches.add(aTurbineHatch); - } - } - return aEmptyTurbineRotorHatches; - } - - protected ArrayList<GT_MetaTileEntity_Hatch_Turbine> getFullTurbineAssemblies() { - ArrayList<GT_MetaTileEntity_Hatch_Turbine> aTurbineRotorHatches = new ArrayList<>(); - // log("Checking "+mTurbineRotorHatches.size()+" Assemblies for Turbines."); - for (GT_MetaTileEntity_Hatch_Turbine aTurbineHatch : this.mTurbineRotorHatches) { - if (aTurbineHatch.hasTurbine()) { - // log("Found Assembly with Turbine."); - aTurbineRotorHatches.add(aTurbineHatch); - } - } - return aTurbineRotorHatches; - } - - protected void depleteTurbineFromStock(ItemStack aTurbine) { - if (aTurbine == null) { - return; - } - startRecipeProcessing(); - for (GT_MetaTileEntity_Hatch_InputBus aInputBus : this.mInputBusses) { - for (int slot = aInputBus.getSizeInventory() - 1; slot >= 0; slot--) { - ItemStack aStack = aInputBus.getStackInSlot(slot); - if (aStack != null && GT_Utility.areStacksEqual(aStack, aTurbine)) { - aStack.stackSize -= aTurbine.stackSize; - updateSlots(); - endRecipeProcessing(); - return; - } - } - } - endRecipeProcessing(); - } - - @Override - public @NotNull CheckRecipeResult checkProcessing() { - try { - ArrayList<GT_MetaTileEntity_Hatch_Turbine> aEmptyTurbineRotorHatches = getEmptyTurbineAssemblies(); - if (aEmptyTurbineRotorHatches.size() > 0) { - hatch: for (GT_MetaTileEntity_Hatch_Turbine aHatch : aEmptyTurbineRotorHatches) { - ArrayList<ItemStack> aTurbines = getAllBufferedTurbines(); - for (ItemStack aTurbineItem : aTurbines) { - if (aTurbineItem == null) { - continue; - } - if (aHatch.insertTurbine(aTurbineItem.copy())) { - depleteTurbineFromStock(aTurbineItem); - continue hatch; - } - } - } - } - - if (getEmptyTurbineAssemblies().size() > 0 || !areAllTurbinesTheSame()) { - stopMachine(ShutDownReasonRegistry.NO_TURBINE); - return CheckRecipeResultRegistry.NO_TURBINE_FOUND; - } - - ArrayList<FluidStack> tFluids = getStoredFluids(); - - if (tFluids.size() > 0) { - if (baseEff == 0 || optFlow == 0 - || counter >= 512 - || this.getBaseMetaTileEntity() - .hasWorkJustBeenEnabled() - || this.getBaseMetaTileEntity() - .hasInventoryBeenModified()) { - counter = 0; - float aTotalBaseEff = 0; - float aTotalOptimalFlow = 0; - - ItemStack aStack = getFullTurbineAssemblies().get(0) - .getTurbine(); - aTotalBaseEff += GT_Utility.safeInt( - (long) ((5F + ((GT_MetaGenerated_Tool) aStack.getItem()).getToolCombatDamage(aStack)) * 1000F)); - aTotalOptimalFlow += GT_Utility.safeInt( - (long) Math.max( - Float.MIN_NORMAL, - ((GT_MetaGenerated_Tool) aStack.getItem()).getToolStats(aStack) - .getSpeedMultiplier() * GT_MetaGenerated_Tool.getPrimaryMaterial(aStack).mToolSpeed - * 50) - * getSpeedMultiplier()); - if (aTotalOptimalFlow < 0) { - aTotalOptimalFlow = 100; - } - - flowMultipliers[0] = GT_MetaGenerated_Tool.getPrimaryMaterial(aStack).mSteamMultiplier; - flowMultipliers[1] = GT_MetaGenerated_Tool.getPrimaryMaterial(aStack).mGasMultiplier; - flowMultipliers[2] = GT_MetaGenerated_Tool.getPrimaryMaterial(aStack).mPlasmaMultiplier; - baseEff = MathUtils.roundToClosestInt(aTotalBaseEff); - optFlow = MathUtils.roundToClosestInt(aTotalOptimalFlow); - if (optFlow <= 0 || baseEff <= 0) { - stopMachine(ShutDownReasonRegistry.NONE); // in case the turbine got removed - return CheckRecipeResultRegistry.NO_FUEL_FOUND; - } - } else { - counter++; - } - } - - // How much the turbine should be producing with this flow - long newPower = fluidIntoPower(tFluids, optFlow, baseEff, flowMultipliers); - long difference = newPower - this.lEUt; // difference between current output and new output - - // Magic numbers: can always change by at least 10 eu/t, but otherwise by at most 1 percent of the - // difference in power level (per tick) - // This is how much the turbine can actually change during this tick - int maxChangeAllowed = Math.max(10, GT_Utility.safeInt(Math.abs(difference) / 100)); - - if (Math.abs(difference) > maxChangeAllowed) { // If this difference is too big, use the maximum allowed - // change - int change = maxChangeAllowed * (difference > 0 ? 1 : -1); // Make the change positive or negative. - this.lEUt += change; // Apply the change - } else { - this.lEUt = newPower; - } - if (this.lEUt <= 0) { - this.lEUt = 0; - this.mEfficiency = 0; - return CheckRecipeResultRegistry.NO_FUEL_FOUND; - } else { - this.mMaxProgresstime = 1; - this.mEfficiencyIncrease = 10; - // Overvoltage is handled inside the MultiBlockBase when pushing out to dynamos. no need to do it here. - // Play sounds (GT++ addition - GT multiblocks play no sounds) - enableAllTurbineHatches(); - return CheckRecipeResultRegistry.GENERATING; - } - } catch (Throwable t) { - t.printStackTrace(); - } - return CheckRecipeResultRegistry.NO_FUEL_FOUND; - } - - @Override - public boolean doRandomMaintenanceDamage() { - if (getMaxParallelRecipes() == 0) { - stopMachine(ShutDownReasonRegistry.NO_TURBINE); - return false; - } - - if (mRuntime++ > 1000) { - mRuntime = 0; - - if (getBaseMetaTileEntity().getRandomNumber(6000) < getMaintenanceThreshold()) { - switch (getBaseMetaTileEntity().getRandomNumber(6)) { - case 0 -> mWrench = false; - case 1 -> mScrewdriver = false; - case 2 -> mSoftHammer = false; - case 3 -> mHardHammer = false; - case 4 -> mSolderingTool = false; - case 5 -> mCrowbar = false; - } - } - for (GT_MetaTileEntity_Hatch_Turbine aHatch : getFullTurbineAssemblies()) { - // This cycle depletes durability from the turbine rotors. - // The amount of times it is run depends on turbineDamageMultiplier - // In XL turbines, durability loss is around 5.2-5.3x faster than in singles - // To compensate for that, the mEU/t scaling is divided by 5 to make it only slightly faster - for (int i = 0; i < getTurbineDamageMultiplier(); i++) { - aHatch.damageTurbine(lEUt / 5, damageFactorLow, damageFactorHigh); - } - } - } - return true; - } - - @Override - public int getMaxParallelRecipes() { - return (getFullTurbineAssemblies().size()); - } - - abstract long fluidIntoPower(ArrayList<FluidStack> aFluids, long aOptFlow, int aBaseEff, float[] flowMultipliers); - - @Override - public int getDamageToComponent(ItemStack aStack) { - return 1; - } - - @Override - public int getMaxEfficiency(ItemStack aStack) { - return this.getMaxParallelRecipes() == 12 ? 10000 : 0; - } - - @Override - public boolean explodesOnComponentBreak(ItemStack aStack) { - return false; - } - - public boolean isLooseMode() { - return false; - } - - @Override - public String[] getExtraInfoData() { - int mPollutionReduction = (int) (100 * mufflerReduction); - - String tRunning = mMaxProgresstime > 0 - ? EnumChatFormatting.GREEN + StatCollector.translateToLocal("GT5U.turbine.running.true") - + EnumChatFormatting.RESET - : EnumChatFormatting.RED + StatCollector.translateToLocal("GT5U.turbine.running.false") - + EnumChatFormatting.RESET; - - String tMaintenance = getIdealStatus() == getRepairStatus() - ? EnumChatFormatting.GREEN + StatCollector.translateToLocal("GT5U.turbine.maintenance.false") - + EnumChatFormatting.RESET - : EnumChatFormatting.RED + StatCollector.translateToLocal("GT5U.turbine.maintenance.true") - + EnumChatFormatting.RESET; - int tDura; - - StringBuilder aTurbineDamage = new StringBuilder(); - for (GT_MetaTileEntity_Hatch_Turbine aHatch : this.getFullTurbineAssemblies()) { - ItemStack aTurbine = aHatch.getTurbine(); - tDura = MathUtils.safeInt( - (long) (100.0f / GT_MetaGenerated_Tool.getToolMaxDamage(aTurbine) - * (GT_MetaGenerated_Tool.getToolDamage(aTurbine)) + 1)); - aTurbineDamage.append(EnumChatFormatting.RED) - .append(GT_Utility.formatNumbers(tDura)) - .append(EnumChatFormatting.RESET) - .append("% | "); - } - - long storedEnergy = 0; - long maxEnergy = 0; - for (GT_MetaTileEntity_Hatch_Dynamo tHatch : filterValidMTEs(mDynamoHatches)) { - storedEnergy += tHatch.getBaseMetaTileEntity() - .getStoredEU(); - maxEnergy += tHatch.getBaseMetaTileEntity() - .getEUCapacity(); - } - - boolean aIsSteam = this.getClass() - .getName() - .toLowerCase() - .contains("steam"); - - String[] ret = new String[] { - // 8 Lines available for information panels - tRunning + ": " - + EnumChatFormatting.RED - + GT_Utility.formatNumbers(((lEUt * mEfficiency) / 10000)) - + EnumChatFormatting.RESET - + " EU/t", - tMaintenance, - StatCollector.translateToLocal("GT5U.turbine.efficiency") + ": " - + EnumChatFormatting.YELLOW - + GT_Utility.formatNumbers((mEfficiency / 100F)) - + EnumChatFormatting.RESET - + "%", - StatCollector.translateToLocal("GT5U.multiblock.energy") + ": " - + EnumChatFormatting.GREEN - + GT_Utility.formatNumbers(storedEnergy) - + EnumChatFormatting.RESET - + " EU / " - + EnumChatFormatting.YELLOW - + GT_Utility.formatNumbers(maxEnergy) - + EnumChatFormatting.RESET - + " EU", - StatCollector.translateToLocal("GT5U.turbine.flow") + ": " - + EnumChatFormatting.YELLOW - + GT_Utility.formatNumbers(MathUtils.safeInt((long) realOptFlow)) - + EnumChatFormatting.RESET - + " L/s" - + EnumChatFormatting.YELLOW - + " (" - + (isLooseMode() ? StatCollector.translateToLocal("GT5U.turbine.loose") - : StatCollector.translateToLocal("GT5U.turbine.tight")) - + ")", - StatCollector.translateToLocal("GT5U.turbine.fuel") + ": " - + EnumChatFormatting.GOLD - + GT_Utility.formatNumbers(storedFluid) - + EnumChatFormatting.RESET - + "L", - StatCollector.translateToLocal("GT5U.turbine.dmg") + ": " + aTurbineDamage, - StatCollector.translateToLocal("GT5U.multiblock.pollution") + ": " - + EnumChatFormatting.GREEN - + GT_Utility.formatNumbers(mPollutionReduction) - + EnumChatFormatting.RESET - + " %" }; - if (!aIsSteam) ret[4] = StatCollector.translateToLocal("GT5U.turbine.flow") + ": " - + EnumChatFormatting.YELLOW - + GT_Utility.formatNumbers(MathUtils.safeInt((long) realOptFlow)) - + EnumChatFormatting.RESET - + " L/t"; - return ret; - } - - @Override - public boolean isGivingInformation() { - return true; - } - - @Override - public boolean polluteEnvironment(int aPollutionLevel) { - if (this.requiresMufflers()) { - mPollution += aPollutionLevel * getPollutionMultiplier() * mufflerReduction; - for (GT_MetaTileEntity_Hatch_Muffler tHatch : filterValidMTEs(mMufflerHatches)) { - if (mPollution >= 10000) { - if (PollutionUtils.addPollution(this.getBaseMetaTileEntity(), 10000)) { - mPollution -= 10000; - } - } else { - break; - } - } - return mPollution < 10000; - } - return true; - } - - @Override - public long maxAmperesOut() { - // This should not be a hard limit, due to TecTech dynamos - if (mFastMode) { - return 64; - } else { - return 16; - } - } - - @Override - public void saveNBTData(NBTTagCompound aNBT) { - aNBT.setBoolean("mFastMode", mFastMode); - super.saveNBTData(aNBT); - } - - @Override - public void loadNBTData(NBTTagCompound aNBT) { - mFastMode = aNBT.getBoolean("mFastMode"); - super.loadNBTData(aNBT); - } - - @Override - public void onModeChangeByScrewdriver(ForgeDirection side, EntityPlayer aPlayer, float aX, float aY, float aZ) { - mFastMode = !mFastMode; - if (mFastMode) { - PlayerUtils.messagePlayer(aPlayer, "Running in Fast (48x) Mode."); - } else { - PlayerUtils.messagePlayer(aPlayer, "Running in Slow (16x) Mode."); - } - } - - public final ITexture[] getTexture(IGregTechTileEntity aBaseMetaTileEntity, ForgeDirection side, - ForgeDirection facing, int aColorIndex, boolean aActive, boolean aRedstone) { - return new ITexture[] { Textures.BlockIcons.MACHINE_CASINGS[1][aColorIndex + 1], - facing == side ? getFrontFacingTurbineTexture(aActive) - : Textures.BlockIcons.getCasingTextureForId(getCasingTextureIndex()) }; - } - - protected ITexture getFrontFacingTurbineTexture(boolean isActive) { - if (isActive) { - return frontFaceActive; - } - return frontFace; - } - - @Override - public void onPostTick(IGregTechTileEntity aBaseMetaTileEntity, long aTick) { - super.onPostTick(aBaseMetaTileEntity, aTick); - if (aBaseMetaTileEntity.isServerSide()) { - if (this.maxProgresstime() > 0 || this.getBaseMetaTileEntity() - .hasWorkJustBeenEnabled()) { - enableAllTurbineHatches(); - } - if (this.maxProgresstime() <= 0) { - stopMachine(ShutDownReasonRegistry.NONE); - } - } - } - - @Override - public void stopMachine(@NotNull ShutDownReason reason) { - baseEff = 0; - optFlow = 0; - disableAllTurbineHatches(); - super.stopMachine(reason); - } - - @Override - public void onRemoval() { - super.onRemoval(); - for (GT_MetaTileEntity_Hatch_Turbine h : this.mTurbineRotorHatches) { - h.clearController(); - } - disableAllTurbineHatches(); - this.mTurbineRotorHatches.clear(); - } - - public void enableAllTurbineHatches() { - updateTurbineHatches(this.isMachineRunning()); - } - - public void disableAllTurbineHatches() { - updateTurbineHatches(false); - } - - private Long mLastHatchUpdate; - - public void updateTurbineHatches(boolean aState) { - if (mLastHatchUpdate == null) { - mLastHatchUpdate = System.currentTimeMillis() / 1000; - } - if (this.mTurbineRotorHatches.isEmpty() || ((System.currentTimeMillis() / 1000) - mLastHatchUpdate) <= 2) { - return; - } - for (GT_MetaTileEntity_Hatch_Turbine h : filterValidMTEs(this.mTurbineRotorHatches)) { - h.setActive(aState); - } - - mLastHatchUpdate = System.currentTimeMillis() / 1000; - } - - @Override - protected IAlignmentLimits getInitialAlignmentLimits() { - return (d, r, f) -> d == ForgeDirection.UP; - } - - /** - * Called every tick the Machine runs - */ - @Override - public boolean onRunningTick(ItemStack aStack) { - if (lEUt > 0) { - addEnergyOutput((lEUt * mEfficiency) / 10000); - return true; - } - return false; - } - - @Override - public boolean addEnergyOutput(long aEU) { - if (aEU <= 0) { - return true; - } - if (this.mAllDynamoHatches.size() > 0) { - return addEnergyOutputMultipleDynamos(aEU, true); - } - return false; - } - - @Override - public boolean addEnergyOutputMultipleDynamos(long aEU, boolean aAllowMixedVoltageDynamos) { - int injected = 0; - long aFirstVoltageFound = -1; - for (GT_MetaTileEntity_Hatch aDynamo : filterValidMTEs(mAllDynamoHatches)) { - long aVoltage = aDynamo.maxEUOutput(); - // Check against voltage to check when hatch mixing - if (aFirstVoltageFound == -1) { - aFirstVoltageFound = aVoltage; - } - } - - long leftToInject; - long aVoltage; - int aAmpsToInject; - int aRemainder; - int ampsOnCurrentHatch; - for (GT_MetaTileEntity_Hatch aDynamo : filterValidMTEs(mAllDynamoHatches)) { - leftToInject = aEU - injected; - aVoltage = aDynamo.maxEUOutput(); - aAmpsToInject = (int) (leftToInject / aVoltage); - aRemainder = (int) (leftToInject - (aAmpsToInject * aVoltage)); - ampsOnCurrentHatch = (int) Math.min(aDynamo.maxAmperesOut(), aAmpsToInject); - - // add full amps - aDynamo.getBaseMetaTileEntity() - .increaseStoredEnergyUnits(aVoltage * ampsOnCurrentHatch, false); - injected += aVoltage * ampsOnCurrentHatch; - - // add reminder - if (aRemainder > 0 && ampsOnCurrentHatch < aDynamo.maxAmperesOut()) { - aDynamo.getBaseMetaTileEntity() - .increaseStoredEnergyUnits(aRemainder, false); - injected += aRemainder; - } - } - return injected > 0; - } - - public int getSpeedMultiplier() { - return mFastMode ? 48 : 16; - } - - public int getMaintenanceThreshold() { - return mFastMode ? 12 : 1; - } - - public int getPollutionMultiplier() { - return mFastMode ? 3 : 1; - } - - public int getTurbineDamageMultiplier() { - return mFastMode ? 3 : 1; - } - - @Override - public boolean supportsBatchMode() { - return false; - } -} diff --git a/gtpp/src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/storage/GregtechMetaTileEntity_PowerSubStationController.java b/gtpp/src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/storage/GregtechMetaTileEntity_PowerSubStationController.java deleted file mode 100644 index 67244cb399..0000000000 --- a/gtpp/src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/storage/GregtechMetaTileEntity_PowerSubStationController.java +++ /dev/null @@ -1,939 +0,0 @@ -package gtPlusPlus.xmod.gregtech.common.tileentities.machines.multi.storage; - -import static com.gtnewhorizon.structurelib.structure.StructureUtility.ofBlock; -import static com.gtnewhorizon.structurelib.structure.StructureUtility.ofChain; -import static com.gtnewhorizon.structurelib.structure.StructureUtility.onElementPass; -import static com.gtnewhorizon.structurelib.structure.StructureUtility.onlyIf; -import static com.gtnewhorizon.structurelib.structure.StructureUtility.transpose; -import static com.gtnewhorizon.structurelib.structure.StructureUtility.withChannel; -import static gregtech.api.enums.GT_HatchElement.Dynamo; -import static gregtech.api.enums.GT_HatchElement.Energy; -import static gregtech.api.enums.GT_HatchElement.Maintenance; -import static gregtech.api.enums.Mods.TecTech; -import static gregtech.api.util.GT_StructureUtility.buildHatchAdder; -import static gregtech.api.util.GT_StructureUtility.ofHatchAdderOptional; -import static gregtech.api.util.GT_Utility.filterValidMTEs; -import static gtPlusPlus.xmod.gregtech.api.metatileentity.implementations.base.GregtechMeta_MultiBlockBase.GTPPHatchElement.TTDynamo; -import static gtPlusPlus.xmod.gregtech.api.metatileentity.implementations.base.GregtechMeta_MultiBlockBase.GTPPHatchElement.TTEnergy; - -import javax.annotation.Nullable; - -import net.minecraft.block.Block; -import net.minecraft.entity.player.EntityPlayer; -import net.minecraft.item.ItemStack; -import net.minecraft.nbt.NBTTagCompound; -import net.minecraft.util.EnumChatFormatting; -import net.minecraft.world.World; -import net.minecraftforge.common.util.Constants.NBT; -import net.minecraftforge.common.util.ForgeDirection; - -import org.jetbrains.annotations.NotNull; - -import com.gtnewhorizon.structurelib.StructureLibAPI; -import com.gtnewhorizon.structurelib.alignment.constructable.ChannelDataAccessor; -import com.gtnewhorizon.structurelib.alignment.constructable.ISurvivalConstructable; -import com.gtnewhorizon.structurelib.structure.AutoPlaceEnvironment; -import com.gtnewhorizon.structurelib.structure.IStructureDefinition; -import com.gtnewhorizon.structurelib.structure.IStructureElement; -import com.gtnewhorizon.structurelib.structure.ISurvivalBuildEnvironment; -import com.gtnewhorizon.structurelib.structure.StructureDefinition; -import com.gtnewhorizon.structurelib.structure.StructureUtility; -import com.gtnewhorizons.modularui.api.NumberFormatMUI; -import com.gtnewhorizons.modularui.api.drawable.Text; -import com.gtnewhorizons.modularui.api.forge.PlayerMainInvWrapper; -import com.gtnewhorizons.modularui.api.screen.ModularWindow; -import com.gtnewhorizons.modularui.api.screen.UIBuildContext; -import com.gtnewhorizons.modularui.common.widget.DrawableWidget; -import com.gtnewhorizons.modularui.common.widget.FakeSyncWidget; -import com.gtnewhorizons.modularui.common.widget.ProgressBar; -import com.gtnewhorizons.modularui.common.widget.SlotGroup; -import com.gtnewhorizons.modularui.common.widget.SlotWidget; -import com.gtnewhorizons.modularui.common.widget.TextWidget; - -import gregtech.api.enums.GT_Values; -import gregtech.api.enums.TAE; -import gregtech.api.enums.Textures; -import gregtech.api.gui.modularui.GT_UIInfos; -import gregtech.api.gui.modularui.GT_UITextures; -import gregtech.api.interfaces.ITexture; -import gregtech.api.interfaces.metatileentity.IMetaTileEntity; -import gregtech.api.interfaces.tileentity.IGregTechTileEntity; -import gregtech.api.metatileentity.MetaTileEntity; -import gregtech.api.metatileentity.implementations.GT_MetaTileEntity_Hatch; -import gregtech.api.metatileentity.implementations.GT_MetaTileEntity_Hatch_Dynamo; -import gregtech.api.metatileentity.implementations.GT_MetaTileEntity_Hatch_Energy; -import gregtech.api.metatileentity.implementations.GT_MetaTileEntity_Hatch_Maintenance; -import gregtech.api.objects.GT_RenderedTexture; -import gregtech.api.recipe.check.CheckRecipeResult; -import gregtech.api.recipe.check.SimpleCheckRecipeResult; -import gregtech.api.util.GT_Multiblock_Tooltip_Builder; -import gregtech.api.util.GT_Utility; -import gtPlusPlus.api.objects.Logger; -import gtPlusPlus.core.block.ModBlocks; -import gtPlusPlus.core.lib.CORE; -import gtPlusPlus.core.util.MovingAverageLong; -import gtPlusPlus.core.util.Utils; -import gtPlusPlus.core.util.math.MathUtils; -import gtPlusPlus.core.util.minecraft.PlayerUtils; -import gtPlusPlus.preloader.asm.AsmConfig; -import gtPlusPlus.xmod.gregtech.api.gui.GTPP_UITextures; -import gtPlusPlus.xmod.gregtech.api.metatileentity.implementations.base.GregtechMeta_MultiBlockBase; - -public class GregtechMetaTileEntity_PowerSubStationController extends - GregtechMeta_MultiBlockBase<GregtechMetaTileEntity_PowerSubStationController> implements ISurvivalConstructable { - - private static enum TopState { - MayBeTop, - Top, - NotTop - } - - protected long mAverageEuUsage = 0; - protected final MovingAverageLong mAverageEuAdded = new MovingAverageLong(20); - protected final MovingAverageLong mAverageEuConsumed = new MovingAverageLong(20); - protected long mTotalEnergyAdded = 0; - protected long mTotalEnergyConsumed = 0; - protected long mTotalEnergyLost = 0; - protected boolean mIsOutputtingPower = false; - protected long mBatteryCapacity = 0; - - private final int ENERGY_TAX = 5; - - private int mCasing; - private int[] cellCount = new int[6]; - private TopState topState = TopState.MayBeTop; - private static IStructureDefinition<GregtechMetaTileEntity_PowerSubStationController> STRUCTURE_DEFINITION = null; - - public GregtechMetaTileEntity_PowerSubStationController(final int aID, final String aName, - final String aNameRegional) { - super(aID, aName, aNameRegional); - } - - public GregtechMetaTileEntity_PowerSubStationController(final String aName) { - super(aName); - } - - @Override - public String getMachineType() { - return "Energy Buffer"; - } - - @Override - protected GT_Multiblock_Tooltip_Builder createTooltip() { - GT_Multiblock_Tooltip_Builder tt = new GT_Multiblock_Tooltip_Builder(); - tt.addMachineType(getMachineType()) - .addInfo("Consumes " + this.ENERGY_TAX + "% of the average voltage of all energy type hatches") - .addInfo("Does not require maintenance") - .addInfo( - "Can be built with variable height between " + (CELL_HEIGHT_MIN + 2) + "-" + (CELL_HEIGHT_MAX + 2) + "") - .addInfo("Hatches can be placed nearly anywhere") - .addInfo("HV Energy/Dynamo Hatches are the lowest tier you can use") - .addInfo("Supports voltages >= UHV using MAX tier components.") - .addSeparator() - .addController("Bottom Center") - .addCasingInfoMin("Sub-Station External Casings", 10, false) - .addDynamoHatch("Any Casing", 1) - .addEnergyHatch("Any Casing", 1) - .addSubChannelUsage("capacitor", "Vanadium Capacitor Cell Tier") - .addSubChannelUsage("height", "Height of structure") - .toolTipFinisher(CORE.GT_Tooltip_Builder.get()); - return tt; - } - - @Override - public ITexture[] getTexture(final IGregTechTileEntity aBaseMetaTileEntity, final ForgeDirection side, - final ForgeDirection facing, final int aColorIndex, final boolean aActive, final boolean aRedstone) { - if (side == facing) { - return new ITexture[] { Textures.BlockIcons.getCasingTextureForId(TAE.GTPP_INDEX(24)), - new GT_RenderedTexture( - aActive ? Textures.BlockIcons.OVERLAY_FRONT_DISASSEMBLER_ACTIVE - : Textures.BlockIcons.OVERLAY_FRONT_DISASSEMBLER) }; - } - if (side == this.getBaseMetaTileEntity() - .getBackFacing()) { - return new ITexture[] { Textures.BlockIcons.getCasingTextureForId(TAE.GTPP_INDEX(24)), - mIsOutputtingPower ? Textures.BlockIcons.OVERLAYS_ENERGY_OUT_MULTI[(int) this.getOutputTier()] - : Textures.BlockIcons.OVERLAYS_ENERGY_IN_MULTI[(int) this.getInputTier()] }; - } - return new ITexture[] { Textures.BlockIcons.getCasingTextureForId(TAE.GTPP_INDEX(23)) }; - } - - @Override - public boolean onRightclick(IGregTechTileEntity aBaseMetaTileEntity, EntityPlayer aPlayer) { - // if (mBatteryCapacity <= 0) return false; - GT_UIInfos.openGTTileEntityUI(aBaseMetaTileEntity, aPlayer); - return true; - } - - private void checkMachineProblem(String msg, int xOff, int yOff, int zOff) { - final IGregTechTileEntity te = this.getBaseMetaTileEntity(); - final Block tBlock = te.getBlockOffset(xOff, yOff, zOff); - final byte tMeta = te.getMetaIDOffset(xOff, yOff, zOff); - String name = tBlock.getLocalizedName(); - String problem = msg + ": (" + xOff + ", " + yOff + ", " + zOff + ") " + name + ":" + tMeta; - checkMachineProblem(problem); - } - - private void checkMachineProblem(String msg) { - if (!AsmConfig.disableAllLogging) { - Logger.INFO("Power Sub-Station problem: " + msg); - } - } - - public static int getCellTier(Block aBlock, int aMeta) { - if (aBlock == ModBlocks.blockCasings2Misc && aMeta == 7) { - return 4; - } else if (aBlock == ModBlocks.blockCasings3Misc && aMeta == 4) { - return 5; - } else if (aBlock == ModBlocks.blockCasings3Misc && aMeta == 5) { - return 6; - } else if (aBlock == ModBlocks.blockCasings3Misc && aMeta == 6) { - return 7; - } else if (aBlock == ModBlocks.blockCasings3Misc && aMeta == 7) { - return 8; - } else if (aBlock == ModBlocks.blockCasings3Misc && aMeta == 8) { - return 9; - } else { - return -1; - } - } - - public static int getMetaFromTier(int tier) { - if (tier == 4) return 7; - if (tier >= 5 && tier <= 9) return tier - 1; - return 0; - } - - public static Block getBlockFromTier(int tier) { - return switch (tier) { - case 4 -> ModBlocks.blockCasings2Misc; - case 5, 6, 7, 8, 9 -> ModBlocks.blockCasings3Misc; - default -> null; - }; - } - - public static int getMaxHatchTier(int aCellTier) { - switch (aCellTier) { - case 9 -> { - return GT_Values.VOLTAGE_NAMES[9].equals("Ultimate High Voltage") ? 15 : 9; - } - default -> { - if (aCellTier < 4) { - return 0; - } else { - return aCellTier; - } - } - } - } - - public static final int CELL_HEIGHT_MAX = 16; - public static final int CELL_HEIGHT_MIN = 2; - - @Override - public IStructureDefinition<GregtechMetaTileEntity_PowerSubStationController> getStructureDefinition() { - if (STRUCTURE_DEFINITION == null) { - STRUCTURE_DEFINITION = StructureDefinition.<GregtechMetaTileEntity_PowerSubStationController>builder() - .addShape( - mName + "bottom", - transpose(new String[][] { { "BB~BB", "BBBBB", "BBBBB", "BBBBB", "BBBBB" } })) - .addShape( - mName + "layer", - transpose(new String[][] { { "CCCCC", "CIIIC", "CIIIC", "CIIIC", "CCCCC" } })) - .addShape(mName + "mid", transpose(new String[][] { { "CCCCC", "CHHHC", "CHHHC", "CHHHC", "CCCCC" } })) - .addShape(mName + "top", transpose(new String[][] { { "TTTTT", "TTTTT", "TTTTT", "TTTTT", "TTTTT" } })) - .addElement( - 'C', - buildHatchAdder(GregtechMetaTileEntity_PowerSubStationController.class) - .atLeast(Energy.or(TTEnergy), Dynamo.or(TTDynamo), Maintenance) - .disallowOnly(ForgeDirection.UP, ForgeDirection.DOWN) - .casingIndex(TAE.GTPP_INDEX(24)) - .dot(1) - .buildAndChain(onElementPass(x -> ++x.mCasing, ofBlock(ModBlocks.blockCasings2Misc, 8)))) - .addElement( - 'B', - buildHatchAdder(GregtechMetaTileEntity_PowerSubStationController.class) - .atLeast(Energy.or(TTEnergy), Dynamo.or(TTDynamo), Maintenance) - .disallowOnly(ForgeDirection.UP) - .casingIndex(TAE.GTPP_INDEX(24)) - .dot(1) - .buildAndChain(onElementPass(x -> ++x.mCasing, ofBlock(ModBlocks.blockCasings2Misc, 8)))) - .addElement( - 'T', - buildHatchAdder(GregtechMetaTileEntity_PowerSubStationController.class) - .atLeast(Energy.or(TTEnergy), Dynamo.or(TTDynamo), Maintenance) - .disallowOnly(ForgeDirection.DOWN) - .casingIndex(TAE.GTPP_INDEX(24)) - .dot(1) - .buildAndChain(onElementPass(x -> ++x.mCasing, ofBlock(ModBlocks.blockCasings2Misc, 8)))) - .addElement( - 'I', - withChannel( - "cell", - ofChain( - onlyIf( - x -> x.topState != TopState.NotTop, - onElementPass( - x -> x.topState = TopState.Top, - ofHatchAdderOptional( - GregtechMetaTileEntity_PowerSubStationController::addPowerSubStationList, - TAE.GTPP_INDEX(24), - 1, - ModBlocks.blockCasings2Misc, - 8))), - onlyIf( - x -> x.topState != TopState.Top, - onElementPass( - x -> x.topState = TopState.NotTop, - ofChain( - onElementPass(x -> ++x.cellCount[0], ofCell(4)), - onElementPass(x -> ++x.cellCount[1], ofCell(5)), - onElementPass(x -> ++x.cellCount[2], ofCell(6)), - onElementPass(x -> ++x.cellCount[3], ofCell(7)), - onElementPass(x -> ++x.cellCount[4], ofCell(8)), - onElementPass(x -> ++x.cellCount[5], ofCell(9)))))))) - .addElement('H', ofCell(4)) - .build(); - } - return STRUCTURE_DEFINITION; - } - - public static <T> IStructureElement<T> ofCell(int aIndex) { - return new IStructureElement<T>() { - - @Override - public boolean check(T t, World world, int x, int y, int z) { - Block block = world.getBlock(x, y, z); - int meta = world.getBlockMetadata(x, y, z); - int tier = getCellTier(block, meta); - return aIndex == tier; - } - - public int getIndex(int size) { - if (size > 6) size = 6; - return size + 3; - } - - @Override - public boolean spawnHint(T t, World world, int x, int y, int z, ItemStack trigger) { - StructureLibAPI.hintParticle( - world, - x, - y, - z, - getBlockFromTier(getIndex(trigger.stackSize)), - getMetaFromTier(getIndex(trigger.stackSize))); - return true; - } - - @Override - public boolean placeBlock(T t, World world, int x, int y, int z, ItemStack trigger) { - return world.setBlock( - x, - y, - z, - getBlockFromTier(getIndex(trigger.stackSize)), - getMetaFromTier(getIndex(trigger.stackSize)), - 3); - } - - @Nullable - @Override - public BlocksToPlace getBlocksToPlace(T t, World world, int x, int y, int z, ItemStack trigger, - AutoPlaceEnvironment env) { - return BlocksToPlace.create(getBlockFromTier(trigger.stackSize), getMetaFromTier(trigger.stackSize)); - } - - @Override - public PlaceResult survivalPlaceBlock(T t, World world, int x, int y, int z, ItemStack trigger, - AutoPlaceEnvironment env) { - Block block = world.getBlock(x, y, z); - int meta = world.getBlockMetadata(x, y, z); - int tier = getCellTier(block, meta); - if (tier >= 0) return PlaceResult.SKIP; - return StructureUtility.survivalPlaceBlock( - getBlockFromTier(getIndex(trigger.stackSize)), - getMetaFromTier(getIndex(trigger.stackSize)), - world, - x, - y, - z, - env.getSource(), - env.getActor(), - env.getChatter()); - } - }; - } - - @Override - public void construct(ItemStack stackSize, boolean hintsOnly) { - int layer = Math.min(stackSize.stackSize + 3, 18); - log("Layer: " + layer); - log("Building 0"); - buildPiece(mName + "bottom", stackSize, hintsOnly, 2, 0, 0); - log("Built 0"); - for (int i = 1; i < layer - 1; i++) { - log("Building " + i); - buildPiece(mName + "mid", stackSize, hintsOnly, 2, i, 0); - log("Built " + i); - } - log("Building " + (layer - 1)); - buildPiece(mName + "top", stackSize, hintsOnly, 2, layer - 1, 0); - log("Built " + (layer - 1)); - } - - @Override - public int survivalConstruct(ItemStack stackSize, int elementBudget, ISurvivalBuildEnvironment env) { - if (mMachine) return -1; - int layer = Math.min(ChannelDataAccessor.getChannelData(stackSize, "height") + 3, 18); - int built; - built = survivialBuildPiece(mName + "bottom", stackSize, 2, 0, 0, elementBudget, env, false, true); - if (built >= 0) return built; - for (int i = 1; i < layer - 1; i++) { - built = survivialBuildPiece(mName + "mid", stackSize, 2, i, 0, elementBudget, env, false, true); - if (built >= 0) return built; - } - return survivialBuildPiece(mName + "top", stackSize, 2, layer - 1, 0, elementBudget, env, false, true); - } - - @Override - public boolean checkMachine(IGregTechTileEntity aBaseMetaTileEntity, ItemStack aStack) { - mCasing = 0; - mEnergyHatches.clear(); - mDynamoHatches.clear(); - mTecTechEnergyHatches.clear(); - mTecTechDynamoHatches.clear(); - mAllEnergyHatches.clear(); - mAllDynamoHatches.clear(); - for (int i = 0; i < 6; i++) { - cellCount[i] = 0; - } - log("Checking 0"); - if (!checkPiece(mName + "bottom", 2, 0, 0)) { - log("Failed on Layer 0"); - return false; - } - log("Pass 0"); - int layer = 1; - topState = TopState.MayBeTop; - while (true) { - if (!checkPiece(mName + "layer", 2, layer, 0)) return false; - layer++; - if (topState == TopState.Top) break; // top found, break out - topState = TopState.MayBeTop; - if (layer > 18) return false; // too many layers - } - int level = 0; - for (int i = 0; i < 6; i++) { - if (cellCount[i] != 0) { - if (level == 0) { - level = i + 4; - } else { - return false; - } - } - } - int tier = getMaxHatchTier(level); - long volSum = 0; - for (GT_MetaTileEntity_Hatch hatch : mAllDynamoHatches) { - if (hatch.mTier > tier || hatch.mTier < 3) { - return false; - } - volSum += (8L << (hatch.mTier * 2)); - } - for (GT_MetaTileEntity_Hatch hatch : mAllEnergyHatches) { - if (hatch.mTier > tier || hatch.mTier < 3) { - return false; - } - volSum += (8L << (hatch.mTier * 2)); - } - mBatteryCapacity = getCapacityFromCellTier(level) * cellCount[level - 4]; - if (mAllEnergyHatches.size() + mAllDynamoHatches.size() > 0) { - mAverageEuUsage = volSum / (mAllEnergyHatches.size() + mAllDynamoHatches.size()); - } else mAverageEuUsage = 0; - fixAllMaintenanceIssue(); - return true; - } - - public final boolean addPowerSubStationList(IGregTechTileEntity aTileEntity, int aBaseCasingIndex) { - if (aTileEntity == null) { - return false; - } else { - IMetaTileEntity aMetaTileEntity = aTileEntity.getMetaTileEntity(); - if (aMetaTileEntity instanceof GT_MetaTileEntity_Hatch_Energy) { - return addToMachineList(aTileEntity, aBaseCasingIndex); - } else if (aMetaTileEntity instanceof GT_MetaTileEntity_Hatch_Dynamo) { - return addToMachineList(aTileEntity, aBaseCasingIndex); - } else if (aMetaTileEntity instanceof GT_MetaTileEntity_Hatch_Maintenance) { - return addToMachineList(aTileEntity, aBaseCasingIndex); - } else if (TecTech.isModLoaded()) { - if (isThisHatchMultiDynamo(aMetaTileEntity)) { - return addToMachineList(aTileEntity, aBaseCasingIndex); - } else if (isThisHatchMultiEnergy(aMetaTileEntity)) { - return addToMachineList(aTileEntity, aBaseCasingIndex); - } - } - } - return false; - } - - // Define storage capacity of smallest cell tier (EV) and compute higher tiers from it - private static final long CELL_TIER_EV_CAPACITY = 100 * 1000 * 1000; - private static final long CELL_TIER_MULTIPLIER = 4; // each tier's capacity is this many times the previous tier - - public static long getCapacityFromCellTier(int aOverallCellTier) { - // Use integer math instead of `Math.pow` to avoid range/precision errors - if (aOverallCellTier < 4) return 0; - aOverallCellTier -= 4; - long capacity = CELL_TIER_EV_CAPACITY; - while (aOverallCellTier > 0) { - capacity *= CELL_TIER_MULTIPLIER; - aOverallCellTier--; - } - return capacity; - } - - @Override - public int getMaxEfficiency(final ItemStack aStack) { - return 10000; - } - - @Override - public boolean explodesOnComponentBreak(final ItemStack aStack) { - return false; - } - - @Override - public IMetaTileEntity newMetaEntity(final IGregTechTileEntity aTileEntity) { - return new GregtechMetaTileEntity_PowerSubStationController(this.mName); - } - - // mTotalEnergyAdded - @Override - public void saveNBTData(NBTTagCompound aNBT) { - aNBT.setLong("mAverageEuUsage", this.mAverageEuUsage); - this.mAverageEuAdded.write(aNBT, "mAverageEuAdded"); - this.mAverageEuConsumed.write(aNBT, "mAverageEuConsumed"); - - // Usage Stats - aNBT.setLong("mTotalEnergyAdded", this.mTotalEnergyAdded); - aNBT.setLong("mTotalEnergyLost", this.mTotalEnergyLost); - aNBT.setLong("mTotalEnergyConsumed", this.mTotalEnergyConsumed); - aNBT.setLong("mTotalRunTime", this.mTotalRunTime); - aNBT.setBoolean("mIsOutputtingPower", this.mIsOutputtingPower); - aNBT.setLong("mBatteryCapacity", this.mBatteryCapacity); - super.saveNBTData(aNBT); - } - - @Override - public void loadNBTData(NBTTagCompound aNBT) { - - // Best not to get a long if the Tag Map is holding an int - if (aNBT.hasKey("mAverageEuUsage")) { - this.mAverageEuUsage = aNBT.getLong("mAverageEuUsage"); - } - switch (aNBT.func_150299_b("mAverageEuAdded")) { - case NBT.TAG_BYTE_ARRAY -> this.mAverageEuAdded.read(aNBT, "mAverageEuAdded"); - case NBT.TAG_LONG -> this.mAverageEuAdded.set(aNBT.getLong("mAverageEuAdded")); - } - switch (aNBT.func_150299_b("mAverageEuConsumed")) { - case NBT.TAG_BYTE_ARRAY -> this.mAverageEuConsumed.read(aNBT, "mAverageEuConsumed"); - case NBT.TAG_LONG -> this.mAverageEuConsumed.set(aNBT.getLong("mAverageEuConsumed")); - } - - // Usage Stats - this.mTotalEnergyAdded = aNBT.getLong("mTotalEnergyAdded"); - this.mTotalEnergyLost = aNBT.getLong("mTotalEnergyLost"); - this.mTotalEnergyConsumed = aNBT.getLong("mTotalEnergyConsumed"); - this.mTotalRunTime = aNBT.getLong("mTotalRunTime"); - - this.mIsOutputtingPower = aNBT.getBoolean("mIsOutputtingPower"); - - this.mBatteryCapacity = aNBT.getLong("mBatteryCapacity"); - - super.loadNBTData(aNBT); - } - - @Override - public @NotNull CheckRecipeResult checkProcessing() { - this.mProgresstime = 0; - this.mMaxProgresstime = 200; - this.lEUt = 0; - this.mEfficiencyIncrease = 10000; - this.fixAllMaintenanceIssue(); - return SimpleCheckRecipeResult.ofSuccess("managing_power"); - } - - @Override - public int getMaxParallelRecipes() { - return 1; - } - - private long drawEnergyFromHatch(MetaTileEntity aHatch) { - long stored = aHatch.getEUVar(); - long voltage = aHatch.maxEUInput() * aHatch.maxAmperesIn(); - - if (voltage > stored || (voltage + this.getEUVar() > this.mBatteryCapacity)) { - return 0; - } - - if (this.getBaseMetaTileEntity() - .increaseStoredEnergyUnits(voltage, false)) { - aHatch.setEUVar((stored - voltage)); - this.mTotalEnergyAdded += voltage; - return voltage; - } - return 0; - } - - private long addEnergyToHatch(MetaTileEntity aHatch) { - long voltage = aHatch.maxEUOutput() * aHatch.maxAmperesOut(); - - if (aHatch.getEUVar() > aHatch.maxEUStore() - voltage) { - return 0; - } - - if (this.getBaseMetaTileEntity() - .decreaseStoredEnergyUnits(voltage, false)) { - aHatch.getBaseMetaTileEntity() - .increaseStoredEnergyUnits(voltage, false); - this.mTotalEnergyConsumed += voltage; - return voltage; - } - return 0; - } - - private long computeEnergyTax() { - float mTax = mAverageEuUsage * (ENERGY_TAX / 100f); - - // Increase tax up to 2x if machine is not fully repaired (does not actually work at the moment, mEfficiency is - // always 0) - // mTax = mTax * (1f + (10000f - mEfficiency) / 10000f); - - return MathUtils.roundToClosestLong(mTax); - } - - @Override - public void onPreTick(IGregTechTileEntity aBaseMetaTileEntity, long aTick) { - this.fixAllMaintenanceIssue(); - } - - @Override - public boolean onRunningTick(ItemStack aStack) { - // First, decay overcharge (1% of stored energy plus 1000 EU per tick) - if (this.getEUVar() > this.mBatteryCapacity) { - long energy = (long) (this.getEUVar() * 0.990f) - 1000; - this.setEUVar(energy); - } - - // Pay Tax - long mDecrease = computeEnergyTax(); - this.mTotalEnergyLost += Math.min(mDecrease, this.getEUVar()); - this.setEUVar(Math.max(0, this.getEUVar() - mDecrease)); - - long aInputAverage = 0; - long aOutputAverage = 0; - // Input Power - for (GT_MetaTileEntity_Hatch THatch : filterValidMTEs(this.mDischargeHatches)) { - aInputAverage += drawEnergyFromHatch(THatch); - } - for (GT_MetaTileEntity_Hatch tHatch : filterValidMTEs(this.mAllEnergyHatches)) { - aInputAverage += drawEnergyFromHatch(tHatch); - } - - // Output Power - for (GT_MetaTileEntity_Hatch THatch : filterValidMTEs(this.mChargeHatches)) { - aOutputAverage += addEnergyToHatch(THatch); - } - for (GT_MetaTileEntity_Hatch tHatch : filterValidMTEs(this.mAllDynamoHatches)) { - aOutputAverage += addEnergyToHatch(tHatch); - } - // reset progress time - mProgresstime = 0; - - this.mAverageEuAdded.sample(aInputAverage); - this.mAverageEuConsumed.sample(aOutputAverage); - - return true; - } - - @Override - public boolean drainEnergyInput(long aEU) { - // Not applicable to this machine - return true; - } - - @Override - public boolean addEnergyOutput(long aEU) { - // Not applicable to this machine - return true; - } - - @Override - public long maxEUStore() { - return mBatteryCapacity; - } - - @Override - public long getMinimumStoredEU() { - return 0; - } - - @Override - public String[] getExtraInfoData() { - String mode; - if (mIsOutputtingPower) { - mode = EnumChatFormatting.GOLD + "Output" + EnumChatFormatting.RESET; - } else { - mode = EnumChatFormatting.BLUE + "Input" + EnumChatFormatting.RESET; - } - - String storedEnergyText; - if (this.getEUVar() > this.mBatteryCapacity) { - storedEnergyText = EnumChatFormatting.RED + GT_Utility.formatNumbers(this.getEUVar()) - + EnumChatFormatting.RESET; - } else { - storedEnergyText = EnumChatFormatting.GREEN + GT_Utility.formatNumbers(this.getEUVar()) - + EnumChatFormatting.RESET; - } - - int errorCode = this.getBaseMetaTileEntity() - .getErrorDisplayID(); - boolean mMaint = (errorCode != 0); - - return new String[] { "Ergon Energy - District Sub-Station", "Stored EU: " + storedEnergyText, - "Capacity: " + EnumChatFormatting.YELLOW - + GT_Utility.formatNumbers(this.maxEUStore()) - + EnumChatFormatting.RESET, - "Running Costs: " + EnumChatFormatting.RED - + GT_Utility.formatNumbers(this.computeEnergyTax()) - + EnumChatFormatting.RESET - + " EU/t", - "Controller Mode: " + mode, - "Requires Maintenance: " + (!mMaint ? EnumChatFormatting.GREEN : EnumChatFormatting.RED) - + mMaint - + EnumChatFormatting.RESET - + " | Code: [" - + (!mMaint ? EnumChatFormatting.GREEN : EnumChatFormatting.RED) - + errorCode - + EnumChatFormatting.RESET - + "]", - "----------------------", "Stats for Nerds", - "Average Input: " + EnumChatFormatting.BLUE - + GT_Utility.formatNumbers(this.getAverageEuAdded()) - + EnumChatFormatting.RESET - + " EU", - "Average Output: " + EnumChatFormatting.GOLD - + GT_Utility.formatNumbers(this.getAverageEuConsumed()) - + EnumChatFormatting.RESET - + " EU", - "Total Input: " + EnumChatFormatting.BLUE - + GT_Utility.formatNumbers(this.mTotalEnergyAdded) - + EnumChatFormatting.RESET - + " EU", - "Total Output: " + EnumChatFormatting.GOLD - + GT_Utility.formatNumbers(this.mTotalEnergyConsumed) - + EnumChatFormatting.RESET - + " EU", - "Total Costs: " + EnumChatFormatting.RED - + GT_Utility.formatNumbers(this.mTotalEnergyLost) - + EnumChatFormatting.RESET - + " EU", }; - } - - @Override - public void explodeMultiblock() { - // TODO Auto-generated method stub - super.explodeMultiblock(); - } - - @Override - public void doExplosion(long aExplosionPower) { - // TODO Auto-generated method stub - super.doExplosion(aExplosionPower); - } - - @Override - public long getMaxInputVoltage() { - return 32768; - } - - @Override - public boolean isElectric() { - return true; - } - - @Override - public boolean isEnetInput() { - return !mIsOutputtingPower; - } - - @Override - public boolean isEnetOutput() { - return mIsOutputtingPower; - } - - @Override - public boolean isInputFacing(ForgeDirection side) { - return (side == this.getBaseMetaTileEntity() - .getBackFacing() && !mIsOutputtingPower); - } - - @Override - public boolean isOutputFacing(ForgeDirection side) { - return (side == this.getBaseMetaTileEntity() - .getBackFacing() && mIsOutputtingPower); - } - - @Override - public long maxAmperesIn() { - return 32; - } - - @Override - public long maxAmperesOut() { - return 32; - } - - @Override - public long maxEUInput() { - return 32768; - } - - @Override - public long maxEUOutput() { - return 32768; - } - - public final long getAverageEuAdded() { - return this.mAverageEuAdded.get(); - } - - public final long getAverageEuConsumed() { - return this.mAverageEuConsumed.get(); - } - - @Override - public void onModeChangeByScrewdriver(ForgeDirection side, EntityPlayer aPlayer, float aX, float aY, float aZ) { - mIsOutputtingPower = !mIsOutputtingPower; - if (mIsOutputtingPower) { - PlayerUtils.messagePlayer(aPlayer, "Sub-Station is now outputting power from the controller."); - } else { - PlayerUtils.messagePlayer(aPlayer, "Sub-Station is now inputting power into the controller."); - } - } - - @Override - public boolean doesBindPlayerInventory() { - return false; - } - - @Override - public int getGUIWidth() { - return 196; - } - - @Override - public int getGUIHeight() { - return 191; - } - - @Override - public void addGregTechLogo(ModularWindow.Builder builder) { - builder.widget( - new DrawableWidget().setDrawable(getGUITextureSet().getGregTechLogo()) - .setSize(17, 17) - .setPos(175, 166)); - } - - private long clientEUIn, clientEUOut, clientEULoss, clientEUStored; - private float clientProgress; - - protected static final NumberFormatMUI numberFormat = new NumberFormatMUI(); - - @Override - public void addUIWidgets(ModularWindow.Builder builder, UIBuildContext buildContext) { - builder.widget( - new DrawableWidget().setDrawable(GT_UITextures.PICTURE_SCREEN_BLACK) - .setPos(4, 4) - .setSize(149, 149)) - .widget(new SlotWidget(inventoryHandler, 0).setPos(154, 4)) - .widget( - new SlotWidget(inventoryHandler, 1).setAccess(true, false) - .setPos(154, 22)) - .widget( - SlotGroup.ofItemHandler(new PlayerMainInvWrapper(buildContext.getPlayer().inventory), 9) - .endAtSlot(8) - .build() - .setPos(7, 166)) - .widget( - TextWidget - .dynamicString( - () -> getBaseMetaTileEntity().getErrorDisplayID() == 0 - ? getBaseMetaTileEntity().isActive() ? "Running perfectly" : "Turn on with Mallet" - : "") - .setSynced(false) - .setDefaultColor(COLOR_TEXT_WHITE.get()) - .setPos(10, 8)) - .widget( - new FakeSyncWidget.BooleanSyncer( - () -> getBaseMetaTileEntity().isActive(), - val -> getBaseMetaTileEntity().setActive(val))) - .widget( - new FakeSyncWidget.IntegerSyncer( - () -> getBaseMetaTileEntity().getErrorDisplayID(), - val -> getBaseMetaTileEntity().setErrorDisplayID(val))) - .widget( - new TextWidget("In").setDefaultColor(COLOR_TEXT_WHITE.get()) - .setPos(178, 10)) - .widget( - new TextWidget("Out").setDefaultColor(COLOR_TEXT_WHITE.get()) - .setPos(176, 28)) - .widget(new FakeSyncWidget.LongSyncer(this::getAverageEuAdded, val -> clientEUIn = val)) - .widget( - new TextWidget().setStringSupplier(() -> "Avg In: " + numberFormat.format(clientEUIn) + " EU") - .setDefaultColor(COLOR_TEXT_WHITE.get()) - .setPos(10, 20)) - .widget(new FakeSyncWidget.LongSyncer(this::getAverageEuConsumed, val -> clientEUOut = val)) - .widget( - new TextWidget().setStringSupplier(() -> "Avg Out: " + numberFormat.format(clientEUOut) + " EU") - .setDefaultColor(COLOR_TEXT_WHITE.get()) - .setPos(10, 30)) - .widget(new FakeSyncWidget.LongSyncer(this::computeEnergyTax, val -> clientEULoss = val)) - .widget( - new TextWidget() - .setStringSupplier(() -> "Powerloss: " + numberFormat.format(clientEULoss) + " EU per tick") - .setDefaultColor(COLOR_TEXT_WHITE.get()) - .setPos(10, 40)) - .widget( - new DrawableWidget().setDrawable(GTPP_UITextures.PICTURE_ENERGY_FRAME) - .setPos(4, 155) - .setSize(149, 7)) - .widget(new FakeSyncWidget.FloatSyncer(this::getProgress, val -> clientProgress = val)) - .widget( - new ProgressBar().setProgress(this::getProgress) - .setTexture(GTPP_UITextures.PROGRESSBAR_PSS_ENERGY, 147) - .setDirection(ProgressBar.Direction.RIGHT) - .setPos(5, 156) - .setSize(147, 5)) - .widget( - new TextWidget("Stored:").setDefaultColor(COLOR_TEXT_WHITE.get()) - .setPos(10, 132)) - .widget( - new FakeSyncWidget.LongSyncer(() -> getBaseMetaTileEntity().getStoredEU(), val -> clientEUStored = val)) - .widget(new TextWidget().setTextSupplier(() -> { - int colorScale = (int) (clientProgress * 100 * 2.55); - return new Text(numberFormat.format(clientEUStored) + " EU") - .color(Utils.rgbtoHexValue((255 - colorScale), colorScale, 0)); - }) - .setPos(10, 142)) - .widget( - new TextWidget().setStringSupplier(() -> numberFormat.format(clientProgress * 100) + "%") - .setDefaultColor(COLOR_TEXT_WHITE.get()) - .setPos(70, 155)); - } - - private float getProgress() { - return (float) getBaseMetaTileEntity().getStoredEU() / getBaseMetaTileEntity().getEUCapacity(); - } -} diff --git a/gtpp/src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/misc/TileEntitySolarHeater.java b/gtpp/src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/misc/TileEntitySolarHeater.java deleted file mode 100644 index 141f4bbc43..0000000000 --- a/gtpp/src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/misc/TileEntitySolarHeater.java +++ /dev/null @@ -1,343 +0,0 @@ -package gtPlusPlus.xmod.gregtech.common.tileentities.misc; - -import net.minecraft.entity.player.EntityPlayer; -import net.minecraft.item.ItemStack; -import net.minecraft.nbt.NBTTagCompound; -import net.minecraftforge.common.util.ForgeDirection; - -import org.apache.commons.lang3.ArrayUtils; - -import gregtech.api.enums.Textures; -import gregtech.api.interfaces.ITexture; -import gregtech.api.interfaces.metatileentity.IMetaTileEntity; -import gregtech.api.interfaces.tileentity.IGregTechTileEntity; -import gregtech.api.metatileentity.implementations.GT_MetaTileEntity_TieredMachineBlock; -import gregtech.api.objects.GT_ItemStack; -import gregtech.api.objects.GT_RenderedTexture; -import gtPlusPlus.core.lib.CORE; -import gtPlusPlus.xmod.gregtech.common.blocks.textures.TexturesGtBlock; -import gtPlusPlus.xmod.gregtech.common.tileentities.machines.multi.production.GregtechMetaTileEntity_SolarTower; - -public class TileEntitySolarHeater extends GT_MetaTileEntity_TieredMachineBlock { - - public boolean mHasTower = false; - private GregtechMetaTileEntity_SolarTower mTower = null; - - private int mTX, mTY, mTZ; - private Byte mRequiredFacing; - - public TileEntitySolarHeater(final int aID, final String aName, final String aNameRegional, final int aTier, - final String aDescription, final int aSlotCount) { - super(aID, aName, aNameRegional, aTier, aSlotCount, aDescription); - } - - public TileEntitySolarHeater(final String aName, final int aTier, final String[] aDescription, - final ITexture[][][] aTextures, final int aSlotCount) { - super(aName, aTier, aSlotCount, aDescription, aTextures); - } - - @Override - public String[] getDescription() { - return ArrayUtils.addAll(this.mDescriptionArray, "Point me at a Solar Tower", CORE.GT_Tooltip.get()); - } - - @Override - public ITexture[][][] getTextureSet(final ITexture[] aTextures) { - final ITexture[][][] rTextures = new ITexture[10][17][]; - for (byte i = -1; i < 16; i++) { - rTextures[0][i + 1] = this.getFront(i); - rTextures[1][i + 1] = this.getBack(i); - rTextures[2][i + 1] = this.getBottom(i); - rTextures[3][i + 1] = this.getTop(i); - rTextures[4][i + 1] = this.getSides(i); - rTextures[5][i + 1] = this.getFrontActive(i); - rTextures[6][i + 1] = this.getBackActive(i); - rTextures[7][i + 1] = this.getBottomActive(i); - rTextures[8][i + 1] = this.getTopActive(i); - rTextures[9][i + 1] = this.getSidesActive(i); - } - return rTextures; - } - - @Override - public ITexture[] getTexture(final IGregTechTileEntity aBaseMetaTileEntity, final ForgeDirection side, - final ForgeDirection facing, final int aColorIndex, final boolean aActive, final boolean aRedstone) { - return this.mTextures[(aActive ? 5 : 0) + (side == facing ? 0 - : side == facing.getOpposite() ? 1 - : side == ForgeDirection.DOWN ? 2 : side == ForgeDirection.UP ? 3 : 4)][aColorIndex + 1]; - } - - public ITexture[] getFront(final byte aColor) { - return new ITexture[] { new GT_RenderedTexture(TexturesGtBlock.Casing_Machine_Simple_Top), - new GT_RenderedTexture(Textures.BlockIcons.SOLARPANEL_IV) }; - } - - public ITexture[] getBack(final byte aColor) { - return new ITexture[] { new GT_RenderedTexture(TexturesGtBlock.Casing_Machine_Simple_Top) }; - } - - public ITexture[] getBottom(final byte aColor) { - return new ITexture[] { new GT_RenderedTexture(TexturesGtBlock.Casing_Machine_Simple_Bottom) }; - } - - public ITexture[] getTop(final byte aColor) { - return new ITexture[] { new GT_RenderedTexture(TexturesGtBlock.Casing_Machine_Simple_Top), - new GT_RenderedTexture(Textures.BlockIcons.SOLARPANEL_LuV) }; - } - - public ITexture[] getSides(final byte aColor) { - return new ITexture[] { new GT_RenderedTexture(TexturesGtBlock.Casing_Machine_Simple_Top), - new GT_RenderedTexture(Textures.BlockIcons.SOLARPANEL_IV) }; - } - - public ITexture[] getFrontActive(final byte aColor) { - return new ITexture[] { new GT_RenderedTexture(TexturesGtBlock.Casing_Machine_Simple_Top), - new GT_RenderedTexture(Textures.BlockIcons.SOLARPANEL_IV) }; - } - - public ITexture[] getBackActive(final byte aColor) { - return new ITexture[] { new GT_RenderedTexture(TexturesGtBlock.Casing_Machine_Simple_Top) }; - } - - public ITexture[] getBottomActive(final byte aColor) { - return new ITexture[] { new GT_RenderedTexture(TexturesGtBlock.Casing_Machine_Simple_Bottom) }; - } - - public ITexture[] getTopActive(final byte aColor) { - return new ITexture[] { new GT_RenderedTexture(TexturesGtBlock.Casing_Machine_Simple_Top), - new GT_RenderedTexture(Textures.BlockIcons.SOLARPANEL_LuV) }; - } - - public ITexture[] getSidesActive(final byte aColor) { - return new ITexture[] { new GT_RenderedTexture(TexturesGtBlock.Casing_Machine_Simple_Top), - new GT_RenderedTexture(Textures.BlockIcons.SOLARPANEL_IV) }; - } - - @Override - public IMetaTileEntity newMetaEntity(final IGregTechTileEntity aTileEntity) { - return new TileEntitySolarHeater(this.mName, this.mTier, this.mDescriptionArray, this.mTextures, 0); - } - - @Override - public boolean allowPullStack(IGregTechTileEntity aBaseMetaTileEntity, int aIndex, ForgeDirection side, - ItemStack aStack) { - return false; - } - - @Override - public boolean allowPutStack(IGregTechTileEntity aBaseMetaTileEntity, int aIndex, ForgeDirection side, - ItemStack aStack) { - return false; - } - - @Override - public String[] getInfoData() { - return new String[] { this.getLocalName(), "Testificate" }; - } - - @Override - public boolean isGivingInformation() { - return true; - } - - @Override - public boolean isUseableByPlayer(final EntityPlayer p_70300_1_) { - return false; - } - - public boolean allowCoverOnSide(final byte aSide, final int aCoverID) { - return false; - } - - @Override - public int[] getAccessibleSlotsFromSide(final int p_94128_1_) { - return new int[] {}; - } - - @Override - public int getSizeInventory() { - return 0; - } - - @Override - public ItemStack getStackInSlot(final int p_70301_1_) { - return null; - } - - @Override - public long maxEUStore() { - return 0; - } - - @Override - public int getCapacity() { - return 0; - } - - @Override - public long maxEUInput() { - return 0; - } - - @Override - public long maxEUOutput() { - return 0; - } - - @Override - public long maxAmperesIn() { - return 0; - } - - @Override - public long maxAmperesOut() { - return 0; - } - - @Override - public boolean isElectric() { - return false; - } - - @Override - public boolean isValidSlot(final int aIndex) { - return false; - } - - @Override - public boolean isFacingValid(final ForgeDirection facing) { - return facing.offsetY == 0; - } - - @Override - public boolean isEnetInput() { - return false; - } - - @Override - public boolean isEnetOutput() { - return false; - } - - @Override - public void saveNBTData(NBTTagCompound aNBT) { - /* - * aNBT.setBoolean("mHasTower", mHasTower); if (this.mHasTower) { aNBT.setInteger("mTX", mTX); - * aNBT.setInteger("mTY", mTY); aNBT.setInteger("mTZ", mTZ); } - */ - } - - @Override - public void loadNBTData(NBTTagCompound aNBT) { - /* - * this.mHasTower = aNBT.getBoolean("mHasTower"); if (this.mHasTower) { if (aNBT.hasKey("mTX")) this.mTX = - * aNBT.getInteger("mTX"); if (aNBT.hasKey("mTY")) this.mTY = aNBT.getInteger("mTY"); if (aNBT.hasKey("mTZ")) - * this.mTZ = aNBT.getInteger("mTZ"); } - */ - } - - @Override - public long getInputTier() { - return 0; - } - - @Override - public long getOutputTier() { - return 0; - } - - @Override - public boolean allowCoverOnSide(ForgeDirection side, GT_ItemStack aStack) { - return false; - } - - @Override - public void onExplosion() {} - - public boolean hasSolarTower() { - return mHasTower; - } - - public GregtechMetaTileEntity_SolarTower getSolarTower() { - if (this.mHasTower) { - return mTower; - } - return null; - } - - public boolean canSeeSky() { - if (this.getBaseMetaTileEntity() - .getWorld() - .canBlockSeeTheSky( - this.getBaseMetaTileEntity() - .getXCoord(), - this.getBaseMetaTileEntity() - .getYCoord() + 1, - this.getBaseMetaTileEntity() - .getZCoord())) { - return true; - } - return false; - } - - public boolean setSolarTower(GregtechMetaTileEntity_SolarTower aTowerTile) { - if (!hasSolarTower()) { - this.mTX = aTowerTile.getBaseMetaTileEntity() - .getXCoord(); - this.mTY = (int) aTowerTile.getBaseMetaTileEntity() - .getYCoord(); - this.mTZ = aTowerTile.getBaseMetaTileEntity() - .getZCoord(); - this.mHasTower = true; - this.mTower = aTowerTile; - return true; - } - return false; - } - - public boolean clearSolarTower() { - if (mHasTower || mRequiredFacing != null || this.mTower != null) { - this.mTX = 0; - this.mTY = 0; - this.mTZ = 0; - this.mRequiredFacing = null; - this.mTower = null; - this.mHasTower = false; - return true; - } - return false; - } - - @Override - public void onPostTick(IGregTechTileEntity aBaseMetaTileEntity, long aTick) { - super.onPostTick(aBaseMetaTileEntity, aTick); - } - - @Override - public void onRemoval() { - super.onRemoval(); - } - - @Override - public boolean isOutputFacing(ForgeDirection side) { - return side.offsetY == 0; - } - - @Override - public boolean isInputFacing(ForgeDirection side) { - return false; - } - - @Override - public long getMinimumStoredEU() { - return 0; - } - - @Override - public void onFacingChange() { - super.onFacingChange(); - } - - @Override - public void doExplosion(long aExplosionPower) {} -} diff --git a/gtpp/src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/storage/GT_MetaTileEntity_TieredChest.java b/gtpp/src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/storage/GT_MetaTileEntity_TieredChest.java deleted file mode 100644 index 07a63a6ba4..0000000000 --- a/gtpp/src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/storage/GT_MetaTileEntity_TieredChest.java +++ /dev/null @@ -1,250 +0,0 @@ -package gtPlusPlus.xmod.gregtech.common.tileentities.storage; - -import net.minecraft.entity.player.EntityPlayer; -import net.minecraft.item.ItemStack; -import net.minecraft.nbt.NBTTagCompound; -import net.minecraftforge.common.util.ForgeDirection; - -import org.apache.commons.lang3.ArrayUtils; - -import com.gtnewhorizons.modularui.api.NumberFormatMUI; -import com.gtnewhorizons.modularui.api.screen.ModularWindow; -import com.gtnewhorizons.modularui.api.screen.UIBuildContext; -import com.gtnewhorizons.modularui.common.widget.DrawableWidget; -import com.gtnewhorizons.modularui.common.widget.SlotWidget; -import com.gtnewhorizons.modularui.common.widget.TextWidget; - -import gregtech.api.enums.Textures.BlockIcons; -import gregtech.api.gui.modularui.GT_UIInfos; -import gregtech.api.gui.modularui.GT_UITextures; -import gregtech.api.interfaces.ITexture; -import gregtech.api.interfaces.modularui.IAddUIWidgets; -import gregtech.api.interfaces.tileentity.IGregTechTileEntity; -import gregtech.api.metatileentity.MetaTileEntity; -import gregtech.api.metatileentity.implementations.GT_MetaTileEntity_TieredMachineBlock; -import gregtech.api.objects.GT_RenderedTexture; -import gregtech.api.util.GT_Utility; -import gtPlusPlus.core.lib.CORE; - -public class GT_MetaTileEntity_TieredChest extends GT_MetaTileEntity_TieredMachineBlock implements IAddUIWidgets { - - public int mItemCount = 0; - public ItemStack mItemStack = null; - private static final double mStorageFactor = (270000.0D / 16); - - public GT_MetaTileEntity_TieredChest(int aID, String aName, String aNameRegional, int aTier) { - super( - aID, - aName, - aNameRegional, - aTier, - 3, - "This Chest stores " + (int) (Math.pow(6.0D, (double) aTier) * mStorageFactor) + " Items", - new ITexture[0]); - } - - public GT_MetaTileEntity_TieredChest(String aName, int aTier, String[] aDescription, ITexture[][][] aTextures) { - super(aName, aTier, 3, aDescription, aTextures); - } - - @Override - public String[] getDescription() { - return ArrayUtils.add(this.mDescriptionArray, CORE.GT_Tooltip.get()); - } - - @Override - public boolean isSimpleMachine() { - return true; - } - - public boolean isFacingValid(ForgeDirection facing) { - return true; - } - - @Override - public boolean isAccessAllowed(EntityPlayer aPlayer) { - return true; - } - - @Override - public boolean isValidSlot(int aIndex) { - return true; - } - - @Override - public MetaTileEntity newMetaEntity(IGregTechTileEntity aTileEntity) { - return new GT_MetaTileEntity_TieredChest(this.mName, this.mTier, this.mDescriptionArray, this.mTextures); - } - - @Override - public boolean onRightclick(IGregTechTileEntity aBaseMetaTileEntity, EntityPlayer aPlayer) { - GT_UIInfos.openGTTileEntityUI(aBaseMetaTileEntity, aPlayer); - return true; - } - - @Override - public void onPostTick(IGregTechTileEntity aBaseMetaTileEntity, long aTimer) { - if (this.getBaseMetaTileEntity() - .isServerSide() - && this.getBaseMetaTileEntity() - .isAllowedToWork()) { - if (this.getItemCount() <= 0) { - this.mItemStack = null; - this.mItemCount = 0; - } - - if (this.mItemStack == null && this.mInventory[0] != null) { - this.mItemStack = this.mInventory[0].copy(); - } - - if (this.mInventory[0] != null && this.mItemCount < this.getMaxItemCount() - && GT_Utility.areStacksEqual(this.mInventory[0], this.mItemStack)) { - this.mItemCount += this.mInventory[0].stackSize; - if (this.mItemCount > this.getMaxItemCount()) { - this.mInventory[0].stackSize = this.mItemCount - this.getMaxItemCount(); - this.mItemCount = this.getMaxItemCount(); - } else { - this.mInventory[0] = null; - } - } - - if (this.mInventory[1] == null && this.mItemStack != null) { - this.mInventory[1] = this.mItemStack.copy(); - this.mInventory[1].stackSize = Math.min(this.mItemStack.getMaxStackSize(), this.mItemCount); - this.mItemCount -= this.mInventory[1].stackSize; - } else if (this.mItemCount > 0 && GT_Utility.areStacksEqual(this.mInventory[1], this.mItemStack) - && this.mInventory[1].getMaxStackSize() > this.mInventory[1].stackSize) { - int tmp = Math - .min(this.mItemCount, this.mInventory[1].getMaxStackSize() - this.mInventory[1].stackSize); - this.mInventory[1].stackSize += tmp; - this.mItemCount -= tmp; - } - - if (this.mItemStack != null) { - this.mInventory[2] = this.mItemStack.copy(); - this.mInventory[2].stackSize = Math.min(this.mItemStack.getMaxStackSize(), this.mItemCount); - } else { - this.mInventory[2] = null; - } - } - } - - private int getItemCount() { - return this.mItemCount; - } - - @Override - public void setItemCount(int aCount) { - this.mItemCount = aCount; - } - - @Override - public int getProgresstime() { - return this.mItemCount + (this.mInventory[0] == null ? 0 : this.mInventory[0].stackSize) - + (this.mInventory[1] == null ? 0 : this.mInventory[1].stackSize); - } - - @Override - public int maxProgresstime() { - return this.getMaxItemCount(); - } - - @Override - public int getMaxItemCount() { - return (int) (Math.pow(6.0D, (double) this.mTier) * mStorageFactor - 128.0D); - } - - public boolean allowPullStack(IGregTechTileEntity aBaseMetaTileEntity, int aIndex, ForgeDirection side, - ItemStack aStack) { - return aIndex == 1; - } - - public boolean allowPutStack(IGregTechTileEntity aBaseMetaTileEntity, int aIndex, ForgeDirection side, - ItemStack aStack) { - return aIndex == 0 && (this.mInventory[0] == null || GT_Utility.areStacksEqual(this.mInventory[0], aStack)); - } - - @Override - public String[] getInfoData() { - return this.mItemStack == null - ? new String[] { "Super Storage Chest", "Stored Items:", "No Items", Integer.toString(0), - Integer.toString(this.getMaxItemCount()) } - : new String[] { "Super Storage Chest", "Stored Items:", this.mItemStack.getDisplayName(), - Integer.toString(this.mItemCount), Integer.toString(this.getMaxItemCount()) }; - } - - @Override - public boolean isGivingInformation() { - return true; - } - - @Override - public void saveNBTData(NBTTagCompound aNBT) { - aNBT.setInteger("mItemCount", this.mItemCount); - if (this.mItemStack != null) { - aNBT.setTag("mItemStack", this.mItemStack.writeToNBT(new NBTTagCompound())); - } - } - - @Override - public void loadNBTData(NBTTagCompound aNBT) { - if (aNBT.hasKey("mItemCount")) { - this.mItemCount = aNBT.getInteger("mItemCount"); - } - - if (aNBT.hasKey("mItemStack")) { - this.mItemStack = ItemStack.loadItemStackFromNBT((NBTTagCompound) aNBT.getTag("mItemStack")); - } - } - - public ITexture[] getTexture(IGregTechTileEntity aBaseMetaTileEntity, ForgeDirection side, ForgeDirection facing, - int aColorIndex, boolean aActive, boolean aRedstone) { - return aBaseMetaTileEntity.getFrontFacing() == ForgeDirection.DOWN && side == ForgeDirection.WEST - ? new ITexture[] { BlockIcons.MACHINE_CASINGS[this.mTier][aColorIndex + 1], - new GT_RenderedTexture(BlockIcons.OVERLAY_QCHEST) } - : (side == aBaseMetaTileEntity.getFrontFacing() - ? new ITexture[] { BlockIcons.MACHINE_CASINGS[this.mTier][aColorIndex + 1], - new GT_RenderedTexture(BlockIcons.OVERLAY_QCHEST) } - : new ITexture[] { BlockIcons.MACHINE_CASINGS[this.mTier][aColorIndex + 1] }); - } - - @Override - public ITexture[][][] getTextureSet(ITexture[] aTextures) { - return new ITexture[0][0][0]; - } - - @Override - public boolean useModularUI() { - return true; - } - - protected static final NumberFormatMUI numberFormat = new NumberFormatMUI(); - - @Override - public void addUIWidgets(ModularWindow.Builder builder, UIBuildContext buildContext) { - builder.widget( - new DrawableWidget().setDrawable(GT_UITextures.PICTURE_SCREEN_BLACK) - .setPos(7, 16) - .setSize(71, 45)) - .widget( - new SlotWidget(inventoryHandler, 0) - .setBackground(getGUITextureSet().getItemSlot(), GT_UITextures.OVERLAY_SLOT_IN) - .setPos(79, 16)) - .widget( - new SlotWidget(inventoryHandler, 1).setAccess(true, false) - .setBackground(getGUITextureSet().getItemSlot(), GT_UITextures.OVERLAY_SLOT_OUT) - .setPos(79, 52)) - .widget( - SlotWidget.phantom(inventoryHandler, 2) - .disableInteraction() - .setBackground(GT_UITextures.TRANSPARENT) - .setPos(59, 42)) - .widget( - new TextWidget("Item Amount").setDefaultColor(COLOR_TEXT_WHITE.get()) - .setPos(10, 20)) - .widget( - new TextWidget().setStringSupplier(() -> numberFormat.format(mItemCount)) - .setDefaultColor(COLOR_TEXT_WHITE.get()) - .setPos(10, 30)); - } -} diff --git a/gtpp/src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/storage/GT_MetaTileEntity_TieredTank.java b/gtpp/src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/storage/GT_MetaTileEntity_TieredTank.java deleted file mode 100644 index a9fc7a3fd4..0000000000 --- a/gtpp/src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/storage/GT_MetaTileEntity_TieredTank.java +++ /dev/null @@ -1,194 +0,0 @@ -package gtPlusPlus.xmod.gregtech.common.tileentities.storage; - -import java.util.ArrayList; -import java.util.Arrays; -import java.util.List; - -import net.minecraft.entity.player.EntityPlayer; -import net.minecraft.item.ItemStack; -import net.minecraft.nbt.NBTTagCompound; -import net.minecraft.util.EnumChatFormatting; -import net.minecraftforge.common.util.ForgeDirection; -import net.minecraftforge.fluids.FluidStack; - -import gregtech.api.GregTech_API; -import gregtech.api.enums.GT_Values; -import gregtech.api.enums.Textures; -import gregtech.api.gui.modularui.GT_UIInfos; -import gregtech.api.interfaces.ITexture; -import gregtech.api.interfaces.tileentity.IGregTechTileEntity; -import gregtech.api.metatileentity.MetaTileEntity; -import gregtech.api.metatileentity.implementations.GT_MetaTileEntity_BasicTank; -import gregtech.api.objects.GT_RenderedTexture; -import gregtech.api.util.GT_LanguageManager; -import gregtech.api.util.GT_Utility; -import gtPlusPlus.api.objects.Logger; -import gtPlusPlus.core.lib.CORE; - -public class GT_MetaTileEntity_TieredTank extends GT_MetaTileEntity_BasicTank { - - public GT_MetaTileEntity_TieredTank(final int aID, final String aName, final String aNameRegional, - final int aTier) { - super( - aID, - aName, - aNameRegional, - aTier, - 3, - "Stores " + GT_Utility.formatNumbers(((int) (Math.pow(2, aTier) * 32000))) + "L of fluid"); - } - - public GT_MetaTileEntity_TieredTank(final String aName, final int aTier, final String[] aDescription, - final ITexture[][][] aTextures) { - super(aName, aTier, 3, aDescription, aTextures); - } - - @Override - public String[] getDescription() { - List<String> description = new ArrayList<>(Arrays.asList(this.mDescriptionArray)); - description.add("A portable tank."); - if (this.mFluid != null) { - description.add("Fluid: " + mFluid.getLocalizedName() + " " + mFluid.amount + "L"); - } - description.add(CORE.GT_Tooltip.get()); - return description.toArray(new String[0]); - } - - @Override - public ITexture[][][] getTextureSet(final ITexture[] aTextures) { - return new ITexture[0][0][0]; - } - - @Override - public ITexture[] getTexture(final IGregTechTileEntity aBaseMetaTileEntity, final ForgeDirection side, - final ForgeDirection facing, final int aColorIndex, final boolean aActive, final boolean aRedstone) { - return side == ForgeDirection.UP - ? new ITexture[] { Textures.BlockIcons.MACHINE_CASINGS[this.mTier][aColorIndex + 1], - new GT_RenderedTexture(Textures.BlockIcons.OVERLAY_SIDE_POTIONBREWER_ACTIVE) } - : new ITexture[] { Textures.BlockIcons.MACHINE_CASINGS[this.mTier][aColorIndex + 1], - new GT_RenderedTexture(Textures.BlockIcons.OVERLAY_SIDE_POTIONBREWER) }; - } - - @Override - public void addAdditionalTooltipInformation(ItemStack stack, List<String> tooltip) { - if (stack.hasTagCompound() && stack.stackTagCompound.hasKey("mFluid")) { - final FluidStack tContents = FluidStack - .loadFluidStackFromNBT(stack.stackTagCompound.getCompoundTag("mFluid")); - if (tContents != null && tContents.amount > 0) { - tooltip.add( - GT_LanguageManager.addStringLocalization( - "TileEntity_TANK_INFO", - "Contains Fluid: ", - !GregTech_API.sPostloadFinished) + EnumChatFormatting.YELLOW - + tContents.getLocalizedName() - + EnumChatFormatting.GRAY); - tooltip.add( - GT_LanguageManager.addStringLocalization( - "TileEntity_TANK_AMOUNT", - "Fluid Amount: ", - !GregTech_API.sPostloadFinished) + EnumChatFormatting.GREEN - + GT_Utility.formatNumbers(tContents.amount) - + " L" - + EnumChatFormatting.GRAY); - } - } - } - - @Override - public boolean isSimpleMachine() { - return true; - } - - @Override - public boolean isFacingValid(final ForgeDirection facing) { - return true; - } - - @Override - public boolean isAccessAllowed(final EntityPlayer aPlayer) { - return true; - } - - @Override - public final byte getUpdateData() { - return 0x00; - } - - @Override - public boolean doesFillContainers() { - return true; - } - - @Override - public boolean doesEmptyContainers() { - return true; - } - - @Override - public boolean canTankBeFilled() { - return true; - } - - @Override - public boolean canTankBeEmptied() { - return true; - } - - @Override - public String[] getInfoData() { - - if (this.mFluid == null) { - return new String[] { GT_Values.VOLTAGE_NAMES[this.mTier] + " Fluid Tank", "Stored Fluid:", "No Fluid", - 0 + "L", this.getCapacity() + "L" }; - } - return new String[] { GT_Values.VOLTAGE_NAMES[this.mTier] + " Fluid Tank", "Stored Fluid:", - this.mFluid.getLocalizedName(), this.mFluid.amount + "L", this.getCapacity() + "L" }; - } - - @Override - public MetaTileEntity newMetaEntity(final IGregTechTileEntity aTileEntity) { - return new GT_MetaTileEntity_TieredTank(this.mName, this.mTier, this.mDescriptionArray, this.mTextures); - } - - @Override - public int getCapacity() { - return (int) (Math.pow(2, this.mTier) * 32000); - } - - @Override - public int getTankPressure() { - return 100; - } - - @Override - public boolean onRightclick(final IGregTechTileEntity aBaseMetaTileEntity, final EntityPlayer aPlayer) { - GT_UIInfos.openGTTileEntityUI(aBaseMetaTileEntity, aPlayer); - return true; - } - - @Override - public boolean displaysItemStack() { - return true; - } - - @Override - public boolean displaysStackSize() { - return false; - } - - @Override - public void setItemNBT(NBTTagCompound aNBT) { - if (mFluid != null) { - Logger.WARNING("Setting item fluid nbt"); - aNBT.setTag("mFluid", mFluid.writeToNBT(new NBTTagCompound())); - if (aNBT.hasKey("mFluid")) { - Logger.WARNING("Set mFluid to NBT."); - } - } - } - - @Override - public boolean useModularUI() { - return true; - } -} diff --git a/gtpp/src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/storage/GregtechMetaEnergyBuffer.java b/gtpp/src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/storage/GregtechMetaEnergyBuffer.java deleted file mode 100644 index 17b2d77756..0000000000 --- a/gtpp/src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/storage/GregtechMetaEnergyBuffer.java +++ /dev/null @@ -1,439 +0,0 @@ -package gtPlusPlus.xmod.gregtech.common.tileentities.storage; - -import static gregtech.api.enums.GT_Values.V; - -import net.minecraft.entity.player.EntityPlayer; -import net.minecraft.item.ItemStack; -import net.minecraft.nbt.NBTTagCompound; -import net.minecraft.world.World; -import net.minecraftforge.common.util.ForgeDirection; - -import gregtech.api.enums.Textures; -import gregtech.api.interfaces.ITexture; -import gregtech.api.interfaces.metatileentity.IMetaTileEntity; -import gregtech.api.interfaces.tileentity.IGregTechTileEntity; -import gregtech.api.objects.GT_ItemStack; -import gregtech.api.objects.GT_RenderedTexture; -import gregtech.api.util.GT_Utility; -import gtPlusPlus.api.objects.Logger; -import gtPlusPlus.core.lib.CORE; -import gtPlusPlus.core.util.minecraft.PlayerUtils; -import gtPlusPlus.xmod.gregtech.api.metatileentity.implementations.base.GregtechMetaTileEntity; -import gtPlusPlus.xmod.gregtech.common.blocks.textures.TexturesGtBlock; - -public class GregtechMetaEnergyBuffer extends GregtechMetaTileEntity { - - protected byte aCurrentOutputAmperage = 4; - - public GregtechMetaEnergyBuffer(final int aID, final String aName, final String aNameRegional, final int aTier, - final String aDescription, final int aSlotCount) { - super(aID, aName, aNameRegional, aTier, aSlotCount, aDescription); - } - - public GregtechMetaEnergyBuffer(final String aName, final int aTier, final String aDescription, - final ITexture[][][] aTextures, final int aSlotCount) { - super(aName, aTier, aSlotCount, aDescription, aTextures); - } - - @Override - public String[] getDescription() { - return new String[] { this.mDescription, "Defaults 4A In/Out", "Change output Amperage with a screwdriver", - "Now Portable!", CORE.GT_Tooltip.get() }; - } - - @Override - public boolean allowCoverOnSide(ForgeDirection side, GT_ItemStack aCover) { - if (side != this.getBaseMetaTileEntity() - .getFrontFacing()) { - return true; - } - return super.allowCoverOnSide(side, aCover); - } - - /* - * MACHINE_STEEL_SIDE - */ - - @Override - public ITexture[][][] getTextureSet(final ITexture[] aTextures) { - final ITexture[][][] rTextures = new ITexture[10][17][]; - for (byte i = -1; i < 16; i++) { - rTextures[0][i + 1] = this.getFront(i); - rTextures[1][i + 1] = this.getBack(i); - rTextures[2][i + 1] = this.getBottom(i); - rTextures[3][i + 1] = this.getTop(i); - rTextures[4][i + 1] = this.getSides(i); - rTextures[5][i + 1] = this.getFrontActive(i); - rTextures[6][i + 1] = this.getBackActive(i); - rTextures[7][i + 1] = this.getBottomActive(i); - rTextures[8][i + 1] = this.getTopActive(i); - rTextures[9][i + 1] = this.getSidesActive(i); - } - return rTextures; - } - - @Override - public ITexture[] getTexture(final IGregTechTileEntity aBaseMetaTileEntity, final ForgeDirection side, - final ForgeDirection facing, final int aColorIndex, final boolean aActive, final boolean aRedstone) { - return this.mTextures[(aActive ? 5 : 0) + (side == facing ? 0 - : side == facing.getOpposite() ? 1 - : side == ForgeDirection.DOWN ? 2 : side == ForgeDirection.UP ? 3 : 4)][aColorIndex + 1]; - } - - public ITexture[] getFront(final byte aColor) { - return new ITexture[] { Textures.BlockIcons.MACHINE_CASINGS[this.mTier][aColor + 1], - Textures.BlockIcons.OVERLAYS_ENERGY_OUT_MULTI[this.mTier] }; - } - - public ITexture[] getBack(final byte aColor) { - return new ITexture[] { Textures.BlockIcons.MACHINE_CASINGS[this.mTier][aColor + 1], - new GT_RenderedTexture(TexturesGtBlock.Overlay_Machine_Dimensional_Orange) }; - } - - public ITexture[] getBottom(final byte aColor) { - return new ITexture[] { Textures.BlockIcons.MACHINE_CASINGS[this.mTier][aColor + 1], - new GT_RenderedTexture(TexturesGtBlock.Overlay_Machine_Dimensional_Orange) }; - } - - public ITexture[] getTop(final byte aColor) { - return new ITexture[] { Textures.BlockIcons.MACHINE_CASINGS[this.mTier][aColor + 1], - new GT_RenderedTexture(TexturesGtBlock.Overlay_Machine_Screen_Logo) }; - } - - public ITexture[] getSides(final byte aColor) { - return new ITexture[] { Textures.BlockIcons.MACHINE_CASINGS[this.mTier][aColor + 1], - new GT_RenderedTexture(TexturesGtBlock.Overlay_Machine_Dimensional_Orange) }; - } - - public ITexture[] getFrontActive(final byte aColor) { - return new ITexture[] { Textures.BlockIcons.MACHINE_CASINGS[this.mTier][aColor + 1], - Textures.BlockIcons.OVERLAYS_ENERGY_OUT_MULTI[this.mTier] }; - } - - public ITexture[] getBackActive(final byte aColor) { - return new ITexture[] { Textures.BlockIcons.MACHINE_CASINGS[this.mTier][aColor + 1], - new GT_RenderedTexture(TexturesGtBlock.Overlay_Machine_Dimensional_Orange) }; - } - - public ITexture[] getBottomActive(final byte aColor) { - return new ITexture[] { Textures.BlockIcons.MACHINE_CASINGS[this.mTier][aColor + 1], - new GT_RenderedTexture(TexturesGtBlock.Overlay_Machine_Dimensional_Orange) }; - } - - public ITexture[] getTopActive(final byte aColor) { - return new ITexture[] { Textures.BlockIcons.MACHINE_CASINGS[this.mTier][aColor + 1], - new GT_RenderedTexture(TexturesGtBlock.Overlay_Machine_Screen_Logo) }; - } - - public ITexture[] getSidesActive(final byte aColor) { - return new ITexture[] { Textures.BlockIcons.MACHINE_CASINGS[this.mTier][aColor + 1], - new GT_RenderedTexture(TexturesGtBlock.Overlay_Machine_Dimensional_Orange) }; - } - - @Override - public IMetaTileEntity newMetaEntity(final IGregTechTileEntity aTileEntity) { - return new GregtechMetaEnergyBuffer( - this.mName, - this.mTier, - this.mDescription, - this.mTextures, - this.mInventory.length); - } - - @Override - public boolean isSimpleMachine() { - return false; - } - - @Override - public boolean isElectric() { - return true; - } - - @Override - public boolean isValidSlot(final int aIndex) { - return true; - } - - @Override - public boolean isFacingValid(final ForgeDirection facing) { - return true; - } - - @Override - public boolean isEnetInput() { - return true; - } - - @Override - public boolean isEnetOutput() { - return true; - } - - @Override - public boolean isInputFacing(final ForgeDirection side) { - return side != this.getBaseMetaTileEntity() - .getFrontFacing(); - } - - @Override - public boolean isOutputFacing(final ForgeDirection side) { - return side == this.getBaseMetaTileEntity() - .getFrontFacing(); - } - - @Override - public boolean isTeleporterCompatible() { - return false; - } - - @Override - public long getMinimumStoredEU() { - return V[this.mTier] * 2; - } - - @Override - public long maxEUStore() { - return V[this.mTier] * 250000; - } - - @Override - public long maxEUInput() { - return V[this.mTier]; - } - - @Override - public long maxEUOutput() { - return V[this.mTier]; - } - - @Override - public long maxAmperesIn() { - return aCurrentOutputAmperage; - } - - @Override - public long maxAmperesOut() { - return aCurrentOutputAmperage; - } - - @Override - public int rechargerSlotStartIndex() { - return 0; - } - - @Override - public int dechargerSlotStartIndex() { - return 0; - } - - @Override - public int rechargerSlotCount() { - return 0; - } - - @Override - public int dechargerSlotCount() { - return 0; - } - - @Override - public int getProgresstime() { - return (int) this.getBaseMetaTileEntity() - .getUniversalEnergyStored(); - } - - @Override - public int maxProgresstime() { - return (int) this.getBaseMetaTileEntity() - .getUniversalEnergyCapacity(); - } - - @Override - public boolean isAccessAllowed(final EntityPlayer aPlayer) { - return true; - } - - @Override - public void saveNBTData(final NBTTagCompound aNBT) { - aNBT.setByte("aCurrentOutputAmperage", aCurrentOutputAmperage); - long aEU = this.getBaseMetaTileEntity() - .getStoredEU(); - if (aEU > 0) { - aNBT.setLong("aStoredEU", aEU); - if (aNBT.hasKey("aStoredEU")) { - Logger.WARNING("Set aStoredEU to NBT."); - } - } - } - - @Override - public void loadNBTData(final NBTTagCompound aNBT) { - aCurrentOutputAmperage = aNBT.getByte("aCurrentOutputAmperage"); - if (aNBT.hasKey("aStoredEU")) { - this.setEUVar(aNBT.getLong("aStoredEU")); - } - } - - @Override - public boolean onRightclick(final IGregTechTileEntity aBaseMetaTileEntity, final EntityPlayer aPlayer) { - Logger.WARNING("Right Click on MTE by Player"); - if (aBaseMetaTileEntity.isClientSide()) { - return true; - } - - Logger.WARNING("MTE is Client-side"); - this.showEnergy(aPlayer.getEntityWorld(), aPlayer); - return true; - } - - protected void showEnergy(final World worldIn, final EntityPlayer playerIn) { - final long tempStorage = this.getBaseMetaTileEntity() - .getStoredEU(); - final double c = ((double) tempStorage / this.maxEUStore()) * 100; - final double roundOff = Math.round(c * 100.00) / 100.00; - PlayerUtils.messagePlayer( - playerIn, - "Energy: " + GT_Utility.formatNumbers(tempStorage) + " EU at " + V[this.mTier] + "v (" + roundOff + "%)"); - PlayerUtils.messagePlayer(playerIn, "Amperage: " + GT_Utility.formatNumbers(maxAmperesOut()) + "A"); - } - // Utils.LOG_WARNING("Begin Show Energy"); - /* - * //Utils.LOG_INFO("getProgresstime: "+tempStorage+" maxProgresstime: "+maxEUStore()+" C: "+c); - * Utils.LOG_INFO("getProgressTime: "+getProgresstime()); Utils.LOG_INFO("maxProgressTime: "+maxProgresstime()); - * Utils.LOG_INFO("getMinimumStoredEU: "+getMinimumStoredEU()); Utils.LOG_INFO("maxEUStore: "+maxEUStore()); - */ - /* - * final long d = (tempStorage * 100L) / maxEUStore(); - * Utils.LOG_INFO("getProgresstime: "+tempStorage+" maxProgresstime: "+maxEUStore()+" D: "+d); final double - * roundOff2 = Math.round(d * 100.00) / 100.00; Utils.messagePlayer(playerIn, "Energy: " + tempStorage + - * " EU at "+V[mTier]+"v ("+roundOff2+"%)"); Utils.LOG_WARNING("Making new instance of Guihandler"); GuiHandler - * block = new GuiHandler(); Utils.LOG_WARNING("Guihandler.toString(): "+block.toString()); - * block.getClientGuiElement(1, playerIn, worldIn, (int) playerIn.posX, (int) playerIn.posY, (int) playerIn.posZ); - */ - - @Override - public boolean allowPullStack(final IGregTechTileEntity aBaseMetaTileEntity, final int aIndex, - final ForgeDirection side, final ItemStack aStack) { - return false; - } - - @Override - public boolean allowPutStack(final IGregTechTileEntity aBaseMetaTileEntity, final int aIndex, - final ForgeDirection side, final ItemStack aStack) { - return false; - } - - @Override - public String[] getInfoData() { - String cur = GT_Utility.formatNumbers( - this.getBaseMetaTileEntity() - .getStoredEU()); - String max = GT_Utility.formatNumbers( - this.getBaseMetaTileEntity() - .getEUCapacity()); - - // Right-align current storage with maximum storage - String fmt = String.format("%%%ds", max.length()); - cur = String.format(fmt, cur); - - return new String[] { cur + " EU stored", max + " EU capacity" }; - } - - @Override - public boolean isGivingInformation() { - return true; - } - - @Override - public int[] getAccessibleSlotsFromSide(final int p_94128_1_) { - return new int[] {}; - } - - @Override - public boolean canInsertItem(final int p_102007_1_, final ItemStack p_102007_2_, final int p_102007_3_) { - return false; - } - - @Override - public boolean canExtractItem(final int p_102008_1_, final ItemStack p_102008_2_, final int p_102008_3_) { - return false; - } - - @Override - public int getSizeInventory() { - return 0; - } - - @Override - public ItemStack getStackInSlot(final int p_70301_1_) { - return null; - } - - @Override - public ItemStack decrStackSize(final int p_70298_1_, final int p_70298_2_) { - return null; - } - - @Override - public ItemStack getStackInSlotOnClosing(final int p_70304_1_) { - return null; - } - - @Override - public void setInventorySlotContents(final int p_70299_1_, final ItemStack p_70299_2_) {} - - @Override - public String getInventoryName() { - return super.getInventoryName(); - } - - @Override - public boolean hasCustomInventoryName() { - return false; - } - - @Override - public int getInventoryStackLimit() { - return 0; - } - - @Override - public boolean isUseableByPlayer(final EntityPlayer p_70300_1_) { - return false; - } - - @Override - public void openInventory() {} - - @Override - public void closeInventory() {} - - @Override - public boolean isItemValidForSlot(final int p_94041_1_, final ItemStack p_94041_2_) { - return false; - } - - @Override - public void setItemNBT(NBTTagCompound aNBT) { - aNBT.setByte("aCurrentOutputAmperage", aCurrentOutputAmperage); - long aEU = this.getBaseMetaTileEntity() - .getStoredEU(); - if (aEU > 0) { - aNBT.setLong("aStoredEU", aEU); - if (aNBT.hasKey("aStoredEU")) { - Logger.WARNING("Set aStoredEU to NBT."); - } - } - } - - @Override - public void onScrewdriverRightClick(ForgeDirection side, EntityPlayer aPlayer, float aX, float aY, float aZ) { - byte aTest = (byte) (aCurrentOutputAmperage + 1); - if (aTest > 16 || aTest <= 0) { - aTest = 1; - } - aCurrentOutputAmperage = aTest; - PlayerUtils.messagePlayer(aPlayer, "Now handling " + aCurrentOutputAmperage + " Amps."); - } -} diff --git a/gtpp/src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/storage/creative/GT_MetaTileEntity_InfiniteItemHolder.java b/gtpp/src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/storage/creative/GT_MetaTileEntity_InfiniteItemHolder.java deleted file mode 100644 index 2dca8d5c30..0000000000 --- a/gtpp/src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/storage/creative/GT_MetaTileEntity_InfiniteItemHolder.java +++ /dev/null @@ -1,92 +0,0 @@ -package gtPlusPlus.xmod.gregtech.common.tileentities.storage.creative; - -import net.minecraft.entity.player.EntityPlayer; -import net.minecraft.item.ItemStack; -import net.minecraftforge.common.util.ForgeDirection; - -import gregtech.api.interfaces.ITexture; -import gregtech.api.interfaces.tileentity.IGregTechTileEntity; -import gregtech.api.metatileentity.MetaTileEntity; -import gtPlusPlus.core.util.minecraft.PlayerUtils; -import gtPlusPlus.core.util.sys.KeyboardUtils; -import gtPlusPlus.xmod.gregtech.common.tileentities.storage.GT_MetaTileEntity_TieredChest; - -public class GT_MetaTileEntity_InfiniteItemHolder extends GT_MetaTileEntity_TieredChest { - - public GT_MetaTileEntity_InfiniteItemHolder(int aID, String aName, String aNameRegional, int aTier) { - super(aID, aName, aNameRegional, aTier); - } - - public GT_MetaTileEntity_InfiniteItemHolder(String aName, int aTier, String[] aDescription, - ITexture[][][] aTextures) { - super(aName, aTier, aDescription, aTextures); - } - - @Override - public boolean onRightclick(IGregTechTileEntity aBaseMetaTileEntity, EntityPlayer aPlayer) { - if (aBaseMetaTileEntity.getWorld().isRemote) { - return false; - } - - if (!KeyboardUtils.isShiftKeyDown()) { - if (this.mItemStack == null) { - if (aPlayer.getHeldItem() != null) { - this.mItemStack = aPlayer.getHeldItem() - .copy(); - this.mItemCount = Short.MAX_VALUE; - aPlayer.setCurrentItemOrArmor(0, null); - PlayerUtils.messagePlayer( - aPlayer, - "Now holding " + this.mItemStack.getDisplayName() + " x" + Short.MAX_VALUE + "."); - return true; - } - } else { - if (aPlayer.getHeldItem() == null) { - aPlayer.entityDropItem(mItemStack, 1); - this.mItemStack = null; - this.mItemCount = 0; - PlayerUtils.messagePlayer(aPlayer, "Emptying."); - return true; - } - } - } - - PlayerUtils.messagePlayer( - aPlayer, - "Currently holding: " + (this.mItemStack != null ? this.mItemStack.getDisplayName() : "Nothing") - + " x" - + this.mItemCount); - return true; - // return super.onRightclick(aBaseMetaTileEntity, aPlayer); - } - - @Override - public void onPostTick(IGregTechTileEntity aBaseMetaTileEntity, long aTimer) { - if (mItemStack != null) { - setItemCount(0); - } - super.onPostTick(aBaseMetaTileEntity, aTimer); - } - - @Override - public void setItemCount(int aCount) { - super.setItemCount(Short.MAX_VALUE); - } - - @Override - public boolean allowPullStack(IGregTechTileEntity aBaseMetaTileEntity, int aIndex, ForgeDirection side, - ItemStack aStack) { - return true; - } - - @Override - public boolean allowPutStack(IGregTechTileEntity aBaseMetaTileEntity, int aIndex, ForgeDirection side, - ItemStack aStack) { - return false; - } - - @Override - public MetaTileEntity newMetaEntity(IGregTechTileEntity aTileEntity) { - return new GT_MetaTileEntity_InfiniteItemHolder(this.mName, this.mTier, this.mDescriptionArray, this.mTextures); - } -} diff --git a/gtpp/src/main/java/gtPlusPlus/xmod/gregtech/common/tools/TOOL_Gregtech_AngleGrinder.java b/gtpp/src/main/java/gtPlusPlus/xmod/gregtech/common/tools/TOOL_Gregtech_AngleGrinder.java deleted file mode 100644 index 6af3a61487..0000000000 --- a/gtpp/src/main/java/gtPlusPlus/xmod/gregtech/common/tools/TOOL_Gregtech_AngleGrinder.java +++ /dev/null @@ -1,175 +0,0 @@ -package gtPlusPlus.xmod.gregtech.common.tools; - -import java.util.Arrays; -import java.util.List; - -import net.minecraft.block.Block; -import net.minecraft.entity.Entity; -import net.minecraft.entity.EntityLivingBase; -import net.minecraft.entity.monster.EntityIronGolem; -import net.minecraft.entity.player.EntityPlayer; -import net.minecraft.item.ItemStack; -import net.minecraft.stats.AchievementList; -import net.minecraft.util.ChatComponentText; -import net.minecraft.util.EnumChatFormatting; -import net.minecraft.util.IChatComponent; -import net.minecraftforge.event.world.BlockEvent; - -import gregtech.GT_Mod; -import gregtech.api.enums.Materials; -import gregtech.api.enums.SoundResource; -import gregtech.api.enums.Textures.ItemIcons; -import gregtech.api.interfaces.IIconContainer; -import gregtech.api.items.GT_MetaGenerated_Tool; -import gregtech.common.items.behaviors.Behaviour_None; -import gregtech.common.tools.GT_Tool; -import gtPlusPlus.xmod.gregtech.common.blocks.textures.TexturesGtTools; - -public class TOOL_Gregtech_AngleGrinder extends GT_Tool { - - public static final List<String> mEffectiveList = Arrays - .asList(new String[] { EntityIronGolem.class.getName(), "EntityTowerGuardian" }); - - @Override - public float getNormalDamageAgainstEntity(final float aOriginalDamage, final Entity aEntity, final ItemStack aStack, - final EntityPlayer aPlayer) { - String tName = aEntity.getClass() - .getName(); - tName = tName.substring(tName.lastIndexOf(".") + 1); - return (mEffectiveList.contains(tName)) || (tName.contains("Golem")) ? aOriginalDamage * 2.0F : aOriginalDamage; - } - - @Override - public int getToolDamagePerBlockBreak() { - return 50; - } - - @Override - public int getToolDamagePerDropConversion() { - return 100; - } - - @Override - public int getToolDamagePerContainerCraft() { - return 400; - } - - @Override - public int getToolDamagePerEntityAttack() { - return 100; - } - - @Override - public int getBaseQuality() { - return 0; - } - - @Override - public float getBaseDamage() { - return 8.0F; - } - - @Override - public float getSpeedMultiplier() { - return 2F; - } - - @Override - public float getMaxDurabilityMultiplier() { - return 1.8F; - } - - @Override - public String getCraftingSound() { - return SoundResource.RANDOM_ANVIL_USE.toString(); - } - - @Override - public String getEntityHitSound() { - return SoundResource.RANDOM_ANVIL_BREAK.toString(); - } - - @Override - public String getMiningSound() { - return null; - } - - @Override - public boolean canBlock() { - return false; - } - - @Override - public boolean isWrench() { - return false; - } - - @Override - public boolean isCrowbar() { - return false; - } - - @Override - public boolean isWeapon() { - return true; - } - - @Override - public boolean isMinableBlock(final Block aBlock, final byte aMetaData) { - final String tTool = aBlock.getHarvestTool(aMetaData); - return (tTool != null) && (tTool.equals("sword") || tTool.equals("file")); - } - - @Override - public int convertBlockDrops(final List<ItemStack> aDrops, final ItemStack aStack, final EntityPlayer aPlayer, - final Block aBlock, final int aX, final int aY, final int aZ, final byte aMetaData, final int aFortune, - final boolean aSilkTouch, final BlockEvent.HarvestDropsEvent aEvent) { - return 0; - } - - @Override - public ItemStack getBrokenItem(final ItemStack aStack) { - return null; - } - - @Override - public IIconContainer getIcon(boolean aIsToolHead, ItemStack aStack) { - return (IIconContainer) (aIsToolHead ? TexturesGtTools.ANGLE_GRINDER : ItemIcons.POWER_UNIT_HV); - } - - @Override - public short[] getRGBa(boolean aIsToolHead, ItemStack aStack) { - return aIsToolHead ? GT_MetaGenerated_Tool.getPrimaryMaterial(aStack).mRGBa : Materials.TungstenSteel.mRGBa; - } - - @Override - public void onToolCrafted(final ItemStack aStack, final EntityPlayer aPlayer) { - super.onToolCrafted(aStack, aPlayer); - aPlayer.triggerAchievement(AchievementList.buildSword); - try { - GT_Mod.achievements.issueAchievement(aPlayer, "tools"); - GT_Mod.achievements.issueAchievement(aPlayer, "unitool"); - } catch (final Exception e) {} - } - - @Override - public IChatComponent getDeathMessage(final EntityLivingBase aPlayer, final EntityLivingBase aEntity) { - return new ChatComponentText( - EnumChatFormatting.RED + aEntity.getCommandSenderName() - + EnumChatFormatting.WHITE - + " has been Ground out of existence by " - + EnumChatFormatting.GREEN - + aPlayer.getCommandSenderName() - + EnumChatFormatting.WHITE); - } - - @Override - public void onStatsAddedToTool(final GT_MetaGenerated_Tool aItem, final int aID) { - aItem.addItemBehavior(aID, new Behaviour_None()); - } - - @Override - public boolean isGrafter() { - return false; - } -} diff --git a/gtpp/src/main/java/gtPlusPlus/xmod/gregtech/common/tools/TOOL_Gregtech_ElectricSnips.java b/gtpp/src/main/java/gtPlusPlus/xmod/gregtech/common/tools/TOOL_Gregtech_ElectricSnips.java deleted file mode 100644 index 25ad03548a..0000000000 --- a/gtpp/src/main/java/gtPlusPlus/xmod/gregtech/common/tools/TOOL_Gregtech_ElectricSnips.java +++ /dev/null @@ -1,96 +0,0 @@ -package gtPlusPlus.xmod.gregtech.common.tools; - -import net.minecraft.entity.EntityLivingBase; -import net.minecraft.entity.player.EntityPlayer; -import net.minecraft.item.ItemStack; -import net.minecraft.stats.AchievementList; -import net.minecraft.util.ChatComponentText; -import net.minecraft.util.EnumChatFormatting; -import net.minecraft.util.IChatComponent; - -import gregtech.GT_Mod; -import gregtech.api.enums.Materials; -import gregtech.api.enums.Textures.ItemIcons; -import gregtech.api.interfaces.IIconContainer; -import gregtech.api.items.GT_MetaGenerated_Tool; -import gregtech.common.tools.GT_Tool_WireCutter; -import gtPlusPlus.xmod.gregtech.common.blocks.textures.TexturesGtTools; - -public class TOOL_Gregtech_ElectricSnips extends GT_Tool_WireCutter { - - @Override - public int getToolDamagePerBlockBreak() { - return 50; - } - - @Override - public int getToolDamagePerDropConversion() { - return 100; - } - - @Override - public int getToolDamagePerContainerCraft() { - return 400; - } - - @Override - public int getToolDamagePerEntityAttack() { - return 100; - } - - @Override - public int getBaseQuality() { - return 0; - } - - @Override - public float getBaseDamage() { - return 4.0F; - } - - @Override - public float getSpeedMultiplier() { - return 1F; - } - - @Override - public float getMaxDurabilityMultiplier() { - return 1.4F; - } - - @Override - public ItemStack getBrokenItem(final ItemStack aStack) { - return null; - } - - @Override - public IIconContainer getIcon(boolean aIsToolHead, ItemStack aStack) { - return (IIconContainer) (aIsToolHead ? TexturesGtTools.ELECTRIC_SNIPS : ItemIcons.POWER_UNIT_MV); - } - - @Override - public short[] getRGBa(boolean aIsToolHead, ItemStack aStack) { - return aIsToolHead ? GT_MetaGenerated_Tool.getPrimaryMaterial(aStack).mRGBa : Materials.TungstenSteel.mRGBa; - } - - @Override - public void onToolCrafted(final ItemStack aStack, final EntityPlayer aPlayer) { - super.onToolCrafted(aStack, aPlayer); - aPlayer.triggerAchievement(AchievementList.buildSword); - try { - GT_Mod.achievements.issueAchievement(aPlayer, "tools"); - GT_Mod.achievements.issueAchievement(aPlayer, "unitool"); - } catch (final Exception e) {} - } - - @Override - public IChatComponent getDeathMessage(final EntityLivingBase aPlayer, final EntityLivingBase aEntity) { - return new ChatComponentText( - EnumChatFormatting.RED + aEntity.getCommandSenderName() - + EnumChatFormatting.WHITE - + " has been Snipped out of existence by " - + EnumChatFormatting.GREEN - + aPlayer.getCommandSenderName() - + EnumChatFormatting.WHITE); - } -} diff --git a/gtpp/src/main/java/gtPlusPlus/xmod/gregtech/loaders/Gregtech_Blocks.java b/gtpp/src/main/java/gtPlusPlus/xmod/gregtech/loaders/Gregtech_Blocks.java deleted file mode 100644 index 1a3d07f510..0000000000 --- a/gtpp/src/main/java/gtPlusPlus/xmod/gregtech/loaders/Gregtech_Blocks.java +++ /dev/null @@ -1,34 +0,0 @@ -package gtPlusPlus.xmod.gregtech.loaders; - -import gtPlusPlus.core.block.ModBlocks; -import gtPlusPlus.xmod.gregtech.common.blocks.GregtechMetaCasingBlocks; -import gtPlusPlus.xmod.gregtech.common.blocks.GregtechMetaCasingBlocks2; -import gtPlusPlus.xmod.gregtech.common.blocks.GregtechMetaCasingBlocks3; -import gtPlusPlus.xmod.gregtech.common.blocks.GregtechMetaCasingBlocks4; -import gtPlusPlus.xmod.gregtech.common.blocks.GregtechMetaCasingBlocks5; -import gtPlusPlus.xmod.gregtech.common.blocks.GregtechMetaCasingBlocks6; -import gtPlusPlus.xmod.gregtech.common.blocks.GregtechMetaCasingBlocksPipeGearbox; -import gtPlusPlus.xmod.gregtech.common.blocks.GregtechMetaSpecialMachineCasings; -import gtPlusPlus.xmod.gregtech.common.blocks.GregtechMetaSpecialMultiCasings; -import gtPlusPlus.xmod.gregtech.common.blocks.GregtechMetaSpecialMultiCasings2; -import gtPlusPlus.xmod.gregtech.common.blocks.GregtechMetaTieredCasingBlocks1; - -public class Gregtech_Blocks { - - public static void run() { - - // Casing Blocks - ModBlocks.blockCasingsMisc = new GregtechMetaCasingBlocks(); - ModBlocks.blockCasings2Misc = new GregtechMetaCasingBlocks2(); - ModBlocks.blockCasings3Misc = new GregtechMetaCasingBlocks3(); - ModBlocks.blockCasings4Misc = new GregtechMetaCasingBlocks4(); - ModBlocks.blockCasings5Misc = new GregtechMetaCasingBlocks5(); - ModBlocks.blockCasings6Misc = new GregtechMetaCasingBlocks6(); - - ModBlocks.blockCasingsTieredGTPP = new GregtechMetaTieredCasingBlocks1(); - ModBlocks.blockSpecialMultiCasings = new GregtechMetaSpecialMultiCasings(); - ModBlocks.blockSpecialMultiCasings2 = new GregtechMetaSpecialMultiCasings2(); - ModBlocks.blockCustomMachineCasings = new GregtechMetaSpecialMachineCasings(); - ModBlocks.blockCustomPipeGearCasings = new GregtechMetaCasingBlocksPipeGearbox(); - } -} diff --git a/gtpp/src/main/java/gtPlusPlus/xmod/gregtech/loaders/ProcessingAngleGrinder.java b/gtpp/src/main/java/gtPlusPlus/xmod/gregtech/loaders/ProcessingAngleGrinder.java deleted file mode 100644 index e2723e5248..0000000000 --- a/gtpp/src/main/java/gtPlusPlus/xmod/gregtech/loaders/ProcessingAngleGrinder.java +++ /dev/null @@ -1,133 +0,0 @@ -package gtPlusPlus.xmod.gregtech.loaders; - -import net.minecraft.item.ItemStack; - -import gregtech.api.enums.GT_Values; -import gregtech.api.enums.ItemList; -import gregtech.api.enums.Materials; -import gregtech.api.enums.OrePrefixes; -import gregtech.api.enums.SubTag; -import gregtech.api.util.GT_ModHandler; -import gregtech.api.util.GT_ModHandler.RecipeBits; -import gregtech.api.util.GT_OreDictUnificator; -import gtPlusPlus.api.objects.Logger; -import gtPlusPlus.core.material.ELEMENT; -import gtPlusPlus.core.recipe.common.CI; -import gtPlusPlus.core.util.minecraft.MaterialUtils; -import gtPlusPlus.xmod.gregtech.api.enums.GregtechOrePrefixes; -import gtPlusPlus.xmod.gregtech.api.enums.GregtechOrePrefixes.GT_Materials; -import gtPlusPlus.xmod.gregtech.api.interfaces.internal.Interface_OreRecipeRegistrator; -import gtPlusPlus.xmod.gregtech.common.items.MetaGeneratedGregtechTools; - -public class ProcessingAngleGrinder implements Interface_OreRecipeRegistrator, Runnable { - - public ProcessingAngleGrinder() { - GregtechOrePrefixes.toolAngleGrinder.add(this); - } - - @Override - public void registerOre(final GregtechOrePrefixes aPrefix, final Materials aMaterial, final String aOreDictName, - final String aModName, final ItemStack aStack) { - if ((aMaterial != Materials.Stone) && (aMaterial != Materials.Flint)) { - if (aMaterial != Materials.Rubber) { - if ((!aMaterial.contains(SubTag.WOOD)) && (!aMaterial.contains(SubTag.BOUNCY)) - && (!aMaterial.contains(SubTag.NO_SMASHING))) {} - } - } - } - - @Override - public void registerOre(final GregtechOrePrefixes aPrefix, final GT_Materials aMaterial, final String aOreDictName, - final String aModName, final ItemStack aStack) { - // TODO Auto-generated method stub - - } - - public void materialsLoops() { - final Materials[] i = Materials.values(); - final int size = i.length; - Logger.MATERIALS("Materials to attempt tool gen. with: " + size); - int used = 0; - Materials aMaterial = null; - for (Materials materials : i) { - aMaterial = materials; - if ((aMaterial != Materials.Stone) && (aMaterial != Materials.Flint) - && (aMaterial != Materials.Rubber) - && (aMaterial != Materials._NULL)) { - if ((!aMaterial.contains(SubTag.WOOD)) && (!aMaterial.contains(SubTag.BOUNCY)) - && (!aMaterial.contains(SubTag.NO_SMASHING)) - && (!aMaterial.contains(SubTag.TRANSPARENT)) - && (!aMaterial.contains(SubTag.FLAMMABLE)) - && (!aMaterial.contains(SubTag.MAGICAL)) - && (!aMaterial.contains(SubTag.NO_SMELTING))) { - Logger.MATERIALS("Generating Angle Grinder from " + MaterialUtils.getMaterialName(aMaterial)); - // Input 1 - - final ItemStack plate = GT_OreDictUnificator.get(OrePrefixes.plate, aMaterial, 1L); - final ItemStack longrod = GT_OreDictUnificator.get(OrePrefixes.stickLong, aMaterial, 1L); - - if ((null != plate && longrod != null)) { - addRecipe(aMaterial, 1600000L, 3, ItemList.Battery_RE_HV_Lithium.get(1)); - addRecipe(aMaterial, 1200000L, 3, ItemList.Battery_RE_HV_Cadmium.get(1)); - addRecipe(aMaterial, 800000L, 3, ItemList.Battery_RE_HV_Sodium.get(1)); - used++; - } else { - Logger.MATERIALS( - "Unable to generate Angle Grinder from " + MaterialUtils.getMaterialName(aMaterial) - + ", Plate or Long Rod may be invalid. Invalid | Plate? " - + (plate == null) - + " | Rod? " - + (longrod == null) - + " |"); - } - // GT_ModHandler.addCraftingRecipe(, - // GT_ModHandler.RecipeBits.DO_NOT_CHECK_FOR_COLLISIONS | - // GT_ModHandler.RecipeBits.BUFFERED, new Object[]{"P H", "PIP", " I ", - // Character.valueOf('I'), OrePrefixes.ingot.get(aMaterial), - // Character.valueOf('P'), OrePrefixes.plate.get(aMaterial), - // Character.valueOf('H'), OrePrefixes.toolHeadHammer.get(aMaterial)}); - } else { - Logger - .MATERIALS("Unable to generate Angle Grinder from " + MaterialUtils.getMaterialName(aMaterial)); - } - } else { - Logger.MATERIALS("Unable to generate Angle Grinder from " + MaterialUtils.getMaterialName(aMaterial)); - } - } - - Logger.INFO("Materials used for tool gen: " + used); - } - - @Override - public void run() { - Logger.INFO("Generating Angle Grinders for all valid GT Materials."); - this.materialsLoops(); - } - - public boolean addRecipe(Materials aMaterial, long aBatteryStorage, int aVoltageTier, ItemStack aBattery) { - - ItemStack aOutputStack = MetaGeneratedGregtechTools.INSTANCE.getToolWithStats( - MetaGeneratedGregtechTools.ANGLE_GRINDER, - 1, - aMaterial, - Materials.Titanium, - new long[] { aBatteryStorage, GT_Values.V[aVoltageTier], 3L, -1L }); - - long aDura = MetaGeneratedGregtechTools.getToolMaxDamage(aOutputStack); - if (aDura <= 32000) { - Logger.MATERIALS( - "Unable to generate Angle Grinder from " + MaterialUtils.getMaterialName(aMaterial) - + ", Durability: " - + aDura); - return false; - } - - return GT_ModHandler.addCraftingRecipe( - aOutputStack, - RecipeBits.DISMANTLEABLE | RecipeBits.DO_NOT_CHECK_FOR_COLLISIONS | RecipeBits.BUFFERED, - new Object[] { "SXL", "GMG", "PBP", 'X', ItemList.Component_Grinder_Tungsten.get(1), 'M', - CI.getElectricMotor(aVoltageTier, 1), 'S', OrePrefixes.screw.get(Materials.Titanium), 'L', - OrePrefixes.stickLong.get(aMaterial), 'P', OrePrefixes.plate.get(aMaterial), 'G', - ELEMENT.STANDALONE.BLACK_METAL.getGear(1), 'B', aBattery }); - } -} diff --git a/gtpp/src/main/java/gtPlusPlus/xmod/gregtech/loaders/ProcessingElectricSnips.java b/gtpp/src/main/java/gtPlusPlus/xmod/gregtech/loaders/ProcessingElectricSnips.java deleted file mode 100644 index 9a60f2c6bf..0000000000 --- a/gtpp/src/main/java/gtPlusPlus/xmod/gregtech/loaders/ProcessingElectricSnips.java +++ /dev/null @@ -1,137 +0,0 @@ -package gtPlusPlus.xmod.gregtech.loaders; - -import net.minecraft.item.ItemStack; - -import gregtech.api.enums.GT_Values; -import gregtech.api.enums.ItemList; -import gregtech.api.enums.Materials; -import gregtech.api.enums.OrePrefixes; -import gregtech.api.enums.SubTag; -import gregtech.api.util.GT_OreDictUnificator; -import gregtech.common.items.GT_MetaGenerated_Tool_01; -import gtPlusPlus.api.objects.Logger; -import gtPlusPlus.core.material.ELEMENT; -import gtPlusPlus.core.recipe.common.CI; -import gtPlusPlus.core.util.minecraft.MaterialUtils; -import gtPlusPlus.core.util.minecraft.RecipeUtils; -import gtPlusPlus.xmod.gregtech.api.enums.GregtechOrePrefixes; -import gtPlusPlus.xmod.gregtech.api.enums.GregtechOrePrefixes.GT_Materials; -import gtPlusPlus.xmod.gregtech.api.interfaces.internal.Interface_OreRecipeRegistrator; -import gtPlusPlus.xmod.gregtech.common.items.MetaGeneratedGregtechTools; - -public class ProcessingElectricSnips implements Interface_OreRecipeRegistrator, Runnable { - - public ProcessingElectricSnips() { - GregtechOrePrefixes.toolElectricSnips.add(this); - } - - @Override - public void registerOre(final GregtechOrePrefixes aPrefix, final Materials aMaterial, final String aOreDictName, - final String aModName, final ItemStack aStack) { - if ((aMaterial != Materials.Stone) && (aMaterial != Materials.Flint)) { - if (aMaterial != Materials.Rubber) { - if ((!aMaterial.contains(SubTag.WOOD)) && (!aMaterial.contains(SubTag.BOUNCY)) - && (!aMaterial.contains(SubTag.NO_SMASHING))) {} - } - } - } - - @Override - public void registerOre(final GregtechOrePrefixes aPrefix, final GT_Materials aMaterial, final String aOreDictName, - final String aModName, final ItemStack aStack) { - // TODO Auto-generated method stub - - } - - public void materialsLoops() { - final Materials[] i = Materials.values(); - final int size = i.length; - Logger.MATERIALS("Materials to attempt tool gen. with: " + size); - int used = 0; - Materials aMaterial = null; - for (Materials materials : i) { - aMaterial = materials; - if ((aMaterial != Materials.Stone) && (aMaterial != Materials.Flint) - && (aMaterial != Materials.Rubber) - && (aMaterial != Materials._NULL)) { - if ((!aMaterial.contains(SubTag.WOOD)) && (!aMaterial.contains(SubTag.BOUNCY)) - && (!aMaterial.contains(SubTag.NO_SMASHING)) - && (!aMaterial.contains(SubTag.TRANSPARENT)) - && (!aMaterial.contains(SubTag.FLAMMABLE)) - && (!aMaterial.contains(SubTag.MAGICAL)) - && (!aMaterial.contains(SubTag.NO_SMELTING))) { - Logger.MATERIALS("Generating Electric Snips from " + MaterialUtils.getMaterialName(aMaterial)); - // Input 1 - - final ItemStack plate = GT_OreDictUnificator.get(OrePrefixes.plate, aMaterial, 1L); - - if ((null != plate)) { - addRecipe(aMaterial, 1600000L, 3, ItemList.Battery_RE_HV_Lithium.get(1)); - addRecipe(aMaterial, 1200000L, 3, ItemList.Battery_RE_HV_Cadmium.get(1)); - addRecipe(aMaterial, 800000L, 3, ItemList.Battery_RE_HV_Sodium.get(1)); - used++; - } else { - Logger.MATERIALS( - "Unable to generate Electric Snips from " + MaterialUtils.getMaterialName(aMaterial) - + ", Plate or Long Rod may be invalid. Invalid | Plate? " - + (plate == null) - + " | Rod? " - + " |"); - } - // GT_ModHandler.addCraftingRecipe(, - // GT_ModHandler.RecipeBits.DO_NOT_CHECK_FOR_COLLISIONS | - // GT_ModHandler.RecipeBits.BUFFERED, new Object[]{"P H", "PIP", " I ", - // Character.valueOf('I'), OrePrefixes.ingot.get(aMaterial), - // Character.valueOf('P'), OrePrefixes.plate.get(aMaterial), - // Character.valueOf('H'), OrePrefixes.toolHeadHammer.get(aMaterial)}); - } else { - Logger.MATERIALS( - "Unable to generate Electric Snips from " + MaterialUtils.getMaterialName(aMaterial)); - } - } else { - Logger.MATERIALS("Unable to generate Electric Snips from " + MaterialUtils.getMaterialName(aMaterial)); - } - } - - Logger.INFO("Materials used for tool gen: " + used); - } - - @Override - public void run() { - Logger.INFO("Generating Electric Snips for all valid GT Materials."); - this.materialsLoops(); - } - - public boolean addRecipe(Materials aMaterial, long aBatteryStorage, int aVoltageTier, ItemStack aBattery) { - - ItemStack aOutputStack = MetaGeneratedGregtechTools.INSTANCE.getToolWithStats( - MetaGeneratedGregtechTools.ELECTRIC_SNIPS, - 1, - aMaterial, - Materials.Titanium, - new long[] { aBatteryStorage, GT_Values.V[aVoltageTier], 3L, -1L }); - - ItemStack aInputCutter = GT_MetaGenerated_Tool_01.INSTANCE - .getToolWithStats(GT_MetaGenerated_Tool_01.WIRECUTTER, 1, aMaterial, aMaterial, null); - - long aDura = MetaGeneratedGregtechTools.getToolMaxDamage(aOutputStack); - if (aDura <= 32000) { - Logger.MATERIALS( - "Unable to generate Electric Snips from " + MaterialUtils.getMaterialName(aMaterial) - + ", Durability: " - + aDura); - return false; - } - return RecipeUtils.addShapedRecipe( - OrePrefixes.wireFine.get(Materials.Electrum), - aInputCutter, - OrePrefixes.wireFine.get(Materials.Electrum), - ELEMENT.STANDALONE.WHITE_METAL.getGear(1), - CI.getElectricMotor(aVoltageTier, 1), - ELEMENT.STANDALONE.WHITE_METAL.getGear(1), - OrePrefixes.plate.get(aMaterial), - aBattery, - OrePrefixes.plate.get(aMaterial), - aOutputStack); - } -} diff --git a/gtpp/src/main/java/gtPlusPlus/xmod/gregtech/loaders/RecipeGen_AlloySmelter.java b/gtpp/src/main/java/gtPlusPlus/xmod/gregtech/loaders/RecipeGen_AlloySmelter.java deleted file mode 100644 index d455697330..0000000000 --- a/gtpp/src/main/java/gtPlusPlus/xmod/gregtech/loaders/RecipeGen_AlloySmelter.java +++ /dev/null @@ -1,63 +0,0 @@ -package gtPlusPlus.xmod.gregtech.loaders; - -import java.util.HashSet; -import java.util.Set; - -import gregtech.api.enums.GT_Values; -import gregtech.api.enums.ItemList; -import gtPlusPlus.api.interfaces.RunnableWithInfo; -import gtPlusPlus.core.material.Material; -import gtPlusPlus.core.material.MaterialGenerator; -import gtPlusPlus.core.util.minecraft.ItemUtils; - -public class RecipeGen_AlloySmelter extends RecipeGen_Base { - - public static final Set<RunnableWithInfo<Material>> mRecipeGenMap = new HashSet<>(); - - static { - MaterialGenerator.mRecipeMapsToGenerate.put(mRecipeGenMap); - } - - public RecipeGen_AlloySmelter(final Material M) { - this.toGenerate = M; - mRecipeGenMap.add(this); - } - - @Override - public void run() { - generateRecipes(this.toGenerate); - } - - private void generateRecipes(final Material material) { - final int tVoltageMultiplier = material.vVoltageMultiplier; - - // Nuggets - if (ItemUtils.checkForInvalidItems(material.getIngot(1)) - && ItemUtils.checkForInvalidItems(material.getNugget(1))) - GT_Values.RA.addAlloySmelterRecipe( - material.getIngot(1), - ItemList.Shape_Mold_Nugget.get(0), - material.getNugget(9), - (int) Math.max(material.getMass() * 2L, 1L), - tVoltageMultiplier); - - // Gears - if (ItemUtils.checkForInvalidItems(material.getIngot(1)) && ItemUtils.checkForInvalidItems(material.getGear(1))) - GT_Values.RA.addAlloySmelterRecipe( - material.getIngot(8), - ItemList.Shape_Mold_Gear.get(0), - material.getGear(1), - (int) Math.max(material.getMass() * 2L, 1L), - tVoltageMultiplier); - - // Ingot - if (ItemUtils.checkForInvalidItems(material.getIngot(1)) - && ItemUtils.checkForInvalidItems(material.getNugget(1))) - GT_Values.RA.addAlloySmelterRecipe( - material.getNugget(9), - ItemList.Shape_Mold_Ingot.get(0), - material.getIngot(1), - (int) Math.max(material.getMass() * 2L, 1L), - tVoltageMultiplier); - } -} diff --git a/gtpp/src/main/java/gtPlusPlus/xmod/gregtech/loaders/RecipeGen_Assembler.java b/gtpp/src/main/java/gtPlusPlus/xmod/gregtech/loaders/RecipeGen_Assembler.java deleted file mode 100644 index 1594568d23..0000000000 --- a/gtpp/src/main/java/gtPlusPlus/xmod/gregtech/loaders/RecipeGen_Assembler.java +++ /dev/null @@ -1,69 +0,0 @@ -package gtPlusPlus.xmod.gregtech.loaders; - -import java.util.HashSet; -import java.util.Set; - -import net.minecraft.item.ItemStack; - -import gregtech.api.enums.GT_Values; -import gtPlusPlus.api.interfaces.RunnableWithInfo; -import gtPlusPlus.core.material.Material; -import gtPlusPlus.core.material.MaterialGenerator; -import gtPlusPlus.core.util.minecraft.FluidUtils; -import gtPlusPlus.core.util.minecraft.ItemUtils; - -public class RecipeGen_Assembler extends RecipeGen_Base { - - public static final Set<RunnableWithInfo<Material>> mRecipeGenMap = new HashSet<>(); - - static { - MaterialGenerator.mRecipeMapsToGenerate.put(mRecipeGenMap); - } - - public RecipeGen_Assembler(final Material M) { - this.toGenerate = M; - mRecipeGenMap.add(this); - } - - @Override - public void run() { - generateRecipes(this.toGenerate); - } - - private void generateRecipes(final Material material) { - - // Frame Box - if (ItemUtils.checkForInvalidItems(new ItemStack[] { material.getRod(1), material.getFrameBox(1) })) - GT_Values.RA.addAssemblerRecipe( - material.getRod(4), - ItemUtils.getGregtechCircuit(4), - material.getFrameBox(1), - 60, - material.vVoltageMultiplier); - - // Rotor - if (ItemUtils - .checkForInvalidItems(new ItemStack[] { material.getPlate(1), material.getRing(1), material.getRotor(1) })) - addAssemblerRecipe( - material.getPlate(4), - material.getRing(1), - material.getRotor(1), - 240, - material.vVoltageMultiplier); - } - - private static void addAssemblerRecipe(final ItemStack input1, final ItemStack input2, final ItemStack output1, - final int seconds, final int euCost) { - GT_Values.RA.addAssemblerRecipe( - input1, - input2, - FluidUtils.getFluidStack("molten.solderingalloy", 16), - output1, - seconds, - euCost); - GT_Values.RA - .addAssemblerRecipe(input1, input2, FluidUtils.getFluidStack("molten.tin", 32), output1, seconds, euCost); - GT_Values.RA - .addAssemblerRecipe(input1, input2, FluidUtils.getFluidStack("molten.lead", 48), output1, seconds, euCost); - } -} diff --git a/gtpp/src/main/java/gtPlusPlus/xmod/gregtech/loaders/RecipeGen_Base.java b/gtpp/src/main/java/gtPlusPlus/xmod/gregtech/loaders/RecipeGen_Base.java deleted file mode 100644 index d000889757..0000000000 --- a/gtpp/src/main/java/gtPlusPlus/xmod/gregtech/loaders/RecipeGen_Base.java +++ /dev/null @@ -1,15 +0,0 @@ -package gtPlusPlus.xmod.gregtech.loaders; - -import gtPlusPlus.api.interfaces.RunnableWithInfo; -import gtPlusPlus.core.material.Material; - -public abstract class RecipeGen_Base implements RunnableWithInfo<Material> { - - protected Material toGenerate; - protected boolean disableOptional; - - @Override - public Material getInfoData() { - return toGenerate; - } -} diff --git a/gtpp/src/main/java/gtPlusPlus/xmod/gregtech/loaders/RecipeGen_BlastSmelter.java b/gtpp/src/main/java/gtPlusPlus/xmod/gregtech/loaders/RecipeGen_BlastSmelter.java deleted file mode 100644 index 2d573c9fb7..0000000000 --- a/gtpp/src/main/java/gtPlusPlus/xmod/gregtech/loaders/RecipeGen_BlastSmelter.java +++ /dev/null @@ -1,321 +0,0 @@ -package gtPlusPlus.xmod.gregtech.loaders; - -import java.util.ArrayList; -import java.util.HashSet; -import java.util.Set; - -import net.minecraft.item.ItemStack; -import net.minecraftforge.fluids.FluidStack; - -import gregtech.api.enums.GT_Values; -import gregtech.api.enums.ItemList; -import gtPlusPlus.api.interfaces.RunnableWithInfo; -import gtPlusPlus.api.objects.Logger; -import gtPlusPlus.api.recipe.GTPPRecipeCategories; -import gtPlusPlus.api.recipe.GTPPRecipeMaps; -import gtPlusPlus.core.lib.CORE; -import gtPlusPlus.core.material.ALLOY; -import gtPlusPlus.core.material.Material; -import gtPlusPlus.core.material.MaterialGenerator; -import gtPlusPlus.core.material.MaterialStack; -import gtPlusPlus.core.material.nuclear.FLUORIDES; -import gtPlusPlus.core.material.nuclear.NUCLIDE; -import gtPlusPlus.core.material.state.MaterialState; -import gtPlusPlus.core.util.minecraft.FluidUtils; -import gtPlusPlus.core.util.minecraft.ItemUtils; -import gtPlusPlus.core.util.minecraft.MaterialUtils; - -public class RecipeGen_BlastSmelter extends RecipeGen_Base { - - public static final Set<RunnableWithInfo<Material>> mRecipeGenMap = new HashSet<>(); - - static { - MaterialGenerator.mRecipeMapsToGenerate.put(mRecipeGenMap); - } - - public RecipeGen_BlastSmelter(final Material M) { - this.toGenerate = M; - mRecipeGenMap.add(this); - } - - @Override - public void run() { - generateARecipe(this.toGenerate); - } - - private void generateARecipe(final Material M) { - - // Add a Blast Smelting Recipe, Let's go! - ItemStack tStack; - if (null != (tStack = M.getDust(1))) { - - final Material[] badMaterials = { FLUORIDES.THORIUM_HEXAFLUORIDE, FLUORIDES.THORIUM_TETRAFLUORIDE, - ALLOY.BLOODSTEEL, NUCLIDE.LiFBeF2ThF4UF4, NUCLIDE.LiFBeF2ZrF4UF4, NUCLIDE.LiFBeF2ZrF4U235 }; - for (final Material R : badMaterials) { - if (M == R) { - return; - } - } - - // Prepare some Variables - ItemStack[] components; - ArrayList<MaterialStack> tMaterial = new ArrayList<>(); - int inputStackCount = 0; - int fluidAmount = 0; - final boolean doTest = true; - tMaterial = M.getComposites(); - - // This Bad boy here is what dictates unique recipes. - ItemStack circuitGT; - - // Set a duration - OLD - /* - * int duration = 0; if (M.getMeltingPointK() > 150){ duration = (int) Math.max(M.getMass() / 50L, 1L) * - * M.getMeltingPointK(); } else { duration = (int) Math.max(M.getMass() / 50L, 1L) * 150; } - */ - - long aVoltage = MaterialUtils.getVoltageForTier(M.vTier); - - // Set a duration - NEW - int duration = 120 * M.vTier * 10; - - if (M.vTier <= 4) { - duration = 20 * M.vTier * 10; - } - - int mMaterialListSize = 0; - - int mTotalPartsCounter = M.smallestStackSizeWhenProcessing; - - if (M.getComposites() != null) { - for (final gtPlusPlus.core.material.MaterialStack ternkfsdf : M.getComposites()) { - if (ternkfsdf != null) { - mMaterialListSize++; - // mTotalPartsCounter += ternkfsdf.getSmallestStackSizes()[0]; - } - } - } else { - mMaterialListSize = 1; - } - - if (duration <= 0) { - final int second = 20; - duration = 14 * second * mMaterialListSize * 8; - } - - Logger.WARNING("[BAS] Size: " + mMaterialListSize); - - // Make a simple one Material MaterialStack[] and log it for validity. - circuitGT = ItemUtils.getGregtechCircuit(1); - final ItemStack[] tItemStackTest = new ItemStack[] { circuitGT, tStack }; - inputStackCount = 1; - fluidAmount = 144 * inputStackCount; - Logger.WARNING( - "[BAS] Adding an Alloy Blast Smelter Recipe for " + M.getLocalizedName() - + ". Gives " - + fluidAmount - + "L of molten metal."); - for (int das = 0; das < tItemStackTest.length; das++) { - if (tItemStackTest[das] != null) { - Logger.WARNING( - "[BAS] tMaterial[" + das - + "]: " - + tItemStackTest[das].getDisplayName() - + " Meta: " - + tItemStackTest[das].getItemDamage() - + ", Amount: " - + tItemStackTest[das].stackSize); - } - } - - final boolean hasMoreInputThanACircuit = (tItemStackTest.length > 1); - - // Generate Recipes for all singular materials that can be made molten. - if (hasMoreInputThanACircuit) { - if (M.requiresBlastFurnace()) { - GT_Values.RA.stdBuilder() - .itemInputs(tItemStackTest) - .fluidOutputs(M.getFluidStack(fluidAmount)) - .duration(duration / (mTotalPartsCounter > 0 ? mTotalPartsCounter : 1)) - .eut(aVoltage) - .recipeCategory(GTPPRecipeCategories.absNonAlloyRecipes) - .addTo(GTPPRecipeMaps.alloyBlastSmelterRecipes); - } else { - Logger.WARNING("[BAS] Failed."); - } - } else { - if (CORE.RA.addBlastSmelterRecipe( - tItemStackTest, - M.getFluidStack(fluidAmount), - 100, - duration / (mTotalPartsCounter > 0 ? mTotalPartsCounter : 1) / 2, - (int) aVoltage)) { - Logger.WARNING("[BAS] Success."); - if (GT_Values.RA.addFluidSolidifierRecipe( - ItemList.Shape_Mold_Ingot.get(0), - M.getFluidStack(144), - M.getIngot(1), - duration / 2, - 60)) { - Logger.WARNING("[BAS] Success, Also added a Fluid solidifier recipe."); - /* - * if (GT_Values.RA.addFluidExtractionRecipe(M.getIngot(1), null, M.getFluidStack(144), 100, - * duration/2, 60)){ Logger.WARNING("[BAS] Success, Also added a Fluid Extractor recipe."); } if - * (GT_Values.RA.addFluidExtractionRecipe(M.getNugget(1), null, M.getFluidStack(16), 100, - * duration/2/9, 60)){ Logger.WARNING("[BAS] Success, Also added a Fluid Extractor recipe."); } - */ - /* - * if (GT_Values.RA.addFluidExtractionRecipe(M.getSmallDust(1), null, M.getFluid(36), 100, - * duration/2/4, 60)){ Logger.WARNING("[BAS] Success, Also added a Fluid Extractor recipe."); } - * if (GT_Values.RA.addFluidExtractionRecipe(M.getTinyDust(1), null, M.getFluid(16), 100, - * duration/2/9, 60)){ Logger.WARNING("[BAS] Success, Also added a Fluid Extractor recipe."); } - */ - } - } else { - Logger.WARNING("[BAS] Failed."); - } - } - - if (tMaterial != null) { - // Reset the Variables for compounds if last recipe was a success. - inputStackCount = 0; - - // If this Material has some kind of compound list, proceed - if (mMaterialListSize > 1) { - final gtPlusPlus.core.material.MaterialStack[] tempStack = new gtPlusPlus.core.material.MaterialStack[mMaterialListSize]; - circuitGT = ItemUtils.getGregtechCircuit(mMaterialListSize); - // Just double checking - if (tempStack.length > 1) { - - // Builds me a MaterialStack[] from the MaterialList of M. - int ooo = 0; - for (final gtPlusPlus.core.material.MaterialStack xMaterial : M.getComposites()) { - if (xMaterial != null) { - if (xMaterial.getStackMaterial() != null) { - Logger.WARNING( - "[BAS] FOUND: " + xMaterial.getStackMaterial() - .getLocalizedName()); - Logger.WARNING( - "[BAS] ADDING: " + xMaterial.getStackMaterial() - .getLocalizedName()); - } - tempStack[ooo] = xMaterial; - } - ooo++; - } - - // Builds me an ItemStack[] of the materials. - Without a circuit - this gets a good count for - // the 144L fluid multiplier - components = new ItemStack[9]; - inputStackCount = 0; - FluidStack componentsFluid = null; - for (int irc = 0; irc < M.getComposites() - .size(); irc++) { - if (M.getComposites() - .get(irc) != null) { - final int r = (int) M.vSmallestRatio[irc]; - inputStackCount = inputStackCount + r; - if ((M.getComposites() - .get(irc) - .getStackMaterial() - .getState() != MaterialState.SOLID) - || !ItemUtils.checkForInvalidItems( - M.getComposites() - .get(irc) - .getDustStack(r))) { - final int xr = r; - if ((xr > 0) && (xr <= 100)) { - final int mathmatics = (r * 1000); - componentsFluid = FluidUtils.getFluidStack( - M.getComposites() - .get(irc) - .getStackMaterial() - .getFluidStack(mathmatics), - mathmatics); - } - } else { - components[irc] = M.getComposites() - .get(irc) - .getUnificatedDustStack(r); - } - } - } - - // Adds a circuit - if ((mMaterialListSize < 9) && (mMaterialListSize != 0)) { - final ItemStack[] components_NoCircuit = components; - // Builds me an ItemStack[] of the materials. - With a circuit - components = new ItemStack[components_NoCircuit.length + 1]; - for (int fr = 0; fr < components.length; fr++) { - if (fr == 0) { - components[0] = circuitGT; - } else { - components[fr] = components_NoCircuit[fr - 1]; - } - } - Logger.WARNING( - "[BAS] Should have added a circuit. mMaterialListSize: " + mMaterialListSize - + " | circuit: " - + components[0].getDisplayName()); - } else { - Logger.WARNING("[BAS] Did not add a circuit. mMaterialListSize: " + mMaterialListSize); - } - - // Set Fluid output - fluidAmount = 144 * inputStackCount; - - Logger.WARNING( - "[BAS] Adding an Alloy Blast Smelter Recipe for " + M.getLocalizedName() - + " using it's compound dusts. This material has " - + inputStackCount - + " parts. Gives " - + fluidAmount - + "L of molten metal."); - Logger.WARNING("[BAS] tMaterial.length: " + components.length + "."); - for (int das = 0; das < components.length; das++) { - if (components[das] != null) { - Logger.WARNING( - "[BAS] tMaterial[" + das - + "]: " - + components[das].getDisplayName() - + " Meta: " - + components[das].getItemDamage() - + ", Amount: " - + components[das].stackSize); - } - } - - // Adds Recipe - if (M.requiresBlastFurnace()) { - if (CORE.RA.addBlastSmelterRecipe( - components, - componentsFluid, - M.getFluidStack(fluidAmount), - 100, - duration, - (int) aVoltage)) { - Logger.WARNING("[BAS] Success."); - } else { - Logger.WARNING("[BAS] Failed."); - } - } else { - if (CORE.RA.addBlastSmelterRecipe( - components, - componentsFluid, - M.getFluidStack(fluidAmount), - 100, - duration, - (int) aVoltage / 2)) { - Logger.WARNING("[BAS] Success."); - } else { - Logger.WARNING("[BAS] Failed."); - } - } - } - } - } else { - Logger.WARNING("[BAS] doTest: " + doTest + " | tMaterial != null: " + (tMaterial != null)); - } - } - } -} diff --git a/gtpp/src/main/java/gtPlusPlus/xmod/gregtech/loaders/RecipeGen_BlastSmelterGT_GTNH.java b/gtpp/src/main/java/gtPlusPlus/xmod/gregtech/loaders/RecipeGen_BlastSmelterGT_GTNH.java deleted file mode 100644 index 5398a6a0b5..0000000000 --- a/gtpp/src/main/java/gtPlusPlus/xmod/gregtech/loaders/RecipeGen_BlastSmelterGT_GTNH.java +++ /dev/null @@ -1,252 +0,0 @@ -package gtPlusPlus.xmod.gregtech.loaders; - -import java.util.ArrayList; -import java.util.HashMap; -import java.util.Map; - -import net.minecraft.item.ItemStack; -import net.minecraftforge.fluids.FluidStack; -import net.minecraftforge.oredict.OreDictionary; - -import org.apache.commons.lang3.ArrayUtils; - -import gregtech.api.enums.GT_Values; -import gregtech.api.recipe.RecipeMaps; -import gregtech.api.util.GT_Recipe; -import gtPlusPlus.api.objects.Logger; -import gtPlusPlus.api.objects.minecraft.ItemStackData; -import gtPlusPlus.api.recipe.GTPPRecipeCategories; -import gtPlusPlus.api.recipe.GTPPRecipeMaps; -import gtPlusPlus.core.recipe.common.CI; -import gtPlusPlus.core.util.math.MathUtils; -import gtPlusPlus.core.util.minecraft.FluidUtils; -import gtPlusPlus.core.util.minecraft.ItemUtils; - -public class RecipeGen_BlastSmelterGT_GTNH { - - private static Map<String, FluidStack> mCachedIngotToFluidRegistry = new HashMap<>(); - private static Map<String, String> mCachedHotToColdRegistry = new HashMap<>(); - - private static synchronized void setIngotToFluid(final ItemStackData stack, final FluidStack fluid) { - if (stack != null && fluid != null) { - mCachedIngotToFluidRegistry.put(stack.getUniqueDataIdentifier(), fluid); - } - } - - private static synchronized void setHotToCold(final ItemStackData hot, final ItemStackData cold) { - if (hot != null && cold != null) { - mCachedHotToColdRegistry.put(hot.getUniqueDataIdentifier(), cold.getUniqueDataIdentifier()); - } - } - - private static synchronized FluidStack getFluidFromIngot(final ItemStackData ingot) { - ItemStackData h = ingot; - if (mCachedIngotToFluidRegistry.containsKey(h.getUniqueDataIdentifier())) { - Logger.MACHINE_INFO("[ABS] mCachedIngotToFluidRegistry contains Output Ingot."); - return mCachedIngotToFluidRegistry.get(h.getUniqueDataIdentifier()); - } - if (mCachedHotToColdRegistry.containsKey(h.getUniqueDataIdentifier())) { - Logger.MACHINE_INFO("[ABS] mCachedHotToColdRegistry contains Output Ingot."); - return mCachedIngotToFluidRegistry.get(mCachedHotToColdRegistry.get(h.getUniqueDataIdentifier())); - } - Logger.MACHINE_INFO("[ABS] Neither Cache contains Output Ingot."); - return null; - } - - private static boolean isValid(final ItemStack[] inputs, final ItemStack outputs[], final FluidStack[] fluidIn, - final FluidStack fluidOut) { - if (inputs != null && outputs != null - && fluidIn != null - && fluidOut != null - && inputs.length > 0 - && outputs.length > 0) { - return true; - } - return false; - } - - public static synchronized boolean generateGTNHBlastSmelterRecipesFromEBFList() { - - // Make a counting object - int mSuccess = 0; - - Logger.INFO("[ABS] Starting recipe generation based on EBF recipe map."); - Logger.INFO("[ABS] Caching Ingots and their Molten fluid.."); - // Ingots/Dusts -> Fluids - for (GT_Recipe x : RecipeMaps.fluidExtractionRecipes.getAllRecipes()) { - ItemStack validInput = null; - FluidStack validOutput = null; - // If there aren't both non empty inputs and outputs, we skip - if (ArrayUtils.isEmpty(x.mInputs) || ArrayUtils.isEmpty(x.mFluidOutputs)) { - continue; - } - - for (int tag : OreDictionary.getOreIDs(x.mInputs[0])) { - String oreName = OreDictionary.getOreName(tag) - .toLowerCase(); - String mType = "ingot"; - if (oreName.startsWith(mType) && !oreName.contains("double") - && !oreName.contains("triple") - && !oreName.contains("quad") - && !oreName.contains("quintuple")) { - validInput = x.mInputs[0]; - } - } - - validOutput = x.mFluidOutputs[0]; - - if (validInput != null) { - ItemStackData R = new ItemStackData(validInput); - setIngotToFluid(R, validOutput); - Logger.MACHINE_INFO( - "[ABS][I2F] Cached " + validInput.getDisplayName() - + " to " - + validOutput.getLocalizedName() - + ". Stored Under ID of " - + R.getUniqueDataIdentifier()); - } - } - - Logger.INFO("[ABS] Caching Ingots and their Hot form..."); - // Hot Ingots -> Cold Ingots - for (GT_Recipe x : RecipeMaps.vacuumFreezerRecipes.getAllRecipes()) { - ItemStack validInput = null; - ItemStack validOutput = null; - // If we the input is an ingot and it and the output are valid, map it to cache. - if (ArrayUtils.isNotEmpty(x.mInputs) && x.mInputs[0] != null) { - validInput = x.mInputs[0]; - } - if (ArrayUtils.isNotEmpty(x.mOutputs) && x.mOutputs[0] != null) { - validOutput = x.mOutputs[0]; - } - if (validInput != null && validOutput != null) { - ItemStackData R1 = new ItemStackData(validInput); - ItemStackData R2 = new ItemStackData(validOutput); - setHotToCold(R1, R2); - Logger.MACHINE_INFO( - "[ABS][H2C] Cached " + validInput.getDisplayName() - + " to " - + validOutput.getDisplayName() - + ". Stored Under ID of " - + R1.getUniqueDataIdentifier() - + ", links to ID " - + R2.getUniqueDataIdentifier()); - } - } - - Logger.INFO("[ABS] Generating recipes based on existing EBF recipes."); - // Okay, so now lets Iterate existing EBF recipes. - for (GT_Recipe x : RecipeMaps.blastFurnaceRecipes.getAllRecipes()) { - ItemStack[] inputs, outputs; - FluidStack[] inputsF; - int voltage, time, special; - boolean enabled; - inputs = x.mInputs.clone(); - outputs = x.mOutputs.clone(); - inputsF = x.mFluidInputs.clone(); - voltage = x.mEUt; - time = x.mDuration; - enabled = x.mEnabled; - special = x.mSpecialValue; - - // continue to next recipe if the Temp is too high. - if (special > 3600) { - Logger.MACHINE_INFO("[ABS] Skipping ABS addition for GTNH due to temp."); - continue; - } else { - FluidStack mMoltenStack = null; - int mMoltenCount = 0; - // If We have a valid Output, let's try use our cached data to get it's molten form. - if (x.mOutputs != null && x.mOutputs[0] != null) { - mMoltenCount = x.mOutputs[0].stackSize; - ItemStackData R = new ItemStackData(x.mOutputs[0]); - Logger.MACHINE_INFO( - "[ABS] Found " + x.mOutputs[0].getDisplayName() - + " as valid EBF output, finding it's fluid from the cache. We will require " - + (144 * mMoltenCount) - + "L. Looking for ID " - + R.getUniqueDataIdentifier()); - FluidStack tempFluid = getFluidFromIngot(R); - if (tempFluid != null) { - // Logger.MACHINE_INFO("[ABS] Got Fluid from Cache."); - mMoltenStack = FluidUtils.getFluidStack(tempFluid, mMoltenCount * 144); - } else { - Logger.MACHINE_INFO("[ABS] Failed to get Fluid from Cache."); - } - } - // If this recipe is enabled and we have a valid molten fluidstack, let's try add this recipe. - if (enabled && isValid(inputs, outputs, inputsF, mMoltenStack)) { - // Boolean to decide whether or not to create a new circuit later - boolean circuitFound = false; - - // Build correct input stack - ArrayList<ItemStack> aTempList = new ArrayList<>(); - for (ItemStack recipeItem : inputs) { - if (ItemUtils.isControlCircuit(recipeItem)) { - circuitFound = true; - } - aTempList.add(recipeItem); - } - - inputs = aTempList.toArray(new ItemStack[aTempList.size()]); - int inputLength = inputs.length; - // If no circuit was found, increase array length by 1 to add circuit at newInput[0] - if (!circuitFound) { - inputLength++; - } - - ItemStack[] newInput = new ItemStack[inputLength]; - - int l = 0; - // If no circuit was found, add a circuit here - if (!circuitFound) { - l = 1; - newInput[0] = CI.getNumberedCircuit(inputs.length); - } - - for (ItemStack y : inputs) { - newInput[l++] = y; - } - - GT_Values.RA.stdBuilder() - .itemInputs(newInput) - .fluidInputs(inputsF) - .fluidOutputs(mMoltenStack) - .duration(MathUtils.roundToClosestInt(time * 0.8)) - .eut(voltage) - .recipeCategory( - inputLength <= 2 ? GTPPRecipeCategories.absNonAlloyRecipes - : GTPPRecipeMaps.alloyBlastSmelterRecipes.getDefaultRecipeCategory()) - .addTo(GTPPRecipeMaps.alloyBlastSmelterRecipes); - } else { - if (!enabled) { - Logger.MACHINE_INFO("[ABS] Failure. EBF recipe was not enabled."); - } else { - Logger.MACHINE_INFO("[ABS] Failure. Invalid Inputs or Outputs."); - if (inputs == null) { - Logger.MACHINE_INFO("[ABS] Inputs were not Valid."); - } else { - Logger.MACHINE_INFO("[ABS] inputs size: " + inputs.length); - } - if (outputs == null) { - Logger.MACHINE_INFO("[ABS] Outputs were not Valid."); - } else { - Logger.MACHINE_INFO("[ABS] outputs size: " + outputs.length); - } - if (inputsF == null) { - Logger.MACHINE_INFO("[ABS] Input Fluids were not Valid."); - } else { - Logger.MACHINE_INFO("[ABS] inputsF size: " + inputsF.length); - } - if (mMoltenStack == null) { - Logger.MACHINE_INFO("[ABS] Output Fluid were not Valid."); - } - } - } - } - } - - Logger.INFO("[ABS] Processed " + mSuccess + " recipes."); - return mSuccess > 0; - } -} diff --git a/gtpp/src/main/java/gtPlusPlus/xmod/gregtech/loaders/RecipeGen_DustGeneration.java b/gtpp/src/main/java/gtPlusPlus/xmod/gregtech/loaders/RecipeGen_DustGeneration.java deleted file mode 100644 index 1499ea3cad..0000000000 --- a/gtpp/src/main/java/gtPlusPlus/xmod/gregtech/loaders/RecipeGen_DustGeneration.java +++ /dev/null @@ -1,448 +0,0 @@ -package gtPlusPlus.xmod.gregtech.loaders; - -import java.util.HashSet; -import java.util.Set; - -import net.minecraft.item.ItemStack; -import net.minecraftforge.fluids.FluidStack; - -import gregtech.api.enums.GT_Values; -import gregtech.api.enums.ItemList; -import gregtech.api.util.GT_ModHandler; -import gregtech.api.util.GT_Utility; -import gtPlusPlus.api.interfaces.RunnableWithInfo; -import gtPlusPlus.api.objects.Logger; -import gtPlusPlus.api.objects.data.AutoMap; -import gtPlusPlus.core.lib.CORE; -import gtPlusPlus.core.material.Material; -import gtPlusPlus.core.material.MaterialGenerator; -import gtPlusPlus.core.material.MaterialStack; -import gtPlusPlus.core.material.state.MaterialState; -import gtPlusPlus.core.recipe.common.CI; -import gtPlusPlus.core.util.math.MathUtils; -import gtPlusPlus.core.util.minecraft.ItemUtils; -import gtPlusPlus.core.util.minecraft.RecipeUtils; - -public class RecipeGen_DustGeneration extends RecipeGen_Base { - - public static final Set<RunnableWithInfo<Material>> mRecipeGenMap = new HashSet<>(); - - static { - MaterialGenerator.mRecipeMapsToGenerate.put(mRecipeGenMap); - } - - public RecipeGen_DustGeneration(final Material M) { - this(M, false); - } - - public RecipeGen_DustGeneration(final Material M, final boolean O) { - this.toGenerate = M; - this.disableOptional = O; - mRecipeGenMap.add(this); - final ItemStack normalDust = M.getDust(1); - final ItemStack smallDust = M.getSmallDust(1); - final ItemStack tinyDust = M.getTinyDust(1); - if (tinyDust != null && normalDust != null) { - if (RecipeUtils.addShapedRecipe( - tinyDust, - tinyDust, - tinyDust, - tinyDust, - tinyDust, - tinyDust, - tinyDust, - tinyDust, - tinyDust, - normalDust)) { - Logger.INFO("9 Tiny dust to 1 Dust Recipe: " + M.getLocalizedName() + " - Success"); - } else { - Logger.INFO("9 Tiny dust to 1 Dust Recipe: " + M.getLocalizedName() + " - Failed"); - } - - if (RecipeUtils - .addShapedRecipe(normalDust, null, null, null, null, null, null, null, null, M.getTinyDust(9))) { - Logger.INFO("9 Tiny dust from 1 Recipe: " + M.getLocalizedName() + " - Success"); - } else { - Logger.INFO("9 Tiny dust from 1 Recipe: " + M.getLocalizedName() + " - Failed"); - } - } - - if (smallDust != null && normalDust != null) { - if (RecipeUtils.addShapedRecipe( - smallDust, - smallDust, - null, - smallDust, - smallDust, - null, - null, - null, - null, - normalDust)) { - Logger.INFO("4 Small dust to 1 Dust Recipe: " + M.getLocalizedName() + " - Success"); - } else { - Logger.INFO("4 Small dust to 1 Dust Recipe: " + M.getLocalizedName() + " - Failed"); - } - if (RecipeUtils - .addShapedRecipe(null, normalDust, null, null, null, null, null, null, null, M.getSmallDust(4))) { - Logger.INFO("4 Small dust from 1 Dust Recipe: " + M.getLocalizedName() + " - Success"); - } else { - Logger.INFO("4 Small dust from 1 Dust Recipe: " + M.getLocalizedName() + " - Failed"); - } - } - } - - @Override - public void run() { - generateRecipes(this.toGenerate, this.disableOptional); - } - - private void generateRecipes(final Material material, final boolean disableOptional) { - - Logger.INFO("Generating Shaped Crafting recipes for " + material.getLocalizedName()); - - final ItemStack normalDust = material.getDust(1); - final ItemStack smallDust = material.getSmallDust(1); - final ItemStack tinyDust = material.getTinyDust(1); - - final ItemStack[] inputStacks = material.getMaterialComposites(); - final ItemStack outputStacks = material.getDust(material.smallestStackSizeWhenProcessing); - - // Macerate blocks back to dusts. - final ItemStack materialBlock = material.getBlock(1); - final ItemStack materialFrameBox = material.getFrameBox(1); - - if (ItemUtils.checkForInvalidItems(materialBlock)) { - GT_ModHandler.addPulverisationRecipe(materialBlock, material.getDust(9)); - } - - if (ItemUtils.checkForInvalidItems(materialFrameBox)) { - GT_ModHandler.addPulverisationRecipe(materialFrameBox, material.getDust(2)); - } - - if (ItemUtils.checkForInvalidItems(smallDust) && ItemUtils.checkForInvalidItems(tinyDust)) { - generatePackagerRecipes(material); - } - - ItemStack ingot = material.getIngot(1); - if (ItemUtils.checkForInvalidItems(normalDust) && ItemUtils.checkForInvalidItems(ingot)) { - addFurnaceRecipe(material); - addMacerationRecipe(material); - } - - // Is this a composite? - if ((inputStacks != null) && !disableOptional) { - // Is this a composite? - Logger.WARNING("mixer length: " + inputStacks.length); - if ((inputStacks.length != 0) && (inputStacks.length <= 4)) { - // Log Input items - Logger.WARNING(ItemUtils.getArrayStackNames(inputStacks)); - final long[] inputStackSize = material.vSmallestRatio; - Logger.WARNING("mixer is stacksizeVar null? " + (inputStackSize != null)); - // Is smallest ratio invalid? - if (inputStackSize != null) { - // set stack sizes on an input ItemStack[] - for (short x = 0; x < inputStacks.length; x++) { - if ((inputStacks[x] != null) && (inputStackSize[x] != 0)) { - inputStacks[x].stackSize = (int) inputStackSize[x]; - } - } - // Relog input values, with stack sizes - Logger.WARNING(ItemUtils.getArrayStackNames(inputStacks)); - - // Get us four ItemStacks to input into the mixer - ItemStack[] input = new ItemStack[4]; - - input[0] = (inputStacks.length >= 1) ? ((inputStacks[0] == null) ? null : inputStacks[0]) : null; - input[1] = (inputStacks.length >= 2) ? ((inputStacks[1] == null) ? null : inputStacks[1]) : null; - input[2] = (inputStacks.length >= 3) ? ((inputStacks[2] == null) ? null : inputStacks[2]) : null; - input[3] = (inputStacks.length >= 4) ? ((inputStacks[3] == null) ? null : inputStacks[3]) : null; - - if (inputStacks.length == 1) { - input[1] = input[0]; - input[0] = CI.getNumberedCircuit(inputStacks.length + 10); - } else if (inputStacks.length == 2) { - input[2] = input[1]; - input[1] = input[0]; - input[0] = CI.getNumberedCircuit(inputStacks.length + 10); - - } else if (inputStacks.length == 3) { - input[3] = input[2]; - input[2] = input[1]; - input[1] = input[0]; - input[0] = CI.getNumberedCircuit(inputStacks.length + 10); - } - - /* - * for (int g = 0; g<4; g++) { if(inputStacks.length > g) { input[g] = inputStacks[g] != null ? - * inputStacks[g] : null; } else { input[g] = CI.getNumberedCircuit(g+10); break; } } - */ - - // Add mixer Recipe - FluidStack oxygen = GT_Values.NF; - if (material.getComposites() != null) { - for (final MaterialStack x : material.getComposites()) { - if (!material.getComposites() - .isEmpty()) { - if (x != null) { - if (x.getStackMaterial() != null) { - if (x.getStackMaterial() - .getDust(1) == null) { - if (x.getStackMaterial() - .getState() != MaterialState.SOLID - && x.getStackMaterial() - .getState() != MaterialState.ORE - && x.getStackMaterial() - .getState() != MaterialState.PLASMA) { - oxygen = x.getStackMaterial() - .getFluidStack(1000); - break; - } - } - } - } - } - } - } - - input = ItemUtils.cleanItemStackArray(input); - - // Add mixer Recipe - if (GT_Values.RA.addMixerRecipe( - input[0], - input[1], - input[2], - input[3], - oxygen, - null, - outputStacks, - (int) Math.max(material.getMass() * 2L * 1, 1), - material.vVoltageMultiplier)) // Was 6, but let's try 2. This makes Potin LV, for example. - { - Logger.WARNING("Dust Mixer Recipe: " + material.getLocalizedName() + " - Success"); - } else { - Logger.WARNING("Dust Mixer Recipe: " + material.getLocalizedName() + " - Failed"); - } - - // Add Shapeless recipe for low tier alloys. - /* - * if (tVoltageMultiplier <= 30){ if (RecipeUtils.addShapedGregtechRecipe(inputStacks, - * outputStacks)){ - * Logger.WARNING("Dust Shapeless Recipe: "+material.getLocalizedName()+" - Success"); } else { - * Logger.WARNING("Dust Shapeless Recipe: "+material.getLocalizedName()+" - Failed"); } } - */ - } - } - } - } - - public static boolean addMixerRecipe_Standalone(final Material material) { - final ItemStack[] inputStacks = material.getMaterialComposites(); - final ItemStack outputStacks = material.getDust(material.smallestStackSizeWhenProcessing); - // Is this a composite? - if ((inputStacks != null)) { - // Is this a composite? - Logger.WARNING("mixer length: " + inputStacks.length); - if ((inputStacks.length >= 1) && (inputStacks.length <= 4)) { - // Log Input items - Logger.WARNING(ItemUtils.getArrayStackNames(inputStacks)); - final long[] inputStackSize = material.vSmallestRatio; - Logger.WARNING("mixer is stacksizeVar not null? " + (inputStackSize != null)); - // Is smallest ratio invalid? - if (inputStackSize != null) { - // set stack sizes on an input ItemStack[] - for (short x = 0; x < inputStacks.length; x++) { - if ((inputStacks[x] != null) && (inputStackSize[x] != 0)) { - inputStacks[x].stackSize = (int) inputStackSize[x]; - } - } - // Relog input values, with stack sizes - Logger.WARNING(ItemUtils.getArrayStackNames(inputStacks)); - - // Get us four ItemStacks to input into the mixer - ItemStack input1, input2, input3, input4; - input1 = inputStacks[0]; - input2 = (inputStacks.length >= 2) ? (input2 = (inputStacks[1] == null) ? null : inputStacks[1]) - : null; - input3 = (inputStacks.length >= 3) ? (input3 = (inputStacks[2] == null) ? null : inputStacks[2]) - : null; - input4 = (inputStacks.length >= 4) ? (input4 = (inputStacks[3] == null) ? null : inputStacks[3]) - : null; - - if (inputStacks.length == 1) { - input2 = input1; - input1 = CI.getNumberedCircuit(20); - } else if (inputStacks.length == 2) { - input3 = input2; - input2 = input1; - input1 = CI.getNumberedCircuit(20); - - } else if (inputStacks.length == 3) { - input4 = input3; - input3 = input2; - input2 = input1; - input1 = CI.getNumberedCircuit(20); - } - - // Add mixer Recipe - FluidStack oxygen = GT_Values.NF; - if (material.getComposites() != null) { - int compSlot = 0; - for (final MaterialStack x : material.getComposites()) { - if (!material.getComposites() - .isEmpty()) { - if (x != null) { - if (x.getStackMaterial() != null) { - if (x.getStackMaterial() - .getDust(1) == null) { - MaterialState f = x.getStackMaterial() - .getState(); - if (f == MaterialState.GAS || f == MaterialState.LIQUID - || f == MaterialState.PURE_LIQUID - || f == MaterialState.PURE_GAS) { - oxygen = x.getStackMaterial() - .getFluidStack((int) (material.vSmallestRatio[compSlot] * 1000)); - } - } - } - } - } - compSlot++; - } - } - - // Add mixer Recipe - try { - if (GT_Values.RA.addMixerRecipe( - input1, - input2, - input3, - input4, - oxygen, - null, - outputStacks, - (int) Math.max(material.getMass() * 2L * 1, 1), - material.vVoltageMultiplier)) // Was 6, but let's try 2. This makes Potin LV, for - // example. - { - Logger.WARNING("Dust Mixer Recipe: " + material.getLocalizedName() + " - Success"); - return true; - } else { - Logger.WARNING("Dust Mixer Recipe: " + material.getLocalizedName() + " - Failed"); - return false; - } - } catch (Throwable t) { - t.printStackTrace(); - } - } else { - Logger.WARNING("inputStackSize == NUll - " + material.getLocalizedName()); - } - } else { - Logger.WARNING("InputStacks is out range 1-4 - " + material.getLocalizedName()); - } - } else { - Logger.WARNING("InputStacks == NUll - " + material.getLocalizedName()); - } - return false; - } - - public static boolean generatePackagerRecipes(Material aMatInfo) { - AutoMap<Boolean> aResults = new AutoMap<>(); - // Small Dust - aResults.put( - GT_Values.RA.addBoxingRecipe( - GT_Utility.copyAmount(4L, new Object[] { aMatInfo.getSmallDust(4) }), - ItemList.Schematic_Dust.get(0L, new Object[0]), - aMatInfo.getDust(1), - 100, - 4)); - // Tiny Dust - aResults.put( - GT_Values.RA.addBoxingRecipe( - GT_Utility.copyAmount(9L, new Object[] { aMatInfo.getTinyDust(9) }), - ItemList.Schematic_Dust.get(0L, new Object[0]), - aMatInfo.getDust(1), - 100, - 4)); - - for (boolean b : aResults) { - if (!b) { - return false; - } - } - return true; - } - - private void addMacerationRecipe(Material aMatInfo) { - try { - Logger.MATERIALS("Adding Maceration recipe for " + aMatInfo.getLocalizedName() + " Ingot -> Dusts"); - final int chance = (aMatInfo.vTier * 10) / MathUtils.randInt(10, 20); - GT_ModHandler.addPulverisationRecipe(aMatInfo.getIngot(1), aMatInfo.getDust(1), null, chance); - } catch (Throwable t) { - t.printStackTrace(); - } - } - - private void addFurnaceRecipe(Material aMatInfo) { - - ItemStack aDust = aMatInfo.getDust(1); - ItemStack aOutput; - try { - if (aMatInfo.requiresBlastFurnace()) { - aOutput = aMatInfo.getHotIngot(1); - if (ItemUtils.checkForInvalidItems(aOutput)) { - if (addBlastFurnaceRecipe(aMatInfo, aDust, null, aOutput, null, aMatInfo.getMeltingPointK())) { - Logger - .MATERIALS("Successfully added a blast furnace recipe for " + aMatInfo.getLocalizedName()); - } else { - Logger.MATERIALS("Failed to add a blast furnace recipe for " + aMatInfo.getLocalizedName()); - } - } else { - Logger.MATERIALS("Failed to add a blast furnace recipe for " + aMatInfo.getLocalizedName()); - } - } else { - aOutput = aMatInfo.getIngot(1); - if (ItemUtils.checkForInvalidItems(aOutput)) { - if (CORE.RA.addSmeltingAndAlloySmeltingRecipe(aDust, aOutput)) { - Logger.MATERIALS("Successfully added a furnace recipe for " + aMatInfo.getLocalizedName()); - } else { - Logger.MATERIALS("Failed to add a furnace recipe for " + aMatInfo.getLocalizedName()); - } - } - } - } catch (Throwable t) { - t.printStackTrace(); - } - } - - private boolean addBlastFurnaceRecipe(Material aMatInfo, final ItemStack input1, final ItemStack input2, - final ItemStack output1, final ItemStack output2, final int tempRequired) { - - try { - int timeTaken = 125 * aMatInfo.vTier * 10; - - if (aMatInfo.vTier <= 4) { - timeTaken = 25 * aMatInfo.vTier * 10; - } - int aSlot = aMatInfo.vTier; - if (aSlot < 2) { - aSlot = 2; - } - long aVoltage = aMatInfo.vVoltageMultiplier; - - return GT_Values.RA.addBlastRecipe( - input1, - input2, - GT_Values.NF, - GT_Values.NF, - output1, - output2, - timeTaken, - (int) aVoltage, - tempRequired); - } catch (Throwable t) { - t.printStackTrace(); - return false; - } - } -} diff --git a/gtpp/src/main/java/gtPlusPlus/xmod/gregtech/loaders/RecipeGen_Extruder.java b/gtpp/src/main/java/gtPlusPlus/xmod/gregtech/loaders/RecipeGen_Extruder.java deleted file mode 100644 index a69a96b925..0000000000 --- a/gtpp/src/main/java/gtPlusPlus/xmod/gregtech/loaders/RecipeGen_Extruder.java +++ /dev/null @@ -1,159 +0,0 @@ -package gtPlusPlus.xmod.gregtech.loaders; - -import java.util.HashSet; -import java.util.Set; - -import net.minecraft.item.ItemStack; - -import gregtech.api.enums.GT_Values; -import gregtech.api.enums.ItemList; -import gtPlusPlus.api.interfaces.RunnableWithInfo; -import gtPlusPlus.api.objects.Logger; -import gtPlusPlus.core.material.Material; -import gtPlusPlus.core.material.MaterialGenerator; -import gtPlusPlus.core.util.minecraft.ItemUtils; - -public class RecipeGen_Extruder extends RecipeGen_Base { - - public static final Set<RunnableWithInfo<Material>> mRecipeGenMap = new HashSet<>(); - - static { - MaterialGenerator.mRecipeMapsToGenerate.put(mRecipeGenMap); - } - - public RecipeGen_Extruder(final Material M) { - this.toGenerate = M; - mRecipeGenMap.add(this); - } - - @Override - public void run() { - generateRecipes(this.toGenerate); - } - - private void generateRecipes(final Material material) { - - final ItemStack itemIngot = material.getIngot(1); - final ItemStack itemPlate = material.getPlate(1); - final ItemStack itemGear = material.getGear(1); - - final ItemStack shape_Plate = ItemList.Shape_Extruder_Plate.get(0); - final ItemStack shape_Ring = ItemList.Shape_Extruder_Ring.get(0); - final ItemStack shape_Gear = ItemList.Shape_Extruder_Gear.get(0); - final ItemStack shape_Rod = ItemList.Shape_Extruder_Rod.get(0); - final ItemStack shape_Bolt = ItemList.Shape_Extruder_Bolt.get(0); - final ItemStack shape_Block = ItemList.Shape_Extruder_Block.get(0); - final ItemStack shape_Ingot = ItemList.Shape_Extruder_Ingot.get(0); - - Logger.WARNING("Generating Extruder recipes for " + material.getLocalizedName()); - - if (ItemUtils.checkForInvalidItems(material.getIngot(1)) - && ItemUtils.checkForInvalidItems(material.getBlock(1))) { - // Ingot Recipe - if (GT_Values.RA.addExtruderRecipe( - material.getBlock(1), - shape_Ingot, - material.getIngot(9), - (int) Math.max(material.getMass() * 2L * 1, 1), - material.vVoltageMultiplier)) { - Logger.WARNING("Extruder Ingot Recipe: " + material.getLocalizedName() + " - Success"); - } else { - Logger.WARNING("Extruder Ingot Recipe: " + material.getLocalizedName() + " - Failed"); - } - - // Block Recipe - if (GT_Values.RA.addExtruderRecipe( - material.getIngot(9), - shape_Block, - material.getBlock(1), - (int) Math.max(material.getMass() * 2L * 1, 1), - material.vVoltageMultiplier)) { - Logger.WARNING("Extruder Block Recipe: " + material.getLocalizedName() + " - Success"); - } else { - Logger.WARNING("Extruder Block Recipe: " + material.getLocalizedName() + " - Failed"); - } - } - - // Plate Recipe - if (ItemUtils.checkForInvalidItems(material.getIngot(1)) - && ItemUtils.checkForInvalidItems(material.getPlate(1))) - if (GT_Values.RA.addExtruderRecipe(itemIngot, shape_Plate, itemPlate, 10, material.vVoltageMultiplier)) { - Logger.WARNING("Extruder Plate Recipe: " + material.getLocalizedName() + " - Success"); - } else { - Logger.WARNING("Extruder Plate Recipe: " + material.getLocalizedName() + " - Failed"); - } - - // Ring Recipe - if (ItemUtils.checkForInvalidItems(material.getIngot(1)) && ItemUtils.checkForInvalidItems(material.getRing(1))) - if (!material.isRadioactive) { - if (GT_Values.RA.addExtruderRecipe( - itemIngot, - shape_Ring, - material.getRing(4), - (int) Math.max(material.getMass() * 2L * 1, 1), - material.vVoltageMultiplier)) { - Logger.WARNING("Extruder Ring Recipe: " + material.getLocalizedName() + " - Success"); - } else { - Logger.WARNING("Extruder Ring Recipe: " + material.getLocalizedName() + " - Failed"); - } - } - - // Gear Recipe - if (ItemUtils.checkForInvalidItems(material.getIngot(1)) && ItemUtils.checkForInvalidItems(material.getGear(1))) - if (!material.isRadioactive) { - if (GT_Values.RA.addExtruderRecipe( - material.getIngot(4), - shape_Gear, - itemGear, - (int) Math.max(material.getMass() * 5L, 1), - material.vVoltageMultiplier)) { - Logger.WARNING("Extruder Gear Recipe: " + material.getLocalizedName() + " - Success"); - } else { - Logger.WARNING("Extruder Gear Recipe: " + material.getLocalizedName() + " - Failed"); - } - } - - // Rod Recipe - if (ItemUtils.checkForInvalidItems(material.getIngot(1)) && ItemUtils.checkForInvalidItems(material.getRod(1))) - if (GT_Values.RA.addExtruderRecipe( - itemIngot, - shape_Rod, - material.getRod(2), - (int) Math.max(material.getMass() * 2L * 1, 1), - material.vVoltageMultiplier)) { - Logger.WARNING("Extruder Rod Recipe: " + material.getLocalizedName() + " - Success"); - } else { - Logger.WARNING("Extruder Rod Recipe: " + material.getLocalizedName() + " - Failed"); - } - - // Bolt Recipe - if (ItemUtils.checkForInvalidItems(material.getIngot(1)) && ItemUtils.checkForInvalidItems(material.getBolt(1))) - if (!material.isRadioactive) { - if (GT_Values.RA.addExtruderRecipe( - itemIngot, - shape_Bolt, - material.getBolt(8), - (int) Math.max(material.getMass() * 2L * 1, 1), - material.vVoltageMultiplier)) { - Logger.WARNING("Extruder Bolt Recipe: " + material.getLocalizedName() + " - Success"); - } else { - Logger.WARNING("Extruder Bolt Recipe: " + material.getLocalizedName() + " - Failed"); - } - } - - // Rotor Recipe - // Shape_Extruder_Rotor - if (ItemUtils.checkForInvalidItems(material.getIngot(1)) - && ItemUtils.checkForInvalidItems(material.getRotor(1))) - if (GT_Values.RA.addExtruderRecipe( - material.getIngot(5), - ItemList.Shape_Extruder_Rotor.get(0), - material.getRotor(1), - (int) Math.max(material.getMass() * 5L * 1, 1), - material.vVoltageMultiplier)) { - Logger.WARNING("Extruder Rotor Recipe: " + material.getLocalizedName() + " - Success"); - } else { - Logger.WARNING("Extruder Rotor Recipe: " + material.getLocalizedName() + " - Failed"); - } - } -} diff --git a/gtpp/src/main/java/gtPlusPlus/xmod/gregtech/loaders/RecipeGen_FluidCanning.java b/gtpp/src/main/java/gtPlusPlus/xmod/gregtech/loaders/RecipeGen_FluidCanning.java deleted file mode 100644 index fb6dc807ef..0000000000 --- a/gtpp/src/main/java/gtPlusPlus/xmod/gregtech/loaders/RecipeGen_FluidCanning.java +++ /dev/null @@ -1,222 +0,0 @@ -package gtPlusPlus.xmod.gregtech.loaders; - -import java.util.HashSet; - -import net.minecraft.item.ItemStack; -import net.minecraftforge.fluids.FluidStack; - -import gregtech.api.enums.GT_Values; -import gregtech.api.recipe.RecipeMap; -import gregtech.api.recipe.RecipeMaps; -import gregtech.api.util.GT_Recipe; -import gtPlusPlus.api.interfaces.RunnableWithInfo; -import gtPlusPlus.api.objects.Logger; -import gtPlusPlus.core.lib.CORE; -import gtPlusPlus.core.util.minecraft.ItemUtils; -import gtPlusPlus.core.util.reflect.ReflectionUtils; - -public class RecipeGen_FluidCanning implements Runnable { - - public static void init() { - FluidCanningRunnableHandler x = new FluidCanningRunnableHandler(); - x.run(); - } - - private static class FluidCanningRunnableHandler implements RunnableWithInfo<String> { - - @Override - public void run() { - mHasRun = true; - for (RecipeGen_FluidCanning aRecipe : mCache) { - aRecipe.run(); - } - } - - @Override - public String getInfoData() { - return "Fluid Canning Recipes"; - } - } - - private static boolean mHasRun = false; - - private static HashSet<RecipeGen_FluidCanning> mCache = new HashSet<>(); - - private static void addRunnableToRecipeCache(RecipeGen_FluidCanning r) { - if (mHasRun) { - CORE.crash(); - } - mCache.add(r); - } - - protected boolean disableOptional; - - private final GT_Recipe recipe; - private final boolean isValid; - - public boolean valid() { - return isValid; - } - - // Alternative Constructor - public RecipeGen_FluidCanning(boolean aExtracting, ItemStack aEmpty, ItemStack aFull, FluidStack aFluidIn, - FluidStack aFluidOut, Integer aDuration, Integer aEUt) { - ItemStack aInput; - ItemStack aOutput; - FluidStack aFluidInput; - FluidStack aFluidOutput; - - // Safety check on the duration - if (aDuration == null || aDuration <= 0) { - aDuration = (aFluidIn != null) ? (aFluidIn.amount / 62) - : ((aFluidOut != null) ? (aFluidOut.amount / 62) : 10); - } - - // Safety check on the EU - if (aEUt == null || aEUt <= 0) { - if (aExtracting) { - aEUt = 2; - } else { - aEUt = 1; - } - } - - // Set Item stacks correctly, invert if extraction recipe. - if (aExtracting) { - aInput = aFull; - aOutput = aEmpty; - aFluidInput = GT_Values.NF; - aFluidOutput = aFluidIn; - } else { - aInput = aEmpty; - aOutput = aFull; - aFluidInput = aFluidIn; - aFluidOutput = aFluidOut != null ? aFluidOut : GT_Values.NF; - } - - // Check validity - - GT_Recipe aRecipe = new GT_Recipe( - true, - new ItemStack[] { aInput }, - new ItemStack[] { aOutput }, - null, - new int[] { 10000 }, - new FluidStack[] { aFluidInput }, - new FluidStack[] { aFluidOutput }, - aDuration, - aEUt, - 0); - - // Check Valid - boolean aTempValidityCheck = false; - // Logger.INFO("Validity Check."); - if (aExtracting) { - Logger.INFO("Extracting."); - if (aInput != null && aFluidOutput != null) { - // Logger.INFO("Pass."); - aTempValidityCheck = true; - } - } else { - // Logger.INFO("Canning."); - if (aInput != null && aOutput != null && (aFluidInput != null || aFluidOutput != null)) { - // Logger.INFO("Pass."); - aTempValidityCheck = true; - } - } - - if (aTempValidityCheck) { - // Valid Recipe - recipe = aRecipe; - disableOptional = aExtracting; - isValid = true; - addRunnableToRecipeCache(this); - } else { - // Logger.INFO("Failed Validity Check."); - isValid = false; - disableOptional = aExtracting; - aRecipe.mEnabled = false; - aRecipe.mHidden = true; - recipe = null; - } - } - - @Override - public void run() { - Logger.INFO("Processing Recipe with Hash: " + recipe.hashCode()); - generateRecipes(); - } - - private void generateRecipes() { - if (isValid && recipe != null) { - if (this.disableOptional) { - addFluidExtractionRecipe(recipe); - } else { - addFluidCannerRecipe(recipe); - } - } - } - - private void addFluidExtractionRecipe(GT_Recipe aRecipe) { - CORE.crash(); - Logger.INFO( - "[FE-Debug] " + aRecipe.mFluidOutputs[0].amount - + "L of " - + aRecipe.mFluidOutputs[0].getLocalizedName() - + " fluid extractor from 1 " - + aRecipe.mInputs[0].getDisplayName() - + " - Success. Time: " - + aRecipe.mDuration - + ", Voltage: " - + aRecipe.mEUt); - int aCount1 = getMapSize(RecipeMaps.fluidExtractionRecipes); - int aCount2 = aCount1; - RecipeMaps.fluidExtractionRecipes.addRecipe(aRecipe); - aCount1 = getMapSize(RecipeMaps.fluidExtractionRecipes); - if (aCount1 <= aCount2) { - Logger.INFO( - "[ERROR] Failed adding Extraction recipe for " + ItemUtils.getArrayStackNames(aRecipe.mInputs) - + ", " - + ItemUtils.getArrayStackNames(aRecipe.mOutputs) - + ", " - + ItemUtils.getArrayStackNames(aRecipe.mFluidInputs) - + ", " - + ItemUtils.getArrayStackNames(aRecipe.mFluidOutputs)); - dumpStack(); - } - } - - private void addFluidCannerRecipe(GT_Recipe aRecipe) { - boolean result; - int aCount1 = getMapSize(RecipeMaps.fluidCannerRecipes); - int aCount2 = aCount1; - RecipeMaps.fluidCannerRecipes.addRecipe(aRecipe); - aCount1 = getMapSize(RecipeMaps.fluidCannerRecipes); - if (aCount1 <= aCount2) { - Logger.INFO( - "[ERROR] Failed adding Canning recipe for " + ItemUtils.getArrayStackNames(aRecipe.mInputs) - + ", " - + ItemUtils.getArrayStackNames(aRecipe.mOutputs) - + ", " - + ItemUtils.getArrayStackNames(aRecipe.mFluidInputs) - + ", " - + ItemUtils.getArrayStackNames(aRecipe.mFluidOutputs)); - dumpStack(); - } - } - - private void dumpStack() { - int parents = 2; - for (int i = 0; i < 6; i++) { - Logger.INFO( - (disableOptional ? "EXTRACTING" : "CANNING") + " DEBUG | " - + (i == 0 ? "Called from: " : "Parent: ") - + ReflectionUtils.getMethodName(i + parents)); - } - } - - private int getMapSize(RecipeMap<?> aMap) { - return aMap.getAllRecipes() - .size(); - } -} diff --git a/gtpp/src/main/java/gtPlusPlus/xmod/gregtech/loaders/RecipeGen_Fluids.java b/gtpp/src/main/java/gtPlusPlus/xmod/gregtech/loaders/RecipeGen_Fluids.java deleted file mode 100644 index dd0c1b505c..0000000000 --- a/gtpp/src/main/java/gtPlusPlus/xmod/gregtech/loaders/RecipeGen_Fluids.java +++ /dev/null @@ -1,212 +0,0 @@ -package gtPlusPlus.xmod.gregtech.loaders; - -import java.util.HashSet; -import java.util.Set; - -import gregtech.api.enums.GT_Values; -import gregtech.api.enums.ItemList; -import gtPlusPlus.api.interfaces.RunnableWithInfo; -import gtPlusPlus.api.objects.Logger; -import gtPlusPlus.core.material.Material; -import gtPlusPlus.core.material.MaterialGenerator; -import gtPlusPlus.core.util.minecraft.ItemUtils; - -public class RecipeGen_Fluids extends RecipeGen_Base { - - public static final Set<RunnableWithInfo<Material>> mRecipeGenMap = new HashSet<>(); - - static { - MaterialGenerator.mRecipeMapsToGenerate.put(mRecipeGenMap); - } - - public RecipeGen_Fluids(final Material M) { - this(M, false); - } - - public RecipeGen_Fluids(final Material M, final boolean dO) { - this.toGenerate = M; - this.disableOptional = dO; - mRecipeGenMap.add(this); - } - - @Override - public void run() { - generateRecipes(this.toGenerate, this.disableOptional); - } - - private void generateRecipes(final Material material, final boolean dO) { - - if (material == null) { - return; - } - - // Melting Shapes to fluid - if (material.getFluidStack(1) != null && !material.getFluidStack(1) - .getUnlocalizedName() - .toLowerCase() - .contains("plasma")) { - - // Making Shapes from fluid - - // Ingot - if (ItemUtils.checkForInvalidItems(material.getIngot(1))) if (GT_Values.RA.addFluidSolidifierRecipe( - ItemList.Shape_Mold_Ingot.get(0), // Item Shape - material.getFluidStack(144), // Fluid Input - material.getIngot(1), // output - 32, // Duration - material.vVoltageMultiplier // Eu Tick - )) { - Logger.WARNING("144l fluid molder for 1 ingot Recipe: " + material.getLocalizedName() + " - Success"); - } else { - Logger.WARNING("144l fluid molder for 1 ingot Recipe: " + material.getLocalizedName() + " - Failed"); - } - - // Plate - if (ItemUtils.checkForInvalidItems(material.getPlate(1))) if (GT_Values.RA.addFluidSolidifierRecipe( - ItemList.Shape_Mold_Plate.get(0), // Item Shape - material.getFluidStack(144), // Fluid Input - material.getPlate(1), // output - 32, // Duration - material.vVoltageMultiplier // Eu Tick - )) { - Logger.WARNING("144l fluid molder for 1 plate Recipe: " + material.getLocalizedName() + " - Success"); - } else { - Logger.WARNING("144l fluid molder for 1 plate Recipe: " + material.getLocalizedName() + " - Failed"); - } - - // Nugget - if (ItemUtils.checkForInvalidItems(material.getNugget(1))) if (GT_Values.RA.addFluidSolidifierRecipe( - ItemList.Shape_Mold_Nugget.get(0), // Item Shape - material.getFluidStack(16), // Fluid Input - material.getNugget(1), // output - 16, // Duration - material.vVoltageMultiplier // Eu Tick - )) { - Logger.WARNING("16l fluid molder for 1 nugget Recipe: " + material.getLocalizedName() + " - Success"); - } else { - Logger.WARNING("16l fluid molder for 1 nugget Recipe: " + material.getLocalizedName() + " - Failed"); - } - - // Gears - if (ItemUtils.checkForInvalidItems(material.getGear(1))) if (GT_Values.RA.addFluidSolidifierRecipe( - ItemList.Shape_Mold_Gear.get(0), // Item Shape - material.getFluidStack(576), // Fluid Input - material.getGear(1), // output - 128, // Duration - material.vVoltageMultiplier // Eu Tick - )) { - Logger.WARNING("576l fluid molder for 1 gear Recipe: " + material.getLocalizedName() + " - Success"); - } else { - Logger.WARNING("576l fluid molder for 1 gear Recipe: " + material.getLocalizedName() + " - Failed"); - } - - // Blocks - if (ItemUtils.checkForInvalidItems(material.getBlock(1))) if (GT_Values.RA.addFluidSolidifierRecipe( - ItemList.Shape_Mold_Block.get(0), // Item Shape - material.getFluidStack(144 * 9), // Fluid Input - material.getBlock(1), // output - 288, // Duration - material.vVoltageMultiplier // Eu Tick - )) { - Logger.WARNING( - (144 * 9) + "l fluid molder from 1 block Recipe: " + material.getLocalizedName() + " - Success"); - } else { - Logger.WARNING( - (144 * 9) + "l fluid molder from 1 block Recipe: " + material.getLocalizedName() + " - Failed"); - } - - // GTNH - - // Rod - if (ItemUtils.checkForInvalidItems(material.getRod(1))) if (GT_Values.RA.addFluidSolidifierRecipe( - ItemList.Shape_Mold_Rod.get(0), // Item Shape - material.getFluidStack(72), // Fluid Input - material.getRod(1), // output - 150, // Duration - material.vVoltageMultiplier // Eu Tick - )) { - Logger.WARNING( - (144 * 9) + "l fluid molder from 1 rod Recipe: " + material.getLocalizedName() + " - Success"); - } else { - Logger.WARNING( - (144 * 9) + "l fluid molder from 1 rod Recipe: " + material.getLocalizedName() + " - Failed"); - } - - // Rod Long - if (ItemUtils.checkForInvalidItems(material.getLongRod(1))) if (GT_Values.RA.addFluidSolidifierRecipe( - ItemList.Shape_Mold_Rod_Long.get(0), // Item - // Shape - material.getFluidStack(144), // Fluid Input - material.getLongRod(1), // output - 300, // Duration - material.vVoltageMultiplier // Eu Tick - )) { - Logger.WARNING( - (144 * 9) + "l fluid molder from 1 rod long Recipe: " + material.getLocalizedName() + " - Success"); - } else { - Logger.WARNING( - (144 * 9) + "l fluid molder from 1 rod long Recipe: " + material.getLocalizedName() + " - Failed"); - } - - // Bolt - if (ItemUtils.checkForInvalidItems(material.getBolt(1))) if (GT_Values.RA.addFluidSolidifierRecipe( - ItemList.Shape_Mold_Bolt.get(0), // Item Shape - material.getFluidStack(18), // Fluid Input - material.getBolt(1), // output - 50, // Duration - material.vVoltageMultiplier // Eu Tick - )) { - Logger.WARNING( - (144 * 9) + "l fluid molder from 1 bolt Recipe: " + material.getLocalizedName() + " - Success"); - } else { - Logger.WARNING( - (144 * 9) + "l fluid molder from 1 bolt Recipe: " + material.getLocalizedName() + " - Failed"); - } - - // Screw - if (ItemUtils.checkForInvalidItems(material.getScrew(1))) if (GT_Values.RA.addFluidSolidifierRecipe( - ItemList.Shape_Mold_Screw.get(0), // Item Shape - material.getFluidStack(18), // Fluid Input - material.getScrew(1), // output - 50, // Duration - material.vVoltageMultiplier // Eu Tick - )) { - Logger.WARNING( - (144 * 9) + "l fluid molder from 1 screw Recipe: " + material.getLocalizedName() + " - Success"); - } else { - Logger.WARNING( - (144 * 9) + "l fluid molder from 1 screw Recipe: " + material.getLocalizedName() + " - Failed"); - } - - // Ring - if (ItemUtils.checkForInvalidItems(material.getRing(1))) if (GT_Values.RA.addFluidSolidifierRecipe( - ItemList.Shape_Mold_Ring.get(0), // Item Shape - material.getFluidStack(36), // Fluid Input - material.getRing(1), // output - 100, // Duration - material.vVoltageMultiplier // Eu Tick - )) { - Logger.WARNING( - (144 * 9) + "l fluid molder from 1 ring Recipe: " + material.getLocalizedName() + " - Success"); - } else { - Logger.WARNING( - (144 * 9) + "l fluid molder from 1 ring Recipe: " + material.getLocalizedName() + " - Failed"); - } - - // Rotor - if (ItemUtils.checkForInvalidItems(material.getRotor(1))) if (GT_Values.RA.addFluidSolidifierRecipe( - ItemList.Shape_Mold_Rotor.get(0), // Item Shape - material.getFluidStack(612), // Fluid Input - material.getRotor(1), // output - 100, // Duration - material.vVoltageMultiplier // Eu Tick - )) { - Logger.WARNING( - (144 * 9) + "l fluid molder from 1 rotor Recipe: " + material.getLocalizedName() + " - Success"); - } else { - Logger.WARNING( - (144 * 9) + "l fluid molder from 1 rotor Recipe: " + material.getLocalizedName() + " - Failed"); - } - } - } -} diff --git a/gtpp/src/main/java/gtPlusPlus/xmod/gregtech/loaders/RecipeGen_Fluorite.java b/gtpp/src/main/java/gtPlusPlus/xmod/gregtech/loaders/RecipeGen_Fluorite.java deleted file mode 100644 index a3ba819fb6..0000000000 --- a/gtpp/src/main/java/gtPlusPlus/xmod/gregtech/loaders/RecipeGen_Fluorite.java +++ /dev/null @@ -1,267 +0,0 @@ -package gtPlusPlus.xmod.gregtech.loaders; - -import java.util.HashSet; -import java.util.Set; - -import net.minecraft.item.ItemStack; -import net.minecraftforge.fluids.FluidStack; - -import gregtech.api.enums.GT_Values; -import gregtech.api.util.GT_ModHandler; -import gtPlusPlus.api.interfaces.RunnableWithInfo; -import gtPlusPlus.api.objects.Logger; -import gtPlusPlus.core.lib.CORE; -import gtPlusPlus.core.material.Material; -import gtPlusPlus.core.material.MaterialGenerator; -import gtPlusPlus.core.material.nuclear.FLUORIDES; -import gtPlusPlus.core.recipe.common.CI; -import gtPlusPlus.core.util.minecraft.FluidUtils; -import gtPlusPlus.core.util.minecraft.ItemUtils; -import gtPlusPlus.core.util.minecraft.MaterialUtils; -import gtPlusPlus.core.util.minecraft.RecipeUtils; - -public class RecipeGen_Fluorite extends RecipeGen_Base { - - public static final Set<RunnableWithInfo<Material>> mRecipeGenMap = new HashSet<>(); - - static { - MaterialGenerator.mRecipeMapsToGenerate.put(mRecipeGenMap); - } - - public RecipeGen_Fluorite(final Material material) { - this.toGenerate = material; - mRecipeGenMap.add(this); - - /** - * Shaped Crafting - */ - RecipeUtils.addShapedRecipe( - CI.craftingToolHammer_Hard, - null, - null, - material.getCrushedPurified(1), - null, - null, - null, - null, - null, - material.getDustPurified(1)); - - RecipeUtils.addShapedRecipe( - CI.craftingToolHammer_Hard, - null, - null, - material.getCrushed(1), - null, - null, - null, - null, - null, - material.getDustImpure(1)); - - RecipeUtils.addShapedRecipe( - CI.craftingToolHammer_Hard, - null, - null, - material.getCrushedCentrifuged(1), - null, - null, - null, - null, - null, - material.getDust(1)); - - final ItemStack normalDust = material.getDust(1); - final ItemStack smallDust = material.getSmallDust(1); - final ItemStack tinyDust = material.getTinyDust(1); - - if (RecipeUtils.addShapedRecipe( - tinyDust, - tinyDust, - tinyDust, - tinyDust, - tinyDust, - tinyDust, - tinyDust, - tinyDust, - tinyDust, - normalDust)) { - Logger.WARNING("9 Tiny dust to 1 Dust Recipe: " + material.getLocalizedName() + " - Success"); - } else { - Logger.WARNING("9 Tiny dust to 1 Dust Recipe: " + material.getLocalizedName() + " - Failed"); - } - - if (RecipeUtils - .addShapedRecipe(normalDust, null, null, null, null, null, null, null, null, material.getTinyDust(9))) { - Logger.WARNING("9 Tiny dust from 1 Recipe: " + material.getLocalizedName() + " - Success"); - } else { - Logger.WARNING("9 Tiny dust from 1 Recipe: " + material.getLocalizedName() + " - Failed"); - } - - if (RecipeUtils - .addShapedRecipe(smallDust, smallDust, null, smallDust, smallDust, null, null, null, null, normalDust)) { - Logger.WARNING("4 Small dust to 1 Dust Recipe: " + material.getLocalizedName() + " - Success"); - } else { - Logger.WARNING("4 Small dust to 1 Dust Recipe: " + material.getLocalizedName() + " - Failed"); - } - - if (RecipeUtils - .addShapedRecipe(null, normalDust, null, null, null, null, null, null, null, material.getSmallDust(4))) { - Logger.WARNING("4 Small dust from 1 Dust Recipe: " + material.getLocalizedName() + " - Success"); - } else { - Logger.WARNING("4 Small dust from 1 Dust Recipe: " + material.getLocalizedName() + " - Failed"); - } - } - - @Override - public void run() { - generateRecipes(this.toGenerate); - } - - public static void generateRecipes(final Material material) { - - int tVoltageMultiplier = MaterialUtils.getVoltageForTier(material.vTier); - - final ItemStack dustStone = ItemUtils.getItemStackOfAmountFromOreDict("dustStone", 1); - - ItemStack tinyDustA = FLUORIDES.FLUORITE.getTinyDust(1); - ItemStack tinyDustB = FLUORIDES.FLUORITE.getTinyDust(1); - ItemStack matDust = FLUORIDES.FLUORITE.getDust(1); - ItemStack matDustA = FLUORIDES.FLUORITE.getDust(1); - - /** - * Package - */ - // Allow ore dusts to be packaged - if (ItemUtils.checkForInvalidItems(material.getSmallDust(1)) - && ItemUtils.checkForInvalidItems(material.getTinyDust(1))) { - RecipeGen_DustGeneration.generatePackagerRecipes(material); - } - - /** - * Macerate - */ - // Macerate ore to Crushed - if (GT_Values.RA.addPulveriserRecipe( - material.getOre(1), - new ItemStack[] { material.getCrushed(2) }, - new int[] { 10000 }, - 20 * 20, - tVoltageMultiplier / 2)) { - Logger.MATERIALS("[Macerator] Added Recipe: 'Macerate ore to Crushed ore'"); - } - // Macerate raw ore to Crushed - if (GT_Values.RA.addPulveriserRecipe( - material.getRawOre(1), - new ItemStack[] { material.getCrushed(2) }, - new int[] { 10000 }, - 20 * 20, - tVoltageMultiplier / 2)) { - Logger.MATERIALS("[Macerator] Added Recipe: 'Macerate raw ore to Crushed ore'"); - } - - // Macerate Centrifuged to Pure Dust - if (GT_Values.RA.addPulveriserRecipe( - material.getCrushedCentrifuged(1), - new ItemStack[] { matDust, matDustA }, - new int[] { 10000, 1000 }, - 20 * 20, - tVoltageMultiplier / 2)) { - Logger.MATERIALS("[Macerator] Added Recipe: 'Macerate Centrifuged ore to Pure Dust'"); - } - if (GT_ModHandler.addThermalCentrifugeRecipe( - material.getCrushedPurified(1), - (int) Math.min(5000L, Math.abs(material.getMass() * 20L)), - material.getCrushedCentrifuged(1), - tinyDustA, - dustStone)) { - Logger.MATERIALS( - "[ThermalCentrifuge] Added Recipe: 'Washed ore to Centrifuged Ore' | Input: " - + material.getCrushedPurified(1) - .getDisplayName() - + " | Outputs: " - + material.getCrushedCentrifuged(1) - .getDisplayName() - + ", " - + tinyDustA.getDisplayName() - + ", " - + dustStone.getDisplayName() - + "."); - } - - GT_Values.RA.addChemicalBathRecipe( - FLUORIDES.FLUORITE.getCrushed(2), - FluidUtils.getFluidStack("hydrogen", 2000), - FLUORIDES.FLUORITE.getCrushedPurified(8), - FLUORIDES.FLUORITE.getDustImpure(4), - FLUORIDES.FLUORITE.getDustPurified(2), - new int[] { 10000, 5000, 1000 }, - 30 * 20, - 240); - - /** - * Forge Hammer - */ - if (GT_Values.RA.addForgeHammerRecipe(material.getCrushedCentrifuged(1), matDust, 10, tVoltageMultiplier / 4)) { - Logger.MATERIALS("[ForgeHammer] Added Recipe: 'Crushed Centrifuged to Pure Dust'"); - } - - /** - * Centrifuge - */ - // Purified Dust to Clean - if (GT_Values.RA.addCentrifugeRecipe( - material.getDustPurified(1), - null, - null, // In Fluid - null, // Out Fluid - matDust, - tinyDustA, - null, - null, - null, - null, - new int[] { 10000, 10000 }, // Chances - (int) Math.max(1L, material.getMass() * 8L), // Time - tVoltageMultiplier / 2)) { // Eu - Logger.MATERIALS("[Centrifuge] Added Recipe: Purified Dust to Clean Dust"); - } - - // Impure Dust to Clean - if (GT_Values.RA.addCentrifugeRecipe( - material.getDustImpure(1), - null, - null, // In Fluid - null, // Out Fluid - matDust, - tinyDustB, - null, - null, - null, - null, - new int[] { 10000, 10000 }, // Chances - (int) Math.max(1L, material.getMass() * 8L), // Time - tVoltageMultiplier / 2)) { // Eu - Logger.MATERIALS("[Centrifuge] Added Recipe: Inpure Dust to Clean Dust"); - } - - // CaF2 + H2SO4 → CaSO4(solid) + 2 HF - FluidStack aGregtechHydro = FluidUtils.getFluidStack("hydrofluoricacid_gt5u", 16000); - if (aGregtechHydro == null) { - aGregtechHydro = FluidUtils.getFluidStack("hydrofluoricacid", 16000); - } - - CORE.RA.addDehydratorRecipe( - new ItemStack[] { CI.getNumberedAdvancedCircuit(5), FLUORIDES.FLUORITE.getDust(37), }, - FluidUtils.getFluidStack("sulfuricacid", 8000), - aGregtechHydro, // Fluid output (slot 2) - new ItemStack[] { ItemUtils.getItemStackOfAmountFromOreDict("dustCalciumSulfate", 15), - ItemUtils.getItemStackOfAmountFromOreDict("dustSilver", 1), - ItemUtils.getItemStackOfAmountFromOreDict("dustGold", 2), - ItemUtils.getItemStackOfAmountFromOreDict("dustTin", 1), - ItemUtils.getItemStackOfAmountFromOreDict("dustCopper", 2) }, - new int[] { 10000, 1000, 1000, 3000, 2000 }, - 10 * 60 * 20, - 240); // EU - } -} diff --git a/gtpp/src/main/java/gtPlusPlus/xmod/gregtech/loaders/RecipeGen_MaterialProcessing.java b/gtpp/src/main/java/gtPlusPlus/xmod/gregtech/loaders/RecipeGen_MaterialProcessing.java deleted file mode 100644 index 83bbe6a6d7..0000000000 --- a/gtpp/src/main/java/gtPlusPlus/xmod/gregtech/loaders/RecipeGen_MaterialProcessing.java +++ /dev/null @@ -1,318 +0,0 @@ -package gtPlusPlus.xmod.gregtech.loaders; - -import java.util.HashSet; -import java.util.Set; - -import net.minecraft.item.ItemStack; -import net.minecraftforge.fluids.FluidStack; - -import gregtech.api.enums.GT_Values; -import gtPlusPlus.api.interfaces.RunnableWithInfo; -import gtPlusPlus.api.objects.Logger; -import gtPlusPlus.api.objects.data.AutoMap; -import gtPlusPlus.api.objects.data.Pair; -import gtPlusPlus.core.lib.CORE; -import gtPlusPlus.core.material.Material; -import gtPlusPlus.core.material.MaterialGenerator; -import gtPlusPlus.core.material.MaterialStack; -import gtPlusPlus.core.material.state.MaterialState; -import gtPlusPlus.core.recipe.common.CI; -import gtPlusPlus.core.util.minecraft.ItemUtils; - -public class RecipeGen_MaterialProcessing extends RecipeGen_Base { - - public static final Set<RunnableWithInfo<Material>> mRecipeGenMap = new HashSet<>(); - - static { - MaterialGenerator.mRecipeMapsToGenerate.put(mRecipeGenMap); - } - - public RecipeGen_MaterialProcessing(final Material M) { - this(M, false); - } - - public RecipeGen_MaterialProcessing(final Material M, final boolean O) { - this.toGenerate = M; - this.disableOptional = O; - mRecipeGenMap.add(this); - } - - @Override - public void run() { - generateRecipes(this.toGenerate, this.disableOptional); - } - - private void generateRecipes(final Material material, final boolean disableOptional) { - if (disableOptional) { - return; - } - - if (material.getMaterialComposites().length > 1) { - Logger.MATERIALS("[Recipe Generator Debug] [" + material.getLocalizedName() + "]"); - final int tVoltageMultiplier = material.vVoltageMultiplier; - int[] partSizes = new int[99]; - if (material.vSmallestRatio != null) { - partSizes = new int[material.vSmallestRatio.length]; - for (int hu = 0; hu < material.vSmallestRatio.length; hu++) { - partSizes[hu] = (int) material.vSmallestRatio[hu]; - } - } - AutoMap<Pair<Integer, Material>> componentMap = new AutoMap<>(); - int alnsnfds = 0; - for (MaterialStack r : material.getComposites()) { - if (r != null) { - componentMap.put(new Pair<>(partSizes[alnsnfds], r.getStackMaterial())); - } - alnsnfds++; - } - - /** - * Centrifuge - */ - - // Process Dust - if (componentMap.size() > 0 && componentMap.size() <= 6) { - ItemStack mInternalOutputs[] = new ItemStack[6]; - int mChances[] = new int[6]; - int mCellCount = 0; - - int mTotalCount = 0; - - int mCounter = 0; - for (Pair<Integer, Material> f : componentMap) { - if (f.getValue() - .getState() != MaterialState.SOLID) { - Logger.MATERIALS( - "[Centrifuge] Found Fluid Component, adding " + f.getKey() - + " cells of " - + f.getValue() - .getLocalizedName() - + "."); - mInternalOutputs[mCounter++] = f.getValue() - .getCell(f.getKey()); - mCellCount += f.getKey(); - mTotalCount += f.getKey(); - Logger.MATERIALS( - "[Centrifuge] In total, adding " + mCellCount - + " cells for " - + material.getLocalizedName() - + " processing."); - } else { - Logger.MATERIALS( - "[Centrifuge] Found Solid Component, adding " + f.getKey() - + " dusts of " - + f.getValue() - .getLocalizedName() - + "."); - mInternalOutputs[mCounter++] = f.getValue() - .getDust(f.getKey()); - mTotalCount += f.getKey(); - } - } - - // Build Output Array - for (int g = 0; g < mInternalOutputs.length; g++) { - Logger.MATERIALS( - "[Centrifuge] Is output[" + g - + "] valid with a chance? " - + (mInternalOutputs[g] != null ? 10000 : 0)); - mChances[g] = (mInternalOutputs[g] != null ? 10000 : 0); - } - - ItemStack emptyCell = null; - if (mCellCount > 0) { - emptyCell = ItemUtils.getItemStackOfAmountFromOreDict("cellEmpty", mCellCount); - Logger.MATERIALS("[Centrifuge] Recipe now requires " + mCellCount + " empty cells as input."); - } - - ItemStack mainDust = material.getDust(material.smallestStackSizeWhenProcessing); - if (mainDust != null) { - Logger.MATERIALS( - "[Centrifuge] Recipe now requires " + material.smallestStackSizeWhenProcessing - + "x " - + mainDust.getDisplayName() - + " as input."); - } else { - mainDust = material.getDust(mTotalCount); - Logger.MATERIALS("[Centrifuge] Could not find valid input dust, trying alternative."); - if (mainDust != null) { - Logger.MATERIALS( - "[Centrifuge] Recipe now requires " + mTotalCount - + "x " - + mainDust.getDisplayName() - + " as input."); - } else { - Logger.MATERIALS("[Centrifuge] Could not find valid input dust, exiting."); - } - } - - for (int j = 0; j < mInternalOutputs.length; j++) { - if (mInternalOutputs[j] == null) { - mInternalOutputs[j] = GT_Values.NI; - Logger.MATERIALS("[Centrifuge] Set slot " + j + " to null."); - } else { - Logger.MATERIALS( - "[Centrifuge] Set slot " + j + " to " + mInternalOutputs[j].getDisplayName() + "."); - } - } - - try { - if (addCentrifgeRecipe( - mainDust, - emptyCell, // input 2 - null, // Input fluid 1 - null, // Output fluid 1 - mInternalOutputs[0], - mInternalOutputs[1], - mInternalOutputs[2], - mInternalOutputs[3], - mInternalOutputs[4], - mInternalOutputs[5], - mChances, - 20 * 1 * (tVoltageMultiplier / 10), - tVoltageMultiplier)) { - Logger.MATERIALS( - "[Centrifuge] Generated Centrifuge recipe for " + material.getDust(1) - .getDisplayName()); - } else { - Logger.MATERIALS( - "[Centrifuge] Failed to generate Centrifuge recipe for " + material.getDust(1) - .getDisplayName()); - } - } catch (Throwable t) { - t.printStackTrace(); - } - } else if (componentMap.size() > 6 && componentMap.size() <= 9) { - Logger.MATERIALS( - "[Issue][Electrolyzer] " + material.getLocalizedName() - + " is composed of over 6 materials, so an electrolyzer recipe for processing cannot be generated. Trying to create one for the Dehydrator instead."); - - ItemStack mInternalOutputs[] = new ItemStack[9]; - int mChances[] = new int[9]; - int mCellCount = 0; - - int mTotalCount = 0; - - int mCounter = 0; - for (Pair<Integer, Material> f : componentMap) { - if (f.getValue() - .getState() != MaterialState.SOLID) { - Logger.MATERIALS( - "[Dehydrator] Found Fluid Component, adding " + f.getKey() - + " cells of " - + f.getValue() - .getLocalizedName() - + "."); - mInternalOutputs[mCounter++] = f.getValue() - .getCell(f.getKey()); - mCellCount += f.getKey(); - mTotalCount += f.getKey(); - Logger.MATERIALS( - "[Dehydrator] In total, adding " + mCellCount - + " cells for " - + material.getLocalizedName() - + " processing."); - } else { - Logger.MATERIALS( - "[Dehydrator] Found Solid Component, adding " + f.getKey() - + " dusts of " - + f.getValue() - .getLocalizedName() - + "."); - mInternalOutputs[mCounter++] = f.getValue() - .getDust(f.getKey()); - mTotalCount += f.getKey(); - } - } - - // Build Output Array - for (int g = 0; g < mInternalOutputs.length; g++) { - Logger.MATERIALS( - "[Dehydrator] Is output[" + g - + "] valid with a chance? " - + (mInternalOutputs[g] != null ? 10000 : 0)); - mChances[g] = (mInternalOutputs[g] != null ? 10000 : 0); - } - - ItemStack emptyCell = null; - if (mCellCount > 0) { - emptyCell = CI.emptyCells(mCellCount); - Logger.MATERIALS("[Dehydrator] Recipe now requires " + mCellCount + " empty cells as input."); - } - - ItemStack mainDust = material.getDust(material.smallestStackSizeWhenProcessing); - if (mainDust != null) { - Logger.MATERIALS( - "[Dehydrator] Recipe now requires " + material.smallestStackSizeWhenProcessing - + "x " - + mainDust.getDisplayName() - + " as input."); - } else { - mainDust = material.getDust(mTotalCount); - Logger.MATERIALS("[Dehydrator] Could not find valid input dust, trying alternative."); - if (mainDust != null) { - Logger.MATERIALS( - "[Dehydrator] Recipe now requires " + mTotalCount - + "x " - + mainDust.getDisplayName() - + " as input."); - } else { - Logger.MATERIALS("[Dehydrator] Could not find valid input dust, exiting."); - } - } - - for (int j = 0; j < mInternalOutputs.length; j++) { - if (mInternalOutputs[j] == null) { - mInternalOutputs[j] = GT_Values.NI; - Logger.MATERIALS("[Dehydrator] Set slot " + j + " to null."); - } else { - Logger.MATERIALS( - "[Dehydrator] Set slot " + j + " to " + mInternalOutputs[j].getDisplayName() + "."); - } - } - - try { - - if (CORE.RA.addDehydratorRecipe( - new ItemStack[] { mainDust, emptyCell }, - null, - null, - mInternalOutputs, - mChances, - 20 * 1 * (tVoltageMultiplier / 10), - tVoltageMultiplier)) { - Logger.MATERIALS( - "[Dehydrator] Generated Dehydrator recipe for " + material.getDust(1) - .getDisplayName()); - } else { - Logger.MATERIALS( - "[Dehydrator] Failed to generate Dehydrator recipe for " + material.getDust(1) - .getDisplayName()); - } - } catch (Throwable t) { - t.printStackTrace(); - } - } - } - } - - @Deprecated - public static boolean addCentrifgeRecipe(ItemStack aInput1, ItemStack aInput2, FluidStack aFluidInput, - FluidStack aFluidOutput, ItemStack aOutput1, ItemStack aOutput2, ItemStack aOutput3, ItemStack aOutput4, - ItemStack aOutput5, ItemStack aOutput6, int[] aChances, int aDuration, int aEUt) { - return GT_Values.RA.addCentrifugeRecipe( - aInput1, - aInput2, - aFluidInput, - aFluidOutput, - aOutput1, - aOutput2, - aOutput3, - aOutput4, - aOutput5, - aOutput6, - aChances, - aDuration, - aEUt); - } -} diff --git a/gtpp/src/main/java/gtPlusPlus/xmod/gregtech/loaders/RecipeGen_MetalRecipe.java b/gtpp/src/main/java/gtPlusPlus/xmod/gregtech/loaders/RecipeGen_MetalRecipe.java deleted file mode 100644 index f11b97cbda..0000000000 --- a/gtpp/src/main/java/gtPlusPlus/xmod/gregtech/loaders/RecipeGen_MetalRecipe.java +++ /dev/null @@ -1,112 +0,0 @@ -package gtPlusPlus.xmod.gregtech.loaders; - -import java.util.HashSet; -import java.util.Set; - -import gregtech.api.enums.GT_Values; -import gregtech.api.util.GT_ModHandler; -import gtPlusPlus.api.interfaces.RunnableWithInfo; -import gtPlusPlus.api.objects.Logger; -import gtPlusPlus.core.lib.CORE; -import gtPlusPlus.core.material.Material; -import gtPlusPlus.core.material.MaterialGenerator; -import gtPlusPlus.core.util.minecraft.ItemUtils; - -public class RecipeGen_MetalRecipe extends RecipeGen_Base { - - public static final Set<RunnableWithInfo<Material>> mRecipeGenMap = new HashSet<>(); - - static { - MaterialGenerator.mRecipeMapsToGenerate.put(mRecipeGenMap); - } - - public RecipeGen_MetalRecipe(final Material M) { - this.toGenerate = M; - mRecipeGenMap.add(this); - } - - @Override - public void run() { - generateRecipes(this.toGenerate); - } - - private void generateRecipes(final Material material) { - - Logger.WARNING("Generating Metal recipes for " + material.getLocalizedName()); - if (ItemUtils.checkForInvalidItems(material.getIngot(1)) - && ItemUtils.checkForInvalidItems(material.getBlock(1))) - if (GT_ModHandler.addCompressionRecipe(material.getIngot(9), material.getBlock(1))) { - Logger.WARNING("Compress Block Recipe: " + material.getLocalizedName() + " - Success"); - } else { - Logger.WARNING("Compress Block Recipe: " + material.getLocalizedName() + " - Failed"); - } - - if (ItemUtils.checkForInvalidItems(material.getIngot(1)) && ItemUtils.checkForInvalidItems(material.getRod(1))) - if (GT_Values.RA.addLatheRecipe( - material.getIngot(1), - material.getRod(1), - material.getSmallDust(2), - (int) Math.max(material.getMass() / 8L, 1L), - material.vVoltageMultiplier)) { - Logger.WARNING("Lathe Rod Recipe: " + material.getLocalizedName() + " - Success"); - } else { - Logger.WARNING("Lathe Rod Recipe: " + material.getLocalizedName() + " - Failed"); - } - - if (ItemUtils.checkForInvalidItems(material.getRod(1)) && ItemUtils.checkForInvalidItems(material.getBolt(1))) - if (GT_Values.RA.addCutterRecipe( - material.getRod(1), - material.getBolt(4), - null, - (int) Math.max(material.getMass() * 2L, 1L), - material.vVoltageMultiplier)) { - Logger.WARNING("Cut Bolt Recipe: " + material.getLocalizedName() + " - Success"); - } else { - Logger.WARNING("Cut Bolt Recipe: " + material.getLocalizedName() + " - Failed"); - } - - if (ItemUtils.checkForInvalidItems(material.getIngot(1)) - && ItemUtils.checkForInvalidItems(material.getHotIngot(1))) - if (CORE.RA.addVacuumFreezerRecipe( - material.getHotIngot(1), - material.getIngot(1), - (int) Math.max(material.getMass() * 3L, 1L), - material.vVoltageMultiplier)) { - Logger.WARNING("Cool Hot Ingot Recipe: " + material.getLocalizedName() + " - Success"); - } else { - Logger.WARNING("Cool Hot Ingot Recipe: " + material.getLocalizedName() + " - Failed"); - } - - if (ItemUtils.checkForInvalidItems(material.getRod(1)) - && ItemUtils.checkForInvalidItems(material.getLongRod(1))) { - if (GT_Values.RA.addForgeHammerRecipe( - material.getRod(2), - material.getLongRod(1), - (int) Math.max(material.getMass(), 1L), - 16)) { - Logger.WARNING("Hammer Long Rod Recipe: " + material.getLocalizedName() + " - Success"); - } else { - Logger.WARNING("Hammer Long Rod Recipe: " + material.getLocalizedName() + " - Failed"); - } - - GT_Values.RA.addCutterRecipe( - material.getLongRod(1), - material.getRod(2), - null, - (int) Math.max(material.getMass(), 1L), - 4); - } - - if (ItemUtils.checkForInvalidItems(material.getBolt(1)) && ItemUtils.checkForInvalidItems(material.getScrew(1))) - if (GT_Values.RA.addLatheRecipe( - material.getBolt(1), - material.getScrew(1), - null, - (int) Math.max(material.getMass() / 8L, 1L), - 4)) { - Logger.WARNING("Lathe Screw Recipe: " + material.getLocalizedName() + " - Success"); - } else { - Logger.WARNING("Lathe Screw Recipe: " + material.getLocalizedName() + " - Failed"); - } - } -} diff --git a/gtpp/src/main/java/gtPlusPlus/xmod/gregtech/loaders/RecipeGen_MultisUsingFluidInsteadOfCells.java b/gtpp/src/main/java/gtPlusPlus/xmod/gregtech/loaders/RecipeGen_MultisUsingFluidInsteadOfCells.java deleted file mode 100644 index 208be14c8c..0000000000 --- a/gtpp/src/main/java/gtPlusPlus/xmod/gregtech/loaders/RecipeGen_MultisUsingFluidInsteadOfCells.java +++ /dev/null @@ -1,187 +0,0 @@ -package gtPlusPlus.xmod.gregtech.loaders; - -import java.util.ArrayList; -import java.util.Arrays; -import java.util.List; - -import net.minecraft.item.ItemStack; -import net.minecraftforge.fluids.FluidStack; - -import gregtech.api.recipe.RecipeMap; -import gregtech.api.util.GT_Recipe; -import gregtech.api.util.GT_Utility; -import gtPlusPlus.api.objects.Logger; -import gtPlusPlus.api.objects.data.AutoMap; -import gtPlusPlus.core.recipe.common.CI; -import gtPlusPlus.core.util.minecraft.ItemUtils; -import gtPlusPlus.core.util.recipe.GT_RecipeUtils; - -public class RecipeGen_MultisUsingFluidInsteadOfCells { - - private static ItemStack mEmptyCell; - private static final AutoMap<ItemStack> mItemsToIgnore = new AutoMap<>(); - private static boolean mInit = false; - - private static void init() { - if (!mInit) { - mInit = true; - mItemsToIgnore.add( - ItemUtils.simpleMetaStack( - CI.emptyCells(1) - .getItem(), - 8, - 1)); - } - } - - private static boolean doesItemMatchIgnoringStackSize(ItemStack a, ItemStack b) { - if (a == null || b == null) { - return false; - } - if (a.getItem() == b.getItem()) { - return a.getItemDamage() == b.getItemDamage(); - } - return false; - } - - private static boolean isEmptyCell(ItemStack aCell) { - if (aCell == null) { - return false; - } - if (mEmptyCell == null) { - mEmptyCell = CI.emptyCells(1); - } - if (mEmptyCell != null) { - ItemStack aTempStack = mEmptyCell.copy(); - aTempStack.stackSize = aCell.stackSize; - return GT_Utility.areStacksEqual(aTempStack, aCell); - } - return false; - } - - private static synchronized FluidStack getFluidFromItemStack(final ItemStack ingot) { - if (ingot == null) { - return null; - } - return GT_Utility.getFluidForFilledItem(ingot, true); - } - - public static synchronized int generateRecipesNotUsingCells(RecipeMap<?> aInputs, RecipeMap<?> aOutputs) { - init(); - int aRecipesHandled = 0; - int aInvalidRecipesToConvert = 0; - int aOriginalCount = aInputs.getAllRecipes() - .size(); - ArrayList<GT_Recipe> deDuplicationInputArray = new ArrayList<>(); - - recipe: for (GT_Recipe x : aInputs.getAllRecipes()) { - if (x != null) { - - ItemStack[] aInputItems = x.mInputs.clone(); - ItemStack[] aOutputItems = x.mOutputs.clone(); - FluidStack[] aInputFluids = x.mFluidInputs.clone(); - FluidStack[] aOutputFluids = x.mFluidOutputs.clone(); - - AutoMap<ItemStack> aInputItemsMap = new AutoMap<>(); - AutoMap<ItemStack> aOutputItemsMap = new AutoMap<>(); - AutoMap<FluidStack> aInputFluidsMap = new AutoMap<>(); - AutoMap<FluidStack> aOutputFluidsMap = new AutoMap<>(); - - // Iterate Inputs, Convert valid items into fluids - for (ItemStack aInputStack : aInputItems) { - FluidStack aFoundFluid = getFluidFromItemStack(aInputStack); - if (aFoundFluid == null) { - for (ItemStack aBadStack : mItemsToIgnore) { - if (doesItemMatchIgnoringStackSize(aInputStack, aBadStack)) { - continue recipe; // Skip this recipe entirely if we find an item we don't like - } - } - if (!isEmptyCell(aInputStack)) { - aInputItemsMap.add(aInputStack); - } - } else { - aFoundFluid.amount = aFoundFluid.amount * aInputStack.stackSize; - aInputFluidsMap.add(aFoundFluid); - } - } - // Iterate Outputs, Convert valid items into fluids - for (ItemStack aOutputStack : aOutputItems) { - FluidStack aFoundFluid = getFluidFromItemStack(aOutputStack); - if (aFoundFluid == null) { - for (ItemStack aBadStack : mItemsToIgnore) { - if (doesItemMatchIgnoringStackSize(aOutputStack, aBadStack)) { - continue recipe; // Skip this recipe entirely if we find an item we don't like - } - } - if (!isEmptyCell(aOutputStack)) { - aOutputItemsMap.add(aOutputStack); - } - } else { - aFoundFluid.amount = aFoundFluid.amount * aOutputStack.stackSize; - aOutputFluidsMap.add(aFoundFluid); - } - } - // Add Input fluids second - aInputFluidsMap.addAll(Arrays.asList(aInputFluids)); - // Add Output fluids second - aOutputFluidsMap.addAll(Arrays.asList(aOutputFluids)); - - // Make some new Arrays - ItemStack[] aNewItemInputs = new ItemStack[aInputItemsMap.size()]; - ItemStack[] aNewItemOutputs = new ItemStack[aOutputItemsMap.size()]; - FluidStack[] aNewFluidInputs = new FluidStack[aInputFluidsMap.size()]; - FluidStack[] aNewFluidOutputs = new FluidStack[aOutputFluidsMap.size()]; - - // Add AutoMap contents to Arrays - for (int i = 0; i < aInputItemsMap.size(); i++) { - aNewItemInputs[i] = aInputItemsMap.get(i); - } - for (int i = 0; i < aOutputItemsMap.size(); i++) { - aNewItemOutputs[i] = aOutputItemsMap.get(i); - } - for (int i = 0; i < aInputFluidsMap.size(); i++) { - aNewFluidInputs[i] = aInputFluidsMap.get(i); - } - for (int i = 0; i < aOutputFluidsMap.size(); i++) { - aNewFluidOutputs[i] = aOutputFluidsMap.get(i); - } - - if (!ItemUtils.checkForInvalidItems(aNewItemInputs, aNewItemOutputs)) { - aInvalidRecipesToConvert++; - continue; // Skip this recipe entirely if we find an item we don't like - } - GT_Recipe aNewRecipe = new GT_Recipe( - false, - aNewItemInputs, - aNewItemOutputs, - x.mSpecialItems, - x.mChances, - aNewFluidInputs, - aNewFluidOutputs, - x.mDuration, - x.mEUt, - x.mSpecialValue); - aNewRecipe.owners = new ArrayList<>(x.owners); - - // add all recipes to an intermediate array - deDuplicationInputArray.add(aNewRecipe); - - aRecipesHandled++; - } else { - aInvalidRecipesToConvert++; - } - } - // cast arraylist of input to a regular array and pass it to a duplicate recipe remover. - List<GT_Recipe> deDuplicationOutputArray = GT_RecipeUtils - .removeDuplicates(deDuplicationInputArray, aOutputs.unlocalizedName); - // add each recipe from the above output to the intended recipe map - for (GT_Recipe recipe : deDuplicationOutputArray) { - aOutputs.add(recipe); - } - Logger.INFO("Generated Recipes for " + aOutputs.unlocalizedName); - Logger.INFO("Original Map contains " + aOriginalCount + " recipes."); - Logger.INFO("Output Map contains " + aRecipesHandled + " recipes."); - Logger.INFO("There were " + aInvalidRecipesToConvert + " invalid recipes."); - return aRecipesHandled; - } -} diff --git a/gtpp/src/main/java/gtPlusPlus/xmod/gregtech/loaders/RecipeGen_Ore.java b/gtpp/src/main/java/gtPlusPlus/xmod/gregtech/loaders/RecipeGen_Ore.java deleted file mode 100644 index 32d6a1066b..0000000000 --- a/gtpp/src/main/java/gtPlusPlus/xmod/gregtech/loaders/RecipeGen_Ore.java +++ /dev/null @@ -1,750 +0,0 @@ -package gtPlusPlus.xmod.gregtech.loaders; - -import java.util.ArrayList; -import java.util.HashSet; -import java.util.Set; - -import net.minecraft.item.ItemStack; -import net.minecraftforge.fluids.FluidStack; - -import gregtech.api.enums.GT_Values; -import gregtech.api.enums.Materials; -import gregtech.api.util.GT_ModHandler; -import gtPlusPlus.api.interfaces.RunnableWithInfo; -import gtPlusPlus.api.objects.Logger; -import gtPlusPlus.api.objects.data.AutoMap; -import gtPlusPlus.api.objects.data.Pair; -import gtPlusPlus.core.lib.CORE; -import gtPlusPlus.core.material.Material; -import gtPlusPlus.core.material.MaterialGenerator; -import gtPlusPlus.core.material.MaterialStack; -import gtPlusPlus.core.material.state.MaterialState; -import gtPlusPlus.core.recipe.common.CI; -import gtPlusPlus.core.util.minecraft.ItemUtils; -import gtPlusPlus.core.util.minecraft.MaterialUtils; -import gtPlusPlus.core.util.minecraft.RecipeUtils; - -public class RecipeGen_Ore extends RecipeGen_Base { - - public static final Set<RunnableWithInfo<Material>> mRecipeGenMap = new HashSet<>(); - - static { - MaterialGenerator.mRecipeMapsToGenerate.put(mRecipeGenMap); - } - - public RecipeGen_Ore(final Material M) { - this(M, false); - } - - public RecipeGen_Ore(final Material M, final boolean O) { - this.toGenerate = M; - this.disableOptional = O; - mRecipeGenMap.add(this); - } - - @Override - public void run() { - generateRecipes(this.toGenerate, this.disableOptional); - } - - private static Material mStone; - - private void generateRecipes(final Material material, final boolean disableOptional) { - - if (mStone == null) { - mStone = MaterialUtils.generateMaterialFromGtENUM(Materials.Stone); - } - - // if (material.getMaterialComposites().length > 1){ - Logger.MATERIALS("[Recipe Generator Debug] [" + material.getLocalizedName() + "]"); - int tVoltageMultiplier = MaterialUtils.getVoltageForTier(material.vTier); - - final ItemStack dustStone = ItemUtils.getItemStackOfAmountFromOreDict("dustStone", 1); - Material bonusA = null; // Ni - Material bonusB = null; // Tin - - if (material.getComposites() - .size() >= 1 - && material.getComposites() - .get(0) != null) { - bonusA = material.getComposites() - .get(0) - .getStackMaterial(); - } else { - bonusA = material; - } - - boolean allFailed = false; - - // Setup Bonuses - ArrayList<Material> aMatComp = new ArrayList<>(); - for (Material j : MaterialUtils.getCompoundMaterialsRecursively(material)) { - aMatComp.add(j); - } - - if (aMatComp.size() < 3) { - while (aMatComp.size() < 3) { - aMatComp.add(material); - } - } - - AutoMap<Material> amJ = new AutoMap<>(); - int aIndexCounter = 0; - for (Material g : aMatComp) { - if (g.hasSolidForm()) { - if (getDust(g) != null && getTinyDust(g) != null) { - amJ.put(g); - } - } - } - - if (amJ.size() < 2) { - if (material.getComposites() - .size() >= 2 - && material.getComposites() - .get(1) != null) { - bonusB = material.getComposites() - .get(1) - .getStackMaterial(); - // If Secondary Output has no solid output, try the third (If it exists) - if (!bonusB.hasSolidForm() && material.getComposites() - .size() >= 3 - && material.getComposites() - .get(2) != null) { - bonusB = material.getComposites() - .get(2) - .getStackMaterial(); - // If Third Output has no solid output, try the Fourth (If it exists) - if (!bonusB.hasSolidForm() && material.getComposites() - .size() >= 4 - && material.getComposites() - .get(3) != null) { - bonusB = material.getComposites() - .get(3) - .getStackMaterial(); - // If Fourth Output has no solid output, try the Fifth (If it exists) - if (!bonusB.hasSolidForm() && material.getComposites() - .size() >= 5 - && material.getComposites() - .get(4) != null) { - bonusB = material.getComposites() - .get(4) - .getStackMaterial(); - // If Fifth Output has no solid output, default out to Stone dust. - if (!bonusB.hasSolidForm()) { - allFailed = true; - bonusB = mStone; - } - } - } - } - } else { - allFailed = true; - } - } else { - bonusA = amJ.get(0); - bonusB = amJ.get(1); - } - - // Default out if it's made of fluids or some stuff. - if (bonusA == null) { - bonusA = tVoltageMultiplier > 100 ? material : mStone; - } - // Default out if it's made of fluids or some stuff. - if (allFailed || bonusB == null) { - bonusB = tVoltageMultiplier > 100 ? material : mStone; - } - - AutoMap<Pair<Integer, Material>> componentMap = new AutoMap<>(); - for (MaterialStack r : material.getComposites()) { - if (r != null) { - componentMap.put(new Pair<>(r.getPartsPerOneHundred(), r.getStackMaterial())); - } - } - - // Need two valid outputs - if (bonusA == null || bonusB == null || !bonusA.hasSolidForm() || !bonusB.hasSolidForm()) { - if (bonusA == null) { - bonusA = mStone; - } - if (bonusB == null) { - bonusB = mStone; - } - if (!bonusA.hasSolidForm()) { - bonusA = mStone; - } - if (!bonusB.hasSolidForm()) { - bonusB = mStone; - } - } - - ItemStack matDust = getDust(material); - ItemStack matDustA = getDust(bonusA); - ItemStack matDustB = getDust(bonusB); - - /** - * Package - */ - // Allow ore dusts to be packaged - if (ItemUtils.checkForInvalidItems(material.getSmallDust(1)) - && ItemUtils.checkForInvalidItems(material.getTinyDust(1))) { - RecipeGen_DustGeneration.generatePackagerRecipes(material); - } - - /** - * Macerate - */ - // Macerate ore to Crushed - if (GT_Values.RA.addPulveriserRecipe( - material.getOre(1), - new ItemStack[] { material.getCrushed(2) }, - new int[] { 10000 }, - 20 * 20, - tVoltageMultiplier / 2)) { - Logger.MATERIALS("[Macerator] Added Recipe: 'Macerate ore to Crushed ore'"); - } - // Macerate raw ore to Crushed - if (GT_Values.RA.addPulveriserRecipe( - material.getRawOre(1), - new ItemStack[] { material.getCrushed(2) }, - new int[] { 10000 }, - 20 * 20, - tVoltageMultiplier / 2)) { - Logger.MATERIALS("[Macerator] Added Recipe: 'Macerate raw ore to Crushed ore'"); - } - // Macerate Crushed to Impure Dust - if (GT_Values.RA.addPulveriserRecipe( - material.getCrushed(1), - new ItemStack[] { material.getDustImpure(1), matDustA }, - new int[] { 10000, 1000 }, - 20 * 20, - tVoltageMultiplier / 2)) { - Logger.MATERIALS("[Macerator] Added Recipe: 'Macerate Crushed ore to Impure Dust'"); - } - // Macerate Washed to Purified Dust - if (GT_Values.RA.addPulveriserRecipe( - material.getCrushedPurified(1), - new ItemStack[] { material.getDustPurified(1), matDustA }, - new int[] { 10000, 1000 }, - 20 * 20, - tVoltageMultiplier / 2)) { - Logger.MATERIALS("[Macerator] Added Recipe: 'Macerate Washed ore to Purified Dust'"); - } - // Macerate Centrifuged to Pure Dust - if (GT_Values.RA.addPulveriserRecipe( - material.getCrushedCentrifuged(1), - new ItemStack[] { matDust, matDustA }, - new int[] { 10000, 1000 }, - 20 * 20, - tVoltageMultiplier / 2)) { - Logger.MATERIALS("[Macerator] Added Recipe: 'Macerate Centrifuged ore to Pure Dust'"); - } - - /** - * Wash - */ - // Wash into Purified Crushed - /* - * if (GT_Values.RA.addOreWasherRecipe(material.getCrushed(1), material.getCrushedPurified(1), - * bonusA.getTinyDust(1), dustStone, FluidUtils.getWater(1000), 25*20, 16)){ - * Logger.MATERIALS("[OreWasher] Added Recipe: 'Wash Crushed ore into Purified Crushed ore'"); } - */ - // .08 compat method - if (GT_ModHandler.addOreWasherRecipe( - material.getCrushed(1), - new int[] { 10000, 1111, 10000 }, - 1000, - material.getCrushedPurified(1), - matDustA, - dustStone)) { - Logger.MATERIALS("[OreWasher] Added Recipe: 'Wash Crushed ore into Purified Crushed ore'"); - } - - /** - * Thermal Centrifuge - */ - /* - * //Crushed ore to Centrifuged Ore if (GT_Values.RA.addThermalCentrifugeRecipe(material.getCrushed(1), - * material.getCrushedCentrifuged(1), tinyDustB, dustStone, 25*20, 24)){ - * Logger.MATERIALS("[ThermalCentrifuge] Added Recipe: 'Crushed ore to Centrifuged Ore'"); } //Washed ore to - * Centrifuged Ore if (GT_Values.RA.addThermalCentrifugeRecipe(material.getCrushedPurified(1), - * material.getCrushedCentrifuged(1), bonusA.getTinyDust(1), dustStone, 25*20, 24)){ - * Logger.MATERIALS("[ThermalCentrifuge] Added Recipe: 'Washed ore to Centrifuged Ore'"); } - */ - - Logger.MATERIALS("material.getCrushed(1): " + (material.getCrushed(1) != null)); - Logger.MATERIALS("material.getCrushedPurified(1): " + (material.getCrushedPurified(1) != null)); - - Logger.MATERIALS("material.getTinyDust(1): " + (ItemUtils.getItemName(bonusA.getCrushed(1)))); - Logger.MATERIALS("material.getTinyDust(1): " + (ItemUtils.getItemName(bonusB.getCrushed(1)))); - - try { - // .08 compat - if (GT_ModHandler.addThermalCentrifugeRecipe( - material.getCrushed(1), - new int[] { 10000, 1111, 10000 }, - (int) Math.min(5000L, Math.abs(material.getMass() * 20L)), - material.getCrushedCentrifuged(1), - matDustB, - dustStone)) { - Logger.MATERIALS( - "[ThermalCentrifuge] Added Recipe: 'Crushed ore to Centrifuged Ore' | Input: " - + material.getCrushed(1) - .getDisplayName() - + " | Outputs: " - + material.getCrushedCentrifuged(1) - .getDisplayName() - + ", " - + matDustB.getDisplayName() - + ", " - + dustStone.getDisplayName() - + "."); - } - } catch (Throwable t) {} - try { - if (GT_ModHandler.addThermalCentrifugeRecipe( - material.getCrushedPurified(1), - new int[] { 10000, 1111, 10000 }, - (int) Math.min(5000L, Math.abs(material.getMass() * 20L)), - material.getCrushedCentrifuged(1), - matDustA, - dustStone)) { - Logger.MATERIALS( - "[ThermalCentrifuge] Added Recipe: 'Washed ore to Centrifuged Ore' | Input: " - + material.getCrushedPurified(1) - .getDisplayName() - + " | Outputs: " - + material.getCrushedCentrifuged(1) - .getDisplayName() - + ", " - + matDustA.getDisplayName() - + ", " - + dustStone.getDisplayName() - + "."); - } - } catch (Throwable t) {} - - /** - * Forge Hammer - */ - if (GT_Values.RA.addForgeHammerRecipe(material.getCrushedCentrifuged(1), matDust, 10, tVoltageMultiplier / 4)) { - Logger.MATERIALS("[ForgeHammer] Added Recipe: 'Crushed Centrifuged to Pure Dust'"); - } - if (GT_Values.RA.addForgeHammerRecipe( - material.getCrushedPurified(1), - material.getDustPurified(1), - 10, - tVoltageMultiplier / 4)) { - Logger.MATERIALS("[ForgeHammer] Added Recipe: 'Crushed Purified to Purified Dust'"); - } - if (GT_Values.RA.addForgeHammerRecipe(material.getOre(1), material.getCrushed(1), 10, tVoltageMultiplier / 4)) { - Logger.MATERIALS("[ForgeHammer] Added Recipe: 'Ore to Crushed'"); - } - - /** - * Centrifuge - */ - // Purified Dust to Clean - if (GT_Values.RA.addCentrifugeRecipe( - material.getDustPurified(1), - null, - null, // In Fluid - null, // Out Fluid - matDust, - matDustA, - null, - null, - null, - null, - new int[] { 10000, 1111 }, // Chances - (int) Math.max(1L, material.getMass() * 8L), // Time - tVoltageMultiplier / 2)) { // Eu - Logger.MATERIALS("[Centrifuge] Added Recipe: Purified Dust to Clean Dust"); - } - - // Impure Dust to Clean - if (GT_Values.RA.addCentrifugeRecipe( - material.getDustImpure(1), - null, - null, // In Fluid - null, // Out Fluid - matDust, - matDustB, - null, - null, - null, - null, - new int[] { 10000, 1111 }, // Chances - (int) Math.max(1L, material.getMass() * 8L), // Time - tVoltageMultiplier / 2)) { // Eu - Logger.MATERIALS("[Centrifuge] Added Recipe: Inpure Dust to Clean Dust"); - } - - /** - * Electrolyzer - */ - if (!disableOptional) { - // Process Dust - if (componentMap.size() > 0 && componentMap.size() <= 6) { - - ItemStack mInternalOutputs[] = new ItemStack[6]; - int mChances[] = new int[6]; - int mCellCount = 0; - - int mTotalCount = 0; - - int mCounter = 0; - for (Pair<Integer, Material> f : componentMap) { - if (f.getValue() - .getState() != MaterialState.SOLID) { - Logger.MATERIALS( - "[Electrolyzer] Found Fluid Component, adding " + f.getKey() - + " cells of " - + f.getValue() - .getLocalizedName() - + "."); - mInternalOutputs[mCounter++] = f.getValue() - .getCell(f.getKey()); - mCellCount += f.getKey(); - mTotalCount += f.getKey(); - Logger.MATERIALS( - "[Electrolyzer] In total, adding " + mCellCount - + " cells for " - + material.getLocalizedName() - + " processing."); - } else { - Logger.MATERIALS( - "[Electrolyzer] Found Solid Component, adding " + f.getKey() - + " dusts of " - + f.getValue() - .getLocalizedName() - + "."); - mInternalOutputs[mCounter++] = f.getValue() - .getDust(f.getKey()); - mTotalCount += f.getKey(); - } - } - - // Build Output Array - for (int g = 0; g < mInternalOutputs.length; g++) { - Logger.MATERIALS( - "[Electrolyzer] Is output[" + g - + "] valid with a chance? " - + (mInternalOutputs[g] != null ? 10000 : 0)); - mChances[g] = (mInternalOutputs[g] != null ? 10000 : 0); - } - - ItemStack emptyCell = null; - if (mCellCount > 0) { - emptyCell = ItemUtils.getItemStackOfAmountFromOreDict("cellEmpty", mCellCount); - Logger.MATERIALS("[Electrolyzer] Recipe now requires " + mCellCount + " empty cells as input."); - } - - ItemStack mainDust = material.getDust(material.smallestStackSizeWhenProcessing); - if (mainDust != null) { - Logger.MATERIALS( - "[Electrolyzer] Recipe now requires " + material.smallestStackSizeWhenProcessing - + "x " - + mainDust.getDisplayName() - + " as input."); - } else { - mainDust = material.getDust(mTotalCount); - Logger.MATERIALS("[Electrolyzer] Could not find valid input dust, trying alternative."); - if (mainDust != null) { - Logger.MATERIALS( - "[Electrolyzer] Recipe now requires " + mTotalCount - + "x " - + mainDust.getDisplayName() - + " as input."); - } else { - Logger.MATERIALS("[Electrolyzer] Could not find valid input dust, exiting."); - } - } - - for (int j = 0; j < mInternalOutputs.length; j++) { - if (mInternalOutputs[j] == null) { - mInternalOutputs[j] = GT_Values.NI; - Logger.MATERIALS("[Electrolyzer] Set slot " + j + " to null."); - } else { - Logger.MATERIALS( - "[Electrolyzer] Set slot " + j + " to " + mInternalOutputs[j].getDisplayName() + "."); - } - } - - try { - if (addElectrolyzerRecipe( - mainDust, - emptyCell, // input 2 - null, // Input fluid 1 - null, // Output fluid 1 - mInternalOutputs[0], - mInternalOutputs[1], - mInternalOutputs[2], - mInternalOutputs[3], - mInternalOutputs[4], - mInternalOutputs[5], - mChances, - (int) Math.max(material.getMass() * 3L * 1, 1), - tVoltageMultiplier)) { - Logger - .MATERIALS("[Electrolyzer] Generated Electrolyzer recipe for " + matDust.getDisplayName()); - } else { - Logger.MATERIALS( - "[Electrolyzer] Failed to generate Electrolyzer recipe for " + matDust.getDisplayName()); - } - } catch (Throwable t) { - t.printStackTrace(); - } - } else if (componentMap.size() > 6 && componentMap.size() <= 9) { - Logger.MATERIALS( - "[Issue][Electrolyzer] " + material.getLocalizedName() - + " is composed of over 6 materials, so an electrolyzer recipe for processing cannot be generated. Trying to create one for the Dehydrator instead."); - - ItemStack mInternalOutputs[] = new ItemStack[9]; - int mChances[] = new int[9]; - int mCellCount = 0; - - int mTotalCount = 0; - - int mCounter = 0; - for (Pair<Integer, Material> f : componentMap) { - if (f.getValue() - .getState() != MaterialState.SOLID - && f.getValue() - .getState() != MaterialState.ORE) { - Logger.MATERIALS( - "[Dehydrator] Found Fluid Component, adding " + f.getKey() - + " cells of " - + f.getValue() - .getLocalizedName() - + "."); - mInternalOutputs[mCounter++] = f.getValue() - .getCell(f.getKey()); - mCellCount += f.getKey(); - mTotalCount += f.getKey(); - Logger.MATERIALS( - "[Dehydrator] In total, adding " + mCellCount - + " cells for " - + material.getLocalizedName() - + " processing."); - } else { - Logger.MATERIALS( - "[Dehydrator] Found Solid Component, adding " + f.getKey() - + " dusts of " - + f.getValue() - .getLocalizedName() - + "."); - mInternalOutputs[mCounter++] = f.getValue() - .getDust(f.getKey()); - mTotalCount += f.getKey(); - } - } - - // Build Output Array - for (int g = 0; g < mInternalOutputs.length; g++) { - Logger.MATERIALS( - "[Dehydrator] Is output[" + g - + "] valid with a chance? " - + (mInternalOutputs[g] != null ? 10000 : 0)); - mChances[g] = (mInternalOutputs[g] != null ? 10000 : 0); - } - - ItemStack emptyCell = null; - if (mCellCount > 0) { - emptyCell = ItemUtils.getItemStackOfAmountFromOreDict("cellEmpty", mCellCount); - Logger.MATERIALS("[Dehydrator] Recipe now requires " + mCellCount + " empty cells as input."); - } - - ItemStack mainDust = material.getDust(material.smallestStackSizeWhenProcessing); - if (mainDust != null) { - Logger.MATERIALS( - "[Dehydrator] Recipe now requires " + material.smallestStackSizeWhenProcessing - + "x " - + mainDust.getDisplayName() - + " as input."); - } else { - mainDust = material.getDust(mTotalCount); - Logger.MATERIALS("[Dehydrator] Could not find valid input dust, trying alternative."); - if (mainDust != null) { - Logger.MATERIALS( - "[Dehydrator] Recipe now requires " + mTotalCount - + "x " - + mainDust.getDisplayName() - + " as input."); - } else { - Logger.MATERIALS("[Dehydrator] Could not find valid input dust, exiting."); - } - } - - for (int j = 0; j < mInternalOutputs.length; j++) { - if (mInternalOutputs[j] == null) { - mInternalOutputs[j] = GT_Values.NI; - Logger.MATERIALS("[Dehydrator] Set slot " + j + " to null."); - } else { - Logger.MATERIALS( - "[Dehydrator] Set slot " + j + " to " + mInternalOutputs[j].getDisplayName() + "."); - } - } - - try { - if (CORE.RA.addDehydratorRecipe( - new ItemStack[] { mainDust, emptyCell }, - null, - null, - mInternalOutputs, - mChances, - (int) Math.max(material.getMass() * 4L * 1, 1), - tVoltageMultiplier)) { - Logger.MATERIALS("[Dehydrator] Generated Dehydrator recipe for " + matDust.getDisplayName()); - Logger.MATERIALS( - "Inputs: " + mainDust.getDisplayName() - + " x" - + mainDust.stackSize - + ", " - + (emptyCell == null ? "No Cells" - : "" + emptyCell.getDisplayName() + " x" + emptyCell.stackSize)); - Logger.MATERIALS("Outputs " + ItemUtils.getArrayStackNames(mInternalOutputs)); - Logger.MATERIALS("Time: " + ((int) Math.max(material.getMass() * 4L * 1, 1))); - Logger.MATERIALS("EU: " + tVoltageMultiplier); - } else { - Logger.MATERIALS( - "[Dehydrator] Failed to generate Dehydrator recipe for " + matDust.getDisplayName()); - } - } catch (Throwable t) { - t.printStackTrace(); - } - } - } - - /** - * Shaped Crafting - */ - RecipeUtils.addShapedRecipe( - CI.craftingToolHammer_Hard, - null, - null, - material.getCrushedPurified(1), - null, - null, - null, - null, - null, - material.getDustPurified(1)); - - RecipeUtils.addShapedRecipe( - CI.craftingToolHammer_Hard, - null, - null, - material.getCrushed(1), - null, - null, - null, - null, - null, - material.getDustImpure(1)); - - RecipeUtils.addShapedRecipe( - CI.craftingToolHammer_Hard, - null, - null, - material.getCrushedCentrifuged(1), - null, - null, - null, - null, - null, - matDust); - - final ItemStack normalDust = matDust; - final ItemStack smallDust = material.getSmallDust(1); - final ItemStack tinyDust = material.getTinyDust(1); - - if (RecipeUtils.addShapedRecipe( - tinyDust, - tinyDust, - tinyDust, - tinyDust, - tinyDust, - tinyDust, - tinyDust, - tinyDust, - tinyDust, - normalDust)) { - Logger.WARNING("9 Tiny dust to 1 Dust Recipe: " + material.getLocalizedName() + " - Success"); - } else { - Logger.WARNING("9 Tiny dust to 1 Dust Recipe: " + material.getLocalizedName() + " - Failed"); - } - - if (RecipeUtils - .addShapedRecipe(normalDust, null, null, null, null, null, null, null, null, material.getTinyDust(9))) { - Logger.WARNING("9 Tiny dust from 1 Recipe: " + material.getLocalizedName() + " - Success"); - } else { - Logger.WARNING("9 Tiny dust from 1 Recipe: " + material.getLocalizedName() + " - Failed"); - } - - if (RecipeUtils - .addShapedRecipe(smallDust, smallDust, null, smallDust, smallDust, null, null, null, null, normalDust)) { - Logger.WARNING("4 Small dust to 1 Dust Recipe: " + material.getLocalizedName() + " - Success"); - } else { - Logger.WARNING("4 Small dust to 1 Dust Recipe: " + material.getLocalizedName() + " - Failed"); - } - - if (RecipeUtils - .addShapedRecipe(null, normalDust, null, null, null, null, null, null, null, material.getSmallDust(4))) { - Logger.WARNING("4 Small dust from 1 Dust Recipe: " + material.getLocalizedName() + " - Success"); - } else { - Logger.WARNING("4 Small dust from 1 Dust Recipe: " + material.getLocalizedName() + " - Failed"); - } - - // } - } - - public static boolean addElectrolyzerRecipe(ItemStack aInput1, ItemStack aInput2, FluidStack aFluidInput, - FluidStack aFluidOutput, ItemStack aOutput1, ItemStack aOutput2, ItemStack aOutput3, ItemStack aOutput4, - ItemStack aOutput5, ItemStack aOutput6, int[] aChances, int aDuration, int aEUt) { - if (((aInput1 == null) && (aFluidInput == null)) || ((aOutput1 == null) && (aFluidOutput == null))) { - Logger.MATERIALS("[Electrolyzer] Either both inputs or outputs are null."); - return false; - } - if ((aInput1 != null) && (aDuration <= 0)) { - Logger.MATERIALS("[Electrolyzer] Fail 1."); - return false; - } - if ((aFluidInput != null) && (aDuration <= 0)) { - Logger.MATERIALS("[Electrolyzer] Fail 2."); - return false; - } - GT_Values.RA.addElectrolyzerRecipe( - aInput1, - aInput2, - aFluidInput, - aFluidOutput, - aOutput1, - aOutput2, - aOutput3, - aOutput4, - aOutput5, - aOutput6, - aChances, - aDuration, - aEUt); - Logger.MATERIALS("[Electrolyzer] Recipe added."); - return true; - } - - public static ItemStack getTinyDust(Material m) { - ItemStack x = m.getTinyDust(1); - if (x == null) { - x = mStone.getDust(1); - } - return x; - } - - public static ItemStack getDust(Material m) { - ItemStack x = m.getDust(1); - if (x == null) { - x = mStone.getDust(1); - } - return x; - } -} diff --git a/gtpp/src/main/java/gtPlusPlus/xmod/gregtech/loaders/RecipeGen_Plasma.java b/gtpp/src/main/java/gtPlusPlus/xmod/gregtech/loaders/RecipeGen_Plasma.java deleted file mode 100644 index 01d6f9bb02..0000000000 --- a/gtpp/src/main/java/gtPlusPlus/xmod/gregtech/loaders/RecipeGen_Plasma.java +++ /dev/null @@ -1,62 +0,0 @@ -package gtPlusPlus.xmod.gregtech.loaders; - -import java.util.HashSet; -import java.util.Set; - -import net.minecraft.item.ItemStack; - -import gregtech.api.enums.GT_Values; -import gregtech.api.util.GT_Utility; -import gtPlusPlus.api.interfaces.RunnableWithInfo; -import gtPlusPlus.core.material.Material; -import gtPlusPlus.core.material.MaterialGenerator; -import gtPlusPlus.core.recipe.common.CI; -import gtPlusPlus.core.util.minecraft.ItemUtils; - -public class RecipeGen_Plasma extends RecipeGen_Base { - - public static final Set<RunnableWithInfo<Material>> mRecipeGenMap = new HashSet<>(); - - static { - MaterialGenerator.mRecipeMapsToGenerate.put(mRecipeGenMap); - } - - public RecipeGen_Plasma(final Material M) { - this.toGenerate = M; - mRecipeGenMap.add(this); - } - - @Override - public void run() { - generateRecipes(this.toGenerate); - } - - private void generateRecipes(final Material material) { - if (material.getPlasma() != null) { - // Cool Plasma - ItemStack aPlasmaCell = material.getPlasmaCell(1); - ItemStack aCell = material.getCell(1); - ItemStack aContainerItem = GT_Utility.getFluidForFilledItem(aPlasmaCell, true) == null - ? GT_Utility.getContainerItem(aPlasmaCell, true) - : CI.emptyCells(1); - if (ItemUtils.checkForInvalidItems(new ItemStack[] { aPlasmaCell, aContainerItem })) { - switch (material.getUnlocalizedName()) { - case "Runite": - GT_Values.RA.addFuel(GT_Utility.copyAmount(1L, aPlasmaCell), aContainerItem, 350_000, 4); - case "CelestialTungsten": - GT_Values.RA.addFuel(GT_Utility.copyAmount(1L, aPlasmaCell), aContainerItem, 720_000, 4); - default: - GT_Values.RA.addFuel( - GT_Utility.copyAmount(1L, aPlasmaCell), - aContainerItem, - (int) Math.max(1024L, 1024L * material.getMass()), - 4); - - } - } - if (ItemUtils.checkForInvalidItems(new ItemStack[] { aCell, aPlasmaCell })) { - GT_Values.RA.addVacuumFreezerRecipe(aPlasmaCell, aCell, (int) Math.max(material.getMass() * 2L, 1L)); - } - } - } -} diff --git a/gtpp/src/main/java/gtPlusPlus/xmod/gregtech/loaders/RecipeGen_Plates.java b/gtpp/src/main/java/gtPlusPlus/xmod/gregtech/loaders/RecipeGen_Plates.java deleted file mode 100644 index 7eebc16af7..0000000000 --- a/gtpp/src/main/java/gtPlusPlus/xmod/gregtech/loaders/RecipeGen_Plates.java +++ /dev/null @@ -1,225 +0,0 @@ -package gtPlusPlus.xmod.gregtech.loaders; - -import java.util.HashSet; -import java.util.Set; - -import net.minecraft.item.ItemStack; - -import gregtech.api.GregTech_API; -import gregtech.api.enums.GT_Values; -import gregtech.api.enums.ItemList; -import gregtech.api.objects.GT_RenderedTexture; -import gregtech.api.recipe.RecipeMaps; -import gtPlusPlus.api.interfaces.RunnableWithInfo; -import gtPlusPlus.api.objects.Logger; -import gtPlusPlus.core.material.Material; -import gtPlusPlus.core.material.MaterialGenerator; -import gtPlusPlus.core.recipe.common.CI; -import gtPlusPlus.core.util.minecraft.ItemUtils; - -public class RecipeGen_Plates extends RecipeGen_Base { - - public static final Set<RunnableWithInfo<Material>> mRecipeGenMap = new HashSet<>(); - - static { - MaterialGenerator.mRecipeMapsToGenerate.put(mRecipeGenMap); - } - - public RecipeGen_Plates(final Material M) { - this.toGenerate = M; - mRecipeGenMap.add(this); - } - - @Override - public void run() { - generateRecipes(this.toGenerate); - } - - private void generateRecipes(final Material material) { - - final int tVoltageMultiplier = material.getMeltingPointK() >= 2800 ? 60 : 15; - final ItemStack ingotStackOne = material.getIngot(1); - final ItemStack ingotStackTwo = material.getIngot(2); - final ItemStack ingotStackThree = material.getIngot(3); - final ItemStack ingotStackNine = material.getIngot(9); - final ItemStack shape_Mold = ItemList.Shape_Mold_Plate.get(0); - final ItemStack plate_Single = material.getPlate(1); - final ItemStack plate_SingleTwo = material.getPlate(2); - final ItemStack plate_SingleNine = material.getPlate(9); - final ItemStack plate_Double = material.getPlateDouble(1); - final ItemStack plate_Dense = material.getPlateDense(1); - final ItemStack foil_SingleFour = material.getFoil(4); - final ItemStack block = material.getBlock(1); - - Logger.WARNING("Generating Plate recipes for " + material.getLocalizedName()); - - // Forge Hammer - if (ItemUtils.checkForInvalidItems(ingotStackTwo) && ItemUtils.checkForInvalidItems(plate_Single)) - if (addForgeHammerRecipe( - ingotStackThree, - plate_SingleTwo, - (int) Math.max(material.getMass(), 1L), - material.vVoltageMultiplier)) { - Logger.WARNING("Forge Hammer Recipe: " + material.getLocalizedName() + " - Success"); - } else { - Logger.WARNING("Forge Hammer Recipe: " + material.getLocalizedName() + " - Failed"); - } - // Bender - if (ItemUtils.checkForInvalidItems(ingotStackOne) && ItemUtils.checkForInvalidItems(plate_Single)) - if (addBenderRecipe( - ingotStackOne, - plate_Single, - (int) Math.max(material.getMass() * 1L, 1L), - material.vVoltageMultiplier)) { - Logger.WARNING("Bender Recipe: " + material.getLocalizedName() + " - Success"); - } else { - Logger.WARNING("Bender Recipe: " + material.getLocalizedName() + " - Failed"); - } - if (ItemUtils.checkForInvalidItems(ingotStackOne) && ItemUtils.checkForInvalidItems(foil_SingleFour)) - if (addBenderRecipe( - ingotStackOne, - CI.getNumberedCircuit(10), - foil_SingleFour, - (int) Math.max(material.getMass() * 2L, 1L), - material.vVoltageMultiplier)) { - Logger.WARNING("Bender Recipe: " + material.getLocalizedName() + " - Success"); - } else { - Logger.WARNING("Bender Recipe: " + material.getLocalizedName() + " - Failed"); - } - // Alloy Smelter - if (ItemUtils.checkForInvalidItems(ingotStackTwo) && ItemUtils.checkForInvalidItems(plate_Single)) - if (GT_Values.RA.addAlloySmelterRecipe( - ingotStackTwo, - shape_Mold, - plate_Single, - (int) Math.max(material.getMass() * 2L, 1L), - material.vVoltageMultiplier)) { - Logger.WARNING("Alloy Smelter Recipe: " + material.getLocalizedName() + " - Success"); - } else { - Logger.WARNING("Alloy Smelter Recipe: " + material.getLocalizedName() + " - Failed"); - } - // Cutting Machine - if (ItemUtils.checkForInvalidItems(block) && ItemUtils.checkForInvalidItems(plate_Single)) - if (GT_Values.RA.addCutterRecipe( - block, - plate_SingleNine, - null, - (int) Math.max(material.getMass() * 10L, 1L), - material.vVoltageMultiplier)) { - Logger.WARNING("Cutting Machine Recipe: " + material.getLocalizedName() + " - Success"); - } else { - Logger.WARNING("Cutting Machine Recipe: " + material.getLocalizedName() + " - Failed"); - } - - // Making Double Plates - if (ItemUtils.checkForInvalidItems(ingotStackTwo) && ItemUtils.checkForInvalidItems(plate_Double)) - if (addBenderRecipe( - ingotStackTwo, - plate_Double, - (int) Math.max(material.getMass() * 2L, 1L), - material.vVoltageMultiplier)) { - Logger.WARNING("Bender Recipe: " + material.getLocalizedName() + " - Success"); - } else { - Logger.WARNING("Bender Recipe: " + material.getLocalizedName() + " - Failed"); - } - - if (ItemUtils.checkForInvalidItems(plate_SingleTwo) && ItemUtils.checkForInvalidItems(plate_Double)) - if (addBenderRecipe( - plate_SingleTwo, - plate_Double, - (int) Math.max(material.getMass() * 2L, 1L), - material.vVoltageMultiplier)) { - Logger.WARNING("Bender Recipe: " + material.getLocalizedName() + " - Success"); - } else { - Logger.WARNING("Bender Recipe: " + material.getLocalizedName() + " - Failed"); - } - - // Bender - if (ItemUtils.checkForInvalidItems(material.getPlate(1)) && ItemUtils.checkForInvalidItems(material.getFoil(1))) - if (addBenderRecipe( - material.getPlate(1), - material.getFoil(4), - (int) Math.max(material.getMass(), 1L), - material.vVoltageMultiplier)) { - GregTech_API.registerCover( - material.getFoil(1), - new GT_RenderedTexture(material.getTextureSet().mTextures[70], material.getRGBA(), false), - null); - Logger.WARNING("Bender Foil Recipe: " + material.getLocalizedName() + " - Success"); - } else { - Logger.WARNING("Bender Foil Recipe: " + material.getLocalizedName() + " - Failed"); - } - - // Making Dense Plates - if (ItemUtils.checkForInvalidItems(ingotStackNine) && ItemUtils.checkForInvalidItems(plate_Dense)) - if (addBenderRecipe( - ingotStackNine, - plate_Dense, - (int) Math.max(material.getMass() * 2L, 1L), - material.vVoltageMultiplier)) { - Logger.WARNING("Bender Recipe: " + material.getLocalizedName() + " - Success"); - } else { - Logger.WARNING("Bender Recipe: " + material.getLocalizedName() + " - Failed"); - } - - if (ItemUtils.checkForInvalidItems(plate_SingleNine) && ItemUtils.checkForInvalidItems(plate_Dense)) - if (addBenderRecipe( - plate_SingleNine, - plate_Dense, - (int) Math.max(material.getMass() * 2L, 1L), - material.vVoltageMultiplier)) { - Logger.WARNING("Bender Recipe: " + material.getLocalizedName() + " - Success"); - } else { - Logger.WARNING("Bender Recipe: " + material.getLocalizedName() + " - Failed"); - } - } - - public static boolean addBenderRecipe(final ItemStack aInput1, final ItemStack aOutput1, int aDuration, - final int aEUt) { - return GT_Values.RA.addBenderRecipe(aInput1, aOutput1, aDuration, aEUt); - } - - public static boolean addBenderRecipe(final ItemStack aInput1, final ItemStack aCircuit, final ItemStack aOutput1, - int aDuration, final int aEUt) { - return GT_Values.RA.addBenderRecipe(aInput1, aCircuit, aOutput1, aDuration, aEUt); - } - - public static boolean addExtruderRecipe(final ItemStack aInput, final ItemStack aShape, final ItemStack aOutput, - int aDuration, final int aEUt) { - if ((aInput == null) || (aShape == null) || (aOutput == null)) { - return false; - } - if (aDuration <= 0) { - return false; - } - RecipeMaps.extruderRecipes.addRecipe( - true, - new ItemStack[] { aInput, aShape }, - new ItemStack[] { aOutput }, - null, - null, - null, - aDuration, - aEUt, - 0); - return true; - } - - public static boolean addForgeHammerRecipe(final ItemStack aInput1, final ItemStack aOutput1, final int aDuration, - final int aEUt) { - if ((aInput1 == null) || (aOutput1 == null)) { - return false; - } - RecipeMaps.hammerRecipes.addRecipe( - true, - new ItemStack[] { aInput1 }, - new ItemStack[] { aOutput1 }, - null, - null, - null, - aDuration, - aEUt, - 0); - return true; - } -} diff --git a/gtpp/src/main/java/gtPlusPlus/xmod/gregtech/loaders/RecipeGen_Recycling.java b/gtpp/src/main/java/gtPlusPlus/xmod/gregtech/loaders/RecipeGen_Recycling.java deleted file mode 100644 index 044ce58c62..0000000000 --- a/gtpp/src/main/java/gtPlusPlus/xmod/gregtech/loaders/RecipeGen_Recycling.java +++ /dev/null @@ -1,400 +0,0 @@ -package gtPlusPlus.xmod.gregtech.loaders; - -import static gregtech.api.enums.GT_Values.L; -import static gregtech.api.enums.GT_Values.M; - -import java.util.ArrayList; -import java.util.Map; - -import net.minecraft.init.Items; -import net.minecraft.item.ItemStack; -import net.minecraftforge.oredict.OreDictionary; - -import org.apache.commons.lang3.reflect.FieldUtils; - -import gregtech.api.enums.Materials; -import gregtech.api.enums.OrePrefixes; -import gregtech.api.util.GT_ModHandler; -import gregtech.api.util.GT_OreDictUnificator; -import gregtech.api.util.GT_Utility; -import gtPlusPlus.api.objects.Logger; -import gtPlusPlus.api.objects.data.AutoMap; -import gtPlusPlus.api.objects.data.Pair; -import gtPlusPlus.core.lib.CORE; -import gtPlusPlus.core.material.Material; -import gtPlusPlus.core.material.state.MaterialState; -import gtPlusPlus.core.util.Utils; -import gtPlusPlus.core.util.minecraft.ItemUtils; -import gtPlusPlus.core.util.reflect.ReflectionUtils; - -public class RecipeGen_Recycling implements Runnable { - - public static AutoMap<Runnable> mQueuedRecyclingGenerators = new AutoMap<>(); - - public static void executeGenerators() { - if (mQueuedRecyclingGenerators.size() > 0) { - for (Runnable R : mQueuedRecyclingGenerators.values()) { - R.run(); - } - } - } - - final Material toGenerate; - public static Map<String, ItemStack> mNameMap; - - public RecipeGen_Recycling(final Material M) { - this.toGenerate = M; - if (mNameMap == null) { - mNameMap = this.getNameMap(); - } - mQueuedRecyclingGenerators.put(this); - } - - @Override - public void run() { - if (mNameMap != null) { - generateRecipes(this.toGenerate); - } - } - - public static void generateRecipes(final Material material) { - - if (material != null) Logger.WARNING("Generating Recycling recipes for " + material.getLocalizedName()); - - final OrePrefixes[] mValidPrefixesAsString = { OrePrefixes.ingot, OrePrefixes.ingotHot, OrePrefixes.nugget, - OrePrefixes.plate, OrePrefixes.plateDense, OrePrefixes.plateDouble, OrePrefixes.plateTriple, - OrePrefixes.plateQuadruple, OrePrefixes.plateQuintuple, OrePrefixes.stick, OrePrefixes.stickLong, - OrePrefixes.bolt, OrePrefixes.screw, OrePrefixes.ring, OrePrefixes.rotor, OrePrefixes.gearGt, - OrePrefixes.gearGtSmall, OrePrefixes.gear, OrePrefixes.block, OrePrefixes.cableGt01, OrePrefixes.cableGt02, - OrePrefixes.cableGt04, OrePrefixes.cableGt08, OrePrefixes.cableGt12, OrePrefixes.wireFine, - OrePrefixes.wireGt01, OrePrefixes.wireGt02, OrePrefixes.wireGt04, OrePrefixes.wireGt08, - OrePrefixes.wireGt12, OrePrefixes.wireGt16, OrePrefixes.foil, OrePrefixes.frameGt, OrePrefixes.pipeHuge, - OrePrefixes.pipeLarge, OrePrefixes.pipeMedium, OrePrefixes.pipeSmall, OrePrefixes.pipeTiny, }; - - int mSlotIndex = 0; - Pair<OrePrefixes, ItemStack>[] mValidPairs = new Pair[mValidPrefixesAsString.length]; - - for (int r = 0; r < mValidPairs.length; r++) { - ItemStack temp = getItemStackOfAmountFromOreDictNoBroken( - mValidPrefixesAsString[r].name() + Utils.sanitizeString(material.getLocalizedName()), - 1); - if (temp != null) { - mValidPairs[mSlotIndex++] = new Pair<>(mValidPrefixesAsString[r], temp.copy()); - } - } - - if (mValidPairs.length > 0) { - int validCounter = 0; - Pair<OrePrefixes, ItemStack>[] temp = mValidPairs; - for (Pair<OrePrefixes, ItemStack> temp2 : mValidPairs) { - if (temp2 != null) { - Logger.WARNING( - "Valid: " + temp2.getValue() - .getDisplayName()); - validCounter++; - } - } - Pair<OrePrefixes, ItemStack> temp3[] = new Pair[validCounter]; - int temp4 = 0; - for (Pair<OrePrefixes, ItemStack> r : mValidPairs) { - if (r != null) { - temp3[temp4++] = r; - } - } - if (temp3.length > 0) { - mValidPairs = temp3.clone(); - } - } - - if (mValidPrefixesAsString.length >= 1) { - for (final Pair<OrePrefixes, ItemStack> validPrefix : mValidPairs) { - try { - - if (material == null || validPrefix == null - || (material.getState() != MaterialState.SOLID && material.getState() != MaterialState.LIQUID) - || validPrefix.getKey() == OrePrefixes.ingotHot) { - continue; - } - - final ItemStack tempStack = validPrefix.getValue(); - final ItemStack mDust = getDust(material, validPrefix.getKey()); - final Pair<OrePrefixes, ItemStack> mData = getDustData(material, validPrefix.getKey()); - int mFluidAmount = (int) GT_Utility - .translateMaterialToFluidAmount(validPrefix.getKey().mMaterialAmount, true); - - // Maceration - if (ItemUtils.checkForInvalidItems(tempStack)) { - // mValidItems[mSlotIndex++] = tempStack; - if ((mDust != null) && GT_ModHandler.addPulverisationRecipe(tempStack, mDust)) { - Logger.WARNING( - "Recycle Recipe: " + material.getLocalizedName() - + " - Success - Recycle " - + tempStack.getDisplayName() - + " and obtain " - + mDust.getDisplayName()); - } else { - Logger.WARNING("Recycle Recipe: " + material.getLocalizedName() + " - Failed"); - if (mDust == null) { - Logger.WARNING("Invalid Dust output."); - } - } - } - - // Arc Furnace - if (ItemUtils.checkForInvalidItems(tempStack)) {} - - // Fluid Extractor - if (ItemUtils.checkForInvalidItems(tempStack)) { - // mValidItems[mSlotIndex++] = tempStack; - - int aFluidAmount = (int) ((L * validPrefix.getKey().mMaterialAmount) - / (M * tempStack.stackSize)); - int aDuration = (int) Math.max(1, (24 * validPrefix.getKey().mMaterialAmount) / M); - boolean aGenFluidExtraction = CORE.RA.addFluidExtractionRecipe( - tempStack, - material.getFluidStack(aFluidAmount), - aDuration, - material.vVoltageMultiplier); - if (aGenFluidExtraction /* - * (mDust != null) && CORE.RA.addFluidExtractionRecipe(tempStack, - * material.getFluidStack(mFluidAmount), 30, - * material.vVoltageMultiplier) - */) { - Logger.WARNING( - "Fluid Recycle Recipe: " + material.getLocalizedName() - + " - Success - Recycle " - + tempStack.getDisplayName() - + " and obtain " - + aFluidAmount - + "mb of " - + material.getFluidStack(1) - .getLocalizedName() - + ". Time: " - + aDuration - + ", Voltage: " - + material.vVoltageMultiplier); - } else { - Logger.WARNING("Fluid Recycle Recipe: " + material.getLocalizedName() + " - Failed"); - if (mDust == null) { - Logger.WARNING("Invalid Dust output."); - } - } - } - - } catch (final Throwable t) { - t.printStackTrace(); - // Utils.LOG_WARNING("Returning Null. Throwable Info: - // "+t.getMessage()); - // Utils.LOG_WARNING("Throwable Info: "+t.toString()); - // Utils.LOG_WARNING("Throwable Info: - // "+t.getCause().toString()); - } - } - } - } - - public static Pair<OrePrefixes, ItemStack> getDustData(final Material aMaterial, final OrePrefixes aPrefix) { - return getDustData(aMaterial, aPrefix.mMaterialAmount); - } - - public static Pair<OrePrefixes, ItemStack> getDustData(final Material aMaterial, final long aMaterialAmount) { - ItemStack mDust = null; - OrePrefixes mPrefix = null; - - if (aMaterial == null || aMaterialAmount <= 0) { - return null; - } - if ((((aMaterialAmount % M) == 0) || (aMaterialAmount >= (M * 16)))) { - mDust = get(OrePrefixes.dust, aMaterial, aMaterialAmount / M); - mPrefix = OrePrefixes.dust; - } - if ((mDust == null) && ((((aMaterialAmount * 4) % M) == 0) || (aMaterialAmount >= (M * 8)))) { - mDust = get(OrePrefixes.dustSmall, aMaterial, (aMaterialAmount * 4) / M); - mPrefix = OrePrefixes.dustSmall; - } - if ((mDust == null) && (((aMaterialAmount * 9) >= M))) { - mDust = get(OrePrefixes.dustTiny, aMaterial, (aMaterialAmount * 9) / M); - mPrefix = OrePrefixes.dustTiny; - } - - if (mPrefix != null && mDust != null) { - Logger.WARNING("Built valid dust pair."); - return new Pair<>(mPrefix, mDust); - } else { - Logger.WARNING("mPrefix: " + (mPrefix != null)); - Logger.WARNING("mDust: " + (mDust != null)); - } - Logger.WARNING("Failed to build valid dust pair."); - return null; - } - - public static ItemStack getDust(final Material aMaterial, final OrePrefixes aPrefix) { - return aMaterial == null ? null : getDust(aMaterial, aPrefix.mMaterialAmount); - } - - public static ItemStack getDust(final Material aMaterial, final long aMaterialAmount) { - if (aMaterialAmount <= 0) { - return null; - } - ItemStack rStack = null; - if ((((aMaterialAmount % M) == 0) || (aMaterialAmount >= (M * 16)))) { - Logger.WARNING("Trying to get a Dust"); - rStack = get(OrePrefixes.dust, aMaterial, aMaterialAmount / M); - } - if ((rStack == null) && ((((aMaterialAmount * 4) % M) == 0) || (aMaterialAmount >= (M * 8)))) { - Logger.WARNING("Trying to get a Small Dust"); - rStack = get(OrePrefixes.dustSmall, aMaterial, (aMaterialAmount * 4) / M); - } - if ((rStack == null) && (((aMaterialAmount * 9) >= M))) { - Logger.WARNING("Trying to get a Tiny Dust"); - rStack = get(OrePrefixes.dustTiny, aMaterial, (aMaterialAmount * 9) / M); - } - return rStack; - } - - public static ItemStack get(final Object aName, final long aAmount) { - return get(aName, null, aAmount, true, true); - } - - public static ItemStack get(final Object aName, final ItemStack aReplacement, final long aAmount) { - return get(aName, aReplacement, aAmount, true, true); - } - - public static ItemStack get(final OrePrefixes aPrefix, final Material aMaterial, final long aAmount) { - return get(aPrefix, aMaterial, null, aAmount); - } - - public static ItemStack get(final OrePrefixes aPrefix, final Material aMaterial, final ItemStack aReplacement, - final long aAmount) { - return get( - aPrefix.name() + Utils.sanitizeString(aMaterial.getLocalizedName()), - aReplacement, - aAmount, - false, - true); - } - - public static ItemStack get(final Object aName, final ItemStack aReplacement, final long aAmount, - final boolean aMentionPossibleTypos, final boolean aNoInvalidAmounts) { - if (aNoInvalidAmounts && (aAmount < 1L)) { - Logger.WARNING("Returning Null. Method: " + ReflectionUtils.getMethodName(0)); - Logger.WARNING("Called from method: " + ReflectionUtils.getMethodName(1)); - Logger.WARNING("Called from method: " + ReflectionUtils.getMethodName(2)); - Logger.WARNING("Called from method: " + ReflectionUtils.getMethodName(3)); - Logger.WARNING("Called from method: " + ReflectionUtils.getMethodName(4)); - return null; - } - if (!mNameMap.containsKey(aName.toString()) && aMentionPossibleTypos) { - Logger.WARNING("Unknown Key for Unification, Typo? " + aName); - } - return GT_Utility.copyAmount( - aAmount, - new Object[] { mNameMap.get(aName.toString()), getFirstOre(aName, aAmount), aReplacement }); - } - - public static ItemStack getFirstOre(final Object aName, final long aAmount) { - if (GT_Utility.isStringInvalid(aName)) { - Logger.WARNING("Returning Null. Method: " + ReflectionUtils.getMethodName(0)); - Logger.WARNING("Called from method: " + ReflectionUtils.getMethodName(1)); - Logger.WARNING("Called from method: " + ReflectionUtils.getMethodName(2)); - Logger.WARNING("Called from method: " + ReflectionUtils.getMethodName(3)); - Logger.WARNING("Called from method: " + ReflectionUtils.getMethodName(4)); - return null; - } - final ItemStack tStack = mNameMap.get(aName.toString()); - if (GT_Utility.isStackValid(tStack)) { - Logger.WARNING("Found valid stack."); - return GT_Utility.copyAmount(aAmount, new Object[] { tStack }); - } - return GT_Utility.copyAmount(aAmount, getOres(aName).toArray()); - } - - public static ArrayList<ItemStack> getOres(final Object aOreName) { - final String aName = (aOreName == null) ? "" : aOreName.toString(); - final ArrayList<ItemStack> rList = new ArrayList<>(); - if (GT_Utility.isStringValid(aName)) { - Logger.WARNING("Making a list of all OreDict entries for " + aOreName + "."); - if (rList.addAll(OreDictionary.getOres(aName))) { - Logger.WARNING("Added " + rList.size() + " elements to list."); - } else { - Logger.WARNING("Failed to Add Collection from oreDictionary, forcing an entry."); - rList.add(ItemUtils.getItemStackOfAmountFromOreDict((String) aOreName, 1)); - } - } - return rList; - } - - @SuppressWarnings("unchecked") - public Map<String, ItemStack> getNameMap() { - Map<String, ItemStack> tempMap; - try { - tempMap = (Map<String, ItemStack>) FieldUtils - .readStaticField(GT_OreDictUnificator.class, "sName2StackMap", true); - if (tempMap != null) { - Logger.WARNING("Found 'sName2StackMap' in GT_OreDictUnificator.class."); - return tempMap; - } - } catch (final IllegalAccessException e) { - e.printStackTrace(); - } - Logger.WARNING("Invalid map stored in GT_OreDictUnificator.class, unable to find sName2StackMap field."); - return null; - } - - public static ItemStack getItemStackOfAmountFromOreDictNoBroken(String oredictName, final int amount) { - - try { - - if (oredictName.contains("-") || oredictName.contains("_")) { - oredictName = Utils.sanitizeString(oredictName, new char[] { '-', '_' }); - } else { - oredictName = Utils.sanitizeString(oredictName); - } - - // Adds a check to grab dusts using GT methodology if possible. - ItemStack returnValue = null; - if (oredictName.toLowerCase() - .contains("dust")) { - final String MaterialName = oredictName.toLowerCase() - .replace("dust", ""); - final Materials m = Materials.get(MaterialName); - if (m != null && m != Materials._NULL) { - returnValue = ItemUtils.getGregtechDust(m, amount); - if (ItemUtils.checkForInvalidItems(returnValue)) { - return returnValue; - } - } - } - if (returnValue == null) { - returnValue = getItemStackOfAmountFromOreDict(oredictName, amount); - if (ItemUtils.checkForInvalidItems(returnValue)) { - return returnValue.copy(); - } - } - return null; - } catch (final Throwable t) { - return null; - } - } - - public static ItemStack getItemStackOfAmountFromOreDict(String oredictName, final int amount) { - String mTemp = oredictName; - - // Banned Materials and replacements for GT5.8 compat. - - if (oredictName.toLowerCase() - .contains("ingotclay")) { - return ItemUtils.getSimpleStack(Items.clay_ball, amount); - } - - final ArrayList<ItemStack> oreDictList = OreDictionary.getOres(mTemp); - if (!oreDictList.isEmpty()) { - final ItemStack returnValue = oreDictList.get(0) - .copy(); - returnValue.stackSize = amount; - return returnValue; - } - return null; - // return getItemStackOfAmountFromOreDictNoBroken(mTemp, amount); - } -} diff --git a/gtpp/src/main/java/gtPlusPlus/xmod/gregtech/loaders/RecipeGen_ShapedCrafting.java b/gtpp/src/main/java/gtPlusPlus/xmod/gregtech/loaders/RecipeGen_ShapedCrafting.java deleted file mode 100644 index 3ef1740189..0000000000 --- a/gtpp/src/main/java/gtPlusPlus/xmod/gregtech/loaders/RecipeGen_ShapedCrafting.java +++ /dev/null @@ -1,222 +0,0 @@ -package gtPlusPlus.xmod.gregtech.loaders; - -import java.util.HashSet; -import java.util.Set; - -import gregtech.api.util.GT_ModHandler; -import gtPlusPlus.api.interfaces.RunnableWithInfo; -import gtPlusPlus.api.objects.Logger; -import gtPlusPlus.core.material.Material; -import gtPlusPlus.core.material.MaterialGenerator; -import gtPlusPlus.core.util.minecraft.ItemUtils; - -public class RecipeGen_ShapedCrafting extends RecipeGen_Base { - - public static final Set<RunnableWithInfo<Material>> mRecipeGenMap = new HashSet<>(); - - static { - MaterialGenerator.mRecipeMapsToGenerate.put(mRecipeGenMap); - } - - public RecipeGen_ShapedCrafting(final Material M) { - this.toGenerate = M; - mRecipeGenMap.add(this); - } - - @Override - public void run() { - generateRecipes(this.toGenerate); - } - - private void generateRecipes(final Material material) { - Logger.WARNING("Generating Shaped Crafting recipes for " + material.getLocalizedName()); // TODO - - // Single Plate Shaped/Shapeless - if (ItemUtils.checkForInvalidItems(material.getPlate(1)) - && ItemUtils.checkForInvalidItems(material.getIngot(1))) - if (material.getPlate(1) != null && material.getIngot(1) != null) GT_ModHandler.addCraftingRecipe( - material.getPlate(1), - gregtech.api.util.GT_ModHandler.RecipeBits.DO_NOT_CHECK_FOR_COLLISIONS - | gregtech.api.util.GT_ModHandler.RecipeBits.BUFFERED, - new Object[] { "h", "B", "I", Character.valueOf('I'), material.getIngot(1), Character.valueOf('B'), - material.getIngot(1) }); - - if (ItemUtils.checkForInvalidItems(material.getPlate(1)) - && ItemUtils.checkForInvalidItems(material.getIngot(1))) - GT_ModHandler.addShapelessCraftingRecipe( - material.getPlate(1), - new Object[] { gregtech.api.enums.ToolDictNames.craftingToolForgeHammer, material.getIngot(1), - material.getIngot(1) }); - - // Double Plate Shaped/Shapeless - if (ItemUtils.checkForInvalidItems(material.getPlateDouble(1)) - && ItemUtils.checkForInvalidItems(material.getPlate(1))) - GT_ModHandler.addCraftingRecipe( - material.getPlateDouble(1), - gregtech.api.util.GT_ModHandler.RecipeBits.DO_NOT_CHECK_FOR_COLLISIONS - | gregtech.api.util.GT_ModHandler.RecipeBits.BUFFERED, - new Object[] { "I", "B", "h", Character.valueOf('I'), material.getPlate(1), Character.valueOf('B'), - material.getPlate(1) }); - - if (ItemUtils.checkForInvalidItems(material.getPlateDouble(1)) - && ItemUtils.checkForInvalidItems(material.getPlate(1))) - GT_ModHandler.addShapelessCraftingRecipe( - material.getPlateDouble(1), - new Object[] { gregtech.api.enums.ToolDictNames.craftingToolForgeHammer, material.getPlate(1), - material.getPlate(1) }); - - // Ring Recipe - if (!material.isRadioactive && ItemUtils.checkForInvalidItems(material.getRing(1)) - && ItemUtils.checkForInvalidItems(material.getRod(1))) { - if (GT_ModHandler.addCraftingRecipe( - material.getRing(1), - GT_ModHandler.RecipeBits.DO_NOT_CHECK_FOR_COLLISIONS | GT_ModHandler.RecipeBits.BUFFERED, - new Object[] { "h ", "fR", 'R', material.getRod(1) })) { - Logger.WARNING("GT:NH Ring Recipe: " + material.getLocalizedName() + " - Success"); - } else { - Logger.WARNING("GT:NH Ring Recipe: " + material.getLocalizedName() + " - Failed"); - } - } - - // Framebox Recipe - if (!material.isRadioactive && ItemUtils.checkForInvalidItems(material.getFrameBox(1)) - && ItemUtils.checkForInvalidItems(material.getRod(1))) { - if (GT_ModHandler.addCraftingRecipe( - material.getFrameBox(2), - gregtech.api.util.GT_ModHandler.RecipeBits.DO_NOT_CHECK_FOR_COLLISIONS - | gregtech.api.util.GT_ModHandler.RecipeBits.BUFFERED, - new Object[] { "RRR", "RwR", "RRR", 'R', material.getRod(1) })) { - Logger.WARNING("Framebox Recipe: " + material.getLocalizedName() + " - Success"); - } else { - Logger.WARNING("Framebox Recipe: " + material.getLocalizedName() + " - Failed"); - } - } - - // Shaped Recipe - Bolts - if (!material.isRadioactive && ItemUtils.checkForInvalidItems(material.getBolt(1)) - && ItemUtils.checkForInvalidItems(material.getRod(1))) { - if (GT_ModHandler.addCraftingRecipe( - material.getBolt(2), - gregtech.api.util.GT_ModHandler.RecipeBits.DO_NOT_CHECK_FOR_COLLISIONS - | gregtech.api.util.GT_ModHandler.RecipeBits.BUFFERED, - new Object[] { "s ", " R", 'R', material.getRod(1) })) { - Logger.WARNING("Bolt Recipe: " + material.getLocalizedName() + " - Success"); - } else { - Logger.WARNING("Bolt Recipe: " + material.getLocalizedName() + " - Failed"); - } - } - - // Shaped Recipe - Fine Wire - if (!material.isRadioactive && ItemUtils.checkForInvalidItems(material.getFoil(1)) - && ItemUtils.checkForInvalidItems(material.getFineWire(1))) { - if (GT_ModHandler.addCraftingRecipe( - material.getFineWire(1), - gregtech.api.util.GT_ModHandler.RecipeBits.DO_NOT_CHECK_FOR_COLLISIONS - | gregtech.api.util.GT_ModHandler.RecipeBits.BUFFERED, - new Object[] { "Fx", 'F', material.getFoil(1) })) { - Logger.WARNING("Fine Wire Recipe: " + material.getLocalizedName() + " - Success"); - } else { - Logger.WARNING("Fine Wire Recipe: " + material.getLocalizedName() + " - Failed"); - } - } - - // Shaped Recipe - Foil - if (ItemUtils.checkForInvalidItems(material.getFoil(1)) - && ItemUtils.checkForInvalidItems(material.getPlate(1))) { - if (GT_ModHandler.addCraftingRecipe( - material.getFoil(2), - gregtech.api.util.GT_ModHandler.RecipeBits.DO_NOT_CHECK_FOR_COLLISIONS - | gregtech.api.util.GT_ModHandler.RecipeBits.BUFFERED, - new Object[] { "hP", 'P', material.getPlate(1) })) { - Logger.WARNING("Foil Recipe: " + material.getLocalizedName() + " - Success"); - } else { - Logger.WARNING("Foil Recipe: " + material.getLocalizedName() + " - Failed"); - } - } - - // Shaped Recipe - Ingot to Rod - if (ItemUtils.checkForInvalidItems(material.getRod(1)) && ItemUtils.checkForInvalidItems(material.getIngot(1))) - if (GT_ModHandler.addCraftingRecipe( - material.getRod(1), - gregtech.api.util.GT_ModHandler.RecipeBits.DO_NOT_CHECK_FOR_COLLISIONS - | gregtech.api.util.GT_ModHandler.RecipeBits.BUFFERED, - new Object[] { "f ", " I", 'I', material.getIngot(1) })) { - Logger.WARNING("Rod Recipe: " + material.getLocalizedName() + " - Success"); - } else { - Logger.WARNING("Rod Recipe: " + material.getLocalizedName() + " - Failed"); - } - - // Shaped Recipe - Long Rod to two smalls - if (ItemUtils.checkForInvalidItems(material.getRod(1)) - && ItemUtils.checkForInvalidItems(material.getLongRod(1))) - if (GT_ModHandler.addCraftingRecipe( - material.getRod(2), - gregtech.api.util.GT_ModHandler.RecipeBits.DO_NOT_CHECK_FOR_COLLISIONS - | gregtech.api.util.GT_ModHandler.RecipeBits.BUFFERED, - new Object[] { "s", "L", 'L', material.getLongRod(1) })) { - Logger.WARNING("Rod Recipe: " + material.getLocalizedName() + " - Success"); - } else { - Logger.WARNING("Rod Recipe: " + material.getLocalizedName() + " - Failed"); - } - - // Two small to long rod - if (ItemUtils.checkForInvalidItems(material.getLongRod(1)) - && ItemUtils.checkForInvalidItems(material.getRod(1))) - if (GT_ModHandler.addCraftingRecipe( - material.getLongRod(1), - gregtech.api.util.GT_ModHandler.RecipeBits.DO_NOT_CHECK_FOR_COLLISIONS - | gregtech.api.util.GT_ModHandler.RecipeBits.BUFFERED, - new Object[] { "RhR", 'R', material.getRod(1) })) { - Logger.WARNING("Long Rod Recipe: " + material.getLocalizedName() + " - Success"); - } else { - Logger.WARNING("Long Rod Recipe: " + material.getLocalizedName() + " - Failed"); - } - - // Rotor Recipe - if (!material.isRadioactive && ItemUtils.checkForInvalidItems(material.getRotor(1)) - && ItemUtils.checkForInvalidItems(material.getRing(1)) - && !material.isRadioactive - && ItemUtils.checkForInvalidItems(material.getPlate(1)) - && ItemUtils.checkForInvalidItems(material.getScrew(1))) { - if (GT_ModHandler.addCraftingRecipe( - material.getRotor(1), - gregtech.api.util.GT_ModHandler.RecipeBits.DO_NOT_CHECK_FOR_COLLISIONS - | gregtech.api.util.GT_ModHandler.RecipeBits.BUFFERED, - new Object[] { "PhP", "SRf", "PdP", 'P', material.getPlate(1), 'S', material.getScrew(1), 'R', - material.getRing(1), })) { - Logger.WARNING("Rotor Recipe: " + material.getLocalizedName() + " - Success"); - } else { - Logger.WARNING("Rotor Recipe: " + material.getLocalizedName() + " - Failed"); - } - } - - // Gear Recipe - if (!material.isRadioactive && ItemUtils.checkForInvalidItems(material.getGear(1)) - && ItemUtils.checkForInvalidItems(material.getPlate(1)) - && ItemUtils.checkForInvalidItems(material.getRod(1))) { - if (GT_ModHandler.addCraftingRecipe( - material.getGear(1), - gregtech.api.util.GT_ModHandler.RecipeBits.DO_NOT_CHECK_FOR_COLLISIONS - | gregtech.api.util.GT_ModHandler.RecipeBits.BUFFERED, - new Object[] { "RPR", "PwP", "RPR", 'P', material.getPlate(1), 'R', material.getRod(1), })) { - Logger.WARNING("Gear Recipe: " + material.getLocalizedName() + " - Success"); - } else { - Logger.WARNING("Gear Recipe: " + material.getLocalizedName() + " - Failed"); - } - } - - // Screws - if (!material.isRadioactive && ItemUtils.checkForInvalidItems(material.getScrew(1)) - && ItemUtils.checkForInvalidItems(material.getBolt(1))) { - if (GT_ModHandler.addCraftingRecipe( - material.getScrew(1), - gregtech.api.util.GT_ModHandler.RecipeBits.DO_NOT_CHECK_FOR_COLLISIONS - | gregtech.api.util.GT_ModHandler.RecipeBits.BUFFERED, - new Object[] { "fB", "B ", 'B', material.getBolt(1), })) { - Logger.WARNING("Screw Recipe: " + material.getLocalizedName() + " - Success"); - } else { - Logger.WARNING("Screw Recipe: " + material.getLocalizedName() + " - Failed"); - } - } - } -} diff --git a/gtpp/src/main/java/gtPlusPlus/xmod/gregtech/loaders/misc/AddCustomMachineToPA.java b/gtpp/src/main/java/gtPlusPlus/xmod/gregtech/loaders/misc/AddCustomMachineToPA.java deleted file mode 100644 index aab24db6d3..0000000000 --- a/gtpp/src/main/java/gtPlusPlus/xmod/gregtech/loaders/misc/AddCustomMachineToPA.java +++ /dev/null @@ -1,13 +0,0 @@ -package gtPlusPlus.xmod.gregtech.loaders.misc; - -import gregtech.api.util.GT_ProcessingArray_Manager; -import gtPlusPlus.api.recipe.GTPPRecipeMaps; - -public class AddCustomMachineToPA { - - public static void register() { - - // Simple Washers - GT_ProcessingArray_Manager.addRecipeMapToPA("simplewasher.01", GTPPRecipeMaps.simpleWasherRecipes); - } -} diff --git a/gtpp/src/main/java/gtPlusPlus/xmod/gregtech/loaders/recipe/RecipeLoader_AlgaeFarm.java b/gtpp/src/main/java/gtPlusPlus/xmod/gregtech/loaders/recipe/RecipeLoader_AlgaeFarm.java deleted file mode 100644 index 69d79cdc4b..0000000000 --- a/gtpp/src/main/java/gtPlusPlus/xmod/gregtech/loaders/recipe/RecipeLoader_AlgaeFarm.java +++ /dev/null @@ -1,192 +0,0 @@ -package gtPlusPlus.xmod.gregtech.loaders.recipe; - -import java.util.HashMap; - -import net.minecraft.item.ItemStack; -import net.minecraftforge.fluids.FluidStack; - -import gregtech.api.enums.GT_Values; -import gregtech.api.util.GT_Recipe; -import gtPlusPlus.api.objects.Logger; -import gtPlusPlus.api.objects.data.AutoMap; -import gtPlusPlus.api.objects.data.WeightedCollection; -import gtPlusPlus.core.item.chemistry.AgriculturalChem; -import gtPlusPlus.core.util.math.MathUtils; -import gtPlusPlus.core.util.minecraft.ItemUtils; - -public class RecipeLoader_AlgaeFarm { - - private static final HashMap<Integer, AutoMap<GT_Recipe>> mRecipeCache = new HashMap<>(); - private static final HashMap<Integer, AutoMap<GT_Recipe>> mRecipeCompostCache = new HashMap<>(); - - public static void generateRecipes() { - for (int i = 0; i < 10; i++) { - getTieredRecipeFromCache(i, false); - } - for (int i = 0; i < 10; i++) { - getTieredRecipeFromCache(i, true); - } - } - - public static GT_Recipe getTieredRecipeFromCache(int aTier, boolean aCompost) { - HashMap<Integer, AutoMap<GT_Recipe>> aMap = aCompost ? mRecipeCompostCache : mRecipeCache; - String aComp = aCompost ? "(Compost)" : ""; - - AutoMap<GT_Recipe> aTemp = aMap.get(aTier); - if (aTemp == null || aTemp.isEmpty()) { - aTemp = new AutoMap<>(); - aMap.put(aTier, aTemp); - Logger.INFO("Tier " + aTier + aComp + " had no recipes, initialising new map."); - } - if (aTemp.size() < 500) { - Logger - .INFO("Tier " + aTier + aComp + " has less than 500 recipes, generating " + (500 - aTemp.size()) + "."); - for (int i = aTemp.size(); i < 500; i++) { - aTemp.put(generateBaseRecipe(aCompost, aTier)); - } - } - int aIndex = MathUtils.randInt(0, aTemp.isEmpty() ? 1 : aTemp.size()); - Logger.INFO("Using recipe with index of " + aIndex + ". " + aComp); - return aTemp.get(aIndex); - } - - public static int compostForTier(int aTier) { - return aTier > 1 ? (int) Math.min(64, Math.pow(2, aTier - 1)) : 1; - } - - private static GT_Recipe generateBaseRecipe(boolean aUsingCompost, int aTier) { - - // Type Safety - if (aTier < 0) { - return null; - } - - WeightedCollection<Float> aOutputTimeMulti = new WeightedCollection<>(); - for (int i = 100; i > 0; i--) { - float aValue = 0; - if (i < 10) { - aValue = 3f; - } else if (i < 20) { - aValue = 2f; - } else { - aValue = 1f; - } - aOutputTimeMulti.put(i, aValue); - } - - final int[] aDurations = new int[] { 2000, 1800, 1600, 1400, 1200, 1000, 512, 256, 128, 64, 32, 16, 8, 4, 2, - 1 }; - - ItemStack[] aInputs = new ItemStack[] {}; - - if (aUsingCompost) { - // Make it use 4 compost per tier if we have some available - // Compost consumption maxes out at 1 stack per cycle - ItemStack aCompost = ItemUtils.getSimpleStack(AgriculturalChem.mCompost, compostForTier(aTier)); - aInputs = new ItemStack[] { aCompost }; - // Boost Tier by one if using compost so it gets a speed boost - aTier++; - } - - // We set these elsewhere - ItemStack[] aOutputs = getOutputsForTier(aTier); - - GT_Recipe tRecipe = new GT_Recipe( - false, - aInputs, - aOutputs, - (Object) null, - new int[] {}, - new FluidStack[] { GT_Values.NF }, - new FluidStack[] { GT_Values.NF }, - (int) (aDurations[aTier] * aOutputTimeMulti.get() / 2), // Time - 0, - 0); - - tRecipe.mSpecialValue = tRecipe.hashCode(); - - return tRecipe; - } - - private static ItemStack[] getOutputsForTier(int aTier) { - - // Create an Automap to dump contents into - AutoMap<ItemStack> aOutputMap = new AutoMap<>(); - - // Add loot relevant to tier and also add any from lower tiers. - - if (aTier >= 0) { - aOutputMap.put(ItemUtils.getSimpleStack(AgriculturalChem.mAlgaeBiosmass, 2)); - aOutputMap.put(ItemUtils.getSimpleStack(AgriculturalChem.mAlgaeBiosmass, 4)); - if (MathUtils.randInt(0, 10) > 9) { - aOutputMap.put(ItemUtils.getSimpleStack(AgriculturalChem.mGreenAlgaeBiosmass, 2)); - } - } - - if (aTier >= 1) { - aOutputMap.put(ItemUtils.getSimpleStack(AgriculturalChem.mAlgaeBiosmass, 4)); - aOutputMap.put(ItemUtils.getSimpleStack(AgriculturalChem.mGreenAlgaeBiosmass, 2)); - if (MathUtils.randInt(0, 10) > 9) { - aOutputMap.put(ItemUtils.getSimpleStack(AgriculturalChem.mGreenAlgaeBiosmass, 4)); - } - } - if (aTier >= 2) { - aOutputMap.put(ItemUtils.getSimpleStack(AgriculturalChem.mGreenAlgaeBiosmass, 2)); - aOutputMap.put(ItemUtils.getSimpleStack(AgriculturalChem.mGreenAlgaeBiosmass, 3)); - if (MathUtils.randInt(0, 10) > 9) { - aOutputMap.put(ItemUtils.getSimpleStack(AgriculturalChem.mGreenAlgaeBiosmass, 8)); - } - } - if (aTier >= 3) { - aOutputMap.put(ItemUtils.getSimpleStack(AgriculturalChem.mGreenAlgaeBiosmass, 4)); - aOutputMap.put(ItemUtils.getSimpleStack(AgriculturalChem.mBrownAlgaeBiosmass, 1)); - if (MathUtils.randInt(0, 10) > 9) { - aOutputMap.put(ItemUtils.getSimpleStack(AgriculturalChem.mBrownAlgaeBiosmass, 4)); - } - } - if (aTier >= 4) { - aOutputMap.put(ItemUtils.getSimpleStack(AgriculturalChem.mBrownAlgaeBiosmass, 2)); - aOutputMap.put(ItemUtils.getSimpleStack(AgriculturalChem.mBrownAlgaeBiosmass, 3)); - if (MathUtils.randInt(0, 10) > 9) { - aOutputMap.put(ItemUtils.getSimpleStack(AgriculturalChem.mGoldenBrownAlgaeBiosmass, 4)); - } - } - if (aTier >= 5) { - aOutputMap.put(ItemUtils.getSimpleStack(AgriculturalChem.mBrownAlgaeBiosmass, 4)); - aOutputMap.put(ItemUtils.getSimpleStack(AgriculturalChem.mGoldenBrownAlgaeBiosmass, 2)); - if (MathUtils.randInt(0, 10) > 9) { - aOutputMap.put(ItemUtils.getSimpleStack(AgriculturalChem.mRedAlgaeBiosmass, 4)); - } - } - // Tier 6 is Highest for outputs - if (aTier >= 6) { - aOutputMap.put(ItemUtils.getSimpleStack(AgriculturalChem.mGoldenBrownAlgaeBiosmass, 4)); - aOutputMap.put(ItemUtils.getSimpleStack(AgriculturalChem.mRedAlgaeBiosmass, 2)); - if (MathUtils.randInt(0, 10) > 9) { - aOutputMap.put(ItemUtils.getSimpleStack(AgriculturalChem.mRedAlgaeBiosmass, 8)); - } - } - - // Iterate a special loop at higher tiers to provide more Red/Gold Algae. - for (int i2 = 0; i2 < 20; i2++) { - if (aTier >= (6 + i2)) { - int aMulti = i2 + 1; - aOutputMap.put(ItemUtils.getSimpleStack(AgriculturalChem.mGreenAlgaeBiosmass, aMulti * 4)); - aOutputMap.put(ItemUtils.getSimpleStack(AgriculturalChem.mBrownAlgaeBiosmass, aMulti * 3)); - aOutputMap.put(ItemUtils.getSimpleStack(AgriculturalChem.mGoldenBrownAlgaeBiosmass, aMulti * 2)); - aOutputMap.put(ItemUtils.getSimpleStack(AgriculturalChem.mRedAlgaeBiosmass, aMulti)); - } else { - i2 = 20; - } - } - - // Map the AutoMap contents to an Itemstack Array. - ItemStack[] aOutputs = new ItemStack[aOutputMap.size()]; - for (int i = 0; i < aOutputMap.size(); i++) { - aOutputs[i] = aOutputMap.get(i); - } - - // Return filled ItemStack Array. - return aOutputs; - } -} diff --git a/gtpp/src/main/java/gtPlusPlus/xmod/gregtech/loaders/recipe/RecipeLoader_ChemicalSkips.java b/gtpp/src/main/java/gtPlusPlus/xmod/gregtech/loaders/recipe/RecipeLoader_ChemicalSkips.java deleted file mode 100644 index dfa6d9dea6..0000000000 --- a/gtpp/src/main/java/gtPlusPlus/xmod/gregtech/loaders/recipe/RecipeLoader_ChemicalSkips.java +++ /dev/null @@ -1,661 +0,0 @@ -package gtPlusPlus.xmod.gregtech.loaders.recipe; - -import static gregtech.api.enums.Mods.BartWorks; -import static gregtech.api.enums.Mods.EternalSingularity; -import static gregtech.api.enums.Mods.GalaxySpace; -import static gregtech.api.enums.Mods.GoodGenerator; -import static gregtech.api.enums.Mods.NewHorizonsCoreMod; -import static gregtech.api.recipe.RecipeMaps.assemblerRecipes; -import static gregtech.api.util.GT_ModHandler.getModItem; -import static gregtech.api.util.GT_RecipeBuilder.SECONDS; -import static gregtech.api.util.GT_RecipeBuilder.TICKS; - -import net.minecraft.item.ItemStack; -import net.minecraftforge.fluids.FluidStack; - -import com.github.bartimaeusnek.bartworks.system.material.WerkstoffLoader; -import com.github.technus.tectech.recipe.TT_recipeAdder; -import com.github.technus.tectech.thing.block.QuantumGlassBlock; - -import gregtech.api.enums.GT_Values; -import gregtech.api.enums.ItemList; -import gregtech.api.enums.Materials; -import gregtech.api.enums.MaterialsKevlar; -import gregtech.api.enums.MaterialsUEVplus; -import gregtech.api.enums.OrePrefixes; -import gregtech.api.enums.TierEU; -import gregtech.api.util.GT_ModHandler; -import gregtech.api.util.GT_OreDictUnificator; -import gregtech.api.util.GT_Utility; -import gregtech.common.items.CombType; -import gregtech.loaders.misc.GT_Bees; -import gtPlusPlus.core.item.chemistry.GenericChem; -import gtPlusPlus.core.lib.CORE; -import gtPlusPlus.core.material.ALLOY; -import gtPlusPlus.core.material.ELEMENT; -import gtPlusPlus.core.material.MISC_MATERIALS; -import gtPlusPlus.core.material.Particle; -import gtPlusPlus.core.recipe.common.CI; -import gtPlusPlus.core.util.minecraft.FluidUtils; -import gtPlusPlus.core.util.minecraft.ItemUtils; -import gtPlusPlus.xmod.gregtech.api.enums.GregtechItemList; - -public class RecipeLoader_ChemicalSkips { - - public static void generate() { - createRecipes(); - } - - private static void createRecipes() { - quantumTransformerRecipes(); - fusionReactorRecipes(); - catalystRecipes(); - tieredCasingRecipes(); - } - - // All the recipes that the QFT can do. Each recipe has a machine tier. - // -> Tier 1 is UEV (UEV circuits and 1 Eternal Singularity); - // -> Tier 2 needs new item from QFT, plus stacks of Infinity; - // -> Tier 3 needs new item from QFT, plus stacks of Transcendent Metal; - // -> Tier 4 needs new item from QFT, plus stacks of Spacetime; - // (Until they are created, the new items are represented by - // HSS-G for Tier 2, HSS-S for Tier 3 and HSS-E for Tier 4) - - private static void quantumTransformerRecipes() { - ItemStack stemcells = GT_Utility.copyAmountUnsafe(64 * 32, ItemList.Circuit_Chip_Stemcell.get(1)); - ItemStack biocells = GT_Utility.copyAmountUnsafe(64 * 32, ItemList.Circuit_Chip_Biocell.get(1)); - // Platline - CORE.RA.addQuantumTransformerRecipe( - new ItemStack[] { WerkstoffLoader.PTMetallicPowder.get(OrePrefixes.dust, 32), - ItemUtils.getSimpleStack(GenericChem.mPlatinumGroupCatalyst, 0) }, - new FluidStack[] {}, - new FluidStack[] {}, - new ItemStack[] { Materials.Platinum.getDust(64), Materials.Palladium.getDust(64), - Materials.Iridium.getDust(64), Materials.Osmium.getDust(64), - WerkstoffLoader.Rhodium.get(OrePrefixes.dust, 64), - WerkstoffLoader.Ruthenium.get(OrePrefixes.dust, 64) }, - new int[] { 1667, 1667, 1667, 1667, 1667, 1667 }, - 20 * 20, - (int) TierEU.RECIPE_UV, - 1); - - // Early Plastics - CORE.RA.addQuantumTransformerRecipe( - new ItemStack[] { Materials.Carbon.getDust(64), - ItemUtils.getSimpleStack(GenericChem.mPlasticPolymerCatalyst, 0) }, - new FluidStack[] { Materials.Oxygen.getGas(1000 * 16), Materials.Hydrogen.getGas(1000 * 16), - Materials.Chlorine.getGas(1000 * 16), Materials.Fluorine.getGas(1000 * 16) }, - new FluidStack[] { Materials.Plastic.getMolten(144 * 256), Materials.PolyvinylChloride.getMolten(144 * 128), - Materials.Polystyrene.getMolten(144 * 64), Materials.Polytetrafluoroethylene.getMolten(144 * 128), - Materials.Epoxid.getMolten(144 * 64), Materials.Polybenzimidazole.getMolten(144 * 64) }, - null, - new int[] { 2000, 2000, 2000, 2000, 2000, 2000 }, - 20 * 20, - (int) TierEU.RECIPE_ZPM, - 1); - - // Early Rubbers/Cable Materials - CORE.RA.addQuantumTransformerRecipe( - new ItemStack[] { Materials.Carbon.getDust(64), - ItemUtils.getSimpleStack(GenericChem.mRubberPolymerCatalyst, 0) }, - new FluidStack[] { Materials.Oxygen.getGas(1000 * 16), Materials.Hydrogen.getGas(1000 * 16), - Materials.Chlorine.getGas(1000 * 16) }, - new FluidStack[] { Materials.Silicone.getMolten(144 * 64), - Materials.StyreneButadieneRubber.getMolten(144 * 64), - Materials.PolyphenyleneSulfide.getMolten(144 * 128), Materials.Rubber.getMolten(144 * 256) }, - null, - new int[] { 2500, 2500, 2500, 2500 }, - 20 * 20, - (int) TierEU.RECIPE_ZPM, - 1); - - // Glues and Solders - CORE.RA.addQuantumTransformerRecipe( - new ItemStack[] { Materials.Carbon.getDust(32), Materials.Bismuth.getDust(32), - ItemUtils.getSimpleStack(GenericChem.mAdhesionPromoterCatalyst, 0) }, - new FluidStack[] { Materials.Oxygen.getGas(10000), Materials.Hydrogen.getGas(10000) }, - new FluidStack[] { MISC_MATERIALS.ETHYL_CYANOACRYLATE.getFluidStack(1000 * 32), - Materials.AdvancedGlue.getFluid(1000 * 16), ALLOY.INDALLOY_140.getFluidStack(144 * 64), - Materials.SolderingAlloy.getMolten(144 * 128) }, - new ItemStack[] { ItemList.StableAdhesive.get(1) }, - new int[] { 2000, 2000, 2000, 2000, 2000 }, - 20 * 20, - (int) TierEU.RECIPE_UV, - 1); - - // Titanium, Tungsten, Indium - CORE.RA.addQuantumTransformerRecipe( - new ItemStack[] { Materials.Lead.getDust(16), Materials.Bauxite.getDust(32), - Materials.Tungstate.getDust(16), ItemUtils.getSimpleStack(GenericChem.mTitaTungstenIndiumCatalyst, 0) }, - new FluidStack[] {}, - new FluidStack[] {}, - new ItemStack[] { Materials.Titanium.getDust(64), Materials.TungstenSteel.getDust(64), - Materials.TungstenCarbide.getDust(64), Materials.Indium.getDust(64) }, - new int[] { 2500, 2500, 2500, 2500 }, - 20 * 20, - (int) TierEU.RECIPE_UV, - 1); - - // Thorium, Uranium, Plutonium - CORE.RA.addQuantumTransformerRecipe( - new ItemStack[] { Materials.Thorium.getDust(32), Materials.Uranium.getDust(32), - ItemUtils.getSimpleStack(GenericChem.mRadioactivityCatalyst, 0) }, - new FluidStack[] {}, - new FluidStack[] {}, - new ItemStack[] { ELEMENT.getInstance().THORIUM232.getDust(64), - ELEMENT.getInstance().URANIUM233.getDust(64), Materials.Uranium235.getDust(64), - ELEMENT.getInstance().PLUTONIUM238.getDust(64), Materials.Plutonium.getDust(64), - Materials.Plutonium241.getDust(64) }, - new int[] { 1667, 1667, 1667, 1667, 1667, 1667 }, - 20 * 20, - (int) TierEU.RECIPE_UV, - 1); - - // Monaline - CORE.RA.addQuantumTransformerRecipe( - new ItemStack[] { Materials.Monazite.getDust(32), - ItemUtils.getSimpleStack(GenericChem.mRareEarthGroupCatalyst, 0) }, - new FluidStack[] {}, - new FluidStack[] {}, - new ItemStack[] { Materials.Cerium.getDust(64), Materials.Gadolinium.getDust(64), - Materials.Samarium.getDust(64), getModItem(BartWorks.ID, "gt.bwMetaGenerateddust", 64L, 11002), // Hafnia - getModItem(BartWorks.ID, "gt.bwMetaGenerateddust", 64L, 11007), // Zirconium - ItemList.SuperconductorComposite.get(1) }, - new int[] { 1667, 1667, 1667, 1667, 1667, 1667 }, - 20 * 20, - (int) TierEU.RECIPE_UHV, - 2); - - // Bastline - CORE.RA.addQuantumTransformerRecipe( - new ItemStack[] { Materials.Bastnasite.getDust(32), - ItemUtils.getSimpleStack(GenericChem.mRareEarthGroupCatalyst, 0) }, - null, - null, - new ItemStack[] { Materials.Holmium.getDust(64), Materials.Cerium.getDust(64), - Materials.Samarium.getDust(64), Materials.Gadolinium.getDust(64), Materials.Lanthanum.getDust(64) }, - new int[] { 2000, 2000, 2000, 2000, 2000 }, - 20 * 20, - (int) TierEU.RECIPE_UHV, - 2); - - // Early Waterline skip (first 4 tiers) - CORE.RA.addQuantumTransformerRecipe( - new ItemStack[] { ItemUtils.getSimpleStack(GenericChem.mLimpidWaterCatalyst, 0) }, - new FluidStack[] { Materials.Water.getFluid(40000L) }, - new FluidStack[] { Materials.Grade1PurifiedWater.getFluid(20000L), - Materials.Grade2PurifiedWater.getFluid(10000L), Materials.Grade3PurifiedWater.getFluid(5000L), - Materials.Grade4PurifiedWater.getFluid(1000L) }, - new ItemStack[] {}, - new int[] { 2500, 2500, 2500, 2500 }, - 20 * 20, - (int) TierEU.RECIPE_UHV, - 2); - - // Stem Cells - CORE.RA.addQuantumTransformerRecipe( - new ItemStack[] { Materials.Calcium.getDust(32), Materials.MeatRaw.getDust(32), - getModItem(NewHorizonsCoreMod.ID, "GTNHBioItems", 32, 2), - ItemUtils.getSimpleStack(GenericChem.mRawIntelligenceCatalyst, 0) }, - new FluidStack[] {}, - new FluidStack[] { Materials.GrowthMediumRaw.getFluid(1000 * 1024), - Materials.GrowthMediumSterilized.getFluid(1000 * 512) }, - new ItemStack[] { stemcells }, - new int[] { 3333, 3333, 3333 }, - 20 * 20, - (int) TierEU.RECIPE_UEV, - 3); - - // Unknown Particles - CORE.RA.addQuantumTransformerRecipe( - new ItemStack[] { ItemUtils.getSimpleStack(GenericChem.mParticleAccelerationCatalyst, 0) }, - new FluidStack[] { Materials.Hydrogen.getGas(10000L), Materials.Deuterium.getGas(1000L) }, - new FluidStack[] { FluidUtils.getFluidStack("plasma.hydrogen", 1000) }, - new ItemStack[] { Particle.getBaseParticle(Particle.UNKNOWN), Particle.getBaseParticle(Particle.GRAVITON), - Particle.getBaseParticle(Particle.PROTON), Particle.getBaseParticle(Particle.ELECTRON) }, - new int[] { 2000, 2000, 2000, 2000, 2000 }, - 5 * 20, - (int) TierEU.RECIPE_UEV, - 3); - - // Lategame Plastics (Missing Radox Polymer and Heavy Radox) - CORE.RA.addQuantumTransformerRecipe( - new ItemStack[] { Materials.Carbon.getDust(64), Materials.Osmium.getDust(24), - ItemUtils.getSimpleStack(GenericChem.mUltimatePlasticCatalyst, 0) }, - new FluidStack[] { Materials.Hydrogen.getGas(1000 * 16), Materials.Nitrogen.getGas(1000 * 16) }, - new FluidStack[] { FluidUtils.getFluidStack("xenoxene", 1000 * 16), - FluidUtils.getFluidStack("molten.radoxpoly", 144 * 64), - FluidUtils.getFluidStack("heavyradox", 1000 * 16), MaterialsKevlar.Kevlar.getMolten(144 * 64) }, - new ItemStack[] {}, - new int[] { 2500, 2500, 2500, 2500 }, - 20 * 20, - (int) TierEU.RECIPE_UIV, - 4); - - // Lategame Kevlar using Kevlar bee comb - CORE.RA.addQuantumTransformerRecipe( - new ItemStack[] { GT_Bees.combs.getStackForType(CombType.KEVLAR, 24), Materials.Carbon.getDust(64), - ItemUtils.getSimpleStack(GenericChem.mUltimatePlasticCatalyst, 0) }, - new FluidStack[] { Materials.Nitrogen.getGas(1000 * 16), Materials.Hydrogen.getGas(1000 * 16) }, - new FluidStack[] { MaterialsKevlar.PolyurethaneResin.getFluid(1000 * 32), - MaterialsKevlar.LiquidCrystalKevlar.getFluid(144 * 32), MaterialsKevlar.Kevlar.getMolten(144 * 64) }, - new ItemStack[] {}, - new int[] { 2500, 2500, 2500, 2500 }, - 20 * 20, - (int) TierEU.RECIPE_UIV, - 4); - // Platline skip using Platline Combs (Palladium, Osmium, Iridium, Platinum) - CORE.RA.addQuantumTransformerRecipe( - new ItemStack[] { GT_Bees.combs.getStackForType(CombType.PLATINUM, 32), - GT_Bees.combs.getStackForType(CombType.PALLADIUM, 32), - GT_Bees.combs.getStackForType(CombType.OSMIUM, 32), GT_Bees.combs.getStackForType(CombType.IRIDIUM, 32), - ItemUtils.getSimpleStack(GenericChem.mPlatinumGroupCatalyst, 0) }, - new FluidStack[] {}, - new FluidStack[] { Materials.Osmium.getMolten(144 * 256), Materials.Palladium.getMolten(144 * 256), - Materials.Iridium.getMolten(144 * 256), Materials.Platinum.getMolten(144 * 256) }, - new ItemStack[] {}, - new int[] { 2500, 2500, 2500, 2500 }, - 20 * 20, - (int) TierEU.RECIPE_UV, - 1); - // Bio Cells and Mutated Solder - CORE.RA.addQuantumTransformerRecipe( - new ItemStack[] { ItemList.Circuit_Chip_Stemcell.get(16), Materials.InfinityCatalyst.getDust(4), - ItemUtils.getSimpleStack(GenericChem.mBiologicalIntelligenceCatalyst, 0) }, - new FluidStack[] {}, - new FluidStack[] { MISC_MATERIALS.MUTATED_LIVING_SOLDER.getFluidStack(144 * 128), - Materials.BioMediumSterilized.getFluid(1000 * 256), Materials.BioMediumRaw.getFluid(1000 * 512) }, - new ItemStack[] { biocells }, - new int[] { 2500, 2500, 2500, 2500 }, - 20 * 20, - (int) TierEU.RECIPE_UIV, - 4); - - // Advanced Waterline skip (last 4 tiers) - CORE.RA.addQuantumTransformerRecipe( - new ItemStack[] { ItemUtils.getSimpleStack(GenericChem.mFlawlessWaterCatalyst, 0) }, - new FluidStack[] { Materials.Water.getFluid(40000L) }, - new FluidStack[] { Materials.Grade5PurifiedWater.getFluid(20000L), - Materials.Grade6PurifiedWater.getFluid(10000L), Materials.Grade7PurifiedWater.getFluid(5000L), - Materials.Grade8PurifiedWater.getFluid(1000L) }, - new ItemStack[] {}, - new int[] { 2500, 2500, 2500, 2500 }, - 20 * 20, - (int) TierEU.RECIPE_UIV, - 4); - - // Rare Particles - CORE.RA.addQuantumTransformerRecipe( - new ItemStack[] { ItemUtils.getSimpleStack(GenericChem.mSynchrotronCapableCatalyst, 0), - GregtechItemList.Laser_Lens_Special.get(1) }, - new FluidStack[] { FluidUtils.getFluidStack("plasma.hydrogen", 30000), Materials.Helium.getPlasma(30000L), - Materials.Americium.getPlasma(30000L), - new FluidStack(ELEMENT.STANDALONE.CELESTIAL_TUNGSTEN.getPlasma(), 30000) }, - new FluidStack[] {}, - new ItemStack[] { Particle.getBaseParticle(Particle.Z_BOSON), Particle.getBaseParticle(Particle.W_BOSON), - Particle.getBaseParticle(Particle.LAMBDA), Particle.getBaseParticle(Particle.OMEGA), - Particle.getBaseParticle(Particle.HIGGS_BOSON) }, - new int[] { 2000, 2000, 2000, 2000, 2000 }, - 200 * 20, - (int) TierEU.RECIPE_UIV, - 4); - - if (GalaxySpace.isModLoaded()) { - // Seaweed - ItemStack seaweed = GT_Utility - .copyAmountUnsafe(64 * 32, getModItem(GalaxySpace.ID, "tcetiedandelions", 1, 4)); - CORE.RA.addQuantumTransformerRecipe( - new ItemStack[] { GT_OreDictUnificator.get("cropSeaweed", 64), Materials.Mytryl.getDust(16), - ItemUtils.getSimpleStack(GenericChem.mAlgagenicGrowthPromoterCatalyst, 0) }, - new FluidStack[] { FluidUtils.getFluidStack("unknowwater", 25_000) }, - new FluidStack[] { FluidUtils.getFluidStack("seaweedbroth", 50_000), - FluidUtils.getFluidStack("iodine", 64_000) }, - new ItemStack[] { seaweed, getModItem(NewHorizonsCoreMod.ID, "item.TCetiESeaweedExtract", 16) }, - new int[] { 2_500, 2_500, 2_500, 2_500 }, - 20 * SECONDS, - (int) TierEU.RECIPE_UIV, - 4); - } - } - - private static void fusionReactorRecipes() { - GT_Values.RA.addFusionReactorRecipe( - new FluidStack[] { Materials.Radon.getPlasma(100), Materials.Nitrogen.getPlasma(100) }, - new FluidStack[] { new FluidStack(ELEMENT.getInstance().NEPTUNIUM.getPlasma(), 100) }, - 30 * 20, - (int) TierEU.RECIPE_UHV, - 1_000_000_000); - - GT_Values.RA.addFusionReactorRecipe( - new FluidStack[] { Materials.Americium.getPlasma(100), Materials.Boron.getPlasma(100) }, - new FluidStack[] { new FluidStack(ELEMENT.getInstance().FERMIUM.getPlasma(), 100) }, - 30 * 20, - (int) TierEU.RECIPE_UHV, - 1_000_000_000); - - // MK5 versions - GT_Values.RA.addFusionReactorRecipe( - new FluidStack[] { new FluidStack(ELEMENT.getInstance().XENON.getPlasma(), 288), - Materials.Yttrium.getMolten(288) }, - new FluidStack[] { new FluidStack(ELEMENT.getInstance().NEPTUNIUM.getPlasma(), 288) }, - 1 * SECONDS + 12 * TICKS, - (int) TierEU.RECIPE_UEV, - 1_000_000_000); - - GT_Values.RA.addFusionReactorRecipe( - new FluidStack[] { new FluidStack(ELEMENT.STANDALONE.FORCE.getPlasma(), 288), - Materials.Rubidium.getMolten(288) }, - new FluidStack[] { new FluidStack(ELEMENT.getInstance().FERMIUM.getPlasma(), 288) }, - 1 * SECONDS + 12 * TICKS, - (int) TierEU.RECIPE_UEV, - 1_000_000_000); - } - - private static void catalystRecipes() { - CORE.RA.addSixSlotAssemblingRecipe( - new ItemStack[] { CI.getNumberedCircuit(10), CI.getEmptyCatalyst(1), - getModItem(BartWorks.ID, "gt.bwMetaGenerateddust", 64L, 88), Materials.Osmiridium.getDust(64), - Materials.Carbon.getNanite(64) }, - ELEMENT.STANDALONE.HYPOGEN.getFluidStack(360), - ItemUtils.getSimpleStack(GenericChem.mPlatinumGroupCatalyst, 1), - 60 * 20, - (int) TierEU.RECIPE_UEV); - - CORE.RA.addSixSlotAssemblingRecipe( - new ItemStack[] { CI.getNumberedCircuit(10), CI.getEmptyCatalyst(1), - Materials.Polybenzimidazole.getDust(64), Materials.Polytetrafluoroethylene.getDust(64), - Materials.Carbon.getNanite(64) }, - ELEMENT.STANDALONE.HYPOGEN.getFluidStack(360), - ItemUtils.getSimpleStack(GenericChem.mPlasticPolymerCatalyst, 1), - 60 * 20, - (int) TierEU.RECIPE_UEV); - - CORE.RA.addSixSlotAssemblingRecipe( - new ItemStack[] { CI.getNumberedCircuit(10), CI.getEmptyCatalyst(1), Materials.Silicone.getDust(64), - Materials.StyreneButadieneRubber.getDust(64), Materials.Carbon.getNanite(64) }, - ELEMENT.STANDALONE.HYPOGEN.getFluidStack(360), - ItemUtils.getSimpleStack(GenericChem.mRubberPolymerCatalyst, 1), - 60 * 20, - (int) TierEU.RECIPE_UEV); - - CORE.RA.addSixSlotAssemblingRecipe( - new ItemStack[] { CI.getNumberedCircuit(10), CI.getEmptyCatalyst(1), ALLOY.INDALLOY_140.getDust(64), - MISC_MATERIALS.ETHYL_CYANOACRYLATE.getCell(64), Materials.Carbon.getNanite(64) }, - ELEMENT.STANDALONE.HYPOGEN.getFluidStack(360), - ItemUtils.getSimpleStack(GenericChem.mAdhesionPromoterCatalyst, 1), - 60 * 20, - (int) TierEU.RECIPE_UHV); - - CORE.RA.addSixSlotAssemblingRecipe( - new ItemStack[] { CI.getNumberedCircuit(10), CI.getEmptyCatalyst(1), Materials.TungstenSteel.getDust(64), - Materials.Indium.getDust(64), Materials.Carbon.getNanite(64) }, - ELEMENT.STANDALONE.HYPOGEN.getFluidStack(360), - ItemUtils.getSimpleStack(GenericChem.mTitaTungstenIndiumCatalyst, 1), - 60 * 20, - (int) TierEU.RECIPE_UHV); - - CORE.RA.addSixSlotAssemblingRecipe( - new ItemStack[] { CI.getNumberedCircuit(10), CI.getEmptyCatalyst(1), - ELEMENT.getInstance().URANIUM235.getDust(64), ELEMENT.getInstance().PLUTONIUM241.getDust(64), - Materials.Carbon.getNanite(64) }, - ELEMENT.STANDALONE.HYPOGEN.getFluidStack(360), - ItemUtils.getSimpleStack(GenericChem.mRadioactivityCatalyst, 1), - 60 * 20, - (int) TierEU.RECIPE_UHV); - - CORE.RA.addSixSlotAssemblingRecipe( - new ItemStack[] { CI.getNumberedCircuit(10), CI.getEmptyCatalyst(1), Materials.Samarium.getDust(64), - Materials.Gadolinium.getDust(64), Materials.Silver.getNanite(1) }, - ELEMENT.STANDALONE.HYPOGEN.getFluidStack(9216), - ItemUtils.getSimpleStack(GenericChem.mRareEarthGroupCatalyst, 1), - 60 * 20, - (int) TierEU.RECIPE_UEV); - - CORE.RA.addSixSlotAssemblingRecipe( - new ItemStack[] { CI.getNumberedCircuit(10), CI.getEmptyCatalyst(1), - WerkstoffLoader.Hedenbergit.get(OrePrefixes.lens, 1), - GT_OreDictUnificator.get(OrePrefixes.nanite, Materials.Silver, 1, false), - ItemList.Circuit_Silicon_Wafer6.get(64) }, - ELEMENT.STANDALONE.HYPOGEN.getFluidStack(9216), - ItemUtils.getSimpleStack(GenericChem.mLimpidWaterCatalyst, 1), - 60 * 20, - (int) TierEU.RECIPE_UEV); - - CORE.RA.addSixSlotAssemblingRecipe( - new ItemStack[] { CI.getNumberedCircuit(10), CI.getEmptyCatalyst(1), Materials.Naquadah.getDust(64), - Materials.Adamantium.getDust(64), Materials.Silver.getNanite(1) }, - ELEMENT.STANDALONE.HYPOGEN.getFluidStack(9216), - ItemUtils.getSimpleStack(GenericChem.mSimpleNaquadahCatalyst, 1), - 60 * 20, - (int) TierEU.RECIPE_UEV); - - CORE.RA.addSixSlotAssemblingRecipe( - new ItemStack[] { CI.getNumberedCircuit(10), CI.getEmptyCatalyst(1), Materials.Naquadria.getDust(64), - Materials.Trinium.getDust(64), Materials.Gold.getNanite(1) }, - MaterialsUEVplus.SpaceTime.getMolten(9216L), - ItemUtils.getSimpleStack(GenericChem.mAdvancedNaquadahCatalyst, 1), - 60 * 20, - (int) TierEU.RECIPE_UIV); - - CORE.RA.addSixSlotAssemblingRecipe( - new ItemStack[] { CI.getNumberedCircuit(10), CI.getEmptyCatalyst(1), ItemList.Circuit_Chip_Stemcell.get(64), - Materials.Gold.getNanite(1) }, - MaterialsUEVplus.SpaceTime.getMolten(9216L), - ItemUtils.getSimpleStack(GenericChem.mRawIntelligenceCatalyst, 1), - 60 * 20, - (int) TierEU.RECIPE_UIV); - - CORE.RA.addSixSlotAssemblingRecipe( - new ItemStack[] { CI.getNumberedCircuit(10), CI.getEmptyCatalyst(1), - GregtechItemList.Laser_Lens_Special.get(64), - GT_ModHandler.getModItem(EternalSingularity.ID, "eternal_singularity", 10) }, - MaterialsUEVplus.SpaceTime.getMolten(9216L), - ItemUtils.getSimpleStack(GenericChem.mParticleAccelerationCatalyst, 1), - 60 * 20, - (int) TierEU.RECIPE_UIV); - - CORE.RA.addSixSlotAssemblingRecipe( - new ItemStack[] { CI.getNumberedCircuit(10), CI.getEmptyCatalyst(1), MaterialsKevlar.Kevlar.getDust(64), - MaterialsUEVplus.TranscendentMetal.getNanite(1) }, - FluidUtils.getFluidStack("molten.shirabon", 92160), - ItemUtils.getSimpleStack(GenericChem.mUltimatePlasticCatalyst, 1), - 60 * 20, - (int) TierEU.RECIPE_UMV); - - CORE.RA.addSixSlotAssemblingRecipe( - new ItemStack[] { CI.getNumberedCircuit(10), CI.getEmptyCatalyst(1), ItemList.Circuit_Chip_Biocell.get(64), - MaterialsUEVplus.TranscendentMetal.getNanite(1) }, - FluidUtils.getFluidStack("molten.shirabon", 92160), - ItemUtils.getSimpleStack(GenericChem.mBiologicalIntelligenceCatalyst, 1), - 60 * 20, - (int) TierEU.RECIPE_UMV); - - CORE.RA.addSixSlotAssemblingRecipe( - new ItemStack[] { CI.getNumberedCircuit(10), CI.getEmptyCatalyst(1), - WerkstoffLoader.Hedenbergit.get(OrePrefixes.lens, 64), - GT_OreDictUnificator.get(OrePrefixes.nanite, Materials.Silver, 64, false), - ItemList.Circuit_Silicon_Wafer6.get(64) }, - FluidUtils.getFluidStack("molten.shirabon", 92160), - ItemUtils.getSimpleStack(GenericChem.mFlawlessWaterCatalyst, 1), - 60 * 20, - (int) TierEU.RECIPE_UMV); - - CORE.RA.addSixSlotAssemblingRecipe( - new ItemStack[] { CI.getNumberedCircuit(10), CI.getEmptyCatalyst(1), - Particle.getBaseParticle(Particle.HIGGS_BOSON), Particle.getIon("Helium", 0), - Particle.getIon("Hydrogen", 0), MaterialsUEVplus.Eternity.getNanite(16) }, - FluidUtils.getFluidStack("molten.shirabon", 92160), - ItemUtils.getSimpleStack(GenericChem.mSynchrotronCapableCatalyst, 1), - 60 * 20, - (int) TierEU.RECIPE_UMV); - - CORE.RA.addSixSlotAssemblingRecipe( - new ItemStack[] { CI.getNumberedCircuit(10), CI.getEmptyCatalyst(1), - GT_OreDictUnificator.get("blockShirabon", 16), MaterialsUEVplus.Universium.getNanite(1), - ItemList.Timepiece.get(1) }, - Materials.DarkIron.getMolten(92160), - ItemUtils.getSimpleStack(GenericChem.TemporalHarmonyCatalyst, 1), - 60 * 20, - (int) TierEU.RECIPE_UXV); - - GT_Values.RA.stdBuilder() - .itemInputs( - CI.getNumberedCircuit(10), - CI.getEmptyCatalyst(1), - getModItem(NewHorizonsCoreMod.ID, "item.TCetiESeaweedExtract", 64), - GT_OreDictUnificator.get("dustIodine", 64), - MaterialsUEVplus.TranscendentMetal.getNanite(1)) - .itemOutputs(ItemUtils.getSimpleStack(GenericChem.mAlgagenicGrowthPromoterCatalyst, 1)) - .fluidInputs(FluidUtils.getFluidStack("molten.shirabon", 92_160)) - .duration(60 * SECONDS) - .eut(TierEU.RECIPE_UMV) - .addTo(assemblerRecipes); - } - - private static void tieredCasingRecipes() { - TT_recipeAdder.addResearchableAssemblylineRecipe( - GregtechItemList.ForceFieldGlass.get(1), - 1024 * 30 * 20, - 1024, - (int) TierEU.RECIPE_ZPM, - 32, - new ItemStack[] { GregtechItemList.ForceFieldGlass.get(1), Materials.Carbon.getNanite(4), - ItemList.Emitter_UV.get(4), - GT_OreDictUnificator.get(OrePrefixes.wireGt16, Materials.SuperconductorUHV, 8), - GregtechItemList.Laser_Lens_Special.get(1), - getModItem(GoodGenerator.ID, "advancedRadiationProtectionPlate", 2) }, - new FluidStack[] { Materials.Thulium.getMolten(144 * 10), MaterialsUEVplus.ExcitedDTCC.getFluid(5000), - new FluidStack(ELEMENT.getInstance().NEPTUNIUM.getPlasma(), 500), - new FluidStack(ELEMENT.getInstance().FERMIUM.getPlasma(), 500) }, - GregtechItemList.NeutronPulseManipulator.get(1), - 60 * 20, - (int) TierEU.RECIPE_UEV); - - TT_recipeAdder.addResearchableAssemblylineRecipe( - GregtechItemList.NeutronPulseManipulator.get(1), - 2048 * 30 * 20, - 2048, - (int) TierEU.RECIPE_UV, - 32, - new ItemStack[] { GregtechItemList.ForceFieldGlass.get(2), Materials.Carbon.getNanite(8), - ItemList.Emitter_UEV.get(4), - GT_OreDictUnificator.get(OrePrefixes.wireGt16, Materials.SuperconductorUEV, 8), - GregtechItemList.Laser_Lens_Special.get(1), - getModItem(GoodGenerator.ID, "advancedRadiationProtectionPlate", 4), ItemList.StableAdhesive.get(4) }, - new FluidStack[] { Materials.Thulium.getMolten(144 * 12), MaterialsUEVplus.ExcitedDTPC.getFluid(5000), - new FluidStack(ELEMENT.getInstance().NEPTUNIUM.getPlasma(), 2500), - new FluidStack(ELEMENT.getInstance().FERMIUM.getPlasma(), 2500) }, - GregtechItemList.CosmicFabricManipulator.get(1), - 75 * 20, - (int) TierEU.RECIPE_UIV); - - TT_recipeAdder.addResearchableAssemblylineRecipe( - GregtechItemList.CosmicFabricManipulator.get(1), - 4096 * 30 * 20, - 4096, - (int) TierEU.RECIPE_ZPM, - 32, - new ItemStack[] { GregtechItemList.ForceFieldGlass.get(4), Materials.Carbon.getNanite(16), - ItemList.Emitter_UIV.get(4), - GT_OreDictUnificator.get(OrePrefixes.wireGt16, Materials.SuperconductorUIV, 8), - GregtechItemList.Laser_Lens_Special.get(1), - getModItem(GoodGenerator.ID, "advancedRadiationProtectionPlate", 8), - ItemList.SuperconductorComposite.get(4) }, - new FluidStack[] { Materials.Thulium.getMolten(144 * 15), MaterialsUEVplus.ExcitedDTRC.getFluid(5000), - new FluidStack(ELEMENT.getInstance().NEPTUNIUM.getPlasma(), 1000 * 10), - new FluidStack(ELEMENT.getInstance().FERMIUM.getPlasma(), 1000 * 10) }, - GregtechItemList.InfinityInfusedManipulator.get(1), - 90 * 20, - (int) TierEU.RECIPE_UMV); - TT_recipeAdder.addResearchableAssemblylineRecipe( - GregtechItemList.InfinityInfusedManipulator.get(1), - 1024 * 30 * 20, - 1024, - (int) TierEU.RECIPE_ZPM, - 32, - new ItemStack[] { GregtechItemList.ForceFieldGlass.get(8), Materials.Carbon.getNanite(32), - ItemList.Emitter_UMV.get(4), - GT_OreDictUnificator.get(OrePrefixes.wireGt16, Materials.SuperconductorUMV, 8), - GregtechItemList.Laser_Lens_Special.get(1), - getModItem(GoodGenerator.ID, "advancedRadiationProtectionPlate", 16), - ItemList.NaquadriaSupersolid.get(4) }, - new FluidStack[] { Materials.Thulium.getMolten(144 * 20), MaterialsUEVplus.ExcitedDTEC.getFluid(5000), - new FluidStack(ELEMENT.getInstance().NEPTUNIUM.getPlasma(), 2000 * 10), - new FluidStack(ELEMENT.getInstance().FERMIUM.getPlasma(), 2000 * 10) }, - GregtechItemList.SpaceTimeContinuumRipper.get(1), - 60 * 20, - (int) TierEU.RECIPE_UXV); - - TT_recipeAdder.addResearchableAssemblylineRecipe( - ItemList.Casing_AdvancedRadiationProof.get(1), - 1024 * 30 * 20, - 1024, - (int) TierEU.RECIPE_ZPM, - 32, - new ItemStack[] { ALLOY.QUANTUM.getFrameBox(1), - GT_OreDictUnificator.get("plateDensePreciousMetalsAlloy", 4), - GT_OreDictUnificator.get(OrePrefixes.plateDense, Materials.Neutronium, 16), - ItemList.Field_Generator_UV.get(1), ELEMENT.STANDALONE.CHRONOMATIC_GLASS.getScrew(16) }, - new FluidStack[] { MISC_MATERIALS.MUTATED_LIVING_SOLDER.getFluidStack(144 * 10), }, - GregtechItemList.NeutronShieldingCore.get(1), - 60 * 20, - (int) TierEU.RECIPE_UEV); - - TT_recipeAdder.addResearchableAssemblylineRecipe( - GregtechItemList.NeutronShieldingCore.get(1), - 2048 * 30 * 20, - 2048, - (int) TierEU.RECIPE_UV, - 32, - new ItemStack[] { ALLOY.QUANTUM.getFrameBox(2), - GT_OreDictUnificator.get("plateDenseEnrichedNaquadahAlloy", 4), - GT_OreDictUnificator.get(OrePrefixes.plateDense, Materials.Infinity, 16), - ItemList.Field_Generator_UEV.get(1), - // Radox polymer screw. - GT_OreDictUnificator.get(OrePrefixes.screw, Materials.get("RadoxPoly"), 16), - ItemList.StableAdhesive.get(4) }, - new FluidStack[] { MISC_MATERIALS.MUTATED_LIVING_SOLDER.getFluidStack(144 * 20), }, - GregtechItemList.CosmicFabricShieldingCore.get(1), - 75 * 20, - (int) TierEU.RECIPE_UIV); - - TT_recipeAdder.addResearchableAssemblylineRecipe( - GregtechItemList.CosmicFabricShieldingCore.get(1), - 4096 * 30 * 20, - 4096, - (int) TierEU.RECIPE_UHV, - 32, - new ItemStack[] { ALLOY.QUANTUM.getFrameBox(4), ELEMENT.STANDALONE.HYPOGEN.getPlateDense(4), - GT_OreDictUnificator.get(OrePrefixes.plateDense, MaterialsUEVplus.TranscendentMetal, 16), - ItemList.Field_Generator_UIV.get(1), GT_OreDictUnificator.get("screwMetastableOganesson", 16), - ItemList.SuperconductorComposite.get(4) }, - new FluidStack[] { MISC_MATERIALS.MUTATED_LIVING_SOLDER.getFluidStack(144 * 40), }, - GregtechItemList.InfinityInfusedShieldingCore.get(1), - 90 * 20, - (int) TierEU.RECIPE_UMV); - - TT_recipeAdder.addResearchableAssemblylineRecipe( - GregtechItemList.InfinityInfusedShieldingCore.get(1), - 8192 * 30 * 20, - 8192, - (int) TierEU.RECIPE_UEV, - 32, - new ItemStack[] { ALLOY.QUANTUM.getFrameBox(8), GT_OreDictUnificator.get("plateDenseShirabon", 4), - GT_OreDictUnificator.get(OrePrefixes.plateDense, MaterialsUEVplus.SpaceTime, 16), - ItemList.Field_Generator_UMV.get(1), - GT_OreDictUnificator.get(OrePrefixes.screw, Materials.Dilithium, 16), - ItemList.NaquadriaSupersolid.get(4) }, - new FluidStack[] { MISC_MATERIALS.MUTATED_LIVING_SOLDER.getFluidStack(144 * 80), }, - GregtechItemList.SpaceTimeBendingCore.get(1), - 120 * 20, - (int) TierEU.RECIPE_UXV); - - GT_Values.RA.addAssemblerRecipe( - new ItemStack[] { new ItemStack(QuantumGlassBlock.INSTANCE, 1), ItemList.Field_Generator_ZPM.get(1), - ELEMENT.STANDALONE.CELESTIAL_TUNGSTEN.getLongRod(6), ELEMENT.STANDALONE.CHRONOMATIC_GLASS.getPlate(6) }, - ALLOY.QUANTUM.getFluidStack(144 * 6), - GregtechItemList.ForceFieldGlass.get(1), - 10 * 20, - (int) TierEU.RECIPE_UEV); - } -} diff --git a/gtpp/src/main/java/gtPlusPlus/xmod/gregtech/loaders/recipe/RecipeLoader_GTNH.java b/gtpp/src/main/java/gtPlusPlus/xmod/gregtech/loaders/recipe/RecipeLoader_GTNH.java deleted file mode 100644 index 4aa13a0072..0000000000 --- a/gtpp/src/main/java/gtPlusPlus/xmod/gregtech/loaders/recipe/RecipeLoader_GTNH.java +++ /dev/null @@ -1,45 +0,0 @@ -package gtPlusPlus.xmod.gregtech.loaders.recipe; - -import net.minecraft.init.Items; -import net.minecraft.item.ItemStack; -import net.minecraftforge.fluids.FluidRegistry; -import net.minecraftforge.fluids.FluidStack; - -import gregtech.api.enums.GT_Values; -import gregtech.api.enums.ItemList; -import gregtech.api.enums.Materials; -import gtPlusPlus.core.material.ELEMENT; - -public class RecipeLoader_GTNH { - - public static void generate() { - GT_Values.RA.addFluidSolidifierRecipe( - ItemList.Shape_Mold_Ball.get(0L), - new FluidStack(FluidRegistry.getFluid("ender"), 250), - new ItemStack(Items.ender_pearl, 1, 0), - 100, - 30); - // MK4 - GT_Values.RA.addFusionReactorRecipe( - Materials.Plutonium241.getMolten(144), - Materials.Helium.getGas(1000), - ELEMENT.getInstance().CURIUM.getFluidStack(144), - 96, - 98304, - 500000000); - GT_Values.RA.addFusionReactorRecipe( - ELEMENT.getInstance().CURIUM.getFluidStack(144), - Materials.Helium.getPlasma(144), - ELEMENT.getInstance().CALIFORNIUM.getFluidStack(144), - 128, - 196608, - 750000000); - GT_Values.RA.addFusionReactorRecipe( - Materials.Plutonium241.getMolten(144), - Materials.Calcium.getPlasma(144), - Materials.Flerovium.getMolten(144), - 160, - 196608, - 1000000000); - } -} diff --git a/gtpp/src/main/java/gtPlusPlus/xmod/gregtech/loaders/recipe/RecipeLoader_GlueLine.java b/gtpp/src/main/java/gtPlusPlus/xmod/gregtech/loaders/recipe/RecipeLoader_GlueLine.java deleted file mode 100644 index a954711fd2..0000000000 --- a/gtpp/src/main/java/gtPlusPlus/xmod/gregtech/loaders/recipe/RecipeLoader_GlueLine.java +++ /dev/null @@ -1,395 +0,0 @@ -package gtPlusPlus.xmod.gregtech.loaders.recipe; - -import static gregtech.api.enums.Mods.BartWorks; -import static gregtech.api.enums.Mods.GalacticraftCore; -import static gregtech.api.enums.Mods.NewHorizonsCoreMod; -import static gregtech.api.enums.Mods.TecTech; -import static gregtech.api.util.GT_RecipeBuilder.SECONDS; -import static gregtech.api.util.GT_RecipeConstants.UniversalChemical; - -import net.minecraft.init.Items; -import net.minecraft.item.ItemStack; -import net.minecraftforge.fluids.FluidStack; - -import gregtech.api.enums.GT_Values; -import gregtech.api.enums.ItemList; -import gregtech.api.enums.Materials; -import gregtech.api.enums.OrePrefixes; -import gregtech.api.enums.TierEU; -import gregtech.api.util.GT_ModHandler; -import gregtech.api.util.GT_OreDictUnificator; -import gregtech.api.util.GT_Utility; -import gtPlusPlus.core.item.ModItems; -import gtPlusPlus.core.item.chemistry.AgriculturalChem; -import gtPlusPlus.core.item.chemistry.GenericChem; -import gtPlusPlus.core.lib.CORE; -import gtPlusPlus.core.material.MISC_MATERIALS; -import gtPlusPlus.core.recipe.common.CI; -import gtPlusPlus.core.util.minecraft.FluidUtils; -import gtPlusPlus.core.util.minecraft.ItemUtils; -import gtPlusPlus.core.util.minecraft.MaterialUtils; -import gtPlusPlus.plugin.agrichem.BioRecipes; - -public class RecipeLoader_GlueLine { - - public static void generate() { - createRecipes(); - } - - private static void createRecipes() { - chemicalPlantRecipes(); - chemicalReactorRecipes(); - dehydratorRecipes(); - distillationTowerRecipes(); - fluidHeaterRecipes(); - mixerRecipes(); - - glueUsageRecipes(); - } - - private static void chemicalPlantRecipes() { - // CO + C3H6O2 = C4H6O3 - CORE.RA.addChemicalPlantRecipe( - new ItemStack[] { CI.getNumberedCircuit(17), ItemUtils.getSimpleStack(GenericChem.mBlueCatalyst, 0) }, - new FluidStack[] { FluidUtils.getFluidStack("carbonmonoxide", 1000), - FluidUtils.getFluidStack("methylacetate", 1000), }, - new ItemStack[] {}, - new FluidStack[] { MISC_MATERIALS.ACETIC_ANHYDRIDE.getFluidStack(1000) }, - 10 * 20, - 500, - 3); - - CORE.RA.addChemicalPlantRecipe( - new ItemStack[] { CI.getNumberedCircuit(18) }, - new FluidStack[] { FluidUtils.getFluidStack("aceticacid", 1000), FluidUtils.getFluidStack("chlorine", 1000), - MISC_MATERIALS.ACETIC_ANHYDRIDE.getFluidStack(1000) }, - new ItemStack[] {}, - new FluidStack[] { MISC_MATERIALS.CHLOROACETIC_MIXTURE.getFluidStack(1000), - MISC_MATERIALS.ACETIC_ANHYDRIDE.getFluidStack(950) }, - 150 * 20, - 1000, - 4); - - // Na2CO3 + NaCN + C2H3O2Cl + 2HCl = C3H3NO2 + 3NaCl + CO2 + H2O - CORE.RA.addChemicalPlantRecipe( - new ItemStack[] { CI.getNumberedCircuit(19), ItemUtils.getSimpleStack(AgriculturalChem.mSodiumCarbonate, 6), - MISC_MATERIALS.SODIUM_CYANIDE.getDust(3) }, - new FluidStack[] { MISC_MATERIALS.CHLOROACETIC_ACID.getFluidStack(1000), - FluidUtils.getFluidStack("hydrochloricacid_gt5u", 2000) }, - new ItemStack[] { MISC_MATERIALS.CYANOACETIC_ACID.getDust(9), Materials.Salt.getDust(6) }, - new FluidStack[] { Materials.CarbonDioxide.getGas(1000), GT_ModHandler.getWater(1000) }, - 20 * 20, - 1000, - 4); - - // CuSO4 + 5C3H3NO2 + 5C2H6O = CuSO4·5(H2O) + 5C5H7NO2 - CORE.RA.addChemicalPlantRecipe( - new ItemStack[] { CI.getNumberedCircuit(20), ItemUtils.getSimpleStack(GenericChem.mSolidAcidCatalyst, 0), - MISC_MATERIALS.COPPER_SULFATE.getDust(6), MISC_MATERIALS.CYANOACETIC_ACID.getDust(45) }, - new FluidStack[] { Materials.Ethanol.getFluid(5000) }, - new ItemStack[] { MISC_MATERIALS.COPPER_SULFATE_HYDRATED.getDust(11) }, - new FluidStack[] { MISC_MATERIALS.ETHYL_CYANOACETATE.getFluidStack(5000) }, - 500 * 20, - 6000, - 5); - - // C3H3NO2 + C2H6O = C5H7NO2 + H2O - CORE.RA.addChemicalPlantRecipe( - new ItemStack[] { CI.getNumberedCircuit(21), MISC_MATERIALS.CYANOACETIC_ACID.getDust(9) }, - new FluidStack[] { Materials.Ethanol.getFluid(1000) }, - new ItemStack[] {}, - new FluidStack[] { MISC_MATERIALS.ETHYL_CYANOACETATE.getFluidStack(1000) }, - 1000 * 20, - 6000, - 5); - - BioRecipes.mFormaldehyde = FluidUtils.getFluidStack("fluid.formaldehyde", 1) - .getFluid(); - - CORE.RA.addChemicalPlantRecipe( - new ItemStack[] { CI.getNumberedCircuit(22), ItemUtils.getSimpleStack(GenericChem.mSolidAcidCatalyst, 0) }, - new FluidStack[] { MISC_MATERIALS.ETHYL_CYANOACETATE.getFluidStack(100), - FluidUtils.getFluidStack(BioRecipes.mFormaldehyde, 100) }, - new ItemStack[] {}, - new FluidStack[] { MISC_MATERIALS.CYANOACRYLATE_POLYMER.getFluidStack(100), FluidUtils.getWater(1000) }, - 10 * 20, - 8000, - 5); - - // CH4 + NH3 + 3O = HCN + 3H2O - CORE.RA.addChemicalPlantRecipe( - new ItemStack[] { CI.getNumberedCircuit(23), ItemUtils.getSimpleStack(GenericChem.mPinkCatalyst, 0) }, - new FluidStack[] { FluidUtils.getFluidStack("methane", 2000), FluidUtils.getFluidStack("ammonia", 2000), - FluidUtils.getFluidStack("oxygen", 6000) }, - new ItemStack[] {}, - new FluidStack[] { MISC_MATERIALS.HYDROGEN_CYANIDE.getFluidStack(2000), FluidUtils.getWater(6000) }, - 10 * 20, - 500, - 3); - } - - private static void chemicalReactorRecipes() { - // NaOH + HCN = NaCN + H2O - GT_Values.RA.addChemicalRecipe( - CI.getNumberedCircuit(17), - ItemUtils.getItemStackOfAmountFromOreDict("dustSodiumHydroxide", 3), - MISC_MATERIALS.HYDROGEN_CYANIDE.getFluidStack(1000), - FluidUtils.getWater(1000), - MISC_MATERIALS.SODIUM_CYANIDE.getDust(3), - 10 * 20); - // #addChemicalRecipe won't generate LCR recipe if config >= 10 - GT_Values.RA.addMultiblockChemicalRecipe( - new ItemStack[] { CI.getNumberedCircuit(17), - ItemUtils.getItemStackOfAmountFromOreDict("dustSodiumHydroxide", 3) }, - new FluidStack[] { MISC_MATERIALS.HYDROGEN_CYANIDE.getFluidStack(1000) }, - new FluidStack[] { FluidUtils.getWater(1000) }, - new ItemStack[] { MISC_MATERIALS.SODIUM_CYANIDE.getDust(3) }, - 10 * 20, - 30); - - // CaCO3 + 2HCl = CaCl2 + CO2 + H2O - if (BartWorks.isModLoaded()) { - GT_Values.RA.stdBuilder() - .itemInputs( - ItemUtils.getSimpleStack(ModItems.dustCalciumCarbonate, 5), - GT_Utility.getIntegratedCircuit(8)) - .itemOutputs(ItemUtils.getItemStackFromFQRN("bartworks:gt.bwMetaGenerateddust:63", 3)) - .fluidInputs(Materials.HydrochloricAcid.getFluid(2000L)) - .fluidOutputs(Materials.CarbonDioxide.getGas(1000)) - .duration(5 * SECONDS) - .eut(TierEU.RECIPE_LV) - .addTo(UniversalChemical); - } else { - GT_Values.RA.stdBuilder() - .itemInputs( - ItemUtils.getSimpleStack(ModItems.dustCalciumCarbonate, 5), - GT_Utility.getIntegratedCircuit(8)) - .itemOutputs(MISC_MATERIALS.CALCIUM_CHLORIDE.getDust(3)) - .fluidInputs(Materials.HydrochloricAcid.getFluid(2000L)) - .fluidOutputs(Materials.CarbonDioxide.getGas(1000)) - .duration(5 * SECONDS) - .eut(TierEU.RECIPE_LV) - .addTo(UniversalChemical); - } - - // Cu + 2H2SO4 = CuSO4 + SO2 + 2H2O - // SO2 + 2H2O -> diluted sulfuric acid - GT_Values.RA.addChemicalRecipe( - CI.getNumberedCircuit(19), - ItemUtils.getItemStackOfAmountFromOreDict("dustCopper", 1), - FluidUtils.getFluidStack("sulfuricacid", 2000), - FluidUtils.getFluidStack("dilutedsulfuricacid", 1000), - MISC_MATERIALS.COPPER_SULFATE.getDust(6), - 5 * 20); - // #addChemicalRecipe won't generate LCR recipe if config >= 10 - GT_Values.RA.addMultiblockChemicalRecipe( - new ItemStack[] { CI.getNumberedCircuit(19), ItemUtils.getItemStackOfAmountFromOreDict("dustCopper", 1) }, - new FluidStack[] { FluidUtils.getFluidStack("sulfuricacid", 2000) }, - new FluidStack[] { FluidUtils.getFluidStack("dilutedsulfuricacid", 1000) }, - new ItemStack[] { MISC_MATERIALS.COPPER_SULFATE.getDust(6) }, - 5 * 20, - 30); - } - - private static void dehydratorRecipes() { - CORE.RA.addDehydratorRecipe( - new ItemStack[] { MISC_MATERIALS.COPPER_SULFATE_HYDRATED.getDust(11), }, - null, - GT_ModHandler.getWater(5000), - new ItemStack[] { MISC_MATERIALS.COPPER_SULFATE.getDust(6) }, - new int[] { 10000, 10000, 10000 }, - 300 * 20, - 10); - } - - private static void distillationTowerRecipes() { - GT_Values.RA.addDistillationTowerRecipe( - MISC_MATERIALS.CHLOROACETIC_MIXTURE.getFluidStack(1000), - new FluidStack[] { MISC_MATERIALS.CHLOROACETIC_ACID.getFluidStack(100), - MISC_MATERIALS.DICHLOROACETIC_ACID.getFluidStack(450), - MISC_MATERIALS.TRICHLOROACETIC_ACID.getFluidStack(450) }, - null, - 4 * 20, - MaterialUtils.getVoltageForTier(5)); - } - - private static void fluidHeaterRecipes() { - - CORE.RA.addFluidHeaterRecipe( - CI.getNumberedCircuit(16), - MISC_MATERIALS.CYANOACRYLATE_POLYMER.getFluidStack(100), - MISC_MATERIALS.ETHYL_CYANOACRYLATE.getFluidStack(100), - 30 * 30, - 500); - } - - private static void mixerRecipes() { - GT_Values.RA.addMixerRecipe( - CI.getNumberedCircuit(1), - MISC_MATERIALS.DICHLOROACETIC_ACID.getCell(1), - null, - null, - MISC_MATERIALS.TRICHLOROACETIC_ACID.getFluidStack(1000), - MISC_MATERIALS.CHLOROACETIC_MIXTURE.getFluidStack(2000), - CI.emptyCells(1), - 100, - 100); - - GT_Values.RA.addMixerRecipe( - ItemUtils.getItemStackOfAmountFromOreDict("cellSulfurTrioxide", 1), - CI.getNumberedCircuit(2), - null, - null, - FluidUtils.getFluidStack("sulfuricacid", 1000), - MISC_MATERIALS.SOLID_ACID_MIXTURE.getFluidStack(1000), - CI.emptyCells(1), - 100, - 40); - } - - private static void glueUsageRecipes() { - // Braintech Tape recipe, PBI and superglue make 16 tape at once - GT_Values.RA.addAssemblerRecipe( - new ItemStack[] { GT_OreDictUnificator.get(OrePrefixes.plate, Materials.Polybenzimidazole, 1L), - GT_ModHandler.getIC2Item("carbonMesh", 1L), CI.getNumberedCircuit(10) }, - MISC_MATERIALS.ETHYL_CYANOACRYLATE.getFluidStack(100), - ItemList.Duct_Tape.get(16L), - 120, - 30); - - // Maintenance Hatch recipe, using Braintech Tape - GT_Values.RA.addAssemblerRecipe( - new ItemStack[] { ItemList.Hull_LV.get(1), ItemList.Duct_Tape.get(1), CI.getNumberedCircuit(1) }, - MISC_MATERIALS.ETHYL_CYANOACRYLATE.getFluidStack(100), - ItemList.Hatch_Maintenance.get(1), - 120, - 30); - - // Graphene recipes from later wafer tiers, using superglue instead of the bronze age glue - GT_Values.RA.addAssemblerRecipe( - new ItemStack[] { ItemUtils.getItemStackOfAmountFromOreDict("dustGraphite", 64), - ItemList.Circuit_Silicon_Wafer4.get(2L), CI.getNumberedCircuit(2) }, - MISC_MATERIALS.ETHYL_CYANOACRYLATE.getFluidStack(500), - ItemUtils.getItemStackOfAmountFromOreDict("dustGraphene", 64), - 400, - 30720); - - GT_Values.RA.addAssemblerRecipe( - new ItemStack[] { ItemUtils.getItemStackOfAmountFromOreDict("dustGraphite", 64), - ItemList.Circuit_Silicon_Wafer5.get(1L), CI.getNumberedCircuit(2) }, - MISC_MATERIALS.ETHYL_CYANOACRYLATE.getFluidStack(250), - ItemUtils.getItemStackOfAmountFromOreDict("dustGraphene", 64), - 80, - 122880); - - GT_Values.RA.addMixerRecipe( - GT_OreDictUnificator.get(OrePrefixes.dust, Materials.Sulfur, 1L), - GT_OreDictUnificator.get(OrePrefixes.dust, Materials.Lithium, 1L), - GT_OreDictUnificator.get(OrePrefixes.dust, Materials.Wood, 4L), - GT_Values.NI, - GT_Values.NI, - GT_Utility.getIntegratedCircuit(1), - MISC_MATERIALS.ETHYL_CYANOACRYLATE.getFluidStack(100), - null, - ItemList.SFMixture.get(32), - 1600, - 16); - - GT_Values.RA.addMixerRecipe( - ItemList.GelledToluene.get(1), - GT_OreDictUnificator.get(OrePrefixes.dust, Materials.Aluminium, 1L), - GT_OreDictUnificator.get(OrePrefixes.dustTiny, Materials.Polybenzimidazole, 1L), - GT_Values.NI, - GT_Values.NI, - GT_Utility.getIntegratedCircuit(1), - MISC_MATERIALS.ETHYL_CYANOACRYLATE.getFluidStack(100), - null, - ItemList.SFMixture.get(64), - 1600, - 16); - - GT_Values.RA.addAssemblerRecipe( - GT_OreDictUnificator.get(OrePrefixes.foil, Materials.PolyvinylChloride, 8), - GT_OreDictUnificator.get(OrePrefixes.plate, Materials.Paper, 32), - MISC_MATERIALS.ETHYL_CYANOACRYLATE.getFluidStack(200), - new ItemStack(Items.book, 64, 0), - 32, - 8); - - if (TecTech.isModLoaded()) { - GT_Values.RA.addAssemblerRecipe( - GT_OreDictUnificator.get(OrePrefixes.cableGt01, Materials.Naquadah, 2), - GT_OreDictUnificator.get(OrePrefixes.plate, Materials.RedSteel, 18), - MISC_MATERIALS.ETHYL_CYANOACRYLATE.getFluidStack(144), - ItemUtils.getItemStackFromFQRN("gregtech:gt.metaitem.01:32505", 1), - 300, - 7680); - - GT_Values.RA.addAssemblerRecipe( - GT_OreDictUnificator.get(OrePrefixes.cableGt01, Materials.NaquadahAlloy, 2), - GT_OreDictUnificator.get(OrePrefixes.plate, Materials.Europium, 6), - MISC_MATERIALS.ETHYL_CYANOACRYLATE.getFluidStack(288), - ItemUtils.getItemStackFromFQRN("gregtech:gt.metaitem.01:32506", 1), - 200, - 30720); - - GT_Values.RA.addAssemblerRecipe( - GT_OreDictUnificator.get(OrePrefixes.cableGt01, Materials.ElectrumFlux, 2), - GT_OreDictUnificator.get(OrePrefixes.plate, Materials.Americium, 18), - MISC_MATERIALS.ETHYL_CYANOACRYLATE.getFluidStack(576), - ItemUtils.getItemStackFromFQRN("gregtech:gt.metaitem.01:32507", 1), - 300, - 122880); - - GT_Values.RA.addAssemblerRecipe( - GT_OreDictUnificator.get(OrePrefixes.cableGt02, Materials.ElectrumFlux, 2), - GT_OreDictUnificator.get(OrePrefixes.plate, Materials.Naquadah, 24), - MISC_MATERIALS.ETHYL_CYANOACRYLATE.getFluidStack(1152), - ItemUtils.getItemStackFromFQRN("gregtech:gt.metaitem.01:32561", 1), - 100, - 491520); - - GT_Values.RA.addAssemblerRecipe( - GT_OreDictUnificator.get(OrePrefixes.cableGt04, Materials.ElectrumFlux, 2), - GT_OreDictUnificator.get(OrePrefixes.plate, Materials.NaquadahEnriched, 36), - MISC_MATERIALS.ETHYL_CYANOACRYLATE.getFluidStack(2304), - ItemUtils.getItemStackFromFQRN("gregtech:gt.metaitem.01:32562", 1), - 200, - 1966080); - - GT_Values.RA.addAssemblerRecipe( - GT_OreDictUnificator.get(OrePrefixes.cableGt08, Materials.ElectrumFlux, 2), - GT_OreDictUnificator.get(OrePrefixes.plate, Materials.NaquadahAlloy, 48), - MISC_MATERIALS.ETHYL_CYANOACRYLATE.getFluidStack(4608), - ItemUtils.getItemStackFromFQRN("gregtech:gt.metaitem.01:32563", 1), - 300, - 1966080); - - GT_Values.RA.addAssemblerRecipe( - GT_OreDictUnificator.get(OrePrefixes.wireGt16, Materials.SuperconductorUHV, 2), - GT_OreDictUnificator.get(OrePrefixes.plate, Materials.Neutronium, 56), - MISC_MATERIALS.ETHYL_CYANOACRYLATE.getFluidStack(9216), - ItemUtils.getItemStackFromFQRN("gregtech:gt.metaitem.01:32564", 1), - 600, - 1966080); - - GT_Values.RA.addAssemblerRecipe( - GT_OreDictUnificator.get(OrePrefixes.wireGt16, Materials.SuperconductorUHV, 2), - GT_OreDictUnificator.get(OrePrefixes.plate, Materials.DraconiumAwakened, 64), - MISC_MATERIALS.ETHYL_CYANOACRYLATE.getFluidStack(18432), - ItemUtils.getItemStackFromFQRN("gregtech:gt.metaitem.01:32565", 1), - 1200, - 1966080); - } - if (NewHorizonsCoreMod.isModLoaded() && GalacticraftCore.isModLoaded()) { - GT_Values.RA.addAssemblerRecipe( - new ItemStack[] { ItemUtils.getItemStackFromFQRN("GalacticraftMars:item.itemBasicAsteroids:7", 1), - GT_OreDictUnificator.get(OrePrefixes.foil, Materials.Titanium, 8), - ItemUtils.getItemStackFromFQRN("dreamcraft:item.TungstenString", 8), CI.getNumberedCircuit(1) }, - MISC_MATERIALS.ETHYL_CYANOACRYLATE.getFluidStack(576), - ItemUtils.getItemStackFromFQRN("GalaxySpace:item.ThermalClothT2", 1), - 600, - 1024); - } - } -} diff --git a/gtpp/src/main/java/gtPlusPlus/xmod/gregtech/loaders/recipe/RecipeLoader_LFTR.java b/gtpp/src/main/java/gtPlusPlus/xmod/gregtech/loaders/recipe/RecipeLoader_LFTR.java deleted file mode 100644 index 81fde457ae..0000000000 --- a/gtpp/src/main/java/gtPlusPlus/xmod/gregtech/loaders/recipe/RecipeLoader_LFTR.java +++ /dev/null @@ -1,135 +0,0 @@ -package gtPlusPlus.xmod.gregtech.loaders.recipe; - -import net.minecraft.item.ItemStack; -import net.minecraftforge.fluids.Fluid; -import net.minecraftforge.fluids.FluidStack; - -import gregtech.api.enums.Materials; -import gregtech.api.util.GasSpargingRecipeMap; -import gtPlusPlus.api.objects.data.AutoMap; -import gtPlusPlus.api.recipe.GTPPRecipeMaps; -import gtPlusPlus.core.material.ELEMENT; -import gtPlusPlus.core.material.nuclear.FLUORIDES; -import gtPlusPlus.core.material.nuclear.NUCLIDE; - -public class RecipeLoader_LFTR { - - private static AutoMap<Fluid> mNobleGases; - private static AutoMap<Fluid> mFluorideGases; - private static AutoMap<Fluid> mSpargeGases; - - private static void configureSparging() { - if (mSpargeGases == null) { - mSpargeGases = new AutoMap<>(); - mSpargeGases.add( - Materials.Helium.getGas(1) - .getFluid()); - mSpargeGases.add( - Materials.Fluorine.getGas(1) - .getFluid()); - } - if (mNobleGases == null) { - mNobleGases = new AutoMap<>(); - mNobleGases.add(mSpargeGases.get(0)); - mNobleGases.add(ELEMENT.getInstance().XENON.getFluid()); - mNobleGases.add(ELEMENT.getInstance().NEON.getFluid()); - mNobleGases.add(ELEMENT.getInstance().ARGON.getFluid()); - mNobleGases.add(ELEMENT.getInstance().KRYPTON.getFluid()); - mNobleGases.add(ELEMENT.getInstance().RADON.getFluid()); - } - if (mFluorideGases == null) { - mFluorideGases = new AutoMap<>(); - mFluorideGases.add(mSpargeGases.get(1)); - mFluorideGases.add(FLUORIDES.LITHIUM_FLUORIDE.getFluid()); - mFluorideGases.add(FLUORIDES.NEPTUNIUM_HEXAFLUORIDE.getFluid()); - mFluorideGases.add(FLUORIDES.TECHNETIUM_HEXAFLUORIDE.getFluid()); - mFluorideGases.add(FLUORIDES.SELENIUM_HEXAFLUORIDE.getFluid()); - mFluorideGases.add(FLUORIDES.THORIUM_TETRAFLUORIDE.getFluid()); - } - } - - public static void generate() { - // Fli2BeF4 + Thorium TetraFluoride = Uranium233 - // 72k Ticks/hr - // 1l/4t = 1000l/hr - // 1l/40t = 1000l/10hr (Probably better) LiFBeF2ThF4UF4 - // 1l/20t= 1000l/2.5hr LiFBeF2ZrF4UF4 - // 1l/10t= 1000l/2.5hr LiFBeF2ZrF4U235 - - configureSparging(); - FluidStack Li2BeF4 = NUCLIDE.Li2BeF4.getFluidStack(200); - - // LiFBeF2ThF4UF4 - T3 - GTPPRecipeMaps.liquidFluorineThoriumReactorRecipes.addRecipe( - false, - new ItemStack[] {}, - new ItemStack[] {}, - null, - new int[] { 10000, 10000, 5000, 2500 }, - new FluidStack[] { NUCLIDE.LiFBeF2ThF4UF4.getFluidStack(100), Li2BeF4 }, - new FluidStack[] { NUCLIDE.LiFBeF2UF4FP.getFluidStack(100), NUCLIDE.LiFBeF2ThF4.getFluidStack(200), - FLUORIDES.URANIUM_HEXAFLUORIDE.getFluidStack(20), FLUORIDES.URANIUM_HEXAFLUORIDE.getFluidStack(10) }, - 100 * 20, // time - 0, // cost - 32768 * 4 // fuel value - ); - - // LiFBeF2ZrF4UF4 - T2 - GTPPRecipeMaps.liquidFluorineThoriumReactorRecipes.addRecipe( - false, - new ItemStack[] {}, - new ItemStack[] {}, - null, - new int[] { 10000, 10000, 2500, 1250 }, - new FluidStack[] { NUCLIDE.LiFBeF2ZrF4UF4.getFluidStack(100), Li2BeF4 }, - new FluidStack[] { NUCLIDE.LiFBeF2UF4FP.getFluidStack(50), NUCLIDE.LiFBeF2ThF4.getFluidStack(100), - FLUORIDES.URANIUM_HEXAFLUORIDE.getFluidStack(10), FLUORIDES.URANIUM_HEXAFLUORIDE.getFluidStack(5) }, - 100 * 20, // time - 0, // cost - 8192 * 4 // fuel value - ); - - // LiFBeF2ZrF4U235 - T1 - GTPPRecipeMaps.liquidFluorineThoriumReactorRecipes.addRecipe( - false, - new ItemStack[] {}, - new ItemStack[] {}, - null, - new int[] { 10000, 10000, 1000, 500 }, - new FluidStack[] { NUCLIDE.LiFBeF2ZrF4U235.getFluidStack(100), Li2BeF4 }, - new FluidStack[] { NUCLIDE.LiFBeF2UF4FP.getFluidStack(25), NUCLIDE.LiFThF4.getFluidStack(50), - FLUORIDES.URANIUM_HEXAFLUORIDE.getFluidStack(4), FLUORIDES.URANIUM_HEXAFLUORIDE.getFluidStack(2) }, - 100 * 20, // time - 0, // cost - 8192 // fuel value - ); - - // Sparging NEI Recipes - GasSpargingRecipeMap.addRecipe( - new FluidStack(mSpargeGases.get(0), 1000), - NUCLIDE.LiFBeF2UF4FP.getFluidStack(50), - NUCLIDE.Sparged_LiFBeF2UF4FP.getFluidStack(50), - new FluidStack[] { new FluidStack(mNobleGases.get(1), 10), new FluidStack(mNobleGases.get(2), 10), - new FluidStack(mNobleGases.get(3), 10), new FluidStack(mNobleGases.get(4), 10), - new FluidStack(mNobleGases.get(5), 10) }, - new int[] { 20000, 20000, 20000, 20000, 20000 }); - - GasSpargingRecipeMap.addRecipe( - new FluidStack(mSpargeGases.get(1), 100), - NUCLIDE.LiFThF4.getFluidStack(50), - NUCLIDE.Sparged_LiFThF4.getFluidStack(50), - new FluidStack[] { new FluidStack(mFluorideGases.get(1), 5), new FluidStack(mFluorideGases.get(2), 5), - new FluidStack(mFluorideGases.get(3), 5), new FluidStack(mFluorideGases.get(4), 5), - new FluidStack(mFluorideGases.get(5), 5) }, - new int[] { 1000, 1000, 1000, 1000, 1000 }); - - GasSpargingRecipeMap.addRecipe( - new FluidStack(mSpargeGases.get(1), 100), - NUCLIDE.LiFBeF2ThF4.getFluidStack(50), - NUCLIDE.Sparged_LiFBeF2ThF4.getFluidStack(50), - new FluidStack[] { new FluidStack(mFluorideGases.get(1), 10), new FluidStack(mFluorideGases.get(2), 10), - new FluidStack(mFluorideGases.get(3), 10), new FluidStack(mFluorideGases.get(4), 10), - new FluidStack(mFluorideGases.get(5), 10) }, - new int[] { 2000, 2000, 2000, 2000, 2000 }); - } -} diff --git a/gtpp/src/main/java/gtPlusPlus/xmod/gregtech/loaders/recipe/RecipeLoader_MolecularTransformer.java b/gtpp/src/main/java/gtPlusPlus/xmod/gregtech/loaders/recipe/RecipeLoader_MolecularTransformer.java deleted file mode 100644 index cd576dbc8d..0000000000 --- a/gtpp/src/main/java/gtPlusPlus/xmod/gregtech/loaders/recipe/RecipeLoader_MolecularTransformer.java +++ /dev/null @@ -1,78 +0,0 @@ -package gtPlusPlus.xmod.gregtech.loaders.recipe; - -import static advsolar.utils.MTRecipeManager.transformerRecipes; -import static gregtech.api.enums.Mods.AdvancedSolarPanel; -import static gregtech.api.enums.Mods.GalaxySpace; - -import advsolar.utils.MTRecipeRecord; -import gregtech.api.enums.Materials; -import gregtech.api.enums.OrePrefixes; -import gregtech.api.util.GT_ModHandler; -import gregtech.api.util.GT_OreDictUnificator; -import gtPlusPlus.api.objects.Logger; -import gtPlusPlus.core.lib.CORE; -import gtPlusPlus.core.util.math.MathUtils; -import gtPlusPlus.core.util.minecraft.MaterialUtils; - -public class RecipeLoader_MolecularTransformer { - - public static void run() { - - for (MTRecipeRecord aRecipe : transformerRecipes) { - int aEU = MaterialUtils.getVoltageForTier(5); - Logger.INFO("======================="); - Logger.INFO("Generating GT recipe for Molecular Transformer."); - Logger.INFO( - "Input: " + aRecipe.inputStack - .getDisplayName() + ", Output: " + aRecipe.outputStack.getDisplayName() + ", EU/t: " + aEU); - float aTicks = (float) aRecipe.energyPerOperation / (float) aEU; - Logger.INFO("Ticks: " + aTicks); - int aTicksRoundedUp = MathUtils.roundToClosestInt(Math.ceil(aTicks)); - Logger.INFO("Ticks: " + aTicksRoundedUp); - Logger.INFO("Total EU equal or greater? " + ((aTicksRoundedUp * aEU) >= aRecipe.energyPerOperation)); - CORE.RA.addMolecularTransformerRecipe(aRecipe.inputStack, aRecipe.outputStack, aTicksRoundedUp, aEU, 2); - Logger.INFO("======================="); - } - - transformerRecipes.clear(); - if (AdvancedSolarPanel.isModLoaded() && GalaxySpace.isModLoaded()) { - - CORE.RA.addMolecularTransformerRecipe( - GT_OreDictUnificator.get(OrePrefixes.dust, Materials.Glowstone, 1L), - GT_ModHandler.getModItem(AdvancedSolarPanel.ID, "asp_crafting_items", 1L, 9), - 600, - 1920, - 2); - CORE.RA.addMolecularTransformerRecipe( - GT_ModHandler.getModItem(GalaxySpace.ID, "item.GlowstoneDusts", 1L, 0), - GT_ModHandler.getModItem(AdvancedSolarPanel.ID, "asp_crafting_items", 1L, 9), - 150, - 7680, - 2); - CORE.RA.addMolecularTransformerRecipe( - GT_ModHandler.getModItem(GalaxySpace.ID, "item.GlowstoneDusts", 1L, 1), - GT_ModHandler.getModItem(AdvancedSolarPanel.ID, "asp_crafting_items", 1L, 9), - 38, - 30720, - 2); - CORE.RA.addMolecularTransformerRecipe( - GT_ModHandler.getModItem(GalaxySpace.ID, "item.GlowstoneDusts", 1L, 2), - GT_ModHandler.getModItem(AdvancedSolarPanel.ID, "asp_crafting_items", 1L, 9), - 10, - 122880, - 2); - CORE.RA.addMolecularTransformerRecipe( - GT_ModHandler.getModItem(GalaxySpace.ID, "item.GlowstoneDusts", 1L, 3), - GT_ModHandler.getModItem(AdvancedSolarPanel.ID, "asp_crafting_items", 1L, 9), - 3, - 491520, - 2); - CORE.RA.addMolecularTransformerRecipe( - GT_ModHandler.getModItem(GalaxySpace.ID, "item.GlowstoneDusts", 1L, 4), - GT_ModHandler.getModItem(AdvancedSolarPanel.ID, "asp_crafting_items", 1L, 9), - 1, - 1996080, - 2); - } - } -} diff --git a/gtpp/src/main/java/gtPlusPlus/xmod/gregtech/loaders/recipe/RecipeLoader_Nuclear.java b/gtpp/src/main/java/gtPlusPlus/xmod/gregtech/loaders/recipe/RecipeLoader_Nuclear.java deleted file mode 100644 index a25ed99dd2..0000000000 --- a/gtpp/src/main/java/gtPlusPlus/xmod/gregtech/loaders/recipe/RecipeLoader_Nuclear.java +++ /dev/null @@ -1,680 +0,0 @@ -package gtPlusPlus.xmod.gregtech.loaders.recipe; - -import static gregtech.api.recipe.RecipeMaps.centrifugeRecipes; -import static gregtech.api.recipe.RecipeMaps.fusionRecipes; -import static gregtech.api.util.GT_RecipeBuilder.MINUTES; -import static gregtech.api.util.GT_RecipeBuilder.SECONDS; -import static gregtech.api.util.GT_RecipeBuilder.TICKS; -import static gregtech.api.util.GT_RecipeConstants.FUSION_THRESHOLD; -import static gtPlusPlus.api.recipe.GTPPRecipeMaps.chemicalDehydratorRecipes; - -import net.minecraft.item.ItemStack; -import net.minecraftforge.fluids.FluidStack; - -import gregtech.api.enums.GT_Values; -import gregtech.api.enums.ItemList; -import gregtech.api.enums.Materials; -import gregtech.api.enums.OrePrefixes; -import gregtech.api.enums.TierEU; -import gregtech.api.util.GT_ModHandler; -import gregtech.api.util.GT_OreDictUnificator; -import gregtech.api.util.GT_Utility; -import gtPlusPlus.api.objects.Logger; -import gtPlusPlus.core.item.chemistry.GenericChem; -import gtPlusPlus.core.lib.CORE; -import gtPlusPlus.core.material.ALLOY; -import gtPlusPlus.core.material.ELEMENT; -import gtPlusPlus.core.material.MISC_MATERIALS; -import gtPlusPlus.core.material.nuclear.FLUORIDES; -import gtPlusPlus.core.material.nuclear.NUCLIDE; -import gtPlusPlus.core.recipe.common.CI; -import gtPlusPlus.core.util.minecraft.FluidUtils; -import gtPlusPlus.core.util.minecraft.ItemUtils; - -public class RecipeLoader_Nuclear { - - public static void generate() { - createRecipes(); - RecipeLoader_LFTR.generate(); - RecipeLoader_NuclearFuelProcessing.generate(); - } - - private static void createRecipes() { - autoclave(); - blastFurnace(); - centrifugeRecipes(); - chemicalBathRecipes(); - chemicalReactorRecipes(); - dehydratorRecipes(); - electroMagneticSeperator(); - fluidExtractorRecipes(); - fluidHeater(); - fusionChainRecipes(); - macerator(); - mixerRecipes(); - sifter(); - } - - private static void autoclave() { - - GT_Values.RA.addAutoclaveRecipe( - ItemUtils.getItemStackOfAmountFromOreDict("dustZirconium", 9), - FluidUtils.getFluidStack("chlorine", 9 * 4 * 144), - ItemUtils.getItemStackOfAmountFromOreDict("pelletZirconium", 9), - 0, - 120 * 20, - 30); - } - - private static void blastFurnace() { - - GT_Values.RA.addBlastRecipe( - FLUORIDES.LITHIUM_FLUORIDE.getDust(2), - FLUORIDES.BERYLLIUM_FLUORIDE.getDust(1), - GT_Values.NF, - GT_Values.NF, - NUCLIDE.Li2BeF4.getDust(3), - null, - 60 * 20, - 2000, - 3000); - - GT_Values.RA.addBlastRecipe( - ItemUtils.getItemStackOfAmountFromOreDict("dustZrCl4", 1), - null, - GT_Values.NF, - GT_Values.NF, - ItemUtils.getItemStackOfAmountFromOreDict("dustCookedZrCl4", 1), - null, - 60 * 20, - 340, - 300); - } - - private static void centrifugeRecipes() { - - // Process Used Fuel Rods for Krypton - - // Uranium - for (ItemStack depletedRod : new ItemStack[] { - ItemUtils.getItemStackFromFQRN("IC2:reactorUraniumSimpledepleted", 8), - ItemUtils.getItemStackFromFQRN("IC2:reactorUraniumDualdepleted", 4), - ItemUtils.getItemStackFromFQRN("IC2:reactorUraniumQuaddepleted", 2) }) { - GT_Values.RA.stdBuilder() - .itemInputs(depletedRod, GT_Utility.getIntegratedCircuit(20)) - .itemOutputs( - ItemList.IC2_Fuel_Rod_Empty.get(8), - GT_OreDictUnificator.get(OrePrefixes.dust, Materials.Uranium, 2L), - ELEMENT.getInstance().URANIUM232.getSmallDust(1), - ELEMENT.getInstance().URANIUM233.getSmallDust(1), - GT_OreDictUnificator.get(OrePrefixes.dustSmall, Materials.Uranium235, 1L), - GT_OreDictUnificator.get(OrePrefixes.dustTiny, Materials.Plutonium, 1L)) - .outputChances(10000, 10000, 1000, 1000, 1000, 500) - .fluidOutputs(FluidUtils.getFluidStack("krypton", 60)) - .duration(4 * MINUTES + 10 * SECONDS) - .eut(TierEU.RECIPE_IV) - .addTo(centrifugeRecipes); - } - - // Mox - for (ItemStack depletedRod : new ItemStack[] { - ItemUtils.getItemStackFromFQRN("IC2:reactorMOXSimpledepleted", 8), - ItemUtils.getItemStackFromFQRN("IC2:reactorMOXDualdepleted", 4), - ItemUtils.getItemStackFromFQRN("IC2:reactorMOXQuaddepleted", 2) }) { - GT_Values.RA.stdBuilder() - .itemInputs(depletedRod, GT_Utility.getIntegratedCircuit(20)) - .itemOutputs( - ItemList.IC2_Fuel_Rod_Empty.get(8), - GT_OreDictUnificator.get(OrePrefixes.dust, Materials.Plutonium, 2L), - GT_OreDictUnificator.get(OrePrefixes.dustTiny, Materials.Plutonium241, 1L), - GT_OreDictUnificator.get(OrePrefixes.dustTiny, Materials.Plutonium, 1L), - ELEMENT.getInstance().PLUTONIUM238.getTinyDust(1), - GT_OreDictUnificator.get(OrePrefixes.dustTiny, Materials.Plutonium, 1L)) - .outputChances(10000, 10000, 500, 500, 500, 500) - .fluidOutputs(FluidUtils.getFluidStack("krypton", 90)) - .duration(6 * MINUTES + 15 * SECONDS) - .eut(TierEU.RECIPE_IV) - .addTo(centrifugeRecipes); - } - - // Thorium - for (ItemStack depletedRod : new ItemStack[] { ItemList.Depleted_Thorium_1.get(8), - ItemList.Depleted_Thorium_2.get(4), ItemList.Depleted_Thorium_4.get(2) }) { - GT_Values.RA.stdBuilder() - .itemInputs(depletedRod, GT_Utility.getIntegratedCircuit(20)) - .itemOutputs( - ItemList.IC2_Fuel_Rod_Empty.get(8), - GT_OreDictUnificator.get(OrePrefixes.dust, Materials.Thorium, 2L), - ELEMENT.getInstance().THORIUM232.getDust(1), - GT_OreDictUnificator.get(OrePrefixes.dustSmall, Materials.Lutetium, 1L), - ELEMENT.getInstance().POLONIUM.getSmallDust(1), - ELEMENT.getInstance().THALLIUM.getTinyDust(1)) - .outputChances(10000, 10000, 5000, 5000, 5000, 2500) - .fluidOutputs(FluidUtils.getFluidStack("krypton", 30)) - .duration(2 * MINUTES + 5 * SECONDS) - .eut(TierEU.RECIPE_IV) - .addTo(centrifugeRecipes); - } - } - - private static void chemicalBathRecipes() { - - int[] chances = { 9000, 6000, 3000 }; - GT_Values.RA.addChemicalBathRecipe( - ItemUtils.getItemStackOfAmountFromOreDict("dustTin", 12), - FluidUtils.getFluidStack("chlorine", 2400), - ItemUtils.getItemStackOfAmountFromOreDict("dustZirconium", 3), - ItemUtils.getItemStackOfAmountFromOreDict("dustZirconium", 4), - ItemUtils.getItemStackOfAmountFromOreDict("dustZirconium", 5), - chances, - 30 * 20, - 480); - - chances = new int[] { 9000, 3000, 1000 }; - GT_Values.RA.addChemicalBathRecipe( - ItemUtils.getItemStackOfAmountFromOreDict("dustRutile", 5), - FluidUtils.getFluidStack("chlorine", 4000), - ItemUtils.getItemStackOfAmountFromOreDict("dustZirconium", 3), - ItemUtils.getItemStackOfAmountFromOreDict("dustTitanium", 1), - ItemUtils.getItemStackOfAmountFromOreDict("dustHafnium", 1), - chances, - 30 * 20, - 1024); - - GT_Values.RA.addChemicalBathRecipe( - ItemUtils.getItemStackOfAmountFromOreDict("dustLithiumCarbonate", 10), - FluidUtils.getFluidStack("hydrofluoricacid", 10 * 144), - ItemUtils.getItemStackOfAmountFromOreDict("dustLithiumFluoride", 10), - null, - null, - new int[] {}, - 90 * 20, - 500); - } - - private static void chemicalReactorRecipes() { - - ItemStack aGtHydrofluoricAcid = ItemUtils - .getItemStackOfAmountFromOreDictNoBroken("cellHydrofluoricAcid_GT5U", 2); - - GT_Values.RA.addChemicalRecipe( - ItemUtils.getItemStackOfAmountFromOreDict("dustLithiumCarbonate", 5), // Input - ItemUtils.getItemStackOfAmountFromOreDict("dustCalciumHydroxide", 5), // Input - null, // Fluid Input - null, // Fluid Output - ItemUtils.getItemStackOfAmountFromOreDict("dustLi2CO3CaOH2", 10), - 600 * 20); - - GT_Values.RA.addChemicalRecipe( - ItemUtils.getItemStackOfAmountFromOreDict("dustLithiumHydroxide", 5), // Input - null, // Input Stack 2 - FluidUtils.getFluidStack("hydrofluoricacid", 5 * 144), - FluidUtils.getFluidStack("water", 5 * 144), // Fluid Output - ItemUtils.getItemStackOfAmountFromOreDict("dustLithiumFluoride", 5), - 600 * 20); - - GT_Values.RA.addChemicalRecipe( - ItemUtils.getItemStackOfAmountFromOreDict("cellOxygen", 1), - ItemUtils.getItemStackOfAmountFromOreDict("dustLithium7", 16), - FluidUtils.getFluidStack("water", 1000), - FluidUtils.getFluidStack("lithiumhydroxide", 2000 + 144 * 4), - CI.emptyCells(1), - 300 * 20); - - // LFTR Fuel Related Compounds - // Hydroxide - GT_Values.RA.addChemicalRecipe( - ItemUtils.getGregtechCircuit(3), - ELEMENT.getInstance().OXYGEN.getCell(1), - ELEMENT.getInstance().HYDROGEN.getFluidStack(1000), - MISC_MATERIALS.HYDROXIDE.getFluidStack(1000), - CI.emptyCells(1), - GT_Values.NI, - 8 * 20, - 30); - // Beryllium Hydroxide - GT_Values.RA.addChemicalRecipe( - ItemUtils.getGregtechCircuit(3), - ELEMENT.getInstance().BERYLLIUM.getDust(7), - MISC_MATERIALS.HYDROXIDE.getFluidStack(1000), - FLUORIDES.BERYLLIUM_HYDROXIDE.getFluidStack(2000), - GT_Values.NI, - 8 * 20, - 30); - // Ammonium Bifluoride - GT_Values.RA.addChemicalRecipe( - ItemUtils.getGregtechCircuit(3), - ItemUtils.getItemStackOfAmountFromOreDict("cellHydrofluoricAcid", 1), - MISC_MATERIALS.AMMONIUM.getFluidStack(1000), - FLUORIDES.AMMONIUM_BIFLUORIDE.getFluidStack(2000), - CI.emptyCells(1), - 20 * 20, - 30); - if (aGtHydrofluoricAcid != null) { - // Ammonium Bifluoride - GT_Values.RA.addChemicalRecipe( - ItemUtils.getGregtechCircuit(3), - aGtHydrofluoricAcid, - MISC_MATERIALS.AMMONIUM.getFluidStack(1000), - FLUORIDES.AMMONIUM_BIFLUORIDE.getFluidStack(2000), - CI.emptyCells(2), - 40 * 20, - 30); - } - // Ammonium - GT_Values.RA.addChemicalRecipe( - ItemUtils.getGregtechCircuit(3), - ELEMENT.getInstance().HYDROGEN.getCell(1), - MISC_MATERIALS.AMMONIA.getFluidStack(1000), - MISC_MATERIALS.AMMONIUM.getFluidStack(2000), - CI.emptyCells(1), - GT_Values.NI, - 20 * 20, - 30); - - // Sodium Hydroxide - GT_Values.RA.addChemicalRecipe( - CI.getNumberedBioCircuit(15), - ItemUtils.getItemStackOfAmountFromOreDict("dustSodiumHydroxide", 1), - FluidUtils.getFluidStack("hydrofluoricacid", 500), - FluidUtils.getWater(1000), - FLUORIDES.SODIUM_FLUORIDE.getDust(1), - 60 * 20); - - if (FluidUtils.doesFluidExist("hydrofluoricacid_gt5u")) { - GT_Values.RA.addChemicalRecipe( - CI.getNumberedBioCircuit(15), - ItemUtils.getItemStackOfAmountFromOreDict("dustSodiumHydroxide", 1), - FluidUtils.getFluidStack("hydrofluoricacid_gt5u", 1000), - FluidUtils.getWater(1000), - FLUORIDES.SODIUM_FLUORIDE.getDust(1), - 60 * 20); - } - } - - private static void dehydratorRecipes() { - - // Makes 7-Lithium - GT_Values.RA.stdBuilder() - .itemInputs(CI.getNumberedAdvancedCircuit(14)) - .fluidInputs(FluidUtils.getFluidStack("sulfuriclithium", 1440)) - .itemOutputs( - ItemUtils.getItemStackOfAmountFromOreDict("dustSulfur", 3), - ItemUtils.getItemStackOfAmountFromOreDict("dustCopper", 1), - ItemUtils.getItemStackOfAmountFromOreDict("dustSodium", 1), - ItemUtils.getItemStackOfAmountFromOreDict("dustCarbon", 1), - ItemUtils.getItemStackOfAmountFromOreDict("dustLithium7", 4)) - .duration(30 * SECONDS) - .eut(30) - .addTo(chemicalDehydratorRecipes); - - // Makes Lithium Carbonate - CORE.RA.addDehydratorRecipe( - new ItemStack[] { CI.emptyCells(12), ItemUtils.getItemStackOfAmountFromOreDict("dustLepidolite", 20) }, // Item - // input - // (Array, - // up - // to - // 2) - FluidUtils.getFluidStack("sulfuricacid", 10000), - FluidUtils.getFluidStack("sulfuriclithium", 10000), - new ItemStack[] { ItemUtils.getItemStackOfAmountFromOreDict("dustPotassium", 1), - GT_OreDictUnificator.get(OrePrefixes.dust, Materials.Aluminium, 4), - ItemUtils.getItemStackOfAmountFromOreDict("cellOxygen", 10), - ItemUtils.getItemStackOfAmountFromOreDict("cellFluorine", 2), - ItemUtils.getItemStackOfAmountFromOreDict("dustLithiumCarbonate", 3), // LithiumCarbonate - }, // Output Array of Items - Upto 9, - new int[] { 10000, 10000, 10000, 10000, 10000 }, - 75 * 20, // Time in ticks - 1000); // EU - - // Calcium Hydroxide - if (ItemUtils.checkForInvalidItems(ItemUtils.getItemStackOfAmountFromOreDict("dustQuicklime", 1))) { - // CaO + H2O = Ca(OH)2 - CORE.RA.addDehydratorRecipe( - new ItemStack[] { CI.getNumberedBioCircuit(20), - ItemUtils.getItemStackOfAmountFromOreDict("dustQuicklime", 2) }, - FluidUtils.getFluidStack("water", 1000), - null, // Fluid output (slot 2) - new ItemStack[] { ItemUtils.getItemStackOfAmountFromOreDict("dustCalciumHydroxide", 5) }, // Output - new int[] { 10000 }, - 12 * 20, // Time in ticks - 120); // EU - } else { - Logger.INFO("[dustCalciumHydroxide] FAILED TO LOAD RECIPE"); - if (!ItemUtils.checkForInvalidItems(ItemUtils.getItemStackOfAmountFromOreDict("dustQuicklime", 1))) { - Logger.INFO("Could not find dustQuicklime, cannot make dustCalciumHydroxide."); - } - } - - // 2 LiOH + CaCO3 - CORE.RA.addDehydratorRecipe( - new ItemStack[] { CI.getNumberedAdvancedCircuit(20), - ItemUtils.getItemStackOfAmountFromOreDict("dustLi2CO3CaOH2", 5) }, // Item - null, // Fluid input (slot 1) - null, // Fluid output (slot 2) - new ItemStack[] { ItemUtils.getItemStackOfAmountFromOreDict("dustLithiumHydroxide", 2), - ItemUtils.getItemStackOfAmountFromOreDict("dustCalciumCarbonate", 3) }, // Output - new int[] { 10000, 10000 }, - 120 * 20, // Time in ticks - 1000); // EU - - // LiOH Liquid to Dust - CORE.RA.addDehydratorRecipe( - new ItemStack[] { CI.getNumberedAdvancedCircuit(22) }, - FluidUtils.getFluidStack("lithiumhydroxide", 144), - null, - new ItemStack[] { ItemUtils.getItemStackOfAmountFromOreDict("dustLithiumHydroxide", 1) }, - new int[] { 10000 }, - 1 * 20, // Time in ticks - 64); // EU - - // Zirconium Chloride -> TetraFluoride - FluidStack aHydrogenChloride = new FluidStack(GenericChem.HydrochloricAcid, 9000); - CORE.RA.addDehydratorRecipe( - new ItemStack[] { CI.getNumberedAdvancedCircuit(11), - ItemUtils.getItemStackOfAmountFromOreDict("dustCookedZrCl4", 9), }, // Item - FluidUtils.getFluidStack("hydrofluoricacid", 9 * 144), - aHydrogenChloride, - new ItemStack[] { FLUORIDES.ZIRCONIUM_TETRAFLUORIDE.getDust(9) }, - new int[] { 10000 }, - 120 * 20, // Time in ticks - 500); // EU - - // Zirconium Chloride -> TetraFluoride - CORE.RA.addDehydratorRecipe( - new ItemStack[] { CI.getNumberedAdvancedCircuit(10), - ItemUtils.getItemStackOfAmountFromOreDict("dustCookedZrCl4", 9) }, - FluidUtils.getFluidStack("hydrofluoricacid_gt5u", 18 * 144), - aHydrogenChloride, - new ItemStack[] { FLUORIDES.ZIRCONIUM_TETRAFLUORIDE.getDust(9) }, - new int[] { 10000 }, - 240 * 20, // Time in ticks - 500); // EU - - // Be(OH)2 + 2 (NH4)HF2 → (NH4)2BeF4 + 2 H2O - CORE.RA.addDehydratorRecipe( - new ItemStack[] { CI.getNumberedAdvancedCircuit(6), FLUORIDES.AMMONIUM_BIFLUORIDE.getCell(4) }, - FLUORIDES.BERYLLIUM_HYDROXIDE.getFluidStack(2000), // Fluid input (slot 1) - FLUORIDES.AMMONIUM_TETRAFLUOROBERYLLATE.getFluidStack(6000), - new ItemStack[] { ItemUtils.getItemStackOfAmountFromOreDict("cellWater", 4) }, - new int[] { 10000 }, - 32 * 20, // Time in ticks - 64); // EU - - // (NH4)2BeF4 → 2 NH3 + 2 HF + BeF2 - CORE.RA.addDehydratorRecipe( - new ItemStack[] { CI.getNumberedAdvancedCircuit(17), CI.emptyCells(5) }, - FLUORIDES.AMMONIUM_TETRAFLUOROBERYLLATE.getFluidStack(5000), - null, - new ItemStack[] { MISC_MATERIALS.AMMONIA.getCell(2), - ItemUtils.getItemStackOfAmountFromOreDict("cellHydrofluoricAcid", 2), - FLUORIDES.BERYLLIUM_FLUORIDE.getCell(1) }, - new int[] { 10000, 10000, 10000 }, - 5 * 60 * 20, - 120); - } - - private static void electroMagneticSeperator() { - - // Zirconium - GT_Values.RA.addElectromagneticSeparatorRecipe( - ItemUtils.getItemStackOfAmountFromOreDict("crushedPurifiedBauxite", 1), - ItemUtils.getItemStackOfAmountFromOreDict("dustBauxite", 1), - ItemUtils.getItemStackOfAmountFromOreDict("dustSmallRutile", 1), - ItemUtils.getItemStackOfAmountFromOreDict("nuggetZirconium", 1), - new int[] { 10000, 2500, 4000 }, - 20 * 20, - 24); - - // Zircon - GT_Values.RA.addElectromagneticSeparatorRecipe( - ItemUtils.getItemStackOfAmountFromOreDict("crushedPurifiedMagnetite", 1), - ItemUtils.getItemStackOfAmountFromOreDict("dustMagnetite", 1), - ItemUtils.getItemStackOfAmountFromOreDict("dustSmallZircon", 1), - ItemUtils.getItemStackOfAmountFromOreDict("dustTinyZircon", 1), - new int[] { 10000, 1250, 2500 }, - 20 * 20, - 24); - GT_Values.RA.addElectromagneticSeparatorRecipe( - ItemUtils.getItemStackOfAmountFromOreDict("crushedPurifiedCassiterite", 1), - ItemUtils.getItemStackOfAmountFromOreDict("dustCassiterite", 1), - ItemUtils.getItemStackOfAmountFromOreDict("dustSmallZircon", 1), - ItemUtils.getItemStackOfAmountFromOreDict("dustTinyZircon", 1), - new int[] { 10000, 1250, 2500 }, - 20 * 20, - 24); - } - - private static void fluidExtractorRecipes() { - - // FLiBe fuel - CORE.RA.addFluidExtractionRecipe(NUCLIDE.Li2BeF4.getDust(1), NUCLIDE.Li2BeF4.getFluidStack(144), 100, 500); - // Lithium Fluoride - CORE.RA.addFluidExtractionRecipe( - ItemUtils.getItemStackOfAmountFromOreDict("dustLithiumFluoride", 1), - FLUORIDES.LITHIUM_FLUORIDE.getFluidStack(144), - 100, - 500); - // LFTR Fuel 1 - CORE.RA.addFluidExtractionRecipe( - NUCLIDE.LiFBeF2ZrF4U235.getDust(1), - NUCLIDE.LiFBeF2ZrF4U235.getFluidStack(144), - 250, - 1000); - CORE.RA.addFluidExtractionRecipe( - NUCLIDE.LiFBeF2ZrF4UF4.getDust(1), - NUCLIDE.LiFBeF2ZrF4UF4.getFluidStack(144), - 150, - 1500); - CORE.RA.addFluidExtractionRecipe( - NUCLIDE.LiFBeF2ThF4UF4.getDust(1), - NUCLIDE.LiFBeF2ThF4UF4.getFluidStack(144), - 150, - 2000); - - // ZIRCONIUM_TETRAFLUORIDE - CORE.RA.addFluidExtractionRecipe( - FLUORIDES.ZIRCONIUM_TETRAFLUORIDE.getDust(1), - FLUORIDES.ZIRCONIUM_TETRAFLUORIDE.getFluidStack(144), - 200, - 512 + 256); - } - - private static void fusionChainRecipes() { - // Mk1 - GT_Values.RA.stdBuilder() - .fluidInputs(Materials.Boron.getPlasma(144), Materials.Calcium.getPlasma(16)) - .fluidOutputs(new FluidStack(ELEMENT.getInstance().NEON.getPlasma(), 1000)) - .duration(3 * SECONDS + 4 * TICKS) - .eut(TierEU.RECIPE_LuV) - .metadata(FUSION_THRESHOLD, 100000000) - .addTo(fusionRecipes); - - GT_Values.RA.stdBuilder() - .fluidInputs( - new FluidStack(ELEMENT.getInstance().NEON.getPlasma(), 144), - Materials.Bedrockium.getMolten(144)) - .fluidOutputs(new FluidStack(ELEMENT.STANDALONE.FORCE.getPlasma(), 1000)) - .duration(3 * SECONDS + 4 * TICKS) - .eut(TierEU.RECIPE_LuV) - .metadata(FUSION_THRESHOLD, 100000000) - .addTo(fusionRecipes); - - // Mk2 - GT_Values.RA.stdBuilder() - .fluidInputs(Materials.Niobium.getPlasma(144), Materials.Zinc.getPlasma(144)) - .fluidOutputs(new FluidStack(ELEMENT.getInstance().KRYPTON.getPlasma(), 144)) - .duration(32 * TICKS) - .eut(TierEU.RECIPE_ZPM) - .metadata(FUSION_THRESHOLD, 300000000) - .addTo(fusionRecipes); - - GT_Values.RA.stdBuilder() - .fluidInputs( - new FluidStack(ELEMENT.getInstance().KRYPTON.getPlasma(), 144), - new FluidStack(ELEMENT.STANDALONE.FORCE.getPlasma(), 1000)) - .fluidOutputs(new FluidStack(ELEMENT.STANDALONE.ASTRAL_TITANIUM.getPlasma(), 1000)) - .duration(32 * TICKS) - .eut(TierEU.RECIPE_ZPM) - .metadata(FUSION_THRESHOLD, 300000000) - .addTo(fusionRecipes); - - GT_Values.RA.stdBuilder() - .fluidInputs( - new FluidStack(ELEMENT.STANDALONE.ASTRAL_TITANIUM.getPlasma(), 144), - new FluidStack(ALLOY.TITANSTEEL.getFluid(), 8)) - .fluidOutputs(new FluidStack(ELEMENT.STANDALONE.RUNITE.getPlasma(), 1000)) - .duration(32 * TICKS) - .eut(TierEU.RECIPE_ZPM) - .metadata(FUSION_THRESHOLD, 300000000) - .addTo(fusionRecipes); - - // Mk3 - GT_Values.RA.stdBuilder() - .fluidInputs(ELEMENT.getInstance().CURIUM.getFluidStack(144), Materials.Americium.getPlasma(144)) - .fluidOutputs(new FluidStack(ELEMENT.getInstance().XENON.getPlasma(), 144)) - .duration(16 * TICKS) - .eut(TierEU.RECIPE_UV) - .metadata(FUSION_THRESHOLD, 500000000) - .addTo(fusionRecipes); - - GT_Values.RA.stdBuilder() - .fluidInputs( - new FluidStack(ELEMENT.getInstance().XENON.getPlasma(), 144), - new FluidStack(ELEMENT.STANDALONE.RUNITE.getPlasma(), 1000)) - .fluidOutputs(new FluidStack(ELEMENT.STANDALONE.ADVANCED_NITINOL.getPlasma(), 1000)) - .duration(16 * TICKS) - .eut(TierEU.RECIPE_UV) - .metadata(FUSION_THRESHOLD, 500000000) - .addTo(fusionRecipes); - - GT_Values.RA.stdBuilder() - .fluidInputs( - new FluidStack(ELEMENT.STANDALONE.ADVANCED_NITINOL.getPlasma(), 144), - Materials.Tartarite.getMolten(2)) - .fluidOutputs(new FluidStack(ELEMENT.STANDALONE.CELESTIAL_TUNGSTEN.getPlasma(), 1000)) - .duration(16 * TICKS) - .eut(TierEU.RECIPE_UV) - .metadata(FUSION_THRESHOLD, 500000000) - .addTo(fusionRecipes); - } - - private static void macerator() { - - GT_ModHandler.addPulverisationRecipe( - ItemUtils.getItemStackOfAmountFromOreDict("pelletZirconium", 1), - ItemUtils.getItemStackOfAmountFromOreDict("dustZrCl4", 1)); - } - - private static void mixerRecipes() { - - GT_Values.RA.addMixerRecipe( - ItemUtils.getItemStackOfAmountFromOreDict("dustUranium233", 4), - ItemUtils.getItemStackOfAmountFromOreDict("dustUranium235", 1), - null, - null, - FluidUtils.getFluidStack("hydrofluoricacid", 5000), - FLUORIDES.URANIUM_TETRAFLUORIDE.getFluidStack(5000), - null, - 3000, - 500); - } - - private static void sifter() { - - // Zirconium - GT_Values.RA.addSifterRecipe( - ItemUtils.getItemStackOfAmountFromOreDict("crushedPurifiedIlmenite", 1), - new ItemStack[] { ItemUtils.getItemStackOfAmountFromOreDict("dustIron", 1), - ItemUtils.getItemStackOfAmountFromOreDict("dustWroughtIron", 1), - ItemUtils.getItemStackOfAmountFromOreDict("dustZirconium", 1), - ItemUtils.getItemStackOfAmountFromOreDict("dustZirconium", 1), - ItemUtils.getItemStackOfAmountFromOreDict("dustHafnium", 1), - ItemUtils.getItemStackOfAmountFromOreDict("dustHafnium", 1) }, - new int[] { 5000, 278, 1000, 1000, 300, 300 }, - 20 * 30, - 500); - GT_Values.RA.addSifterRecipe( - ItemUtils.getItemStackOfAmountFromOreDict("crushedPurifiedTin", 1), - new ItemStack[] { ItemUtils.getItemStackOfAmountFromOreDict("dustTin", 1), - ItemUtils.getItemStackOfAmountFromOreDict("dustZinc", 1), - ItemUtils.getItemStackOfAmountFromOreDict("dustZirconium", 1), - ItemUtils.getItemStackOfAmountFromOreDict("dustZirconium", 1), - ItemUtils.getItemStackOfAmountFromOreDict("dustZirconium", 1), - ItemUtils.getItemStackOfAmountFromOreDict("dustZirconium", 1) }, - new int[] { 10000, 556, 1500, 1000, 500, 500 }, - 20 * 30, - 500); - GT_Values.RA.addSifterRecipe( - ItemUtils.getItemStackOfAmountFromOreDict("crushedPurifiedCassiterite", 1), - new ItemStack[] { ItemUtils.getItemStackOfAmountFromOreDict("dustCassiterite", 1), - ItemUtils.getItemStackOfAmountFromOreDict("dustTin", 1), - ItemUtils.getItemStackOfAmountFromOreDict("dustZirconium", 1), - ItemUtils.getItemStackOfAmountFromOreDict("dustZirconium", 1), - ItemUtils.getItemStackOfAmountFromOreDict("dustZirconium", 1), - ItemUtils.getItemStackOfAmountFromOreDict("dustZirconium", 1) }, - new int[] { 10000, 556, 1500, 1000, 500, 500 }, - 20 * 30, - 500); - - // Radium - GT_Values.RA.addSifterRecipe( - ItemUtils.getItemStackOfAmountFromOreDict("crushedPurifiedThorium", 1), - new ItemStack[] { ItemUtils.getItemStackOfAmountFromOreDict("dustThorium", 1), - ItemUtils.getItemStackOfAmountFromOreDict("dustLead", 1), - ItemUtils.getItemStackOfAmountFromOreDict("dustRadium226", 1), - ItemUtils.getItemStackOfAmountFromOreDict("dustRadium226", 1), - ItemUtils.getItemStackOfAmountFromOreDict("dustRadium226", 1), - ItemUtils.getItemStackOfAmountFromOreDict("dustRadium226", 1) }, - new int[] { 10000, 500, 300, 200, 100, 100 }, - 20 * 30, - 500); - - GT_Values.RA.addSifterRecipe( - ItemUtils.getItemStackOfAmountFromOreDict("crushedPurifiedUranium", 1), - new ItemStack[] { ItemUtils.getItemStackOfAmountFromOreDict("dustUranium", 1), - ItemUtils.getItemStackOfAmountFromOreDict("dustLead", 1), - ItemUtils.getItemStackOfAmountFromOreDict("dustRadium226", 1), - ItemUtils.getItemStackOfAmountFromOreDict("dustRadium226", 1), - ItemUtils.getItemStackOfAmountFromOreDict("dustRadium226", 1), - ItemUtils.getItemStackOfAmountFromOreDict("dustRadium226", 1) }, - new int[] { 10000, 556, 1000, 500, 500, 500 }, - 20 * 30, - 500); - - GT_Values.RA.addSifterRecipe( - ItemUtils.getItemStackOfAmountFromOreDict("crushedPurifiedUraninite", 1), - new ItemStack[] { ItemUtils.getItemStackOfAmountFromOreDict("dustUraninite", 1), - ItemUtils.getItemStackOfAmountFromOreDict("dustUranium", 1), - ItemUtils.getItemStackOfAmountFromOreDict("dustRadium226", 1), - ItemUtils.getItemStackOfAmountFromOreDict("dustRadium226", 1), - ItemUtils.getItemStackOfAmountFromOreDict("dustRadium226", 1), - ItemUtils.getItemStackOfAmountFromOreDict("dustRadium226", 1) }, - new int[] { 10000, 556, 500, 250, 250, 250 }, - 20 * 30, - 500); - - GT_Values.RA.addSifterRecipe( - ItemUtils.getItemStackOfAmountFromOreDict("crushedPurifiedPitchblende", 1), - new ItemStack[] { ItemUtils.getItemStackOfAmountFromOreDict("dustPitchblende", 1), - ItemUtils.getItemStackOfAmountFromOreDict("dustLead", 1), - ItemUtils.getItemStackOfAmountFromOreDict("dustRadium226", 1), - ItemUtils.getItemStackOfAmountFromOreDict("dustRadium226", 1), - ItemUtils.getItemStackOfAmountFromOreDict("dustRadium226", 1), - ItemUtils.getItemStackOfAmountFromOreDict("dustRadium226", 1) }, - new int[] { 10000, 556, 500, 250, 250, 250 }, - 20 * 30, - 500); - } - - private static void fluidHeater() { - - CORE.RA.addFluidHeaterRecipe( - FLUORIDES.SODIUM_FLUORIDE.getDust(1), - null, - FLUORIDES.SODIUM_FLUORIDE.getFluidStack(144), - 20 * 30, - 500); - } -} diff --git a/gtpp/src/main/java/gtPlusPlus/xmod/gregtech/loaders/recipe/RecipeLoader_NuclearFuelProcessing.java b/gtpp/src/main/java/gtPlusPlus/xmod/gregtech/loaders/recipe/RecipeLoader_NuclearFuelProcessing.java deleted file mode 100644 index dec6fd426a..0000000000 --- a/gtpp/src/main/java/gtPlusPlus/xmod/gregtech/loaders/recipe/RecipeLoader_NuclearFuelProcessing.java +++ /dev/null @@ -1,258 +0,0 @@ -package gtPlusPlus.xmod.gregtech.loaders.recipe; - -import static gregtech.api.recipe.RecipeMaps.blastFurnaceRecipes; -import static gregtech.api.recipe.RecipeMaps.distillationTowerRecipes; -import static gregtech.api.util.GT_RecipeBuilder.MINUTES; -import static gregtech.api.util.GT_RecipeBuilder.SECONDS; -import static gregtech.api.util.GT_RecipeConstants.COIL_HEAT; - -import net.minecraft.item.ItemStack; -import net.minecraftforge.fluids.FluidStack; - -import gregtech.api.enums.GT_Values; -import gregtech.api.enums.Materials; -import gregtech.api.enums.TierEU; -import gtPlusPlus.core.item.chemistry.NuclearChem; -import gtPlusPlus.core.lib.CORE; -import gtPlusPlus.core.material.ELEMENT; -import gtPlusPlus.core.material.nuclear.FLUORIDES; -import gtPlusPlus.core.material.nuclear.NUCLIDE; -import gtPlusPlus.core.recipe.common.CI; -import gtPlusPlus.core.util.minecraft.FluidUtils; -import gtPlusPlus.core.util.minecraft.ItemUtils; -import gtPlusPlus.core.util.minecraft.MaterialUtils; - -public class RecipeLoader_NuclearFuelProcessing { - - public static void generate() { - - // Create Fuels - - final FluidStack aLithiumFluoride = FLUORIDES.LITHIUM_FLUORIDE.getFluidStack(100); - final FluidStack aBerylliumFluoride = FLUORIDES.BERYLLIUM_FLUORIDE.getFluidStack(100); - final FluidStack aThoriumFluoride = FLUORIDES.THORIUM_TETRAFLUORIDE.getFluidStack(100); - final FluidStack aZirconiumFluoride = FLUORIDES.ZIRCONIUM_TETRAFLUORIDE.getFluidStack(100); - final FluidStack aUraniumTetraFluoride = FLUORIDES.URANIUM_TETRAFLUORIDE.getFluidStack(100); - final FluidStack aUranium235 = ELEMENT.getInstance().URANIUM235.getFluidStack(1000); - final FluidStack aLiFBeF2ZrF4U235 = NUCLIDE.LiFBeF2ZrF4U235.getFluidStack(100); - final FluidStack aLiFBeF2ZrF4UF4 = NUCLIDE.LiFBeF2ZrF4UF4.getFluidStack(100); - final FluidStack aLiFBeF2ThF4UF4 = NUCLIDE.LiFBeF2ThF4UF4.getFluidStack(100); - - // 7LiF - BeF2 - ZrF4 - U235 - 590C - CORE.RA.addFissionFuel( - FluidUtils.getFluidStack(aLithiumFluoride, 550), - FluidUtils.getFluidStack(aBerylliumFluoride, 150), - FluidUtils.getFluidStack(aZirconiumFluoride, 60), - FluidUtils.getFluidStack(aUranium235, 240), - null, - null, - null, - null, - null, // Extra 5 inputs - FluidUtils.getFluidStack(aLiFBeF2ZrF4U235, 1000), - null, - 30 * 60 * 20, // Duration - MaterialUtils.getVoltageForTier(4)); - - // 7LiF - BeF2 - ZrF4 - UF4 - 650C - CORE.RA.addFissionFuel( - FluidUtils.getFluidStack(aLithiumFluoride, 600), - FluidUtils.getFluidStack(aBerylliumFluoride, 250), - FluidUtils.getFluidStack(aZirconiumFluoride, 80), - FluidUtils.getFluidStack(aUraniumTetraFluoride, 70), - null, - null, - null, - null, - null, // Extra 5 inputs - FluidUtils.getFluidStack(aLiFBeF2ZrF4UF4, 1000), - null, - 40 * 60 * 20, - MaterialUtils.getVoltageForTier(5)); - - // 7liF - BeF2 - ThF4 - UF4 - 566C - CORE.RA.addFissionFuel( - FluidUtils.getFluidStack(aLithiumFluoride, 580), - FluidUtils.getFluidStack(aBerylliumFluoride, 270), - FluidUtils.getFluidStack(aThoriumFluoride, 80), - FluidUtils.getFluidStack(aUraniumTetraFluoride, 70), - null, - null, - null, - null, - null, // Extra 5 inputs - FluidUtils.getFluidStack(aLiFBeF2ThF4UF4, 1000), - null, - 50 * 60 * 20, // Duration - MaterialUtils.getVoltageForTier(5)); - - // Reprocess Fuels - - // Reactor Blanket step 1 - Fluorination - CORE.RA.addReactorProcessingUnitRecipe( - CI.getNumberedAdvancedCircuit(17), - ELEMENT.getInstance().FLUORINE.getCell(6), - NUCLIDE.LiFThF4.getFluidStack(10000), - new ItemStack[] { CI.emptyCells(5), FLUORIDES.LITHIUM_FLUORIDE.getCell(1), - ELEMENT.getInstance().PROTACTINIUM.getDust(1), ELEMENT.getInstance().PROTACTINIUM.getDust(1), - ELEMENT.getInstance().PROTACTINIUM.getDust(1), ELEMENT.getInstance().PROTACTINIUM.getDust(1), - ELEMENT.getInstance().PROTACTINIUM.getDust(1), ELEMENT.getInstance().PROTACTINIUM.getDust(1) }, - new int[] { 10000, 10000, 500, 500, 500, 250, 250, 250 }, - NUCLIDE.UF6F2.getFluidStack(1500), - 20 * 60 * 10, - MaterialUtils.getVoltageForTier(5)); - CORE.RA.addReactorProcessingUnitRecipe( - CI.getNumberedAdvancedCircuit(18), - ELEMENT.getInstance().FLUORINE.getCell(6), - NUCLIDE.LiFBeF2ThF4.getFluidStack(10000), - new ItemStack[] { CI.emptyCells(4), FLUORIDES.LITHIUM_FLUORIDE.getCell(1), - FLUORIDES.BERYLLIUM_FLUORIDE.getCell(1), ELEMENT.getInstance().PROTACTINIUM.getDust(1), - ELEMENT.getInstance().PROTACTINIUM.getDust(1), ELEMENT.getInstance().PROTACTINIUM.getDust(1), - ELEMENT.getInstance().PROTACTINIUM.getDust(1), ELEMENT.getInstance().PROTACTINIUM.getDust(1), - ELEMENT.getInstance().PROTACTINIUM.getDust(1) }, - new int[] { 10000, 10000, 10000, 1000, 1000, 1000, 500, 500, 500 }, - NUCLIDE.UF6F2.getFluidStack(3000), - 20 * 60 * 10, - MaterialUtils.getVoltageForTier(5)); - - // Reactor Blanket step 1 - Fluorination - CORE.RA.addReactorProcessingUnitRecipe( - CI.getNumberedAdvancedCircuit(7), - ELEMENT.getInstance().FLUORINE.getCell(6), - NUCLIDE.Sparged_LiFThF4.getFluidStack(10000), - new ItemStack[] { CI.emptyCells(4), FLUORIDES.LITHIUM_FLUORIDE.getCell(2), - ELEMENT.getInstance().PROTACTINIUM.getDust(1), ELEMENT.getInstance().PROTACTINIUM.getDust(1), - ELEMENT.getInstance().PROTACTINIUM.getDust(1), ELEMENT.getInstance().PROTACTINIUM.getDust(1), - ELEMENT.getInstance().PROTACTINIUM.getDust(1), ELEMENT.getInstance().PROTACTINIUM.getDust(1) }, - new int[] { 10000, 10000, 1000, 1000, 1000, 1000, 1000, 1000 }, - NUCLIDE.UF6F2.getFluidStack(3000), - 20 * 60 * 5, - MaterialUtils.getVoltageForTier(5)); - CORE.RA.addReactorProcessingUnitRecipe( - CI.getNumberedAdvancedCircuit(8), - ELEMENT.getInstance().FLUORINE.getCell(6), - NUCLIDE.Sparged_LiFBeF2ThF4.getFluidStack(10000), - new ItemStack[] { CI.emptyCells(2), FLUORIDES.LITHIUM_FLUORIDE.getCell(2), - FLUORIDES.BERYLLIUM_FLUORIDE.getCell(2), ELEMENT.getInstance().PROTACTINIUM.getDust(1), - ELEMENT.getInstance().PROTACTINIUM.getDust(1), ELEMENT.getInstance().PROTACTINIUM.getDust(1), - ELEMENT.getInstance().PROTACTINIUM.getDust(1), ELEMENT.getInstance().PROTACTINIUM.getDust(1), - ELEMENT.getInstance().PROTACTINIUM.getDust(1) }, - new int[] { 10000, 10000, 10000, 2000, 2000, 2000, 2000, 2000, 2000 }, - NUCLIDE.UF6F2.getFluidStack(6000), - 20 * 60 * 5, - MaterialUtils.getVoltageForTier(5)); - - // Reactor Blanket step 2 - Sorption + Cold Trap - CORE.RA.addColdTrapRecipe( - 8, - FLUORIDES.SODIUM_FLUORIDE.getCell(4), - NUCLIDE.UF6F2.getFluidStack(3000), - new ItemStack[] { ELEMENT.getInstance().FLUORINE.getCell(2), FLUORIDES.URANIUM_HEXAFLUORIDE.getCell(2), - ELEMENT.getInstance().URANIUM233.getDust(1), ELEMENT.getInstance().URANIUM233.getDust(1), - ELEMENT.getInstance().URANIUM233.getDust(1) }, - new int[] { 10000, 10000, 3000, 2000, 1000 }, - FLUORIDES.SODIUM_FLUORIDE.getFluidStack(2000), - 20 * 60 * 10, - MaterialUtils.getVoltageForTier(3)); - - // LiBeF2UF4FP + F2 = LiFBeF2 & UF6F2FP - // Reactor Core step 1 - Process Burnt Salt - CORE.RA.addReactorProcessingUnitRecipe( - CI.getNumberedAdvancedCircuit(1), - ELEMENT.getInstance().FLUORINE.getCell(1), - NUCLIDE.LiFBeF2UF4FP.getFluidStack(1000), - new ItemStack[] { NUCLIDE.UF6F2FP.getCell(1) }, - new int[] { 10000 }, - FluidUtils.getFluidStack(NuclearChem.Impure_LiFBeF2, 1000), - 20 * 60 * 120, - MaterialUtils.getVoltageForTier(3)); - - // LiBeF2UF4FP + F2 = LiFBeF2 & UF6F2FP - // Reactor Core step 1 - Process Burnt Salt - CORE.RA.addReactorProcessingUnitRecipe( - CI.getNumberedAdvancedCircuit(1), - ELEMENT.getInstance().FLUORINE.getCell(3), - NUCLIDE.Sparged_LiFBeF2UF4FP.getFluidStack(1000), - new ItemStack[] { CI.emptyCells(1), NUCLIDE.UF6F2FP.getCell(2) }, - new int[] { 10000 }, - FluidUtils.getFluidStack(NuclearChem.Impure_LiFBeF2, 2000), - 20 * 60 * 60, - MaterialUtils.getVoltageForTier(3)); - - // Reactor Core step 2A - Sorption + Cold Trap - CORE.RA.addColdTrapRecipe( - 8, - FLUORIDES.SODIUM_FLUORIDE.getCell(3), - NUCLIDE.UF6F2FP.getFluidStack(2000), - new ItemStack[] { ELEMENT.getInstance().FLUORINE.getCell(1), FLUORIDES.URANIUM_HEXAFLUORIDE.getCell(2), - ELEMENT.getInstance().PHOSPHORUS.getDust(1), ELEMENT.getInstance().PHOSPHORUS.getDust(1), - ELEMENT.getInstance().PHOSPHORUS.getDust(1), ELEMENT.getInstance().PHOSPHORUS.getDust(1), - ELEMENT.getInstance().PHOSPHORUS.getDust(1), ELEMENT.getInstance().PHOSPHORUS.getDust(1) }, - new int[] { 10000, 10000, 5000, 5000, 5000, 5000, 5000, 5000 }, - FLUORIDES.SODIUM_FLUORIDE.getFluidStack(2000), - 20 * 60 * 10, - MaterialUtils.getVoltageForTier(4)); - - // Reactor Core step 2B - Distillation - GT_Values.RA.stdBuilder() - .fluidInputs(FluidUtils.getFluidStack(NuclearChem.Impure_LiFBeF2, 1000)) - .fluidOutputs(NUCLIDE.LiFBeF2.getFluidStack(250)) - .duration(7 * MINUTES + 30 * SECONDS) - .eut(TierEU.RECIPE_IV) - .addTo(distillationTowerRecipes); - - // UF6 -> UF4 reduction - // UF6 + LiFBeF2 + H2 -> LiFBeF2UF4 + HF - GT_Values.RA.stdBuilder() - .itemInputs(FLUORIDES.URANIUM_HEXAFLUORIDE.getCell(1), NUCLIDE.LiFBeF2.getCell(1)) - .fluidInputs(Materials.Hydrogen.getGas(2000L)) - .itemOutputs(ItemUtils.getItemStackOfAmountFromOreDict("cellHydrofluoricAcid", 2)) - .fluidOutputs(NUCLIDE.LiFBeF2UF4.getFluidStack(3000)) - .duration(2 * MINUTES + 30 * SECONDS) - .eut(TierEU.RECIPE_IV) - .metadata(COIL_HEAT, 5400) - .addTo(blastFurnaceRecipes); - // Alternative recipe to the above, for chemplant, to not use cells - - CORE.RA.addChemicalPlantRecipe( - new ItemStack[] {}, - new FluidStack[] { FLUORIDES.URANIUM_HEXAFLUORIDE.getFluidStack(1000), NUCLIDE.LiFBeF2.getFluidStack(1000), - ELEMENT.getInstance().HYDROGEN.getFluidStack(2000) }, - new ItemStack[] {}, - new FluidStack[] { NUCLIDE.LiFBeF2UF4.getFluidStack(3000), - FluidUtils.getFluidStack("hydrofluoricacid", 2000) }, - 300 * 10, - MaterialUtils.getVoltageForTier(5), - 4); - - CORE.RA.addFissionFuel( - FLUORIDES.ZIRCONIUM_TETRAFLUORIDE.getFluidStack(100), - NUCLIDE.LiFBeF2UF4.getFluidStack(900), - null, - null, - null, - null, - null, - null, - null, - NUCLIDE.LiFBeF2ZrF4UF4.getFluidStack(1000), - null, - 20 * 60 * 12, // Duration - MaterialUtils.getVoltageForTier(5)); - - CORE.RA.addFissionFuel( - FLUORIDES.THORIUM_TETRAFLUORIDE.getFluidStack(100), - NUCLIDE.LiFBeF2UF4.getFluidStack(900), - null, - null, - null, - null, - null, - null, - null, - NUCLIDE.LiFBeF2ThF4UF4.getFluidStack(1000), - null, - 20 * 60 * 15, // Duration - MaterialUtils.getVoltageForTier(5)); - } -} diff --git a/gtpp/src/main/java/gtPlusPlus/xmod/gregtech/loaders/recipe/RecipeLoader_TreeFarm.java b/gtpp/src/main/java/gtPlusPlus/xmod/gregtech/loaders/recipe/RecipeLoader_TreeFarm.java deleted file mode 100644 index 28c8b2a337..0000000000 --- a/gtpp/src/main/java/gtPlusPlus/xmod/gregtech/loaders/recipe/RecipeLoader_TreeFarm.java +++ /dev/null @@ -1,719 +0,0 @@ -package gtPlusPlus.xmod.gregtech.loaders.recipe; - -import net.minecraft.init.Blocks; -import net.minecraft.init.Items; -import net.minecraft.item.ItemStack; -import net.minecraft.nbt.NBTTagCompound; - -import binnie.extratrees.genetics.ExtraTreeSpecies; -import forestry.api.arboriculture.EnumGermlingType; -import forestry.api.arboriculture.EnumWoodType; -import forestry.api.arboriculture.ITree; -import forestry.api.arboriculture.TreeManager; -import forestry.arboriculture.genetics.TreeDefinition; -import forestry.plugins.PluginArboriculture; -import gregtech.api.enums.Mods; -import gregtech.api.util.GT_ModHandler; -import gtPlusPlus.core.util.reflect.ReflectionUtils; -import gtPlusPlus.xmod.gregtech.common.tileentities.machines.multi.production.GregtechMetaTileEntityTreeFarm; - -public class RecipeLoader_TreeFarm { - - public static void generateRecipes() { - generateVanillaTrees(); - - if (Mods.IndustrialCraft2.isModLoaded()) generateIC2Trees(); - if (Mods.TinkerConstruct.isModLoaded()) generateTinkersTrees(); - if (Mods.GTPlusPlus.isModLoaded()) generateGTPPTrees(); - - if (Mods.TwilightForest.isModLoaded()) generateTwilightForestTrees(); - if (Mods.GalaxySpace.isModLoaded()) generateGalaxySpaceTrees(); - if (Mods.GalacticraftAmunRa.isModLoaded()) generateAmunRaTrees(); - - if (Mods.Thaumcraft.isModLoaded()) generateThaumcraftTrees(); - if (Mods.ThaumicBases.isModLoaded()) generateThaumicBasesTrees(); - if (Mods.TaintedMagic.isModLoaded()) generateTaintedMagicTrees(); - if (Mods.ForbiddenMagic.isModLoaded()) generateForbiddenMagicTrees(); - if (Mods.Witchery.isModLoaded()) generateWitcheryTrees(); - - if (Mods.Natura.isModLoaded()) generateNaturaTrees(); - if (Mods.BiomesOPlenty.isModLoaded()) generateBOPTrees(); - if (Mods.PamsHarvestCraft.isModLoaded()) generatePamsTrees(); - if (Mods.PamsHarvestTheNether.isModLoaded()) generatePamsNetherTrees(); - - if (Mods.Forestry.isModLoaded()) generateForestryTrees(); - if (Mods.ExtraTrees.isModLoaded()) generateExtraTreesTrees(); - } - - private static void generateVanillaTrees() { - GregtechMetaTileEntityTreeFarm.registerTreeProducts( // Oak - new ItemStack(Blocks.sapling, 1, 0), - new ItemStack(Blocks.log, 1, 0), - new ItemStack(Blocks.leaves, 1, 0), - new ItemStack(Items.apple, 1, 0)); - - GregtechMetaTileEntityTreeFarm.registerTreeProducts( // Spruce - new ItemStack(Blocks.sapling, 1, 1), - new ItemStack(Blocks.log, 2, 1), - new ItemStack(Blocks.leaves, 1, 1), - null); - - GregtechMetaTileEntityTreeFarm.registerTreeProducts( // Birch - new ItemStack(Blocks.sapling, 1, 2), - new ItemStack(Blocks.log, 1, 2), - new ItemStack(Blocks.leaves, 1, 2), - null); - - GregtechMetaTileEntityTreeFarm.registerTreeProducts( // Jungle - new ItemStack(Blocks.sapling, 1, 3), - new ItemStack(Blocks.log, 2, 3), - new ItemStack(Blocks.leaves, 1, 3), - new ItemStack(Items.dye, 1, 3)); - - GregtechMetaTileEntityTreeFarm.registerTreeProducts( // Acacia - new ItemStack(Blocks.sapling, 1, 4), - new ItemStack(Blocks.log2, 1, 0), - new ItemStack(Blocks.leaves2, 1, 0), - null); - - GregtechMetaTileEntityTreeFarm.registerTreeProducts( // Dark Oak - new ItemStack(Blocks.sapling, 1, 5), - new ItemStack(Blocks.log2, 1, 1), - new ItemStack(Blocks.leaves2, 1, 1), - new ItemStack(Items.apple, 1, 0)); - - GregtechMetaTileEntityTreeFarm.registerTreeProducts( // Brown Mushroom - new ItemStack(Blocks.brown_mushroom, 1, 0), - new ItemStack(Blocks.brown_mushroom_block, 1, 0), - null, - null); - - GregtechMetaTileEntityTreeFarm.registerTreeProducts( // Red Mushroom - new ItemStack(Blocks.red_mushroom, 1, 0), - new ItemStack(Blocks.red_mushroom_block, 1, 0), - null, - null); - } - - private static void generateIC2Trees() { - GregtechMetaTileEntityTreeFarm.registerTreeProducts( // Rubber Tree - GT_ModHandler.getModItem(Mods.IndustrialCraft2.ID, "blockRubSapling", 1, 0), - GT_ModHandler.getModItem(Mods.IndustrialCraft2.ID, "blockRubWood", 1, 0), - GT_ModHandler.getModItem(Mods.IndustrialCraft2.ID, "blockRubLeaves", 1, 0), - GT_ModHandler.getModItem(Mods.IndustrialCraft2.ID, "itemHarz", 1, 0)); - } - - private static void generateTinkersTrees() { - GregtechMetaTileEntityTreeFarm.registerTreeProducts( // Slimy - GT_ModHandler.getModItem(Mods.TinkerConstruct.ID, "slime.sapling", 1, 0), - GT_ModHandler.getModItem(Mods.TinkerConstruct.ID, "slime.gel", 1, 1), - GT_ModHandler.getModItem(Mods.TinkerConstruct.ID, "slime.leaves", 1, 0), - GT_ModHandler.getModItem(Mods.TinkerConstruct.ID, "strangeFood", 1, 0)); - } - - private static void generateGTPPTrees() { - GregtechMetaTileEntityTreeFarm.registerTreeProducts( // Rainforest Oak - GT_ModHandler.getModItem(Mods.GTPlusPlus.ID, "blockRainforestOakSapling", 1, 0), - GT_ModHandler.getModItem(Mods.GTPlusPlus.ID, "blockRainforestOakLog", 3, 0), - GT_ModHandler.getModItem(Mods.GTPlusPlus.ID, "blockRainforestOakLeaves", 1, 0), - new ItemStack(Items.apple, 1, 0)); - - GregtechMetaTileEntityTreeFarm.registerTreeProducts( // Pine - GT_ModHandler.getModItem(Mods.GTPlusPlus.ID, "blockPineSapling", 1, 0), - GT_ModHandler.getModItem(Mods.GTPlusPlus.ID, "blockPineLogLog", 1, 0), - GT_ModHandler.getModItem(Mods.GTPlusPlus.ID, "blockPineLeaves", 1, 0), - GT_ModHandler.getModItem(Mods.GTPlusPlus.ID, "item.BasicAgrichemItem", 1, 24)); - } - - private static void generateTwilightForestTrees() { - GregtechMetaTileEntityTreeFarm.registerTreeProducts( // Sickly Twilight Oak - GT_ModHandler.getModItem(Mods.TwilightForest.ID, "tile.TFSapling", 1, 0), - GT_ModHandler.getModItem(Mods.TwilightForest.ID, "tile.TFLog", 1, 0), - GT_ModHandler.getModItem(Mods.TwilightForest.ID, "tile.TFLeaves", 1, 0), - null); - - GregtechMetaTileEntityTreeFarm.registerTreeProducts( // Canopy Tree - GT_ModHandler.getModItem(Mods.TwilightForest.ID, "tile.TFSapling", 1, 1), - GT_ModHandler.getModItem(Mods.TwilightForest.ID, "tile.TFLog", 1, 1), - GT_ModHandler.getModItem(Mods.TwilightForest.ID, "tile.TFLeaves", 1, 1), - null); - - GregtechMetaTileEntityTreeFarm.registerTreeProducts( // Twilight Mangrove - GT_ModHandler.getModItem(Mods.TwilightForest.ID, "tile.TFSapling", 1, 2), - GT_ModHandler.getModItem(Mods.TwilightForest.ID, "tile.TFLog", 1, 2), - GT_ModHandler.getModItem(Mods.TwilightForest.ID, "tile.TFLeaves", 1, 2), - null); - - GregtechMetaTileEntityTreeFarm.registerTreeProducts( // Darkwood - GT_ModHandler.getModItem(Mods.TwilightForest.ID, "tile.TFSapling", 1, 3), - GT_ModHandler.getModItem(Mods.TwilightForest.ID, "tile.TFLog", 1, 3), - GT_ModHandler.getModItem(Mods.TwilightForest.ID, "tile.DarkLeaves", 1, 0), - null); - - GregtechMetaTileEntityTreeFarm.registerTreeProducts( // Robust Twilight Oak - GT_ModHandler.getModItem(Mods.TwilightForest.ID, "tile.TFSapling", 1, 4), - GT_ModHandler.getModItem(Mods.TwilightForest.ID, "tile.TFLog", 4, 0), - // Does not drop more robust saplings normally: - GT_ModHandler.getModItem(Mods.TwilightForest.ID, "tile.TFSapling", 1, 0), - GT_ModHandler.getModItem(Mods.TwilightForest.ID, "tile.TFLeaves", 1, 0), - null); - - GregtechMetaTileEntityTreeFarm.registerTreeProducts( // Tree of Time - GT_ModHandler.getModItem(Mods.TwilightForest.ID, "tile.TFSapling", 1, 5), - GT_ModHandler.getModItem(Mods.TwilightForest.ID, "tile.TFMagicLog", 1, 0), - GT_ModHandler.getModItem(Mods.TwilightForest.ID, "tile.TFMagicLeaves", 1, 0), - // No I am not making this drop clocks. - null); - - GregtechMetaTileEntityTreeFarm.registerTreeProducts( // Tree of Transformation - GT_ModHandler.getModItem(Mods.TwilightForest.ID, "tile.TFSapling", 1, 6), - GT_ModHandler.getModItem(Mods.TwilightForest.ID, "tile.TFMagicLog", 1, 1), - GT_ModHandler.getModItem(Mods.TwilightForest.ID, "tile.TFMagicLeaves", 1, 1), - null); - - GregtechMetaTileEntityTreeFarm.registerTreeProducts( // Sorting Tree - GT_ModHandler.getModItem(Mods.TwilightForest.ID, "tile.TFSapling", 1, 8), - GT_ModHandler.getModItem(Mods.TwilightForest.ID, "tile.TFMagicLog", 1, 3), - GT_ModHandler.getModItem(Mods.TwilightForest.ID, "tile.TFMagicLeaves", 1, 3), - null); - - GregtechMetaTileEntityTreeFarm.registerTreeProducts( // Rainbow Oak - GT_ModHandler.getModItem(Mods.TwilightForest.ID, "tile.TFSapling", 1, 9), - GT_ModHandler.getModItem(Mods.TwilightForest.ID, "tile.TFLog", 1, 0), - GT_ModHandler.getModItem(Mods.TwilightForest.ID, "tile.TFLeaves", 1, 3), - null); - - GregtechMetaTileEntityTreeFarm.registerTreeProducts( // Thorns - GT_ModHandler.getModItem(Mods.TwilightForest.ID, "tile.TFThorns", 1, 0), - GT_ModHandler.getModItem(Mods.TwilightForest.ID, "tile.TFThorns", 1, 0), - GT_ModHandler.getModItem(Mods.TwilightForest.ID, "tile.TFThorns", 1, 1), - GT_ModHandler.getModItem(Mods.TwilightForest.ID, "tile.TFLeaves3", 1, 0), - GT_ModHandler.getModItem(Mods.TwilightForest.ID, "tile.TFThornRose", 1, 0)); - - GregtechMetaTileEntityTreeFarm.registerTreeProducts( // Magic Beans - GT_ModHandler.getModItem(Mods.TwilightForest.ID, "item.magicBeans", 1, 0), - GT_ModHandler.getModItem(Mods.TwilightForest.ID, "tile.HugeStalk", 5, 0), - GT_ModHandler.getModItem(Mods.TwilightForest.ID, "tile.TFLeaves3", 1, 1), - null); - } - - private static void generateGalaxySpaceTrees() { - GregtechMetaTileEntityTreeFarm.registerTreeProducts( // Barnarda C - GT_ModHandler.getModItem(Mods.GalaxySpace.ID, "barnardaCsapling", 1, 1), - GT_ModHandler.getModItem(Mods.GalaxySpace.ID, "barnardaClog", 1, 0), - GT_ModHandler.getModItem(Mods.GalaxySpace.ID, "barnardaCleaves", 1, 0), - null); - } - - private static void generateAmunRaTrees() { - GregtechMetaTileEntityTreeFarm.registerTreeProducts( // Virilig - GT_ModHandler.getModItem(Mods.GalacticraftAmunRa.ID, "tile.saplings", 1, 0), - GT_ModHandler.getModItem(Mods.GalacticraftAmunRa.ID, "tile.log1", 1, 0), - GT_ModHandler.getModItem(Mods.GalacticraftAmunRa.ID, "tile.null", 1, 0), - null); - - GregtechMetaTileEntityTreeFarm.registerTreeProducts( // Lumipod - GT_ModHandler.getModItem(Mods.GalacticraftAmunRa.ID, "tile.saplings", 1, 1), - GT_ModHandler.getModItem(Mods.GalacticraftAmunRa.ID, "tile.wood1", 1, 0), - null, - GT_ModHandler.getModItem(Mods.GalacticraftAmunRa.ID, "tile.wood1", 1, 1)); - } - - private static void generateNaturaTrees() { - GregtechMetaTileEntityTreeFarm.registerTreeProducts( // Redwood - GT_ModHandler.getModItem(Mods.Natura.ID, "florasapling", 1, 0), - GT_ModHandler.getModItem(Mods.Natura.ID, "redwood", 5, 1), - GT_ModHandler.getModItem(Mods.Natura.ID, "florasapling", 2, 0), - GT_ModHandler.getModItem(Mods.Natura.ID, "floraleaves", 2, 0), - GT_ModHandler.getModItem(Mods.Natura.ID, "redwood", 2, 0)); - - GregtechMetaTileEntityTreeFarm.registerTreeProducts( // Eucalyptus - GT_ModHandler.getModItem(Mods.Natura.ID, "florasapling", 1, 1), - GT_ModHandler.getModItem(Mods.Natura.ID, "tree", 1, 0), - GT_ModHandler.getModItem(Mods.Natura.ID, "floraleaves", 1, 1), - null); - - GregtechMetaTileEntityTreeFarm.registerTreeProducts( // Hopseed - GT_ModHandler.getModItem(Mods.Natura.ID, "florasapling", 1, 2), - GT_ModHandler.getModItem(Mods.Natura.ID, "tree", 1, 3), - GT_ModHandler.getModItem(Mods.Natura.ID, "floraleaves", 1, 2), - null); - - GregtechMetaTileEntityTreeFarm.registerTreeProducts( // Sakura - GT_ModHandler.getModItem(Mods.Natura.ID, "florasapling", 1, 3), - GT_ModHandler.getModItem(Mods.Natura.ID, "tree", 1, 1), - GT_ModHandler.getModItem(Mods.Natura.ID, "floraleavesnocolor", 1, 0), - null); - - GregtechMetaTileEntityTreeFarm.registerTreeProducts( // Ghostwood - GT_ModHandler.getModItem(Mods.Natura.ID, "florasapling", 1, 4), - GT_ModHandler.getModItem(Mods.Natura.ID, "tree", 1, 2), - GT_ModHandler.getModItem(Mods.Natura.ID, "floraleavesnocolor", 1, 1), - null); - - GregtechMetaTileEntityTreeFarm.registerTreeProducts( // Blood - GT_ModHandler.getModItem(Mods.Natura.ID, "florasapling", 1, 5), - GT_ModHandler.getModItem(Mods.Natura.ID, "bloodwood", 1, 0), - GT_ModHandler.getModItem(Mods.Natura.ID, "floraleavesnocolor", 1, 2), - new ItemStack(Items.redstone, 1, 0)); - - GregtechMetaTileEntityTreeFarm.registerTreeProducts( // Darkwood - GT_ModHandler.getModItem(Mods.Natura.ID, "florasapling", 1, 6), - GT_ModHandler.getModItem(Mods.Natura.ID, "Dark Tree", 1, 0), - GT_ModHandler.getModItem(Mods.Natura.ID, "Dark Leaves", 1, 0), - GT_ModHandler.getModItem(Mods.Natura.ID, "Natura.netherfood", 1, 0)); - - GregtechMetaTileEntityTreeFarm.registerTreeProducts( // Fusewood - GT_ModHandler.getModItem(Mods.Natura.ID, "florasapling", 1, 7), - GT_ModHandler.getModItem(Mods.Natura.ID, "Dark Tree", 1, 1), - GT_ModHandler.getModItem(Mods.Natura.ID, "Dark Leaves", 1, 3), - null); - - GregtechMetaTileEntityTreeFarm.registerTreeProducts( // Maple - GT_ModHandler.getModItem(Mods.Natura.ID, "Rare Sapling", 1, 0), - GT_ModHandler.getModItem(Mods.Natura.ID, "Rare Tree", 1, 0), - GT_ModHandler.getModItem(Mods.Natura.ID, "Rare Leaves", 1, 0), - null); - - GregtechMetaTileEntityTreeFarm.registerTreeProducts( // Silverbell - GT_ModHandler.getModItem(Mods.Natura.ID, "Rare Sapling", 1, 1), - GT_ModHandler.getModItem(Mods.Natura.ID, "Rare Tree", 1, 1), - GT_ModHandler.getModItem(Mods.Natura.ID, "Rare Leaves", 1, 1), - null); - - GregtechMetaTileEntityTreeFarm.registerTreeProducts( // Amaranth - GT_ModHandler.getModItem(Mods.Natura.ID, "Rare Sapling", 1, 2), - GT_ModHandler.getModItem(Mods.Natura.ID, "Rare Tree", 1, 2), - GT_ModHandler.getModItem(Mods.Natura.ID, "Rare Leaves", 1, 2), - null); - - GregtechMetaTileEntityTreeFarm.registerTreeProducts( // Tigerwood - GT_ModHandler.getModItem(Mods.Natura.ID, "Rare Sapling", 1, 3), - GT_ModHandler.getModItem(Mods.Natura.ID, "Rare Tree", 1, 3), - GT_ModHandler.getModItem(Mods.Natura.ID, "Rare Leaves", 1, 3), - null); - - GregtechMetaTileEntityTreeFarm.registerTreeProducts( // Willow - GT_ModHandler.getModItem(Mods.Natura.ID, "Rare Sapling", 1, 4), - GT_ModHandler.getModItem(Mods.Natura.ID, "willow", 1, 0), - GT_ModHandler.getModItem(Mods.Natura.ID, "floraleavesnocolor", 1, 3), - null); - - GregtechMetaTileEntityTreeFarm.registerTreeProducts( // Green Glowshroom - GT_ModHandler.getModItem(Mods.Natura.ID, "Glowshroom", 1, 0), - GT_ModHandler.getModItem(Mods.Natura.ID, "greenGlowshroom", 1, 0), - null, - null); - - GregtechMetaTileEntityTreeFarm.registerTreeProducts( // Purple Glowshroom - GT_ModHandler.getModItem(Mods.Natura.ID, "Glowshroom", 1, 1), - GT_ModHandler.getModItem(Mods.Natura.ID, "purpleGlowshroom", 1, 0), - null, - null); - - GregtechMetaTileEntityTreeFarm.registerTreeProducts( // Blue Glowshroom - GT_ModHandler.getModItem(Mods.Natura.ID, "Glowshroom", 1, 2), - GT_ModHandler.getModItem(Mods.Natura.ID, "blueGlowshroom", 1, 0), - null, - null); - } - - private static void generateBOPTrees() { - GregtechMetaTileEntityTreeFarm.registerTreeProducts( // Apple - GT_ModHandler.getModItem(Mods.BiomesOPlenty.ID, "saplings", 1, 0), - new ItemStack(Blocks.log, 1, 0), - GT_ModHandler.getModItem(Mods.BiomesOPlenty.ID, "appleLeaves", 1, 0), - new ItemStack(Items.apple, 2, 0)); - - GregtechMetaTileEntityTreeFarm.registerTreeProducts( // Yellow Autumn - GT_ModHandler.getModItem(Mods.BiomesOPlenty.ID, "saplings", 1, 1), - new ItemStack(Blocks.log, 1, 2), - GT_ModHandler.getModItem(Mods.BiomesOPlenty.ID, "leaves1", 1, 0), - GT_ModHandler.getModItem(Mods.BiomesOPlenty.ID, "food", 1, 8)); - - GregtechMetaTileEntityTreeFarm.registerTreeProducts( // Bamboo - GT_ModHandler.getModItem(Mods.BiomesOPlenty.ID, "saplings", 1, 2), - GT_ModHandler.getModItem(Mods.BiomesOPlenty.ID, "bamboo", 1, 0), - GT_ModHandler.getModItem(Mods.BiomesOPlenty.ID, "leaves1", 1, 9), - null); - - GregtechMetaTileEntityTreeFarm.registerTreeProducts( // Magic - GT_ModHandler.getModItem(Mods.BiomesOPlenty.ID, "saplings", 1, 3), - GT_ModHandler.getModItem(Mods.BiomesOPlenty.ID, "logs2", 1, 1), - GT_ModHandler.getModItem(Mods.BiomesOPlenty.ID, "leaves1", 1, 2), - null); - - GregtechMetaTileEntityTreeFarm.registerTreeProducts( // Dark - GT_ModHandler.getModItem(Mods.BiomesOPlenty.ID, "saplings", 1, 4), - GT_ModHandler.getModItem(Mods.BiomesOPlenty.ID, "logs1", 1, 2), - GT_ModHandler.getModItem(Mods.BiomesOPlenty.ID, "leaves1", 1, 3), - null); - - GregtechMetaTileEntityTreeFarm.registerTreeProducts( // Dying - GT_ModHandler.getModItem(Mods.BiomesOPlenty.ID, "saplings", 1, 5), - new ItemStack(Blocks.log, 1, 0), - GT_ModHandler.getModItem(Mods.BiomesOPlenty.ID, "leaves2", 1, 0), - GT_ModHandler.getModItem(Mods.BiomesOPlenty.ID, "food", 1, 8)); - - GregtechMetaTileEntityTreeFarm.registerTreeProducts( // Fir - GT_ModHandler.getModItem(Mods.BiomesOPlenty.ID, "saplings", 1, 6), - GT_ModHandler.getModItem(Mods.BiomesOPlenty.ID, "logs1", 1, 3), - GT_ModHandler.getModItem(Mods.BiomesOPlenty.ID, "leaves2", 1, 1), - GT_ModHandler.getModItem(Mods.BiomesOPlenty.ID, "misc", 1, 13)); - - GregtechMetaTileEntityTreeFarm.registerTreeProducts( // Ethereal - GT_ModHandler.getModItem(Mods.BiomesOPlenty.ID, "saplings", 1, 7), - GT_ModHandler.getModItem(Mods.BiomesOPlenty.ID, "logs2", 1, 0), - GT_ModHandler.getModItem(Mods.BiomesOPlenty.ID, "leaves2", 1, 2), - null); - - GregtechMetaTileEntityTreeFarm.registerTreeProducts( // Orange Autumn - GT_ModHandler.getModItem(Mods.BiomesOPlenty.ID, "saplings", 1, 8), - new ItemStack(Blocks.log2, 1, 1), - GT_ModHandler.getModItem(Mods.BiomesOPlenty.ID, "leaves2", 1, 3), - null); - - GregtechMetaTileEntityTreeFarm.registerTreeProducts( // Origin - GT_ModHandler.getModItem(Mods.BiomesOPlenty.ID, "saplings", 1, 9), - new ItemStack(Blocks.log, 1, 0), - GT_ModHandler.getModItem(Mods.BiomesOPlenty.ID, "leaves3", 1, 0), - GT_ModHandler.getModItem(Mods.BiomesOPlenty.ID, "food", 1, 8)); - - GregtechMetaTileEntityTreeFarm.registerTreeProducts( // Pink Cherry - GT_ModHandler.getModItem(Mods.BiomesOPlenty.ID, "saplings", 1, 10), - GT_ModHandler.getModItem(Mods.BiomesOPlenty.ID, "logs1", 1, 1), - GT_ModHandler.getModItem(Mods.BiomesOPlenty.ID, "leaves3", 1, 1), - null); - - GregtechMetaTileEntityTreeFarm.registerTreeProducts( // Maple - GT_ModHandler.getModItem(Mods.BiomesOPlenty.ID, "saplings", 1, 11), - new ItemStack(Blocks.log, 1, 0), - GT_ModHandler.getModItem(Mods.BiomesOPlenty.ID, "leaves3", 1, 2), - null); - - GregtechMetaTileEntityTreeFarm.registerTreeProducts( // White Cherry - GT_ModHandler.getModItem(Mods.BiomesOPlenty.ID, "saplings", 1, 12), - GT_ModHandler.getModItem(Mods.BiomesOPlenty.ID, "logs1", 1, 1), - GT_ModHandler.getModItem(Mods.BiomesOPlenty.ID, "leaves3", 1, 3), - null); - - GregtechMetaTileEntityTreeFarm.registerTreeProducts( // Hellbark - GT_ModHandler.getModItem(Mods.BiomesOPlenty.ID, "saplings", 1, 13), - GT_ModHandler.getModItem(Mods.BiomesOPlenty.ID, "logs4", 1, 1), - GT_ModHandler.getModItem(Mods.BiomesOPlenty.ID, "leaves4", 1, 0), - GT_ModHandler.getModItem(Mods.BiomesOPlenty.ID, "food", 1, 8)); - - GregtechMetaTileEntityTreeFarm.registerTreeProducts( // Jacaranda - GT_ModHandler.getModItem(Mods.BiomesOPlenty.ID, "saplings", 1, 14), - GT_ModHandler.getModItem(Mods.BiomesOPlenty.ID, "logs4", 1, 2), - GT_ModHandler.getModItem(Mods.BiomesOPlenty.ID, "leaves4", 1, 1), - null); - - GregtechMetaTileEntityTreeFarm.registerTreeProducts( // Persimmon - GT_ModHandler.getModItem(Mods.BiomesOPlenty.ID, "saplings", 1, 15), - new ItemStack(Blocks.log, 1, 0), - GT_ModHandler.getModItem(Mods.BiomesOPlenty.ID, "persimmonLeaves", 1, 0), - GT_ModHandler.getModItem(Mods.BiomesOPlenty.ID, "food", 2, 8)); - - GregtechMetaTileEntityTreeFarm.registerTreeProducts( // Sacred Oak - GT_ModHandler.getModItem(Mods.BiomesOPlenty.ID, "colorizedSaplings", 1, 0), - GT_ModHandler.getModItem(Mods.BiomesOPlenty.ID, "logs1", 4, 0), - GT_ModHandler.getModItem(Mods.BiomesOPlenty.ID, "colorizedSaplings", 2, 0), - GT_ModHandler.getModItem(Mods.BiomesOPlenty.ID, "colorizedLeaves1", 2, 0), - null); - - GregtechMetaTileEntityTreeFarm.registerTreeProducts( // Mangrove - GT_ModHandler.getModItem(Mods.BiomesOPlenty.ID, "colorizedSaplings", 1, 1), - GT_ModHandler.getModItem(Mods.BiomesOPlenty.ID, "logs2", 1, 2), - GT_ModHandler.getModItem(Mods.BiomesOPlenty.ID, "colorizedLeaves1", 1, 1), - null); - - GregtechMetaTileEntityTreeFarm.registerTreeProducts( // Palm - GT_ModHandler.getModItem(Mods.BiomesOPlenty.ID, "colorizedSaplings", 1, 2), - GT_ModHandler.getModItem(Mods.BiomesOPlenty.ID, "logs2", 1, 3), - GT_ModHandler.getModItem(Mods.BiomesOPlenty.ID, "colorizedLeaves1", 1, 2), - null); - - GregtechMetaTileEntityTreeFarm.registerTreeProducts( // Redwood - GT_ModHandler.getModItem(Mods.BiomesOPlenty.ID, "colorizedSaplings", 1, 3), - GT_ModHandler.getModItem(Mods.BiomesOPlenty.ID, "logs3", 2, 0), - GT_ModHandler.getModItem(Mods.BiomesOPlenty.ID, "colorizedLeaves1", 1, 3), - null); - - GregtechMetaTileEntityTreeFarm.registerTreeProducts( // Willow - GT_ModHandler.getModItem(Mods.BiomesOPlenty.ID, "colorizedSaplings", 1, 4), - GT_ModHandler.getModItem(Mods.BiomesOPlenty.ID, "logs3", 1, 1), - GT_ModHandler.getModItem(Mods.BiomesOPlenty.ID, "colorizedLeaves2", 1, 0), - null); - - GregtechMetaTileEntityTreeFarm.registerTreeProducts( // Pine - GT_ModHandler.getModItem(Mods.BiomesOPlenty.ID, "colorizedSaplings", 1, 5), - GT_ModHandler.getModItem(Mods.BiomesOPlenty.ID, "logs4", 1, 0), - GT_ModHandler.getModItem(Mods.BiomesOPlenty.ID, "colorizedLeaves2", 1, 1), - null); - - GregtechMetaTileEntityTreeFarm.registerTreeProducts( // Mahogany - GT_ModHandler.getModItem(Mods.BiomesOPlenty.ID, "colorizedSaplings", 1, 6), - GT_ModHandler.getModItem(Mods.BiomesOPlenty.ID, "logs4", 1, 3), - GT_ModHandler.getModItem(Mods.BiomesOPlenty.ID, "colorizedLeaves2", 1, 2), - null); - - GregtechMetaTileEntityTreeFarm.registerTreeProducts( // Flowering Oak - GT_ModHandler.getModItem(Mods.BiomesOPlenty.ID, "colorizedSaplings", 1, 7), - new ItemStack(Blocks.log, 1, 0), - GT_ModHandler.getModItem(Mods.BiomesOPlenty.ID, "colorizedLeaves2", 1, 3), - null); - - GregtechMetaTileEntityTreeFarm.registerTreeProducts( // Red Flower Stem - new ItemStack(Blocks.red_flower, 1, 0), - GT_ModHandler.getModItem(Mods.BiomesOPlenty.ID, "logs3", 1, 3), - GT_ModHandler.getModItem(Mods.BiomesOPlenty.ID, "petals", 1, 0), - null); - - GregtechMetaTileEntityTreeFarm.registerTreeProducts( // Yellow Flower Stem - new ItemStack(Blocks.yellow_flower, 1, 0), - GT_ModHandler.getModItem(Mods.BiomesOPlenty.ID, "logs3", 1, 3), - GT_ModHandler.getModItem(Mods.BiomesOPlenty.ID, "petals", 1, 1), - null); - } - - private static void addPamTree(String name, int meta) { - GregtechMetaTileEntityTreeFarm.registerTreeProducts( - GT_ModHandler.getModItem(Mods.PamsHarvestCraft.ID, "pam" + name + "Sapling", 1, 0), - new ItemStack(Blocks.log, 1, meta), - new ItemStack(Blocks.leaves, 1, meta), - GT_ModHandler.getModItem(Mods.PamsHarvestCraft.ID, name + "Item", 2, 0)); - } - - private static void generatePamsTrees() { - GregtechMetaTileEntityTreeFarm.registerTreeProducts( // Cinnamon - GT_ModHandler.getModItem(Mods.PamsHarvestCraft.ID, "pamappleSapling", 1, 0), - new ItemStack(Blocks.log, 1, 0), - new ItemStack(Blocks.leaves, 1, 0), - new ItemStack(Items.apple, 2, 0)); - - addPamTree("almond", 3); - addPamTree("apricot", 3); - addPamTree("avocado", 0); - addPamTree("banana", 3); - addPamTree("cashew", 3); - addPamTree("cherry", 0); - addPamTree("chestnut", 0); - - GregtechMetaTileEntityTreeFarm.registerTreeProducts( // Cinnamon - GT_ModHandler.getModItem(Mods.PamsHarvestCraft.ID, "pamcinnamonSapling", 1, 0), - GT_ModHandler.getModItem(Mods.PamsHarvestCraft.ID, "pamCinnamon", 1, 0), - new ItemStack(Blocks.leaves, 1, 3), - GT_ModHandler.getModItem(Mods.PamsHarvestCraft.ID, "cinnamonItem", 2, 0)); - - addPamTree("coconut", 3); - addPamTree("date", 3); - addPamTree("dragonfruit", 3); - addPamTree("durian", 3); - addPamTree("fig", 3); - addPamTree("grapefruit", 3); - addPamTree("lemon", 3); - addPamTree("lime", 3); - - GregtechMetaTileEntityTreeFarm.registerTreeProducts( // Maple - GT_ModHandler.getModItem(Mods.PamsHarvestCraft.ID, "pammapleSapling", 1, 0), - GT_ModHandler.getModItem(Mods.PamsHarvestCraft.ID, "pamMaple", 1, 0), - new ItemStack(Blocks.leaves, 1, 1), - GT_ModHandler.getModItem(Mods.PamsHarvestCraft.ID, "maplesyrupItem", 2, 0)); - - addPamTree("mango", 3); - addPamTree("nutmeg", 0); - addPamTree("olive", 0); - addPamTree("orange", 3); - addPamTree("papaya", 3); - - GregtechMetaTileEntityTreeFarm.registerTreeProducts( // Paperbark - GT_ModHandler.getModItem(Mods.PamsHarvestCraft.ID, "pampaperbarkSapling", 1, 0), - GT_ModHandler.getModItem(Mods.PamsHarvestCraft.ID, "pamPaperbark", 1, 0), - new ItemStack(Blocks.leaves, 1, 3), - new ItemStack(Items.paper, 1, 0)); - - addPamTree("peach", 3); - addPamTree("pear", 0); - addPamTree("pecan", 3); - addPamTree("peppercorn", 3); - addPamTree("persimmon", 3); - addPamTree("pistachio", 3); - addPamTree("plum", 0); - addPamTree("pomegranate", 3); - addPamTree("starfruit", 3); - addPamTree("vanillabean", 3); - addPamTree("walnut", 0); - addPamTree("gooseberry", 0); - } - - private static void generatePamsNetherTrees() { - GregtechMetaTileEntityTreeFarm.registerTreeProducts( // Ignis Fruit - GT_ModHandler.getModItem(Mods.PamsHarvestTheNether.ID, "netherSapling", 1, 0), - GT_ModHandler.getModItem(Mods.PamsHarvestTheNether.ID, "netherLog", 1, 0), - GT_ModHandler.getModItem(Mods.PamsHarvestTheNether.ID, "netherLeaves", 1, 0), - GT_ModHandler.getModItem(Mods.PamsHarvestTheNether.ID, "ignisfruitItem", 2, 0)); - } - - private static void generateThaumcraftTrees() { - GregtechMetaTileEntityTreeFarm.registerTreeProducts( // Greatwood - GT_ModHandler.getModItem(Mods.Thaumcraft.ID, "blockCustomPlant", 1, 0), - GT_ModHandler.getModItem(Mods.Thaumcraft.ID, "blockMagicalLog", 2, 0), - GT_ModHandler.getModItem(Mods.Thaumcraft.ID, "blockMagicalLeaves", 1, 0), - null); - - GregtechMetaTileEntityTreeFarm.registerTreeProducts( // Silverwood - GT_ModHandler.getModItem(Mods.Thaumcraft.ID, "blockCustomPlant", 1, 1), - GT_ModHandler.getModItem(Mods.Thaumcraft.ID, "blockMagicalLog", 1, 1), - GT_ModHandler.getModItem(Mods.Thaumcraft.ID, "blockMagicalLeaves", 1, 1), - null); - } - - private static void generateThaumicBasesTrees() { - GregtechMetaTileEntityTreeFarm.registerTreeProducts( // Golden Oak - GT_ModHandler.getModItem(Mods.ThaumicBases.ID, "goldenOakSapling", 1, 0), - new ItemStack(Blocks.log, 1, 0), - GT_ModHandler.getModItem(Mods.ThaumicBases.ID, "genLeaves", 1, 0), - GT_ModHandler.getModItem(Mods.Thaumcraft.ID, "blockMagicalLeaves", 1, 0), - null); - - GregtechMetaTileEntityTreeFarm.registerTreeProducts( // Peaceful - GT_ModHandler.getModItem(Mods.ThaumicBases.ID, "goldenOakSapling", 1, 1), - GT_ModHandler.getModItem(Mods.ThaumicBases.ID, "genLogs", 1, 0), - GT_ModHandler.getModItem(Mods.ThaumicBases.ID, "genLeaves", 1, 1), - null); - - GregtechMetaTileEntityTreeFarm.registerTreeProducts( // Nether - GT_ModHandler.getModItem(Mods.ThaumicBases.ID, "goldenOakSapling", 1, 2), - GT_ModHandler.getModItem(Mods.ThaumicBases.ID, "genLogs", 1, 1), - GT_ModHandler.getModItem(Mods.ThaumicBases.ID, "genLeaves", 1, 2), - null); - - GregtechMetaTileEntityTreeFarm.registerTreeProducts( // Ender - GT_ModHandler.getModItem(Mods.ThaumicBases.ID, "goldenOakSapling", 1, 3), - GT_ModHandler.getModItem(Mods.ThaumicBases.ID, "genLogs", 1, 2), - GT_ModHandler.getModItem(Mods.ThaumicBases.ID, "genLeaves", 1, 3), - null); - } - - private static void generateTaintedMagicTrees() { - GregtechMetaTileEntityTreeFarm.registerTreeProducts( // Warpwood - GT_ModHandler.getModItem(Mods.TaintedMagic.ID, "BlockWarpwoodSapling", 1, 0), - GT_ModHandler.getModItem(Mods.TaintedMagic.ID, "BlockWarpwoodLog", 1, 0), - GT_ModHandler.getModItem(Mods.TaintedMagic.ID, "BlockWarpwoodLeaves", 1, 0), - null); - } - - private static void generateForbiddenMagicTrees() { - GregtechMetaTileEntityTreeFarm.registerTreeProducts( // Warpwood - GT_ModHandler.getModItem(Mods.ForbiddenMagic.ID, "TaintSapling", 1, 0), - GT_ModHandler.getModItem(Mods.ForbiddenMagic.ID, "TaintLog", 1, 0), - GT_ModHandler.getModItem(Mods.ForbiddenMagic.ID, "TaintLeaves", 1, 0), - GT_ModHandler.getModItem(Mods.ForbiddenMagic.ID, "TaintFruit", 1, 0)); - } - - private static void generateWitcheryTrees() { - GregtechMetaTileEntityTreeFarm.registerTreeProducts( // Rowan - GT_ModHandler.getModItem(Mods.Witchery.ID, "witchsapling", 1, 0), - GT_ModHandler.getModItem(Mods.Witchery.ID, "witchlog", 1, 0), - GT_ModHandler.getModItem(Mods.Witchery.ID, "witchleaves", 1, 0), - GT_ModHandler.getModItem(Mods.Witchery.ID, "ingredient", 1, 63)); - - GregtechMetaTileEntityTreeFarm.registerTreeProducts( // Alder - GT_ModHandler.getModItem(Mods.Witchery.ID, "witchsapling", 1, 1), - GT_ModHandler.getModItem(Mods.Witchery.ID, "witchlog", 1, 1), - GT_ModHandler.getModItem(Mods.Witchery.ID, "witchleaves", 1, 1), - null); - - GregtechMetaTileEntityTreeFarm.registerTreeProducts( // Hawthorn - GT_ModHandler.getModItem(Mods.Witchery.ID, "witchsapling", 1, 2), - GT_ModHandler.getModItem(Mods.Witchery.ID, "witchlog", 1, 2), - GT_ModHandler.getModItem(Mods.Witchery.ID, "witchleaves", 1, 2), - null); - } - - /* - * Abdiel Kavash: I do not claim the code in the following two methods to be ideal, or to even completely understand - * all the details. Much of it has been copied from the previous version, available at - * https://github.com/GTNewHorizons/GTplusplus/blob/dca836fee368878cf64ca59e4c7ffc5875a3f489/src/main/java/ - * gtPlusPlus/xmod/forestry/HANDLER_FR.java#L60. If anybody understands Forestry and/or Extra Trees internals better - * than I do, and knows a more straightforward way to retrieve the relevant ItemStacks here, please update this. - */ - - private static void generateForestryTrees() { - for (TreeDefinition tree : TreeDefinition.values()) { - String speciesUID = tree.getUID(); - - ItemStack sapling = tree.getMemberStack(EnumGermlingType.SAPLING); - - ItemStack log; - EnumWoodType woodType = ReflectionUtils.getField(tree, "woodType"); - if (woodType != null) { - log = TreeManager.woodItemAccess.getLog(woodType, false); - } else { - log = ReflectionUtils.getField(tree, "vanillaWood"); - } - - ItemStack leaves = new ItemStack(PluginArboriculture.blocks.leaves, 1, 0); - if (speciesUID != null) { - NBTTagCompound nbtTagCompound = new NBTTagCompound(); - nbtTagCompound.setString("species", speciesUID); - leaves.setTagCompound(nbtTagCompound); - } - - ItemStack fruit = null; - ITree individual = tree.getIndividual(); - if (individual.canBearFruit()) { - ItemStack[] produceList = individual.getProduceList(); - if (produceList != null && produceList.length > 0) { - fruit = individual.getProduceList()[0]; - } - } - - GregtechMetaTileEntityTreeFarm.registerForestryTree( - speciesUID, - sapling == null ? null : sapling.copy(), - log == null ? null : log.copy(), - leaves == null ? null : leaves.copy(), - fruit == null ? null : fruit.copy()); - } - } - - private static void generateExtraTreesTrees() { - for (ExtraTreeSpecies species : ExtraTreeSpecies.values()) { - - String speciesUID = species.getUID(); - - ITree individual = TreeManager.treeRoot.templateAsIndividual(species.getTemplate()); - ItemStack sapling = TreeManager.treeRoot.getMemberStack(individual, 0); - - ItemStack log = null; - if (species.getLog() != null) { - log = species.getLog() - .getItemStack(); - } - - ItemStack leaves = new ItemStack(PluginArboriculture.blocks.leaves, 1, 0); - if (speciesUID != null) { - NBTTagCompound nbtTagCompound = new NBTTagCompound(); - nbtTagCompound.setString("species", speciesUID); - leaves.setTagCompound(nbtTagCompound); - } - - ItemStack fruit = null; - if (individual.canBearFruit()) { - ItemStack[] produceList = individual.getProduceList(); - if (produceList != null && produceList.length > 0) { - fruit = individual.getProduceList()[0]; - } - } - - GregtechMetaTileEntityTreeFarm.registerForestryTree( - speciesUID, - sapling == null ? null : sapling.copy(), - log == null ? null : log.copy(), - leaves == null ? null : leaves.copy(), - fruit == null ? null : fruit.copy()); - } - } -} diff --git a/gtpp/src/main/java/gtPlusPlus/xmod/gregtech/recipes/GregtechRecipeAdder.java b/gtpp/src/main/java/gtPlusPlus/xmod/gregtech/recipes/GregtechRecipeAdder.java deleted file mode 100644 index 6b4a02e984..0000000000 --- a/gtpp/src/main/java/gtPlusPlus/xmod/gregtech/recipes/GregtechRecipeAdder.java +++ /dev/null @@ -1,1220 +0,0 @@ -package gtPlusPlus.xmod.gregtech.recipes; - -import static gregtech.api.enums.GT_Values.RA; - -import net.minecraft.item.ItemStack; -import net.minecraftforge.fluids.FluidStack; - -import gregtech.api.enums.GT_Values; -import gregtech.api.enums.Materials; -import gregtech.api.recipe.RecipeMaps; -import gregtech.api.util.GT_ModHandler; -import gregtech.api.util.GT_OreDictUnificator; -import gregtech.api.util.GT_Recipe; -import gregtech.api.util.GT_Utility; -import gregtech.api.util.SemiFluidFuelHandler; -import gtPlusPlus.api.objects.Logger; -import gtPlusPlus.api.objects.data.AutoMap; -import gtPlusPlus.api.recipe.GTPPRecipeMaps; -import gtPlusPlus.core.lib.CORE; -import gtPlusPlus.core.material.Material; -import gtPlusPlus.core.material.MaterialGenerator; -import gtPlusPlus.core.recipe.common.CI; -import gtPlusPlus.core.util.data.ArrayUtils; -import gtPlusPlus.core.util.minecraft.ItemUtils; -import gtPlusPlus.core.util.minecraft.MaterialUtils; -import gtPlusPlus.xmod.gregtech.api.enums.GregtechItemList; -import gtPlusPlus.xmod.gregtech.api.interfaces.internal.IGregtech_RecipeAdder; -import gtPlusPlus.xmod.gregtech.common.helpers.FlotationRecipeHandler; - -public class GregtechRecipeAdder implements IGregtech_RecipeAdder { - - @Override - public boolean addCokeOvenRecipe(final ItemStack aInput1, final ItemStack aInput2, final FluidStack aFluidInput, - final FluidStack aFluidOutput, final ItemStack aOutput, int aDuration, final int aEUt) { - if (aInput1 == null || (aOutput == null && aFluidOutput == null)) { - Logger.WARNING("Something was null, returning false"); - return false; - } - if (aOutput != null && (aDuration <= 0)) { - Logger.WARNING("Something was null, returning false"); - return false; - } - if (aFluidOutput != null && (aDuration <= 0)) { - Logger.WARNING("Something was null, returning false"); - return false; - } - - GT_Recipe aSpecialRecipe = new GT_Recipe( - true, - new ItemStack[] { aInput1, aInput2 }, - new ItemStack[] { aOutput }, - null, - new int[] {}, - new FluidStack[] { aFluidInput }, - new FluidStack[] { aFluidOutput }, - aDuration, - Math.max(1, aEUt), - 0); - GTPPRecipeMaps.cokeOvenRecipes.add(aSpecialRecipe); - return true; - } - - @Override - public boolean addCokeOvenRecipe(int aCircuit, ItemStack aInput2, FluidStack[] aFluidInputs, - FluidStack[] aFluidOutputs, ItemStack[] aOutputs, int aDuration, int aEUt) { - return addCokeOvenRecipe( - aInput2, - CI.getNumberedCircuit(aCircuit), - aFluidInputs, - aFluidOutputs, - aOutputs, - aDuration, - aEUt); - } - - @Override - public boolean addCokeOvenRecipe(ItemStack aInput1, ItemStack aInput2, FluidStack[] aFluidInputs, - FluidStack[] aFluidOutputs, ItemStack[] aOutputs, int aDuration, int aEUt) { - GT_Recipe aSpecialRecipe = new GT_Recipe( - true, - new ItemStack[] { aInput1, aInput2 }, - aOutputs, - null, - new int[] {}, - aFluidInputs, - aFluidOutputs, - Math.max(1, aDuration), - Math.max(1, aEUt), - 0); - GTPPRecipeMaps.cokeOvenRecipes.add(aSpecialRecipe); - return true; - } - - @Override - public boolean addMatterFabricatorRecipe(final FluidStack aFluidInput, final FluidStack aFluidOutput, - final int aDuration, final int aEUt) { - if (aFluidOutput == null) { - Logger.WARNING("Something was null, returning false"); - return false; - } - GT_Recipe aRecipe = new GT_Recipe( - false, - new ItemStack[] {}, - new ItemStack[] {}, - null, - new int[] {}, - aFluidInput == null ? new FluidStack[] {} : new FluidStack[] { aFluidInput }, - new FluidStack[] { aFluidOutput }, - aDuration, - aEUt, - 0); - GTPPRecipeMaps.multiblockMassFabricatorRecipes.addRecipe(aRecipe); - return true; - } - - @Override - public boolean addDehydratorRecipe(final ItemStack[] aInput, final FluidStack aFluidInput, - final FluidStack aFluidOutput, final ItemStack[] aOutputItems, final int[] aChances, int aDuration, - final int aEUt) throws IndexOutOfBoundsException { - if (((aInput == null || aInput.length == 0) && (aFluidInput == null)) - || ((aOutputItems == null || aOutputItems.length == 0) && (aFluidOutput == null))) { - return false; - } - - GT_Recipe aSpecialRecipe = new GT_Recipe( - true, - aInput, - aOutputItems, - null, - aChances, - new FluidStack[] { aFluidInput }, - new FluidStack[] { aFluidOutput }, - Math.max(1, aDuration), - Math.max(1, aEUt), - 0); - GTPPRecipeMaps.chemicalDehydratorRecipes.add(aSpecialRecipe); - return true; - } - - @Override - public boolean addBlastSmelterRecipe(final ItemStack[] aInput, FluidStack aOutput, final int aChance, int aDuration, - final int aEUt) { - return addBlastSmelterRecipe( - aInput, - (FluidStack) null, - aOutput, - new ItemStack[] {}, - new int[] { aChance }, - aDuration, - aEUt, - 3700); - } - - @Override - public boolean addBlastSmelterRecipe(final ItemStack[] aInput, FluidStack aInputFluid, FluidStack aOutput, - final int aChance, int aDuration, final int aEUt) { - return addBlastSmelterRecipe( - aInput, - aInputFluid, - aOutput, - new ItemStack[] {}, - new int[] { aChance }, - aDuration, - aEUt, - 3700); - } - - @Override - public boolean addBlastSmelterRecipe(final ItemStack[] aInput, FluidStack[] aInputFluid, FluidStack aOutput, - final int aChance, int aDuration, final int aEUt) { - return addBlastSmelterRecipe( - aInput, - aInputFluid, - aOutput, - new ItemStack[] {}, - new int[] { aChance }, - aDuration, - aEUt, - 3700); - } - - @Override - public boolean addBlastSmelterRecipe(final ItemStack[] aInput, FluidStack aInputFluid, FluidStack aOutput, - ItemStack[] aOutputStack, final int[] aChance, int aDuration, final int aEUt) { - return addBlastSmelterRecipe(aInput, aInputFluid, aOutput, aOutputStack, aChance, aDuration, aEUt, 3700); - } - - @Override - public boolean addBlastSmelterRecipe(final ItemStack[] aInput, FluidStack[] aInputFluid, FluidStack aOutput, - ItemStack[] aOutputStack, final int[] aChance, int aDuration, final int aEUt) { - return addBlastSmelterRecipe(aInput, aInputFluid, aOutput, aOutputStack, aChance, aDuration, aEUt, 3700); - } - - @Override - public boolean addBlastSmelterRecipe(ItemStack[] aInput, FluidStack aInputFluid, FluidStack aOutput, int aChance, - int aDuration, int aEUt, int aSpecialValue) { - return addBlastSmelterRecipe( - aInput, - aInputFluid, - aOutput, - new ItemStack[] {}, - new int[] { aChance }, - aDuration, - aEUt, - aSpecialValue); - } - - @Override - public boolean addBlastSmelterRecipe(ItemStack[] aInput, FluidStack[] aInputFluid, FluidStack aOutput, int aChance, - int aDuration, int aEUt, int aSpecialValue) { - return addBlastSmelterRecipe( - aInput, - aInputFluid, - aOutput, - new ItemStack[] {}, - new int[] { aChance }, - aDuration, - aEUt, - aSpecialValue); - } - - @Override - public boolean addBlastSmelterRecipe(ItemStack[] aInput, FluidStack aInputFluid, FluidStack aOutput, - ItemStack[] aOutputStack, int[] aChance, int aDuration, int aEUt, int aSpecialValue) { - return addBlastSmelterRecipe( - aInput, - aInputFluid, - aOutput, - aOutputStack, - aChance, - aDuration, - aEUt, - aSpecialValue, - true); - } - - @Override - public boolean addBlastSmelterRecipe(ItemStack[] aInput, FluidStack[] aInputFluid, FluidStack aOutput, - ItemStack[] aOutputStack, int[] aChance, int aDuration, int aEUt, int aSpecialValue) { - return addBlastSmelterRecipe( - aInput, - aInputFluid, - aOutput, - aOutputStack, - aChance, - aDuration, - aEUt, - aSpecialValue, - true); - } - - @Override - public boolean addBlastSmelterRecipe(ItemStack[] aInput, FluidStack aInputFluid, FluidStack aOutput, - ItemStack[] aOutputStack, int[] aChance, int aDuration, int aEUt, int aSpecialValue, boolean aOptimizeRecipe) { - return addBlastSmelterRecipe( - aInput, - new FluidStack[] { aInputFluid }, - aOutput, - aOutputStack, - aChance, - aDuration, - aEUt, - aSpecialValue, - aOptimizeRecipe); - } - - @Override - public boolean addBlastSmelterRecipe(ItemStack[] aInput, FluidStack[] aInputFluid, FluidStack aOutput, - ItemStack[] aOutputStack, int[] aChance, int aDuration, int aEUt, int aSpecialValue, boolean aOptimizeRecipe) { - if ((aInput == null) || (aOutput == null)) { - Logger.WARNING("Fail - Input or Output was null."); - return false; - } - - if (aOutput.isFluidEqual(Materials.PhasedGold.getMolten(1))) { - aOutput = Materials.VibrantAlloy.getMolten(aOutput.amount); - } - if (aOutput.isFluidEqual(Materials.PhasedIron.getMolten(1))) { - aOutput = Materials.PulsatingIron.getMolten(aOutput.amount); - } - if (aDuration <= 0) { - Logger.WARNING("Recipe did not register."); - return false; - } - - aInput = ArrayUtils.removeNulls(aInput); - if (aInput.length <= 1) { - return false; - } - - GTPPRecipeMaps.alloyBlastSmelterRecipes.addRecipe( - aOptimizeRecipe, - aInput, - aOutputStack, - null, - aChance, - aInputFluid, - new FluidStack[] { aOutput }, - aDuration, - Math.max(1, aEUt), - aSpecialValue); - return true; - } - - @Override - public boolean addQuantumTransformerRecipe(ItemStack[] aInput, FluidStack[] aFluidInput, FluidStack[] aFluidOutput, - ItemStack[] aOutputStack, int[] aChances, int aDuration, int aEUt, int aSpecialValue) { - if (aInput == null) { - aInput = new ItemStack[0]; - } - if (aFluidInput == null) { - aFluidInput = new FluidStack[0]; - } - if (aOutputStack == null) { - aOutputStack = new ItemStack[0]; - } - if (aFluidOutput == null) { - aFluidOutput = new FluidStack[0]; - } - - GTPPRecipeMaps.quantumForceTransformerRecipes.add( - new GT_Recipe( - false, - aInput, - aOutputStack, - null, - aChances, - aFluidInput, - aFluidOutput, - aDuration, - aEUt, - aSpecialValue)); - return true; - } - - @Override - public boolean addFissionFuel(final FluidStack aInput1, final FluidStack aInput2, final FluidStack aInput3, - final FluidStack aInput4, final FluidStack aInput5, final FluidStack aInput6, final FluidStack aInput7, - final FluidStack aInput8, final FluidStack aInput9, final FluidStack aOutput1, final FluidStack aOutput2, - final int aDuration, final int aEUt) { - return addFissionFuel( - false, - aInput1, - aInput2, - aInput3, - aInput4, - aInput5, - aInput6, - aInput7, - aInput8, - aInput9, - aOutput1, - aOutput2, - aDuration, - aEUt); - } - - @Override - public boolean addFissionFuel(final boolean aOptimise, final FluidStack aInput1, final FluidStack aInput2, - final FluidStack aInput3, final FluidStack aInput4, final FluidStack aInput5, final FluidStack aInput6, - final FluidStack aInput7, final FluidStack aInput8, final FluidStack aInput9, final FluidStack aOutput1, - final FluidStack aOutput2, final int aDuration, final int aEUt) { - if ((aInput1 == null) || (aOutput1 == null) || (aDuration < 1) || (aEUt < 1)) { - return false; - } - final FluidStack[] inputs = { aInput1, aInput2, aInput3, aInput4, aInput5, aInput6, aInput7, aInput8, aInput9 }; - final FluidStack[] outputs = { aOutput1, aOutput2 }; - - GTPPRecipeMaps.fissionFuelProcessingRecipes.addRecipe( - aOptimise, - new ItemStack[] {}, - new ItemStack[] {}, - null, - new int[] {}, - inputs, - outputs, - aDuration, - aEUt, - 0); - return true; - } - - @Override - public boolean addCyclotronRecipe(ItemStack aInputs, FluidStack aFluidInput, ItemStack[] aOutputs, - FluidStack aFluidOutput, int[] aChances, int aDuration, int aEUt, int aSpecialValue) { - return addCyclotronRecipe( - new ItemStack[] { aInputs }, - aFluidInput, - aOutputs, - aFluidOutput, - aChances, - aDuration, - aEUt, - aSpecialValue); - } - - @Override - public boolean addCyclotronRecipe(ItemStack[] aInputs, FluidStack aFluidInput, ItemStack[] aOutput, - FluidStack aFluidOutput, int[] aChances, int aDuration, int aEUt, int aSpecialValue) { - if (aOutput == null || aOutput.length < 1 || !ItemUtils.checkForInvalidItems(aOutput)) { - Logger.INFO("Bad output for Cyclotron Recipe."); - return false; - } - - GT_Recipe aSpecialRecipe = new GT_Recipe( - true, - aInputs, - aOutput, - null, - aChances, - new FluidStack[] { aFluidInput }, - new FluidStack[] { aFluidOutput }, - Math.max(1, aDuration), - Math.max(1, aEUt), - aSpecialValue); - GTPPRecipeMaps.cyclotronRecipes.add(aSpecialRecipe); - return true; - } - - @Override - public boolean addMixerRecipe(ItemStack aInput1, ItemStack aInput2, ItemStack aInput3, ItemStack aInput4, - FluidStack aFluidInput, FluidStack aFluidOutput, ItemStack aOutput1, ItemStack aOutput2, ItemStack aOutput3, - ItemStack aOutput4, int aDuration, int aEUt) { - if ((aInput1 == null && aFluidInput == null) || (aOutput1 == null && aFluidOutput == null)) { - return false; - } - - GT_Recipe aSpecialRecipe = new GT_Recipe( - true, - new ItemStack[] { aInput1, aInput2, aInput3, aInput4 }, - new ItemStack[] { aOutput1, aOutput2, aOutput3, aOutput4 }, - null, - new int[] {}, - new FluidStack[] { aFluidInput }, - new FluidStack[] { aFluidOutput }, - Math.max(1, aDuration), - Math.max(1, aEUt), - 0); - RecipeMaps.mixerRecipes.add(aSpecialRecipe); - return true; - } - - @Override - public boolean addMultiblockCentrifugeRecipe(ItemStack[] aInputs, FluidStack[] aFluidInputs, - FluidStack[] aFluidOutputs, ItemStack[] aOutputs, int[] aChances, int aDuration, int aEUtick, int aSpecial) { - if (areItemsAndFluidsBothNull(aInputs, aFluidInputs) || areItemsAndFluidsBothNull(aOutputs, aFluidOutputs) - || aEUtick <= 0) { - return false; - } - - if (!ItemUtils.checkForInvalidItems(aInputs, aOutputs)) { - Logger.INFO("[Recipe] Error generating Large Centrifuge recipe."); - Logger.INFO("Inputs: " + ItemUtils.getArrayStackNames(aInputs)); - Logger.INFO("Fluid Inputs: " + ItemUtils.getArrayStackNames(aFluidInputs)); - Logger.INFO("Outputs: " + ItemUtils.getArrayStackNames(aOutputs)); - Logger.INFO("Fluid Outputs: " + ItemUtils.getArrayStackNames(aFluidOutputs)); - return false; - } - - GT_Recipe aRecipe = new GT_Recipe( - false, - aInputs, - aOutputs, - null, - aChances, - aFluidInputs, - aFluidOutputs, - aDuration, - aEUtick, - aSpecial); - GTPPRecipeMaps.centrifugeNonCellRecipes.addRecipe(aRecipe); - return true; - } - - @Override - public boolean addMultiblockElectrolyzerRecipe(ItemStack[] aInputs, FluidStack[] aFluidInputs, - FluidStack[] aFluidOutputs, ItemStack[] aOutputs, int[] aChances, int aDuration, int aEUtick, int aSpecial) { - if (areItemsAndFluidsBothNull(aInputs, aFluidInputs) || areItemsAndFluidsBothNull(aOutputs, aFluidOutputs) - || aEUtick <= 0) { - return false; - } - if (!ItemUtils.checkForInvalidItems(aInputs, aOutputs)) { - Logger.INFO("[Recipe] Error generating Large Electrolyzer recipe."); - Logger.INFO("Inputs: " + ItemUtils.getArrayStackNames(aInputs)); - Logger.INFO("Fluid Inputs: " + ItemUtils.getArrayStackNames(aFluidInputs)); - Logger.INFO("Outputs: " + ItemUtils.getArrayStackNames(aOutputs)); - Logger.INFO("Fluid Outputs: " + ItemUtils.getArrayStackNames(aFluidOutputs)); - return false; - } - - GT_Recipe aRecipe = new GT_Recipe( - false, - aInputs, - aOutputs, - null, - aChances, - aFluidInputs, - aFluidOutputs, - aDuration, - aEUtick, - aSpecial); - GTPPRecipeMaps.electrolyzerNonCellRecipes.addRecipe(aRecipe); - return true; - } - - @Override - public boolean addAdvancedFreezerRecipe(ItemStack[] aInputs, FluidStack[] aFluidInputs, FluidStack[] aFluidOutputs, - ItemStack[] aOutputs, int[] aChances, int aDuration, int aEUtick, int aSpecial) { - if (areItemsAndFluidsBothNull(aInputs, aFluidInputs) || areItemsAndFluidsBothNull(aOutputs, aFluidOutputs) - || aEUtick <= 0) { - return false; - } - - if (!ItemUtils.checkForInvalidItems(aInputs, aOutputs)) { - Logger.INFO("[Recipe] Error generating Adv. Vac Freezer recipe."); - Logger.INFO("Inputs: " + ItemUtils.getArrayStackNames(aInputs)); - Logger.INFO("Fluid Inputs: " + ItemUtils.getArrayStackNames(aFluidInputs)); - Logger.INFO("Outputs: " + ItemUtils.getArrayStackNames(aOutputs)); - Logger.INFO("Fluid Outputs: " + ItemUtils.getArrayStackNames(aFluidOutputs)); - return false; - } - - GT_Recipe aRecipe = new GT_Recipe( - false, - aInputs, - aOutputs, - null, - aChances, - aFluidInputs, - aFluidOutputs, - aDuration, - aEUtick, - aSpecial); - GTPPRecipeMaps.advancedFreezerRecipes.addRecipe(aRecipe); - return false; - } - - public boolean addMultiblockMixerRecipe(ItemStack[] aInputs, FluidStack[] aFluidInputs, FluidStack[] aFluidOutputs, - ItemStack[] aOutputs, int[] aChances, int aDuration, int aEUtick, int aSpecial) { - if (areItemsAndFluidsBothNull(aInputs, aFluidInputs) || areItemsAndFluidsBothNull(aOutputs, aFluidOutputs) - || aEUtick <= 0) { - return false; - } - if (!ItemUtils.checkForInvalidItems(aInputs, aOutputs)) { - Logger.INFO("[Recipe] Error generating Large Mixer recipe."); - Logger.INFO("Inputs: " + ItemUtils.getArrayStackNames(aInputs)); - Logger.INFO("Fluid Inputs: " + ItemUtils.getArrayStackNames(aFluidInputs)); - Logger.INFO("Outputs: " + ItemUtils.getArrayStackNames(aOutputs)); - Logger.INFO("Fluid Outputs: " + ItemUtils.getArrayStackNames(aFluidOutputs)); - return false; - } - - GT_Recipe aRecipe = new GT_Recipe( - false, - aInputs, - aOutputs, - null, - aChances, - aFluidInputs, - aFluidOutputs, - aDuration, - aEUtick, - aSpecial); - GTPPRecipeMaps.mixerNonCellRecipes.addRecipe(aRecipe); - return true; - } - - public boolean addMultiblockChemicalDehydratorRecipe(ItemStack[] aInputs, FluidStack[] aFluidInputs, - FluidStack[] aFluidOutputs, ItemStack[] aOutputs, int[] aChances, int aDuration, int aEUtick, int aSpecial) { - if (areItemsAndFluidsBothNull(aInputs, aFluidInputs) || areItemsAndFluidsBothNull(aOutputs, aFluidOutputs) - || aEUtick <= 0) { - return false; - } - if (!ItemUtils.checkForInvalidItems(aInputs, aOutputs)) { - Logger.INFO("[Recipe] Error generating Large Chemical Dehydrator recipe."); - Logger.INFO("Inputs: " + ItemUtils.getArrayStackNames(aInputs)); - Logger.INFO("Fluid Inputs: " + ItemUtils.getArrayStackNames(aFluidInputs)); - Logger.INFO("Outputs: " + ItemUtils.getArrayStackNames(aOutputs)); - Logger.INFO("Fluid Outputs: " + ItemUtils.getArrayStackNames(aFluidOutputs)); - return false; - } - - GT_Recipe aRecipe = new GT_Recipe( - false, - aInputs, - aOutputs, - null, - aChances, - aFluidInputs, - aFluidOutputs, - aDuration, - aEUtick, - aSpecial); - GTPPRecipeMaps.chemicalDehydratorNonCellRecipes.addRecipe(aRecipe); - return true; - } - - @Override - public boolean addSixSlotAssemblingRecipe(ItemStack[] aInputs, FluidStack aInputFluid, ItemStack aOutput1, - int aDuration, int aEUt) { - return RA.addAssemblerRecipe(aInputs, aInputFluid, aOutput1, aDuration, aEUt); - } - - @Override - public boolean addAssemblylineRecipe(ItemStack aResearchItem, int aResearchTime, ItemStack[] aInputs, - FluidStack[] aFluidInputs, ItemStack aOutput, int aDuration, int aEUt) { - return RA.addAssemblylineRecipe(aResearchItem, aResearchTime, aInputs, aFluidInputs, aOutput, aDuration, aEUt); - } - - @Override - public boolean addAssemblylineRecipe(ItemStack aResearchItem, int aResearchTime, Object[] aInputs, - FluidStack[] aFluidInputs, ItemStack aOutput, int aDuration, int aEUt) { - return RA.addAssemblylineRecipe(aResearchItem, aResearchTime, aInputs, aFluidInputs, aOutput, aDuration, aEUt); - } - - @Override - public boolean addChemicalRecipe(ItemStack input1, ItemStack input2, FluidStack inputFluid, FluidStack outputFluid, - ItemStack output, int time, int eu) { - return addChemicalRecipe(input1, input2, inputFluid, outputFluid, output, null, time, eu); - } - - @Override - public boolean addChemicalRecipe(ItemStack input1, ItemStack input2, FluidStack inputFluid, FluidStack outputFluid, - ItemStack output, Object object, int time, int eu) { - return RA.addChemicalRecipe(input1, input2, inputFluid, outputFluid, output, time, eu); - } - - @Override - public boolean addChemicalRecipe(ItemStack input1, ItemStack input2, FluidStack inputFluid, FluidStack outputFluid, - ItemStack output, ItemStack output2, int time) { - return RA.addChemicalRecipe(input1, input2, inputFluid, outputFluid, output, output2, time); - } - - @Override - public boolean addChemicalRecipe(ItemStack input1, ItemStack input2, int aCircuit, FluidStack inputFluid, - FluidStack outputFluid, ItemStack output, ItemStack output2, int time, int eu) { - if (aCircuit < 0 || aCircuit > 24) { - aCircuit = 22; - } - GT_Recipe aSpecialRecipe = new GT_Recipe( - false, - new ItemStack[] { input1, input2 }, - new ItemStack[] { output, output2 }, - CI.getNumberedCircuit(aCircuit), - new int[] {}, - new FluidStack[] { inputFluid }, - new FluidStack[] { outputFluid }, - time, - eu, - 0); - RecipeMaps.chemicalReactorRecipes.add(aSpecialRecipe); - return true; - } - - @Override - public boolean addMultiblockChemicalRecipe(ItemStack[] itemStacks, FluidStack[] fluidStacks, - FluidStack[] fluidStacks2, ItemStack[] outputs, int time, int eu) { - return RA.addMultiblockChemicalRecipe(itemStacks, fluidStacks, fluidStacks2, outputs, time, eu); - } - - private boolean areItemsAndFluidsBothNull(final ItemStack[] items, final FluidStack[] fluids) { - boolean itemsNull = true; - if (items != null) { - for (final ItemStack itemStack : items) { - if (itemStack != null) { - itemsNull = false; - break; - } - } - } - boolean fluidsNull = true; - if (fluids != null) { - for (final FluidStack fluidStack : fluids) { - if (fluidStack != null) { - fluidsNull = false; - break; - } - } - } - return itemsNull && fluidsNull; - } - - @Override - public boolean addCompressorRecipe(ItemStack aInput1, ItemStack aOutput1, int aDuration, int aEUt) { - if ((aInput1 == null) || (aOutput1 == null)) { - return false; - } - if (aDuration <= 0) { - return false; - } - RecipeMaps.compressorRecipes.addRecipe( - true, - new ItemStack[] { aInput1 }, - new ItemStack[] { aOutput1 }, - null, - null, - null, - aDuration, - aEUt, - 0); - return true; - } - - @Override - public boolean addBrewingRecipe(int aCircuit, FluidStack aInput, FluidStack aOutput, int aTime, int aEu, - boolean aHidden) { - return addBrewingRecipe(CI.getNumberedCircuit(aCircuit), aInput, aOutput, aTime, aEu, aHidden); - } - - @Override - public boolean addBrewingRecipe(ItemStack aIngredient, FluidStack aInput, FluidStack aOutput, int aTime, int aEu, - boolean aHidden) { - if (aIngredient == null || aInput == null || aOutput == null) { - return false; - } - GT_Recipe tRecipe = RecipeMaps.brewingRecipes.addRecipe( - false, - new ItemStack[] { aIngredient }, - null, - null, - new FluidStack[] { aInput }, - new FluidStack[] { aOutput }, - aTime, - aEu, - 0); - if (aHidden && tRecipe != null) { - tRecipe.mHidden = true; - } - return true; - } - - /** - * Lets me add recipes for GT 5.08 & 5.09, since someone broke the method headers. - */ - @Override - public boolean addSmeltingAndAlloySmeltingRecipe(ItemStack aDust, ItemStack aOutput) { - return GT_ModHandler.addSmeltingAndAlloySmeltingRecipe(aDust, aOutput, true); - } - - @Override - public boolean addFluidExtractionRecipe(ItemStack input, FluidStack output, int aTime, int aEu) { - return RA.addFluidSmelterRecipe(GT_Utility.copyAmount(1, input), null, output, 10000, aTime, aEu, false); - } - - @Override - public boolean addFluidExtractionRecipe(ItemStack aEmpty, ItemStack aRemains, FluidStack aFluid, int aDuration, - int aEU) { - return RA - .addFluidSmelterRecipe(GT_Utility.copyAmount(1, aEmpty), aRemains, aFluid, 10000, aDuration, aEU, false); - } - - @Override - public boolean addFluidCannerRecipe(ItemStack aContainer, ItemStack aFullContainer, FluidStack rFluidIn) { - return MaterialGenerator.addFluidCannerRecipe(aContainer, aFullContainer, rFluidIn, null); - } - - @Override - public boolean addFluidCannerRecipe(ItemStack aContainer, ItemStack aFullContainer, FluidStack rFluidIn, - FluidStack rFluidOut) { - return MaterialGenerator.addFluidCannerRecipe(aContainer, aFullContainer, rFluidIn, rFluidOut); - } - - @Override - public boolean addFluidCannerRecipe(ItemStack aFullContainer, ItemStack container, FluidStack rFluidIn, - FluidStack rFluidOut, int aTime, int aEu) { - return MaterialGenerator.addFluidCannerRecipe(container, aFullContainer, rFluidIn, rFluidOut, aTime, aEu); - } - - @Override - public boolean addSemifluidFuel(ItemStack aFuelItem, int aFuelValue) { - return SemiFluidFuelHandler.addSemiFluidFuel(aFuelItem, aFuelValue); - } - - @Override - public boolean addSemifluidFuel(FluidStack aFuelItem, int aFuelValue) { - return SemiFluidFuelHandler.addSemiFluidFuel(aFuelItem, aFuelValue); - } - - @Override - public boolean addVacuumFurnaceRecipe(ItemStack aInput1, ItemStack aInput2, FluidStack aFluidInput, - FluidStack aFluidOutput, ItemStack aOutput1, ItemStack aOutput2, int aDuration, int aEUt, int aLevel) { - if (aInput1 != null && aOutput1 != null) { - return addVacuumFurnaceRecipe( - new ItemStack[] { aInput1, aInput2 }, - new FluidStack[] { aFluidInput }, - new ItemStack[] { aOutput1, aOutput2 }, - new FluidStack[] { aFluidOutput }, - aDuration, - aEUt, - aLevel); - } else { - return false; - } - } - - @Override - public boolean addVacuumFurnaceRecipe(ItemStack[] aInputs, FluidStack[] aFluidInputs, ItemStack[] aOutputs, - FluidStack[] aFluidOutputs, int aDuration, int aEUt, int aLevel) { - if (aInputs != null && aOutputs != null) { - GTPPRecipeMaps.vacuumFurnaceRecipes.addRecipe( - false, - aInputs, - aOutputs, - null, - new int[] {}, - aFluidInputs, - aFluidOutputs, - aDuration, - aEUt, - aLevel); - return true; - } else { - return false; - } - } - - @Override - public boolean addUvLaserRecipe(ItemStack aInput1, ItemStack aOutput, int time, long eu) { - // Generate Special Laser Recipe - GT_Recipe u = new GT_Recipe( - false, - new ItemStack[] { aInput1, GregtechItemList.Laser_Lens_WoodsGlass.get(0), }, - new ItemStack[] { aOutput }, - null, - new int[] { 10000 }, - new FluidStack[] {}, - new FluidStack[] {}, - time, - (int) eu, - 0); - RecipeMaps.laserEngraverRecipes.add(u); - return true; - } - - @Override - public boolean addChemicalPlantRecipe(ItemStack[] aInputs, FluidStack[] aInputFluids, ItemStack[] aOutputs, - FluidStack[] aFluidOutputs, int time, long eu, int aTier) { - return addChemicalPlantRecipe(aInputs, aInputFluids, aOutputs, aFluidOutputs, new int[] {}, time, eu, aTier); - } - - @Override - public boolean addChemicalPlantRecipe(ItemStack[] aInputs, FluidStack[] aInputFluids, ItemStack[] aOutputs, - FluidStack[] aFluidOutputs, int[] aChances, int time, long eu, int aTier) { - if (aInputs.length > 4 || aInputFluids.length > 4 || aOutputs.length > 6 || aFluidOutputs.length > 3) { - Logger.INFO("Inputs: " + ItemUtils.getArrayStackNames(aInputs)); - Logger.INFO("Fluid Inputs: " + ItemUtils.getArrayStackNames(aInputFluids)); - Logger.INFO("Outputs: " + ItemUtils.getArrayStackNames(aOutputs)); - Logger.INFO("Fluid Outputs: " + ItemUtils.getArrayStackNames(aFluidOutputs)); - CORE.crash(); - } - - GTPPRecipeMaps.chemicalPlantRecipes - .addRecipe(false, aInputs, aOutputs, null, aChances, aInputFluids, aFluidOutputs, time, (int) eu, aTier); - return true; - } - - @Override - public boolean addBlastRecipe(ItemStack[] aInputs, FluidStack[] aInputFluids, ItemStack[] aOutputs, - FluidStack[] aFluidOutputs, int time, long eu, int aHeat) { - GT_Recipe aSpecialRecipe = new GT_Recipe( - false, - aInputs, - aOutputs, - null, - new int[] {}, - aInputFluids, - aFluidOutputs, - time, - (int) eu, - aHeat); - - RecipeMaps.blastFurnaceRecipes.add(aSpecialRecipe); - return true; - } - - @Override - public boolean addPyrolyseRecipe(ItemStack aInput, FluidStack aFluidInput, int intCircuit, ItemStack aOutput, - FluidStack aFluidOutput, int aDuration, int aEUt) { - return RA.addPyrolyseRecipe(aInput, aFluidInput, intCircuit, aOutput, aFluidOutput, aDuration, aEUt); - } - - @Override - public boolean addDistilleryRecipe(ItemStack aCircuit, FluidStack aInput, FluidStack aOutput, - ItemStack aSolidOutput, int aDuration, int aEUt, boolean aHidden) { - if (aInput != null && aOutput != null) { - if (aDuration <= 0) { - return false; - } else { - GT_Recipe tRecipe = RecipeMaps.distilleryRecipes.addRecipe( - true, - new ItemStack[] { aCircuit }, - new ItemStack[] { aSolidOutput }, - null, - new FluidStack[] { aInput }, - new FluidStack[] { aOutput }, - aDuration, - aEUt, - 0); - if (aHidden && tRecipe != null) { - tRecipe.mHidden = true; - } - return true; - } - } else { - return false; - } - } - - @Override - public boolean addExtractorRecipe(ItemStack aInput, ItemStack aOutput, int aDuration, int aEUt) { - return addExtractorRecipe(aInput, aOutput, 10000, aDuration, aEUt); - } - - @Override - public boolean addExtractorRecipe(ItemStack aInput, ItemStack aOutput, int aChance, int aDuration, int aEUt) { - if (aInput != null && aOutput != null) { - GT_Recipe aRecipe = new GT_Recipe( - false, - new ItemStack[] { aInput.copy() }, - new ItemStack[] { aOutput.copy() }, - null, - new int[] { aChance }, - null, - null, - aDuration, - aEUt, - 0); - RecipeMaps.extractorRecipes.add(aRecipe); - return true; - } else { - return false; - } - } - - @Override - public boolean addPulverisationRecipe(ItemStack aInput, ItemStack aOutput1, ItemStack aOutput2, - ItemStack aOutput3) { - aOutput1 = GT_OreDictUnificator.get(true, aOutput1); - aOutput2 = GT_OreDictUnificator.get(true, aOutput2); - aOutput3 = GT_OreDictUnificator.get(true, aOutput3); - if (GT_Utility.isStackInvalid(aInput) || GT_Utility.isStackInvalid(aOutput1)) { - return false; - } - if (GT_Utility.getContainerItem(aInput, false) == null) { - - GT_Utility.addSimpleIC2MachineRecipe(aInput, GT_ModHandler.getMaceratorRecipeList(), null, aOutput1); - - GT_Values.RA.addPulveriserRecipe( - aInput, - new ItemStack[] { aOutput1, aOutput2, aOutput3 }, - new int[] { 10000, 10000, 10000 }, - 400, - 2); - } - return true; - } - - @Override - public boolean addMillingRecipe(Materials aMat, int aEU) { - return addMillingRecipe(MaterialUtils.generateMaterialFromGtENUM(aMat), aEU); - } - - @Override - public boolean addMillingRecipe(Material aMat, int aEU) { - - ItemStack aOreStack = aMat.getOre(16); - ItemStack aCrushedStack = aMat.getCrushed(16); - - ItemStack aMilledStackOres1 = aMat.getMilled(64); - ItemStack aMilledStackCrushed1 = aMat.getMilled(32); - ItemStack aMilledStackOres2 = aMat.getMilled(48); - ItemStack aMilledStackCrushed2 = aMat.getMilled(16); - - ItemStack aMillingBall_Alumina = GregtechItemList.Milling_Ball_Alumina.get(0); - ItemStack aMillingBall_Soapstone = GregtechItemList.Milling_Ball_Soapstone.get(0); - - // Inputs - ItemStack[] aInputsOre1 = new ItemStack[] { CI.getNumberedCircuit(10), aOreStack, aMillingBall_Alumina }; - - ItemStack[] aInputsOre2 = new ItemStack[] { CI.getNumberedCircuit(11), aOreStack, aMillingBall_Soapstone }; - - ItemStack[] aInputsCrushed1 = new ItemStack[] { CI.getNumberedCircuit(10), aCrushedStack, - aMillingBall_Alumina }; - - ItemStack[] aInputsCrushed2 = new ItemStack[] { CI.getNumberedCircuit(11), aCrushedStack, - aMillingBall_Soapstone }; - - // Outputs - ItemStack[] aOutputsOre1 = new ItemStack[] { aMilledStackOres1 }; - - ItemStack[] aOutputsOre2 = new ItemStack[] { aMilledStackOres2 }; - - ItemStack[] aOutputsCrushed1 = new ItemStack[] { aMilledStackCrushed1 }; - - ItemStack[] aOutputsCrushed2 = new ItemStack[] { aMilledStackCrushed2 }; - - ItemStack[][] aInputArray = new ItemStack[][] { aInputsOre1, aInputsOre2, aInputsCrushed1, aInputsCrushed2 }; - ItemStack[][] aOutputArray = new ItemStack[][] { aOutputsOre1, aOutputsOre2, aOutputsCrushed1, - aOutputsCrushed2 }; - int[] aTime = new int[] { 2400, 3000, 1200, 1500 }; - - for (int i = 0; i < 4; i++) { - GT_Recipe aOreRecipe = new GT_Recipe( - false, - aInputArray[i], - aOutputArray[i], - null, - new int[] {}, - null, - null, - aTime[i], - aEU, - 0); - GTPPRecipeMaps.millingRecipes.add(aOreRecipe); - } - return true; - } - - @Override - public boolean addFlotationRecipe(Materials aMat, ItemStack aXanthate, FluidStack[] aInputFluids, - FluidStack[] aOutputFluids, int aTime, int aEU) { - return addFlotationRecipe( - MaterialUtils.generateMaterialFromGtENUM(aMat), - aXanthate, - aInputFluids, - aOutputFluids, - aTime, - aEU); - } - - @Override - public boolean addFlotationRecipe(Material aMat, ItemStack aXanthate, FluidStack[] aInputFluids, - FluidStack[] aOutputFluids, int aTime, int aEU) { - - FlotationRecipeHandler.registerOreType(aMat); - - GT_Recipe aRecipe = new GT_Recipe( - false, - new ItemStack[] { ItemUtils.getSimpleStack(aXanthate, 32), aMat.getMilled(64), aMat.getMilled(64), - aMat.getMilled(64), aMat.getMilled(64), }, - new ItemStack[] {}, - null, - new int[] {}, - aInputFluids, - aOutputFluids, - aTime, - aEU, - 0); - GTPPRecipeMaps.flotationCellRecipes.add(aRecipe); - return true; - } - - @Override - public boolean addpackagerRecipe(ItemStack aRecipeType, ItemStack aSmallDust, ItemStack aTinyDust, - ItemStack aOutputStack1) { - AutoMap<Boolean> aResults = new AutoMap<>(); - // Dust 1 - aResults.put( - GT_Values.RA.addBoxingRecipe(GT_Utility.copyAmount(4L, aSmallDust), aRecipeType, aOutputStack1, 100, 4)); - // Dust 2 - aResults.put( - GT_Values.RA.addBoxingRecipe(GT_Utility.copyAmount(9L, aTinyDust), aRecipeType, aOutputStack1, 100, 4)); - for (boolean b : aResults) { - if (!b) { - return false; - } - } - return true; - } - - @Override - public boolean addFuelForRTG(ItemStack aFuelPellet, int aFuelDays, int aVoltage) { - GTPPRecipeMaps.rtgFuels.addRecipe( - true, - new ItemStack[] { aFuelPellet }, - new ItemStack[] {}, - null, - null, - null, - 0, - aVoltage, - aFuelDays); - return true; - } - - @Override - public boolean addColdTrapRecipe(int aCircuit, ItemStack aInput, FluidStack aFluidInput, ItemStack[] aOutputs, - int[] aChances, FluidStack aFluidOutput, int aTime, int aEU) { - GT_Recipe aRecipe = new GT_Recipe( - false, - new ItemStack[] { CI.getNumberedAdvancedCircuit(aCircuit), aInput }, - aOutputs, - null, - aChances, - new FluidStack[] { aFluidInput }, - new FluidStack[] { aFluidOutput }, - aTime, - aEU, - 0); - - GTPPRecipeMaps.coldTrapRecipes.add(aRecipe); - return true; - } - - @Override - public boolean addReactorProcessingUnitRecipe(ItemStack aInput1, ItemStack aInput2, FluidStack aFluidInput, - ItemStack[] aOutputs, int[] aChances, FluidStack aFluidOutput, int aTime, int aEU) { - GT_Recipe aRecipe = new GT_Recipe( - false, - new ItemStack[] { aInput1, aInput2 }, - aOutputs, - null, - aChances, - new FluidStack[] { aFluidInput }, - new FluidStack[] { aFluidOutput }, - aTime, - aEU, - 0); - - GTPPRecipeMaps.reactorProcessingUnitRecipes.add(aRecipe); - return true; - } - - public boolean addNuclearSaltProcessingPlantRecipe(ItemStack[] aInputs, FluidStack[] aFluidInputs, - FluidStack[] aFluidOutputs, ItemStack[] aOutputs, int[] aChances, int aDuration, int aEUtick, int aSpecial) { - if (areItemsAndFluidsBothNull(aInputs, aFluidInputs) || areItemsAndFluidsBothNull(aOutputs, aFluidOutputs) - || aEUtick <= 0) { - return false; - } - if (!ItemUtils.checkForInvalidItems(aInputs, aOutputs)) { - Logger.INFO("[Recipe] Error generating Salt Plant recipe."); - Logger.INFO("Inputs: " + ItemUtils.getArrayStackNames(aInputs)); - Logger.INFO("Fluid Inputs: " + ItemUtils.getArrayStackNames(aFluidInputs)); - Logger.INFO("Outputs: " + ItemUtils.getArrayStackNames(aOutputs)); - Logger.INFO("Fluid Outputs: " + ItemUtils.getArrayStackNames(aFluidOutputs)); - return false; - } - - GT_Recipe aRecipe = new GT_Recipe( - false, - aInputs, - aOutputs, - null, - aChances, - aFluidInputs, - aFluidOutputs, - aDuration, - aEUtick, - aSpecial); - GTPPRecipeMaps.nuclearSaltProcessingPlantRecipes.addRecipe(aRecipe); - return true; - } - - @Override - public boolean addFluidHeaterRecipe(ItemStack aInput, FluidStack aFluidInput, FluidStack aOutput, int aDuration, - int aEUt) { - if ((aInput == null && aFluidInput == null) || aOutput == null) { - return false; - } - RecipeMaps.fluidHeaterRecipes.addRecipe( - true, - new ItemStack[] { aInput }, - null, - null, - new FluidStack[] { aFluidInput }, - new FluidStack[] { aOutput }, - aDuration, - aEUt, - 0); - return true; - } - - @Override - public boolean addVacuumFreezerRecipe(ItemStack aInput, ItemStack aOutput, int aDuration, int aEUt) { - if (aInput == null || aOutput == null) { - return false; - } - GT_Recipe aRecipe = new GT_Recipe( - false, - new ItemStack[] { aInput }, - new ItemStack[] { aOutput }, - null, - new int[] { 10000 }, - new FluidStack[] {}, - new FluidStack[] {}, - aDuration, - aEUt, - 0); - - RecipeMaps.vacuumFreezerRecipes.add(aRecipe); - return true; - } - - @Override - public boolean addMolecularTransformerRecipe(ItemStack aInput, ItemStack aOutput, int aDuration, int aEUt) { - if (aInput == null || aOutput == null) { - return false; - } - GT_Recipe aRecipe = new GT_Recipe( - false, - new ItemStack[] { aInput }, - new ItemStack[] { aOutput }, - null, - new int[] { 10000 }, - new FluidStack[] {}, - new FluidStack[] {}, - aDuration, - aEUt, - 0); - - GTPPRecipeMaps.molecularTransformerRecipes.add(aRecipe); - return true; - } - - @Override - public boolean addMolecularTransformerRecipe(ItemStack aInput, ItemStack aOutput, int aDuration, int aEUt, - int aAmps) { - return addMolecularTransformerRecipe(aInput, aOutput, aDuration, aEUt); - } -} diff --git a/gtpp/src/main/java/gtPlusPlus/xmod/gregtech/registration/gregtech/Gregtech4Content.java b/gtpp/src/main/java/gtPlusPlus/xmod/gregtech/registration/gregtech/Gregtech4Content.java deleted file mode 100644 index d08b010e97..0000000000 --- a/gtpp/src/main/java/gtPlusPlus/xmod/gregtech/registration/gregtech/Gregtech4Content.java +++ /dev/null @@ -1,95 +0,0 @@ -package gtPlusPlus.xmod.gregtech.registration.gregtech; - -import gregtech.api.GregTech_API; -import gtPlusPlus.api.objects.Logger; -import gtPlusPlus.core.lib.CORE; -import gtPlusPlus.xmod.gregtech.api.enums.GregtechItemList; -import gtPlusPlus.xmod.gregtech.common.tileentities.automation.GT_MetaTileEntity_ElectricAutoWorkbench; -import gtPlusPlus.xmod.gregtech.common.tileentities.automation.GT_MetaTileEntity_TesseractGenerator; -import gtPlusPlus.xmod.gregtech.common.tileentities.automation.GT_MetaTileEntity_TesseractTerminal; -import gtPlusPlus.xmod.gregtech.common.tileentities.machines.basic.GT_MetaTileEntity_CropHarvestor; -import gtPlusPlus.xmod.gregtech.common.tileentities.machines.multi.production.GT4Entity_AutoCrafter; -import gtPlusPlus.xmod.gregtech.common.tileentities.machines.multi.production.GT4Entity_ThermalBoiler; - -public class Gregtech4Content { - - // ID Range 828, 829, 833 - 850 - - public static void run() { - Logger.INFO("Max MTE: " + GregTech_API.METATILEENTITIES.length + " | " + GregTech_API.MAXIMUM_METATILE_IDS); - thermalBoiler(); - multiCrafter(); - tesseracts(); - basic(); - automation(); - } - - private static void automation() { - Logger.INFO("Gregtech 4 Content | Registering Auto Workbenches."); - GregtechItemList.GT4_Electric_Auto_Workbench_LV - .set(new GT_MetaTileEntity_ElectricAutoWorkbench(31091, 1, "Automatic crafting machine").getStackForm(1L)); - GregtechItemList.GT4_Electric_Auto_Workbench_MV - .set(new GT_MetaTileEntity_ElectricAutoWorkbench(31092, 2, "Automatic crafting machine").getStackForm(1L)); - GregtechItemList.GT4_Electric_Auto_Workbench_HV - .set(new GT_MetaTileEntity_ElectricAutoWorkbench(31093, 3, "Automatic crafting machine").getStackForm(1L)); - GregtechItemList.GT4_Electric_Auto_Workbench_EV - .set(new GT_MetaTileEntity_ElectricAutoWorkbench(31094, 4, "Automatic crafting machine").getStackForm(1L)); - GregtechItemList.GT4_Electric_Auto_Workbench_IV - .set(new GT_MetaTileEntity_ElectricAutoWorkbench(31095, 5, "Automatic crafting machine").getStackForm(1L)); - GregtechItemList.GT4_Electric_Auto_Workbench_LuV - .set(new GT_MetaTileEntity_ElectricAutoWorkbench(31096, 6, "Automatic crafting machine").getStackForm(1L)); - GregtechItemList.GT4_Electric_Auto_Workbench_ZPM - .set(new GT_MetaTileEntity_ElectricAutoWorkbench(31097, 7, "Automatic crafting machine").getStackForm(1L)); - GregtechItemList.GT4_Electric_Auto_Workbench_UV - .set(new GT_MetaTileEntity_ElectricAutoWorkbench(31098, 8, "Automatic crafting machine").getStackForm(1L)); - - } - - private static void basic() { - Logger.INFO("Gregtech 4 Content | Registering Crop Managers."); - GregtechItemList.GT4_Crop_Harvester_LV.set( - new GT_MetaTileEntity_CropHarvestor(31111, 1, "Harvests the Cropsticks in front of it").getStackForm(1L)); - GregtechItemList.GT4_Crop_Harvester_MV.set( - new GT_MetaTileEntity_CropHarvestor(31112, 2, "Harvests the Cropsticks in front of it").getStackForm(1L)); - GregtechItemList.GT4_Crop_Harvester_HV.set( - new GT_MetaTileEntity_CropHarvestor(31113, 3, "Harvests the Cropsticks in front of it").getStackForm(1L)); - GregtechItemList.GT4_Crop_Harvester_EV.set( - new GT_MetaTileEntity_CropHarvestor(31114, 4, "Harvests the Cropsticks in front of it").getStackForm(1L)); - GregtechItemList.GT4_Crop_Harvester_IV.set( - new GT_MetaTileEntity_CropHarvestor(31115, 5, "Harvests the Cropsticks in front of it").getStackForm(1L)); - GregtechItemList.GT4_Crop_Harvester_LuV.set( - new GT_MetaTileEntity_CropHarvestor(31116, 6, "Harvests the Cropsticks in front of it").getStackForm(1L)); - GregtechItemList.GT4_Crop_Harvester_ZPM.set( - new GT_MetaTileEntity_CropHarvestor(31117, 7, "Harvests the Cropsticks in front of it").getStackForm(1L)); - GregtechItemList.GT4_Crop_Harvester_UV.set( - new GT_MetaTileEntity_CropHarvestor(31118, 8, "Harvests the Cropsticks in front of it").getStackForm(1L)); - } - - private static void tesseracts() { - // Gregtech 4 Tesseracts - Logger.INFO("Gregtech 4 Content | Registering Tesseracts."); - GregtechItemList.GT4_Tesseract_Generator.set( - new GT_MetaTileEntity_TesseractGenerator(833, "tesseract.generator", "Tesseract Generator", 4) - .getStackForm(1L)); - GregtechItemList.GT4_Tesseract_Terminal.set( - new GT_MetaTileEntity_TesseractTerminal(834, "tesseract.terminal", "Tesseract Terminal", 4) - .getStackForm(1L)); - } - - private static void thermalBoiler() { - // Gregtech 4 Thermal Boiler - if (CORE.ConfigSwitches.enableMultiblock_ThermalBoiler) { - Logger.INFO("Gregtech 4 Content | Registering Thermal Boiler."); - GregtechItemList.GT4_Thermal_Boiler - .set(new GT4Entity_ThermalBoiler(875, "gtplusplus.thermal.boiler", "Thermal Boiler").getStackForm(1L)); - } - } - - private static void multiCrafter() { - // Gregtech 4 Multiblock Auto-Crafter - Logger.INFO("Gregtech 4 Content | Registering Multiblock Crafter."); - GregtechItemList.GT4_Multi_Crafter.set( - new GT4Entity_AutoCrafter(876, "gtplusplus.autocrafter.multi", "Large Scale Auto-Assembler v1.01") - .getStackForm(1L)); - } -} diff --git a/gtpp/src/main/java/gtPlusPlus/xmod/gregtech/registration/gregtech/GregtechAdvancedBoilers.java b/gtpp/src/main/java/gtPlusPlus/xmod/gregtech/registration/gregtech/GregtechAdvancedBoilers.java deleted file mode 100644 index e77e2b1c54..0000000000 --- a/gtpp/src/main/java/gtPlusPlus/xmod/gregtech/registration/gregtech/GregtechAdvancedBoilers.java +++ /dev/null @@ -1,109 +0,0 @@ -package gtPlusPlus.xmod.gregtech.registration.gregtech; - -import net.minecraft.item.ItemStack; - -import gregtech.api.enums.ItemList; -import gregtech.api.enums.Materials; -import gregtech.api.enums.OrePrefixes; -import gregtech.api.util.GT_ModHandler; -import gtPlusPlus.api.objects.Logger; -import gtPlusPlus.core.material.ALLOY; -import gtPlusPlus.core.recipe.RECIPES_MachineComponents; -import gtPlusPlus.core.util.minecraft.ItemUtils; -import gtPlusPlus.xmod.gregtech.api.enums.GregtechItemList; -import gtPlusPlus.xmod.gregtech.common.tileentities.generators.GT_MetaTileEntity_Boiler_HV; -import gtPlusPlus.xmod.gregtech.common.tileentities.generators.GT_MetaTileEntity_Boiler_LV; -import gtPlusPlus.xmod.gregtech.common.tileentities.generators.GT_MetaTileEntity_Boiler_MV; - -public class GregtechAdvancedBoilers { - - public static void run() { - Logger.INFO("Gregtech5u Content | Registering Advanced Boilers."); - run1(); - } - - private static void run1() { - // Boilers - GregtechItemList.Boiler_Advanced_LV - .set(new GT_MetaTileEntity_Boiler_LV(753, "Advanced Boiler [LV]", 1).getStackForm(1L)); - GregtechItemList.Boiler_Advanced_MV - .set(new GT_MetaTileEntity_Boiler_MV(754, "Advanced Boiler [MV]", 2).getStackForm(1L)); - GregtechItemList.Boiler_Advanced_HV - .set(new GT_MetaTileEntity_Boiler_HV(755, "Advanced Boiler [HV]", 3).getStackForm(1L)); - - ItemStack chassisT1 = ItemUtils - .getItemStackWithMeta(true, "miscutils:itemBoilerChassis", "Boiler_Chassis_T1", 0, 1); - ItemStack chassisT2 = ItemUtils - .getItemStackWithMeta(true, "miscutils:itemBoilerChassis", "Boiler_Chassis_T1", 1, 1); - ItemStack chassisT3 = ItemUtils - .getItemStackWithMeta(true, "miscutils:itemBoilerChassis", "Boiler_Chassis_T1", 2, 1); - - // Make the Coil in each following recipe a hammer and a Screwdriver. - - // Chassis Recipes - GT_ModHandler.addCraftingRecipe( - chassisT1, - GT_ModHandler.RecipeBits.DISMANTLEABLE | GT_ModHandler.RecipeBits.NOT_REMOVABLE - | GT_ModHandler.RecipeBits.REVERSIBLE - | GT_ModHandler.RecipeBits.BUFFERED, - new Object[] { "WCW", "GMG", "WPW", Character.valueOf('M'), ItemList.Hull_ULV, Character.valueOf('P'), - OrePrefixes.pipeLarge.get(Materials.Bronze), Character.valueOf('C'), - OrePrefixes.circuit.get(Materials.Primitive), Character.valueOf('W'), - OrePrefixes.plate.get(Materials.Lead), Character.valueOf('G'), - OrePrefixes.pipeSmall.get(Materials.Copper) }); - - GT_ModHandler.addCraftingRecipe( - chassisT2, - GT_ModHandler.RecipeBits.DISMANTLEABLE | GT_ModHandler.RecipeBits.NOT_REMOVABLE - | GT_ModHandler.RecipeBits.REVERSIBLE - | GT_ModHandler.RecipeBits.BUFFERED, - new Object[] { "WCW", "GMG", "WPW", Character.valueOf('M'), ItemList.Hull_LV, Character.valueOf('P'), - OrePrefixes.pipeLarge.get(Materials.Steel), Character.valueOf('C'), - OrePrefixes.circuit.get(Materials.Basic), Character.valueOf('W'), - OrePrefixes.plate.get(Materials.Steel), Character.valueOf('G'), - OrePrefixes.pipeSmall.get(Materials.Bronze) }); - - GT_ModHandler.addCraftingRecipe( - chassisT3, - GT_ModHandler.RecipeBits.DISMANTLEABLE | GT_ModHandler.RecipeBits.NOT_REMOVABLE - | GT_ModHandler.RecipeBits.REVERSIBLE - | GT_ModHandler.RecipeBits.BUFFERED, - new Object[] { "WCW", "GMG", "WPW", Character.valueOf('M'), ItemList.Hull_MV, Character.valueOf('P'), - OrePrefixes.pipeLarge.get(Materials.StainlessSteel), Character.valueOf('C'), - OrePrefixes.circuit.get(Materials.Good), Character.valueOf('W'), - OrePrefixes.plate.get(Materials.Aluminium), Character.valueOf('G'), - OrePrefixes.pipeSmall.get(Materials.Steel) }); - - ItemStack pipeTier1 = ItemUtils.getItemStackOfAmountFromOreDict(RECIPES_MachineComponents.pipeTier7, 1); - ItemStack pipeTier2 = ItemUtils.getItemStackOfAmountFromOreDict(RECIPES_MachineComponents.pipeTier8, 1); - ItemStack pipeTier3 = ItemUtils.getItemStackOfAmountFromOreDict(RECIPES_MachineComponents.pipeTier9, 1); - - // Boiler Recipes - GT_ModHandler.addCraftingRecipe( - GregtechItemList.Boiler_Advanced_LV.get(1L, new Object[0]), - GT_ModHandler.RecipeBits.DISMANTLEABLE | GT_ModHandler.RecipeBits.NOT_REMOVABLE - | GT_ModHandler.RecipeBits.REVERSIBLE - | GT_ModHandler.RecipeBits.BUFFERED, - new Object[] { "dCw", "WMW", "GPG", Character.valueOf('M'), ItemList.Hull_LV, Character.valueOf('P'), - pipeTier1, Character.valueOf('C'), OrePrefixes.circuit.get(Materials.Basic), Character.valueOf('W'), - chassisT1, Character.valueOf('G'), OrePrefixes.gear.get(Materials.Steel) }); - - GT_ModHandler.addCraftingRecipe( - GregtechItemList.Boiler_Advanced_MV.get(1L, new Object[0]), - GT_ModHandler.RecipeBits.DISMANTLEABLE | GT_ModHandler.RecipeBits.NOT_REMOVABLE - | GT_ModHandler.RecipeBits.REVERSIBLE - | GT_ModHandler.RecipeBits.BUFFERED, - new Object[] { "dCw", "WMW", "GPG", Character.valueOf('M'), ItemList.Hull_MV, Character.valueOf('P'), - pipeTier2, Character.valueOf('C'), OrePrefixes.circuit.get(Materials.Good), Character.valueOf('W'), - chassisT2, Character.valueOf('G'), ALLOY.SILICON_CARBIDE.getGear(1) }); - - GT_ModHandler.addCraftingRecipe( - GregtechItemList.Boiler_Advanced_HV.get(1L, new Object[0]), - GT_ModHandler.RecipeBits.DISMANTLEABLE | GT_ModHandler.RecipeBits.NOT_REMOVABLE - | GT_ModHandler.RecipeBits.REVERSIBLE - | GT_ModHandler.RecipeBits.BUFFERED, - new Object[] { "dCw", "WMW", "GPG", Character.valueOf('M'), ItemList.Hull_HV, Character.valueOf('P'), - pipeTier3, Character.valueOf('C'), OrePrefixes.circuit.get(Materials.Advanced), Character.valueOf('W'), - chassisT3, Character.valueOf('G'), ALLOY.SILICON_CARBIDE.getGear(1) }); - } -} diff --git a/gtpp/src/main/java/gtPlusPlus/xmod/gregtech/registration/gregtech/GregtechAlgaeContent.java b/gtpp/src/main/java/gtPlusPlus/xmod/gregtech/registration/gregtech/GregtechAlgaeContent.java deleted file mode 100644 index 3c244739f6..0000000000 --- a/gtpp/src/main/java/gtPlusPlus/xmod/gregtech/registration/gregtech/GregtechAlgaeContent.java +++ /dev/null @@ -1,50 +0,0 @@ -package gtPlusPlus.xmod.gregtech.registration.gregtech; - -import gregtech.api.GregTech_API; -import gtPlusPlus.api.objects.Logger; -import gtPlusPlus.core.block.ModBlocks; -import gtPlusPlus.xmod.gregtech.api.enums.GregtechItemList; -import gtPlusPlus.xmod.gregtech.api.metatileentity.implementations.nbthandlers.GT_MetaTileEntity_Hatch_Catalysts; -import gtPlusPlus.xmod.gregtech.common.tileentities.machines.multi.production.algae.GregtechMTE_AlgaePondBase; -import gtPlusPlus.xmod.gregtech.common.tileentities.machines.multi.production.chemplant.GregtechMTE_ChemicalPlant; - -public class GregtechAlgaeContent { - - public static void run() { - Logger.INFO("Gregtech5u Content | Registering Algae Content."); - run1(); - } - - private static void run1() { - - // Algae Pond - GregtechItemList.AlgaeFarm_Controller - .set(new GregtechMTE_AlgaePondBase(997, "algaefarm.controller.tier.single", "Algae Farm").getStackForm(1L)); - - // Chemical Plant - GregtechItemList.ChemicalPlant_Controller.set( - new GregtechMTE_ChemicalPlant(998, "chemicalplant.controller.tier.single", "ExxonMobil Chemical Plant") - .getStackForm(1L)); - - GregtechItemList.Bus_Catalysts.set( - (new GT_MetaTileEntity_Hatch_Catalysts(31030, "hatch.catalysts", "Catalyst Housing")).getStackForm(1L)); - - int aTier = 0; - // Bronze - GregtechMTE_ChemicalPlant.registerMachineCasingForTier(aTier++, ModBlocks.blockCustomMachineCasings, 0, 10); - // Steel - GregtechMTE_ChemicalPlant.registerMachineCasingForTier(aTier++, GregTech_API.sBlockCasings2, 0, 16); - // Aluminium - GregtechMTE_ChemicalPlant.registerMachineCasingForTier(aTier++, ModBlocks.blockCustomMachineCasings, 1, 17); - // Stainless - GregtechMTE_ChemicalPlant.registerMachineCasingForTier(aTier++, GregTech_API.sBlockCasings4, 1, 49); - // Titanium - GregtechMTE_ChemicalPlant.registerMachineCasingForTier(aTier++, GregTech_API.sBlockCasings4, 2, 50); - // Tungsten - GregtechMTE_ChemicalPlant.registerMachineCasingForTier(aTier++, GregTech_API.sBlockCasings4, 0, 48); - // Laurenium - GregtechMTE_ChemicalPlant.registerMachineCasingForTier(aTier++, ModBlocks.blockCustomMachineCasings, 2, 84); - // Botmium - GregtechMTE_ChemicalPlant.registerMachineCasingForTier(aTier++, ModBlocks.blockCustomMachineCasings, 3, 11); - } -} diff --git a/gtpp/src/main/java/gtPlusPlus/xmod/gregtech/registration/gregtech/GregtechAmazonWarehouse.java b/gtpp/src/main/java/gtPlusPlus/xmod/gregtech/registration/gregtech/GregtechAmazonWarehouse.java deleted file mode 100644 index 8fc84177ca..0000000000 --- a/gtpp/src/main/java/gtPlusPlus/xmod/gregtech/registration/gregtech/GregtechAmazonWarehouse.java +++ /dev/null @@ -1,20 +0,0 @@ -package gtPlusPlus.xmod.gregtech.registration.gregtech; - -import gtPlusPlus.api.objects.Logger; -import gtPlusPlus.xmod.gregtech.api.enums.GregtechItemList; -import gtPlusPlus.xmod.gregtech.common.tileentities.machines.multi.misc.GMTE_AmazonPackager; - -public class GregtechAmazonWarehouse { - - public static void run() { - Logger.INFO("Gregtech5u Content | Registering Amazon Warehouse Multiblock."); - run1(); - } - - private static void run1() { - // Amazon packager multiblock - GregtechItemList.Amazon_Warehouse_Controller.set( - new GMTE_AmazonPackager(942, "amazonprime.controller.tier.single", "Amazon Warehousing Depot.") - .getStackForm(1L)); - } -} diff --git a/gtpp/src/main/java/gtPlusPlus/xmod/gregtech/registration/gregtech/GregtechBufferDynamos.java b/gtpp/src/main/java/gtPlusPlus/xmod/gregtech/registration/gregtech/GregtechBufferDynamos.java deleted file mode 100644 index 20df726ebe..0000000000 --- a/gtpp/src/main/java/gtPlusPlus/xmod/gregtech/registration/gregtech/GregtechBufferDynamos.java +++ /dev/null @@ -1,133 +0,0 @@ -package gtPlusPlus.xmod.gregtech.registration.gregtech; - -import static gtPlusPlus.core.recipe.common.CI.bitsd; - -import gregtech.api.enums.ItemList; -import gregtech.api.enums.Materials; -import gregtech.api.enums.OrePrefixes; -import gregtech.api.util.GT_ModHandler; -import gtPlusPlus.core.recipe.common.CI; -import gtPlusPlus.xmod.gregtech.api.enums.GregtechItemList; -import gtPlusPlus.xmod.gregtech.api.metatileentity.implementations.GT_MetaTileEntity_Hatch_DynamoBuffer; - -public class GregtechBufferDynamos { - - private static int mID = 899; - - public static void run() { - run2(); - } - - private static void run2() { - GregtechItemList.Hatch_Buffer_Dynamo_ULV.set( - new GT_MetaTileEntity_Hatch_DynamoBuffer( - mID++, - "hatch.dynamo.buffer.tier.00", - "ULV Dynamo Hatch [Buffered]", - 0).getStackForm(1L)); - GregtechItemList.Hatch_Buffer_Dynamo_LV.set( - new GT_MetaTileEntity_Hatch_DynamoBuffer( - mID++, - "hatch.dynamo.buffer.tier.01", - "LV Dynamo Hatch [Buffered]", - 1).getStackForm(1L)); - GregtechItemList.Hatch_Buffer_Dynamo_MV.set( - new GT_MetaTileEntity_Hatch_DynamoBuffer( - mID++, - "hatch.dynamo.buffer.tier.02", - "MV Dynamo Hatch [Buffered]", - 2).getStackForm(1L)); - GregtechItemList.Hatch_Buffer_Dynamo_HV.set( - new GT_MetaTileEntity_Hatch_DynamoBuffer( - mID++, - "hatch.dynamo.buffer.tier.03", - "HV Dynamo Hatch [Buffered]", - 3).getStackForm(1L)); - GregtechItemList.Hatch_Buffer_Dynamo_EV.set( - new GT_MetaTileEntity_Hatch_DynamoBuffer( - mID++, - "hatch.dynamo.buffer.tier.04", - "EV Dynamo Hatch [Buffered]", - 4).getStackForm(1L)); - GregtechItemList.Hatch_Buffer_Dynamo_IV.set( - new GT_MetaTileEntity_Hatch_DynamoBuffer( - mID++, - "hatch.dynamo.buffer.tier.05", - "IV Dynamo Hatch [Buffered]", - 5).getStackForm(1L)); - GregtechItemList.Hatch_Buffer_Dynamo_LuV.set( - new GT_MetaTileEntity_Hatch_DynamoBuffer( - mID++, - "hatch.dynamo.buffer.tier.06", - "LuV Dynamo Hatch [Buffered]", - 6).getStackForm(1L)); - GregtechItemList.Hatch_Buffer_Dynamo_ZPM.set( - new GT_MetaTileEntity_Hatch_DynamoBuffer( - mID++, - "hatch.dynamo.buffer.tier.07", - "ZPM Dynamo Hatch [Buffered]", - 7).getStackForm(1L)); - GregtechItemList.Hatch_Buffer_Dynamo_UV.set( - new GT_MetaTileEntity_Hatch_DynamoBuffer( - mID++, - "hatch.dynamo.buffer.tier.08", - "UV Dynamo Hatch [Buffered]", - 8).getStackForm(1L)); - GregtechItemList.Hatch_Buffer_Dynamo_MAX.set( - new GT_MetaTileEntity_Hatch_DynamoBuffer( - mID++, - "hatch.dynamo.buffer.tier.09", - "UHV Dynamo Hatch [Buffered]", - 9).getStackForm(1L)); - GT_ModHandler.addCraftingRecipe( - GregtechItemList.Hatch_Buffer_Dynamo_ULV.get(1L, new Object[0]), - bitsd, - new Object[] { "TMC", 'M', ItemList.Hatch_Dynamo_ULV, 'T', CI.getTieredCircuit(0), 'C', - OrePrefixes.cableGt04.get((Object) Materials.Lead) }); - GT_ModHandler.addCraftingRecipe( - GregtechItemList.Hatch_Buffer_Dynamo_LV.get(1L, new Object[0]), - bitsd, - new Object[] { "TMC", 'M', ItemList.Hatch_Dynamo_LV, 'T', CI.getTieredCircuit(1), 'C', - OrePrefixes.cableGt04.get((Object) Materials.Tin) }); - GT_ModHandler.addCraftingRecipe( - GregtechItemList.Hatch_Buffer_Dynamo_MV.get(1L, new Object[0]), - bitsd, - new Object[] { "TMC", 'M', ItemList.Hatch_Dynamo_MV, 'T', CI.getTieredCircuit(2), 'C', - OrePrefixes.cableGt04.get((Object) Materials.AnyCopper) }); - GT_ModHandler.addCraftingRecipe( - GregtechItemList.Hatch_Buffer_Dynamo_HV.get(1L, new Object[0]), - bitsd, - new Object[] { "TMC", 'M', ItemList.Hatch_Dynamo_HV, 'T', CI.getTieredCircuit(3), 'C', - OrePrefixes.cableGt04.get((Object) Materials.Gold) }); - GT_ModHandler.addCraftingRecipe( - GregtechItemList.Hatch_Buffer_Dynamo_EV.get(1L, new Object[0]), - bitsd, - new Object[] { "TMC", 'M', ItemList.Hatch_Dynamo_EV, 'T', CI.getTieredCircuit(4), 'C', - OrePrefixes.cableGt04.get((Object) Materials.Aluminium) }); - GT_ModHandler.addCraftingRecipe( - GregtechItemList.Hatch_Buffer_Dynamo_IV.get(1L, new Object[0]), - bitsd, - new Object[] { "TMC", 'M', ItemList.Hatch_Dynamo_IV, 'T', CI.getTieredCircuit(5), 'C', - OrePrefixes.cableGt04.get((Object) Materials.Tungsten) }); - GT_ModHandler.addCraftingRecipe( - GregtechItemList.Hatch_Buffer_Dynamo_LuV.get(1L, new Object[0]), - bitsd, - new Object[] { "TMC", 'M', ItemList.Hatch_Dynamo_LuV, 'T', CI.getTieredCircuit(6), 'C', - OrePrefixes.cableGt04.get((Object) Materials.VanadiumGallium) }); - GT_ModHandler.addCraftingRecipe( - GregtechItemList.Hatch_Buffer_Dynamo_ZPM.get(1L, new Object[0]), - bitsd, - new Object[] { "TMC", 'M', ItemList.Hatch_Dynamo_ZPM, 'T', CI.getTieredCircuit(7), 'C', - OrePrefixes.cableGt04.get((Object) Materials.Naquadah) }); - GT_ModHandler.addCraftingRecipe( - GregtechItemList.Hatch_Buffer_Dynamo_UV.get(1L, new Object[0]), - bitsd, - new Object[] { "TMC", 'M', ItemList.Hatch_Dynamo_UV, 'T', CI.getTieredCircuit(8), 'C', - OrePrefixes.wireGt12.get((Object) Materials.NaquadahAlloy) }); - GT_ModHandler.addCraftingRecipe( - GregtechItemList.Hatch_Buffer_Dynamo_MAX.get(1L, new Object[0]), - bitsd, - new Object[] { "TMC", 'M', ItemList.Hatch_Dynamo_MAX, 'T', CI.getTieredCircuit(9), 'C', - OrePrefixes.wireGt04.get(Materials.SuperconductorUHV) }); - } -} diff --git a/gtpp/src/main/java/gtPlusPlus/xmod/gregtech/registration/gregtech/GregtechConduits.java b/gtpp/src/main/java/gtPlusPlus/xmod/gregtech/registration/gregtech/GregtechConduits.java deleted file mode 100644 index 22d3cd9608..0000000000 --- a/gtpp/src/main/java/gtPlusPlus/xmod/gregtech/registration/gregtech/GregtechConduits.java +++ /dev/null @@ -1,1269 +0,0 @@ -package gtPlusPlus.xmod.gregtech.registration.gregtech; - -import static gregtech.api.enums.Mods.EnderIO; -import static gregtech.api.enums.Mods.Thaumcraft; - -import java.lang.reflect.Constructor; -import java.lang.reflect.InvocationTargetException; -import java.util.ArrayList; - -import net.minecraft.item.ItemStack; -import net.minecraftforge.oredict.OreDictionary; - -import gregtech.api.enums.GT_Values; -import gregtech.api.enums.ItemList; -import gregtech.api.enums.Materials; -import gregtech.api.enums.OrePrefixes; -import gregtech.api.metatileentity.implementations.GT_MetaPipeEntity_Fluid; -import gregtech.api.util.GT_OreDictUnificator; -import gregtech.api.util.GT_Utility; -import gtPlusPlus.api.objects.Logger; -import gtPlusPlus.core.lib.CORE; -import gtPlusPlus.core.material.ALLOY; -import gtPlusPlus.core.material.ELEMENT; -import gtPlusPlus.core.material.Material; -import gtPlusPlus.core.recipe.common.CI; -import gtPlusPlus.core.util.Utils; -import gtPlusPlus.core.util.minecraft.FluidUtils; -import gtPlusPlus.core.util.minecraft.ItemUtils; -import gtPlusPlus.core.util.minecraft.MaterialUtils; -import gtPlusPlus.core.util.minecraft.RecipeUtils; -import gtPlusPlus.xmod.gregtech.api.enums.GregtechOrePrefixes.GT_Materials; -import gtPlusPlus.xmod.gregtech.api.metatileentity.implementations.GregtechMetaPipeEntityFluid; -import gtPlusPlus.xmod.gregtech.api.metatileentity.implementations.GregtechMetaPipeEntity_Cable; - -public class GregtechConduits { - - // 30000-30999 - - private static int BaseWireID = 30600; - private static int BasePipeID = 30700; - private static int BasePipeHexadecupleID = 30100; - - public static void run() { - Logger.INFO("Gregtech5u Content | Registering Custom Cables/Wires/Pipes."); - if (CORE.ConfigSwitches.enableCustom_Cables) { - run1(); - } - if (CORE.ConfigSwitches.enableCustom_Pipes) { - run2(); - run3(); - } - } - - private static void run3() { - - try { - Class<GT_MetaPipeEntity_Fluid> aPipeEntity = GT_MetaPipeEntity_Fluid.class; - Constructor<GT_MetaPipeEntity_Fluid> constructor = aPipeEntity.getConstructor( - int.class, - String.class, - String.class, - float.class, - Materials.class, - int.class, - int.class, - boolean.class, - int.class); - if (constructor != null) { - Logger.INFO("Generating Hexadecuple pipes."); - generateFluidMultiPipes( - constructor, - Materials.Copper, - MaterialUtils.getMaterialName(Materials.Copper), - "Copper", - BasePipeHexadecupleID++, - 60, - 1000, - true); - generateFluidMultiPipes( - constructor, - Materials.Bronze, - MaterialUtils.getMaterialName(Materials.Bronze), - "Bronze", - BasePipeHexadecupleID++, - 120, - 2000, - true); - generateFluidMultiPipes( - constructor, - Materials.Steel, - MaterialUtils.getMaterialName(Materials.Steel), - "Steel", - BasePipeHexadecupleID++, - 240, - 2500, - true); - generateFluidMultiPipes( - constructor, - Materials.StainlessSteel, - MaterialUtils.getMaterialName(Materials.StainlessSteel), - "Stainless Steel", - BasePipeHexadecupleID++, - 360, - 3000, - true); - generateFluidMultiPipes( - constructor, - Materials.Titanium, - MaterialUtils.getMaterialName(Materials.Titanium), - "Titanium", - BasePipeHexadecupleID++, - 480, - 5000, - true); - generateFluidMultiPipes( - constructor, - Materials.TungstenSteel, - MaterialUtils.getMaterialName(Materials.TungstenSteel), - "Tungsten Steel", - BasePipeHexadecupleID++, - 600, - 7500, - true); - generateFluidMultiPipes( - constructor, - Materials.Plastic, - MaterialUtils.getMaterialName(Materials.Plastic), - "Plastic", - BasePipeHexadecupleID++, - 360, - 350, - true); - - Materials aPTFE = Materials.get("Polytetrafluoroethylene"); - if (aPTFE != null) { - generateFluidMultiPipes( - constructor, - aPTFE, - MaterialUtils.getMaterialName(aPTFE), - "PTFE", - BasePipeHexadecupleID++, - 480, - 600, - true); - } - } else { - Logger.INFO("Failed during Hexadecuple pipe generation."); - } - - } catch (NoSuchMethodException | SecurityException e) { - Logger.INFO("Failed during Hexadecuple pipe generation. [Ecx]"); - e.printStackTrace(); - } - - // Generate Heat Pipes - // GregtechItemList.HeatPipe_Tier_1.set(new GT_MetaPipeEntity_Heat(31021, "gtpp.pipe.heat.basic.01", "Lead Heat - // Pipe (500C)", Materials.Lead, 500).getStackForm(1L)); - // GregtechItemList.HeatPipe_Tier_2.set(new GT_MetaPipeEntity_Heat(31022, "gtpp.pipe.heat.basic.02", "Iron Heat - // Pipe (500C)", Materials.Iron, 500).getStackForm(1L)); - // GregtechItemList.HeatPipe_Tier_3.set(new GT_MetaPipeEntity_Heat(31023, "gtpp.pipe.heat.basic.03", "Silver - // Heat Pipe (1500C)", Materials.Silver, 1500).getStackForm(1L)); - - } - - private static void generateFluidMultiPipes(Constructor<GT_MetaPipeEntity_Fluid> aClazz, Materials aMaterial, - String name, String displayName, int startID, int transferRatePerSec, int heatCapacity, boolean gasProof) { - GT_MetaPipeEntity_Fluid aPipe; - final int transferRatePerTick = transferRatePerSec / 20; - try { - aPipe = aClazz.newInstance( - startID, - "GT_Pipe_" + name + "_Hexadecuple", - "Hexadecuple " + displayName + " Fluid Pipe", - 1.0F, - aMaterial, - transferRatePerTick, - heatCapacity, - gasProof, - 16); - if (aPipe == null) { - Logger.INFO("Failed to Generate " + aMaterial + " Hexadecuple pipes."); - } else { - Logger.INFO("Generated " + aMaterial + " Hexadecuple pipes."); - GT_OreDictUnificator.registerOre("pipeHexadecuple" + aMaterial, aPipe.getStackForm(1L)); - } - } catch (InstantiationException | IllegalAccessException | IllegalArgumentException - | InvocationTargetException e) { - Logger.INFO("Failed to Generate " + aMaterial + " Hexadecuple pipes. [Ecx]"); - e.printStackTrace(); - } - } - - private static void run1() { - - wireFactory("RedstoneAlloy", 32, BaseWireID + 45, 0, 2, 1, new short[] { 178, 34, 34, 0 }); - - // need to go back id because fluid pipes already occupy - makeCustomWires(ELEMENT.STANDALONE.HYPOGEN, BaseWireID - 15, 0, 0, 8, GT_Values.V[11], false, true); - - } - - private static void run2() { - generateNonGTFluidPipes(GT_Materials.Staballoy, ALLOY.STABALLOY, BasePipeID, 12500, 7500, true); - generateNonGTFluidPipes(GT_Materials.Tantalloy60, ALLOY.TANTALLOY_60, BasePipeID + 5, 10000, 4250, true); - generateNonGTFluidPipes(GT_Materials.Tantalloy61, ALLOY.TANTALLOY_61, BasePipeID + 10, 12000, 5800, true); - if (Thaumcraft.isModLoaded()) { - generateNonGTFluidPipes(GT_Materials.Void, null, BasePipeID + 15, 1600, 25000, true); - } - generateGTFluidPipes(Materials.Europium, BasePipeID + 20, 12000, 7500, true); - generateNonGTFluidPipes(GT_Materials.Potin, ALLOY.POTIN, BasePipeID + 25, 500, 2000, true); - generateNonGTFluidPipes(GT_Materials.MaragingSteel300, ALLOY.MARAGING300, BasePipeID + 30, 14000, 2500, true); - generateNonGTFluidPipes(GT_Materials.MaragingSteel350, ALLOY.MARAGING350, BasePipeID + 35, 16000, 2500, true); - generateNonGTFluidPipes(GT_Materials.Inconel690, ALLOY.INCONEL_690, BasePipeID + 40, 15000, 4800, true); - generateNonGTFluidPipes(GT_Materials.Inconel792, ALLOY.INCONEL_792, BasePipeID + 45, 16000, 5500, true); - generateNonGTFluidPipes(GT_Materials.HastelloyX, ALLOY.HASTELLOY_X, BasePipeID + 50, 20000, 4200, true); - - generateGTFluidPipes(Materials.Tungsten, BasePipeID + 55, 4320, 7200, true); - if (EnderIO.isModLoaded()) { - generateGTFluidPipes(Materials.DarkSteel, BasePipeID + 60, 2320, 2750, true); - } - generateGTFluidPipes(Materials.Clay, BasePipeID + 65, 100, 500, false); - generateGTFluidPipes(Materials.Lead, BasePipeID + 70, 350, 1200, true); - - generateNonGTFluidPipes( - GT_Materials.TriniumNaquadahCarbonite, - ALLOY.TRINIUM_NAQUADAH_CARBON, - 30500, - 20, - 250000, - true); - } - - private static void wireFactory(final String Material, final int Voltage, final int ID, final long insulatedLoss, - final long uninsulatedLoss, final long Amps, final short[] rgb) { - final Materials T = Materials.get(Material); - int V = GT_Utility.getTier(Voltage); - if (V == -1) { - Logger.ERROR("Failed to set voltage on " + Material + ". Invalid voltage of " + Voltage + "V set."); - Logger.ERROR(Material + " has defaulted to 8v."); - V = 0; - } - makeWires(T, ID, insulatedLoss, uninsulatedLoss, Amps, GT_Values.V[V], true, false, rgb); - } - - private static void makeWires(final Materials aMaterial, final int aStartID, final long aLossInsulated, - final long aLoss, final long aAmperage, final long aVoltage, final boolean aInsulatable, - final boolean aAutoInsulated, final short[] aRGB) { - Logger.WARNING("Gregtech5u Content | Registered " + aMaterial.mName + " as a new material for Wire & Cable."); - GT_OreDictUnificator.registerOre( - OrePrefixes.wireGt01, - aMaterial, - new GregtechMetaPipeEntity_Cable( - aStartID + 0, - "wire." + aMaterial.mName.toLowerCase() + ".01", - "1x " + aMaterial.mDefaultLocalName + " Wire", - 0.125F, - aMaterial, - aLoss, - 1L * aAmperage, - aVoltage, - false, - !aAutoInsulated, - aRGB).getStackForm(1L)); - GT_OreDictUnificator.registerOre( - OrePrefixes.wireGt02, - aMaterial, - new GregtechMetaPipeEntity_Cable( - aStartID + 1, - "wire." + aMaterial.mName.toLowerCase() + ".02", - "2x " + aMaterial.mDefaultLocalName + " Wire", - 0.25F, - aMaterial, - aLoss, - 2L * aAmperage, - aVoltage, - false, - !aAutoInsulated, - aRGB).getStackForm(1L)); - GT_OreDictUnificator.registerOre( - OrePrefixes.wireGt04, - aMaterial, - new GregtechMetaPipeEntity_Cable( - aStartID + 2, - "wire." + aMaterial.mName.toLowerCase() + ".04", - "4x " + aMaterial.mDefaultLocalName + " Wire", - 0.375F, - aMaterial, - aLoss, - 4L * aAmperage, - aVoltage, - false, - !aAutoInsulated, - aRGB).getStackForm(1L)); - GT_OreDictUnificator.registerOre( - OrePrefixes.wireGt08, - aMaterial, - new GregtechMetaPipeEntity_Cable( - aStartID + 3, - "wire." + aMaterial.mName.toLowerCase() + ".08", - "8x " + aMaterial.mDefaultLocalName + " Wire", - 0.50F, - aMaterial, - aLoss, - 8L * aAmperage, - aVoltage, - false, - !aAutoInsulated, - aRGB).getStackForm(1L)); - GT_OreDictUnificator.registerOre( - OrePrefixes.wireGt12, - aMaterial, - new GregtechMetaPipeEntity_Cable( - aStartID + 4, - "wire." + aMaterial.mName.toLowerCase() + ".12", - "12x " + aMaterial.mDefaultLocalName + " Wire", - 0.625F, - aMaterial, - aLoss, - 12L * aAmperage, - aVoltage, - false, - !aAutoInsulated, - aRGB).getStackForm(1L)); - GT_OreDictUnificator.registerOre( - OrePrefixes.wireGt16, - aMaterial, - new GregtechMetaPipeEntity_Cable( - aStartID + 5, - "wire." + aMaterial.mName.toLowerCase() + ".16", - "16x " + aMaterial.mDefaultLocalName + " Wire", - 0.75F, - aMaterial, - aLoss, - 16L * aAmperage, - aVoltage, - false, - !aAutoInsulated, - aRGB).getStackForm(1L)); - if (aInsulatable) { - GT_OreDictUnificator.registerOre( - OrePrefixes.cableGt01, - aMaterial, - new GregtechMetaPipeEntity_Cable( - aStartID + 6, - "cable." + aMaterial.mName.toLowerCase() + ".01", - "1x " + aMaterial.mDefaultLocalName + " Cable", - 0.25F, - aMaterial, - aLossInsulated, - 1L * aAmperage, - aVoltage, - true, - false, - aRGB).getStackForm(1L)); - GT_OreDictUnificator.registerOre( - OrePrefixes.cableGt02, - aMaterial, - new GregtechMetaPipeEntity_Cable( - aStartID + 7, - "cable." + aMaterial.mName.toLowerCase() + ".02", - "2x " + aMaterial.mDefaultLocalName + " Cable", - 0.375F, - aMaterial, - aLossInsulated, - 2L * aAmperage, - aVoltage, - true, - false, - aRGB).getStackForm(1L)); - GT_OreDictUnificator.registerOre( - OrePrefixes.cableGt04, - aMaterial, - new GregtechMetaPipeEntity_Cable( - aStartID + 8, - "cable." + aMaterial.mName.toLowerCase() + ".04", - "4x " + aMaterial.mDefaultLocalName + " Cable", - 0.5F, - aMaterial, - aLossInsulated, - 4L * aAmperage, - aVoltage, - true, - false, - aRGB).getStackForm(1L)); - GT_OreDictUnificator.registerOre( - OrePrefixes.cableGt08, - aMaterial, - new GregtechMetaPipeEntity_Cable( - aStartID + 9, - "cable." + aMaterial.mName.toLowerCase() + ".08", - "8x " + aMaterial.mDefaultLocalName + " Cable", - 0.625F, - aMaterial, - aLossInsulated, - 8L * aAmperage, - aVoltage, - true, - false, - aRGB).getStackForm(1L)); - GT_OreDictUnificator.registerOre( - OrePrefixes.cableGt12, - aMaterial, - new GregtechMetaPipeEntity_Cable( - aStartID + 10, - "cable." + aMaterial.mName.toLowerCase() + ".12", - "12x " + aMaterial.mDefaultLocalName + " Cable", - 0.75F, - aMaterial, - aLossInsulated, - 12L * aAmperage, - aVoltage, - true, - false, - aRGB).getStackForm(1L)); - GT_OreDictUnificator.registerOre( - OrePrefixes.cableGt16, - aMaterial, - new GregtechMetaPipeEntity_Cable( - aStartID + 11, - "cable." + aMaterial.mName.toLowerCase() + ".16", - "16x " + aMaterial.mDefaultLocalName + " Cable", - 0.875f, - aMaterial, - aLossInsulated, - 16L * aAmperage, - aVoltage, - true, - false, - aRGB).getStackForm(1L)); - } - } - - private static void customWireFactory(final Material Material, final int Voltage, final int ID, - final long insulatedLoss, final long uninsulatedLoss, final long Amps) { - int V = GT_Utility.getTier(Voltage); - if (V == -1) { - Logger.ERROR("Failed to set voltage on " + Material + ". Invalid voltage of " + Voltage + "V set."); - Logger.ERROR(Material + " has defaulted to 8v."); - V = 0; - } - makeCustomWires(Material, ID, insulatedLoss, uninsulatedLoss, Amps, GT_Values.V[V], true, false); - } - - private static void makeCustomWires(final Material aMaterial, final int aStartID, final long aLossInsulated, - final long aLoss, final long aAmperage, final long aVoltage, final boolean aInsulatable, - final boolean aAutoInsulated) { - Logger.WARNING( - "Gregtech5u Content | Registered " + aMaterial.getLocalizedName() + " as a new material for Wire & Cable."); - registerOre( - OrePrefixes.wireGt01, - aMaterial, - new GregtechMetaPipeEntity_Cable( - aStartID + 0, - "wire." + aMaterial.getLocalizedName() - .toLowerCase() + ".01", - "1x " + aMaterial.getLocalizedName() + " Wire", - 0.125F, - aLoss, - 1L * aAmperage, - aVoltage, - false, - !aAutoInsulated, - aMaterial.getRGBA()).getStackForm(1L)); - registerOre( - OrePrefixes.wireGt02, - aMaterial, - new GregtechMetaPipeEntity_Cable( - aStartID + 1, - "wire." + aMaterial.getLocalizedName() - .toLowerCase() + ".02", - "2x " + aMaterial.getLocalizedName() + " Wire", - 0.25F, - aLoss, - 2L * aAmperage, - aVoltage, - false, - !aAutoInsulated, - aMaterial.getRGBA()).getStackForm(1L)); - registerOre( - OrePrefixes.wireGt04, - aMaterial, - new GregtechMetaPipeEntity_Cable( - aStartID + 2, - "wire." + aMaterial.getLocalizedName() - .toLowerCase() + ".04", - "4x " + aMaterial.getLocalizedName() + " Wire", - 0.375F, - aLoss, - 4L * aAmperage, - aVoltage, - false, - !aAutoInsulated, - aMaterial.getRGBA()).getStackForm(1L)); - registerOre( - OrePrefixes.wireGt08, - aMaterial, - new GregtechMetaPipeEntity_Cable( - aStartID + 3, - "wire." + aMaterial.getLocalizedName() - .toLowerCase() + ".08", - "8x " + aMaterial.getLocalizedName() + " Wire", - 0.50F, - aLoss, - 8L * aAmperage, - aVoltage, - false, - !aAutoInsulated, - aMaterial.getRGBA()).getStackForm(1L)); - registerOre( - OrePrefixes.wireGt12, - aMaterial, - new GregtechMetaPipeEntity_Cable( - aStartID + 4, - "wire." + aMaterial.getLocalizedName() - .toLowerCase() + ".12", - "12x " + aMaterial.getLocalizedName() + " Wire", - 0.625F, - aLoss, - 12L * aAmperage, - aVoltage, - false, - !aAutoInsulated, - aMaterial.getRGBA()).getStackForm(1L)); - registerOre( - OrePrefixes.wireGt16, - aMaterial, - new GregtechMetaPipeEntity_Cable( - aStartID + 5, - "wire." + aMaterial.getLocalizedName() - .toLowerCase() + ".16", - "16x " + aMaterial.getLocalizedName() + " Wire", - 0.75F, - aLoss, - 16L * aAmperage, - aVoltage, - false, - !aAutoInsulated, - aMaterial.getRGBA()).getStackForm(1L)); - if (aInsulatable) { - registerOre( - OrePrefixes.cableGt01, - aMaterial, - new GregtechMetaPipeEntity_Cable( - aStartID + 6, - "cable." + aMaterial.getLocalizedName() - .toLowerCase() + ".01", - "1x " + aMaterial.getLocalizedName() + " Cable", - 0.25F, - aLossInsulated, - 1L * aAmperage, - aVoltage, - true, - false, - aMaterial.getRGBA()).getStackForm(1L)); - registerOre( - OrePrefixes.cableGt02, - aMaterial, - new GregtechMetaPipeEntity_Cable( - aStartID + 7, - "cable." + aMaterial.getLocalizedName() - .toLowerCase() + ".02", - "2x " + aMaterial.getLocalizedName() + " Cable", - 0.375F, - aLossInsulated, - 2L * aAmperage, - aVoltage, - true, - false, - aMaterial.getRGBA()).getStackForm(1L)); - registerOre( - OrePrefixes.cableGt04, - aMaterial, - new GregtechMetaPipeEntity_Cable( - aStartID + 8, - "cable." + aMaterial.getLocalizedName() - .toLowerCase() + ".04", - "4x " + aMaterial.getLocalizedName() + " Cable", - 0.5F, - aLossInsulated, - 4L * aAmperage, - aVoltage, - true, - false, - aMaterial.getRGBA()).getStackForm(1L)); - registerOre( - OrePrefixes.cableGt08, - aMaterial, - new GregtechMetaPipeEntity_Cable( - aStartID + 9, - "cable." + aMaterial.getLocalizedName() - .toLowerCase() + ".08", - "8x " + aMaterial.getLocalizedName() + " Cable", - 0.625F, - aLossInsulated, - 8L * aAmperage, - aVoltage, - true, - false, - aMaterial.getRGBA()).getStackForm(1L)); - registerOre( - OrePrefixes.cableGt12, - aMaterial, - new GregtechMetaPipeEntity_Cable( - aStartID + 10, - "cable." + aMaterial.getLocalizedName() - .toLowerCase() + ".12", - "12x " + aMaterial.getLocalizedName() + " Cable", - 0.75F, - aLossInsulated, - 12L * aAmperage, - aVoltage, - true, - false, - aMaterial.getRGBA()).getStackForm(1L)); - registerOre( - OrePrefixes.cableGt16, - aMaterial, - new GregtechMetaPipeEntity_Cable( - aStartID + 11, - "cable." + aMaterial.getLocalizedName() - .toLowerCase() + ".16", - "16x " + aMaterial.getLocalizedName() + " Cable", - 0.875f, - aLossInsulated, - 16L * aAmperage, - aVoltage, - true, - false, - aMaterial.getRGBA()).getStackForm(1L)); - } - } - - private static void superConductorFactory(final GT_Materials Material, final int Voltage, final int ID, - final long insulatedLoss, final long uninsulatedLoss, final long Amps) { - final GT_Materials T = Material; - int V = 0; - if (Voltage == 8) { - V = 0; - } else if (Voltage == 32) { - V = 1; - } else if (Voltage == 128) { - V = 2; - } else if (Voltage == 512) { - V = 3; - } else if (Voltage == 2048) { - V = 4; - } else if (Voltage == 8196) { - V = 5; - } else if (Voltage == 32768) { - V = 6; - } else if (Voltage == 131072) { - V = 7; - } else if (Voltage == 524288) { - V = 8; - } else if (Voltage == Integer.MAX_VALUE) { - V = 9; - } else { - Logger.ERROR("Failed to set voltage on " + Material.name() + ". Invalid voltage of " + Voltage + "V set."); - Logger.ERROR(Material.name() + " has defaulted to 8v."); - V = 0; - } - } - - private static void generateGTFluidPipes(final Materials material, final int startID, final int transferRatePerSec, - final int heatResistance, final boolean isGasProof) { - final int transferRatePerTick = transferRatePerSec / 20; - final long mass = material.getMass(); - final long voltage = material.mMeltingPoint >= 2800 ? 64 : 16; - GT_OreDictUnificator.registerOre( - OrePrefixes.pipeTiny.get(material), - new GT_MetaPipeEntity_Fluid( - startID, - "GT_Pipe_" + material.mDefaultLocalName + "_Tiny", - "Tiny " + material.mDefaultLocalName + " Fluid Pipe", - 0.25F, - material, - transferRatePerTick * 2, - heatResistance, - isGasProof).getStackForm(1L)); - GT_OreDictUnificator.registerOre( - OrePrefixes.pipeSmall.get(material), - new GT_MetaPipeEntity_Fluid( - startID + 1, - "GT_Pipe_" + material.mDefaultLocalName + "_Small", - "Small " + material.mDefaultLocalName + " Fluid Pipe", - 0.375F, - material, - transferRatePerTick * 4, - heatResistance, - isGasProof).getStackForm(1L)); - GT_OreDictUnificator.registerOre( - OrePrefixes.pipeMedium.get(material), - new GT_MetaPipeEntity_Fluid( - startID + 2, - "GT_Pipe_" + material.mDefaultLocalName + "", - "" + material.mDefaultLocalName + " Fluid Pipe", - 0.5F, - material, - transferRatePerTick * 12, - heatResistance, - isGasProof).getStackForm(1L)); - GT_OreDictUnificator.registerOre( - OrePrefixes.pipeLarge.get(material), - new GT_MetaPipeEntity_Fluid( - startID + 3, - "GT_Pipe_" + material.mDefaultLocalName + "_Large", - "Large " + material.mDefaultLocalName + " Fluid Pipe", - 0.75F, - material, - transferRatePerTick * 24, - heatResistance, - isGasProof).getStackForm(1L)); - GT_OreDictUnificator.registerOre( - OrePrefixes.pipeHuge.get(material), - new GT_MetaPipeEntity_Fluid( - startID + 4, - "GT_Pipe_" + material.mDefaultLocalName + "_Huge", - "Huge " + material.mDefaultLocalName + " Fluid Pipe", - 0.875F, - material, - transferRatePerTick * 48, - heatResistance, - isGasProof).getStackForm(1L)); - // generatePipeRecipes(material.mDefaultLocalName, mass, voltage); - } - - private static void generateNonGTFluidPipes(final GT_Materials material, final Material myMaterial, - final int startID, final int transferRatePerSec, final int heatResistance, final boolean isGasProof) { - final int transferRatePerTick = transferRatePerSec / 20; - long mass; - if (myMaterial != null) { - mass = myMaterial.getMass(); - } else { - mass = ELEMENT.getInstance().IRON.getMass(); - } - - int tVoltageMultiplier = (material.mBlastFurnaceTemp >= 2800) ? 64 : 16; - - GT_OreDictUnificator.registerOre( - OrePrefixes.pipeTiny.get(material), - new GregtechMetaPipeEntityFluid( - startID, - "GT_Pipe_" + material.mDefaultLocalName + "_Tiny", - "Tiny " + material.mDefaultLocalName + " Fluid Pipe", - 0.25F, - material, - transferRatePerTick * 2, - heatResistance, - isGasProof).getStackForm(1L)); - GT_OreDictUnificator.registerOre( - OrePrefixes.pipeSmall.get(material), - new GregtechMetaPipeEntityFluid( - startID + 1, - "GT_Pipe_" + material.mDefaultLocalName + "_Small", - "Small " + material.mDefaultLocalName + " Fluid Pipe", - 0.375F, - material, - transferRatePerTick * 4, - heatResistance, - isGasProof).getStackForm(1L)); - GT_OreDictUnificator.registerOre( - OrePrefixes.pipeMedium.get(material), - new GregtechMetaPipeEntityFluid( - startID + 2, - "GT_Pipe_" + material.mDefaultLocalName + "", - "" + material.mDefaultLocalName + " Fluid Pipe", - 0.5F, - material, - transferRatePerTick * 12, - heatResistance, - isGasProof).getStackForm(1L)); - GT_OreDictUnificator.registerOre( - OrePrefixes.pipeLarge.get(material), - new GregtechMetaPipeEntityFluid( - startID + 3, - "GT_Pipe_" + material.mDefaultLocalName + "_Large", - "Large " + material.mDefaultLocalName + " Fluid Pipe", - 0.75F, - material, - transferRatePerTick * 24, - heatResistance, - isGasProof).getStackForm(1L)); - GT_OreDictUnificator.registerOre( - OrePrefixes.pipeHuge.get(material), - new GregtechMetaPipeEntityFluid( - startID + 4, - "GT_Pipe_" + material.mDefaultLocalName + "_Huge", - "Huge " + material.mDefaultLocalName + " Fluid Pipe", - 0.875F, - material, - transferRatePerTick * 48, - heatResistance, - isGasProof).getStackForm(1L)); - // generatePipeRecipes(material.mDefaultLocalName, mass, tVoltageMultiplier); - - } - - public static void generatePipeRecipes(final String materialName, final long Mass, final long vMulti) { - - String output = materialName.substring(0, 1) - .toUpperCase() + materialName.substring(1); - output = Utils.sanitizeString(output); - - if (output.equals("VoidMetal")) { - output = "Void"; - } - - Logger.INFO("Generating " + output + " pipes & respective recipes."); - - ItemStack pipeIngot = ItemUtils.getItemStackOfAmountFromOreDict("ingot" + output, 1); - ItemStack pipePlate = ItemUtils.getItemStackOfAmountFromOreDict("plate" + output, 1); - - if (pipeIngot == null) { - if (pipePlate != null) { - pipeIngot = pipePlate; - } - } - - // Check all pipes are not null - Logger.WARNING( - "Generated pipeTiny from " + materialName - + "? " - + ((ItemUtils.getItemStackOfAmountFromOreDict("pipe" + "Tiny" + output, 1) != null) ? true : false)); - Logger.WARNING( - "Generated pipeSmall from " + materialName - + "? " - + ((ItemUtils.getItemStackOfAmountFromOreDict("pipe" + "Small" + output, 1) != null) ? true : false)); - Logger.WARNING( - "Generated pipeNormal from " + materialName - + "? " - + ((ItemUtils.getItemStackOfAmountFromOreDict("pipe" + "Medium" + output, 1) != null) ? true : false)); - Logger.WARNING( - "Generated pipeLarge from " + materialName - + "? " - + ((ItemUtils.getItemStackOfAmountFromOreDict("pipe" + "Large" + output, 1) != null) ? true : false)); - Logger.WARNING( - "Generated pipeHuge from " + materialName - + "? " - + ((ItemUtils.getItemStackOfAmountFromOreDict("pipe" + "Huge" + output, 1) != null) ? true : false)); - - int eut = 120; - eut = (int) (8 * vMulti); - - // Add the Three Shaped Recipes First - RecipeUtils.addShapedRecipe( - pipePlate, - "craftingToolWrench", - pipePlate, - pipePlate, - null, - pipePlate, - pipePlate, - "craftingToolHardHammer", - pipePlate, - ItemUtils.getItemStackOfAmountFromOreDict("pipe" + "Small" + output, 6)); - - RecipeUtils.addShapedRecipe( - pipePlate, - pipePlate, - pipePlate, - "craftingToolWrench", - null, - "craftingToolHardHammer", - pipePlate, - pipePlate, - pipePlate, - ItemUtils.getItemStackOfAmountFromOreDict("pipe" + "Medium" + output, 2)); - - RecipeUtils.addShapedRecipe( - pipePlate, - "craftingToolHardHammer", - pipePlate, - pipePlate, - null, - pipePlate, - pipePlate, - "craftingToolWrench", - pipePlate, - ItemUtils.getItemStackOfAmountFromOreDict("pipe" + "Large" + output, 1)); - - if (pipeIngot != null && ItemUtils.checkForInvalidItems(pipeIngot)) { - // 1 Clay Plate = 1 Clay Dust = 2 Clay Ball - int inputMultiplier = materialName.equals("Clay") ? 2 : 1; - GT_Values.RA.addExtruderRecipe( - ItemUtils.getSimpleStack(pipeIngot, 1 * inputMultiplier), - ItemList.Shape_Extruder_Pipe_Tiny.get(0), - ItemUtils.getItemStackOfAmountFromOreDictNoBroken("pipe" + "Tiny" + output, 2), - 5, - eut); - - GT_Values.RA.addExtruderRecipe( - ItemUtils.getSimpleStack(pipeIngot, 1 * inputMultiplier), - ItemList.Shape_Extruder_Pipe_Small.get(0), - ItemUtils.getItemStackOfAmountFromOreDict("pipe" + "Small" + output, 1), - 10, - eut); - - GT_Values.RA.addExtruderRecipe( - ItemUtils.getSimpleStack(pipeIngot, 3 * inputMultiplier), - ItemList.Shape_Extruder_Pipe_Medium.get(0), - ItemUtils.getItemStackOfAmountFromOreDict("pipe" + "Medium" + output, 1), - 1 * 20, - eut); - - GT_Values.RA.addExtruderRecipe( - ItemUtils.getSimpleStack(pipeIngot, 6 * inputMultiplier), - ItemList.Shape_Extruder_Pipe_Large.get(0), - ItemUtils.getItemStackOfAmountFromOreDict("pipe" + "Large" + output, 1), - 2 * 20, - eut); - - GT_Values.RA.addExtruderRecipe( - ItemUtils.getSimpleStack(pipeIngot, 12 * inputMultiplier), - ItemList.Shape_Extruder_Pipe_Huge.get(0), - ItemUtils.getItemStackOfAmountFromOreDict("pipe" + "Huge" + output, 1), - 4 * 20, - eut); - } - - if ((eut < 512) && !output.equals("Void")) { - try { - final ItemStack pipePlateDouble = ItemUtils.getItemStackOfAmountFromOreDict("plateDouble" + output, 1) - .copy(); - if (pipePlateDouble != null) { - RecipeUtils.addShapedRecipe( - pipePlateDouble, - "craftingToolHardHammer", - pipePlateDouble, - pipePlateDouble, - null, - pipePlateDouble, - pipePlateDouble, - "craftingToolWrench", - pipePlateDouble, - ItemUtils.getItemStackOfAmountFromOreDict("pipe" + "Huge" + output, 1)); - } else { - Logger.INFO( - "Failed to add a recipe for " + materialName - + " Huge pipes. Double plates probably do not exist."); - } - } catch (Throwable t) { - t.printStackTrace(); - } - } - } - - public static boolean registerOre(OrePrefixes aPrefix, Material aMaterial, ItemStack aStack) { - return registerOre(aPrefix.get(Utils.sanitizeString(aMaterial.getLocalizedName())), aStack); - } - - public static boolean registerOre(Object aName, ItemStack aStack) { - if ((aName == null) || (GT_Utility.isStackInvalid(aStack))) return false; - String tName = aName.toString(); - if (GT_Utility.isStringInvalid(tName)) return false; - ArrayList<ItemStack> tList = GT_OreDictUnificator.getOres(tName); - for (ItemStack itemStack : tList) - if (GT_Utility.areStacksEqual((ItemStack) itemStack, aStack, true)) return false; - OreDictionary.registerOre(tName, GT_Utility.copyAmount(1L, new Object[] { aStack })); - return true; - } - - public static boolean generateWireRecipes(Material aMaterial) { - - ItemStack aPlate = aMaterial.getPlate(1); - ItemStack aIngot = aMaterial.getIngot(1); - ItemStack aRod = aMaterial.getRod(1); - ItemStack aWire01 = aMaterial.getWire01(1); - ItemStack aWire02 = aMaterial.getWire02(1); - ItemStack aWire04 = aMaterial.getWire04(1); - ItemStack aWire08 = aMaterial.getWire08(1); - ItemStack aWire12 = aMaterial.getWire12(1); - ItemStack aWire16 = aMaterial.getWire16(1); - ItemStack aCable01 = aMaterial.getCable01(1); - ItemStack aCable02 = aMaterial.getCable02(1); - ItemStack aCable04 = aMaterial.getCable04(1); - ItemStack aCable08 = aMaterial.getCable08(1); - ItemStack aCable12 = aMaterial.getCable12(1); - ItemStack aCable16 = aMaterial.getCable16(1); - ItemStack aFineWire = aMaterial.getFineWire(1); - - // Adds manual crafting recipe - if (ItemUtils.checkForInvalidItems(new ItemStack[] { aPlate, aWire01 })) { - RecipeUtils - .addShapedRecipe(aPlate, CI.craftingToolWireCutter, null, null, null, null, null, null, null, aWire01); - } - - // Wire mill - if (ItemUtils - .checkForInvalidItems(new ItemStack[] { aIngot, aWire01, aWire02, aWire04, aWire08, aWire12, aWire16 })) { - GT_Values.RA.addWiremillRecipe( - aMaterial.getIngot(1), - GT_Utility.getIntegratedCircuit(1), - aMaterial.getWire01(2), - 100, - 4); - GT_Values.RA.addWiremillRecipe( - aMaterial.getIngot(1), - GT_Utility.getIntegratedCircuit(2), - aMaterial.getWire02(1), - 150, - 4); - GT_Values.RA.addWiremillRecipe( - aMaterial.getIngot(2), - GT_Utility.getIntegratedCircuit(4), - aMaterial.getWire04(1), - 200, - 4); - GT_Values.RA.addWiremillRecipe( - aMaterial.getIngot(4), - GT_Utility.getIntegratedCircuit(8), - aMaterial.getWire08(1), - 250, - 4); - GT_Values.RA.addWiremillRecipe( - aMaterial.getIngot(6), - GT_Utility.getIntegratedCircuit(12), - aMaterial.getWire12(1), - 300, - 4); - GT_Values.RA.addWiremillRecipe( - aMaterial.getIngot(8), - GT_Utility.getIntegratedCircuit(16), - aMaterial.getWire16(1), - 350, - 4); - } - - if (ItemUtils - .checkForInvalidItems(new ItemStack[] { aRod, aWire01, aWire02, aWire04, aWire08, aWire12, aWire16 })) { - GT_Values.RA.addWiremillRecipe( - aMaterial.getRod(1), - GT_Utility.getIntegratedCircuit(1), - aMaterial.getWire01(1), - 50, - 4); - GT_Values.RA.addWiremillRecipe( - aMaterial.getRod(2), - GT_Utility.getIntegratedCircuit(2), - aMaterial.getWire02(1), - 100, - 4); - GT_Values.RA.addWiremillRecipe( - aMaterial.getRod(4), - GT_Utility.getIntegratedCircuit(4), - aMaterial.getWire04(1), - 150, - 4); - GT_Values.RA.addWiremillRecipe( - aMaterial.getRod(8), - GT_Utility.getIntegratedCircuit(8), - aMaterial.getWire08(1), - 200, - 4); - GT_Values.RA.addWiremillRecipe( - aMaterial.getRod(12), - GT_Utility.getIntegratedCircuit(12), - aMaterial.getWire12(1), - 250, - 4); - GT_Values.RA.addWiremillRecipe( - aMaterial.getRod(16), - GT_Utility.getIntegratedCircuit(16), - aMaterial.getWire16(1), - 300, - 4); - } - - if (ItemUtils.checkForInvalidItems(new ItemStack[] { aIngot, aFineWire })) { - GT_Values.RA.addWiremillRecipe( - aMaterial.getIngot(1), - GT_Utility.getIntegratedCircuit(3), - aMaterial.getFineWire(8), - 100, - 4); - } - - if (ItemUtils.checkForInvalidItems(new ItemStack[] { aRod, aFineWire })) { - GT_Values.RA.addWiremillRecipe( - aMaterial.getRod(1), - GT_Utility.getIntegratedCircuit(3), - aMaterial.getFineWire(4), - 50, - 4); - } - - if (ItemUtils.checkForInvalidItems(new ItemStack[] { aWire01, aFineWire })) { - GT_Values.RA.addWiremillRecipe( - aMaterial.getWire01(1), - GT_Utility.getIntegratedCircuit(1), - aMaterial.getFineWire(4), - 200, - 8); - } - - // Extruder - if (ItemUtils.checkForInvalidItems(new ItemStack[] { aIngot, aWire01 })) { - GT_Values.RA - .addExtruderRecipe(aIngot, ItemList.Shape_Extruder_Wire.get(0), aMaterial.getWire01(2), 196, 96); - } - - if (ItemUtils.checkForInvalidItems(new ItemStack[] { aCable01, aWire01 })) { - GT_Values.RA.addUnboxingRecipe(aCable01, aWire01, null, 100, 8); - } - - // Shapeless Down-Crafting - // 2x - if (ItemUtils.checkForInvalidItems(new ItemStack[] { aWire01, aWire02 })) { - RecipeUtils.addShapelessGregtechRecipe(new ItemStack[] { aWire02 }, aMaterial.getWire01(2)); - } - - // 4x - if (ItemUtils.checkForInvalidItems(new ItemStack[] { aWire01, aWire04 })) { - RecipeUtils.addShapelessGregtechRecipe(new ItemStack[] { aWire04 }, aMaterial.getWire01(4)); - } - - // 8x - if (ItemUtils.checkForInvalidItems(new ItemStack[] { aWire01, aWire08 })) { - RecipeUtils.addShapelessGregtechRecipe(new ItemStack[] { aWire08 }, aMaterial.getWire01(8)); - } - - // 12x - if (ItemUtils.checkForInvalidItems(new ItemStack[] { aWire01, aWire12 })) { - RecipeUtils.addShapelessGregtechRecipe(new ItemStack[] { aWire12 }, aMaterial.getWire01(12)); - } - - // 16x - if (ItemUtils.checkForInvalidItems(new ItemStack[] { aWire01, aWire16 })) { - RecipeUtils.addShapelessGregtechRecipe(new ItemStack[] { aWire16 }, aMaterial.getWire01(16)); - } - - // 1x -> 2x - if (ItemUtils.checkForInvalidItems(new ItemStack[] { aWire01, aWire02 })) { - RecipeUtils.addShapelessGregtechRecipe(new ItemStack[] { aWire01, aWire01 }, aWire02); - } - - // 2x -> 4x - if (ItemUtils.checkForInvalidItems(new ItemStack[] { aWire02, aWire04 })) { - RecipeUtils.addShapelessGregtechRecipe(new ItemStack[] { aWire02, aWire02 }, aWire04); - } - - // 4x -> 8x - if (ItemUtils.checkForInvalidItems(new ItemStack[] { aWire04, aWire08 })) { - RecipeUtils.addShapelessGregtechRecipe(new ItemStack[] { aWire04, aWire04 }, aWire08); - } - - // 8x -> 12x - if (ItemUtils.checkForInvalidItems(new ItemStack[] { aWire04, aWire08, aWire12 })) { - RecipeUtils.addShapelessGregtechRecipe(new ItemStack[] { aWire04, aWire08 }, aWire12); - } - - // 12x -> 16x - if (ItemUtils.checkForInvalidItems(new ItemStack[] { aWire04, aWire12, aWire16 })) { - RecipeUtils.addShapelessGregtechRecipe(new ItemStack[] { aWire04, aWire12 }, aWire16); - } - - // 8x -> 16x - if (ItemUtils.checkForInvalidItems(new ItemStack[] { aWire08, aWire16 })) { - RecipeUtils.addShapelessGregtechRecipe(new ItemStack[] { aWire08, aWire08 }, aWire16); - } - - // 1x -> 4x - if (ItemUtils.checkForInvalidItems(new ItemStack[] { aWire01, aWire04 })) { - RecipeUtils.addShapelessGregtechRecipe(new ItemStack[] { aWire01, aWire01, aWire01, aWire01 }, aWire04); - } - - // 1x -> 8x - if (ItemUtils.checkForInvalidItems(new ItemStack[] { aWire01, aWire08 })) { - RecipeUtils.addShapelessGregtechRecipe( - new ItemStack[] { aWire01, aWire01, aWire01, aWire01, aWire01, aWire01, aWire01, aWire01 }, - aWire08); - } - - // Wire to Cable - // 1x - if (ItemUtils.checkForInvalidItems(new ItemStack[] { aWire01, aCable01 })) { - GT_Values.RA.addAssemblerRecipe( - aWire01, - CI.getNumberedCircuit(24), - FluidUtils.getFluidStack("molten.rubber", 144), - aCable01, - 100, - 8); - } - - // 2x - if (ItemUtils.checkForInvalidItems(new ItemStack[] { aWire02, aCable02 })) { - GT_Values.RA.addAssemblerRecipe( - aWire02, - CI.getNumberedCircuit(24), - FluidUtils.getFluidStack("molten.rubber", 144), - aCable02, - 100, - 8); - } - - // 4x - if (ItemUtils.checkForInvalidItems(new ItemStack[] { aWire04, aCable04 })) { - GT_Values.RA.addAssemblerRecipe( - aWire04, - CI.getNumberedCircuit(24), - FluidUtils.getFluidStack("molten.rubber", 288), - aCable04, - 100, - 8); - } - - // 8x - if (ItemUtils.checkForInvalidItems(new ItemStack[] { aWire08, aCable08 })) { - GT_Values.RA.addAssemblerRecipe( - aWire08, - CI.getNumberedCircuit(24), - FluidUtils.getFluidStack("molten.rubber", 432), - aCable08, - 100, - 8); - } - - // 12x - if (ItemUtils.checkForInvalidItems(new ItemStack[] { aWire12, aCable12 })) { - GT_Values.RA.addAssemblerRecipe( - aWire12, - CI.getNumberedCircuit(24), - FluidUtils.getFluidStack("molten.rubber", 576), - aCable12, - 100, - 8); - } - - // 16x - if (ItemUtils.checkForInvalidItems(new ItemStack[] { aWire16, aCable16 })) { - GT_Values.RA.addAssemblerRecipe( - aWire16, - CI.getNumberedCircuit(24), - FluidUtils.getFluidStack("molten.rubber", 720), - aCable16, - 100, - 8); - } - - // Assemble small wires into bigger wires - - // 2x - if (ItemUtils.checkForInvalidItems(new ItemStack[] { aWire01, aWire02 })) { - GT_Values.RA.addAssemblerRecipe(aMaterial.getWire01(2), CI.getNumberedCircuit(2), null, aWire02, 100, 8); - } - - // 4x - if (ItemUtils.checkForInvalidItems(new ItemStack[] { aWire01, aWire02 })) { - GT_Values.RA.addAssemblerRecipe(aMaterial.getWire01(4), CI.getNumberedCircuit(4), null, aWire04, 100, 8); - } - - // 8x - if (ItemUtils.checkForInvalidItems(new ItemStack[] { aWire01, aWire02 })) { - GT_Values.RA.addAssemblerRecipe(aMaterial.getWire01(8), CI.getNumberedCircuit(8), null, aWire08, 100, 8); - } - - // 12x - if (ItemUtils.checkForInvalidItems(new ItemStack[] { aWire01, aWire02 })) { - GT_Values.RA.addAssemblerRecipe(aMaterial.getWire01(12), CI.getNumberedCircuit(12), null, aWire12, 100, 8); - } - - // 16x - if (ItemUtils.checkForInvalidItems(new ItemStack[] { aWire01, aWire02 })) { - GT_Values.RA.addAssemblerRecipe(aMaterial.getWire01(16), CI.getNumberedCircuit(16), null, aWire16, 100, 8); - } - - return true; - } -} diff --git a/gtpp/src/main/java/gtPlusPlus/xmod/gregtech/registration/gregtech/GregtechCustomHatches.java b/gtpp/src/main/java/gtPlusPlus/xmod/gregtech/registration/gregtech/GregtechCustomHatches.java deleted file mode 100644 index 148ea9bc68..0000000000 --- a/gtpp/src/main/java/gtPlusPlus/xmod/gregtech/registration/gregtech/GregtechCustomHatches.java +++ /dev/null @@ -1,278 +0,0 @@ -package gtPlusPlus.xmod.gregtech.registration.gregtech; - -import gregtech.api.interfaces.metatileentity.IMetaTileEntity; -import gtPlusPlus.api.objects.Logger; -import gtPlusPlus.core.util.minecraft.FluidUtils; -import gtPlusPlus.core.util.minecraft.gregtech.PollutionUtils; -import gtPlusPlus.xmod.gregtech.api.enums.GregtechItemList; -import gtPlusPlus.xmod.gregtech.api.metatileentity.implementations.GT_MetaTileEntity_ChiselBus; -import gtPlusPlus.xmod.gregtech.api.metatileentity.implementations.GT_MetaTileEntity_Hatch_AirIntake; -import gtPlusPlus.xmod.gregtech.api.metatileentity.implementations.GT_MetaTileEntity_Hatch_AirIntake_Extreme; -import gtPlusPlus.xmod.gregtech.api.metatileentity.implementations.GT_MetaTileEntity_Hatch_Muffler_Adv; -import gtPlusPlus.xmod.gregtech.api.metatileentity.implementations.GT_MetaTileEntity_Hatch_Naquadah; -import gtPlusPlus.xmod.gregtech.api.metatileentity.implementations.GT_MetaTileEntity_Hatch_Reservoir; -import gtPlusPlus.xmod.gregtech.api.metatileentity.implementations.GT_MetaTileEntity_Hatch_Solidifier; -import gtPlusPlus.xmod.gregtech.api.metatileentity.implementations.GT_MetaTileEntity_Hatch_TurbineProvider; -import gtPlusPlus.xmod.gregtech.api.metatileentity.implementations.GT_MetaTileEntity_SuperBus_Input; -import gtPlusPlus.xmod.gregtech.api.metatileentity.implementations.GT_MetaTileEntity_SuperBus_Output; -import gtPlusPlus.xmod.gregtech.api.metatileentity.implementations.base.GT_MetaTileEntity_Hatch_CustomFluidBase; - -public class GregtechCustomHatches { - - public static void run() { - Logger.INFO("Gregtech5u Content | Registering Custom Fluid Hatches."); - run1(); - if (PollutionUtils.isPollutionEnabled()) { - run2(); - } - run3(); - run4(); // Chisel buses - run6(); // Solidifier hatches - } - - private static void run1() { - - GregtechItemList.Hatch_Input_Cryotheum.set( - new GT_MetaTileEntity_Hatch_CustomFluidBase( - FluidUtils.getFluidStack("cryotheum", 1) - .getFluid(), // Fluid - // to - // resitrct - // hatch - // to - 128000, // Capacity - 967, // ID - "hatch.cryotheum.input.tier.00", // unlocal name - "Cryotheum Cooling Hatch" // Local name - ).getStackForm(1L)); - - GregtechItemList.Hatch_Input_Pyrotheum.set( - new GT_MetaTileEntity_Hatch_CustomFluidBase( - FluidUtils.getFluidStack("pyrotheum", 1) - .getFluid(), // Fluid - // to - // resitrct - // hatch - // to - 128000, // Capacity - 968, // ID - "hatch.pyrotheum.input.tier.00", // unlocal name - "Pyrotheum Heating Vent" // Local name - ).getStackForm(1L)); - - GregtechItemList.Hatch_Input_Naquadah.set( - new GT_MetaTileEntity_Hatch_Naquadah( - 969, // ID - "hatch.naquadah.input.tier.00", // unlocal name - "Naquadah Reactor Input hatch" // Local name - ).getStackForm(1L)); - - GregtechItemList.Hatch_Input_TurbineHousing.set( - new GT_MetaTileEntity_Hatch_TurbineProvider( - 31025, // ID - "hatch.turbine.input.tier.00", // unlocal name - "Turbine Housing", // Local name - 8).getStackForm(1L)); - - // Multiblock Air Intake Hatch - GregtechItemList.Hatch_Air_Intake.set( - new GT_MetaTileEntity_Hatch_AirIntake(861, "hatch.air.intake.tier.00", "Air Intake Hatch", 5) - .getStackForm(1L)); - GregtechItemList.Hatch_Air_Intake_Extreme.set( - new GT_MetaTileEntity_Hatch_AirIntake_Extreme( - 31070, - "hatch.air.intake.tier.01", - "Extreme Air Intake Hatch", - 6).getStackForm(1L)); - - // Multiblock Reservoir Hatch - GregtechItemList.Hatch_Reservoir.set( - new GT_MetaTileEntity_Hatch_Reservoir(31071, "hatch.water.intake.tier.00", "Reservoir Hatch", 4) - .getStackForm(1L)); - - // Steam Hatch - GregtechItemList.Hatch_Input_Steam.set( - new GT_MetaTileEntity_Hatch_CustomFluidBase( - FluidUtils.getSteam(1) - .getFluid(), // Fluid - // to - // resitrct - // hatch - // to - 64000, // Capacity - 31040, // ID - "hatch.steam.input.tier.00", // unlocal name - "Steam Hatch" // Local name - ).getStackForm(1L)); - } - - private static void run2() { - GregtechItemList.Hatch_Muffler_Adv_LV.set( - (new GT_MetaTileEntity_Hatch_Muffler_Adv( - 30001, - "hatch.muffler.adv.tier.01", - "Advanced Muffler Hatch (LV)", - 1)).getStackForm(1L)); - GregtechItemList.Hatch_Muffler_Adv_MV.set( - (new GT_MetaTileEntity_Hatch_Muffler_Adv( - 30002, - "hatch.muffler.adv.tier.02", - "Advanced Muffler Hatch (MV)", - 2)).getStackForm(1L)); - GregtechItemList.Hatch_Muffler_Adv_HV.set( - (new GT_MetaTileEntity_Hatch_Muffler_Adv( - 30003, - "hatch.muffler.adv.tier.03", - "Advanced Muffler Hatch (HV)", - 3)).getStackForm(1L)); - GregtechItemList.Hatch_Muffler_Adv_EV.set( - (new GT_MetaTileEntity_Hatch_Muffler_Adv( - 30004, - "hatch.muffler.adv.tier.04", - "Advanced Muffler Hatch (EV)", - 4)).getStackForm(1L)); - GregtechItemList.Hatch_Muffler_Adv_IV.set( - (new GT_MetaTileEntity_Hatch_Muffler_Adv( - 30005, - "hatch.muffler.adv.tier.05", - "Advanced Muffler Hatch (IV)", - 5)).getStackForm(1L)); - GregtechItemList.Hatch_Muffler_Adv_LuV.set( - (new GT_MetaTileEntity_Hatch_Muffler_Adv( - 30006, - "hatch.muffler.adv.tier.06", - "Advanced Muffler Hatch (LuV)", - 6)).getStackForm(1L)); - GregtechItemList.Hatch_Muffler_Adv_ZPM.set( - (new GT_MetaTileEntity_Hatch_Muffler_Adv( - 30007, - "hatch.muffler.adv.tier.07", - "Advanced Muffler Hatch (ZPM)", - 7)).getStackForm(1L)); - GregtechItemList.Hatch_Muffler_Adv_UV.set( - (new GT_MetaTileEntity_Hatch_Muffler_Adv( - 30008, - "hatch.muffler.adv.tier.08", - "Advanced Muffler Hatch (UV)", - 8)).getStackForm(1L)); - GregtechItemList.Hatch_Muffler_Adv_MAX.set( - (new GT_MetaTileEntity_Hatch_Muffler_Adv( - 30009, - "hatch.muffler.adv.tier.09", - "Advanced Muffler Hatch (UHV)", - 9)).getStackForm(1L)); - } - - private static void run3() { - /* - * Super Input Busses - */ - - int aStartID = 30022; - - GregtechItemList.Hatch_SuperBus_Input_LV.set( - ((IMetaTileEntity) makeInputBus(aStartID++, "hatch.superbus.input.tier.01", "Super Bus (I) (LV)", 1)) - .getStackForm(1L)); - GregtechItemList.Hatch_SuperBus_Input_MV.set( - ((IMetaTileEntity) makeInputBus(aStartID++, "hatch.superbus.input.tier.02", "Super Bus (I) (MV)", 2)) - .getStackForm(1L)); - GregtechItemList.Hatch_SuperBus_Input_HV.set( - ((IMetaTileEntity) makeInputBus(aStartID++, "hatch.superbus.input.tier.03", "Super Bus (I) (HV)", 3)) - .getStackForm(1L)); - GregtechItemList.Hatch_SuperBus_Input_EV.set( - ((IMetaTileEntity) makeInputBus(aStartID++, "hatch.superbus.input.tier.04", "Super Bus (I) (EV)", 4)) - .getStackForm(1L)); - GregtechItemList.Hatch_SuperBus_Input_IV.set( - ((IMetaTileEntity) makeInputBus(aStartID++, "hatch.superbus.input.tier.05", "Super Bus (I) (IV)", 5)) - .getStackForm(1L)); - GregtechItemList.Hatch_SuperBus_Input_LuV.set( - ((IMetaTileEntity) makeInputBus(aStartID++, "hatch.superbus.input.tier.06", "Super Bus (I) (LuV)", 6)) - .getStackForm(1L)); - GregtechItemList.Hatch_SuperBus_Input_ZPM.set( - ((IMetaTileEntity) makeInputBus(aStartID++, "hatch.superbus.input.tier.07", "Super Bus (I) (ZPM)", 7)) - .getStackForm(1L)); - GregtechItemList.Hatch_SuperBus_Input_UV.set( - ((IMetaTileEntity) makeInputBus(aStartID++, "hatch.superbus.input.tier.08", "Super Bus (I) (UV)", 8)) - .getStackForm(1L)); - GregtechItemList.Hatch_SuperBus_Input_MAX.set( - ((IMetaTileEntity) makeInputBus(aStartID, "hatch.superbus.input.tier.09", "Super Bus (I) (UHV)", 9)) - .getStackForm(1L)); - - /* - * Super Output Busses - */ - aStartID = 30032; - GregtechItemList.Hatch_SuperBus_Output_LV.set( - ((IMetaTileEntity) makeOutputBus(aStartID++, "hatch.superbus.output.tier.01", "Super Bus (O) (LV)", 1)) - .getStackForm(1L)); - GregtechItemList.Hatch_SuperBus_Output_MV.set( - ((IMetaTileEntity) makeOutputBus(aStartID++, "hatch.superbus.output.tier.02", "Super Bus (O) (MV)", 2)) - .getStackForm(1L)); - GregtechItemList.Hatch_SuperBus_Output_HV.set( - ((IMetaTileEntity) makeOutputBus(aStartID++, "hatch.superbus.output.tier.03", "Super Bus (O) (HV)", 3)) - .getStackForm(1L)); - GregtechItemList.Hatch_SuperBus_Output_EV.set( - ((IMetaTileEntity) makeOutputBus(aStartID++, "hatch.superbus.output.tier.04", "Super Bus (O) (EV)", 4)) - .getStackForm(1L)); - GregtechItemList.Hatch_SuperBus_Output_IV.set( - ((IMetaTileEntity) makeOutputBus(aStartID++, "hatch.superbus.output.tier.05", "Super Bus (O) (IV)", 5)) - .getStackForm(1L)); - GregtechItemList.Hatch_SuperBus_Output_LuV.set( - ((IMetaTileEntity) makeOutputBus(aStartID++, "hatch.superbus.output.tier.06", "Super Bus (O) (LuV)", 6)) - .getStackForm(1L)); - GregtechItemList.Hatch_SuperBus_Output_ZPM.set( - ((IMetaTileEntity) makeOutputBus(aStartID++, "hatch.superbus.output.tier.07", "Super Bus (O) (ZPM)", 7)) - .getStackForm(1L)); - GregtechItemList.Hatch_SuperBus_Output_UV.set( - ((IMetaTileEntity) makeOutputBus(aStartID++, "hatch.superbus.output.tier.08", "Super Bus (O) (UV)", 8)) - .getStackForm(1L)); - GregtechItemList.Hatch_SuperBus_Output_MAX.set( - ((IMetaTileEntity) makeOutputBus(aStartID, "hatch.superbus.output.tier.09", "Super Bus (O) (UHV)", 9)) - .getStackForm(1L)); - } - - private static GT_MetaTileEntity_SuperBus_Input makeInputBus(int id, String unlocalizedName, String localizedName, - int tier) { - return new GT_MetaTileEntity_SuperBus_Input(id, unlocalizedName, localizedName, tier); - } - - private static GT_MetaTileEntity_SuperBus_Output makeOutputBus(int id, String unlocalizedName, String localizedName, - int tier) { - return new GT_MetaTileEntity_SuperBus_Output(id, unlocalizedName, localizedName, tier); - } - - private static GT_MetaTileEntity_ChiselBus makeChiselBus(int id, String unlocalizedName, String localizedName, - int tier) { - return new GT_MetaTileEntity_ChiselBus(id, unlocalizedName, localizedName, tier); - } - - private static void run4() { - int aID = 31778; // 31778 - 31780 - - GregtechItemList.GT_MetaTileEntity_ChiselBus_LV - .set((makeChiselBus(aID++, "hatch.chisel.tier.01", "Chisel Bus I", 1)).getStackForm(1L)); - GregtechItemList.GT_MetaTileEntity_ChiselBus_MV - .set((makeChiselBus(aID++, "hatch.chisel.tier.02", "Chisel Bus II", 2)).getStackForm(1L)); - GregtechItemList.GT_MetaTileEntity_ChiselBus_HV - .set((makeChiselBus(aID++, "hatch.chisel.tier.03", "Chisel Bus III", 3)).getStackForm(1L)); - - } - - private static void run6() { - int aID = 31781; // 31781-31784 - - GregtechItemList.GT_MetaTileEntity_Solidifier_I.set( - new GT_MetaTileEntity_Hatch_Solidifier(aID++, "hatch.solidifier.tier.05", "Solidifier Hatch I", 5) - .getStackForm(1L)); - GregtechItemList.GT_MetaTileEntity_Solidifier_II.set( - new GT_MetaTileEntity_Hatch_Solidifier(aID++, "hatch.solidifier.tier.06", "Solidifier Hatch II", 6) - .getStackForm(1L)); - GregtechItemList.GT_MetaTileEntity_Solidifier_III.set( - new GT_MetaTileEntity_Hatch_Solidifier(aID++, "hatch.solidifier.tier.07", "Solidifier Hatch III", 7) - .getStackForm(1L)); - GregtechItemList.GT_MetaTileEntity_Solidifier_IV.set( - new GT_MetaTileEntity_Hatch_Solidifier(aID, "hatch.solidifier.tier.08", "Solidifier Hatch IV", 8) - .getStackForm(1L)); - } - -} diff --git a/gtpp/src/main/java/gtPlusPlus/xmod/gregtech/registration/gregtech/GregtechCyclotron.java b/gtpp/src/main/java/gtPlusPlus/xmod/gregtech/registration/gregtech/GregtechCyclotron.java deleted file mode 100644 index 7a8c160feb..0000000000 --- a/gtpp/src/main/java/gtPlusPlus/xmod/gregtech/registration/gregtech/GregtechCyclotron.java +++ /dev/null @@ -1,19 +0,0 @@ -package gtPlusPlus.xmod.gregtech.registration.gregtech; - -import gtPlusPlus.api.objects.Logger; -import gtPlusPlus.xmod.gregtech.api.enums.GregtechItemList; -import gtPlusPlus.xmod.gregtech.common.tileentities.machines.multi.production.GregtechMetaTileEntity_Cyclotron; - -public class GregtechCyclotron { - - public static void run() { - Logger.INFO("Gregtech5u Content | Registering COMET Cyclotron."); - run1(); - } - - private static void run1() { - GregtechItemList.COMET_Cyclotron.set( - new GregtechMetaTileEntity_Cyclotron(828, "cyclotron.tier.single", "COMET - Compact Cyclotron", 6) - .getStackForm(1L)); - } -} diff --git a/gtpp/src/main/java/gtPlusPlus/xmod/gregtech/registration/gregtech/GregtechDehydrator.java b/gtpp/src/main/java/gtPlusPlus/xmod/gregtech/registration/gregtech/GregtechDehydrator.java deleted file mode 100644 index 4fccef139e..0000000000 --- a/gtpp/src/main/java/gtPlusPlus/xmod/gregtech/registration/gregtech/GregtechDehydrator.java +++ /dev/null @@ -1,199 +0,0 @@ -package gtPlusPlus.xmod.gregtech.registration.gregtech; - -import static gregtech.api.metatileentity.implementations.GT_MetaTileEntity_BasicMachine_GT_Recipe.X.CIRCUIT; -import static gregtech.api.metatileentity.implementations.GT_MetaTileEntity_BasicMachine_GT_Recipe.X.HULL; -import static gregtech.api.metatileentity.implementations.GT_MetaTileEntity_BasicMachine_GT_Recipe.X.ROBOT_ARM; -import static gregtech.api.recipe.RecipeMaps.assemblerRecipes; -import static gregtech.api.util.GT_RecipeBuilder.SECONDS; - -import net.minecraft.item.ItemStack; - -import gregtech.api.enums.GT_Values; -import gregtech.api.enums.Materials; -import gregtech.api.enums.OrePrefixes; -import gregtech.api.enums.SoundResource; -import gregtech.api.enums.TierEU; -import gregtech.api.metatileentity.implementations.GT_MetaTileEntity_BasicMachine_GT_Recipe; -import gregtech.api.metatileentity.implementations.GT_MetaTileEntity_BasicMachine_GT_Recipe.SpecialEffects; -import gregtech.api.util.GT_OreDictUnificator; -import gtPlusPlus.api.objects.Logger; -import gtPlusPlus.api.recipe.GTPPRecipeMaps; -import gtPlusPlus.core.item.ModItems; -import gtPlusPlus.core.lib.CORE; -import gtPlusPlus.core.material.ALLOY; -import gtPlusPlus.xmod.gregtech.api.enums.GregtechItemList; -import gtPlusPlus.xmod.gregtech.common.tileentities.machines.multi.processing.GregtechMetaTileEntity_IndustrialDehydrator; - -public class GregtechDehydrator { - - public static void run() { - Logger.INFO("Gregtech5u Content | Registering Chemical Dehydrators."); - if (CORE.ConfigSwitches.enableMachine_Dehydrators) { - run1(); - } - } - - private static void run1() { - ItemStack coilT1 = new ItemStack(ModItems.itemDehydratorCoil, 1, 0); - ItemStack coilT2 = new ItemStack(ModItems.itemDehydratorCoil, 1, 1); - ItemStack coilT3 = new ItemStack(ModItems.itemDehydratorCoil, 1, 2); - ItemStack coilT4 = new ItemStack(ModItems.itemDehydratorCoil, 1, 3); - - // Make some coils by wrapping wire around a spool. - GT_Values.RA.stdBuilder() - .itemInputs( - new ItemStack(ModItems.itemDehydratorCoilWire, 4, 0), - GT_OreDictUnificator.get(OrePrefixes.pipeMedium, Materials.Bronze, 1)) - .itemOutputs(coilT1) - .duration(8 * SECONDS) - .eut(TierEU.RECIPE_MV) - .addTo(assemblerRecipes); - GT_Values.RA.stdBuilder() - .itemInputs( - new ItemStack(ModItems.itemDehydratorCoilWire, 4, 1), - GT_OreDictUnificator.get(OrePrefixes.pipeMedium, Materials.Steel, 1)) - .itemOutputs(coilT2) - .duration(8 * SECONDS) - .eut(TierEU.RECIPE_HV / 2) - .addTo(assemblerRecipes); - GT_Values.RA.stdBuilder() - .itemInputs( - new ItemStack(ModItems.itemDehydratorCoilWire, 4, 2), - GT_OreDictUnificator.get(OrePrefixes.pipeMedium, Materials.StainlessSteel, 1)) - .itemOutputs(coilT3) - .duration(8 * SECONDS) - .eut(TierEU.RECIPE_HV) - .addTo(assemblerRecipes); - GT_Values.RA.stdBuilder() - .itemInputs( - new ItemStack(ModItems.itemDehydratorCoilWire, 4, 3), - GT_OreDictUnificator.get(OrePrefixes.pipeMedium, Materials.Titanium, 1)) - .itemOutputs(coilT4) - .duration(8 * SECONDS) - .eut(TierEU.RECIPE_EV / 2) - .addTo(assemblerRecipes); - - // Basic - GregtechItemList.GT_Dehydrator_MV.set( - new GT_MetaTileEntity_BasicMachine_GT_Recipe( - 911, - "machine.dehydrator.tier.00", - "Basic Dehydrator I", - 2, - new String[] { "This dehydrates your Grapes into Raisins.", CORE.GT_Tooltip.get() }, - GTPPRecipeMaps.chemicalDehydratorRecipes, - 2, - 9, - true, - SoundResource.NONE, - SpecialEffects.NONE, - "DEHYDRATOR", - new Object[] { "ECE", "WMW", "GPG", 'M', HULL, 'P', ROBOT_ARM, 'E', - OrePrefixes.wireFine.get(Materials.RedAlloy), 'C', CIRCUIT, 'W', - OrePrefixes.cableGt04.get(Materials.Copper), 'G', OrePrefixes.gearGt.get(Materials.Steel) }) - .setRecipeCatalystPriority(6) - .getStackForm(1L)); - - GregtechItemList.GT_Dehydrator_HV.set( - new GT_MetaTileEntity_BasicMachine_GT_Recipe( - 912, - "machine.dehydrator.tier.01", - "Basic Dehydrator II", - 3, - new String[] { "This dehydrates your Grapes into Raisins.", CORE.GT_Tooltip.get() }, - GTPPRecipeMaps.chemicalDehydratorRecipes, - 2, - 9, - true, - SoundResource.NONE, - SpecialEffects.NONE, - "DEHYDRATOR", - new Object[] { "ECE", "WMW", "GPG", 'M', HULL, 'P', ROBOT_ARM, 'E', - OrePrefixes.wireFine.get(Materials.Electrum), 'C', CIRCUIT, 'W', - OrePrefixes.cableGt04.get(Materials.Silver), 'G', ALLOY.POTIN.getGear(1) }) - .setRecipeCatalystPriority(5) - .getStackForm(1L)); - - // Chemical - GregtechItemList.GT_Dehydrator_EV.set( - new GT_MetaTileEntity_BasicMachine_GT_Recipe( - 813, - "advancedmachine.dehydrator.tier.01", - "Chemical Dehydrator I", - 4, - new String[] { "A hangover is the way your body reacts to dehydration.", CORE.GT_Tooltip.get() }, - GTPPRecipeMaps.chemicalDehydratorRecipes, - 2, - 9, - true, - SoundResource.NONE, - SpecialEffects.NONE, - "DEHYDRATOR", - new Object[] { "ECE", "WMW", "GPG", 'M', HULL, 'P', ROBOT_ARM, 'E', coilT1, 'C', CIRCUIT, 'W', - OrePrefixes.cableGt04.get(Materials.Aluminium), 'G', ALLOY.TUMBAGA.getGear(1) }) - .setRecipeCatalystPriority(4) - .getStackForm(1L)); - - GregtechItemList.GT_Dehydrator_IV.set( - new GT_MetaTileEntity_BasicMachine_GT_Recipe( - 814, - "advancedmachine.dehydrator.tier.02", - "Chemical Dehydrator II", - 5, - new String[] { "A hangover is the way your body reacts to dehydration.", CORE.GT_Tooltip.get() }, - GTPPRecipeMaps.chemicalDehydratorRecipes, - 2, - 9, - true, - SoundResource.NONE, - SpecialEffects.NONE, - "DEHYDRATOR", - new Object[] { "ECE", "WMW", "GPG", 'M', HULL, 'P', ROBOT_ARM, 'E', coilT2, 'C', CIRCUIT, 'W', - OrePrefixes.cableGt04.get(Materials.Tungsten), 'G', ALLOY.INCONEL_690.getGear(1) }) - .setRecipeCatalystPriority(3) - .getStackForm(1L)); - - GregtechItemList.GT_Dehydrator_LuV.set( - new GT_MetaTileEntity_BasicMachine_GT_Recipe( - 815, - "advancedmachine.dehydrator.tier.03", - "Chemical Dehydrator III", - 6, - new String[] { "You could probably make space icecream with this..", CORE.GT_Tooltip.get() }, - GTPPRecipeMaps.chemicalDehydratorRecipes, - 2, - 9, - true, - SoundResource.NONE, - SpecialEffects.NONE, - "DEHYDRATOR", - new Object[] { "ECE", "WMW", "GPG", 'M', HULL, 'P', ROBOT_ARM, 'E', coilT3, 'C', CIRCUIT, 'W', - OrePrefixes.cableGt04.get(Materials.Naquadah), 'G', ALLOY.HASTELLOY_N.getGear(1) }) - .setRecipeCatalystPriority(2) - .getStackForm(1L)); - - GregtechItemList.GT_Dehydrator_ZPM.set( - new GT_MetaTileEntity_BasicMachine_GT_Recipe( - 816, - "advancedmachine.dehydrator.tier.04", - "Chemical Dehydrator IV", - 7, - new String[] { "You can definitely make space icecream with this..", CORE.GT_Tooltip.get() }, - GTPPRecipeMaps.chemicalDehydratorRecipes, - 2, - 9, - true, - SoundResource.NONE, - SpecialEffects.NONE, - "DEHYDRATOR", - new Object[] { "ECE", "WMW", "GPG", 'M', HULL, 'P', ROBOT_ARM, 'E', coilT4, 'C', CIRCUIT, 'W', - OrePrefixes.cableGt04.get(Materials.Osmium), 'G', ALLOY.ZERON_100.getGear(1) }) - .setRecipeCatalystPriority(1) - .getStackForm(1L)); - - // Advanced - GregtechItemList.Controller_Vacuum_Furnace.set( - new GregtechMetaTileEntity_IndustrialDehydrator(995, "multimachine.adv.vacuumfurnace", "Utupu-Tanuri") - .getStackForm(1L)); - } -} diff --git a/gtpp/src/main/java/gtPlusPlus/xmod/gregtech/registration/gregtech/GregtechEnergyBuffer.java b/gtpp/src/main/java/gtPlusPlus/xmod/gregtech/registration/gregtech/GregtechEnergyBuffer.java deleted file mode 100644 index 4aebd8a7b5..0000000000 --- a/gtpp/src/main/java/gtPlusPlus/xmod/gregtech/registration/gregtech/GregtechEnergyBuffer.java +++ /dev/null @@ -1,149 +0,0 @@ -package gtPlusPlus.xmod.gregtech.registration.gregtech; - -import gregtech.api.enums.ItemList; -import gregtech.api.enums.Materials; -import gregtech.api.enums.OrePrefixes; -import gregtech.api.util.GT_ModHandler; -import gtPlusPlus.api.objects.Logger; -import gtPlusPlus.xmod.gregtech.api.enums.GregtechItemList; -import gtPlusPlus.xmod.gregtech.api.enums.GregtechOreDictNames; -import gtPlusPlus.xmod.gregtech.common.tileentities.storage.GregtechMetaEnergyBuffer; - -public class GregtechEnergyBuffer { - - // Misc Items - // public static Item itemBufferCore; - - public static void run() { - Logger.INFO("Gregtech5u Content | Registering Energy Buffer Blocks."); - run1(); - } - - private static void run1() { - - // itemBufferCore = new - // Item().setUnlocalizedName("itemBufferCore").setCreativeTab(AddToCreativeTab.tabMisc).setTextureName(GTPlusPlus.ID - // + ":itemBufferCore"); - - // Registry - // GameRegistry.registerItem(itemBufferCore, "itemBufferCore"); - // LanguageRegistry.addName(itemBufferCore, "Buffer Core"); - // OreDictionary.registerOre("itemBufferCore", itemBufferCore); - - // Energy Buffers - GregtechItemList.Energy_Buffer_1by1_ULV.set( - new GregtechMetaEnergyBuffer(770, "energybuffer.tier.00", "Ultra Low Voltage Energy Buffer", 0, "", 1) - .getStackForm(1L)); - GregtechItemList.Energy_Buffer_1by1_LV.set( - new GregtechMetaEnergyBuffer(771, "energybuffer.tier.01", "Low Voltage Energy Buffer", 1, "", 1) - .getStackForm(1L)); - GregtechItemList.Energy_Buffer_1by1_MV.set( - new GregtechMetaEnergyBuffer(772, "energybuffer.tier.02", "Medium Voltage Energy Buffer", 2, "", 1) - .getStackForm(1L)); - GregtechItemList.Energy_Buffer_1by1_HV.set( - new GregtechMetaEnergyBuffer(773, "energybuffer.tier.03", "High Voltage Energy Buffer", 3, "", 1) - .getStackForm(1L)); - GregtechItemList.Energy_Buffer_1by1_EV.set( - new GregtechMetaEnergyBuffer(774, "energybuffer.tier.04", "Extreme Voltage Energy Buffer", 4, "", 1) - .getStackForm(1L)); - GregtechItemList.Energy_Buffer_1by1_IV.set( - new GregtechMetaEnergyBuffer(775, "energybuffer.tier.05", "Insane Voltage Energy Buffer", 5, "", 1) - .getStackForm(1L)); - GregtechItemList.Energy_Buffer_1by1_LuV.set( - new GregtechMetaEnergyBuffer(776, "energybuffer.tier.06", "Ludicrous Voltage Energy Buffer", 6, "", 1) - .getStackForm(1L)); - GregtechItemList.Energy_Buffer_1by1_ZPM.set( - new GregtechMetaEnergyBuffer(777, "energybuffer.tier.07", "ZPM Voltage Energy Buffer", 7, "", 1) - .getStackForm(1L)); - GregtechItemList.Energy_Buffer_1by1_UV.set( - new GregtechMetaEnergyBuffer(778, "energybuffer.tier.08", "Ultimate Voltage Energy Buffer", 8, "", 1) - .getStackForm(1L)); - GregtechItemList.Energy_Buffer_1by1_MAX.set( - new GregtechMetaEnergyBuffer(779, "energybuffer.tier.09", "MAX Voltage Energy Buffer", 9, "", 1) - .getStackForm(1L)); - - GT_ModHandler.addCraftingRecipe( - GregtechItemList.Energy_Buffer_1by1_ULV.get(1L, new Object[0]), - GT_ModHandler.RecipeBits.DISMANTLEABLE | GT_ModHandler.RecipeBits.NOT_REMOVABLE - | GT_ModHandler.RecipeBits.REVERSIBLE - | GT_ModHandler.RecipeBits.BUFFERED, - new Object[] { "WTW", "WMW", Character.valueOf('M'), ItemList.Hull_ULV, Character.valueOf('W'), - OrePrefixes.wireGt08.get(Materials.Lead), Character.valueOf('T'), GregtechOreDictNames.buffer_core }); - GT_ModHandler.addCraftingRecipe( - GregtechItemList.Energy_Buffer_1by1_LV.get(1L, new Object[0]), - GT_ModHandler.RecipeBits.DISMANTLEABLE | GT_ModHandler.RecipeBits.NOT_REMOVABLE - | GT_ModHandler.RecipeBits.REVERSIBLE - | GT_ModHandler.RecipeBits.BUFFERED, - new Object[] { "WTW", "WMW", Character.valueOf('M'), ItemList.Hull_LV, Character.valueOf('W'), - OrePrefixes.wireGt08.get(Materials.Tin), Character.valueOf('T'), GregtechOreDictNames.buffer_core }); - GT_ModHandler.addCraftingRecipe( - GregtechItemList.Energy_Buffer_1by1_MV.get(1L, new Object[0]), - GT_ModHandler.RecipeBits.DISMANTLEABLE | GT_ModHandler.RecipeBits.NOT_REMOVABLE - | GT_ModHandler.RecipeBits.REVERSIBLE - | GT_ModHandler.RecipeBits.BUFFERED, - new Object[] { "WTW", "WMW", Character.valueOf('M'), ItemList.Hull_MV, Character.valueOf('W'), - OrePrefixes.wireGt08.get(Materials.AnyCopper), Character.valueOf('T'), - GregtechOreDictNames.buffer_core }); - GT_ModHandler.addCraftingRecipe( - GregtechItemList.Energy_Buffer_1by1_HV.get(1L, new Object[0]), - GT_ModHandler.RecipeBits.DISMANTLEABLE | GT_ModHandler.RecipeBits.NOT_REMOVABLE - | GT_ModHandler.RecipeBits.REVERSIBLE - | GT_ModHandler.RecipeBits.BUFFERED, - new Object[] { "WTW", "WMW", Character.valueOf('M'), ItemList.Hull_HV, Character.valueOf('W'), - OrePrefixes.wireGt08.get(Materials.Gold), Character.valueOf('T'), GregtechOreDictNames.buffer_core }); - GT_ModHandler.addCraftingRecipe( - GregtechItemList.Energy_Buffer_1by1_EV.get(1L, new Object[0]), - GT_ModHandler.RecipeBits.DISMANTLEABLE | GT_ModHandler.RecipeBits.NOT_REMOVABLE - | GT_ModHandler.RecipeBits.REVERSIBLE - | GT_ModHandler.RecipeBits.BUFFERED, - new Object[] { "WTW", "WMW", Character.valueOf('M'), ItemList.Hull_EV, Character.valueOf('W'), - OrePrefixes.wireGt08.get(Materials.Aluminium), Character.valueOf('T'), - GregtechOreDictNames.buffer_core }); - GT_ModHandler.addCraftingRecipe( - GregtechItemList.Energy_Buffer_1by1_IV.get(1L, new Object[0]), - GT_ModHandler.RecipeBits.DISMANTLEABLE | GT_ModHandler.RecipeBits.NOT_REMOVABLE - | GT_ModHandler.RecipeBits.REVERSIBLE - | GT_ModHandler.RecipeBits.BUFFERED, - new Object[] { "WTW", "WMW", Character.valueOf('M'), ItemList.Hull_IV, Character.valueOf('W'), - OrePrefixes.wireGt08.get(Materials.Tungsten), Character.valueOf('T'), - GregtechOreDictNames.buffer_core }); - GT_ModHandler.addCraftingRecipe( - GregtechItemList.Energy_Buffer_1by1_LuV.get(1L, new Object[0]), - GT_ModHandler.RecipeBits.DISMANTLEABLE | GT_ModHandler.RecipeBits.NOT_REMOVABLE - | GT_ModHandler.RecipeBits.REVERSIBLE - | GT_ModHandler.RecipeBits.BUFFERED, - new Object[] { "WTW", "WMW", Character.valueOf('M'), ItemList.Hull_LuV, Character.valueOf('W'), - OrePrefixes.wireGt08.get(Materials.Osmium), Character.valueOf('T'), GregtechOreDictNames.buffer_core }); - GT_ModHandler.addCraftingRecipe( - GregtechItemList.Energy_Buffer_1by1_ZPM.get(1L, new Object[0]), - GT_ModHandler.RecipeBits.DISMANTLEABLE | GT_ModHandler.RecipeBits.NOT_REMOVABLE - | GT_ModHandler.RecipeBits.REVERSIBLE - | GT_ModHandler.RecipeBits.BUFFERED, - new Object[] { "WTW", "WMW", Character.valueOf('M'), ItemList.Hull_ZPM, Character.valueOf('W'), - OrePrefixes.wireGt08.get(Materials.Osmium), Character.valueOf('T'), GregtechOreDictNames.buffer_core }); - GT_ModHandler.addCraftingRecipe( - GregtechItemList.Energy_Buffer_1by1_UV.get(1L, new Object[0]), - GT_ModHandler.RecipeBits.DISMANTLEABLE | GT_ModHandler.RecipeBits.NOT_REMOVABLE - | GT_ModHandler.RecipeBits.REVERSIBLE - | GT_ModHandler.RecipeBits.BUFFERED, - new Object[] { "WTW", "WMW", Character.valueOf('M'), ItemList.Hull_UV, Character.valueOf('W'), - OrePrefixes.wireGt08.get(Materials.Osmium), Character.valueOf('T'), GregtechOreDictNames.buffer_core }); - GT_ModHandler.addCraftingRecipe( - GregtechItemList.Energy_Buffer_1by1_MAX.get(1L, new Object[0]), - GT_ModHandler.RecipeBits.DISMANTLEABLE | GT_ModHandler.RecipeBits.NOT_REMOVABLE - | GT_ModHandler.RecipeBits.REVERSIBLE - | GT_ModHandler.RecipeBits.BUFFERED, - new Object[] { "WTW", "WMW", Character.valueOf('M'), ItemList.Hull_MAX, Character.valueOf('W'), - OrePrefixes.wireGt08.get(Materials.SuperconductorUHV), Character.valueOf('T'), - GregtechOreDictNames.buffer_core }); - /* - * GT_ModHandler.addCraftingRecipe( GregtechItemList.Energy_Buffer_1by1_MAX.get(1L, new Object[0]), - * GT_ModHandler.RecipeBits.DISMANTLEABLE | GT_ModHandler.RecipeBits.NOT_REMOVABLE | - * GT_ModHandler.RecipeBits.REVERSIBLE | GT_ModHandler.RecipeBits.BUFFERED, new Object[] { "WTW", "WMW", - * Character.valueOf('M'), ItemList.Hull_MAX, Character.valueOf('W'), - * OrePrefixes.wireGt08.get(Materials.Superconductor), Character.valueOf('T'), GregtechOreDictNames.buffer_core - * }); - */ - - } -} diff --git a/gtpp/src/main/java/gtPlusPlus/xmod/gregtech/registration/gregtech/GregtechFactoryGradeReplacementMultis.java b/gtpp/src/main/java/gtPlusPlus/xmod/gregtech/registration/gregtech/GregtechFactoryGradeReplacementMultis.java deleted file mode 100644 index 6117631244..0000000000 --- a/gtpp/src/main/java/gtPlusPlus/xmod/gregtech/registration/gregtech/GregtechFactoryGradeReplacementMultis.java +++ /dev/null @@ -1,44 +0,0 @@ -package gtPlusPlus.xmod.gregtech.registration.gregtech; - -import gtPlusPlus.api.objects.Logger; -import gtPlusPlus.xmod.gregtech.api.enums.GregtechItemList; -import gtPlusPlus.xmod.gregtech.common.tileentities.machines.multi.processing.GregtechMetaTileEntity_IndustrialVacuumFreezer; -import gtPlusPlus.xmod.gregtech.common.tileentities.machines.multi.processing.advanced.GregtechMetaTileEntity_Adv_DistillationTower; -import gtPlusPlus.xmod.gregtech.common.tileentities.machines.multi.processing.advanced.GregtechMetaTileEntity_Adv_EBF; -import gtPlusPlus.xmod.gregtech.common.tileentities.machines.multi.processing.advanced.GregtechMetaTileEntity_Adv_Fusion_MK4; -import gtPlusPlus.xmod.gregtech.common.tileentities.machines.multi.processing.advanced.GregtechMetaTileEntity_Adv_Fusion_MK5; -import gtPlusPlus.xmod.gregtech.common.tileentities.machines.multi.processing.advanced.GregtechMetaTileEntity_Adv_Implosion; - -public class GregtechFactoryGradeReplacementMultis { - - public static void run() { - run1(); - } - - private static void run1() { - Logger.INFO("Gregtech 5 Content | Registering Advanced GT Multiblock replacements."); - GregtechItemList.Machine_Adv_BlastFurnace - .set(new GregtechMetaTileEntity_Adv_EBF(963, "multimachine.adv.blastfurnace", "Volcanus").getStackForm(1L)); - GregtechItemList.Machine_Adv_ImplosionCompressor.set( - new GregtechMetaTileEntity_Adv_Implosion(964, "multimachine.adv.implosioncompressor", "Density^2") - .getStackForm(1L)); - GregtechItemList.Industrial_Cryogenic_Freezer.set( - new GregtechMetaTileEntity_IndustrialVacuumFreezer( - 910, - "multimachine.adv.industrialfreezer", - "Cryogenic Freezer").getStackForm(1L)); - GregtechItemList.FusionComputer_UV2.set( - new GregtechMetaTileEntity_Adv_Fusion_MK4(965, "fusioncomputer.tier.09", "FusionTech MK IV") - .getStackForm(1L)); - GregtechItemList.FusionComputer_UV3.set( - new GregtechMetaTileEntity_Adv_Fusion_MK5(975, "fusioncomputer.tier.10", "FusionTech MK V") - .getStackForm(1L)); - - // 31021 - GregtechItemList.Machine_Adv_DistillationTower.set( - new GregtechMetaTileEntity_Adv_DistillationTower( - 31021, - "multimachine.adv.distillationtower", - "Dangote Distillus").getStackForm(1L)); - } -} diff --git a/gtpp/src/main/java/gtPlusPlus/xmod/gregtech/registration/gregtech/GregtechGeothermalThermalGenerator.java b/gtpp/src/main/java/gtPlusPlus/xmod/gregtech/registration/gregtech/GregtechGeothermalThermalGenerator.java deleted file mode 100644 index 2e012ee7f9..0000000000 --- a/gtpp/src/main/java/gtPlusPlus/xmod/gregtech/registration/gregtech/GregtechGeothermalThermalGenerator.java +++ /dev/null @@ -1,78 +0,0 @@ -package gtPlusPlus.xmod.gregtech.registration.gregtech; - -import net.minecraft.item.ItemStack; - -import gregtech.api.enums.ItemList; -import gregtech.api.enums.Materials; -import gregtech.api.enums.OrePrefixes; -import gregtech.api.util.GT_ModHandler; -import gtPlusPlus.api.objects.Logger; -import gtPlusPlus.core.lib.CORE; -import gtPlusPlus.core.material.ALLOY; -import gtPlusPlus.core.recipe.common.CI; -import gtPlusPlus.xmod.gregtech.api.enums.GregtechItemList; -import gtPlusPlus.xmod.gregtech.common.tileentities.generators.GregtechMetaTileEntityGeothermalGenerator; - -public class GregtechGeothermalThermalGenerator { - - public static void run() { - Logger.INFO("Gregtech5u Content | Registering Industrial Geothermal Engines."); - if (CORE.ConfigSwitches.enableMachine_GeothermalEngines) { - run1(); - } - } - - private static void run1() { - GregtechItemList.Geothermal_Engine_EV.set( - new GregtechMetaTileEntityGeothermalGenerator( - 830, - "advancedgenerator.geothermalFuel.tier.01", - "Basic Geothermal Engine", - 4).getStackForm(1L)); - GregtechItemList.Geothermal_Engine_IV.set( - new GregtechMetaTileEntityGeothermalGenerator( - 831, - "advancedgenerator.geothermalFuel.tier.02", - "Turbo Geothermal Engine", - 5).getStackForm(1L)); - GregtechItemList.Geothermal_Engine_LuV.set( - new GregtechMetaTileEntityGeothermalGenerator( - 832, - "advancedgenerator.geothermalFuel.tier.03", - "Vulcan Geothermal Engine", - 6).getStackForm(1L)); - - GT_ModHandler.addCraftingRecipe( - GregtechItemList.Geothermal_Engine_EV.get(1L, new Object[0]), - GT_ModHandler.RecipeBits.DISMANTLEABLE | GT_ModHandler.RecipeBits.NOT_REMOVABLE - | GT_ModHandler.RecipeBits.REVERSIBLE - | GT_ModHandler.RecipeBits.BUFFERED, - new Object[] { "CEC", "GMG", "PWP", Character.valueOf('M'), ItemList.Hull_EV, Character.valueOf('P'), - ItemList.Electric_Piston_EV, Character.valueOf('E'), ItemList.Electric_Motor_EV, Character.valueOf('C'), - OrePrefixes.circuit.get(Materials.Ultimate), Character.valueOf('W'), - OrePrefixes.cableGt04.get(Materials.Aluminium), Character.valueOf('G'), - ALLOY.TANTALLOY_61.getGear(1) }); - - GT_ModHandler.addCraftingRecipe( - GregtechItemList.Geothermal_Engine_IV.get(1L, new Object[0]), - GT_ModHandler.RecipeBits.DISMANTLEABLE | GT_ModHandler.RecipeBits.NOT_REMOVABLE - | GT_ModHandler.RecipeBits.REVERSIBLE - | GT_ModHandler.RecipeBits.BUFFERED, - new Object[] { "CEC", "GMG", "PWP", Character.valueOf('M'), ItemList.Hull_IV, Character.valueOf('P'), - ItemList.Electric_Piston_IV, Character.valueOf('E'), ItemList.Electric_Motor_IV, Character.valueOf('C'), - OrePrefixes.circuit.get(Materials.SuperconductorUHV), Character.valueOf('W'), - OrePrefixes.cableGt04.get(Materials.Platinum), Character.valueOf('G'), ALLOY.STELLITE.getGear(1) }); - - final ItemStack INGREDIENT_1 = CI.electricPiston_LuV; - final ItemStack INGREDIENT_2 = CI.electricMotor_LuV; - GT_ModHandler.addCraftingRecipe( - GregtechItemList.Geothermal_Engine_LuV.get(1L, new Object[0]), - GT_ModHandler.RecipeBits.DISMANTLEABLE | GT_ModHandler.RecipeBits.NOT_REMOVABLE - | GT_ModHandler.RecipeBits.REVERSIBLE - | GT_ModHandler.RecipeBits.BUFFERED, - new Object[] { "CEC", "GMG", "PWP", Character.valueOf('M'), ItemList.Hull_LuV, Character.valueOf('P'), - INGREDIENT_1, Character.valueOf('E'), INGREDIENT_2, Character.valueOf('C'), - OrePrefixes.circuit.get(Materials.Infinite), Character.valueOf('W'), - OrePrefixes.cableGt04.get(Materials.Tungsten), Character.valueOf('G'), ALLOY.ZERON_100.getGear(1) }); - } -} diff --git a/gtpp/src/main/java/gtPlusPlus/xmod/gregtech/registration/gregtech/GregtechHiAmpTransformer.java b/gtpp/src/main/java/gtPlusPlus/xmod/gregtech/registration/gregtech/GregtechHiAmpTransformer.java deleted file mode 100644 index 2587cb8524..0000000000 --- a/gtpp/src/main/java/gtPlusPlus/xmod/gregtech/registration/gregtech/GregtechHiAmpTransformer.java +++ /dev/null @@ -1,163 +0,0 @@ -package gtPlusPlus.xmod.gregtech.registration.gregtech; - -import net.minecraft.item.ItemStack; - -import gregtech.api.GregTech_API; -import gregtech.api.enums.ItemList; -import gregtech.api.enums.Materials; -import gregtech.api.enums.OrePrefixes; -import gregtech.api.util.GT_ModHandler; -import gtPlusPlus.core.util.minecraft.ItemUtils; -import gtPlusPlus.xmod.gregtech.api.enums.GregtechItemList; -import gtPlusPlus.xmod.gregtech.api.metatileentity.implementations.base.GregtechMetaTransformerHiAmp; - -public class GregtechHiAmpTransformer { - - public static void run() { - - long bitsd = GT_ModHandler.RecipeBits.DISMANTLEABLE | GT_ModHandler.RecipeBits.NOT_REMOVABLE - | GT_ModHandler.RecipeBits.REVERSIBLE - | GT_ModHandler.RecipeBits.BUFFERED; - int mID = 877; - - String mHammerName = "Mallet"; - - GregtechItemList.Transformer_HA_LV_ULV.set( - new GregtechMetaTransformerHiAmp( - mID++, - "transformer.ha.tier.00", - "ULV Hi-Amp Transformer", - 0, - "LV -> ULV (Use Soft " + mHammerName + " to invert)").getStackForm(1L)); - GregtechItemList.Transformer_HA_MV_LV.set( - new GregtechMetaTransformerHiAmp( - mID++, - "transformer.ha.tier.01", - "LV Hi-Amp Transformer", - 1, - "MV -> LV (Use Soft " + mHammerName + " to invert)").getStackForm(1L)); - GregtechItemList.Transformer_HA_HV_MV.set( - new GregtechMetaTransformerHiAmp( - mID++, - "transformer.ha.tier.02", - "MV Hi-Amp Transformer", - 2, - "HV -> MV (Use Soft " + mHammerName + " to invert)").getStackForm(1L)); - GregtechItemList.Transformer_HA_EV_HV.set( - new GregtechMetaTransformerHiAmp( - mID++, - "transformer.ha.tier.03", - "HV Hi-Amp Transformer", - 3, - "EV -> HV (Use Soft " + mHammerName + " to invert)").getStackForm(1L)); - GregtechItemList.Transformer_HA_IV_EV.set( - new GregtechMetaTransformerHiAmp( - mID++, - "transformer.ha.tier.04", - "EV Hi-Amp Transformer", - 4, - "IV -> EV (Use Soft " + mHammerName + " to invert)").getStackForm(1L)); - GregtechItemList.Transformer_HA_LuV_IV.set( - new GregtechMetaTransformerHiAmp( - mID++, - "transformer.ha.tier.05", - "IV Hi-Amp Transformer", - 5, - "LuV -> IV (Use Soft " + mHammerName + " to invert)").getStackForm(1L)); - GregtechItemList.Transformer_HA_ZPM_LuV.set( - new GregtechMetaTransformerHiAmp( - mID++, - "transformer.ha.tier.06", - "LuV Hi-Amp Transformer", - 6, - "ZPM -> LuV (Use Soft " + mHammerName + " to invert)").getStackForm(1L)); - GregtechItemList.Transformer_HA_UV_ZPM.set( - new GregtechMetaTransformerHiAmp( - mID++, - "transformer.ha.tier.07", - "ZPM Hi-Amp Transformer", - 7, - "UV -> ZPM (Use Soft " + mHammerName + " to invert)").getStackForm(1L)); - GregtechItemList.Transformer_HA_MAX_UV.set( - new GregtechMetaTransformerHiAmp( - mID++, - "transformer.ha.tier.08", - "UV Hi-Amp Transformer", - 8, - "UHV -> UV (Use Soft " + mHammerName + " to invert)").getStackForm(1L)); - ItemStack mItem_1; - ItemStack mItem_2; - ItemStack mItem_3; - - mItem_1 = ItemUtils.simpleMetaStack( - ItemUtils.getSimpleStack(GregTech_API.sBlockCasings5) - .getItem(), - 3, - 1); - mItem_2 = ItemUtils.simpleMetaStack( - ItemUtils.getSimpleStack(GregTech_API.sBlockCasings5) - .getItem(), - 4, - 1); - mItem_3 = ItemUtils.simpleMetaStack( - ItemUtils.getSimpleStack(GregTech_API.sBlockCasings5) - .getItem(), - 9, - 1); - - GT_ModHandler.addCraftingRecipe( - GregtechItemList.Transformer_HA_LV_ULV.get(1L, new Object[0]), - bitsd, - new Object[] { " BB", "CM ", " BB", Character.valueOf('M'), ItemList.Transformer_LV_ULV, - Character.valueOf('C'), OrePrefixes.wireGt04.get(Materials.Tin), Character.valueOf('B'), - OrePrefixes.wireGt04.get(Materials.Lead) }); - GT_ModHandler.addCraftingRecipe( - GregtechItemList.Transformer_HA_MV_LV.get(1L, new Object[0]), - bitsd, - new Object[] { " BB", "CM ", " BB", Character.valueOf('M'), ItemList.Transformer_MV_LV, - Character.valueOf('C'), OrePrefixes.wireGt04.get(Materials.AnyCopper), Character.valueOf('B'), - OrePrefixes.wireGt04.get(Materials.Tin) }); - GT_ModHandler.addCraftingRecipe( - GregtechItemList.Transformer_HA_HV_MV.get(1L, new Object[0]), - bitsd, - new Object[] { " BB", "CM ", " BB", Character.valueOf('M'), ItemList.Transformer_HV_MV, - Character.valueOf('C'), OrePrefixes.wireGt04.get(Materials.Gold), Character.valueOf('B'), - OrePrefixes.wireGt04.get(Materials.AnyCopper) }); - GT_ModHandler.addCraftingRecipe( - GregtechItemList.Transformer_HA_EV_HV.get(1L, new Object[0]), - bitsd, - new Object[] { "KBB", "CM ", "KBB", Character.valueOf('M'), ItemList.Transformer_EV_HV, - Character.valueOf('C'), OrePrefixes.wireGt04.get(Materials.Aluminium), Character.valueOf('B'), - OrePrefixes.wireGt04.get(Materials.Gold), Character.valueOf('K'), ItemList.Casing_Coil_Cupronickel }); - GT_ModHandler.addCraftingRecipe( - GregtechItemList.Transformer_HA_IV_EV.get(1L, new Object[0]), - bitsd, - new Object[] { "KBB", "CM ", "KBB", Character.valueOf('M'), ItemList.Transformer_IV_EV, - Character.valueOf('C'), OrePrefixes.wireGt04.get(Materials.Tungsten), Character.valueOf('B'), - OrePrefixes.wireGt04.get(Materials.Aluminium), Character.valueOf('K'), ItemList.Casing_Coil_Kanthal }); - GT_ModHandler.addCraftingRecipe( - GregtechItemList.Transformer_HA_LuV_IV.get(1L, new Object[0]), - bitsd, - new Object[] { "KBB", "CM ", "KBB", Character.valueOf('M'), ItemList.Transformer_LuV_IV, - Character.valueOf('C'), OrePrefixes.wireGt04.get(Materials.VanadiumGallium), Character.valueOf('B'), - OrePrefixes.wireGt04.get(Materials.Tungsten), Character.valueOf('K'), ItemList.Casing_Coil_Nichrome }); - GT_ModHandler.addCraftingRecipe( - GregtechItemList.Transformer_HA_ZPM_LuV.get(1L, new Object[0]), - bitsd, - new Object[] { "KBB", "CM ", "KBB", Character.valueOf('M'), ItemList.Transformer_ZPM_LuV, - Character.valueOf('C'), OrePrefixes.wireGt04.get(Materials.Naquadah), Character.valueOf('B'), - OrePrefixes.wireGt04.get(Materials.VanadiumGallium), Character.valueOf('K'), mItem_1 }); - GT_ModHandler.addCraftingRecipe( - GregtechItemList.Transformer_HA_UV_ZPM.get(1L, new Object[0]), - bitsd, - new Object[] { "KBB", "CM ", "KBB", Character.valueOf('M'), ItemList.Transformer_UV_ZPM, - Character.valueOf('C'), OrePrefixes.wireGt04.get(Materials.NaquadahAlloy), Character.valueOf('B'), - OrePrefixes.wireGt04.get(Materials.Naquadah), Character.valueOf('K'), mItem_2 }); - GT_ModHandler.addCraftingRecipe( - GregtechItemList.Transformer_HA_MAX_UV.get(1L, new Object[0]), - bitsd, - new Object[] { "KBB", "CM ", "KBB", Character.valueOf('M'), ItemList.Transformer_MAX_UV, - Character.valueOf('C'), OrePrefixes.wireGt04.get(Materials.Bedrockium), Character.valueOf('B'), - OrePrefixes.wireGt04.get(Materials.NaquadahAlloy), Character.valueOf('K'), mItem_3 }); - } -} diff --git a/gtpp/src/main/java/gtPlusPlus/xmod/gregtech/registration/gregtech/GregtechIndustrialAlloySmelter.java b/gtpp/src/main/java/gtPlusPlus/xmod/gregtech/registration/gregtech/GregtechIndustrialAlloySmelter.java deleted file mode 100644 index dc176e7356..0000000000 --- a/gtpp/src/main/java/gtPlusPlus/xmod/gregtech/registration/gregtech/GregtechIndustrialAlloySmelter.java +++ /dev/null @@ -1,21 +0,0 @@ -package gtPlusPlus.xmod.gregtech.registration.gregtech; - -import gtPlusPlus.api.objects.Logger; -import gtPlusPlus.xmod.gregtech.api.enums.GregtechItemList; -import gtPlusPlus.xmod.gregtech.common.tileentities.machines.multi.processing.GregtechMetaTileEntity_IndustrialAlloySmelter; - -public class GregtechIndustrialAlloySmelter { - - public static void run() { - Logger.INFO("Gregtech5u Content | Registering Industrial Alloy Smelter Multiblock."); - run1(); - } - - private static void run1() { - GregtechItemList.Industrial_AlloySmelter.set( - new GregtechMetaTileEntity_IndustrialAlloySmelter( - 31023, - "industrialalloysmelter.controller.tier.single", - "Zyngen").getStackForm(1L)); - } -} diff --git a/gtpp/src/main/java/gtPlusPlus/xmod/gregtech/registration/gregtech/GregtechIndustrialArcFurnace.java b/gtpp/src/main/java/gtPlusPlus/xmod/gregtech/registration/gregtech/GregtechIndustrialArcFurnace.java deleted file mode 100644 index 3de3da7f88..0000000000 --- a/gtpp/src/main/java/gtPlusPlus/xmod/gregtech/registration/gregtech/GregtechIndustrialArcFurnace.java +++ /dev/null @@ -1,22 +0,0 @@ -package gtPlusPlus.xmod.gregtech.registration.gregtech; - -import gtPlusPlus.api.objects.Logger; -import gtPlusPlus.xmod.gregtech.api.enums.GregtechItemList; -import gtPlusPlus.xmod.gregtech.common.tileentities.machines.multi.processing.GregtechMetaTileEntity_IndustrialArcFurnace; - -public class GregtechIndustrialArcFurnace { - - public static void run() { - Logger.INFO("Gregtech5u Content | Registering Industrial Arc Furnace Multiblock."); - run1(); - } - - private static void run1() { - // Industrial Arc Furnace Multiblock - GregtechItemList.Industrial_Arc_Furnace.set( - new GregtechMetaTileEntity_IndustrialArcFurnace( - 862, - "industrialarcfurnace.controller.tier.single", - "High Current Industrial Arc Furnace").getStackForm(1L)); - } -} diff --git a/gtpp/src/main/java/gtPlusPlus/xmod/gregtech/registration/gregtech/GregtechIndustrialBlastSmelter.java b/gtpp/src/main/java/gtPlusPlus/xmod/gregtech/registration/gregtech/GregtechIndustrialBlastSmelter.java deleted file mode 100644 index e457575391..0000000000 --- a/gtpp/src/main/java/gtPlusPlus/xmod/gregtech/registration/gregtech/GregtechIndustrialBlastSmelter.java +++ /dev/null @@ -1,31 +0,0 @@ -package gtPlusPlus.xmod.gregtech.registration.gregtech; - -import gtPlusPlus.api.objects.Logger; -import gtPlusPlus.core.lib.CORE; -import gtPlusPlus.xmod.gregtech.api.enums.GregtechItemList; -import gtPlusPlus.xmod.gregtech.common.tileentities.machines.multi.production.GregtechMetaTileEntity_AlloyBlastSmelter; -import gtPlusPlus.xmod.gregtech.common.tileentities.machines.multi.production.mega.GregTechMetaTileEntity_MegaAlloyBlastSmelter; - -public class GregtechIndustrialBlastSmelter { - - public static void run() { - Logger.INFO("Gregtech5u Content | Registering Industrial Alloy Blast Smelter Multiblock."); - if (CORE.ConfigSwitches.enableMultiblock_AlloyBlastSmelter) { - run1(); - } - } - - private static void run1() { - // Industrial Alloy Blast Smelter Multiblock - GregtechItemList.Industrial_AlloyBlastSmelter.set( - new GregtechMetaTileEntity_AlloyBlastSmelter( - 810, - "industrialsalloyamelter.controller.tier.single", - "Alloy Blast Smelter").getStackForm(1L)); - GregtechItemList.Mega_AlloyBlastSmelter.set( - new GregTechMetaTileEntity_MegaAlloyBlastSmelter( - 31150, - "industrialsalloyamelter.controller.tier.mega", - "Mega Alloy Blast Smelter").getStackForm(1L)); - } -} diff --git a/gtpp/src/main/java/gtPlusPlus/xmod/gregtech/registration/gregtech/GregtechIndustrialCentrifuge.java b/gtpp/src/main/java/gtPlusPlus/xmod/gregtech/registration/gregtech/GregtechIndustrialCentrifuge.java deleted file mode 100644 index bc51aaae51..0000000000 --- a/gtpp/src/main/java/gtPlusPlus/xmod/gregtech/registration/gregtech/GregtechIndustrialCentrifuge.java +++ /dev/null @@ -1,25 +0,0 @@ -package gtPlusPlus.xmod.gregtech.registration.gregtech; - -import gtPlusPlus.api.objects.Logger; -import gtPlusPlus.core.lib.CORE; -import gtPlusPlus.xmod.gregtech.api.enums.GregtechItemList; -import gtPlusPlus.xmod.gregtech.common.tileentities.machines.multi.processing.GregtechMetaTileEntity_IndustrialCentrifuge; - -public class GregtechIndustrialCentrifuge { - - public static void run() { - Logger.INFO("Gregtech5u Content | Registering Industrial Centrifuge Multiblock."); - if (CORE.ConfigSwitches.enableMultiblock_IndustrialCentrifuge) { - run1(); - } - } - - private static void run1() { - // Industrial Centrifuge Multiblock - GregtechItemList.Industrial_Centrifuge.set( - new GregtechMetaTileEntity_IndustrialCentrifuge( - 790, - "industrialcentrifuge.controller.tier.single", - "Industrial Centrifuge").getStackForm(1L)); - } -} diff --git a/gtpp/src/main/java/gtPlusPlus/xmod/gregtech/registration/gregtech/GregtechIndustrialChisel.java b/gtpp/src/main/java/gtPlusPlus/xmod/gregtech/registration/gregtech/GregtechIndustrialChisel.java deleted file mode 100644 index ae0e2483cf..0000000000 --- a/gtpp/src/main/java/gtPlusPlus/xmod/gregtech/registration/gregtech/GregtechIndustrialChisel.java +++ /dev/null @@ -1,24 +0,0 @@ -package gtPlusPlus.xmod.gregtech.registration.gregtech; - -import gtPlusPlus.xmod.gregtech.api.enums.GregtechItemList; -import gtPlusPlus.xmod.gregtech.common.tileentities.machines.basic.GregtechMetaTileEntity_AutoChisel; -import gtPlusPlus.xmod.gregtech.common.tileentities.machines.multi.processing.GregtechMetaTileEntity_IndustrialChisel; - -public class GregtechIndustrialChisel { - - public static void run() { - GregtechItemList.GT_Chisel_LV.set( - new GregtechMetaTileEntity_AutoChisel(31066, "chisel.tier.01", "Basic Auto-Chisel", 1).getStackForm(1L)); - GregtechItemList.GT_Chisel_MV.set( - new GregtechMetaTileEntity_AutoChisel(31067, "chisel.tier.02", "Advanced Auto-Chisel", 2).getStackForm(1L)); - GregtechItemList.GT_Chisel_HV.set( - new GregtechMetaTileEntity_AutoChisel(31068, "chisel.tier.03", "Precision Auto-Chisel", 3) - .getStackForm(1L)); - - GregtechItemList.Controller_IndustrialAutoChisel.set( - new GregtechMetaTileEntity_IndustrialChisel( - 31069, - "multimachine.adv.chisel", - "Industrial 3D Copying Machine").getStackForm(1L)); - } -} diff --git a/gtpp/src/main/java/gtPlusPlus/xmod/gregtech/registration/gregtech/GregtechIndustrialCokeOven.java b/gtpp/src/main/java/gtPlusPlus/xmod/gregtech/registration/gregtech/GregtechIndustrialCokeOven.java deleted file mode 100644 index af941e58db..0000000000 --- a/gtpp/src/main/java/gtPlusPlus/xmod/gregtech/registration/gregtech/GregtechIndustrialCokeOven.java +++ /dev/null @@ -1,25 +0,0 @@ -package gtPlusPlus.xmod.gregtech.registration.gregtech; - -import gtPlusPlus.api.objects.Logger; -import gtPlusPlus.core.lib.CORE; -import gtPlusPlus.xmod.gregtech.api.enums.GregtechItemList; -import gtPlusPlus.xmod.gregtech.common.tileentities.machines.multi.processing.GregtechMetaTileEntity_IndustrialCokeOven; - -public class GregtechIndustrialCokeOven { - - public static void run() { - Logger.INFO("Gregtech5u Content | Registering Industrial Coke Oven Multiblock."); - if (CORE.ConfigSwitches.enableMultiblock_IndustrialCokeOven) { - run1(); - } - } - - private static void run1() { - // Industrial Centrifuge Multiblock - GregtechItemList.Industrial_CokeOven.set( - new GregtechMetaTileEntity_IndustrialCokeOven( - 791, - "industrialcokeoven.controller.tier.single", - "Industrial Coke Oven").getStackForm(1L)); - } -} diff --git a/gtpp/src/main/java/gtPlusPlus/xmod/gregtech/registration/gregtech/GregtechIndustrialCuttingFactory.java b/gtpp/src/main/java/gtPlusPlus/xmod/gregtech/registration/gregtech/GregtechIndustrialCuttingFactory.java deleted file mode 100644 index c5ff4a9928..0000000000 --- a/gtpp/src/main/java/gtPlusPlus/xmod/gregtech/registration/gregtech/GregtechIndustrialCuttingFactory.java +++ /dev/null @@ -1,25 +0,0 @@ -package gtPlusPlus.xmod.gregtech.registration.gregtech; - -import gtPlusPlus.api.objects.Logger; -import gtPlusPlus.core.lib.CORE; -import gtPlusPlus.xmod.gregtech.api.enums.GregtechItemList; -import gtPlusPlus.xmod.gregtech.common.tileentities.machines.multi.processing.GregtechMetaTileEntity_IndustrialCuttingMachine; - -public class GregtechIndustrialCuttingFactory { - - public static void run() { - Logger.INFO("Gregtech5u Content | Registering Industrial Cutting Factory Multiblock."); - if (CORE.ConfigSwitches.enableMultiblock_IndustrialCuttingMachine) { - run1(); - } - } - - private static void run1() { - // Industrial Wire Factory Multiblock - GregtechItemList.Industrial_CuttingFactoryController.set( - new GregtechMetaTileEntity_IndustrialCuttingMachine( - 992, - "industrialcuttingmachine.controller.tier.01", - "Cutting Factory Controller").getStackForm(1L)); - } -} diff --git a/gtpp/src/main/java/gtPlusPlus/xmod/gregtech/registration/gregtech/GregtechIndustrialElectrolyzer.java b/gtpp/src/main/java/gtPlusPlus/xmod/gregtech/registration/gregtech/GregtechIndustrialElectrolyzer.java deleted file mode 100644 index a114aaf3cd..0000000000 --- a/gtpp/src/main/java/gtPlusPlus/xmod/gregtech/registration/gregtech/GregtechIndustrialElectrolyzer.java +++ /dev/null @@ -1,25 +0,0 @@ -package gtPlusPlus.xmod.gregtech.registration.gregtech; - -import gtPlusPlus.api.objects.Logger; -import gtPlusPlus.core.lib.CORE; -import gtPlusPlus.xmod.gregtech.api.enums.GregtechItemList; -import gtPlusPlus.xmod.gregtech.common.tileentities.machines.multi.processing.GregtechMetaTileEntity_IndustrialElectrolyzer; - -public class GregtechIndustrialElectrolyzer { - - public static void run() { - Logger.INFO("Gregtech5u Content | Registering Industrial Electrolyzer Multiblock."); - if (CORE.ConfigSwitches.enableMultiblock_IndustrialElectrolyzer) { - run1(); - } - } - - private static void run1() { - // Industrial Electrolyzer Multiblock - GregtechItemList.Industrial_Electrolyzer.set( - new GregtechMetaTileEntity_IndustrialElectrolyzer( - 796, - "industrialelectrolyzer.controller.tier.single", - "Industrial Electrolyzer").getStackForm(1L)); - } -} diff --git a/gtpp/src/main/java/gtPlusPlus/xmod/gregtech/registration/gregtech/GregtechIndustrialElementDuplicator.java b/gtpp/src/main/java/gtPlusPlus/xmod/gregtech/registration/gregtech/GregtechIndustrialElementDuplicator.java deleted file mode 100644 index 222a3e7689..0000000000 --- a/gtpp/src/main/java/gtPlusPlus/xmod/gregtech/registration/gregtech/GregtechIndustrialElementDuplicator.java +++ /dev/null @@ -1,24 +0,0 @@ -package gtPlusPlus.xmod.gregtech.registration.gregtech; - -import gtPlusPlus.api.objects.Logger; -import gtPlusPlus.xmod.gregtech.api.enums.GregtechItemList; -import gtPlusPlus.xmod.gregtech.api.metatileentity.implementations.GT_MetaTileEntity_Hatch_ElementalDataOrbHolder; -import gtPlusPlus.xmod.gregtech.common.tileentities.machines.multi.production.GregtechMTE_ElementalDuplicator; - -public class GregtechIndustrialElementDuplicator { - - public static void run() { - - Logger.INFO("Gregtech5u Content | Registering Elemental Duplicator Multiblock."); - - GregtechItemList.Controller_ElementalDuplicator.set( - new GregtechMTE_ElementalDuplicator(31050, "gtpp.multimachine.replicator", "Elemental Duplicator") - .getStackForm(1L)); - GregtechItemList.Hatch_Input_Elemental_Duplicator.set( - new GT_MetaTileEntity_Hatch_ElementalDataOrbHolder( - 31051, - "hatch.input_bus.elementalorbholder", - "Data Orb Repository", - 7).getStackForm(1L)); - } -} diff --git a/gtpp/src/main/java/gtPlusPlus/xmod/gregtech/registration/gregtech/GregtechIndustrialExtruder.java b/gtpp/src/main/java/gtPlusPlus/xmod/gregtech/registration/gregtech/GregtechIndustrialExtruder.java deleted file mode 100644 index 817858a4a0..0000000000 --- a/gtpp/src/main/java/gtPlusPlus/xmod/gregtech/registration/gregtech/GregtechIndustrialExtruder.java +++ /dev/null @@ -1,25 +0,0 @@ -package gtPlusPlus.xmod.gregtech.registration.gregtech; - -import gtPlusPlus.api.objects.Logger; -import gtPlusPlus.core.lib.CORE; -import gtPlusPlus.xmod.gregtech.api.enums.GregtechItemList; -import gtPlusPlus.xmod.gregtech.common.tileentities.machines.multi.processing.GregtechMetaTileEntity_IndustrialExtruder; - -public class GregtechIndustrialExtruder { - - public static void run() { - Logger.INFO("Gregtech5u Content | Registering Industrial Extrusion Multiblock."); - if (CORE.ConfigSwitches.enableMultiblock_IndustrialExtrudingMachine) { - run1(); - } - } - - private static void run1() { - // Industrial Presser Multiblock - GregtechItemList.Industrial_Extruder.set( - new GregtechMetaTileEntity_IndustrialExtruder( - 859, - "industrialextruder.controller.tier.single", - "Industrial Extrusion Machine").getStackForm(1L)); - } -} diff --git a/gtpp/src/main/java/gtPlusPlus/xmod/gregtech/registration/gregtech/GregtechIndustrialFishPond.java b/gtpp/src/main/java/gtPlusPlus/xmod/gregtech/registration/gregtech/GregtechIndustrialFishPond.java deleted file mode 100644 index 182662bfbc..0000000000 --- a/gtpp/src/main/java/gtPlusPlus/xmod/gregtech/registration/gregtech/GregtechIndustrialFishPond.java +++ /dev/null @@ -1,21 +0,0 @@ -package gtPlusPlus.xmod.gregtech.registration.gregtech; - -import gtPlusPlus.api.objects.Logger; -import gtPlusPlus.xmod.gregtech.api.enums.GregtechItemList; -import gtPlusPlus.xmod.gregtech.common.tileentities.machines.multi.production.GregtechMetaTileEntity_IndustrialFishingPond; - -public class GregtechIndustrialFishPond { - - public static void run() { - Logger.INFO("Gregtech5u Content | Registering Industrial Fishing Pond Multiblock."); - run1(); - } - - private static void run1() { - GregtechItemList.Industrial_FishingPond.set( - new GregtechMetaTileEntity_IndustrialFishingPond( - 829, - "industrial.fishpond.controller.tier.single", - "Zhuhai - Fishing Port").getStackForm(1L)); - } -} diff --git a/gtpp/src/main/java/gtPlusPlus/xmod/gregtech/registration/gregtech/GregtechIndustrialFluidHeater.java b/gtpp/src/main/java/gtPlusPlus/xmod/gregtech/registration/gregtech/GregtechIndustrialFluidHeater.java deleted file mode 100644 index e25ef2fcae..0000000000 --- a/gtpp/src/main/java/gtPlusPlus/xmod/gregtech/registration/gregtech/GregtechIndustrialFluidHeater.java +++ /dev/null @@ -1,21 +0,0 @@ -package gtPlusPlus.xmod.gregtech.registration.gregtech; - -import gtPlusPlus.api.objects.Logger; -import gtPlusPlus.xmod.gregtech.api.enums.GregtechItemList; -import gtPlusPlus.xmod.gregtech.common.tileentities.machines.multi.processing.GregtechMetaTileEntity_IndustrialFluidHeater; - -public class GregtechIndustrialFluidHeater { - - public static void run() { - Logger.INFO("Gregtech5u Content | Registering Industrial Thermal Centrifuge Multiblock."); - run1(); - } - - private static void run1() { - GregtechItemList.Controller_IndustrialFluidHeater.set( - new GregtechMetaTileEntity_IndustrialFluidHeater( - 31077, - "industrialfluidheater.controller.tier.single", - "Thermic Heating Device").getStackForm(1L)); - } -} diff --git a/gtpp/src/main/java/gtPlusPlus/xmod/gregtech/registration/gregtech/GregtechIndustrialForgeHammer.java b/gtpp/src/main/java/gtPlusPlus/xmod/gregtech/registration/gregtech/GregtechIndustrialForgeHammer.java deleted file mode 100644 index a73b9fd873..0000000000 --- a/gtpp/src/main/java/gtPlusPlus/xmod/gregtech/registration/gregtech/GregtechIndustrialForgeHammer.java +++ /dev/null @@ -1,21 +0,0 @@ -package gtPlusPlus.xmod.gregtech.registration.gregtech; - -import gtPlusPlus.api.objects.Logger; -import gtPlusPlus.xmod.gregtech.api.enums.GregtechItemList; -import gtPlusPlus.xmod.gregtech.common.tileentities.machines.multi.processing.GregtechMetaTileEntity_IndustrialForgeHammer; - -public class GregtechIndustrialForgeHammer { - - public static void run() { - Logger.INFO("Gregtech5u Content | Registering Industrial Forge Hammer Multiblock."); - run1(); - } - - private static void run1() { - GregtechItemList.Controller_IndustrialForgeHammer.set( - new GregtechMetaTileEntity_IndustrialForgeHammer( - 31075, - "industrialhammer.controller.tier.single", - "Industrial Sledgehammer").getStackForm(1L)); - } -} diff --git a/gtpp/src/main/java/gtPlusPlus/xmod/gregtech/registration/gregtech/GregtechIndustrialFuelRefinery.java b/gtpp/src/main/java/gtPlusPlus/xmod/gregtech/registration/gregtech/GregtechIndustrialFuelRefinery.java deleted file mode 100644 index e45f593c7a..0000000000 --- a/gtpp/src/main/java/gtPlusPlus/xmod/gregtech/registration/gregtech/GregtechIndustrialFuelRefinery.java +++ /dev/null @@ -1,25 +0,0 @@ -package gtPlusPlus.xmod.gregtech.registration.gregtech; - -import gtPlusPlus.api.objects.Logger; -import gtPlusPlus.core.lib.CORE; -import gtPlusPlus.xmod.gregtech.api.enums.GregtechItemList; -import gtPlusPlus.xmod.gregtech.common.tileentities.machines.multi.production.GregtechMetaTileEntity_Refinery; - -public class GregtechIndustrialFuelRefinery { - - public static void run() { - Logger.INFO("Gregtech5u Content | Registering Industrial Fuel Processing and Refinery Multiblock."); - if (CORE.ConfigSwitches.enableMultiblock_NuclearFuelRefinery) { - run1(); - } - } - - private static void run1() { - // Industrial Maceration Stack Multiblock - GregtechItemList.Industrial_FuelRefinery.set( - new GregtechMetaTileEntity_Refinery( - 835, - "industrialrefinery.controller.tier.single", - "Reactor Fuel Processing Plant").getStackForm(1L)); - } -} diff --git a/gtpp/src/main/java/gtPlusPlus/xmod/gregtech/registration/gregtech/GregtechIndustrialMacerator.java b/gtpp/src/main/java/gtPlusPlus/xmod/gregtech/registration/gregtech/GregtechIndustrialMacerator.java deleted file mode 100644 index 0912660cc1..0000000000 --- a/gtpp/src/main/java/gtPlusPlus/xmod/gregtech/registration/gregtech/GregtechIndustrialMacerator.java +++ /dev/null @@ -1,25 +0,0 @@ -package gtPlusPlus.xmod.gregtech.registration.gregtech; - -import gtPlusPlus.api.objects.Logger; -import gtPlusPlus.core.lib.CORE; -import gtPlusPlus.xmod.gregtech.api.enums.GregtechItemList; -import gtPlusPlus.xmod.gregtech.common.tileentities.machines.multi.processing.GregtechMetaTileEntity_IndustrialMacerator; - -public class GregtechIndustrialMacerator { - - public static void run() { - Logger.INFO("Gregtech5u Content | Registering Industrial Maceration Stack Multiblock."); - if (CORE.ConfigSwitches.enableMultiblock_IndustrialMacerationStack) { - run1(); - } - } - - private static void run1() { - // Industrial Maceration Stack Multiblock - GregtechItemList.Industrial_MacerationStack.set( - new GregtechMetaTileEntity_IndustrialMacerator( - 797, - "industrialmacerator.controller.tier.single", - "Maceration Stack Controller").getStackForm(1L)); - } -} diff --git a/gtpp/src/main/java/gtPlusPlus/xmod/gregtech/registration/gregtech/GregtechIndustrialMassFabricator.java b/gtpp/src/main/java/gtPlusPlus/xmod/gregtech/registration/gregtech/GregtechIndustrialMassFabricator.java deleted file mode 100644 index 92b7182426..0000000000 --- a/gtpp/src/main/java/gtPlusPlus/xmod/gregtech/registration/gregtech/GregtechIndustrialMassFabricator.java +++ /dev/null @@ -1,137 +0,0 @@ -package gtPlusPlus.xmod.gregtech.registration.gregtech; - -import net.minecraft.item.ItemStack; -import net.minecraftforge.fluids.FluidStack; - -import gregtech.api.enums.GT_Values; -import gregtech.api.enums.Materials; -import gregtech.api.util.GT_Recipe; -import gtPlusPlus.api.objects.Logger; -import gtPlusPlus.api.recipe.GTPPRecipeMaps; -import gtPlusPlus.core.lib.CORE; -import gtPlusPlus.core.recipe.common.CI; -import gtPlusPlus.core.util.minecraft.ItemUtils; -import gtPlusPlus.xmod.gregtech.api.enums.GregtechItemList; -import gtPlusPlus.xmod.gregtech.common.tileentities.machines.multi.production.GregtechMetaTileEntity_MassFabricator; - -public class GregtechIndustrialMassFabricator { - - public static void run() { - Logger.INFO("Gregtech5u Content | Registering Industrial Matter Fabricator Multiblock."); - if (CORE.ConfigSwitches.enableMultiblock_MatterFabricator) { - generateRecipes(); - run1(); - } - } - - private static void run1() { - // Industrial Matter Fabricator Multiblock - GregtechItemList.Industrial_MassFab.set( - new GregtechMetaTileEntity_MassFabricator( - 799, - "industrialmassfab.controller.tier.single", - "Matter Fabrication CPU").getStackForm(1L)); - } - - private static void generateRecipes() { - - // Generate Scrap->UUA Recipes - - // Basic UUA1 - GT_Recipe UUA_From_Scrap = new GT_Recipe( - false, - new ItemStack[] { CI.getNumberedCircuit(9), ItemUtils.getSimpleStack(getScrapPile(), 9) }, - new ItemStack[] { GT_Values.NI }, - null, - null, - new FluidStack[] { GT_Values.NF }, - new FluidStack[] { Materials.UUAmplifier.getFluid(1) }, - 9 * 20, - 32, - 0); - // Basic UUA2 - GT_Recipe UUA_From_ScrapBoxes = new GT_Recipe( - false, - new ItemStack[] { CI.getNumberedCircuit(19), ItemUtils.getSimpleStack(getScrapBox(), 1) }, - new ItemStack[] { GT_Values.NI }, - null, - null, - new FluidStack[] { GT_Values.NF }, - new FluidStack[] { Materials.UUAmplifier.getFluid(1) }, - 9 * 20, - 32, - 0); - - GTPPRecipeMaps.multiblockMassFabricatorRecipes.add(UUA_From_Scrap); - GTPPRecipeMaps.multiblockMassFabricatorRecipes.add(UUA_From_ScrapBoxes); - - // Basic UUM - GT_Recipe generateUUM_LV = new GT_Recipe( - false, - new ItemStack[] { CI.getNumberedCircuit(1) }, - new ItemStack[] { GT_Values.NI }, - null, - null, - new FluidStack[] { GT_Values.NF }, - new FluidStack[] { Materials.UUMatter.getFluid(16) }, - 160 * 20, - 4096, - 0); - - // Basic UUM - GT_Recipe generateUUMFromUUA_LV = new GT_Recipe( - false, - new ItemStack[] { CI.getNumberedCircuit(2) }, - new ItemStack[] { GT_Values.NI }, - null, - null, - new FluidStack[] { Materials.UUAmplifier.getFluid(16) }, - new FluidStack[] { Materials.UUMatter.getFluid(16) }, - 40 * 20, - 4096, - 0); - - // Advanced UUM - GTPPRecipeMaps.multiblockMassFabricatorRecipes.add( - new GT_Recipe( - false, - new ItemStack[] { CI.getNumberedCircuit(3) }, - new ItemStack[] { GT_Values.NI }, - null, - null, - new FluidStack[] { GT_Values.NF }, - new FluidStack[] { Materials.UUMatter.getFluid(256) }, - 160 * 20, - 65536, - 0)); - - // Advanced UUM - GTPPRecipeMaps.multiblockMassFabricatorRecipes.add( - new GT_Recipe( - false, - new ItemStack[] { CI.getNumberedCircuit(4) }, - new ItemStack[] { GT_Values.NI }, - null, - null, - new FluidStack[] { Materials.UUAmplifier.getFluid(256) }, - new FluidStack[] { Materials.UUMatter.getFluid(256) }, - 40 * 20, - 65536, - 0)); - - GTPPRecipeMaps.multiblockMassFabricatorRecipes.add(generateUUM_LV); - GTPPRecipeMaps.multiblockMassFabricatorRecipes.add(generateUUMFromUUA_LV); - - Logger.INFO( - "Generated " + GTPPRecipeMaps.multiblockMassFabricatorRecipes.getAllRecipes() - .size() + " Matter Fabricator recipes."); - } - - public static ItemStack getScrapPile() { - return ItemUtils.getSimpleStack(ItemUtils.getItemFromFQRN("IC2:itemScrap")); - } - - public static ItemStack getScrapBox() { - return ItemUtils.getSimpleStack(ItemUtils.getItemFromFQRN("IC2:itemScrapbox")); - } -} diff --git a/gtpp/src/main/java/gtPlusPlus/xmod/gregtech/registration/gregtech/GregtechIndustrialMixer.java b/gtpp/src/main/java/gtPlusPlus/xmod/gregtech/registration/gregtech/GregtechIndustrialMixer.java deleted file mode 100644 index 07d0432213..0000000000 --- a/gtpp/src/main/java/gtPlusPlus/xmod/gregtech/registration/gregtech/GregtechIndustrialMixer.java +++ /dev/null @@ -1,25 +0,0 @@ -package gtPlusPlus.xmod.gregtech.registration.gregtech; - -import gtPlusPlus.api.objects.Logger; -import gtPlusPlus.core.lib.CORE; -import gtPlusPlus.xmod.gregtech.api.enums.GregtechItemList; -import gtPlusPlus.xmod.gregtech.common.tileentities.machines.multi.processing.GregtechMetaTileEntity_IndustrialMixer; - -public class GregtechIndustrialMixer { - - public static void run() { - Logger.INFO("Gregtech5u Content | Registering Industrial Mixer Multiblock."); - if (CORE.ConfigSwitches.enableMultiblock_IndustrialPlatePress) { - run1(); - } - } - - private static void run1() { - // Industrial Mixer Multiblock - GregtechItemList.Industrial_Mixer.set( - new GregtechMetaTileEntity_IndustrialMixer( - 811, - "industrialmixer.controller.tier.single", - "Industrial Mixing Machine").getStackForm(1L)); - } -} diff --git a/gtpp/src/main/java/gtPlusPlus/xmod/gregtech/registration/gregtech/GregtechIndustrialMultiMachine.java b/gtpp/src/main/java/gtPlusPlus/xmod/gregtech/registration/gregtech/GregtechIndustrialMultiMachine.java deleted file mode 100644 index 9ba8810c55..0000000000 --- a/gtpp/src/main/java/gtPlusPlus/xmod/gregtech/registration/gregtech/GregtechIndustrialMultiMachine.java +++ /dev/null @@ -1,24 +0,0 @@ -package gtPlusPlus.xmod.gregtech.registration.gregtech; - -import gtPlusPlus.api.objects.Logger; -import gtPlusPlus.core.lib.CORE; -import gtPlusPlus.xmod.gregtech.api.enums.GregtechItemList; -import gtPlusPlus.xmod.gregtech.common.tileentities.machines.multi.processing.GregtechMetaTileEntity_IndustrialMultiMachine; - -public class GregtechIndustrialMultiMachine { - - public static void run() { - Logger.INFO("Gregtech5u Content | Registering Industrial Multi-Machine Multiblock."); - if (CORE.ConfigSwitches.enableMultiblock_IndustrialMultiMachine) { - run1(); - } - } - - private static void run1() { - GregtechItemList.Industrial_MultiMachine.set( - new GregtechMetaTileEntity_IndustrialMultiMachine( - 860, - "industrialmultimachine.controller.tier.single", - "Large Processing Factory").getStackForm(1L)); - } -} diff --git a/gtpp/src/main/java/gtPlusPlus/xmod/gregtech/registration/gregtech/GregtechIndustrialPlatePress.java b/gtpp/src/main/java/gtPlusPlus/xmod/gregtech/registration/gregtech/GregtechIndustrialPlatePress.java deleted file mode 100644 index 60d93e4cb7..0000000000 --- a/gtpp/src/main/java/gtPlusPlus/xmod/gregtech/registration/gregtech/GregtechIndustrialPlatePress.java +++ /dev/null @@ -1,25 +0,0 @@ -package gtPlusPlus.xmod.gregtech.registration.gregtech; - -import gtPlusPlus.api.objects.Logger; -import gtPlusPlus.core.lib.CORE; -import gtPlusPlus.xmod.gregtech.api.enums.GregtechItemList; -import gtPlusPlus.xmod.gregtech.common.tileentities.machines.multi.processing.GregtechMetaTileEntity_IndustrialPlatePress; - -public class GregtechIndustrialPlatePress { - - public static void run() { - Logger.INFO("Gregtech5u Content | Registering Industrial Press Multiblock."); - if (CORE.ConfigSwitches.enableMultiblock_IndustrialPlatePress) { - run1(); - } - } - - private static void run1() { - // Industrial Presser Multiblock - GregtechItemList.Industrial_PlatePress.set( - new GregtechMetaTileEntity_IndustrialPlatePress( - 792, - "industrialbender.controller.tier.single", - "Industrial Material Press").getStackForm(1L)); - } -} diff --git a/gtpp/src/main/java/gtPlusPlus/xmod/gregtech/registration/gregtech/GregtechIndustrialRockBreaker.java b/gtpp/src/main/java/gtPlusPlus/xmod/gregtech/registration/gregtech/GregtechIndustrialRockBreaker.java deleted file mode 100644 index 3e9efb38cf..0000000000 --- a/gtpp/src/main/java/gtPlusPlus/xmod/gregtech/registration/gregtech/GregtechIndustrialRockBreaker.java +++ /dev/null @@ -1,15 +0,0 @@ -package gtPlusPlus.xmod.gregtech.registration.gregtech; - -import gtPlusPlus.xmod.gregtech.api.enums.GregtechItemList; -import gtPlusPlus.xmod.gregtech.common.tileentities.machines.multi.production.GregtechMetaTileEntity_IndustrialRockBreaker; - -public class GregtechIndustrialRockBreaker { - - public static void run() { - GregtechItemList.Controller_IndustrialRockBreaker.set( - new GregtechMetaTileEntity_IndustrialRockBreaker( - 31065, - "industrialrockcrusher.controller.tier.single", - "Boldarnator").getStackForm(1L)); - } -} diff --git a/gtpp/src/main/java/gtPlusPlus/xmod/gregtech/registration/gregtech/GregtechIndustrialSifter.java b/gtpp/src/main/java/gtPlusPlus/xmod/gregtech/registration/gregtech/GregtechIndustrialSifter.java deleted file mode 100644 index 87f8cc5e44..0000000000 --- a/gtpp/src/main/java/gtPlusPlus/xmod/gregtech/registration/gregtech/GregtechIndustrialSifter.java +++ /dev/null @@ -1,24 +0,0 @@ -package gtPlusPlus.xmod.gregtech.registration.gregtech; - -import gtPlusPlus.api.objects.Logger; -import gtPlusPlus.core.lib.CORE; -import gtPlusPlus.xmod.gregtech.api.enums.GregtechItemList; -import gtPlusPlus.xmod.gregtech.common.tileentities.machines.multi.processing.GregtechMetaTileEntity_IndustrialSifter; - -public class GregtechIndustrialSifter { - - public static void run() { - Logger.INFO("Gregtech5u Content | Registering Industrial Sifter Multiblock."); - if (CORE.ConfigSwitches.enableMultiblock_IndustrialSifter) { - run1(); - } - } - - private static void run1() { - GregtechItemList.Industrial_Sifter.set( - new GregtechMetaTileEntity_IndustrialSifter( - 840, - "industrialsifter.controller.tier.single", - "Large Sifter Control Block").getStackForm(1L)); - } -} diff --git a/gtpp/src/main/java/gtPlusPlus/xmod/gregtech/registration/gregtech/GregtechIndustrialThermalCentrifuge.java b/gtpp/src/main/java/gtPlusPlus/xmod/gregtech/registration/gregtech/GregtechIndustrialThermalCentrifuge.java deleted file mode 100644 index cf8b585ae9..0000000000 --- a/gtpp/src/main/java/gtPlusPlus/xmod/gregtech/registration/gregtech/GregtechIndustrialThermalCentrifuge.java +++ /dev/null @@ -1,24 +0,0 @@ -package gtPlusPlus.xmod.gregtech.registration.gregtech; - -import gtPlusPlus.api.objects.Logger; -import gtPlusPlus.core.lib.CORE; -import gtPlusPlus.xmod.gregtech.api.enums.GregtechItemList; -import gtPlusPlus.xmod.gregtech.common.tileentities.machines.multi.processing.GregtechMetaTileEntity_IndustrialThermalCentrifuge; - -public class GregtechIndustrialThermalCentrifuge { - - public static void run() { - Logger.INFO("Gregtech5u Content | Registering Industrial Thermal Centrifuge Multiblock."); - if (CORE.ConfigSwitches.enableMultiblock_IndustrialThermalCentrifuge) { - run1(); - } - } - - private static void run1() { - GregtechItemList.Industrial_ThermalCentrifuge.set( - new GregtechMetaTileEntity_IndustrialThermalCentrifuge( - 849, - "industrialthermalcentrifuge.controller.tier.single", - "Large Thermal Refinery").getStackForm(1L)); - } -} diff --git a/gtpp/src/main/java/gtPlusPlus/xmod/gregtech/registration/gregtech/GregtechIndustrialTreeFarm.java b/gtpp/src/main/java/gtPlusPlus/xmod/gregtech/registration/gregtech/GregtechIndustrialTreeFarm.java deleted file mode 100644 index 82a0369516..0000000000 --- a/gtpp/src/main/java/gtPlusPlus/xmod/gregtech/registration/gregtech/GregtechIndustrialTreeFarm.java +++ /dev/null @@ -1,22 +0,0 @@ -package gtPlusPlus.xmod.gregtech.registration.gregtech; - -import gtPlusPlus.api.objects.Logger; -import gtPlusPlus.core.lib.CORE; -import gtPlusPlus.xmod.gregtech.api.enums.GregtechItemList; -import gtPlusPlus.xmod.gregtech.common.tileentities.machines.multi.production.GregtechMetaTileEntityTreeFarm; - -public class GregtechIndustrialTreeFarm { - - public static void run() { - if (CORE.ConfigSwitches.enableMultiblock_TreeFarmer) { - Logger.INFO("Gregtech5u Content | Registering Tree Farm Multiblock."); - run1(); - } - } - - private static void run1() { - GregtechItemList.Industrial_TreeFarm.set( - new GregtechMetaTileEntityTreeFarm(836, "treefarm.controller.tier.single", "Tree Growth Simulator") - .getStackForm(1L)); - } -} diff --git a/gtpp/src/main/java/gtPlusPlus/xmod/gregtech/registration/gregtech/GregtechIndustrialWashPlant.java b/gtpp/src/main/java/gtPlusPlus/xmod/gregtech/registration/gregtech/GregtechIndustrialWashPlant.java deleted file mode 100644 index 982695b02c..0000000000 --- a/gtpp/src/main/java/gtPlusPlus/xmod/gregtech/registration/gregtech/GregtechIndustrialWashPlant.java +++ /dev/null @@ -1,24 +0,0 @@ -package gtPlusPlus.xmod.gregtech.registration.gregtech; - -import gtPlusPlus.api.objects.Logger; -import gtPlusPlus.core.lib.CORE; -import gtPlusPlus.xmod.gregtech.api.enums.GregtechItemList; -import gtPlusPlus.xmod.gregtech.common.tileentities.machines.multi.processing.GregtechMetaTileEntity_IndustrialWashPlant; - -public class GregtechIndustrialWashPlant { - - public static void run() { - Logger.INFO("Gregtech5u Content | Registering Industrial Wash Plant Multiblock."); - if (CORE.ConfigSwitches.enableMultiblock_IndustrialWashPlant) { - run1(); - } - } - - private static void run1() { - GregtechItemList.Industrial_WashPlant.set( - new GregtechMetaTileEntity_IndustrialWashPlant( - 850, - "industrialwashplant.controller.tier.single", - "Ore Washing Plant").getStackForm(1L)); - } -} diff --git a/gtpp/src/main/java/gtPlusPlus/xmod/gregtech/registration/gregtech/GregtechIndustrialWiremill.java b/gtpp/src/main/java/gtPlusPlus/xmod/gregtech/registration/gregtech/GregtechIndustrialWiremill.java deleted file mode 100644 index 853013834b..0000000000 --- a/gtpp/src/main/java/gtPlusPlus/xmod/gregtech/registration/gregtech/GregtechIndustrialWiremill.java +++ /dev/null @@ -1,25 +0,0 @@ -package gtPlusPlus.xmod.gregtech.registration.gregtech; - -import gtPlusPlus.api.objects.Logger; -import gtPlusPlus.core.lib.CORE; -import gtPlusPlus.xmod.gregtech.api.enums.GregtechItemList; -import gtPlusPlus.xmod.gregtech.common.tileentities.machines.multi.processing.GregtechMetaTileEntity_IndustrialWireMill; - -public class GregtechIndustrialWiremill { - - public static void run() { - Logger.INFO("Gregtech5u Content | Registering Industrial Wire Factory Multiblock."); - if (CORE.ConfigSwitches.enableMultiblock_IndustrialWireMill) { - run1(); - } - } - - private static void run1() { - // Industrial Wire Factory Multiblock - GregtechItemList.Industrial_WireFactory.set( - new GregtechMetaTileEntity_IndustrialWireMill( - 798, - "industrialwiremill.controller.tier.single", - "Wire Factory Controller").getStackForm(1L)); - } -} diff --git a/gtpp/src/main/java/gtPlusPlus/xmod/gregtech/registration/gregtech/GregtechIsaMill.java b/gtpp/src/main/java/gtPlusPlus/xmod/gregtech/registration/gregtech/GregtechIsaMill.java deleted file mode 100644 index d1719d4b74..0000000000 --- a/gtpp/src/main/java/gtPlusPlus/xmod/gregtech/registration/gregtech/GregtechIsaMill.java +++ /dev/null @@ -1,26 +0,0 @@ -package gtPlusPlus.xmod.gregtech.registration.gregtech; - -import gtPlusPlus.api.objects.Logger; -import gtPlusPlus.xmod.gregtech.api.enums.GregtechItemList; -import gtPlusPlus.xmod.gregtech.api.metatileentity.implementations.nbthandlers.GT_MetaTileEntity_Hatch_MillingBalls; -import gtPlusPlus.xmod.gregtech.common.tileentities.machines.multi.processing.GregtechMetaTileEntity_IsaMill; -import gtPlusPlus.xmod.gregtech.common.tileentities.machines.multi.production.GregtechMTE_FrothFlotationCell; - -public class GregtechIsaMill { - - public static void run() { - - Logger.INFO("Gregtech5u Content | Registering Milling Content."); - - GregtechItemList.Controller_IsaMill.set( - new GregtechMetaTileEntity_IsaMill(31027, "gtpp.multimachine.isamill", "IsaMill Grinding Machine") - .getStackForm(1L)); - GregtechItemList.Controller_Flotation_Cell.set( - new GregtechMTE_FrothFlotationCell(31028, "gtpp.multimachine.flotationcell", "Flotation Cell Regulator") - .getStackForm(1L)); - - // Milling Ball Bus - GregtechItemList.Bus_Milling_Balls - .set((new GT_MetaTileEntity_Hatch_MillingBalls(31029, "hatch.milling", "Ball Housing")).getStackForm(1L)); - } -} diff --git a/gtpp/src/main/java/gtPlusPlus/xmod/gregtech/registration/gregtech/GregtechLFTR.java b/gtpp/src/main/java/gtPlusPlus/xmod/gregtech/registration/gregtech/GregtechLFTR.java deleted file mode 100644 index 3a77c3f569..0000000000 --- a/gtpp/src/main/java/gtPlusPlus/xmod/gregtech/registration/gregtech/GregtechLFTR.java +++ /dev/null @@ -1,93 +0,0 @@ -package gtPlusPlus.xmod.gregtech.registration.gregtech; - -import gregtech.api.enums.SoundResource; -import gregtech.api.metatileentity.implementations.GT_MetaTileEntity_BasicMachine_GT_Recipe; -import gregtech.api.metatileentity.implementations.GT_MetaTileEntity_BasicMachine_GT_Recipe.SpecialEffects; -import gtPlusPlus.api.objects.Logger; -import gtPlusPlus.api.recipe.GTPPRecipeMaps; -import gtPlusPlus.core.lib.CORE; -import gtPlusPlus.xmod.gregtech.api.enums.GregtechItemList; -import gtPlusPlus.xmod.gregtech.common.tileentities.machines.multi.processing.GregtechMetaTileEntity_SpargeTower; -import gtPlusPlus.xmod.gregtech.common.tileentities.machines.multi.production.GregtechMTE_NuclearReactor; - -public class GregtechLFTR { - - public static void run() { - Logger.INFO("Gregtech5u Content | Registering Liquid Fluorine Thorium Reactor [LFTR]."); - if (CORE.ConfigSwitches.enableMultiblock_LiquidFluorideThoriumReactor) { - run1(); - } - } - - private static void run1() { - // LFTR - GregtechItemList.ThoriumReactor.set( - new GregtechMTE_NuclearReactor(751, "lftr.controller.single", "Thorium Reactor [LFTR]").getStackForm(1L)); - // Reactor Processing Units - GregtechItemList.ReactorProcessingUnit_IV.set( - new GT_MetaTileEntity_BasicMachine_GT_Recipe( - 31031, - "rpu.tier.01", - "Reactor Processing Unit I", - 5, - new String[] { "Processes Nuclear things", CORE.GT_Tooltip.get() }, - GTPPRecipeMaps.reactorProcessingUnitRecipes, - 2, - 9, - true, - SoundResource.NONE, - SpecialEffects.NONE, - "REACTOR_PROCESSING_UNIT", - null).getStackForm(1L)); - GregtechItemList.ReactorProcessingUnit_ZPM.set( - new GT_MetaTileEntity_BasicMachine_GT_Recipe( - 31032, - "rpu.tier.02", - "Reactor Processing Unit II", - 7, - new String[] { "Processes Nuclear things", CORE.GT_Tooltip.get() }, - GTPPRecipeMaps.reactorProcessingUnitRecipes, - 2, - 9, - true, - SoundResource.NONE, - SpecialEffects.NONE, - "REACTOR_PROCESSING_UNIT", - null).getStackForm(1L)); - // Cold Traps - GregtechItemList.ColdTrap_IV.set( - new GT_MetaTileEntity_BasicMachine_GT_Recipe( - 31033, - "coldtrap.tier.01", - "Cold Trap I", - 5, - new String[] { "Just like the Arctic", "Does not require ice cubes", CORE.GT_Tooltip.get() }, - GTPPRecipeMaps.coldTrapRecipes, - 2, - 9, - true, - SoundResource.NONE, - SpecialEffects.NONE, - "COLD_TRAP", - null).getStackForm(1L)); - GregtechItemList.ColdTrap_ZPM.set( - new GT_MetaTileEntity_BasicMachine_GT_Recipe( - 31034, - "coldtrap.tier.02", - "Cold Trap II", - 7, - new String[] { "Just like the Arctic", "Does not require ice cubes", CORE.GT_Tooltip.get() }, - GTPPRecipeMaps.coldTrapRecipes, - 2, - 9, - true, - SoundResource.NONE, - SpecialEffects.NONE, - "COLD_TRAP", - null).getStackForm(1L)); - // Sparge Tower - GregtechItemList.Controller_Sparge_Tower.set( - new GregtechMetaTileEntity_SpargeTower(31035, "sparge.controller.single", "Sparge Tower Controller") - .getStackForm(1L)); - } -} diff --git a/gtpp/src/main/java/gtPlusPlus/xmod/gregtech/registration/gregtech/GregtechLargeTurbinesAndHeatExchanger.java b/gtpp/src/main/java/gtPlusPlus/xmod/gregtech/registration/gregtech/GregtechLargeTurbinesAndHeatExchanger.java deleted file mode 100644 index b75573a9cf..0000000000 --- a/gtpp/src/main/java/gtPlusPlus/xmod/gregtech/registration/gregtech/GregtechLargeTurbinesAndHeatExchanger.java +++ /dev/null @@ -1,48 +0,0 @@ -package gtPlusPlus.xmod.gregtech.registration.gregtech; - -import static gregtech.api.enums.Mods.GoodGenerator; - -import gtPlusPlus.api.objects.Logger; -import gtPlusPlus.xmod.gregtech.api.enums.GregtechItemList; -import gtPlusPlus.xmod.gregtech.api.metatileentity.implementations.GT_MetaTileEntity_Hatch_Turbine; -import gtPlusPlus.xmod.gregtech.common.tileentities.machines.multi.processing.advanced.GregtechMetaTileEntity_Adv_HeatExchanger; -import gtPlusPlus.xmod.gregtech.common.tileentities.machines.multi.production.turbines.GT_MTE_LargeTurbine_Gas; -import gtPlusPlus.xmod.gregtech.common.tileentities.machines.multi.production.turbines.GT_MTE_LargeTurbine_Plasma; -import gtPlusPlus.xmod.gregtech.common.tileentities.machines.multi.production.turbines.GT_MTE_LargeTurbine_SCSteam; -import gtPlusPlus.xmod.gregtech.common.tileentities.machines.multi.production.turbines.GT_MTE_LargeTurbine_SHSteam; -import gtPlusPlus.xmod.gregtech.common.tileentities.machines.multi.production.turbines.GT_MTE_LargeTurbine_Steam; - -public class GregtechLargeTurbinesAndHeatExchanger { - - public static void run() { - Logger.INFO("Gregtech5u Content | Registering Larger Turbines & Extra Large Heat Exchanger."); - run1(); - } - - private static void run1() { - GregtechItemList.Large_Steam_Turbine.set( - new GT_MTE_LargeTurbine_Steam(865, "multimachine.largerturbine", "XL Turbo Steam Turbine") - .getStackForm(1L)); - GregtechItemList.Large_HPSteam_Turbine.set( - new GT_MTE_LargeTurbine_SHSteam(866, "multimachine.largerhpturbine", "XL Turbo HP Steam Turbine") - .getStackForm(1L)); - GregtechItemList.Large_Gas_Turbine.set( - new GT_MTE_LargeTurbine_Gas(31073, "multimachine.largergasturbine", "XL Turbo Gas Turbine") - .getStackForm(1L)); - GregtechItemList.Large_Plasma_Turbine.set( - new GT_MTE_LargeTurbine_Plasma(31074, "multimachine.largerplasmaturbine", "XL Turbo Plasma Turbine") - .getStackForm(1L)); - if (GoodGenerator.isModLoaded()) { - GregtechItemList.Large_SCSteam_Turbine.set( - new GT_MTE_LargeTurbine_SCSteam(31076, "multimachine.largerscturbine", "XL Turbo SC Steam Turbine") - .getStackForm(1L)); - } - GregtechItemList.Hatch_Turbine_Rotor - .set(new GT_MetaTileEntity_Hatch_Turbine(30010, "hatch.turbine", "Rotor Assembly", 8).getStackForm(1L)); - GregtechItemList.XL_HeatExchanger.set( - new GregtechMetaTileEntity_Adv_HeatExchanger( - 31079, - "multimachine.reallybigheatexchanger", - "Whakawhiti Wera XL").getStackForm(1L)); - } -} diff --git a/gtpp/src/main/java/gtPlusPlus/xmod/gregtech/registration/gregtech/GregtechMolecularTransformer.java b/gtpp/src/main/java/gtPlusPlus/xmod/gregtech/registration/gregtech/GregtechMolecularTransformer.java deleted file mode 100644 index ebb0bde1cf..0000000000 --- a/gtpp/src/main/java/gtPlusPlus/xmod/gregtech/registration/gregtech/GregtechMolecularTransformer.java +++ /dev/null @@ -1,21 +0,0 @@ -package gtPlusPlus.xmod.gregtech.registration.gregtech; - -import gtPlusPlus.api.objects.Logger; -import gtPlusPlus.xmod.gregtech.api.enums.GregtechItemList; -import gtPlusPlus.xmod.gregtech.common.tileentities.machines.multi.processing.GregtechMetaTileEntity_IndustrialMolecularTransformer; - -public class GregtechMolecularTransformer { - - public static void run() { - Logger.INFO("Gregtech5u Content | Registering Molecular Transformer Multiblock."); - run1(); - } - - private static void run1() { - GregtechItemList.Controller_MolecularTransformer.set( - new GregtechMetaTileEntity_IndustrialMolecularTransformer( - 31072, - "moleculartransformer.controller.tier.single", - "Molecular Transformer").getStackForm(1L)); - } -} diff --git a/gtpp/src/main/java/gtPlusPlus/xmod/gregtech/registration/gregtech/GregtechNuclearSaltProcessingPlant.java b/gtpp/src/main/java/gtPlusPlus/xmod/gregtech/registration/gregtech/GregtechNuclearSaltProcessingPlant.java deleted file mode 100644 index 0122f525c6..0000000000 --- a/gtpp/src/main/java/gtPlusPlus/xmod/gregtech/registration/gregtech/GregtechNuclearSaltProcessingPlant.java +++ /dev/null @@ -1,21 +0,0 @@ -package gtPlusPlus.xmod.gregtech.registration.gregtech; - -import gtPlusPlus.api.objects.Logger; -import gtPlusPlus.core.lib.CORE; -import gtPlusPlus.xmod.gregtech.api.enums.GregtechItemList; -import gtPlusPlus.xmod.gregtech.common.tileentities.machines.multi.processing.GregtechMetaTileEntity_NuclearSaltProcessingPlant; - -public class GregtechNuclearSaltProcessingPlant { - - public static void run() { - Logger.INFO("Gregtech5u Content | Registering Nuclear Salt Processing Plant Multiblock."); - if (CORE.ConfigSwitches.enableMultiblock_NuclearSaltProcessingPlant) { - // Nuclear Salt Processing Plant Multiblock - GregtechItemList.Nuclear_Salt_Processing_Plant.set( - new GregtechMetaTileEntity_NuclearSaltProcessingPlant( - 749, - "nuclearsaltprocessingplant.controller.tier.single", - "Nuclear Salt Processing Plant").getStackForm(1L)); - } - } -} diff --git a/gtpp/src/main/java/gtPlusPlus/xmod/gregtech/registration/gregtech/GregtechPollutionDevices.java b/gtpp/src/main/java/gtPlusPlus/xmod/gregtech/registration/gregtech/GregtechPollutionDevices.java deleted file mode 100644 index fc62698789..0000000000 --- a/gtpp/src/main/java/gtPlusPlus/xmod/gregtech/registration/gregtech/GregtechPollutionDevices.java +++ /dev/null @@ -1,93 +0,0 @@ -package gtPlusPlus.xmod.gregtech.registration.gregtech; - -import gtPlusPlus.api.objects.Logger; -import gtPlusPlus.core.lib.CORE; -import gtPlusPlus.core.util.minecraft.gregtech.PollutionUtils; -import gtPlusPlus.xmod.gregtech.api.enums.GregtechItemList; -import gtPlusPlus.xmod.gregtech.common.tileentities.machines.basic.GregtechMetaAtmosphericReconditioner; -import gtPlusPlus.xmod.gregtech.common.tileentities.machines.basic.GregtechMetaPollutionCreator; -import gtPlusPlus.xmod.gregtech.common.tileentities.machines.basic.GregtechMetaPollutionDetector; - -public class GregtechPollutionDevices { - - public static void run() { - if (PollutionUtils.isPollutionEnabled()) { - Logger.INFO("Gregtech5u Content | Registering Anti-Pollution Devices."); - run1(); - } - } - - private static void run1() { - if (CORE.ConfigSwitches.enableMachine_Pollution) { - // 759 - GregtechItemList.Pollution_Detector.set( - new GregtechMetaPollutionDetector( - 756, - "pollutiondetector.01.tier.single", - "Pollution Detection Device", - 0, - "Tells you if you're living in Gwalior yet.", - 0).getStackForm(1L)); - GregtechItemList.Pollution_Creator.set( - new GregtechMetaPollutionCreator( - 951, - "pollutioncreator.01.tier.single", - "Smog Device", - 4, - "Polluting the skies.", - 0).getStackForm(1L)); - - GregtechItemList.Pollution_Cleaner_LV.set( - new GregtechMetaAtmosphericReconditioner( - 758, - "pollutioncleaner.02.tier.single", - "Upgraded Pollution Scrubber", - 1).getStackForm(1L)); - GregtechItemList.Pollution_Cleaner_MV.set( - new GregtechMetaAtmosphericReconditioner( - 759, - "pollutioncleaner.03.tier.single", - "Advanced Pollution Scrubber", - 2).getStackForm(1L)); - GregtechItemList.Pollution_Cleaner_HV.set( - new GregtechMetaAtmosphericReconditioner( - 760, - "pollutioncleaner.04.tier.single", - "Precision Pollution Scrubber", - 3).getStackForm(1L)); - GregtechItemList.Pollution_Cleaner_EV.set( - new GregtechMetaAtmosphericReconditioner(761, "pollutioncleaner.05.tier.single", "Air Recycler", 4) - .getStackForm(1L)); - GregtechItemList.Pollution_Cleaner_IV.set( - new GregtechMetaAtmosphericReconditioner( - 762, - "pollutioncleaner.06.tier.single", - "Upgraded Air Recycler", - 5).getStackForm(1L)); - GregtechItemList.Pollution_Cleaner_LuV.set( - new GregtechMetaAtmosphericReconditioner( - 763, - "pollutioncleaner.07.tier.single", - "Advanced Air Recycler", - 6).getStackForm(1L)); - GregtechItemList.Pollution_Cleaner_ZPM.set( - new GregtechMetaAtmosphericReconditioner( - 764, - "pollutioncleaner.08.tier.single", - "Precision Air Recycler", - 7).getStackForm(1L)); - GregtechItemList.Pollution_Cleaner_UV.set( - new GregtechMetaAtmosphericReconditioner( - 765, - "pollutioncleaner.09.tier.single", - "Atmospheric Cleaner", - 8).getStackForm(1L)); - GregtechItemList.Pollution_Cleaner_MAX.set( - new GregtechMetaAtmosphericReconditioner( - 766, - "pollutioncleaner.10.tier.single", - "Biosphere Cleanser", - 9).getStackForm(1L)); - } - } -} diff --git a/gtpp/src/main/java/gtPlusPlus/xmod/gregtech/registration/gregtech/GregtechPowerSubStation.java b/gtpp/src/main/java/gtPlusPlus/xmod/gregtech/registration/gregtech/GregtechPowerSubStation.java deleted file mode 100644 index 3fd906b261..0000000000 --- a/gtpp/src/main/java/gtPlusPlus/xmod/gregtech/registration/gregtech/GregtechPowerSubStation.java +++ /dev/null @@ -1,61 +0,0 @@ -package gtPlusPlus.xmod.gregtech.registration.gregtech; - -import gregtech.api.enums.ItemList; -import gregtech.api.util.GT_ModHandler; -import gtPlusPlus.api.objects.Logger; -import gtPlusPlus.core.lib.CORE; -import gtPlusPlus.core.recipe.common.CI; -import gtPlusPlus.xmod.gregtech.api.enums.GregtechItemList; -import gtPlusPlus.xmod.gregtech.api.metatileentity.implementations.GT_MetaTileEntity_Hatch_InputBattery; -import gtPlusPlus.xmod.gregtech.api.metatileentity.implementations.GT_MetaTileEntity_Hatch_OutputBattery; -import gtPlusPlus.xmod.gregtech.common.tileentities.machines.multi.storage.GregtechMetaTileEntity_PowerSubStationController; - -public class GregtechPowerSubStation { - - public static void run() { - Logger.INFO("Gregtech5u Content | Registering Power Substation Node."); - if (CORE.ConfigSwitches.enableMultiblock_PowerSubstation) { - run1(); - } - } - - private static void run1() { - // Steam Condensors - GregtechItemList.PowerSubStation.set( - new GregtechMetaTileEntity_PowerSubStationController( - 812, - "substation.01.input.single", - "Power Station Control Node").getStackForm(1L)); - int tID = 886; - GregtechItemList.Hatch_Input_Battery_MV.set( - new GT_MetaTileEntity_Hatch_InputBattery(tID++, "hatch.input_battery.tier.00", "Charging Bus (MV)", 2) - .getStackForm(1L)); - GregtechItemList.Hatch_Input_Battery_EV.set( - new GT_MetaTileEntity_Hatch_InputBattery(tID++, "hatch.input_battery.tier.01", "Charging Bus (EV)", 4) - .getStackForm(1L)); - - GregtechItemList.Hatch_Output_Battery_MV.set( - new GT_MetaTileEntity_Hatch_OutputBattery(tID++, "hatch.output_battery.tier.00", "Discharging Bus (MV)", 2) - .getStackForm(1L)); - GregtechItemList.Hatch_Output_Battery_EV.set( - new GT_MetaTileEntity_Hatch_OutputBattery(tID++, "hatch.output_battery.tier.01", "Discharging Bus (EV)", 4) - .getStackForm(1L)); - - GT_ModHandler.addCraftingRecipe( - GregtechItemList.Hatch_Input_Battery_MV.get(1L, new Object[0]), - CI.bitsd, - new Object[] { "C", "M", 'M', ItemList.Hull_MV, 'C', ItemList.Battery_Buffer_2by2_MV }); - GT_ModHandler.addCraftingRecipe( - GregtechItemList.Hatch_Input_Battery_EV.get(1L, new Object[0]), - CI.bitsd, - new Object[] { "C", "M", 'M', ItemList.Hull_EV, 'C', ItemList.Battery_Buffer_4by4_EV }); - GT_ModHandler.addCraftingRecipe( - GregtechItemList.Hatch_Output_Battery_MV.get(1L, new Object[0]), - CI.bitsd, - new Object[] { "M", "C", 'M', ItemList.Hull_MV, 'C', ItemList.Battery_Buffer_2by2_MV }); - GT_ModHandler.addCraftingRecipe( - GregtechItemList.Hatch_Output_Battery_EV.get(1L, new Object[0]), - CI.bitsd, - new Object[] { "M", "C", 'M', ItemList.Hull_EV, 'C', ItemList.Battery_Buffer_4by4_EV }); - } -} diff --git a/gtpp/src/main/java/gtPlusPlus/xmod/gregtech/registration/gregtech/GregtechQuantumForceTransformer.java b/gtpp/src/main/java/gtPlusPlus/xmod/gregtech/registration/gregtech/GregtechQuantumForceTransformer.java deleted file mode 100644 index 5943f3bd28..0000000000 --- a/gtpp/src/main/java/gtPlusPlus/xmod/gregtech/registration/gregtech/GregtechQuantumForceTransformer.java +++ /dev/null @@ -1,20 +0,0 @@ -package gtPlusPlus.xmod.gregtech.registration.gregtech; - -import gtPlusPlus.api.objects.Logger; -import gtPlusPlus.core.lib.CORE; -import gtPlusPlus.xmod.gregtech.api.enums.GregtechItemList; -import gtPlusPlus.xmod.gregtech.common.tileentities.machines.multi.production.GregtechMetaTileEntity_QuantumForceTransformer; - -public class GregtechQuantumForceTransformer { - - public static void run() { - Logger.INFO("Gregtech5u Content | Registering Quantum Force Transformer Multiblock."); - if (CORE.ConfigSwitches.enableMultiblock_QuantumForceTransformer) { - GregtechItemList.QuantumForceTransformer.set( - new GregtechMetaTileEntity_QuantumForceTransformer( - 31151, - "quantumforcetransformer.controller.tier.single", - "Quantum Force Transformer").getStackForm(1L)); - } - } -} diff --git a/gtpp/src/main/java/gtPlusPlus/xmod/gregtech/registration/gregtech/GregtechRTG.java b/gtpp/src/main/java/gtPlusPlus/xmod/gregtech/registration/gregtech/GregtechRTG.java deleted file mode 100644 index 5eb148a287..0000000000 --- a/gtpp/src/main/java/gtPlusPlus/xmod/gregtech/registration/gregtech/GregtechRTG.java +++ /dev/null @@ -1,22 +0,0 @@ -package gtPlusPlus.xmod.gregtech.registration.gregtech; - -import gtPlusPlus.api.objects.Logger; -import gtPlusPlus.xmod.gregtech.api.enums.GregtechItemList; -import gtPlusPlus.xmod.gregtech.common.tileentities.generators.GregtechMetaTileEntity_RTG; - -public class GregtechRTG { - - public static void run() { - Logger.INFO("Gregtech5u Content | Registering RTG."); - run1(); - } - - private static void run1() { - GregtechItemList.RTG.set( - new GregtechMetaTileEntity_RTG( - 869, - "basicgenerator.rtg.tier.01", - "Radioisotope Thermoelectric Generator", - 3).getStackForm(1L)); - } -} diff --git a/gtpp/src/main/java/gtPlusPlus/xmod/gregtech/registration/gregtech/GregtechRocketFuelGenerator.java b/gtpp/src/main/java/gtPlusPlus/xmod/gregtech/registration/gregtech/GregtechRocketFuelGenerator.java deleted file mode 100644 index b2f53d46ba..0000000000 --- a/gtpp/src/main/java/gtPlusPlus/xmod/gregtech/registration/gregtech/GregtechRocketFuelGenerator.java +++ /dev/null @@ -1,98 +0,0 @@ -package gtPlusPlus.xmod.gregtech.registration.gregtech; - -import net.minecraft.item.ItemStack; - -import gregtech.api.enums.ItemList; -import gregtech.api.enums.Materials; -import gregtech.api.enums.OrePrefixes; -import gregtech.api.util.GT_ModHandler; -import gtPlusPlus.api.objects.Logger; -import gtPlusPlus.core.lib.CORE; -import gtPlusPlus.core.material.ALLOY; -import gtPlusPlus.core.recipe.common.CI; -import gtPlusPlus.xmod.gregtech.api.enums.GregtechItemList; -import gtPlusPlus.xmod.gregtech.common.tileentities.generators.GregtechMetaTileEntityRocketFuelGenerator; -import gtPlusPlus.xmod.gregtech.common.tileentities.machines.multi.production.GregtechMetaTileEntity_LargeRocketEngine; - -public class GregtechRocketFuelGenerator { - - public static void run() { - Logger.INFO("Gregtech5u Content | Registering Industrial Rocket Engines."); - if (CORE.ConfigSwitches.enableMachine_RocketEngines) { - run1(); - } - } - - private static void run1() { - GregtechItemList.Controller_RocketEngine.set( - new GregtechMetaTileEntity_LargeRocketEngine( - 996, - "gtpp.multimachine.rocketengine", - "Rocketdyne F-1A Engine").getStackForm(1L)); - - GT_ModHandler.addCraftingRecipe( - GregtechItemList.Controller_RocketEngine.get(1L), - CI.bitsd, - new Object[] { "PCP", "EME", "GWG", 'M', ItemList.Machine_Multi_DieselEngine.get(1), 'P', - ItemList.Electric_Piston_IV, 'E', ItemList.Field_Generator_EV, 'C', - OrePrefixes.circuit.get(Materials.Master), 'W', OrePrefixes.cableGt08.get(Materials.Platinum), 'G', - ALLOY.MARAGING350.getGear(1) }); - - GT_ModHandler.addCraftingRecipe( - GregtechItemList.Casing_RocketEngine.get(1L), - CI.bitsd, - new Object[] { "PhP", "RFR", "PWP", 'R', OrePrefixes.pipeMedium.get(Materials.TungstenSteel), 'F', - ItemList.Casing_RobustTungstenSteel, 'P', ALLOY.NITINOL_60.getGear(1), 'W', - OrePrefixes.stickLong.get(Materials.TungstenSteel) }); - - GregtechItemList.Rocket_Engine_EV.set( - new GregtechMetaTileEntityRocketFuelGenerator( - 793, - "advancedgenerator.rocketFuel.tier.01", - "Basic Rocket Engine", - 4).getStackForm(1L)); - GregtechItemList.Rocket_Engine_IV.set( - new GregtechMetaTileEntityRocketFuelGenerator( - 794, - "advancedgenerator.rocketFuel.tier.02", - "Advanced Rocket Engine", - 5).getStackForm(1L)); - GregtechItemList.Rocket_Engine_LuV.set( - new GregtechMetaTileEntityRocketFuelGenerator( - 795, - "advancedgenerator.rocketFuel.tier.03", - "Turbo Rocket Engine", - 6).getStackForm(1L)); - GT_ModHandler.addCraftingRecipe( - GregtechItemList.Rocket_Engine_EV.get(1L, new Object[0]), - GT_ModHandler.RecipeBits.DISMANTLEABLE | GT_ModHandler.RecipeBits.NOT_REMOVABLE - | GT_ModHandler.RecipeBits.REVERSIBLE - | GT_ModHandler.RecipeBits.BUFFERED, - new Object[] { "PCP", "EME", "GWG", Character.valueOf('M'), ItemList.Hull_EV, Character.valueOf('P'), - ItemList.Electric_Piston_EV, Character.valueOf('E'), ItemList.Electric_Motor_EV, Character.valueOf('C'), - OrePrefixes.circuit.get(Materials.Elite), Character.valueOf('W'), - OrePrefixes.cableGt02.get(Materials.Aluminium), Character.valueOf('G'), - ALLOY.TANTALLOY_61.getGear(1) }); - - GT_ModHandler.addCraftingRecipe( - GregtechItemList.Rocket_Engine_IV.get(1L, new Object[0]), - GT_ModHandler.RecipeBits.DISMANTLEABLE | GT_ModHandler.RecipeBits.NOT_REMOVABLE - | GT_ModHandler.RecipeBits.REVERSIBLE - | GT_ModHandler.RecipeBits.BUFFERED, - new Object[] { "PCP", "EME", "GWG", Character.valueOf('M'), ItemList.Hull_IV, Character.valueOf('P'), - ItemList.Electric_Piston_IV, Character.valueOf('E'), ItemList.Electric_Motor_IV, Character.valueOf('C'), - OrePrefixes.circuit.get(Materials.Master), Character.valueOf('W'), - OrePrefixes.cableGt02.get(Materials.Platinum), Character.valueOf('G'), ALLOY.STELLITE.getGear(1) }); - final ItemStack INGREDIENT_1 = CI.electricPiston_LuV; - final ItemStack INGREDIENT_2 = CI.electricMotor_LuV; - GT_ModHandler.addCraftingRecipe( - GregtechItemList.Rocket_Engine_LuV.get(1L, new Object[0]), - GT_ModHandler.RecipeBits.DISMANTLEABLE | GT_ModHandler.RecipeBits.NOT_REMOVABLE - | GT_ModHandler.RecipeBits.REVERSIBLE - | GT_ModHandler.RecipeBits.BUFFERED, - new Object[] { "PCP", "EME", "GWG", Character.valueOf('M'), ItemList.Hull_LuV, Character.valueOf('P'), - INGREDIENT_1, Character.valueOf('E'), INGREDIENT_2, Character.valueOf('C'), - OrePrefixes.circuit.get(Materials.Ultimate), Character.valueOf('W'), - OrePrefixes.cableGt02.get(Materials.Tungsten), Character.valueOf('G'), ALLOY.ZERON_100.getGear(1) }); - } -} diff --git a/gtpp/src/main/java/gtPlusPlus/xmod/gregtech/registration/gregtech/GregtechSemiFluidgenerators.java b/gtpp/src/main/java/gtPlusPlus/xmod/gregtech/registration/gregtech/GregtechSemiFluidgenerators.java deleted file mode 100644 index be349d2a81..0000000000 --- a/gtpp/src/main/java/gtPlusPlus/xmod/gregtech/registration/gregtech/GregtechSemiFluidgenerators.java +++ /dev/null @@ -1,46 +0,0 @@ -package gtPlusPlus.xmod.gregtech.registration.gregtech; - -import gtPlusPlus.xmod.gregtech.api.enums.GregtechItemList; -import gtPlusPlus.xmod.gregtech.common.tileentities.generators.GT_MetaTileEntity_SemiFluidGenerator; -import gtPlusPlus.xmod.gregtech.common.tileentities.machines.multi.production.GregtechMetaTileEntity_LargeSemifluidGenerator; - -public class GregtechSemiFluidgenerators { - - public static void run() { - GregtechItemList.Generator_SemiFluid_LV.set( - new GT_MetaTileEntity_SemiFluidGenerator( - 837, - "basicgenerator.semifluid.tier.01", - "Basic Semi-Fluid Generator", - 1).getStackForm(1L)); - GregtechItemList.Generator_SemiFluid_MV.set( - new GT_MetaTileEntity_SemiFluidGenerator( - 838, - "basicgenerator.semifluid.tier.02", - "Advanced Semi-Fluid Generator", - 2).getStackForm(1L)); - GregtechItemList.Generator_SemiFluid_HV.set( - new GT_MetaTileEntity_SemiFluidGenerator( - 839, - "basicgenerator.semifluid.tier.03", - "Turbo Semi-Fluid Generator", - 3).getStackForm(1L)); - GregtechItemList.Generator_SemiFluid_EV.set( - new GT_MetaTileEntity_SemiFluidGenerator( - 993, - "basicgenerator.semifluid.tier.04", - "Turbo Semi-Fluid Generator II", - 4).getStackForm(1L)); - GregtechItemList.Generator_SemiFluid_IV.set( - new GT_MetaTileEntity_SemiFluidGenerator( - 994, - "basicgenerator.semifluid.tier.05", - "Turbo Semi-Fluid Generator III", - 5).getStackForm(1L)); - GregtechItemList.Controller_LargeSemifluidGenerator.set( - new GregtechMetaTileEntity_LargeSemifluidGenerator( - 31026, - "gtpp.multimachine.semifluidgenerator", - "Large Semifluid Burner").getStackForm(1L)); - } -} diff --git a/gtpp/src/main/java/gtPlusPlus/xmod/gregtech/registration/gregtech/GregtechSimpleWasher.java b/gtpp/src/main/java/gtPlusPlus/xmod/gregtech/registration/gregtech/GregtechSimpleWasher.java deleted file mode 100644 index 15d54a7c6d..0000000000 --- a/gtpp/src/main/java/gtPlusPlus/xmod/gregtech/registration/gregtech/GregtechSimpleWasher.java +++ /dev/null @@ -1,166 +0,0 @@ -package gtPlusPlus.xmod.gregtech.registration.gregtech; - -import java.util.List; - -import net.minecraft.item.ItemStack; -import net.minecraftforge.fluids.FluidStack; - -import com.github.bartimaeusnek.bartworks.system.material.Werkstoff; -import com.google.common.collect.ImmutableList; - -import gregtech.api.enums.Materials; -import gregtech.api.enums.OrePrefixes; -import gregtech.api.enums.SoundResource; -import gregtech.api.metatileentity.implementations.GT_MetaTileEntity_BasicMachine_GT_Recipe; -import gregtech.api.metatileentity.implementations.GT_MetaTileEntity_BasicMachine_GT_Recipe.SpecialEffects; -import gregtech.api.util.GT_OreDictUnificator; -import gregtech.api.util.GT_Recipe; -import gtPlusPlus.api.objects.data.Quad; -import gtPlusPlus.api.recipe.GTPPRecipeMaps; -import gtPlusPlus.core.lib.CORE; -import gtPlusPlus.core.util.minecraft.FluidUtils; -import gtPlusPlus.xmod.gregtech.api.enums.GregtechItemList; - -public class GregtechSimpleWasher { - - public static void run() { - if (CORE.ConfigSwitches.enableMachine_SimpleWasher) { - generateDirtyDustRecipes(); - generateDirtyCrushedRecipes(); - // Register the Simple Washer Entity. - - // The unlocalized names here have inconsistent numbering because there only used to be a simple washer - // every other tier, and they were numbered numerically. In order to maintain backwards compatibility, - // the tier numbers need to stay as they were. - List<Quad<GregtechItemList, Integer, String, String>> washers = ImmutableList.of( - new Quad<>(GregtechItemList.SimpleDustWasher_LV, 31790, "simplewasher.01.tier.06", "Simple Washer I"), - new Quad<>(GregtechItemList.SimpleDustWasher_MV, 31017, "simplewasher.01.tier.02", "Simple Washer II"), - new Quad<>(GregtechItemList.SimpleDustWasher_HV, 31791, "simplewasher.01.tier.07", "Simple Washer III"), - new Quad<>(GregtechItemList.SimpleDustWasher_EV, 31018, "simplewasher.01.tier.03", "Simple Washer IV"), - new Quad<>(GregtechItemList.SimpleDustWasher_IV, 31792, "simplewasher.01.tier.08", "Simple Washer V"), - new Quad<>(GregtechItemList.SimpleDustWasher_LuV, 31019, "simplewasher.01.tier.04", "Simple Washer VI"), - new Quad<>( - GregtechItemList.SimpleDustWasher_ZPM, - 31793, - "simplewasher.01.tier.09", - "Simple Washer VII"), - new Quad<>( - GregtechItemList.SimpleDustWasher_UV, - 31020, - "simplewasher.01.tier.05", - "Simple Washer VIII")); - - GregtechItemList.SimpleDustWasher_ULV.set( - new GT_MetaTileEntity_BasicMachine_GT_Recipe( - 767, - "simplewasher.01.tier.01", - "Deprecated ULV Simple Washer", - 0, - new String[] { "It's like an automatic Cauldron for washing dusts.", - "§cDEPRECATED: No recipe.§r Make a Simple Washer I.", CORE.GT_Tooltip.get() }, - GTPPRecipeMaps.simpleWasherRecipes, - 1, - 1, - true, - SoundResource.NONE, - SpecialEffects.NONE, - "SIMPLE_WASHER", - null).setRecipeCatalystPriority(-11) - .getStackForm(1L)); - - for (int i = 0; i < washers.size(); i++) { - Quad<GregtechItemList, Integer, String, String> washer = washers.get(i); - int tier = i + 1; - washer.getKey() - .set( - new GT_MetaTileEntity_BasicMachine_GT_Recipe( - washer.getValue_1(), - washer.getValue_2(), - washer.getValue_3(), - tier, - new String[] { "It's like an automatic Cauldron for washing dusts.", - CORE.GT_Tooltip.get() }, - GTPPRecipeMaps.simpleWasherRecipes, - 1, - 1, - true, - SoundResource.NONE, - SpecialEffects.NONE, - "SIMPLE_WASHER", - null).setRecipeCatalystPriority(-tier) - .getStackForm(1L)); - } - } - } - - private static boolean generateDirtyDustRecipes() { - int mRecipeCount = 0; - // Generate Recipe Map for the Dust Washer. - ItemStack dustClean; - ItemStack dustDirty; - ItemStack dustPure; - for (Materials v : Materials.values()) { - if (v == Materials.Platinum || v == Materials.Osmium - || v == Materials.Iridium - || v == Materials.Palladium) { - continue; - } - - dustClean = GT_OreDictUnificator.get(OrePrefixes.dust, v, 1L); - dustDirty = GT_OreDictUnificator.get(OrePrefixes.dustImpure, v, 1L); - dustPure = GT_OreDictUnificator.get(OrePrefixes.dustPure, v, 1L); - addSimpleWashRecipe(dustDirty, dustClean); - addSimpleWashRecipe(dustPure, dustClean); - } - - for (Werkstoff v : Werkstoff.werkstoffHashSet) { - dustClean = v.hasItemType(OrePrefixes.dust) ? v.get(OrePrefixes.dust) : null; - dustDirty = v.hasItemType(OrePrefixes.dustImpure) ? v.get(OrePrefixes.dustImpure) : null; - dustPure = v.hasItemType(OrePrefixes.dustPure) ? v.get(OrePrefixes.dustPure) : null; - addSimpleWashRecipe(dustDirty, dustClean); - addSimpleWashRecipe(dustPure, dustClean); - } - - return GTPPRecipeMaps.simpleWasherRecipes.getAllRecipes() - .size() > mRecipeCount; - } - - private static boolean generateDirtyCrushedRecipes() { - int mRecipeCount = GTPPRecipeMaps.simpleWasherRecipes.getAllRecipes() - .size(); - // Generate Recipe Map for the Dust Washer. - ItemStack crushedClean; - ItemStack crushedDirty; - for (Materials v : Materials.values()) { - crushedClean = GT_OreDictUnificator.get(OrePrefixes.crushedPurified, v, 1L); - crushedDirty = GT_OreDictUnificator.get(OrePrefixes.crushed, v, 1L); - addSimpleWashRecipe(crushedDirty, crushedClean); - } - - for (Werkstoff v : Werkstoff.werkstoffHashSet) { - crushedClean = v.hasItemType(OrePrefixes.crushedPurified) ? v.get(OrePrefixes.crushedPurified) : null; - crushedDirty = v.hasItemType(OrePrefixes.crushed) ? v.get(OrePrefixes.crushed) : null; - addSimpleWashRecipe(crushedDirty, crushedClean); - } - - return GTPPRecipeMaps.simpleWasherRecipes.getAllRecipes() - .size() > mRecipeCount; - } - - private static void addSimpleWashRecipe(ItemStack aInput, ItemStack aOutput) { - if (aInput != null && aOutput != null) { - GT_Recipe aRecipe = new GT_Recipe( - false, - new ItemStack[] { aInput }, - new ItemStack[] { aOutput }, - null, - new int[] {}, - new FluidStack[] { FluidUtils.getFluidStack("water", 100) }, - new FluidStack[] {}, - 5, - 8, - 0); - GTPPRecipeMaps.simpleWasherRecipes.addRecipe(aRecipe); - } - } -} diff --git a/gtpp/src/main/java/gtPlusPlus/xmod/gregtech/registration/gregtech/GregtechSolarTower.java b/gtpp/src/main/java/gtPlusPlus/xmod/gregtech/registration/gregtech/GregtechSolarTower.java deleted file mode 100644 index 466e56181b..0000000000 --- a/gtpp/src/main/java/gtPlusPlus/xmod/gregtech/registration/gregtech/GregtechSolarTower.java +++ /dev/null @@ -1,46 +0,0 @@ -package gtPlusPlus.xmod.gregtech.registration.gregtech; - -import net.minecraftforge.fluids.FluidStack; - -import gtPlusPlus.api.objects.Logger; -import gtPlusPlus.api.recipe.GTPPRecipeMaps; -import gtPlusPlus.core.material.MISC_MATERIALS; -import gtPlusPlus.xmod.gregtech.api.enums.GregtechItemList; -import gtPlusPlus.xmod.gregtech.common.tileentities.machines.multi.production.GregtechMetaTileEntity_SolarTower; -import gtPlusPlus.xmod.gregtech.common.tileentities.misc.TileEntitySolarHeater; - -public class GregtechSolarTower { - - public static void run() { - Logger.INFO("Gregtech5u Content | Registering Solar Tower."); - run1(); - } - - private static void run1() { - // Solar Tower - GregtechItemList.Industrial_Solar_Tower.set( - new GregtechMetaTileEntity_SolarTower(863, "solartower.controller.tier.single", "Solar Tower") - .getStackForm(1L)); - GregtechItemList.Solar_Tower_Reflector.set( - new TileEntitySolarHeater( - 864, - "solarreflector.simple.single", - "Solar Reflector", - 8, - "Part of the Clean Green energy movement", - 0).getStackForm(1L)); - - // NEI recipe - GTPPRecipeMaps.solarTowerRecipes.addRecipe( - false, - null, - null, - null, - null, - new FluidStack[] { MISC_MATERIALS.SOLAR_SALT_COLD.getFluidStack(1000) }, - new FluidStack[] { MISC_MATERIALS.SOLAR_SALT_HOT.getFluidStack(1000) }, - 0, - 0, - 0); - } -} diff --git a/gtpp/src/main/java/gtPlusPlus/xmod/gregtech/registration/gregtech/GregtechSteamMultis.java b/gtpp/src/main/java/gtPlusPlus/xmod/gregtech/registration/gregtech/GregtechSteamMultis.java deleted file mode 100644 index 9c3a73092b..0000000000 --- a/gtpp/src/main/java/gtPlusPlus/xmod/gregtech/registration/gregtech/GregtechSteamMultis.java +++ /dev/null @@ -1,30 +0,0 @@ -package gtPlusPlus.xmod.gregtech.registration.gregtech; - -import gtPlusPlus.api.objects.Logger; -import gtPlusPlus.xmod.gregtech.api.enums.GregtechItemList; -import gtPlusPlus.xmod.gregtech.api.metatileentity.implementations.GT_MetaTileEntity_Hatch_Steam_BusInput; -import gtPlusPlus.xmod.gregtech.api.metatileentity.implementations.GT_MetaTileEntity_Hatch_Steam_BusOutput; -import gtPlusPlus.xmod.gregtech.common.tileentities.machines.multi.processing.steam.GregtechMetaTileEntity_SteamCompressor; -import gtPlusPlus.xmod.gregtech.common.tileentities.machines.multi.processing.steam.GregtechMetaTileEntity_SteamMacerator; - -public class GregtechSteamMultis { - - public static void run() { - - Logger.INFO("Gregtech5u Content | Registering Steam Multiblocks."); - - GregtechItemList.Controller_SteamMaceratorMulti.set( - new GregtechMetaTileEntity_SteamMacerator(31041, "gtpp.multimachine.steam.macerator", "Steam Grinder") - .getStackForm(1L)); - GregtechItemList.Controller_SteamCompressorMulti.set( - new GregtechMetaTileEntity_SteamCompressor(31078, "gtpp.multimachine.steam.compressor", "Steam Squasher") - .getStackForm(1L)); - - GregtechItemList.Hatch_Input_Bus_Steam.set( - new GT_MetaTileEntity_Hatch_Steam_BusInput(31046, "hatch.input_bus.tier.steam", "Input Bus (Steam)", 0) - .getStackForm(1L)); - GregtechItemList.Hatch_Output_Bus_Steam.set( - new GT_MetaTileEntity_Hatch_Steam_BusOutput(31047, "hatch.output_bus.tier.steam", "Output Bus (Steam)", 0) - .getStackForm(1L)); - } -} diff --git a/gtpp/src/main/java/gtPlusPlus/xmod/gregtech/registration/gregtech/GregtechSuperChests.java b/gtpp/src/main/java/gtPlusPlus/xmod/gregtech/registration/gregtech/GregtechSuperChests.java deleted file mode 100644 index 51ff8c879c..0000000000 --- a/gtpp/src/main/java/gtPlusPlus/xmod/gregtech/registration/gregtech/GregtechSuperChests.java +++ /dev/null @@ -1,30 +0,0 @@ -package gtPlusPlus.xmod.gregtech.registration.gregtech; - -import gtPlusPlus.xmod.gregtech.api.enums.GregtechItemList; -import gtPlusPlus.xmod.gregtech.common.tileentities.storage.GT_MetaTileEntity_TieredChest; - -public class GregtechSuperChests { - - public static void run() { - int mId = 946; - - String aSuffix = " [Disabled]"; - - GregtechItemList.Super_Chest_LV.set( - (new GT_MetaTileEntity_TieredChest(mId++, "super.chest.gtpp.tier.01", "Super Chest I" + aSuffix, 1)) - .getStackForm(1L)); - GregtechItemList.Super_Chest_MV.set( - (new GT_MetaTileEntity_TieredChest(mId++, "super.chest.gtpp.tier.02", "Super Chest II" + aSuffix, 2)) - .getStackForm(1L)); - GregtechItemList.Super_Chest_HV.set( - (new GT_MetaTileEntity_TieredChest(mId++, "super.chest.gtpp.tier.03", "Super Chest III" + aSuffix, 3)) - .getStackForm(1L)); - GregtechItemList.Super_Chest_EV.set( - (new GT_MetaTileEntity_TieredChest(mId++, "super.chest.gtpp.tier.04", "Super Chest IV" + aSuffix, 4)) - .getStackForm(1L)); - GregtechItemList.Super_Chest_IV.set( - (new GT_MetaTileEntity_TieredChest(mId++, "super.chest.gtpp.tier.05", "Super Chest V" + aSuffix, 5)) - .getStackForm(1L)); - - } -} diff --git a/gtpp/src/main/java/gtPlusPlus/xmod/gregtech/registration/gregtech/GregtechThaumcraftDevices.java b/gtpp/src/main/java/gtPlusPlus/xmod/gregtech/registration/gregtech/GregtechThaumcraftDevices.java deleted file mode 100644 index a8c8a8fa6d..0000000000 --- a/gtpp/src/main/java/gtPlusPlus/xmod/gregtech/registration/gregtech/GregtechThaumcraftDevices.java +++ /dev/null @@ -1,29 +0,0 @@ -package gtPlusPlus.xmod.gregtech.registration.gregtech; - -import static gregtech.api.enums.Mods.Thaumcraft; - -import gtPlusPlus.api.objects.Logger; -import gtPlusPlus.xmod.gregtech.api.enums.GregtechItemList; -import gtPlusPlus.xmod.gregtech.common.tileentities.machines.basic.GregtechMetaPollutionCreator; - -public class GregtechThaumcraftDevices { - - public static void run() { - if (Thaumcraft.isModLoaded()) { - Logger.INFO("Gregtech5u Content | Registering Thaumcraft content."); - run1(); - } - } - - private static void run1() { - // 956-960 - GregtechItemList.Thaumcraft_Researcher.set( - new GregtechMetaPollutionCreator( - 956, - "thaumcraft.gtpp.machine.01", - "Arcane Researcher", - 5, - "Thinking for you.", - 0).getStackForm(1L)); - } -} diff --git a/gtpp/src/main/java/gtPlusPlus/xmod/gregtech/registration/gregtech/GregtechThreadedBuffers.java b/gtpp/src/main/java/gtPlusPlus/xmod/gregtech/registration/gregtech/GregtechThreadedBuffers.java deleted file mode 100644 index 695ae84b38..0000000000 --- a/gtpp/src/main/java/gtPlusPlus/xmod/gregtech/registration/gregtech/GregtechThreadedBuffers.java +++ /dev/null @@ -1,13 +0,0 @@ -package gtPlusPlus.xmod.gregtech.registration.gregtech; - -import gtPlusPlus.xmod.gregtech.api.enums.GregtechItemList; -import gtPlusPlus.xmod.gregtech.common.tileentities.storage.creative.GT_MetaTileEntity_InfiniteItemHolder; - -public class GregtechThreadedBuffers { - - public static void run() { - GregtechItemList.Infinite_Item_Chest.set( - (new GT_MetaTileEntity_InfiniteItemHolder(31010, "infinite.chest.tier.01", "Infinite Item Chest", 1)) - .getStackForm(1L)); - } -} diff --git a/gtpp/src/main/java/gtPlusPlus/xmod/gregtech/registration/gregtech/GregtechTieredFluidTanks.java b/gtpp/src/main/java/gtPlusPlus/xmod/gregtech/registration/gregtech/GregtechTieredFluidTanks.java deleted file mode 100644 index b5db00d058..0000000000 --- a/gtpp/src/main/java/gtPlusPlus/xmod/gregtech/registration/gregtech/GregtechTieredFluidTanks.java +++ /dev/null @@ -1,31 +0,0 @@ -package gtPlusPlus.xmod.gregtech.registration.gregtech; - -import gtPlusPlus.api.objects.Logger; -import gtPlusPlus.core.lib.CORE; -import gtPlusPlus.xmod.gregtech.api.enums.GregtechItemList; -import gtPlusPlus.xmod.gregtech.common.tileentities.storage.GT_MetaTileEntity_TieredTank; - -public class GregtechTieredFluidTanks { - - public static void run() { - Logger.INFO("Gregtech5u Content | Registering Portable Fluid Tanks."); - if (CORE.ConfigSwitches.enableMachine_FluidTanks) { - run1(); - } - } - - private static void run1() { - int ID = 817; - Logger.INFO("Only loading ULV-IV tier tanks for New Horizons Modpack."); - GregtechItemList.GT_FluidTank_ULV.set( - new GT_MetaTileEntity_TieredTank(ID++, "fluidtank.tier.00", "Ultra Low Voltage Fluid Tank", 0) - .getStackForm(1L)); - GregtechItemList.GT_FluidTank_LV.set( - new GT_MetaTileEntity_TieredTank(ID++, "fluidtank.tier.01", "Low Voltage Fluid Tank", 1).getStackForm(1L)); - GregtechItemList.GT_FluidTank_MV.set( - new GT_MetaTileEntity_TieredTank(ID++, "fluidtank.tier.02", "Medium Voltage Fluid Tank", 2) - .getStackForm(1L)); - GregtechItemList.GT_FluidTank_HV.set( - new GT_MetaTileEntity_TieredTank(ID++, "fluidtank.tier.03", "High Voltage Fluid Tank", 3).getStackForm(1L)); - } -} diff --git a/gtpp/src/main/java/gtPlusPlus/xmod/gregtech/registration/gregtech/GregtechTreeFarmerTE.java b/gtpp/src/main/java/gtPlusPlus/xmod/gregtech/registration/gregtech/GregtechTreeFarmerTE.java deleted file mode 100644 index 8b1d4be6ee..0000000000 --- a/gtpp/src/main/java/gtPlusPlus/xmod/gregtech/registration/gregtech/GregtechTreeFarmerTE.java +++ /dev/null @@ -1,21 +0,0 @@ -package gtPlusPlus.xmod.gregtech.registration.gregtech; - -import gtPlusPlus.api.objects.Logger; -import gtPlusPlus.core.lib.CORE; -import gtPlusPlus.xmod.gregtech.api.enums.GregtechItemList; -import gtPlusPlus.xmod.gregtech.api.metatileentity.implementations.GregtechMetaTreeFarmerStructural; - -public class GregtechTreeFarmerTE { - - public static void run() { - Logger.INFO("Gregtech5u Content | Registering Tree Farmer Structural Block."); - if (CORE.ConfigSwitches.enableMultiblock_TreeFarmer) { - run1(); - } - } - - private static void run1() { - GregtechItemList.TreeFarmer_Structural - .set(new GregtechMetaTreeFarmerStructural(752, "treefarmer.structural", "Farm Keeper", 0).getStackForm(1L)); - } -} diff --git a/gtpp/src/main/java/gtPlusPlus/xmod/gregtech/registration/gregtech/GregtechWirelessChargers.java b/gtpp/src/main/java/gtPlusPlus/xmod/gregtech/registration/gregtech/GregtechWirelessChargers.java deleted file mode 100644 index 452c9117ed..0000000000 --- a/gtpp/src/main/java/gtPlusPlus/xmod/gregtech/registration/gregtech/GregtechWirelessChargers.java +++ /dev/null @@ -1,96 +0,0 @@ -package gtPlusPlus.xmod.gregtech.registration.gregtech; - -import gregtech.api.util.GT_ModHandler; -import gtPlusPlus.api.objects.Logger; -import gtPlusPlus.core.util.Utils; -import gtPlusPlus.xmod.gregtech.api.enums.GregtechItemList; -import gtPlusPlus.xmod.gregtech.common.helpers.ChargingHelper; -import gtPlusPlus.xmod.gregtech.common.tileentities.machines.basic.GregtechMetaWirelessCharger; - -public class GregtechWirelessChargers { - - public static void run() { - - Logger.INFO("Gregtech5u Content | Registering Wireless Chargers."); - - long bitsd = GT_ModHandler.RecipeBits.DISMANTLEABLE | GT_ModHandler.RecipeBits.NOT_REMOVABLE - | GT_ModHandler.RecipeBits.REVERSIBLE - | GT_ModHandler.RecipeBits.BUFFERED; - int mID = 890; - - Utils.registerEvent(new ChargingHelper()); - - GregtechItemList.Charger_LV.set( - new GregtechMetaWirelessCharger( - mID++, - "wificharger.01.tier.single", - "Wireless Charger MK I", - 1, - "Hopefully won't give you cancer.", - 0).getStackForm(1L)); - GregtechItemList.Charger_MV.set( - new GregtechMetaWirelessCharger( - mID++, - "wificharger.02.tier.single", - "Wireless Charger MK II", - 2, - "Hopefully won't give you cancer.", - 0).getStackForm(1L)); - GregtechItemList.Charger_HV.set( - new GregtechMetaWirelessCharger( - mID++, - "wificharger.03.tier.single", - "Wireless Charger MK III", - 3, - "Hopefully won't give you cancer.", - 0).getStackForm(1L)); - GregtechItemList.Charger_EV.set( - new GregtechMetaWirelessCharger( - mID++, - "wificharger.04.tier.single", - "Wireless Charger MK IV", - 4, - "Hopefully won't give you cancer.", - 0).getStackForm(1L)); - GregtechItemList.Charger_IV.set( - new GregtechMetaWirelessCharger( - mID++, - "wificharger.05.tier.single", - "Wireless Charger MK V", - 5, - "Hopefully won't give you cancer.", - 0).getStackForm(1L)); - GregtechItemList.Charger_LuV.set( - new GregtechMetaWirelessCharger( - mID++, - "wificharger.06.tier.single", - "Wireless Charger MK VI", - 6, - "Hopefully won't give you cancer.", - 0).getStackForm(1L)); - GregtechItemList.Charger_ZPM.set( - new GregtechMetaWirelessCharger( - mID++, - "wificharger.07.tier.single", - "Wireless Charger MK VII", - 7, - "Hopefully won't give you cancer.", - 0).getStackForm(1L)); - GregtechItemList.Charger_UV.set( - new GregtechMetaWirelessCharger( - mID++, - "wificharger.08.tier.single", - "Wireless Charger MK VIII", - 8, - "Hopefully won't give you cancer.", - 0).getStackForm(1L)); - GregtechItemList.Charger_UHV.set( - new GregtechMetaWirelessCharger( - mID++, - "wificharger.09.tier.single", - "Wireless Charger MK IX", - 9, - "Hopefully won't give you cancer.", - 0).getStackForm(1L)); - } -} diff --git a/gtpp/src/main/java/gtPlusPlus/xmod/ic2/CustomInternalName.java b/gtpp/src/main/java/gtPlusPlus/xmod/ic2/CustomInternalName.java deleted file mode 100644 index 4d7c19792f..0000000000 --- a/gtpp/src/main/java/gtPlusPlus/xmod/ic2/CustomInternalName.java +++ /dev/null @@ -1,23 +0,0 @@ -package gtPlusPlus.xmod.ic2; - -import net.minecraftforge.common.util.EnumHelper; - -import ic2.core.init.InternalName; - -public class CustomInternalName { - - public static InternalName aHazmatHelmetEx; - public static InternalName aHazmatChestEx; - public static InternalName aHazmatLegsEx; - public static InternalName aHazmatBootsEx; - - public static void init() { - aHazmatHelmetEx = EnumHelper - .addEnum(InternalName.class, "itemArmorHazmatHelmetEx", new Class[] {}, new Object[] {}); - aHazmatChestEx = EnumHelper - .addEnum(InternalName.class, "itemArmorHazmatChestplateEx", new Class[] {}, new Object[] {}); - aHazmatLegsEx = EnumHelper - .addEnum(InternalName.class, "itemArmorHazmatLeggingsEx", new Class[] {}, new Object[] {}); - aHazmatBootsEx = EnumHelper.addEnum(InternalName.class, "itemArmorRubBootsEx", new Class[] {}, new Object[] {}); - } -} diff --git a/gtpp/src/main/java/gtPlusPlus/xmod/ic2/HANDLER_IC2.java b/gtpp/src/main/java/gtPlusPlus/xmod/ic2/HANDLER_IC2.java deleted file mode 100644 index 475d8d5feb..0000000000 --- a/gtpp/src/main/java/gtPlusPlus/xmod/ic2/HANDLER_IC2.java +++ /dev/null @@ -1,15 +0,0 @@ -package gtPlusPlus.xmod.ic2; - -import gtPlusPlus.xmod.ic2.item.IC2_Items; -import gtPlusPlus.xmod.ic2.recipe.RECIPE_IC2; - -public class HANDLER_IC2 { - - public static void preInit() { - IC2_Items.register(); - } - - public static void postInit() { - RECIPE_IC2.initRecipes(); - } -} diff --git a/gtpp/src/main/java/gtPlusPlus/xmod/ic2/item/CustomKineticRotor.java b/gtpp/src/main/java/gtPlusPlus/xmod/ic2/item/CustomKineticRotor.java deleted file mode 100644 index 82daf41c90..0000000000 --- a/gtpp/src/main/java/gtPlusPlus/xmod/ic2/item/CustomKineticRotor.java +++ /dev/null @@ -1,244 +0,0 @@ -package gtPlusPlus.xmod.ic2.item; - -import static gregtech.api.enums.Mods.EnderIO; - -import java.util.List; - -import net.minecraft.client.Minecraft; -import net.minecraft.client.renderer.texture.IIconRegister; -import net.minecraft.entity.player.EntityPlayer; -import net.minecraft.item.Item; -import net.minecraft.item.ItemStack; -import net.minecraft.util.IIcon; -import net.minecraft.util.ResourceLocation; -import net.minecraft.util.StatCollector; - -import cpw.mods.fml.common.registry.GameRegistry; -import cpw.mods.fml.relauncher.Side; -import cpw.mods.fml.relauncher.SideOnly; -import ic2.api.item.IKineticRotor; -import ic2.core.IC2; -import ic2.core.block.kineticgenerator.gui.GuiWaterKineticGenerator; -import ic2.core.block.kineticgenerator.gui.GuiWindKineticGenerator; - -public class CustomKineticRotor extends Item implements IKineticRotor { - - private final int mTier; - - @SideOnly(Side.CLIENT) - private IIcon[] mTextures; - - private static final String[] mRegistrationNames = new String[] { "itemwoodrotor", "itemironrotor", - "itemsteelrotor", "itemwcarbonrotor" }; - - private static final String[] mUnlocalNames = new String[] { "itemEnergeticRotor", "itemTungstenSteelRotor", - "itemVibrantRotor", "itemIridiumRotor", "itemMagnaliumRotor", "itemUltimetRotor", }; - private static final int[] mMaxDurability = new int[] { 512000, 809600, 1600000, 3200000 }; - private static final int[] mRadius = new int[] { 9, 11, 13, 15 }; - private static final float[] mEfficiency = new float[] { 0.9f, 1.0f, 1.2f, 1.5f }; - private static final int[] mMinWindStrength = new int[] { 12, 14, 16, 18 }; - private static final int[] mMaxWindStrength = new int[] { 80, 120, 160, 320 }; - - private static final ResourceLocation[] mResourceLocations = new ResourceLocation[] { - new ResourceLocation(IC2.textureDomain, "textures/items/rotors/rotorEnergeticModel.png"), - new ResourceLocation(IC2.textureDomain, "textures/items/rotors/rotorTungstenSteelModel.png"), - new ResourceLocation(IC2.textureDomain, "textures/items/rotors/rotorVibrantModel.png"), - new ResourceLocation(IC2.textureDomain, "textures/items/rotors/rotorIridiumModel.png"), - new ResourceLocation(IC2.textureDomain, "textures/items/rotors/rotorMagnaliumModel.png"), - new ResourceLocation(IC2.textureDomain, "textures/items/rotors/rotorUltimetModel.png"), }; - - private final int maxWindStrength; - private final int minWindStrength; - private final int radius; - private final float efficiency; - private final ResourceLocation renderTexture; - - public CustomKineticRotor(int aTier) { - mTier = aTier; - this.setMaxStackSize(1); - // Handle Differences if EIO is not loaded - if (!EnderIO.isModLoaded() && (aTier == 0 || aTier == 2)) { - this.renderTexture = mResourceLocations[(aTier == 0 ? 4 : 5)]; - this.setUnlocalizedName(mUnlocalNames[(aTier == 0 ? 4 : 5)]); - } else { - this.renderTexture = mResourceLocations[aTier]; - this.setUnlocalizedName(mUnlocalNames[aTier]); - } - this.setMaxDamage(mMaxDurability[aTier]); - this.radius = mRadius[aTier]; - this.efficiency = mEfficiency[aTier]; - this.minWindStrength = mMinWindStrength[aTier]; - this.maxWindStrength = mMaxWindStrength[aTier]; - this.setNoRepair(); - this.setCreativeTab(IC2.tabIC2); - GameRegistry.registerItem(this, mRegistrationNames[aTier]); - } - - @Override - public void setDamage(final ItemStack stack, final int damage) { - if (mTier < 3) { - super.setDamage(stack, damage); - } - } - - @Override - public void addInformation(final ItemStack itemStack, final EntityPlayer player, final List info, final boolean b) { - - info.add( - StatCollector.translateToLocalFormatted( - "ic2.itemrotor.wind.info", - new Object[] { this.minWindStrength, this.maxWindStrength })); - - GearboxType type = null; - if (Minecraft.getMinecraft().currentScreen != null - && Minecraft.getMinecraft().currentScreen instanceof GuiWaterKineticGenerator) { - type = GearboxType.WATER; - } else if (Minecraft.getMinecraft().currentScreen != null - && Minecraft.getMinecraft().currentScreen instanceof GuiWindKineticGenerator) { - type = GearboxType.WIND; - } - - if (type != null) { - info.add(StatCollector.translateToLocal("ic2.itemrotor.fitsin." + this.isAcceptedType(itemStack, type))); - } - } - - @Override - public int getDiameter(final ItemStack stack) { - return this.radius; - } - - @Override - public ResourceLocation getRotorRenderTexture(final ItemStack stack) { - return this.renderTexture; - } - - @Override - public float getEfficiency(final ItemStack stack) { - return this.efficiency; - } - - @Override - public int getMinWindStrength(final ItemStack stack) { - return this.minWindStrength; - } - - @Override - public int getMaxWindStrength(final ItemStack stack) { - return this.maxWindStrength; - } - - @Override - public boolean isAcceptedType(final ItemStack stack, final IKineticRotor.GearboxType type) { - return (type == IKineticRotor.GearboxType.WIND) || (type == IKineticRotor.GearboxType.WATER); - } - - @Override - public String getUnlocalizedName() { - return "ic2." + super.getUnlocalizedName().substring(5); - } - - @Override - public String getUnlocalizedName(ItemStack itemStack) { - return this.getUnlocalizedName(); - } - - @Override - public String getItemStackDisplayName(ItemStack itemStack) { - return StatCollector.translateToLocal(this.getUnlocalizedName(itemStack)); - } - - @Override - public boolean showDurabilityBar(ItemStack stack) { - return mTier < 3; - } - - @Override - @SideOnly(Side.CLIENT) - public IIcon getIconFromDamage(int meta) { - if (!EnderIO.isModLoaded() && (mTier == 0 || mTier == 2)) { - if (mTier == 0) { - return mTextures[4]; - } else { - return mTextures[5]; - } - } else { - return mTextures[mTier]; - } - } - - @Override - @SideOnly(Side.CLIENT) - public IIcon getIconIndex(ItemStack aIndex) { - if (!EnderIO.isModLoaded() && (mTier == 0 || mTier == 2)) { - if (mTier == 0) { - return mTextures[4]; - } else { - return mTextures[5]; - } - } else { - return mTextures[mTier]; - } - } - - @Override - @SideOnly(Side.CLIENT) - public IIcon getIconFromDamageForRenderPass(int aDmg, int aPass) { - if (!EnderIO.isModLoaded() && (mTier == 0 || mTier == 2)) { - if (mTier == 0) { - return mTextures[4]; - } else { - return mTextures[5]; - } - } else { - return mTextures[mTier]; - } - } - - @Override - protected String getIconString() { - return super.getIconString(); - } - - @Override - public double getDurabilityForDisplay(ItemStack stack) { - return super.getDurabilityForDisplay(stack); - } - - @Override - @SideOnly(Side.CLIENT) - public IIcon getIcon(ItemStack stack, int renderPass, EntityPlayer player, ItemStack usingItem, int useRemaining) { - if (!EnderIO.isModLoaded() && (mTier == 0 || mTier == 2)) { - if (mTier == 0) { - return mTextures[4]; - } else { - return mTextures[5]; - } - } else { - return mTextures[mTier]; - } - } - - @Override - @SideOnly(Side.CLIENT) - public IIcon getIcon(ItemStack stack, int pass) { - if (!EnderIO.isModLoaded() && (mTier == 0 || mTier == 2)) { - if (mTier == 0) { - return mTextures[4]; - } else { - return mTextures[5]; - } - } else { - return mTextures[mTier]; - } - } - - @Override - public void registerIcons(IIconRegister iconRegister) { - int aIndex = 0; - mTextures = new IIcon[6]; - for (String y : mUnlocalNames) { - mTextures[aIndex++] = iconRegister.registerIcon(IC2.textureDomain + ":" + "rotors/" + y); - } - } -} diff --git a/gtpp/src/main/java/gtPlusPlus/xmod/ic2/item/IC2_Items.java b/gtpp/src/main/java/gtPlusPlus/xmod/ic2/item/IC2_Items.java deleted file mode 100644 index 3dacc657de..0000000000 --- a/gtpp/src/main/java/gtPlusPlus/xmod/ic2/item/IC2_Items.java +++ /dev/null @@ -1,77 +0,0 @@ -package gtPlusPlus.xmod.ic2.item; - -import static gregtech.api.enums.Mods.EnderIO; - -import net.minecraft.item.ItemStack; - -import gtPlusPlus.core.creative.AddToCreativeTab; -import gtPlusPlus.core.item.base.CoreItem; -import gtPlusPlus.core.item.wearable.hazmat.ItemArmorHazmatEx; - -public class IC2_Items { - - public static ItemStack rotor_Material_1; // Energetic Alloy - public static ItemStack rotor_Material_2; // TungstenSteel - public static ItemStack rotor_Material_3; // Vibrant Alloy - public static ItemStack rotor_Material_4; // Iridium - - public static ItemStack rotor_Blade_Material_1; - public static ItemStack rotor_Blade_Material_2; - public static ItemStack rotor_Blade_Material_3; - public static ItemStack rotor_Blade_Material_4; - - public static ItemStack shaft_Material_1; // Energetic Alloy - public static ItemStack shaft_Material_2; // TungstenSteel - public static ItemStack shaft_Material_3; // Vibrant Alloy - public static ItemStack shaft_Material_4; // Iridium - - private static final String[] mData1 = new String[] { "itemEnergeticRotorBlade", "itemMagnaliumRotorBlade" }; - private static final String[] mData2 = new String[] { "itemEnergeticShaft", "itemMagnaliumShaft" }; - private static final String[] mData3 = new String[] { "itemVibrantRotorBlade", "itemUltimetRotorBlade" }; - private static final String[] mData4 = new String[] { "itemVibrantShaft", "itemUltimetShaft" }; - - public static void register() { - - int aIndexEIO = (EnderIO.isModLoaded() ? 0 : 1); - - // Rotor Blades - rotor_Blade_Material_1 = new ItemStack( - new CoreItem(mData1[aIndexEIO], AddToCreativeTab.tabMachines, 16, "A part for an advanced Kinetic Rotor")); - rotor_Blade_Material_2 = new ItemStack( - new CoreItem( - "itemTungstenSteelRotorBlade", - AddToCreativeTab.tabMachines, - 16, - "A part for an advanced Kinetic Rotor")); - rotor_Blade_Material_3 = new ItemStack( - new CoreItem(mData3[aIndexEIO], AddToCreativeTab.tabMachines, 16, "A part for an advanced Kinetic Rotor")); - rotor_Blade_Material_4 = new ItemStack( - new CoreItem( - "itemIridiumRotorBlade", - AddToCreativeTab.tabMachines, - 16, - "A part for an advanced Kinetic Rotor")); - - // Rotor Shafts - shaft_Material_1 = new ItemStack( - new CoreItem(mData2[aIndexEIO], AddToCreativeTab.tabMachines, 16, "A part for an advanced Kinetic Rotor")); - shaft_Material_2 = new ItemStack( - new CoreItem( - "itemTungstenSteelShaft", - AddToCreativeTab.tabMachines, - 16, - "A part for an advanced Kinetic Rotor")); - shaft_Material_3 = new ItemStack( - new CoreItem(mData4[aIndexEIO], AddToCreativeTab.tabMachines, 16, "A part for an advanced Kinetic Rotor")); - shaft_Material_4 = new ItemStack( - new CoreItem("itemIridiumShaft", AddToCreativeTab.tabMachines, 16, "A part for an advanced Kinetic Rotor")); - - // Rotors - rotor_Material_1 = new ItemStack(new CustomKineticRotor(0)); - rotor_Material_2 = new ItemStack(new CustomKineticRotor(1)); - rotor_Material_3 = new ItemStack(new CustomKineticRotor(2)); - rotor_Material_4 = new ItemStack(new CustomKineticRotor(3)); - - ItemArmorHazmatEx.init(); - } -} diff --git a/gtpp/src/main/java/gtPlusPlus/xmod/ic2/recipe/RECIPE_IC2.java b/gtpp/src/main/java/gtPlusPlus/xmod/ic2/recipe/RECIPE_IC2.java deleted file mode 100644 index 47ec1afe0f..0000000000 --- a/gtpp/src/main/java/gtPlusPlus/xmod/ic2/recipe/RECIPE_IC2.java +++ /dev/null @@ -1,365 +0,0 @@ -package gtPlusPlus.xmod.ic2.recipe; - -import static gregtech.api.enums.Mods.EnderIO; -import static gtPlusPlus.core.recipe.RECIPES_Tools.craftingToolHardHammer; -import static gtPlusPlus.core.recipe.RECIPES_Tools.craftingToolWrench; - -import net.minecraft.init.Blocks; -import net.minecraft.item.ItemStack; - -import gregtech.api.enums.GT_Values; -import gregtech.api.enums.ItemList; -import gregtech.api.enums.Materials; -import gregtech.api.enums.OrePrefixes; -import gregtech.api.util.GT_ModHandler; -import gregtech.api.util.GT_OreDictUnificator; -import gregtech.api.util.GT_Utility; -import gtPlusPlus.api.objects.Logger; -import gtPlusPlus.core.lib.CORE; -import gtPlusPlus.core.material.ALLOY; -import gtPlusPlus.core.material.Material; -import gtPlusPlus.core.recipe.common.CI; -import gtPlusPlus.core.util.minecraft.ItemUtils; -import gtPlusPlus.core.util.minecraft.MaterialUtils; -import gtPlusPlus.core.util.minecraft.RecipeUtils; -import gtPlusPlus.xmod.gregtech.api.enums.GregtechItemList; -import gtPlusPlus.xmod.ic2.item.IC2_Items; -import ic2.core.Ic2Items; - -public class RECIPE_IC2 { - - public static String plate_T1 = "plateEnergeticAlloy"; - public static String plate_T2 = "plateTungstenSteel"; - public static String plate_T3 = "plateVibrantAlloy"; - public static String plate_T4 = "plateAlloyIridium"; - - public static ItemStack block_T1 = GT_OreDictUnificator.get(OrePrefixes.ingot, Materials.EnergeticAlloy, 1L); - public static ItemStack block_T2 = GT_OreDictUnificator.get(OrePrefixes.ingot, Materials.TungstenSteel, 1L); - public static ItemStack block_T3 = GT_OreDictUnificator.get(OrePrefixes.ingot, Materials.VibrantAlloy, 1L); - public static ItemStack block_T4 = GT_OreDictUnificator.get(OrePrefixes.ingot, Materials.Iridium, 1L); - - public static ItemStack shaft_block_T1 = GT_OreDictUnificator.get(OrePrefixes.block, Materials.EnergeticAlloy, 1L); - public static ItemStack shaft_block_T2 = GT_OreDictUnificator.get(OrePrefixes.block, Materials.TungstenSteel, 1L); - public static ItemStack shaft_block_T3 = GT_OreDictUnificator.get(OrePrefixes.block, Materials.VibrantAlloy, 1L); - public static ItemStack shaft_block_T4 = GT_OreDictUnificator.get(OrePrefixes.block, Materials.Iridium, 1L); - - public static String ingot_T1 = "ingotEnergeticAlloy"; - public static String ingot_T2 = "ingotTungstenSteel"; - public static String ingot_T3 = "ingotVibrantAlloy"; - public static String ingot_T4 = "ingotIridium"; - - public static String ring_T1 = "ringStainlessSteel"; - public static String ring_T2 = "ringTungstenSteel"; - public static String ring_T3 = "ringChrome"; - public static String ring_T4 = "ringOsmiridium"; - - private static ItemStack rotor_blade_T1 = ItemUtils.getSimpleStack(IC2_Items.rotor_Blade_Material_1.getItem()); - private static ItemStack rotor_blade_T2 = ItemUtils.getSimpleStack(IC2_Items.rotor_Blade_Material_2.getItem()); - private static ItemStack rotor_blade_T3 = ItemUtils.getSimpleStack(IC2_Items.rotor_Blade_Material_3.getItem()); - private static ItemStack rotor_blade_T4 = ItemUtils.getSimpleStack(IC2_Items.rotor_Blade_Material_4.getItem()); - - private static ItemStack shaft_T1 = ItemUtils.getSimpleStack(IC2_Items.shaft_Material_1.getItem()); - private static ItemStack shaft_T2 = ItemUtils.getSimpleStack(IC2_Items.shaft_Material_2.getItem()); - private static ItemStack shaft_T3 = ItemUtils.getSimpleStack(IC2_Items.shaft_Material_3.getItem()); - private static ItemStack shaft_T4 = ItemUtils.getSimpleStack(IC2_Items.shaft_Material_4.getItem()); - - private static ItemStack rotor_T1 = ItemUtils.getSimpleStack(IC2_Items.rotor_Material_1.getItem()); - private static ItemStack rotor_T2 = ItemUtils.getSimpleStack(IC2_Items.rotor_Material_2.getItem()); - private static ItemStack rotor_T3 = ItemUtils.getSimpleStack(IC2_Items.rotor_Material_3.getItem()); - private static ItemStack rotor_T4 = ItemUtils.getSimpleStack(IC2_Items.rotor_Material_4.getItem()); - - private static boolean checkForEnderIO() { - if (!EnderIO.isModLoaded()) { - plate_T1 = "plateMagnalium"; - plate_T2 = "plateTungstenSteel"; - plate_T3 = "plateUltimet"; - plate_T4 = "plateAlloyIridium"; - - block_T1 = GT_OreDictUnificator.get(OrePrefixes.ingot, Materials.Magnalium, 1L); - block_T2 = GT_OreDictUnificator.get(OrePrefixes.ingot, Materials.TungstenSteel, 1L); - block_T3 = GT_OreDictUnificator.get(OrePrefixes.ingot, Materials.Ultimet, 1L); - block_T4 = GT_OreDictUnificator.get(OrePrefixes.ingot, Materials.Iridium, 1L); - - ingot_T1 = "ingotMagnalium"; - ingot_T2 = "ingotTungstenSteel"; - ingot_T3 = "ingotUltimet"; - ingot_T4 = "ingotIridium"; - return true; - } - return false; - } - - public static void initRecipes() { - - checkForEnderIO(); - addAdvancedHazmat(); - - RecipeUtils.addShapedRecipe( - plate_T1, - plate_T1, - plate_T1, - plate_T1, - ring_T1, - plate_T1, - plate_T1, - plate_T1, - plate_T1, - rotor_blade_T1); - - RecipeUtils.addShapedRecipe( - plate_T2, - plate_T2, - plate_T2, - plate_T2, - ring_T2, - plate_T2, - plate_T2, - plate_T2, - plate_T2, - rotor_blade_T2); - - RecipeUtils.addShapedRecipe( - plate_T3, - plate_T3, - plate_T3, - plate_T3, - ring_T3, - plate_T3, - plate_T3, - plate_T3, - plate_T3, - rotor_blade_T3); - - RecipeUtils.addShapedRecipe( - plate_T4, - plate_T4, - plate_T4, - plate_T4, - ring_T4, - plate_T4, - plate_T4, - plate_T4, - plate_T4, - rotor_blade_T4); - - // Shaft Extruder Recipe - GT_ModHandler.addCraftingRecipe( - GregtechItemList.Shape_Extruder_WindmillShaft.get(1L, new Object[0]), - GT_ModHandler.RecipeBits.BUFFERED | GT_ModHandler.RecipeBits.NOT_REMOVABLE - | GT_ModHandler.RecipeBits.REVERSIBLE, - new Object[] { "hXS", "XPX", "fXd", Character.valueOf('P'), ItemList.Shape_Extruder_Rod, - Character.valueOf('X'), OrePrefixes.plate.get(Materials.DarkSteel), Character.valueOf('S'), - OrePrefixes.screw.get(Materials.DarkSteel) }); - GT_ModHandler.addCraftingRecipe( - GregtechItemList.Shape_Extruder_WindmillShaft.get(1L, new Object[0]), - GT_ModHandler.RecipeBits.BUFFERED | GT_ModHandler.RecipeBits.NOT_REMOVABLE - | GT_ModHandler.RecipeBits.REVERSIBLE, - new Object[] { "hXS", "XPX", "fXd", Character.valueOf('P'), ItemList.Shape_Extruder_Rod, - Character.valueOf('X'), OrePrefixes.plate.get(Materials.TungstenSteel), Character.valueOf('S'), - OrePrefixes.screw.get(Materials.TungstenSteel) }); - GT_ModHandler.addCraftingRecipe( - GregtechItemList.Shape_Extruder_WindmillShaft.get(1L, new Object[0]), - GT_ModHandler.RecipeBits.BUFFERED | GT_ModHandler.RecipeBits.NOT_REMOVABLE - | GT_ModHandler.RecipeBits.REVERSIBLE, - new Object[] { "hXS", "XPX", "fXd", Character.valueOf('P'), ItemList.Shape_Extruder_Rod, - Character.valueOf('X'), OrePrefixes.plate.get(Materials.Molybdenum), Character.valueOf('S'), - OrePrefixes.screw.get(Materials.Molybdenum) }); - Logger.INFO("Added recipe item for GT5 Extruder: Shaft Shape"); - - // Custm Recipes for Iron and Steel - ItemStack mShaftIron = ItemList.IC2_ShaftIron.get(1); - ItemStack mShaftSteel = ItemList.IC2_ShaftSteel.get(1); - GT_Values.RA.addExtruderRecipe( - GT_Utility.copyAmount(9L, GT_OreDictUnificator.get(OrePrefixes.ingot, Materials.Iron, 1L)), - GregtechItemList.Shape_Extruder_WindmillShaft.get(0L, new Object[0]), - mShaftIron, - 32 * 20, - 120); - GT_Values.RA.addExtruderRecipe( - GT_Utility.copyAmount(1L, GT_OreDictUnificator.get(OrePrefixes.block, Materials.Iron, 1L)), - GregtechItemList.Shape_Extruder_WindmillShaft.get(0L, new Object[0]), - mShaftIron, - 32 * 20, - 120); - GT_Values.RA.addExtruderRecipe( - GT_Utility.copyAmount(9L, GT_OreDictUnificator.get(OrePrefixes.ingot, Materials.WroughtIron, 1L)), - GregtechItemList.Shape_Extruder_WindmillShaft.get(0L, new Object[0]), - mShaftIron, - 32 * 20, - 120); - GT_Values.RA.addExtruderRecipe( - GT_Utility.copyAmount(1L, GT_OreDictUnificator.get(OrePrefixes.block, Materials.WroughtIron, 1L)), - GregtechItemList.Shape_Extruder_WindmillShaft.get(0L, new Object[0]), - mShaftIron, - 32 * 20, - 120); - GT_Values.RA.addExtruderRecipe( - GT_Utility.copyAmount(9L, GT_OreDictUnificator.get(OrePrefixes.ingot, Materials.Steel, 1L)), - GregtechItemList.Shape_Extruder_WindmillShaft.get(0L, new Object[0]), - mShaftSteel, - 64 * 20, - 120); - GT_Values.RA.addExtruderRecipe( - GT_Utility.copyAmount(1L, GT_OreDictUnificator.get(OrePrefixes.block, Materials.Steel, 1L)), - GregtechItemList.Shape_Extruder_WindmillShaft.get(0L, new Object[0]), - mShaftSteel, - 64 * 20, - 120); - - // Shaft Recipes - GT_Values.RA.addExtruderRecipe( - GT_Utility.copyAmount(9L, block_T1), - GregtechItemList.Shape_Extruder_WindmillShaft.get(0L, new Object[0]), - shaft_T1, - 2560, - 250); - GT_Values.RA.addExtruderRecipe( - GT_Utility.copyAmount(1L, shaft_block_T1), - GregtechItemList.Shape_Extruder_WindmillShaft.get(0L, new Object[0]), - shaft_T1, - 2560, - 250); - Logger.INFO("Added recipe for GT5 Extruder: Windmill Shaft [Energetic]"); - GT_Values.RA.addExtruderRecipe( - GT_Utility.copyAmount(9L, block_T2), - GregtechItemList.Shape_Extruder_WindmillShaft.get(0L, new Object[0]), - shaft_T2, - 5120, - 500); - GT_Values.RA.addExtruderRecipe( - GT_Utility.copyAmount(1L, shaft_block_T2), - GregtechItemList.Shape_Extruder_WindmillShaft.get(0L, new Object[0]), - shaft_T2, - 5120, - 500); - - Logger.INFO("Added recipe for GT5 Extruder: Windmill Shaft [TungstenSteel]"); - GT_Values.RA.addExtruderRecipe( - GT_Utility.copyAmount(9L, block_T3), - GregtechItemList.Shape_Extruder_WindmillShaft.get(0L, new Object[0]), - shaft_T3, - 10240, - 2000); - GT_Values.RA.addExtruderRecipe( - GT_Utility.copyAmount(1L, shaft_block_T3), - GregtechItemList.Shape_Extruder_WindmillShaft.get(0L, new Object[0]), - shaft_T3, - 10240, - 2000); - Logger.INFO("Added recipe for GT5 Extruder: Windmill Shaft [Vibrant]"); - GT_Values.RA.addExtruderRecipe( - GT_Utility.copyAmount(9L, block_T4), - GregtechItemList.Shape_Extruder_WindmillShaft.get(0L, new Object[0]), - shaft_T4, - 20480, - 4000); - GT_Values.RA.addExtruderRecipe( - GT_Utility.copyAmount(1L, shaft_block_T4), - GregtechItemList.Shape_Extruder_WindmillShaft.get(0L, new Object[0]), - shaft_T4, - 20480, - 4000); - Logger.INFO("Added recipe for GT5 Extruder: Windmill Shaft [Iridium]"); - - RecipeUtils.addShapedRecipe( - shaft_T1, - rotor_blade_T1, - craftingToolHardHammer, - rotor_blade_T1, - ring_T1, - rotor_blade_T1, - craftingToolWrench, - rotor_blade_T1, - shaft_T1, - rotor_T1); - - RecipeUtils.addShapedRecipe( - shaft_T2, - rotor_blade_T2, - craftingToolHardHammer, - rotor_blade_T2, - ring_T2, - rotor_blade_T2, - craftingToolWrench, - rotor_blade_T2, - shaft_T2, - rotor_T2); - - RecipeUtils.addShapedRecipe( - shaft_T3, - rotor_blade_T3, - craftingToolHardHammer, - rotor_blade_T3, - ring_T3, - rotor_blade_T3, - craftingToolWrench, - rotor_blade_T3, - shaft_T3, - rotor_T3); - - RecipeUtils.addShapedRecipe( - shaft_T4, - rotor_blade_T4, - craftingToolHardHammer, - rotor_blade_T4, - ring_T4, - rotor_blade_T4, - craftingToolWrench, - rotor_blade_T4, - shaft_T4, - rotor_T4); - } - - private static void addAdvancedHazmat() { - - ItemStack[] aBasicHazmatPieces = new ItemStack[] { Ic2Items.hazmatHelmet.copy(), - Ic2Items.hazmatChestplate.copy(), Ic2Items.hazmatLeggings.copy(), Ic2Items.hazmatBoots.copy() }; - - Material aRubber = MaterialUtils.generateMaterialFromGtENUM(Materials.Rubber); - ItemStack aYellowWool = ItemUtils.getSimpleStack(Blocks.wool, 4, 1); - ItemStack aBlackWool = ItemUtils.getSimpleStack(Blocks.wool, 15, 1); - ItemStack aCoilIC2 = Ic2Items.coil; - ItemStack aPlateCobalt = CI.getTieredComponentOfMaterial(Materials.Cobalt, OrePrefixes.plate, 1); - ItemStack aGearSmallSteel = CI.getTieredComponentOfMaterial(Materials.Steel, OrePrefixes.gearGtSmall, 1); - ItemStack aGearSmallAluminium = CI - .getTieredComponentOfMaterial(Materials.Aluminium, OrePrefixes.gearGtSmall, 1); - ItemStack aGearPotin = ALLOY.TUMBAGA.getGear(1); - ItemStack aGearSiliconCarbide = ALLOY.SILICON_CARBIDE.getGear(1); - - CORE.RA.addSixSlotAssemblingRecipe( - new ItemStack[] { CI.getNumberedAdvancedCircuit(2), aBasicHazmatPieces[0], - ItemUtils.getSimpleStack(aYellowWool, 16), ItemUtils.getSimpleStack(aPlateCobalt, 4), - ItemUtils.getSimpleStack(aCoilIC2, 8), ItemUtils.getSimpleStack(aGearSmallAluminium, 4), }, - aRubber.getFluidStack(144 * 4), - GregtechItemList.Armour_Hazmat_Advanced_Helmet.get(1), - 30 * 20, - MaterialUtils.getVoltageForTier(2)); - - CORE.RA.addSixSlotAssemblingRecipe( - new ItemStack[] { CI.getNumberedAdvancedCircuit(2), aBasicHazmatPieces[1], - ItemUtils.getSimpleStack(aYellowWool, 64), ItemUtils.getSimpleStack(aCoilIC2, 32), - ItemUtils.getSimpleStack(aPlateCobalt, 16), ItemUtils.getSimpleStack(aGearSiliconCarbide, 8), }, - aRubber.getFluidStack(144 * 10), - GregtechItemList.Armour_Hazmat_Advanced_Chest.get(1), - 90 * 20, - MaterialUtils.getVoltageForTier(2)); - - CORE.RA.addSixSlotAssemblingRecipe( - new ItemStack[] { CI.getNumberedAdvancedCircuit(2), aBasicHazmatPieces[2], - ItemUtils.getSimpleStack(aYellowWool, 32), ItemUtils.getSimpleStack(aCoilIC2, 16), - ItemUtils.getSimpleStack(aPlateCobalt, 8), ItemUtils.getSimpleStack(aGearSiliconCarbide, 4), }, - aRubber.getFluidStack(144 * 8), - GregtechItemList.Armour_Hazmat_Advanced_Legs.get(1), - 75 * 20, - MaterialUtils.getVoltageForTier(2)); - - CORE.RA.addSixSlotAssemblingRecipe( - new ItemStack[] { CI.getNumberedAdvancedCircuit(2), aBasicHazmatPieces[3], - ItemUtils.getSimpleStack(aBlackWool, 16), ItemUtils.getSimpleStack(aCoilIC2, 6), - ItemUtils.getSimpleStack(aGearSmallSteel, 8), ItemUtils.getSimpleStack(aGearPotin, 4), }, - aRubber.getFluidStack(144 * 6), - GregtechItemList.Armour_Hazmat_Advanced_Boots.get(1), - 45 * 20, - MaterialUtils.getVoltageForTier(2)); - } -} diff --git a/gtpp/src/main/java/gtPlusPlus/xmod/pamsharvest/fishtrap/FishTrapHandler.java b/gtpp/src/main/java/gtPlusPlus/xmod/pamsharvest/fishtrap/FishTrapHandler.java deleted file mode 100644 index ee51f28eaa..0000000000 --- a/gtpp/src/main/java/gtPlusPlus/xmod/pamsharvest/fishtrap/FishTrapHandler.java +++ /dev/null @@ -1,73 +0,0 @@ -package gtPlusPlus.xmod.pamsharvest.fishtrap; - -import static gregtech.api.recipe.RecipeMaps.centrifugeRecipes; -import static gregtech.api.recipe.RecipeMaps.fluidExtractionRecipes; -import static gregtech.api.recipe.RecipeMaps.maceratorRecipes; -import static gregtech.api.util.GT_RecipeBuilder.SECONDS; -import static gregtech.api.util.GT_RecipeBuilder.TICKS; - -import gregtech.api.enums.GT_Values; -import gtPlusPlus.core.util.minecraft.FluidUtils; -import gtPlusPlus.core.util.minecraft.ItemUtils; - -public class FishTrapHandler { - - static final String prefix = "food"; - static final String suffix = "raw"; - static final String greenheartFish = "foodGreenheartfish"; - private static final String[] harvestcraftFish = { "Anchovy", "Bass", "Calamari", "Carp", "Catfish", "Charr", - "Clam", "Crab", "Crayfish", "Eel", "Frog", "Grouper", "Herring", "Jellyfish", "Mudfish", "Octopus", "Perch", - "Scallop", "Shrimp", "Snail", "Snapper", "Tilapia", "Trout", "Tuna", "Turtle", "Walley" }; - - public static void pamsHarvestCraftCompat() { - for (String fish : harvestcraftFish) { - final String itemName = prefix + fish + suffix; - if (ItemUtils.getItemStackOfAmountFromOreDictNoBroken(itemName, 1) != null) { - GT_Values.RA.stdBuilder() - .itemInputs(ItemUtils.getItemStackOfAmountFromOreDict(itemName, 1)) - .itemOutputs( - ItemUtils.getItemStackOfAmountFromOreDict("dustMeatRaw", 1), - ItemUtils.getItemStackOfAmountFromOreDict("dustTinyBone", 1)) - .outputChances(10000, 1000) - .duration(20 * SECONDS) - .eut(2) - .addTo(maceratorRecipes); - GT_Values.RA.stdBuilder() - .itemInputs(ItemUtils.getItemStackOfAmountFromOreDict(itemName, 1)) - .fluidOutputs(FluidUtils.getFluidStack("methane", 48)) - .duration(19 * SECONDS + 4 * TICKS) - .eut(5) - .addTo(centrifugeRecipes); - GT_Values.RA.stdBuilder() - .itemInputs(ItemUtils.getItemStackOfAmountFromOreDict(itemName, 1)) - .fluidOutputs(FluidUtils.getFluidStack("fishoil", 50)) - .duration(16 * TICKS) - .eut(4) - .addTo(fluidExtractionRecipes); - } - } - if (ItemUtils.getItemStackOfAmountFromOreDictNoBroken(greenheartFish, 1) != null) { - GT_Values.RA.stdBuilder() - .itemInputs(ItemUtils.getItemStackOfAmountFromOreDict(greenheartFish, 1)) - .itemOutputs( - ItemUtils.getItemStackOfAmountFromOreDict("dustMeatRaw", 1), - ItemUtils.getItemStackOfAmountFromOreDict("dustTinyBone", 1)) - .outputChances(10000, 1000) - .duration(20 * SECONDS) - .eut(2) - .addTo(maceratorRecipes); - GT_Values.RA.stdBuilder() - .itemInputs(ItemUtils.getItemStackOfAmountFromOreDict(greenheartFish, 1)) - .fluidOutputs(FluidUtils.getFluidStack("methane", 48)) - .duration(19 * SECONDS + 4 * TICKS) - .eut(5) - .addTo(centrifugeRecipes); - GT_Values.RA.stdBuilder() - .itemInputs(ItemUtils.getItemStackOfAmountFromOreDict(greenheartFish, 1)) - .fluidOutputs(FluidUtils.getFluidStack("fishoil", 50)) - .duration(16 * TICKS) - .eut(4) - .addTo(fluidExtractionRecipes); - } - } -} diff --git a/gtpp/src/main/java/gtPlusPlus/xmod/railcraft/HANDLER_Railcraft.java b/gtpp/src/main/java/gtPlusPlus/xmod/railcraft/HANDLER_Railcraft.java deleted file mode 100644 index 4efa85992a..0000000000 --- a/gtpp/src/main/java/gtPlusPlus/xmod/railcraft/HANDLER_Railcraft.java +++ /dev/null @@ -1,217 +0,0 @@ -package gtPlusPlus.xmod.railcraft; - -import static gregtech.api.enums.Mods.GTPlusPlus; -import static gregtech.api.enums.Mods.NewHorizonsCoreMod; -import static gregtech.api.enums.Mods.Railcraft; -import static gregtech.api.recipe.RecipeMaps.fluidExtractionRecipes; -import static gregtech.api.util.GT_RecipeBuilder.SECONDS; -import static gregtech.api.util.GT_RecipeBuilder.TICKS; -import static gregtech.api.util.GT_RecipeConstants.UniversalChemical; -import static gtPlusPlus.core.creative.AddToCreativeTab.tabMisc; - -import net.minecraft.init.Blocks; -import net.minecraft.init.Items; -import net.minecraft.item.ItemStack; - -import gregtech.api.enums.GT_Values; -import gregtech.api.enums.Materials; -import gregtech.api.enums.OrePrefixes; -import gregtech.api.util.GT_OreDictUnificator; -import gregtech.api.util.GT_Utility; -import gtPlusPlus.core.item.ModItems; -import gtPlusPlus.core.item.base.BaseItemBurnable; -import gtPlusPlus.core.lib.CORE; -import gtPlusPlus.core.recipe.common.CI; -import gtPlusPlus.core.util.minecraft.FluidUtils; -import gtPlusPlus.core.util.minecraft.ItemUtils; -import gtPlusPlus.xmod.railcraft.utils.RailcraftUtils; - -public class HANDLER_Railcraft { - - public static void preInit() { - // Register Custom Coal Coke - ModItems.itemCoalCoke = new BaseItemBurnable( - "itemCoalCoke", - "Coking Coal", - tabMisc, - 64, - 0, - "Used for metallurgy.", - "fuelCoke", - 3200, - 0).setTextureName(GTPlusPlus.ID + ":burnables/itemCoalCoke"); - - // Add in things that once existed in 1.5.2 - ModItems.itemCactusCharcoal = new BaseItemBurnable( - "itemCactusCharcoal", - "Cactus Charcoal", - tabMisc, - 64, - 0, - "Used for smelting.", - "fuelCactusCharcoal", - 400, - 0).setTextureName(GTPlusPlus.ID + ":burnables/itemCactusCharcoal"); - ModItems.itemSugarCharcoal = new BaseItemBurnable( - "itemSugarCharcoal", - "Sugar Charcoal", - tabMisc, - 64, - 0, - "Used for smelting.", - "fuelSugarCharcoal", - 400, - 0).setTextureName(GTPlusPlus.ID + ":burnables/itemSugarCharcoal"); - ModItems.itemCactusCoke = new BaseItemBurnable( - "itemCactusCoke", - "Cactus Coke", - tabMisc, - 64, - 0, - "Used for smelting.", - "fuelCactusCoke", - 800, - 0).setTextureName(GTPlusPlus.ID + ":burnables/itemCactusCoke"); - ModItems.itemSugarCoke = new BaseItemBurnable( - "itemSugarCoke", - "Sugar Coke", - tabMisc, - 64, - 0, - "Used for smelting.", - "fuelSugarCoke", - 800, - 0).setTextureName(GTPlusPlus.ID + ":burnables/itemSugarCoke"); - - ItemUtils.addItemToOreDictionary(ItemUtils.getSimpleStack(ModItems.itemCactusCharcoal), "itemCharcoalCactus"); - ItemUtils.addItemToOreDictionary(ItemUtils.getSimpleStack(ModItems.itemCactusCoke), "itemCokeCactus"); - ItemUtils.addItemToOreDictionary(ItemUtils.getSimpleStack(ModItems.itemSugarCharcoal), "itemCharcoalSugar"); - ItemUtils.addItemToOreDictionary(ItemUtils.getSimpleStack(ModItems.itemSugarCoke), "itemCokeSugar"); - } - - public static void postInit() { - generateCokeOvenRecipes(); - } - - private static void generateCokeOvenRecipes() { - ItemStack[] aInputs1 = new ItemStack[] { ItemUtils.getSimpleStack(Blocks.cactus), - ItemUtils.getSimpleStack(Items.reeds) }; - ItemStack[] aInputs2 = new ItemStack[] { ItemUtils.getSimpleStack(ModItems.itemCactusCharcoal), - ItemUtils.getSimpleStack(ModItems.itemSugarCharcoal) }; - ItemStack[] aOutputs = new ItemStack[] { ItemUtils.getSimpleStack(ModItems.itemCactusCoke), - ItemUtils.getSimpleStack(ModItems.itemSugarCoke) }; - for (int i = 0; i < aOutputs.length; i++) { - // Recipes for the Charcoals and Cokes, outputting either Creosote or Charcoal Byproducts depending on the - // fluid input - CORE.RA.addCokeOvenRecipe( - aInputs1[i], - CI.getNumberedCircuit(3), - null, - FluidUtils.getFluidStack("creosote", 100), - aInputs2[i], - 20, - 16); - CORE.RA.addCokeOvenRecipe( - aInputs1[i], - CI.getNumberedCircuit(4), - FluidUtils.getFluidStack("nitrogen", 100), - FluidUtils.getFluidStack("charcoal_byproducts", 200), - aInputs2[i], - 10, - 16); - CORE.RA.addCokeOvenRecipe( - aInputs2[i], - CI.getNumberedCircuit(3), - null, - FluidUtils.getFluidStack("creosote", 200), - aOutputs[i], - 40, - 16); - CORE.RA.addCokeOvenRecipe( - aInputs2[i], - CI.getNumberedCircuit(4), - FluidUtils.getFluidStack("nitrogen", 50), - FluidUtils.getFluidStack("charcoal_byproducts", 100), - aOutputs[i], - 20, - 16); - - // Generate Wood Tar and Wood Gas from these Cokes - CORE.RA.addCokeOvenRecipe( - aOutputs[i], - CI.getNumberedCircuit(5), - FluidUtils.getFluidStack("steam", 100), - Materials.WoodTar.getFluid(200), - Materials.Ash.getDustSmall(1), - 60, - 240); - CORE.RA.addCokeOvenRecipe( - aOutputs[i], - CI.getNumberedCircuit(6), - FluidUtils.getFluidStack("steam", 100), - Materials.WoodGas.getFluid(300), - Materials.Ash.getDustSmall(1), - 60, - 240); - - // Fluid Extracting the Charcoals for Wood Tar - GT_Values.RA.stdBuilder() - .itemInputs(aInputs2[i]) - .itemOutputs(GT_OreDictUnificator.get(OrePrefixes.dust, Materials.Ash, 1L)) - .outputChances(1000) - .fluidOutputs(Materials.WoodTar.getFluid(50L)) - .duration(1 * SECONDS + 10 * TICKS) - .eut(16) - .addTo(fluidExtractionRecipes); - - // Processing the Charcoals with Oxygen to get CO and CO2 - // C + O = CO - GT_Values.RA.stdBuilder() - .itemInputs(aInputs2[i], GT_Utility.getIntegratedCircuit(1)) - .itemOutputs(Materials.Ash.getDustTiny(1)) - .fluidInputs(Materials.Oxygen.getGas(500)) - .fluidOutputs(Materials.CarbonMonoxide.getGas(500)) - .duration(4 * SECONDS) - .eut(8) - .addTo(UniversalChemical); - // C + 2O = CO2 - GT_Values.RA.stdBuilder() - .itemInputs(aInputs2[i], GT_Utility.getIntegratedCircuit(2)) - .itemOutputs(Materials.Ash.getDustTiny(1)) - .fluidInputs(Materials.Oxygen.getGas(2000)) - .fluidOutputs(Materials.CarbonDioxide.getGas(1000)) - .duration(2 * SECONDS) - .eut(8) - .addTo(UniversalChemical); - } - if (Railcraft.isModLoaded()) { - for (int i = 0; i < aOutputs.length; i++) { - RailcraftUtils.addCokeOvenRecipe( - aInputs1[i], - true, - true, - aInputs2[i], - FluidUtils.getFluidStack("creosote", 30), - 500); - } - for (int i = 0; i < aOutputs.length; i++) { - RailcraftUtils.addCokeOvenRecipe( - aInputs2[i], - true, - true, - aOutputs[i], - FluidUtils.getFluidStack("creosote", 30), - 500); - } - - if (NewHorizonsCoreMod.isModLoaded()) { - for (int i = 0; i < aOutputs.length; i++) { - RailcraftUtils.addAdvancedCokeOvenRecipe(aInputs1[i], true, true, aInputs2[i], 20); - } - for (int i = 0; i < aOutputs.length; i++) { - RailcraftUtils.addAdvancedCokeOvenRecipe(aInputs2[i], true, true, aOutputs[i], 20); - } - } - } - } -} diff --git a/gtpp/src/main/java/gtPlusPlus/xmod/railcraft/utils/RailcraftUtils.java b/gtpp/src/main/java/gtPlusPlus/xmod/railcraft/utils/RailcraftUtils.java deleted file mode 100644 index f2f538ab38..0000000000 --- a/gtpp/src/main/java/gtPlusPlus/xmod/railcraft/utils/RailcraftUtils.java +++ /dev/null @@ -1,22 +0,0 @@ -package gtPlusPlus.xmod.railcraft.utils; - -import net.minecraft.item.ItemStack; -import net.minecraftforge.fluids.FluidStack; - -import mods.railcraft.common.util.crafting.BlastFurnaceCraftingManager; -import mods.railcraft.common.util.crafting.CokeOvenCraftingManager; - -public class RailcraftUtils { - - public static void addCokeOvenRecipe(ItemStack input, boolean matchDamage, boolean matchNBT, ItemStack output, - FluidStack fluidOutput, int cookTime) { - CokeOvenCraftingManager.getInstance() - .addRecipe(input, matchDamage, matchNBT, output, fluidOutput, cookTime); - } - - public static void addAdvancedCokeOvenRecipe(ItemStack input, boolean matchDamage, boolean matchNBT, - ItemStack output, int cookTime) { - BlastFurnaceCraftingManager.getInstance() - .addRecipe(input, matchDamage, matchNBT, cookTime, output); - } -} diff --git a/gtpp/src/main/java/gtPlusPlus/xmod/thaumcraft/commands/CommandDumpAspects.java b/gtpp/src/main/java/gtPlusPlus/xmod/thaumcraft/commands/CommandDumpAspects.java deleted file mode 100644 index 5dcc27e592..0000000000 --- a/gtpp/src/main/java/gtPlusPlus/xmod/thaumcraft/commands/CommandDumpAspects.java +++ /dev/null @@ -1,92 +0,0 @@ -package gtPlusPlus.xmod.thaumcraft.commands; - -import static gtPlusPlus.core.util.minecraft.PlayerUtils.messagePlayer; - -import java.util.ArrayList; -import java.util.List; - -import net.minecraft.command.ICommand; -import net.minecraft.command.ICommandSender; -import net.minecraft.entity.player.EntityPlayer; - -import gtPlusPlus.api.objects.Logger; -import gtPlusPlus.core.commands.CommandUtils; -import gtPlusPlus.core.util.minecraft.PlayerUtils; -import gtPlusPlus.xmod.thaumcraft.objects.ThreadAspectScanner; - -public class CommandDumpAspects implements ICommand { - - private final List<String> aliases; - public static long mLastScanTime = System.currentTimeMillis(); - - public CommandDumpAspects() { - this.aliases = new ArrayList<>(); - this.aliases.add("DA"); - this.aliases.add("da"); - this.aliases.add("dumpaspects"); - this.aliases.add("dumptc"); - Logger.INFO("Registered Aspect Dump Command."); - } - - @Override - public int compareTo(final Object o) { - return 0; - } - - @Override - public String getCommandName() { - return "DumpAspects"; - } - - @Override - public String getCommandUsage(final ICommandSender var1) { - return "/DumpAspects"; - } - - @Override - public List<String> getCommandAliases() { - return this.aliases; - } - - @Override - public void processCommand(final ICommandSender S, final String[] argString) { - final EntityPlayer P = CommandUtils.getPlayer(S); - final long T = System.currentTimeMillis(); - final long D = T - mLastScanTime; - final int Z = (int) (D / 1000); - if (Z >= 30) { - // Lets process this in the Background on a new Thread. - Thread t = createNewThread(); - messagePlayer(P, "Beginning to dump information about all items/blocks & their aspects to file."); - messagePlayer( - P, - "Please do not close your game during this process, you will be notified upon completion."); - t.start(); - } else { - messagePlayer( - P, - "Your last run of DA was less than 30 seconds ago, please wait " + (30 - Z) - + " seconds before trying again."); - } - } - - @Override - public boolean canCommandSenderUseCommand(final ICommandSender var1) { - final EntityPlayer P = CommandUtils.getPlayer(var1); - return P != null && PlayerUtils.isPlayerOP(P); - } - - @Override - public List<?> addTabCompletionOptions(final ICommandSender var1, final String[] var2) { - return null; - } - - @Override - public boolean isUsernameIndex(final String[] var1, final int var2) { - return false; - } - - private static Thread createNewThread() { - return new ThreadAspectScanner(); - } -} diff --git a/gtpp/src/main/java/gtPlusPlus/xmod/thaumcraft/objects/ThreadAspectScanner.java b/gtpp/src/main/java/gtPlusPlus/xmod/thaumcraft/objects/ThreadAspectScanner.java deleted file mode 100644 index 1f053220ab..0000000000 --- a/gtpp/src/main/java/gtPlusPlus/xmod/thaumcraft/objects/ThreadAspectScanner.java +++ /dev/null @@ -1,165 +0,0 @@ -package gtPlusPlus.xmod.thaumcraft.objects; - -import java.io.File; -import java.util.ArrayList; -import java.util.HashMap; -import java.util.Iterator; -import java.util.List; -import java.util.Map; -import java.util.Set; - -import net.minecraft.block.Block; -import net.minecraft.item.Item; -import net.minecraft.item.ItemStack; - -import gtPlusPlus.api.objects.Logger; -import gtPlusPlus.api.objects.data.AutoMap; -import gtPlusPlus.api.objects.data.Pair; -import gtPlusPlus.core.util.Utils; -import gtPlusPlus.core.util.data.FileUtils; -import gtPlusPlus.core.util.minecraft.ItemUtils; -import gtPlusPlus.xmod.thaumcraft.commands.CommandDumpAspects; - -public class ThreadAspectScanner extends Thread { - - public static boolean mDoWeScan = false; - private static final Map<String, AutoMap<ItemStack>> mAllGameContent = new HashMap<>(); - public final File mAspectCacheFile; - - public ThreadAspectScanner() { - mAspectCacheFile = FileUtils.getFile("config/GTplusplus", "AspectInfo", "txt"); - mDoWeScan = true; - } - - private void tryCacheObject(ItemStack aStack) { - if (aStack == null) { - return; - } - String nameKey; - try { - nameKey = ItemUtils.getUnlocalizedItemName(aStack); - } catch (NullPointerException n) { - try { - nameKey = Utils.sanitizeString( - aStack.getDisplayName() - .toLowerCase()); - } catch (NullPointerException n2) { - try { - nameKey = aStack.getItem() - .getUnlocalizedName(); - } catch (NullPointerException n3) { - nameKey = "BadItemsGalore"; - } - } - } - AutoMap<ItemStack> m = new AutoMap<>(); - if (mAllGameContent.containsKey(nameKey)) { - m = mAllGameContent.get(nameKey); - } - m.put(aStack); - mAllGameContent.put(nameKey, m); - } - - @SuppressWarnings({ "rawtypes" }) - @Override - public void run() { - if (mDoWeScan) { - Iterator iterator; - Logger.INFO("Finding Blocks and Items to scan for Aspect data."); - long mBlocksCounter = 0; - long mItemsCounter = 0; - - // First, find blocks - iterator = Block.blockRegistry.getKeys() - .iterator(); - while (iterator.hasNext()) { - String s = (String) iterator.next(); - Block block = (Block) Block.blockRegistry.getObject(s); - if (block != null) { - tryCacheObject(ItemUtils.getSimpleStack(block)); - mBlocksCounter++; - } - } - Logger.INFO("Completed Block Scan. Counted " + mBlocksCounter); - - // Second Find items, Skipping things that exist. - iterator = Item.itemRegistry.getKeys() - .iterator(); - while (iterator.hasNext()) { - String s = (String) iterator.next(); - Item item = (Item) Item.itemRegistry.getObject(s); - if (item != null) { - if (item.getHasSubtypes()) { - List q1 = new ArrayList(); - item.getSubItems(item, item.getCreativeTab(), q1); - if (q1 != null && q1.size() > 0) { - for (int e = 0; e < q1.size(); e++) { - ItemStack check = ItemUtils.simpleMetaStack(item, e, 1); - if (check != null) { - tryCacheObject(check); - mItemsCounter++; - } - } - } else { - tryCacheObject(ItemUtils.getSimpleStack(item)); - mItemsCounter++; - } - } else { - tryCacheObject(ItemUtils.getSimpleStack(item)); - mItemsCounter++; - } - } - } - Logger.INFO("Completed Item Scan. Counted " + mItemsCounter); - - Set<String> y = mAllGameContent.keySet(); - Logger.INFO("Beginning iteration of " + y.size() + " itemstacks for aspect information."); - - for (String key : y) { - // Logger.INFO("Looking for key: "+key); - if (mAllGameContent.containsKey(key)) { - AutoMap<ItemStack> group = mAllGameContent.get(key); - if (group == null || group.size() <= 0) { - continue; - } - for (ItemStack stack : group) { - thaumcraft.api.aspects.AspectList a = thaumcraft.common.lib.crafting.ThaumcraftCraftingManager - .getObjectTags(stack); - if (a == null) { - continue; - } else { - AutoMap<Pair<String, Integer>> aspectPairs = new AutoMap<>(); - for (thaumcraft.api.aspects.Aspect c : a.getAspectsSortedAmount()) { - if (c != null) { - aspectPairs.put(new Pair<>(c.getName(), a.getAmount(c))); - } - } - try { - List<String> mList = new ArrayList<>(); - mList.add( - stack.getDisplayName() + " | Meta: " - + stack.getItemDamage() - + " | Unlocal: " - + stack.getUnlocalizedName()); - for (Pair<String, Integer> r : aspectPairs) { - if (r != null) { - mList.add(r.getKey() + " x" + r.getValue()); - } - } - mList.add(""); - if (mAspectCacheFile != null && mList.size() >= 3) { - FileUtils.appendListToFile(mAspectCacheFile, mList); - } - } catch (Throwable t) { - Logger.INFO("Error while iterating one item. " + t); - } - } - } - } - } - Logger.INFO( - "Completed Aspect Iteration. AspectInfo.txt is now available to process in the GTplusplus configuration folder."); - CommandDumpAspects.mLastScanTime = System.currentTimeMillis(); - } - } -} diff --git a/gtpp/src/main/java/gtPlusPlus/xmod/thermalfoundation/HANDLER_TF.java b/gtpp/src/main/java/gtPlusPlus/xmod/thermalfoundation/HANDLER_TF.java deleted file mode 100644 index 460a5e9fbe..0000000000 --- a/gtpp/src/main/java/gtPlusPlus/xmod/thermalfoundation/HANDLER_TF.java +++ /dev/null @@ -1,36 +0,0 @@ -package gtPlusPlus.xmod.thermalfoundation; - -import static gregtech.api.enums.Mods.COFHCore; - -import gtPlusPlus.xmod.thermalfoundation.block.TF_Blocks; -import gtPlusPlus.xmod.thermalfoundation.fluid.TF_Fluids; -import gtPlusPlus.xmod.thermalfoundation.item.TF_Items; -import gtPlusPlus.xmod.thermalfoundation.recipe.TF_Gregtech_Recipes; - -public class HANDLER_TF { - - public static void preInit() { - if (COFHCore.isModLoaded()) { - TF_Fluids.preInit(); - TF_Items.preInit(); - TF_Blocks.preInit(); - } - } - - public static void init() { - if (COFHCore.isModLoaded()) { - TF_Fluids.init(); - TF_Blocks.init(); - TF_Items.init(); - } - } - - public static void postInit() { - if (COFHCore.isModLoaded()) { - TF_Fluids.postInit(); - TF_Items.postInit(); - TF_Blocks.postInit(); - TF_Gregtech_Recipes.run(); - } - } -} diff --git a/gtpp/src/main/java/gtPlusPlus/xmod/thermalfoundation/block/TF_Block_Fluid_Cryotheum.java b/gtpp/src/main/java/gtPlusPlus/xmod/thermalfoundation/block/TF_Block_Fluid_Cryotheum.java deleted file mode 100644 index b48be445e5..0000000000 --- a/gtpp/src/main/java/gtPlusPlus/xmod/thermalfoundation/block/TF_Block_Fluid_Cryotheum.java +++ /dev/null @@ -1,178 +0,0 @@ -package gtPlusPlus.xmod.thermalfoundation.block; - -import static gregtech.api.enums.Mods.GTPlusPlus; - -import java.util.Random; - -import net.minecraft.block.Block; -import net.minecraft.block.material.MapColor; -import net.minecraft.block.material.Material; -import net.minecraft.block.material.MaterialLiquid; -import net.minecraft.entity.Entity; -import net.minecraft.entity.EntityLivingBase; -import net.minecraft.entity.monster.EntityBlaze; -import net.minecraft.entity.monster.EntityCreeper; -import net.minecraft.entity.monster.EntitySnowman; -import net.minecraft.entity.monster.EntityZombie; -import net.minecraft.init.Blocks; -import net.minecraft.potion.Potion; -import net.minecraft.potion.PotionEffect; -import net.minecraft.world.IBlockAccess; -import net.minecraft.world.World; -import net.minecraftforge.common.util.ForgeDirection; - -import cofh.core.fluid.BlockFluidInteractive; -import cofh.lib.util.BlockWrapper; -import cofh.lib.util.helpers.DamageHelper; -import cofh.lib.util.helpers.ServerHelper; -import cpw.mods.fml.common.registry.GameRegistry; -import gtPlusPlus.xmod.thermalfoundation.fluid.TF_Fluids; - -public class TF_Block_Fluid_Cryotheum extends BlockFluidInteractive { - - public static final Material materialFluidCryotheum = new MaterialLiquid(MapColor.iceColor); - private static boolean enableSourceFall = true; - private static boolean effect = true; - - public TF_Block_Fluid_Cryotheum() { - super(GTPlusPlus.ID, TF_Fluids.fluidCryotheum, materialFluidCryotheum, "cryotheum"); - this.setQuantaPerBlock(5); - this.setTickRate(15); - - this.setHardness(1000.0F); - this.setLightOpacity(1); - this.setParticleColor(0.15F, 0.7F, 1.0F); - } - - @Override - public boolean preInit() { - GameRegistry.registerBlock(this, "FluidCryotheum"); - - this.addInteraction(Blocks.grass, Blocks.dirt); - this.addInteraction(Blocks.water, 0, Blocks.ice); - this.addInteraction(Blocks.water, Blocks.snow); - this.addInteraction(Blocks.flowing_water, 0, Blocks.ice); - this.addInteraction(Blocks.flowing_water, Blocks.snow); - this.addInteraction(Blocks.lava, 0, Blocks.obsidian); - this.addInteraction(Blocks.lava, Blocks.stone); - this.addInteraction(Blocks.flowing_lava, 0, Blocks.obsidian); - this.addInteraction(Blocks.flowing_lava, Blocks.stone); - this.addInteraction(Blocks.leaves, Blocks.air); - this.addInteraction(Blocks.tallgrass, Blocks.air); - this.addInteraction(Blocks.fire, Blocks.air); - - effect = true; - enableSourceFall = true; - - return true; - } - - @Override - public void onEntityCollidedWithBlock(final World paramWorld, final int paramInt1, final int paramInt2, - final int paramInt3, final Entity paramEntity) { - paramEntity.extinguish(); - if (!effect) { - return; - } - if ((paramEntity.motionY < -0.05D) || (paramEntity.motionY > 0.05D)) { - paramEntity.motionY *= 0.05D; - } - if ((paramEntity.motionZ < -0.05D) || (paramEntity.motionZ > 0.05D)) { - paramEntity.motionZ *= 0.05D; - } - if ((paramEntity.motionX < -0.05D) || (paramEntity.motionX > 0.05D)) { - paramEntity.motionX *= 0.05D; - } - if (ServerHelper.isClientWorld(paramWorld)) { - return; - } - if ((paramWorld.getTotalWorldTime() % 8L) != 0L) { - return; - } - if (((paramEntity instanceof EntityZombie)) || ((paramEntity instanceof EntityCreeper))) { - final EntitySnowman localEntitySnowman = new EntitySnowman(paramWorld); - localEntitySnowman.setLocationAndAngles( - paramEntity.posX, - paramEntity.posY, - paramEntity.posZ, - paramEntity.rotationYaw, - paramEntity.rotationPitch); - paramWorld.spawnEntityInWorld(localEntitySnowman); - - paramEntity.setDead(); - } else if ( - /* ((paramEntity instanceof EntityBlizz)) || */ ((paramEntity instanceof EntitySnowman))) { - ((EntityLivingBase) paramEntity).addPotionEffect(new PotionEffect(Potion.moveSpeed.id, 120, 0)); - ((EntityLivingBase) paramEntity).addPotionEffect(new PotionEffect(Potion.regeneration.id, 120, 0)); - } else if ((paramEntity instanceof EntityBlaze)) { - paramEntity.attackEntityFrom(DamageHelper.cryotheum, 10.0F); - } else { - final boolean bool = paramEntity.velocityChanged; - paramEntity.attackEntityFrom(DamageHelper.cryotheum, 2.0F); - paramEntity.velocityChanged = bool; - } - } - - @Override - public int getLightValue(final IBlockAccess paramIBlockAccess, final int paramInt1, final int paramInt2, - final int paramInt3) { - return TF_Fluids.fluidCryotheum.getLuminosity(); - } - - @Override - public void updateTick(final World paramWorld, final int paramInt1, final int paramInt2, final int paramInt3, - final Random paramRandom) { - if (effect) { - this.checkForInteraction(paramWorld, paramInt1, paramInt2, paramInt3); - } - if ((enableSourceFall) && (paramWorld.getBlockMetadata(paramInt1, paramInt2, paramInt3) == 0)) { - final Block localBlock = paramWorld.getBlock(paramInt1, paramInt2 + this.densityDir, paramInt3); - final int i = paramWorld.getBlockMetadata(paramInt1, paramInt2 + this.densityDir, paramInt3); - if ((localBlock == this) && (i != 0)) { - paramWorld.setBlock(paramInt1, paramInt2 + this.densityDir, paramInt3, this, 0, 3); - paramWorld.setBlockToAir(paramInt1, paramInt2, paramInt3); - return; - } - } - super.updateTick(paramWorld, paramInt1, paramInt2, paramInt3, paramRandom); - } - - protected void checkForInteraction(final World paramWorld, final int paramInt1, final int paramInt2, - final int paramInt3) { - if (paramWorld.getBlock(paramInt1, paramInt2, paramInt3) != this) { - return; - } - int i = paramInt1; - int j = paramInt2; - int k = paramInt3; - for (int m = 0; m < 6; m++) { - i = paramInt1 + cofh.lib.util.helpers.BlockHelper.SIDE_COORD_MOD[m][0]; - j = paramInt2 + cofh.lib.util.helpers.BlockHelper.SIDE_COORD_MOD[m][1]; - k = paramInt3 + cofh.lib.util.helpers.BlockHelper.SIDE_COORD_MOD[m][2]; - - this.interactWithBlock(paramWorld, i, j, k); - } - this.interactWithBlock(paramWorld, paramInt1 - 1, paramInt2, paramInt3 - 1); - this.interactWithBlock(paramWorld, paramInt1 - 1, paramInt2, paramInt3 + 1); - this.interactWithBlock(paramWorld, paramInt1 + 1, paramInt2, paramInt3 - 1); - this.interactWithBlock(paramWorld, paramInt1 + 1, paramInt2, paramInt3 + 1); - } - - protected void interactWithBlock(final World paramWorld, final int paramInt1, final int paramInt2, - final int paramInt3) { - final Block localBlock = paramWorld.getBlock(paramInt1, paramInt2, paramInt3); - if ((localBlock == Blocks.air) || (localBlock == this)) { - return; - } - final int i = paramWorld.getBlockMetadata(paramInt1, paramInt2, paramInt3); - if (this.hasInteraction(localBlock, i)) { - final BlockWrapper localBlockWrapper = this.getInteraction(localBlock, i); - paramWorld - .setBlock(paramInt1, paramInt2, paramInt3, localBlockWrapper.block, localBlockWrapper.metadata, 3); - } else if ((paramWorld.isSideSolid(paramInt1, paramInt2, paramInt3, ForgeDirection.UP)) - && (paramWorld.isAirBlock(paramInt1, paramInt2 + 1, paramInt3))) { - paramWorld.setBlock(paramInt1, paramInt2 + 1, paramInt3, Blocks.snow_layer, 0, 3); - } - } - -} diff --git a/gtpp/src/main/java/gtPlusPlus/xmod/thermalfoundation/block/TF_Block_Fluid_Ender.java b/gtpp/src/main/java/gtPlusPlus/xmod/thermalfoundation/block/TF_Block_Fluid_Ender.java deleted file mode 100644 index 9f89d01250..0000000000 --- a/gtpp/src/main/java/gtPlusPlus/xmod/thermalfoundation/block/TF_Block_Fluid_Ender.java +++ /dev/null @@ -1,61 +0,0 @@ -package gtPlusPlus.xmod.thermalfoundation.block; - -import static gregtech.api.enums.Mods.GTPlusPlus; - -import net.minecraft.block.material.MapColor; -import net.minecraft.block.material.Material; -import net.minecraft.block.material.MaterialLiquid; -import net.minecraft.entity.Entity; -import net.minecraft.world.IBlockAccess; -import net.minecraft.world.World; - -import cofh.core.fluid.BlockFluidCoFHBase; -import cofh.core.util.CoreUtils; -import cpw.mods.fml.common.registry.GameRegistry; -import gtPlusPlus.xmod.thermalfoundation.fluid.TF_Fluids; - -public class TF_Block_Fluid_Ender extends BlockFluidCoFHBase { - - public static final Material materialFluidEnder = new MaterialLiquid(MapColor.greenColor); - private static boolean effect = true; - - public TF_Block_Fluid_Ender() { - super(GTPlusPlus.ID, TF_Fluids.fluidEnder, materialFluidEnder, "ender"); - setQuantaPerBlock(4); - setTickRate(20); - - setHardness(2000.0F); - setLightOpacity(7); - setParticleColor(0.05F, 0.2F, 0.2F); - } - - @Override - public boolean preInit() { - GameRegistry.registerBlock(this, "FluidEnder"); - - return true; - } - - @Override - public void onEntityCollidedWithBlock(World paramWorld, int paramInt1, int paramInt2, int paramInt3, - Entity paramEntity) { - if ((!effect) || (paramWorld.isRemote)) { - return; - } - if (paramWorld.getTotalWorldTime() % 8L == 0L) { - int i = paramInt1 - 8 + paramWorld.rand.nextInt(17); - int j = paramInt2 + paramWorld.rand.nextInt(8); - int k = paramInt3 - 8 + paramWorld.rand.nextInt(17); - if (!paramWorld.getBlock(i, j, k) - .getMaterial() - .isSolid()) { - CoreUtils.teleportEntityTo(paramEntity, i, j, k); - } - } - } - - @Override - public int getLightValue(IBlockAccess paramIBlockAccess, int paramInt1, int paramInt2, int paramInt3) { - return TF_Fluids.fluidEnder.getLuminosity(); - } -} diff --git a/gtpp/src/main/java/gtPlusPlus/xmod/thermalfoundation/block/TF_Block_Fluid_Pyrotheum.java b/gtpp/src/main/java/gtPlusPlus/xmod/thermalfoundation/block/TF_Block_Fluid_Pyrotheum.java deleted file mode 100644 index 90c8be8bf7..0000000000 --- a/gtpp/src/main/java/gtPlusPlus/xmod/thermalfoundation/block/TF_Block_Fluid_Pyrotheum.java +++ /dev/null @@ -1,192 +0,0 @@ -package gtPlusPlus.xmod.thermalfoundation.block; - -import static gregtech.api.enums.Mods.GTPlusPlus; - -import java.util.Random; - -import net.minecraft.block.Block; -import net.minecraft.block.material.Material; -import net.minecraft.entity.Entity; -import net.minecraft.entity.monster.EntityCreeper; -import net.minecraft.entity.player.EntityPlayer; -import net.minecraft.init.Blocks; -import net.minecraft.world.IBlockAccess; -import net.minecraft.world.World; -import net.minecraftforge.common.util.ForgeDirection; - -import cofh.core.fluid.BlockFluidInteractive; -import cofh.lib.util.BlockWrapper; -import cofh.lib.util.helpers.ServerHelper; -import cpw.mods.fml.common.registry.GameRegistry; -import gtPlusPlus.xmod.thermalfoundation.fluid.TF_Fluids; - -public class TF_Block_Fluid_Pyrotheum extends BlockFluidInteractive { - - Random random = new Random(); - private static boolean effect = true; - private static boolean enableSourceFall = true; - - public TF_Block_Fluid_Pyrotheum() { - super(GTPlusPlus.ID, TF_Fluids.fluidPyrotheum, Material.lava, "pyrotheum"); - this.setQuantaPerBlock(5); - this.setTickRate(10); - - this.setHardness(1000.0F); - this.setLightOpacity(1); - this.setParticleColor(1.0F, 0.7F, 0.15F); - } - - @Override - public boolean preInit() { - GameRegistry.registerBlock(this, "FluidPyrotheum"); - - this.addInteraction(Blocks.cobblestone, Blocks.stone); - this.addInteraction(Blocks.grass, Blocks.dirt); - this.addInteraction(Blocks.sand, Blocks.glass); - this.addInteraction(Blocks.water, Blocks.stone); - this.addInteraction(Blocks.flowing_water, Blocks.stone); - this.addInteraction(Blocks.clay, Blocks.hardened_clay); - this.addInteraction(Blocks.ice, Blocks.stone); - this.addInteraction(Blocks.snow, Blocks.air); - this.addInteraction(Blocks.snow_layer, Blocks.air); - for (int i = 0; i < 8; i++) { - this.addInteraction(Blocks.stone_stairs, i, Blocks.stone_brick_stairs, i); - } - final String str1 = "Fluid.Pyrotheum"; - String str2 = "Enable this for Fluid Pyrotheum to be worse than lava."; - effect = true; - - str2 = "Enable this for Fluid Pyrotheum Source blocks to gradually fall downwards."; - enableSourceFall = true; - - return true; - } - - @Override - public void onEntityCollidedWithBlock(final World paramWorld, final int paramInt1, final int paramInt2, - final int paramInt3, final Entity paramEntity) { - if (!effect) { - return; - } - if (ServerHelper.isClientWorld(paramWorld)) { - return; - } - if (!(paramEntity instanceof EntityPlayer)) { - if ((paramEntity instanceof EntityCreeper)) { - paramWorld.createExplosion( - paramEntity, - paramEntity.posX, - paramEntity.posY, - paramEntity.posZ, - 6.0F, - paramEntity.worldObj.getGameRules() - .getGameRuleBooleanValue("mobGriefing")); - paramEntity.setDead(); - } - } - } - - @Override - public int getLightValue(final IBlockAccess paramIBlockAccess, final int paramInt1, final int paramInt2, - final int paramInt3) { - return TF_Fluids.fluidPyrotheum.getLuminosity(); - } - - @Override - public int getFireSpreadSpeed(final IBlockAccess paramIBlockAccess, final int paramInt1, final int paramInt2, - final int paramInt3, final ForgeDirection paramForgeDirection) { - return effect ? 800 : 0; - } - - @Override - public int getFlammability(final IBlockAccess paramIBlockAccess, final int paramInt1, final int paramInt2, - final int paramInt3, final ForgeDirection paramForgeDirection) { - return 0; - } - - @Override - public boolean isFlammable(final IBlockAccess paramIBlockAccess, final int paramInt1, final int paramInt2, - final int paramInt3, final ForgeDirection paramForgeDirection) { - return (effect) && (paramForgeDirection.ordinal() > ForgeDirection.UP.ordinal()) - && (paramIBlockAccess.getBlock(paramInt1, paramInt2 - 1, paramInt3) != this); - } - - @Override - public boolean isFireSource(final World paramWorld, final int paramInt1, final int paramInt2, final int paramInt3, - final ForgeDirection paramForgeDirection) { - return effect; - } - - @Override - public void updateTick(final World paramWorld, final int paramInt1, final int paramInt2, final int paramInt3, - final Random paramRandom) { - if (effect) { - this.checkForInteraction(paramWorld, paramInt1, paramInt2, paramInt3); - } - if ((enableSourceFall) && (paramWorld.getBlockMetadata(paramInt1, paramInt2, paramInt3) == 0)) { - final Block localBlock = paramWorld.getBlock(paramInt1, paramInt2 + this.densityDir, paramInt3); - final int i = paramWorld.getBlockMetadata(paramInt1, paramInt2 + this.densityDir, paramInt3); - if (((localBlock == this) && (i != 0)) || (localBlock - .isFlammable(paramWorld, paramInt1, paramInt2 + this.densityDir, paramInt3, ForgeDirection.UP))) { - paramWorld.setBlock(paramInt1, paramInt2 + this.densityDir, paramInt3, this, 0, 3); - paramWorld.setBlockToAir(paramInt1, paramInt2, paramInt3); - return; - } - } - super.updateTick(paramWorld, paramInt1, paramInt2, paramInt3, paramRandom); - } - - protected void checkForInteraction(final World paramWorld, final int paramInt1, final int paramInt2, - final int paramInt3) { - if (paramWorld.getBlock(paramInt1, paramInt2, paramInt3) != this) { - return; - } - int i = paramInt1; - int j = paramInt2; - int k = paramInt3; - for (int m = 0; m < 6; m++) { - i = paramInt1 + cofh.lib.util.helpers.BlockHelper.SIDE_COORD_MOD[m][0]; - j = paramInt2 + cofh.lib.util.helpers.BlockHelper.SIDE_COORD_MOD[m][1]; - k = paramInt3 + cofh.lib.util.helpers.BlockHelper.SIDE_COORD_MOD[m][2]; - - this.interactWithBlock(paramWorld, i, j, k); - } - this.interactWithBlock(paramWorld, paramInt1 - 1, paramInt2, paramInt3 - 1); - this.interactWithBlock(paramWorld, paramInt1 - 1, paramInt2, paramInt3 + 1); - this.interactWithBlock(paramWorld, paramInt1 + 1, paramInt2, paramInt3 - 1); - this.interactWithBlock(paramWorld, paramInt1 + 1, paramInt2, paramInt3 + 1); - } - - protected void interactWithBlock(final World paramWorld, final int paramInt1, final int paramInt2, - final int paramInt3) { - final Block localBlock = paramWorld.getBlock(paramInt1, paramInt2, paramInt3); - if ((localBlock == Blocks.air) || (localBlock == this)) { - return; - } - final int i = paramWorld.getBlockMetadata(paramInt1, paramInt2, paramInt3); - if (this.hasInteraction(localBlock, i)) { - final BlockWrapper localBlockWrapper = this.getInteraction(localBlock, i); - paramWorld - .setBlock(paramInt1, paramInt2, paramInt3, localBlockWrapper.block, localBlockWrapper.metadata, 3); - this.triggerInteractionEffects(paramWorld, paramInt1, paramInt2, paramInt3); - } else if (localBlock.isFlammable(paramWorld, paramInt1, paramInt2, paramInt3, ForgeDirection.UP)) { - paramWorld.setBlock(paramInt1, paramInt2, paramInt3, Blocks.fire); - } else if ((paramWorld.isSideSolid(paramInt1, paramInt2, paramInt3, ForgeDirection.UP)) - && (paramWorld.isAirBlock(paramInt1, paramInt2 + 1, paramInt3))) { - paramWorld.setBlock(paramInt1, paramInt2 + 1, paramInt3, Blocks.fire, 0, 3); - } - } - - protected void triggerInteractionEffects(final World paramWorld, final int paramInt1, final int paramInt2, - final int paramInt3) { - if (this.random.nextInt(16) == 0) { - paramWorld.playSoundEffect( - paramInt1 + 0.5F, - paramInt2 + 0.5F, - paramInt3 + 0.5F, - "random.fizz", - 0.5F, - 2.2F + ((paramWorld.rand.nextFloat() - paramWorld.rand.nextFloat()) * 0.8F)); - } - } -} diff --git a/gtpp/src/main/java/gtPlusPlus/xmod/thermalfoundation/block/TF_Blocks.java b/gtpp/src/main/java/gtPlusPlus/xmod/thermalfoundation/block/TF_Blocks.java deleted file mode 100644 index 38fed4c137..0000000000 --- a/gtpp/src/main/java/gtPlusPlus/xmod/thermalfoundation/block/TF_Blocks.java +++ /dev/null @@ -1,23 +0,0 @@ -package gtPlusPlus.xmod.thermalfoundation.block; - -import cofh.core.fluid.BlockFluidCoFHBase; - -public class TF_Blocks { - - public static BlockFluidCoFHBase blockFluidPyrotheum; - public static BlockFluidCoFHBase blockFluidCryotheum; - public static BlockFluidCoFHBase blockFluidEnder; - - public static void preInit() { - blockFluidPyrotheum = new TF_Block_Fluid_Pyrotheum(); - blockFluidCryotheum = new TF_Block_Fluid_Cryotheum(); - blockFluidEnder = new TF_Block_Fluid_Ender(); - blockFluidPyrotheum.preInit(); - blockFluidCryotheum.preInit(); - blockFluidEnder.preInit(); - } - - public static void init() {} - - public static void postInit() {} -} diff --git a/gtpp/src/main/java/gtPlusPlus/xmod/thermalfoundation/fluid/TF_Fluids.java b/gtpp/src/main/java/gtPlusPlus/xmod/thermalfoundation/fluid/TF_Fluids.java deleted file mode 100644 index 27a0c8e080..0000000000 --- a/gtpp/src/main/java/gtPlusPlus/xmod/thermalfoundation/fluid/TF_Fluids.java +++ /dev/null @@ -1,69 +0,0 @@ -package gtPlusPlus.xmod.thermalfoundation.fluid; - -import net.minecraft.item.EnumRarity; -import net.minecraftforge.fluids.Fluid; -import net.minecraftforge.fluids.FluidRegistry; - -import gtPlusPlus.api.objects.Logger; - -public class TF_Fluids { - - public static Fluid fluidPyrotheum; - public static Fluid fluidCryotheum; - public static Fluid fluidEnder; - - public static void preInit() { - Logger.INFO("Adding in our own versions of Thermal Foundation Fluids - Non-GT"); - final Fluid pyrotheum = FluidRegistry.getFluid("pyrotheum"); - final Fluid cryotheum = FluidRegistry.getFluid("cryotheum"); - final Fluid ender = FluidRegistry.getFluid("ender"); - - if (pyrotheum == null) { - Logger.INFO("Registering Blazing Pyrotheum as it does not exist."); - fluidPyrotheum = new Fluid("pyrotheum").setLuminosity(15) - .setDensity(2000) - .setViscosity(1200) - .setTemperature(4000) - .setRarity(EnumRarity.rare); - registerFluid(fluidPyrotheum, "pyrotheum"); - } else { - Logger.INFO("Registering Blazing Pyrotheum as it is an already existing Fluid."); - fluidPyrotheum = pyrotheum; - } - if (cryotheum == null) { - Logger.INFO("Registering Gelid Cryotheum as it does not exist."); - fluidCryotheum = new Fluid("cryotheum").setLuminosity(0) - .setDensity(4000) - .setViscosity(3000) - .setTemperature(50) - .setRarity(EnumRarity.rare); - registerFluid(fluidCryotheum, "cryotheum"); - } else { - Logger.INFO("Registering Gelid Cryotheum as it is an already existing Fluid."); - fluidCryotheum = cryotheum; - } - - if (ender == null) { - Logger.INFO("Registering Resonant Ender as it does not exist."); - fluidEnder = new Fluid("ender").setLuminosity(3) - .setDensity(4000) - .setViscosity(3000) - .setTemperature(300) - .setRarity(EnumRarity.uncommon); - registerFluid(fluidEnder, "ender"); - } else { - Logger.INFO("Registering Resonant Ender as it is an already existing Fluid."); - fluidEnder = ender; - } - } - - public static void init() {} - - public static void postInit() {} - - public static void registerFluid(final Fluid paramFluid, final String paramString) { - if (!FluidRegistry.isFluidRegistered(paramString)) { - FluidRegistry.registerFluid(paramFluid); - } - } -} diff --git a/gtpp/src/main/java/gtPlusPlus/xmod/thermalfoundation/item/TF_Items.java b/gtpp/src/main/java/gtPlusPlus/xmod/thermalfoundation/item/TF_Items.java deleted file mode 100644 index d2ea7ea2d1..0000000000 --- a/gtpp/src/main/java/gtPlusPlus/xmod/thermalfoundation/item/TF_Items.java +++ /dev/null @@ -1,75 +0,0 @@ -package gtPlusPlus.xmod.thermalfoundation.item; - -import net.minecraft.item.ItemStack; -import net.minecraftforge.fluids.FluidContainerRegistry; - -import cofh.core.item.ItemBase; -import cofh.core.item.ItemBucket; -import cofh.core.util.energy.FurnaceFuelHandler; -import cofh.core.util.fluid.BucketHandler; -import gtPlusPlus.core.creative.AddToCreativeTab; -import gtPlusPlus.core.util.minecraft.ItemUtils; -import gtPlusPlus.core.util.reflect.ReflectionUtils; -import gtPlusPlus.xmod.thermalfoundation.block.TF_Blocks; -import gtPlusPlus.xmod.thermalfoundation.fluid.TF_Fluids; - -public class TF_Items { - - public static ItemBase itemMaterial; - public static ItemStack rodBlizz; - public static ItemStack dustBlizz; - public static ItemStack dustPyrotheum; - public static ItemStack dustCryotheum; - public static ItemBucket itemBucket; - public static ItemStack bucketPyrotheum; - public static ItemStack bucketCryotheum; - public static ItemStack bucketEnder; - - public static ItemStack itemDustBlizz; - public static ItemStack itemDustPyrotheum; - public static ItemStack itemDustCryotheum; - public static ItemStack itemRodBlizz; - - public static void preInit() { - - itemBucket = (ItemBucket) new ItemBucket("MiscUtils").setUnlocalizedName("bucket") - .setCreativeTab(AddToCreativeTab.tabMisc); - itemMaterial = (ItemBase) new ItemBase("MiscUtils").setUnlocalizedName("material") - .setCreativeTab(AddToCreativeTab.tabMisc); - - bucketPyrotheum = itemBucket.addOreDictItem(1, "bucketPyrotheum"); - bucketCryotheum = itemBucket.addOreDictItem(2, "bucketCryotheum"); - bucketEnder = itemBucket.addOreDictItem(3, "bucketEnder", 1); - rodBlizz = itemMaterial.addOreDictItem(1, "rodBlizz"); - dustBlizz = itemMaterial.addOreDictItem(2, "dustBlizz"); - dustPyrotheum = itemMaterial.addOreDictItem(3, "dustPyrotheum"); - dustCryotheum = itemMaterial.addOreDictItem(4, "dustCryotheum"); - - if (ReflectionUtils.doesClassExist("cofh.core.util.energy.FurnaceFuelHandler")) { - FurnaceFuelHandler.registerFuel(dustPyrotheum, 2400); // cofh.core.util.energy.FurnaceFuelHandler.registerFuel(ItemStack, - // int) - } - - ItemUtils.addItemToOreDictionary(rodBlizz, "stickBlizz"); - - itemRodBlizz = ItemUtils.simpleMetaStack(itemMaterial, 1, 1); - itemDustBlizz = ItemUtils.simpleMetaStack(itemMaterial, 2, 1); - itemDustPyrotheum = ItemUtils.simpleMetaStack(itemMaterial, 3, 1); - itemDustCryotheum = ItemUtils.simpleMetaStack(itemMaterial, 4, 1); - } - - public static void init() { - - BucketHandler.registerBucket(TF_Blocks.blockFluidPyrotheum, 0, bucketPyrotheum); - BucketHandler.registerBucket(TF_Blocks.blockFluidCryotheum, 0, bucketCryotheum); - BucketHandler.registerBucket(TF_Blocks.blockFluidEnder, 0, bucketEnder); - FluidContainerRegistry - .registerFluidContainer(TF_Fluids.fluidPyrotheum, bucketPyrotheum, FluidContainerRegistry.EMPTY_BUCKET); - FluidContainerRegistry - .registerFluidContainer(TF_Fluids.fluidCryotheum, bucketCryotheum, FluidContainerRegistry.EMPTY_BUCKET); - FluidContainerRegistry - .registerFluidContainer(TF_Fluids.fluidEnder, bucketEnder, FluidContainerRegistry.EMPTY_BUCKET); - } - - public static void postInit() {} -} diff --git a/gtpp/src/main/java/gtPlusPlus/xmod/thermalfoundation/recipe/TF_Gregtech_Recipes.java b/gtpp/src/main/java/gtPlusPlus/xmod/thermalfoundation/recipe/TF_Gregtech_Recipes.java deleted file mode 100644 index cd48964d37..0000000000 --- a/gtpp/src/main/java/gtPlusPlus/xmod/thermalfoundation/recipe/TF_Gregtech_Recipes.java +++ /dev/null @@ -1,93 +0,0 @@ -package gtPlusPlus.xmod.thermalfoundation.recipe; - -import static gregtech.api.recipe.RecipeMaps.chemicalBathRecipes; -import static gregtech.api.recipe.RecipeMaps.mixerRecipes; -import static gregtech.api.recipe.RecipeMaps.vacuumFreezerRecipes; -import static gregtech.api.util.GT_RecipeBuilder.SECONDS; -import static gregtech.api.util.GT_RecipeBuilder.TICKS; - -import net.minecraft.init.Items; -import net.minecraft.item.ItemStack; -import net.minecraftforge.fluids.FluidStack; - -import gregtech.api.enums.GT_Values; -import gregtech.api.enums.Materials; -import gregtech.api.enums.OrePrefixes; -import gregtech.api.enums.TierEU; -import gregtech.api.util.GT_OreDictUnificator; -import gtPlusPlus.core.util.minecraft.FluidUtils; - -public class TF_Gregtech_Recipes { - - public static void run() { - start(); - } - - private static void start() { - - final FluidStack moltenBlaze = getFluidStack("molten.blaze", 1440); - - // Gelid Cryotheum - GT_Values.RA.stdBuilder() - .itemInputs(GT_OreDictUnificator.get(OrePrefixes.ore, Materials.Cinnabar, 1L)) - .itemOutputs(GT_OreDictUnificator.get(OrePrefixes.dust, Materials.Cinnabar, 3L)) - .fluidInputs(getFluidStack("cryotheum", 144)) - .duration(20 * SECONDS) - .eut(TierEU.RECIPE_LV) - .addTo(chemicalBathRecipes); - - // Blizz Powder - GT_Values.RA.stdBuilder() - .itemInputs(new ItemStack(Items.snowball, 4)) - .itemOutputs(GT_OreDictUnificator.get(OrePrefixes.dust, Materials.Blizz, 1L)) - .fluidInputs(moltenBlaze) - .duration(20 * SECONDS) - .eut(TierEU.RECIPE_HV / 2) - .addTo(chemicalBathRecipes); - - // Blizz Rod - GT_Values.RA.stdBuilder() - .itemInputs(new ItemStack(Items.blaze_rod)) - .itemOutputs(GT_OreDictUnificator.get(OrePrefixes.stick, Materials.Blizz, 1L)) - .duration(((int) Math.max((Materials.Blaze.getMass() * 4) * 3L, 1L)) * TICKS) - .eut(TierEU.RECIPE_MV) - .addTo(vacuumFreezerRecipes); - - GT_Values.RA.stdBuilder() - .itemInputs( - GT_OreDictUnificator.get(OrePrefixes.dust, Materials.Coal, 1L), - GT_OreDictUnificator.get(OrePrefixes.dust, Materials.Sulfur, 1L), - GT_OreDictUnificator.get(OrePrefixes.dust, Materials.Redstone, 1L), - GT_OreDictUnificator.get(OrePrefixes.dust, Materials.Blaze, 1L)) - .itemOutputs(GT_OreDictUnificator.get(OrePrefixes.dust, Materials.Pyrotheum, 1L)) - .duration(8 * SECONDS) - .eut(TierEU.RECIPE_MV) - .addTo(mixerRecipes); - - GT_Values.RA.stdBuilder() - .itemInputs( - GT_OreDictUnificator.get(OrePrefixes.dust, Materials.Saltpeter, 1L), - GT_OreDictUnificator.get(OrePrefixes.dust, Materials.Snow, 1L), - GT_OreDictUnificator.get(OrePrefixes.dust, Materials.Redstone, 1L), - GT_OreDictUnificator.get(OrePrefixes.dust, Materials.Blizz, 1L)) - .itemOutputs(GT_OreDictUnificator.get(OrePrefixes.dust, Materials.Cryotheum, 1L)) - .duration(8 * SECONDS) - .eut(TierEU.RECIPE_MV) - .addTo(mixerRecipes); - - GT_Values.RA.stdBuilder() - .itemInputs( - GT_OreDictUnificator.get(OrePrefixes.dust, Materials.Niter, 1L), - GT_OreDictUnificator.get(OrePrefixes.dust, Materials.Snow, 1L), - GT_OreDictUnificator.get(OrePrefixes.dust, Materials.Redstone, 1L), - GT_OreDictUnificator.get(OrePrefixes.dust, Materials.Blizz, 1L)) - .itemOutputs(GT_OreDictUnificator.get(OrePrefixes.dust, Materials.Cryotheum, 1L)) - .duration(8 * SECONDS) - .eut(TierEU.RECIPE_MV) - .addTo(mixerRecipes); - } - - private static FluidStack getFluidStack(final String fluidName, final int amount) { - return FluidUtils.getFluidStack(fluidName, amount); - } -} diff --git a/gtpp/src/main/java/gtPlusPlus/xmod/tinkers/HANDLER_Tinkers.java b/gtpp/src/main/java/gtPlusPlus/xmod/tinkers/HANDLER_Tinkers.java deleted file mode 100644 index 1023d0325f..0000000000 --- a/gtpp/src/main/java/gtPlusPlus/xmod/tinkers/HANDLER_Tinkers.java +++ /dev/null @@ -1,30 +0,0 @@ -package gtPlusPlus.xmod.tinkers; - -import static gregtech.api.enums.Mods.TinkerConstruct; - -import net.minecraftforge.fluids.Fluid; -import net.minecraftforge.fluids.FluidRegistry; - -import gtPlusPlus.api.objects.data.AutoMap; -import gtPlusPlus.xmod.tinkers.material.BaseTinkersMaterial; -import gtPlusPlus.xmod.tinkers.util.TinkersDryingRecipe; -import gtPlusPlus.xmod.tinkers.util.TinkersUtils; - -public class HANDLER_Tinkers { - - public static AutoMap<BaseTinkersMaterial> mTinkerMaterials = new AutoMap<>(); - - public static void postInit() { - if (TinkerConstruct.isModLoaded()) { - - Fluid pyrotheumFluid = FluidRegistry.getFluid("pyrotheum"); - if (pyrotheumFluid != null) { - // Enable Pyrotheum as Fuel for the Smeltery - TinkersUtils.addSmelteryFuel(pyrotheumFluid, 5000, 70); // pyrotheum lasts 3.5 seconds per 15 mb - } - - // Generate Drying Rack recipes - TinkersDryingRecipe.generateAllDryingRecipes(); - } - } -} diff --git a/gtpp/src/main/java/gtPlusPlus/xmod/tinkers/material/BaseTinkersMaterial.java b/gtpp/src/main/java/gtPlusPlus/xmod/tinkers/material/BaseTinkersMaterial.java deleted file mode 100644 index f57aa64263..0000000000 --- a/gtpp/src/main/java/gtPlusPlus/xmod/tinkers/material/BaseTinkersMaterial.java +++ /dev/null @@ -1,200 +0,0 @@ -package gtPlusPlus.xmod.tinkers.material; - -import static gregtech.api.enums.Mods.TinkerConstruct; -import static gtPlusPlus.core.util.math.MathUtils.safeCast_LongToInt; - -import java.util.HashMap; - -import net.minecraft.block.Block; -import net.minecraft.item.ItemStack; -import net.minecraft.nbt.NBTTagCompound; -import net.minecraft.util.EnumChatFormatting; -import net.minecraftforge.fluids.Fluid; - -import cpw.mods.fml.common.event.FMLInterModComms; -import gtPlusPlus.api.objects.Logger; -import gtPlusPlus.core.material.Material; -import gtPlusPlus.core.util.Utils; -import gtPlusPlus.xmod.tinkers.HANDLER_Tinkers; -import gtPlusPlus.xmod.tinkers.util.TinkersUtils; - -public class BaseTinkersMaterial { - - private static HashMap<String, Integer> aInternalMaterialIdMap = new HashMap<>(); - private static int aNextFreeID; - - public final String mLocalName; - - private final String mUnlocalName; - private final int mID; - private final Material mMaterial; - - static { - aNextFreeID = (Short.MAX_VALUE / 2) + 420; - } - - public BaseTinkersMaterial(Material aMaterial) { - mLocalName = aMaterial.getLocalizedName(); - mUnlocalName = "material.gtpp." + Utils.sanitizeString(mLocalName); - mMaterial = aMaterial; - mID = aNextFreeID++; - Logger.INFO("[TiCon] Assigning ID " + mID + " to " + mLocalName + "."); - aInternalMaterialIdMap.put(mUnlocalName, mID); - HANDLER_Tinkers.mTinkerMaterials.put(this); - } - - public String getUnlocalName() { - return mUnlocalName; - } - - private static int calcDurability(Material aMaterial) { - return safeCast_LongToInt(aMaterial.vDurability); - } - - private static int calcMiningSpeed(Material aMaterial) { - return (aMaterial.vHarvestLevel * 2) + aMaterial.vTier; - } - - private static int calcHarvestLevel(Material aMaterial) { - return aMaterial.vHarvestLevel; - } - - private static int calcAttack(Material aMaterial) { - return aMaterial.vHarvestLevel + aMaterial.vTier + aMaterial.vRadiationLevel; - } - - private static float calcHandleModifier(Material aMaterial) { - return 1f; - } - - private static int calcReinforced(Material aMaterial) { - return aMaterial.getMeltingPointC() / 3600; - } - - private static int calcBowProjectileSpeed(Material aMaterial) { - return aMaterial.vHarvestLevel + 2; - } - - private static int calcBowDrawSpeed(Material aMaterial) { - return aMaterial.vHarvestLevel + 8; - } - - private static float calcProjectileMass(Material aMaterial) { - return (aMaterial.getMeltingPointC() / 1800) * 0.1f; - } - - private static float calcProjectileFragility(Material aMaterial) { - return 0f; - } - - private static String calcStyle(Material aMaterial) { - String aReturn; - int aTemp = aMaterial.getMeltingPointC(); - if (aTemp < 3600) { - aReturn = "" + EnumChatFormatting.WHITE; - } else if (aTemp >= 3600) { - aReturn = "" + EnumChatFormatting.YELLOW; - } else if (aTemp >= (3600 * 2)) { - aReturn = "" + EnumChatFormatting.GREEN; - } else if (aTemp >= (3600 * 3)) { - aReturn = "" + EnumChatFormatting.RED; - } else if (aTemp >= (3600 * 4)) { - aReturn = "" + EnumChatFormatting.DARK_RED; - } else { - aReturn = "" + EnumChatFormatting.GOLD; - } - return aReturn; - } - - private static int calcColour(Material aMaterial) { - return aMaterial.getRgbAsHex(); - } - - public void generate() { - - Logger.INFO("[TiCon] Trying to generate Material: " + mLocalName); - int id = mID; - if (id > 0) { - - NBTTagCompound tag = new NBTTagCompound(); - tag.setInteger("Id", id); - tag.setString("Name", mUnlocalName); - tag.setString("localizationString", mLocalName); - tag.setInteger("Durability", calcDurability(mMaterial)); // 97 - tag.setInteger("MiningSpeed", calcMiningSpeed(mMaterial)); // 150 - tag.setInteger("HarvestLevel", calcHarvestLevel(mMaterial)); // 1 - tag.setInteger("Attack", calcAttack(mMaterial)); // 0 - tag.setFloat("HandleModifier", calcHandleModifier(mMaterial)); // 1.0f - tag.setInteger("Reinforced", calcReinforced(mMaterial)); // 0 - tag.setFloat("Bow_ProjectileSpeed", calcBowProjectileSpeed(mMaterial)); // 3.0f - tag.setInteger("Bow_DrawSpeed", calcBowDrawSpeed(mMaterial)); // 18 - tag.setFloat("Projectile_Mass", calcProjectileMass(mMaterial)); // 0.69f - tag.setFloat("Projectile_Fragility", calcProjectileFragility(mMaterial)); // 0.2f - tag.setString("Style", calcStyle(mMaterial)); - tag.setInteger("Color", calcColour(mMaterial)); - - boolean generate = generateRecipes(mMaterial, id); - - if (generate) { - Logger.INFO("[TiCon] Sending IMC: addMaterial - " + mLocalName + "."); - FMLInterModComms.sendMessage(TinkerConstruct.ID, "addMaterial", tag); - - ItemStack itemstack = mMaterial.getIngot(1); - tag = new NBTTagCompound(); - tag.setInteger("MaterialId", id); - NBTTagCompound item = new NBTTagCompound(); - itemstack.writeToNBT(item); - tag.setTag("Item", item); - tag.setInteger("Value", 2); // What is value for? - - Logger.INFO("[TiCon] Sending IMC: addPartBuilderMaterial - " + mLocalName + "."); - FMLInterModComms.sendMessage(TinkerConstruct.ID, "addPartBuilderMaterial", tag); - - tag = new NBTTagCompound(); - tag.setInteger("MaterialId", id); - tag.setInteger("Value", 2); // What is value for? - item = new NBTTagCompound(); - itemstack.writeToNBT(item); - tag.setTag("Item", item); - - Logger.INFO("[TiCon] Sending IMC: addMaterialItem - " + mLocalName + "."); - FMLInterModComms.sendMessage(TinkerConstruct.ID, "addMaterialItem", tag); - } - } - } - - private boolean generateRecipes(Material aMaterial, int aID) { - - Block aMatBlock; - Integer aMelt; - Fluid aFluid; - - try { - aMatBlock = aMaterial.getBlock(); - aMelt = aMaterial.getMeltingPointC(); - aFluid = aMaterial.getFluidStack(0) - .getFluid(); - } catch (Throwable t) { - return false; - } - - if (aMatBlock == null || aMelt == null || aFluid == null) { - return false; - } - - TinkersUtils.registerFluidType(mLocalName, aMatBlock, 0, aMelt, aFluid, true); - TinkersUtils.addMelting(aMaterial.getBlock(1), aMatBlock, 0, aMelt, aMaterial.getFluidStack(144 * 9)); - TinkersUtils.addMelting(aMaterial.getIngot(1), aMatBlock, 0, aMelt, aMaterial.getFluidStack(144)); - if (aMelt <= 3600) { - ItemStack ingotcast = TinkersUtils.getPattern(1); - TinkersUtils - .addBasinRecipe(aMaterial.getBlock(1), aMaterial.getFluidStack(144 * 9), (ItemStack) null, true, 100); - TinkersUtils - .addCastingTableRecipe(aMaterial.getIngot(1), aMaterial.getFluidStack(144), ingotcast, false, 50); - } - - TinkersUtils.generateCastingRecipes(aMaterial, aID); - - return true; - } -} diff --git a/gtpp/src/main/java/gtPlusPlus/xmod/tinkers/util/TinkersDryingRecipe.java b/gtpp/src/main/java/gtPlusPlus/xmod/tinkers/util/TinkersDryingRecipe.java deleted file mode 100644 index 33dad51510..0000000000 --- a/gtpp/src/main/java/gtPlusPlus/xmod/tinkers/util/TinkersDryingRecipe.java +++ /dev/null @@ -1,129 +0,0 @@ -package gtPlusPlus.xmod.tinkers.util; - -import static gregtech.api.enums.Mods.TinkerConstruct; - -import java.lang.reflect.Field; -import java.util.List; - -import net.minecraft.item.ItemStack; -import net.minecraft.nbt.NBTTagCompound; - -import gregtech.api.enums.GT_Values; -import gtPlusPlus.api.objects.Logger; -import gtPlusPlus.api.objects.data.AutoMap; -import gtPlusPlus.core.lib.CORE; -import gtPlusPlus.core.recipe.common.CI; -import gtPlusPlus.core.util.reflect.ReflectionUtils; - -public class TinkersDryingRecipe { - - public static AutoMap<TinkersDryingRecipe> recipes = new AutoMap<>(); - - public final int time; - public final ItemStack input; - public final ItemStack result; - - public static void generateAllDryingRecipes() { - List<?> aRecipes = TinkersUtils.getDryingRecipes(); - if (aRecipes != null && aRecipes.size() > 0) { - for (Object o : aRecipes) { - Logger.INFO( - "Trying to generate recipe using object of type " + o.getClass() - .getSimpleName()); - generateFromTinkersRecipeObject(o); - } - } else { - Logger.INFO( - "Error generating Drying recipes, map was either null or empty. Null? " + (aRecipes != null) - + ", Size: " - + aRecipes.size()); - } - if (!recipes.isEmpty()) { - Logger.INFO("Adding " + recipes.size() + " drying rack recipes to the dehydrator."); - for (TinkersDryingRecipe r : recipes) { - CORE.RA.addDehydratorRecipe( - new ItemStack[] { CI.getNumberedCircuit(16), r.input }, - GT_Values.NF, - GT_Values.NF, - new ItemStack[] { r.result }, - new int[] {}, - r.time / 10, - 30); - } - } - } - - public static TinkersDryingRecipe generateFromTinkersRecipeObject(Object o) { - Field aTime; - Field aInput; - Field aOutput; - Class aTinkerClass = ReflectionUtils.getClass("tconstruct.library.crafting.DryingRackRecipes.DryingRecipe"); // o.getClass(); - if (aTinkerClass == null || TinkerConstruct.isModLoaded()) { - Logger.INFO( - "Error generating Drying Recipe, could not find class. Exists? " - + ReflectionUtils.doesClassExist("tconstruct.library.crafting.DryingRackRecipes.DryingRecipe")); - Class clazz = ReflectionUtils.getClass("tconstruct.library.crafting.DryingRackRecipes"); - Class[] y = clazz.getDeclaredClasses(); - if (y == null || y.length <= 0) { - Logger.INFO("No hidden inner classes."); - return null; - } else { - boolean found = false; - for (Class h : y) { - Logger.INFO("Found hidden inner class: " + h.getCanonicalName()); - if (h.getSimpleName() - .toLowerCase() - .equals("dryingrecipe")) { - Logger.INFO("Found correct recipe. Caching at correct location."); - ReflectionUtils.mCachedClasses - .put("tconstruct.library.crafting.DryingRackRecipes.DryingRecipe", h); - aTinkerClass = h; - found = true; - break; - } - } - if (!found) { - return null; - } - } - } - aTime = ReflectionUtils.getField(aTinkerClass, "time"); - aInput = ReflectionUtils.getField(aTinkerClass, "input"); - aOutput = ReflectionUtils.getField(aTinkerClass, "result"); - try { - int time_internal = aTime.getInt(o); - ItemStack input_internal = (ItemStack) aInput.get(o); - ItemStack result_internal = (ItemStack) aOutput.get(o); - return new TinkersDryingRecipe(input_internal, time_internal, result_internal); - } catch (Throwable b) { - b.printStackTrace(); - } - return null; - } - - public TinkersDryingRecipe(final ItemStack input, final int time, final ItemStack result) { - this.time = time; - this.input = input; - this.result = result; - Logger.INFO( - "Generating Drying Recipe. Input: " + input.getDisplayName() + ", Output: " + result.getDisplayName()); - recipes.add(this); - } - - public boolean matches(ItemStack input) { - if (input.hasTagCompound()) { - input = input.copy(); - input.getTagCompound() - .removeTag("frypanKill"); - if (input.getTagCompound() - .hasNoTags()) { - input.setTagCompound((NBTTagCompound) null); - } - } - return ItemStack.areItemStacksEqual(this.input, input); - } - - public ItemStack getResult() { - return this.result.copy(); - } -} diff --git a/gtpp/src/main/java/gtPlusPlus/xmod/tinkers/util/TinkersUtils.java b/gtpp/src/main/java/gtPlusPlus/xmod/tinkers/util/TinkersUtils.java deleted file mode 100644 index 8b173d5b62..0000000000 --- a/gtpp/src/main/java/gtPlusPlus/xmod/tinkers/util/TinkersUtils.java +++ /dev/null @@ -1,377 +0,0 @@ -package gtPlusPlus.xmod.tinkers.util; - -import static gregtech.api.enums.Mods.TinkerConstruct; - -import java.lang.reflect.Field; -import java.lang.reflect.InvocationTargetException; -import java.lang.reflect.Method; -import java.util.ArrayList; -import java.util.HashMap; -import java.util.Iterator; -import java.util.LinkedHashMap; -import java.util.LinkedList; -import java.util.List; - -import net.minecraft.block.Block; -import net.minecraft.item.Item; -import net.minecraft.item.ItemStack; -import net.minecraftforge.fluids.Fluid; -import net.minecraftforge.fluids.FluidStack; - -import gregtech.api.enums.Materials; -import gtPlusPlus.api.objects.Logger; -import gtPlusPlus.api.objects.data.AutoMap; -import gtPlusPlus.core.material.Material; -import gtPlusPlus.core.util.minecraft.ItemUtils; -import gtPlusPlus.core.util.reflect.ReflectionUtils; - -public class TinkersUtils { - - private static final Class<?> mClass_Smeltery; - private static final Class<?> mClass_TConstructRegistry; - private static final Class<?> mClass_ToolMaterial; - private static final Class<?> mClass_IPattern; - private static final Class<?> mClass_DynamicToolPart; - private static final Class<?> mClass_FluidType; - private static final Class<?> mClass_CastingRecipe; - private static final Class<?> mClass_TinkerSmeltery; - - private static final Field mField_MoltenIronFluid; - - private static final Method mMethod_getFluidType; - private static final Method mMethod_getCastingRecipes; - - private static Object mSmelteryInstance; - private static Object mTinkersRegistryInstance; - - private static final HashMap<String, Method> mMethodCache = new LinkedHashMap<>(); - - static { - mClass_Smeltery = ReflectionUtils.getClass("tconstruct.library.crafting.Smeltery"); - mClass_TConstructRegistry = ReflectionUtils.getClass("tconstruct.library.TConstructRegistry"); - - mClass_ToolMaterial = ReflectionUtils.getClass("tconstruct.library.tools.ToolMaterial"); - mClass_IPattern = ReflectionUtils.getClass("tconstruct.library.util.IPattern"); - mClass_DynamicToolPart = ReflectionUtils.getClass("tconstruct.library.tools.DynamicToolPart"); - mClass_FluidType = ReflectionUtils.getClass("tconstruct.library.crafting.FluidType"); - mClass_CastingRecipe = ReflectionUtils.getClass("tconstruct.library.crafting.CastingRecipe"); - mClass_TinkerSmeltery = ReflectionUtils.getClass("tconstruct.smeltery.TinkerSmeltery"); - - mField_MoltenIronFluid = ReflectionUtils.getField(mClass_TinkerSmeltery, "moltenIronFluid"); - - mMethod_getFluidType = ReflectionUtils.getMethod(mClass_FluidType, "getFluidType", String.class); - mMethod_getCastingRecipes = ReflectionUtils - .getMethod(getCastingInstance(0), "getCastingRecipes", new Class[] {}); - } - - private static void setTiConDataInstance() { - if (!TinkerConstruct.isModLoaded()) { - return; - } - - if (mSmelteryInstance == null) { - if (mClass_Smeltery != null) { - try { - mSmelteryInstance = ReflectionUtils.getField(mClass_Smeltery, "instance") - .get(null); - } catch (IllegalArgumentException | IllegalAccessException ignored) {} - } - } - if (mTinkersRegistryInstance == null) { - if (mClass_TConstructRegistry != null) { - try { - mTinkersRegistryInstance = ReflectionUtils.getField(mClass_TConstructRegistry, "instance") - .get(null); - } catch (IllegalArgumentException | IllegalAccessException ignored) {} - } - } - } - - /** - * Add a new fluid as a valid Smeltery fuel. - * - * @param fluid The fluid. - * @param power The temperature of the fluid. This also influences the melting speed. Lava is 1000. - * @param duration How long one "portion" of liquid fuels the smeltery. Lava is 10. - */ - public static void addSmelteryFuel(Fluid fluid, int power, int duration) { - setTiConDataInstance(); - ReflectionUtils.invokeVoid( - mSmelteryInstance, - "addSmelteryFuel", - new Class[] { Fluid.class, int.class, int.class }, - new Object[] { fluid, power, duration }); - } - - public static boolean registerFluidType(String name, Block block, int meta, int baseTemperature, Fluid fluid, - boolean isToolpart) { - if (mMethodCache.get("registerFluidType") == null) { - Method m = ReflectionUtils.getMethod( - ReflectionUtils.getClass("tconstruct.library.crafting.FluidType"), - "registerFluidType", - String.class, - Block.class, - int.class, - int.class, - Fluid.class, - boolean.class); - mMethodCache.put("registerFluidType", m); - } - try { - mMethodCache.get("registerFluidType") - .invoke(null, name, block, meta, baseTemperature, fluid, isToolpart); - return true; - } catch (IllegalAccessException | IllegalArgumentException | InvocationTargetException e) { - return false; - } - } - - public static void addMelting(ItemStack input, Block block, int metadata, int temperature, FluidStack liquid) { - if (mMethodCache.get("addMelting") == null) { - Method m = ReflectionUtils.getMethod( - mClass_Smeltery, - "addMelting", - ItemStack.class, - Block.class, - int.class, - int.class, - FluidStack.class); - mMethodCache.put("addMelting", m); - } - try { - mMethodCache.get("addMelting") - .invoke(null, input, block, metadata, temperature, liquid); - } catch (IllegalAccessException | IllegalArgumentException | InvocationTargetException ignored) {} - } - - public static void addMelting(Object type, ItemStack input, int temperatureDifference, int fluidAmount) { - if (mMethodCache.get("addMelting") == null) { - Method m = ReflectionUtils - .getMethod(mClass_Smeltery, "addMelting", mClass_FluidType, ItemStack.class, int.class, int.class); - mMethodCache.put("addMelting", m); - } - try { - mMethodCache.get("addMelting") - .invoke(null, type, input, temperatureDifference, fluidAmount); - } catch (IllegalAccessException | IllegalArgumentException | InvocationTargetException ignored) {} - } - - public static void addBasinRecipe(ItemStack output, FluidStack metal, ItemStack cast, boolean consume, int delay) { - if (mMethodCache.get("addBasinRecipe") == null) { - Method m = ReflectionUtils.getMethod( - ReflectionUtils.getClass("tconstruct.library.crafting.LiquidCasting"), - "addCastingRecipe", - ItemStack.class, - FluidStack.class, - ItemStack.class, - boolean.class, - int.class); - mMethodCache.put("addBasinRecipe", m); - } - try { - mMethodCache.get("addBasinRecipe") - .invoke(getCastingInstance(0), output, metal, cast, consume, delay); - } catch (IllegalAccessException | IllegalArgumentException | InvocationTargetException ignored) {} - } - - public static void addCastingTableRecipe(ItemStack output, FluidStack metal, ItemStack cast, boolean consume, - int delay) { - if (mMethodCache.get("addCastingTableRecipe") == null) { - Method m = ReflectionUtils.getMethod( - ReflectionUtils.getClass("tconstruct.library.crafting.LiquidCasting"), - "addCastingRecipe", - ItemStack.class, - FluidStack.class, - ItemStack.class, - boolean.class, - int.class); - mMethodCache.put("addCastingTableRecipe", m); - } - try { - mMethodCache.get("addCastingTableRecipe") - .invoke(getCastingInstance(1), output, metal, cast, consume, delay); - } catch (IllegalAccessException | IllegalArgumentException | InvocationTargetException ignored) {} - } - - /** - * 0 For Table, 1 For Basin. - * - * @param aType - Casting Type - * @return - The casting instance. - */ - public static Object getCastingInstance(int aType) { - - setTiConDataInstance(); - - Method m = null; - if (aType == 0) { - m = ReflectionUtils.getMethod(mTinkersRegistryInstance, "getTableCasting", new Class[] {}); - } else if (aType == 1) { - m = ReflectionUtils.getMethod(mTinkersRegistryInstance, "getBasinCasting", new Class[] {}); - } // return null; - - if (m != null) { - try { - return m.invoke(mTinkersRegistryInstance, new Object[] {}); - } catch (IllegalAccessException | IllegalArgumentException | InvocationTargetException e) { - e.printStackTrace(); - } - } - return null; - } - - private static Item mTinkerMetalPattern; - - public static ItemStack getPattern(int aType) { - if (mTinkerMetalPattern == null) { - Field m = ReflectionUtils.getField(mClass_TinkerSmeltery, "metalPattern"); - if (m != null) { - try { - mTinkerMetalPattern = (Item) m.get(null); - } catch (IllegalArgumentException | IllegalAccessException ignored) {} - } - } - if (mTinkerMetalPattern != null) { - return new ItemStack(mTinkerMetalPattern, aType, 0); - } - return ItemUtils.getErrorStack(1, "Bad Tinkers Pattern"); - } - - private static AutoMap<?> mDryingRackRecipes; - - public static List<?> getDryingRecipes() { - if (mDryingRackRecipes != null) { - return mDryingRackRecipes; - } - AutoMap<Object> aData = new AutoMap<>(); - int aCount = 0; - try { - ArrayList<?> recipes = (ArrayList<?>) ReflectionUtils - .getField(ReflectionUtils.getClass("tconstruct.library.crafting.DryingRackRecipes"), "recipes") - .get(null); - if (recipes != null) { - for (Object o : recipes) { - aData.put(o); - aCount++; - } - Logger.INFO("Found " + aCount + " Tinkers drying rack recipes."); - } else { - Logger.INFO("Failed to find any Tinkers drying rack recipes."); - } - } catch (IllegalArgumentException | IllegalAccessException e) { - Logger.INFO("Failed to find any Tinkers drying rack recipes."); - } - mDryingRackRecipes = aData; - return aData; - } - - public static List<?> getTableCastingRecipes() { - Object aCastingTableHandlerInstance = getCastingInstance(0); - List<?> aTemp; - try { - aTemp = (List<?>) mMethod_getCastingRecipes.invoke(aCastingTableHandlerInstance, new Object[] {}); - return aTemp; - } catch (IllegalAccessException | IllegalArgumentException | InvocationTargetException e) { - e.printStackTrace(); - } - return new ArrayList<>(); - } - - public static void generateCastingRecipes(Material aMaterial, int aID) { - - List<CastingRecipeHandler> newRecipies = new LinkedList<>(); - - Iterator<?> iterator1 = getTableCastingRecipes().iterator(); - Fluid aMoltenIron = null; - if (aMoltenIron == null) { - try { - aMoltenIron = (Fluid) mField_MoltenIronFluid.get(null); - } catch (IllegalArgumentException | IllegalAccessException e) { - e.printStackTrace(); - aMoltenIron = Materials.Iron.getMolten(0) - .getFluid(); - } - } - while (iterator1.hasNext()) { - CastingRecipeHandler recipe = new CastingRecipeHandler(iterator1.next()); - if (recipe == null || !recipe.valid) { - continue; - } - try { - if (recipe.castingMetal.getFluid() == aMoltenIron && recipe.cast != null - && mClass_IPattern.isInstance(recipe.cast.getItem()) - && mClass_DynamicToolPart.isInstance( - recipe.getResult() - .getItem())) { - newRecipies.add(recipe); - } - } catch (IllegalArgumentException e) { - e.printStackTrace(); - return; - } - } - - Object ft; - try { - ft = mMethod_getFluidType.invoke(null, aMaterial.getLocalizedName()); - for (CastingRecipeHandler newRecipy : newRecipies) { - CastingRecipeHandler recipe = new CastingRecipeHandler(newRecipy); - if (!recipe.valid) { - continue; - } - // CastingRecipe recipe = (CastingRecipe) i$.next(); - ItemStack output = recipe.getResult() - .copy(); - output.setItemDamage(aID); - FluidStack liquid2 = new FluidStack( - aMaterial.getFluidStack(0) - .getFluid(), - recipe.castingMetal.amount); - addCastingTableRecipe(output, liquid2, recipe.cast, recipe.consumeCast, recipe.coolTime); - addMelting(ft, output, 0, liquid2.amount / 2); - } - } catch (IllegalAccessException | IllegalArgumentException | InvocationTargetException e) { - e.printStackTrace(); - } - - } - - private static class CastingRecipeHandler { - - public ItemStack output; - public FluidStack castingMetal; - public ItemStack cast; - public boolean consumeCast; - public int coolTime; - - public boolean valid; - - public CastingRecipeHandler(Object aCastingRecipe) { - if (mClass_CastingRecipe.isInstance(aCastingRecipe)) { - try { - Field aF_output = ReflectionUtils.getField(mClass_CastingRecipe, "output"); - Field aF_castingMetal = ReflectionUtils.getField(mClass_CastingRecipe, "castingMetal"); - Field aF_cast = ReflectionUtils.getField(mClass_CastingRecipe, "cast"); - Field aF_consumeCast = ReflectionUtils.getField(mClass_CastingRecipe, "consumeCast"); - Field aF_coolTime = ReflectionUtils.getField(mClass_CastingRecipe, "coolTime"); - - output = (ItemStack) aF_output.get(aCastingRecipe); - castingMetal = (FluidStack) aF_castingMetal.get(aCastingRecipe); - cast = (ItemStack) aF_cast.get(aCastingRecipe); - consumeCast = (boolean) aF_consumeCast.get(aCastingRecipe); - coolTime = (int) aF_coolTime.get(aCastingRecipe); - valid = true; - } catch (Throwable t) { - t.printStackTrace(); - valid = false; - } - } else { - valid = false; - } - } - - public ItemStack getResult() { - return this.output.copy(); - } - } -} |