diff options
Diffstat (limited to 'src/Java/gtPlusPlus')
48 files changed, 1892 insertions, 1304 deletions
diff --git a/src/Java/gtPlusPlus/GTplusplus.java b/src/Java/gtPlusPlus/GTplusplus.java index 7f22ac179e..6f734db111 100644 --- a/src/Java/gtPlusPlus/GTplusplus.java +++ b/src/Java/gtPlusPlus/GTplusplus.java @@ -58,6 +58,7 @@ import gtPlusPlus.xmod.gregtech.api.objects.GregtechBufferThread; import gtPlusPlus.xmod.gregtech.common.Meta_GT_Proxy; import gtPlusPlus.xmod.gregtech.common.blocks.textures.TexturesGtBlock; import gtPlusPlus.xmod.gregtech.common.blocks.textures.TexturesGtTools; +import gtPlusPlus.xmod.gregtech.common.tileentities.machines.multi.production.chemplant.GregtechMTE_ChemicalPlant; import gtPlusPlus.xmod.gregtech.loaders.GT_Material_Loader; import gtPlusPlus.xmod.gregtech.loaders.RecipeGen_BlastSmelterGT_GTNH; import gtPlusPlus.xmod.gregtech.registration.gregtech.GregtechMiniRaFusion; @@ -291,6 +292,7 @@ public class GTplusplus implements ActionListener { FishPondFakeRecipe.generateFishPondRecipes(); GregtechMiniRaFusion.generateSlowFusionrecipes(); SemiFluidFuelHandler.generateFuels(); + GregtechMTE_ChemicalPlant.generateRecipes(); //Large Centrifuge generation mOriginalCount[0] = GT_Recipe.GT_Recipe_Map.sCentrifugeRecipes.mRecipeList.size(); diff --git a/src/Java/gtPlusPlus/core/block/ModBlocks.java b/src/Java/gtPlusPlus/core/block/ModBlocks.java index 4bc5908f98..db9ad2264c 100644 --- a/src/Java/gtPlusPlus/core/block/ModBlocks.java +++ b/src/Java/gtPlusPlus/core/block/ModBlocks.java @@ -55,7 +55,8 @@ public final class ModBlocks { public static Block blockCasingsMisc; public static Block blockCasings2Misc; public static Block blockCasings3Misc; - public static Block blockCasings4Misc; + public static Block blockCasings4Misc; + public static Block blockCasingsTieredGTPP; public static Block blockMetaTileEntity; public static Block blockHeliumGenerator; @@ -97,7 +98,6 @@ public final class ModBlocks { public static Block blockPooCollector; public static Block blockPestKiller; - public static GregtechMetaTieredCasingBlocks1 BlockTieredCasings1; public static void init() { Logger.INFO("Initializing Blocks."); diff --git a/src/Java/gtPlusPlus/core/config/ConfigHandler.java b/src/Java/gtPlusPlus/core/config/ConfigHandler.java index ecaf031030..61e7045192 100644 --- a/src/Java/gtPlusPlus/core/config/ConfigHandler.java +++ b/src/Java/gtPlusPlus/core/config/ConfigHandler.java @@ -113,6 +113,9 @@ public class ConfigHandler { "gregtech", true, "Very basic automated cauldron for dust washing."); enableMachine_Pollution = config.getBoolean("enableMachinePollution", "gregtech", true, "Pollution Detector & Scrubbers."); + enableMachine_RF_Convetor = config.getBoolean("enableMachineRFConvetor", "gregtech", + true, "Converts RF to GTEU. Requires COFH-Core to be installed."); + // Multi machines enableMultiblock_AlloyBlastSmelter = config.getBoolean("enableMultiblockAlloyBlastSmelter", diff --git a/src/Java/gtPlusPlus/core/handler/BookHandler.java b/src/Java/gtPlusPlus/core/handler/BookHandler.java index 860946f513..d9d3efe680 100644 --- a/src/Java/gtPlusPlus/core/handler/BookHandler.java +++ b/src/Java/gtPlusPlus/core/handler/BookHandler.java @@ -125,7 +125,7 @@ public class BookHandler { "The Mode can be set by using a Screwdriver on the controller block. Each mode allows the use of Numbered Circuits, to allow a different machine 'type' for each input bus.", "[Metal Work] Mode A - Allows the multiblock to function as a Compressor, a Lathe or an Electro-Magnet. To allow a hatch to run in Compressor mode, insert a No. 20 circuit. For Lathe, use No. 21 and for Electro-Magnet use No. 22.", "[Fluid Work] Mode B - Allows the multiblock to function as a Fermenter, a Fluid Extractor or an Extractor. To allow a hatch to run in Fermenter mode, insert a No. 20 circuit. For Fluid Extractor, use No. 21 and for Extractor use No. 22.", - "[Misc. Work] Mode C - Allows the multiblock to function as a Laser Engraver, a Replicator or an Autoclave. To allow a hatch to run in Laser Engraver mode, insert a No. 20 circuit. For Autoclave, use No. 21 and for Replicator use No. 22. REPLICATOR DISABLED.", + "[Misc. Work] Mode C - Allows the multiblock to function as a Laser Engraver, an Autoclave or a Fluid Solidifier. To allow a hatch to run in Laser Engraver mode, insert a No. 20 circuit. For Autoclave, use No. 21 and for Solidifier use No. 22.", }); book_NuclearManual = writeBookTemplate( diff --git a/src/Java/gtPlusPlus/core/handler/COMPAT_HANDLER.java b/src/Java/gtPlusPlus/core/handler/COMPAT_HANDLER.java index be02e352c7..d7c971e71f 100644 --- a/src/Java/gtPlusPlus/core/handler/COMPAT_HANDLER.java +++ b/src/Java/gtPlusPlus/core/handler/COMPAT_HANDLER.java @@ -68,6 +68,7 @@ import gtPlusPlus.xmod.gregtech.registration.gregtech.GregtechIndustrialCuttingF import gtPlusPlus.xmod.gregtech.registration.gregtech.GregtechIndustrialElectrolyzer; import gtPlusPlus.xmod.gregtech.registration.gregtech.GregtechIndustrialExtruder; import gtPlusPlus.xmod.gregtech.registration.gregtech.GregtechIndustrialFishPond; +import gtPlusPlus.xmod.gregtech.registration.gregtech.GregtechIndustrialAlloySmelter; import gtPlusPlus.xmod.gregtech.registration.gregtech.GregtechIndustrialFuelRefinery; import gtPlusPlus.xmod.gregtech.registration.gregtech.GregtechIndustrialGeneratorArray; import gtPlusPlus.xmod.gregtech.registration.gregtech.GregtechIndustrialMacerator; @@ -216,6 +217,7 @@ public class COMPAT_HANDLER { GregtechPowerBreakers.run(); GregtechFluidReactor.run(); GregtechAlgaeContent.run(); + GregtechIndustrialAlloySmelter.run(); //New Horizons Content NewHorizonsAccelerator.run(); diff --git a/src/Java/gtPlusPlus/core/item/ModItems.java b/src/Java/gtPlusPlus/core/item/ModItems.java index 114750d2d9..354107147b 100644 --- a/src/Java/gtPlusPlus/core/item/ModItems.java +++ b/src/Java/gtPlusPlus/core/item/ModItems.java @@ -4,7 +4,6 @@ import static gtPlusPlus.core.creative.AddToCreativeTab.tabMisc; import static gtPlusPlus.core.lib.CORE.LOAD_ALL_CONTENT; import cpw.mods.fml.common.registry.GameRegistry; -import gregtech.api.enums.GT_Values; import gregtech.api.enums.Materials; import gregtech.api.util.GT_OreDictUnificator; import gtPlusPlus.api.objects.Logger; @@ -14,7 +13,6 @@ import gtPlusPlus.core.common.compat.COMPAT_Baubles; import gtPlusPlus.core.creative.AddToCreativeTab; import gtPlusPlus.core.item.base.BaseEuItem; import gtPlusPlus.core.item.base.BaseItemBackpack; -import gtPlusPlus.core.item.base.BaseItemBurnable; import gtPlusPlus.core.item.base.BaseItemComponent.ComponentTypes; import gtPlusPlus.core.item.base.BaseItemDamageable; import gtPlusPlus.core.item.base.BaseItemTCShard; @@ -55,7 +53,6 @@ import gtPlusPlus.core.item.general.ItemGenericToken; import gtPlusPlus.core.item.general.ItemGiantEgg; import gtPlusPlus.core.item.general.ItemHalfCompleteCasings; import gtPlusPlus.core.item.general.ItemLavaFilter; -import gtPlusPlus.core.item.general.RF2EU_Battery; import gtPlusPlus.core.item.general.books.ItemBaseBook; import gtPlusPlus.core.item.general.capture.ItemEntityCatcher; import gtPlusPlus.core.item.general.chassis.ItemBoilerChassis; @@ -97,6 +94,7 @@ import gtPlusPlus.core.util.minecraft.ItemUtils; import gtPlusPlus.core.util.minecraft.MaterialUtils; import gtPlusPlus.core.util.reflect.ReflectionUtils; import gtPlusPlus.everglades.GTplusplus_Everglades; +import gtPlusPlus.xmod.cofh.HANDLER_COFH; import gtPlusPlus.xmod.eio.material.MaterialEIO; import gtPlusPlus.xmod.gregtech.common.items.MetaGeneratedGregtechItems; import net.minecraft.item.EnumRarity; @@ -1135,10 +1133,6 @@ public final class ModItems { if (LoadedMods.IndustrialCraft2|| LOAD_ALL_CONTENT){ Logger.INFO("IndustrialCraft2 Found - Loading Resources."); - if (LoadedMods.CoFHCore) { - RfEuBattery = new RF2EU_Battery(); - } - //Baubles Mod Test try { final Class<?> baublesTest = ReflectionUtils.getClass("baubles.api.IBauble"); @@ -1167,7 +1161,7 @@ public final class ModItems { //UtilsItems.generateSpawnEgg("ic2", "boatcarbon", Utils.generateSingularRandomHexValue(), Utils.generateSingularRandomHexValue()); - + HANDLER_COFH.initItems(); /* * Misc Items diff --git a/src/Java/gtPlusPlus/core/item/chemistry/GenericChem.java b/src/Java/gtPlusPlus/core/item/chemistry/GenericChem.java index 6e5b47041f..49d3303688 100644 --- a/src/Java/gtPlusPlus/core/item/chemistry/GenericChem.java +++ b/src/Java/gtPlusPlus/core/item/chemistry/GenericChem.java @@ -87,7 +87,7 @@ public class GenericChem extends ItemPackage { // Phenol Byproducts public Item PhenolicResins; //https://en.wikipedia.org/wiki/Phenol_formaldehyde_resin - public ItemGenericChemBase mGenericChemItem1; + public static ItemGenericChemBase mGenericChemItem1; @@ -112,6 +112,7 @@ public class GenericChem extends ItemPackage { public static ItemStack mOrangeCatalyst; public static ItemStack mPurpleCatalyst; public static ItemStack mBrownCatalyst; + public static ItemStack mPinkCatalyst; public void registerItemStacks() { @@ -124,6 +125,7 @@ public class GenericChem extends ItemPackage { mOrangeCatalyst = ItemUtils.simpleMetaStack(mGenericChemItem1, 3, 1); mPurpleCatalyst = ItemUtils.simpleMetaStack(mGenericChemItem1, 4, 1); mBrownCatalyst = ItemUtils.simpleMetaStack(mGenericChemItem1, 5, 1); + mPinkCatalyst = ItemUtils.simpleMetaStack(mGenericChemItem1, 6, 1); } @@ -135,6 +137,7 @@ public class GenericChem extends ItemPackage { ItemUtils.addItemToOreDictionary(mOrangeCatalyst, "catalystVanadiumPalladium"); ItemUtils.addItemToOreDictionary(mPurpleCatalyst, "catalystIridiumRuthenium"); ItemUtils.addItemToOreDictionary(mBrownCatalyst, "catalystNickelAluminium"); + ItemUtils.addItemToOreDictionary(mPinkCatalyst, "catalystPlatinumRhodium"); } @@ -206,6 +209,7 @@ public class GenericChem extends ItemPackage { recipeCatalystOrange(); recipeCatalystPurple(); recipeCatalystBrown(); + recipeCatalystPink(); recipeNitroBenzene(); recipeAniline(); @@ -224,7 +228,7 @@ public class GenericChem extends ItemPackage { private void recipeCyclohexane() { - CORE.RA.addFluidReactorRecipe( + CORE.RA.addChemicalPlantRecipe( new ItemStack[] { getTierTwoChip(), ItemUtils.getSimpleStack(mBrownCatalyst, 0) @@ -247,7 +251,7 @@ public class GenericChem extends ItemPackage { private void recipeCyclohexanone() { - CORE.RA.addFluidReactorRecipe( + CORE.RA.addChemicalPlantRecipe( new ItemStack[] { getTierTwoChip(), ItemUtils.getSimpleStack(mBlueCatalyst, 0) @@ -266,7 +270,7 @@ public class GenericChem extends ItemPackage { 120, 2); - CORE.RA.addFluidReactorRecipe( + CORE.RA.addChemicalPlantRecipe( new ItemStack[] { getTierTwoChip(), }, @@ -293,7 +297,7 @@ public class GenericChem extends ItemPackage { // Assembly Recipe CORE.RA.addSixSlotAssemblingRecipe(new ItemStack[] { getTierOneChip(), - ItemUtils.getSimpleStack(AgriculturalChem.mCatalystCarrier, 10), + CI.getEmptyCatalyst(10), ELEMENT.getInstance().IRON.getDust(2), ELEMENT.getInstance().COPPER.getDust(2), }, @@ -308,7 +312,7 @@ public class GenericChem extends ItemPackage { // Assembly Recipe CORE.RA.addSixSlotAssemblingRecipe(new ItemStack[] { getTierThreeChip(), - ItemUtils.getSimpleStack(AgriculturalChem.mCatalystCarrier, 10), + CI.getEmptyCatalyst(10), ELEMENT.getInstance().TUNGSTEN.getDust(4), ELEMENT.getInstance().NICKEL.getDust(4), }, @@ -323,7 +327,7 @@ public class GenericChem extends ItemPackage { // Assembly Recipe CORE.RA.addSixSlotAssemblingRecipe(new ItemStack[] { getTierTwoChip(), - ItemUtils.getSimpleStack(AgriculturalChem.mCatalystCarrier, 10), + CI.getEmptyCatalyst(10), ELEMENT.getInstance().COBALT.getDust(3), ELEMENT.getInstance().TITANIUM.getDust(3), }, @@ -338,7 +342,7 @@ public class GenericChem extends ItemPackage { // Assembly Recipe CORE.RA.addSixSlotAssemblingRecipe(new ItemStack[] { getTierTwoChip(), - ItemUtils.getSimpleStack(AgriculturalChem.mCatalystCarrier, 10), + CI.getEmptyCatalyst(10), ELEMENT.getInstance().VANADIUM.getDust(5), ELEMENT.getInstance().PALLADIUM.getDust(5), }, @@ -353,7 +357,7 @@ public class GenericChem extends ItemPackage { // Assembly Recipe CORE.RA.addSixSlotAssemblingRecipe(new ItemStack[] { getTierFourChip(), - ItemUtils.getSimpleStack(AgriculturalChem.mCatalystCarrier, 10), + CI.getEmptyCatalyst(10), ELEMENT.getInstance().IRIDIUM.getDust(6), ELEMENT.getInstance().RUTHENIUM.getDust(6), }, @@ -368,7 +372,7 @@ public class GenericChem extends ItemPackage { // Assembly Recipe CORE.RA.addSixSlotAssemblingRecipe(new ItemStack[] { getTierOneChip(), - ItemUtils.getSimpleStack(AgriculturalChem.mCatalystCarrier, 10), + CI.getEmptyCatalyst(10), ELEMENT.getInstance().NICKEL.getDust(4), ELEMENT.getInstance().ALUMINIUM.getDust(4), }, @@ -379,10 +383,25 @@ public class GenericChem extends ItemPackage { } + private void recipeCatalystPink() { + // Assembly Recipe + CORE.RA.addSixSlotAssemblingRecipe(new ItemStack[] { + getTierThreeChip(), + CI.getEmptyCatalyst(10), + ELEMENT.getInstance().PLATINUM.getDust(4), + ELEMENT.getInstance().RHODIUM.getDust(4), + }, + GT_Values.NF, + ItemUtils.getSimpleStack(mPinkCatalyst, 10), + 30 * 20, + 2000); + + } + private void recipeCadaverineAndPutrescine() { // Basic Recipe - CORE.RA.addFluidReactorRecipe( + CORE.RA.addChemicalPlantRecipe( new ItemStack[] { getTierOneChip(), ItemUtils.getSimpleStack(Items.rotten_flesh, 64) @@ -402,7 +421,7 @@ public class GenericChem extends ItemPackage { 1); // Advanced Recipe - CORE.RA.addFluidReactorRecipe( + CORE.RA.addChemicalPlantRecipe( new ItemStack[] { getTierTwoChip(), ItemUtils.getSimpleStack(Items.rotten_flesh, 128), @@ -426,7 +445,7 @@ public class GenericChem extends ItemPackage { private void recipeAniline() { - CORE.RA.addFluidReactorRecipe( + CORE.RA.addChemicalPlantRecipe( new ItemStack[] { getTierThreeChip(), ItemUtils.getSimpleStack(mBlueCatalyst, 0) @@ -449,7 +468,7 @@ public class GenericChem extends ItemPackage { private void recipeNitroBenzene() { - CORE.RA.addFluidReactorRecipe( + CORE.RA.addChemicalPlantRecipe( new ItemStack[] { getTierThreeChip(), }, @@ -474,7 +493,7 @@ public class GenericChem extends ItemPackage { private void recipe2Ethylanthraquinone() { - CORE.RA.addFluidReactorRecipe( + CORE.RA.addChemicalPlantRecipe( new ItemStack[] { CI.getNumberedCircuit(4), ItemUtils.getItemStackOfAmountFromOreDict("dustPhthalicAnhydride", 4), @@ -504,7 +523,7 @@ public class GenericChem extends ItemPackage { private void recipe2Ethylanthrahydroquinone() { - CORE.RA.addFluidReactorRecipe( + CORE.RA.addChemicalPlantRecipe( new ItemStack[] { CI.getNumberedCircuit(4), ItemUtils.getSimpleStack(mOrangeCatalyst, 0), @@ -553,7 +572,7 @@ public class GenericChem extends ItemPackage { private void recipeLithiumHydroperoxide() { - CORE.RA.addFluidReactorRecipe( + CORE.RA.addChemicalPlantRecipe( new ItemStack[] { CI.getNumberedCircuit(4), ItemUtils.getItemStackOfAmountFromOreDict("dustLithiumHydroxide", 7), @@ -587,7 +606,7 @@ public class GenericChem extends ItemPackage { private void recipeHydrogenPeroxide() { - CORE.RA.addFluidReactorRecipe( + CORE.RA.addChemicalPlantRecipe( new ItemStack[] { CI.getNumberedCircuit(4), }, diff --git a/src/Java/gtPlusPlus/core/item/chemistry/general/ItemGenericChemBase.java b/src/Java/gtPlusPlus/core/item/chemistry/general/ItemGenericChemBase.java index 8a003ec7aa..208fecd57c 100644 --- a/src/Java/gtPlusPlus/core/item/chemistry/general/ItemGenericChemBase.java +++ b/src/Java/gtPlusPlus/core/item/chemistry/general/ItemGenericChemBase.java @@ -19,7 +19,7 @@ public class ItemGenericChemBase extends Item { final protected IIcon base[]; - final private int aMetaSize = 6; + final private int aMetaSize = 7; /* * 0 - Red Metal Catalyst //FeCu @@ -28,6 +28,7 @@ public class ItemGenericChemBase extends Item { * 3 - Orange Metal Catalyst //Vanadium Pd * 4 - Purple Metal Catalyst //IrIdium Ruthenium * 5 - Brown Metal Catalyst //NiAl + * 6 - Pink Metal Catalyst //PtRh * */ diff --git a/src/Java/gtPlusPlus/core/lib/CORE.java b/src/Java/gtPlusPlus/core/lib/CORE.java index 2a267dc16d..34d7475df3 100644 --- a/src/Java/gtPlusPlus/core/lib/CORE.java +++ b/src/Java/gtPlusPlus/core/lib/CORE.java @@ -237,6 +237,7 @@ public class CORE { public static boolean enableMachine_ComponentAssemblers = false; public static boolean enableCustom_Pipes = true; public static boolean enableCustom_Cables = true; + public static boolean enableMachine_RF_Convetor = false; //Multiblocks public static boolean enableMultiblock_AlloyBlastSmelter = true; diff --git a/src/Java/gtPlusPlus/core/recipe/RECIPES_GREGTECH.java b/src/Java/gtPlusPlus/core/recipe/RECIPES_GREGTECH.java index 74c8ce4202..f1676689e7 100644 --- a/src/Java/gtPlusPlus/core/recipe/RECIPES_GREGTECH.java +++ b/src/Java/gtPlusPlus/core/recipe/RECIPES_GREGTECH.java @@ -17,6 +17,7 @@ import gregtech.api.util.ThermalFuel; import gtPlusPlus.api.objects.Logger; import gtPlusPlus.core.block.ModBlocks; import gtPlusPlus.core.item.ModItems; +import gtPlusPlus.core.item.chemistry.AgriculturalChem; import gtPlusPlus.core.item.chemistry.GenericChem; import gtPlusPlus.core.item.chemistry.IonParticles; import gtPlusPlus.core.item.chemistry.RocketFuels; @@ -39,6 +40,7 @@ import gtPlusPlus.core.util.minecraft.ItemUtils; import gtPlusPlus.core.util.minecraft.MaterialUtils; import gtPlusPlus.core.util.reflect.AddGregtechRecipe; import gtPlusPlus.everglades.dimension.Dimension_Everglades; +import gtPlusPlus.plugin.agrichem.BioRecipes; import gtPlusPlus.xmod.gregtech.api.enums.GregtechItemList; import net.minecraft.init.Blocks; import net.minecraft.init.Items; @@ -91,6 +93,7 @@ public class RECIPES_GREGTECH { latheRecipes(); vacuumFreezerRecipes(); fluidheaterRecipes(); + chemplantRecipes(); /** @@ -107,6 +110,30 @@ public class RECIPES_GREGTECH { addFuels(); } + private static void chemplantRecipes() { + + // Advanced method for Nitric Acid Production + /* CORE.RA.addChemicalPlantRecipe( + new ItemStack[] { + CI.getNumberedBioCircuit(17), + CI.getPinkCatalyst(0), + }, + new FluidStack[] { + FluidUtils.getLava(10000), + FluidUtils.getDistilledWater(5000) + }, + new ItemStack[] { + + }, + new FluidStack[] { + FluidUtils.getFluidStack("nitricacid", 2000), + }, + 10 * 20, + 480, + 3);*/ + + } + private static void fluidheaterRecipes() { GT_Values.RA.addFluidHeaterRecipe(CI.getNumberedCircuit(20), FluidUtils.getWater(1000), FluidUtils.getHotWater(1000), 30, 30); @@ -511,6 +538,30 @@ public class RECIPES_GREGTECH { private static void laserEngraverRecipes() { + // Laser Sensors and Emitters together + GregtechItemList[] aTransParts = new GregtechItemList[] { + GregtechItemList.TransmissionComponent_ULV, + 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_MAX, + }; + for (int i=0;i<10;i++) { + GT_Values.RA.addLaserEngraverRecipe( + CI.getEmitter(i, 2), + CI.getSensor(i, 2), + aTransParts[i].get(1), + 20 * 5, + MaterialUtils.getVoltageForTier(i)); + } + + + GT_Values.RA.addLaserEngraverRecipe( GT_OreDictUnificator.get(OrePrefixes.dust, Materials.Tungsten, 6L), GregtechItemList.Laser_Lens_Special.get(0), @@ -646,18 +697,18 @@ public class RECIPES_GREGTECH { new int[] {10000}, //Output Chance 20 * 120, 30720); - + //NITINOL_60 CORE.RA.addBlastSmelterRecipe( new ItemStack[] { - ELEMENT.getInstance().TITANIUM.getDust(3), - ELEMENT.getInstance().NICKEL.getDust(2) + ELEMENT.getInstance().TITANIUM.getDust(3), + ELEMENT.getInstance().NICKEL.getDust(2) }, - ALLOY.NITINOL_60.getFluid(20 * 144), + ALLOY.NITINOL_60.getFluid(5 * 144), 0, 20 * 75, 7680); - + @@ -847,13 +898,13 @@ public class RECIPES_GREGTECH { //Gelid Cryotheum CORE.RA.addFluidExtractionRecipe(ItemUtils.getItemStackOfAmountFromOreDict("dustCryotheum", 1), FluidUtils.getFluidStack("cryotheum", 250), 200, 240); - + //Ender Fluid CORE.RA.addFluidExtractionRecipe(ItemUtils.getSimpleStack(Items.ender_pearl), FluidUtils.getFluidStack("ender", 250), 100, 30); - + //Blazing Pyrotheum CORE.RA.addFluidExtractionRecipe(ItemUtils.getItemStackOfAmountFromOreDict("dustPyrotheum", 1), FluidUtils.getFluidStack("pyrotheum", 250), 200, 240); - + } @@ -1568,10 +1619,10 @@ public class RECIPES_GREGTECH { GT_Values.RA.addAssemblerRecipe(GT_OreDictUnificator.get(OrePrefixes.plate, Materials.Invar, 8L), GT_OreDictUnificator.get(OrePrefixes.ring, Materials.Invar, 4L), GregtechItemList.Fluid_Cell_144L.get(1L, new Object[0]), 75, 32); } } - + if (LoadedMods.Baubles) { - + // Turbine Housing Research Page @@ -1600,8 +1651,8 @@ public class RECIPES_GREGTECH { ItemDummyResearch.getResearchStack(ASSEMBLY_LINE_RESEARCH.RESEARCH_9_CLOAKING, 1), 20 * 60 * 10, (int) GT_Values.V[7]); - - + + // Supreme Pizza Gloves CORE.RA.addSixSlotAssemblingRecipe(new ItemStack[] { ItemUtils.getGregtechCircuit(19), diff --git a/src/Java/gtPlusPlus/core/recipe/RECIPES_Machines.java b/src/Java/gtPlusPlus/core/recipe/RECIPES_Machines.java index d703bb9637..2165f27ec7 100644 --- a/src/Java/gtPlusPlus/core/recipe/RECIPES_Machines.java +++ b/src/Java/gtPlusPlus/core/recipe/RECIPES_Machines.java @@ -253,7 +253,7 @@ public class RECIPES_Machines { CI.getTieredComponentOfMaterial(Materials.Steel, OrePrefixes.gearGt, 6), CI.getTieredComponentOfMaterial(Materials.Aluminium, OrePrefixes.plate, 32), CI.getTieredComponentOfMaterial(Materials.CobaltBrass, OrePrefixes.dust, 16), - ALLOY.STAINLESS_STEEL.getFrameBox(4), + CI.getTieredComponent(OrePrefixes.frameGt, 2, 4), }, ALLOY.STEEL.getFluid(2 * (144 * 4)), GregtechItemList.ChemicalPlant_Controller.get(1), @@ -293,7 +293,7 @@ public class RECIPES_Machines { private static void distillus() { - CORE.RA.addFluidReactorRecipe( + CORE.RA.addChemicalPlantRecipe( new ItemStack[] { CI.getNumberedBioCircuit(19), ItemList.Distillation_Tower.get(2), @@ -338,7 +338,7 @@ public class RECIPES_Machines { CI.getElectricPiston(i, 10), CI.getFieldGenerator(i + 1, 6), CI.getPlate(i, 16), - CI.getEmitter(i - 1, 24), + CI.getTransmissionComponent(i - 1, 8), CI.getTieredComponent(OrePrefixes.cableGt08, i, 16) }, ALLOY.EGLIN_STEEL.getFluid(i * (144 * 4)), @@ -394,14 +394,14 @@ public class RECIPES_Machines { for (int i=0;i<10;i++) { CORE.RA.addSixSlotAssemblingRecipe( new ItemStack[] { - CI.getNumberedBioCircuit(22), + CI.getNumberedBioCircuit(20), CI.getTieredMachineCasing(i), CI.getPlate(i, 8), CI.getGear(i, 2), CI.getTieredComponent(OrePrefixes.cableGt02, i, 4), CI.getTieredComponent(OrePrefixes.circuit, i, 2) }, - CI.getTieredFluid(i, 144 * i * 2), + CI.getAlternativeTieredFluid(i, 144 * i * 2), aHulls[i].get(1), 20 * 20, MaterialUtils.getVoltageForTier(i)); @@ -605,6 +605,16 @@ public class RECIPES_Machines { plateEnergeticAlloy, pipeLargeCopper, plateEnergeticAlloy, RECIPE_SteamCondenser); } + + + //Steam Condenser + if (LoadedMods.CoFHCore && CORE.ConfigSwitches.enableMachine_RF_Convetor){ + RecipeUtils.addShapedGregtechRecipe( + CI.getPlate(4, 1), CI.getTieredCircuitOreDictName(5), CI.getPlate(4, 1), + CI.getTransmissionComponent(3, 1), CI.getTieredGTPPMachineCasing(4, 1), CI.getTransmissionComponent(3, 1), + CI.getPlate(4, 1), plateEnergeticAlloy, CI.getPlate(4, 1), + GregtechItemList.Energy_Buffer_RF_Convertor.get(1)); + } if (CORE.ConfigSwitches.enableMultiblock_IronBlastFurnace){ @@ -1488,8 +1498,7 @@ public class RECIPES_Machines { GregtechItemList.Casing_Refinery_Structural.get(4), ItemUtils.getSimpleStack(ModItems.itemCircuitLFTR, GTNH ? 2 : 1), CI.getTieredComponent(OrePrefixes.cableGt08, GTNH ? 7 : 6, GTNH ? 32 : 16), - CI.getEmitter(GTNH ? 6 : 5, 2), - CI.getSensor(GTNH ? 6 : 5, 2), + CI.getTransmissionComponent(GTNH ? 6 : 5, 2), GregtechItemList.Gregtech_Computer_Cube.get(1), }, CI.getTieredFluid(7, 144 * (GTNH ? 32 : 8)), GregtechItemList.GT4_Multi_Crafter.get(1), @@ -2178,8 +2187,7 @@ public class RECIPES_Machines { int aTier = (i + 1); ItemStack[] aInputs = new ItemStack[] { CI.getTieredMachineHull(i, 1 * aCostMultiplier), - CI.getEmitter(i, 2 * aCostMultiplier), - CI.getSensor(i, 2 * aCostMultiplier), + CI.getTransmissionComponent(i, 2 * aCostMultiplier), CI.getFieldGenerator(i, 1 * aCostMultiplier), CI.getTieredComponent(OrePrefixes.plate, aTier, 4 * aCostMultiplier), CI.getTieredComponent(OrePrefixes.circuit, aTier, 2 * aCostMultiplier), @@ -2199,9 +2207,8 @@ public class RECIPES_Machines { CORE.RA.addSixSlotAssemblingRecipe( new ItemStack[] { CI.getTieredMachineHull(-1, 1 * aCostMultiplier), - CI.getEmitter(2, 2 * aCostMultiplier), + CI.getTransmissionComponent(2, 2 * aCostMultiplier), CI.getElectricPiston(4, 2 * aCostMultiplier), - CI.getSensor(4, 1 * aCostMultiplier), CI.getTieredComponent(OrePrefixes.plate, 5, 4 * aCostMultiplier), CI.getTieredComponent(OrePrefixes.pipeSmall, 4, 1 * aCostMultiplier), }, diff --git a/src/Java/gtPlusPlus/core/recipe/common/CI.java b/src/Java/gtPlusPlus/core/recipe/common/CI.java index 6b8f992266..1d3d386da3 100644 --- a/src/Java/gtPlusPlus/core/recipe/common/CI.java +++ b/src/Java/gtPlusPlus/core/recipe/common/CI.java @@ -7,6 +7,7 @@ import gregtech.api.util.GT_ModHandler; import gregtech.api.util.GT_Utility; import gtPlusPlus.api.objects.Logger; import gtPlusPlus.core.item.chemistry.AgriculturalChem; +import gtPlusPlus.core.item.chemistry.GenericChem; import gtPlusPlus.core.lib.CORE; import gtPlusPlus.core.lib.LoadedMods; import gtPlusPlus.core.material.ALLOY; @@ -564,7 +565,7 @@ public class CI { private static final Material[] aMaterial_Secondary = new Material[] { ALLOY.STEEL, ALLOY.SILICON_CARBIDE, - ALLOY.TUNGSTEN_CARBIDE, + ALLOY.BABBIT_ALLOY, ALLOY.INCONEL_690, ALLOY.STELLITE, ALLOY.ARCANITE, @@ -579,7 +580,7 @@ public class CI { private static final Material[] aMaterial_Tertiary = new Material[] { ELEMENT.getInstance().LEAD, ELEMENT.getInstance().ALUMINIUM, - ALLOY.STAINLESS_STEEL, + ELEMENT.STANDALONE.BLACK_METAL, ELEMENT.getInstance().TUNGSTEN, ALLOY.HASTELLOY_N, ALLOY.ENERGYCRYSTAL, @@ -1264,4 +1265,96 @@ public class CI { return ItemUtils.getOrePrefixStack(aPrefix, aMaterial, aAmount); } + public static ItemStack getTransmissionComponent(int aTier, int aAmount) { + GregtechItemList[] aTransParts = new GregtechItemList[] { + GregtechItemList.TransmissionComponent_ULV, + 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_MAX, + }; + return aTransParts[aTier].get(aAmount); + } + + public static ItemStack getEmptyCatalyst(int aAmount) { + return ItemUtils.simpleMetaStack(AgriculturalChem.mAgrichemItem1, 13, aAmount); + } + + /** + * Aluminium + Silver Catalyst + * @param aAmount - Stacksize + * @return - A Catalyst stack of given size + */ + public static ItemStack getGreenCatalyst(int aAmount) { + return ItemUtils.simpleMetaStack(AgriculturalChem.mAgrichemItem1, 14, aAmount); + } + + /** + * Iron + Copper Catalyst + * @param aAmount - Stacksize + * @return - A Catalyst stack of given size + */ + public static ItemStack getRedCatalyst(int aAmount) { + return ItemUtils.simpleMetaStack(GenericChem.mGenericChemItem1, 0, aAmount); + } + + /** + * Tungsten + Nickel Catalyst + * @param aAmount - Stacksize + * @return - A Catalyst stack of given size + */ + public static ItemStack getYellowCatalyst(int aAmount) { + return ItemUtils.simpleMetaStack(GenericChem.mGenericChemItem1, 1, aAmount); + } + + /** + * Cobalt + Titanium Catalyst + * @param aAmount - Stacksize + * @return - A Catalyst stack of given size + */ + public static ItemStack getBlueCatalyst(int aAmount) { + return ItemUtils.simpleMetaStack(GenericChem.mGenericChemItem1, 2, aAmount); + } + + /** + * Vanadium + Palladium Catalyst + * @param aAmount - Stacksize + * @return - A Catalyst stack of given size + */ + public static ItemStack getOrangeCatalyst(int aAmount) { + return ItemUtils.simpleMetaStack(GenericChem.mGenericChemItem1, 3, aAmount); + } + + /** + * Iridium + Ruthenium Catalyst + * @param aAmount - Stacksize + * @return - A Catalyst stack of given size + */ + public static ItemStack getPurpleCatalyst(int aAmount) { + return ItemUtils.simpleMetaStack(GenericChem.mGenericChemItem1, 4, aAmount); + } + + /** + * Aluminium + Nickel Catalyst + * @param aAmount - Stacksize + * @return - A Catalyst stack of given size + */ + public static ItemStack getBrownCatalyst(int aAmount) { + return ItemUtils.simpleMetaStack(GenericChem.mGenericChemItem1, 5, aAmount); + } + + /** + * Platinum + Rhodium Catalyst + * @param aAmount - Stacksize + * @return - A Catalyst stack of given size + */ + public static ItemStack getPinkCatalyst(int aAmount) { + return ItemUtils.simpleMetaStack(GenericChem.mGenericChemItem1, 6, aAmount); + } + } diff --git a/src/Java/gtPlusPlus/core/slots/SlotChemicalPlantInput.java b/src/Java/gtPlusPlus/core/slots/SlotChemicalPlantInput.java index 6cd13dc209..add55b8d27 100644 --- a/src/Java/gtPlusPlus/core/slots/SlotChemicalPlantInput.java +++ b/src/Java/gtPlusPlus/core/slots/SlotChemicalPlantInput.java @@ -20,9 +20,9 @@ public class SlotChemicalPlantInput extends Slot { } public static boolean isItemValidForChemicalPlantSlot(ItemStack aStack) { - boolean validItem = Gregtech_Recipe_Map.sFluidChemicalReactorRecipes.containsInput(aStack); + boolean validItem = Gregtech_Recipe_Map.sChemicalPlantRecipes.containsInput(aStack); if (!validItem) { - for (Recipe_GT f : Gregtech_Recipe_Map.sFluidChemicalReactorRecipes.mRecipeList) { + for (Recipe_GT f : Gregtech_Recipe_Map.sChemicalPlantRecipes.mRecipeList) { if (f.mFluidInputs.length > 0) { for (FluidStack g : f.mFluidInputs) { if (g != null) { diff --git a/src/Java/gtPlusPlus/core/util/data/ArrayUtils.java b/src/Java/gtPlusPlus/core/util/data/ArrayUtils.java index 3e96220995..6f5bb5b453 100644 --- a/src/Java/gtPlusPlus/core/util/data/ArrayUtils.java +++ b/src/Java/gtPlusPlus/core/util/data/ArrayUtils.java @@ -10,6 +10,7 @@ import java.util.Set; import gtPlusPlus.api.objects.Logger; import gtPlusPlus.api.objects.data.AutoMap; import net.minecraft.item.ItemStack; +import net.minecraftforge.fluids.FluidStack; public class ArrayUtils { @@ -88,5 +89,14 @@ public class ArrayUtils { return org.apache.commons.lang3.ArrayUtils.toString(aArray); } + public static <T> Object[] getArrayFromArrayList(ArrayList<T> aArrayList) { + Object[] aGenericArray = new Object[aArrayList.size()]; + int aIndex = 0; + for (T object : aArrayList) { + aGenericArray[aIndex++] = object; + } + return aGenericArray; + } + } diff --git a/src/Java/gtPlusPlus/core/util/minecraft/ItemUtils.java b/src/Java/gtPlusPlus/core/util/minecraft/ItemUtils.java index 485436011f..d7d611a1e4 100644 --- a/src/Java/gtPlusPlus/core/util/minecraft/ItemUtils.java +++ b/src/Java/gtPlusPlus/core/util/minecraft/ItemUtils.java @@ -25,11 +25,14 @@ import gtPlusPlus.core.item.base.dusts.BaseItemDustUnique; import gtPlusPlus.core.item.base.dusts.decimal.BaseItemCentidust; import gtPlusPlus.core.item.base.dusts.decimal.BaseItemDecidust; import gtPlusPlus.core.item.base.plates.BaseItemPlate_OLD; +import gtPlusPlus.core.item.chemistry.AgriculturalChem; +import gtPlusPlus.core.item.chemistry.GenericChem; import gtPlusPlus.core.item.tool.staballoy.MultiPickaxeBase; import gtPlusPlus.core.item.tool.staballoy.MultiSpadeBase; import gtPlusPlus.core.lib.CORE; import gtPlusPlus.core.lib.LoadedMods; import gtPlusPlus.core.material.Material; +import gtPlusPlus.core.recipe.common.CI; import gtPlusPlus.core.util.Utils; import gtPlusPlus.core.util.math.MathUtils; import gtPlusPlus.core.util.reflect.ReflectionUtils; @@ -909,46 +912,10 @@ public class ItemUtils { return CORE.burnables.add(new Pair<Integer, ItemStack>(burn, aBurnable)); } - /** - * Quick Block Name Lookup that is friendly to servers and locale. - */ - private static volatile Map<String, String> mLocaleCache = new HashMap<String, String>(); - public static String getLocalizedNameOfBlock(BlockPos pos) { Block block = pos.world.getBlock(pos.xPos, pos.yPos, pos.zPos); int metaData = pos.world.getBlockMetadata(pos.xPos, pos.yPos, pos.zPos); - return getLocalizedNameOfBlock(block, metaData); - } - - public synchronized static String getLocalizedNameOfBlock(Block block, int meta) { - if (block == null || meta < 0) { - return "Bad Block"; - } - String mCacheKey = block.getUnlocalizedName() + ":" + meta; - if (mLocaleCache.containsKey(mCacheKey)) { - // Recache the key if it's invalid. - if (mLocaleCache.get(mCacheKey).toLowerCase().contains(".name")) { - mLocaleCache.remove(mCacheKey); - String mNew = ItemUtils.simpleMetaStack(block, meta, 1).getDisplayName(); - //Logger.INFO("Re-caching "+mNew+" into locale cache."); - mLocaleCache.put(mCacheKey, mNew); - } - //Logger.INFO("Returning Cached Value."); - return mLocaleCache.get(mCacheKey); - } else { - Item item = Item.getItemFromBlock(block); - if (item == null) { - return "Bad Item"; - } - String unlocalizedName = item.getUnlocalizedName(new ItemStack(block, 1, meta)); - String blockName = StatCollector.translateToLocal(unlocalizedName + ".name"); - if (blockName.toLowerCase().contains(".name")) { - blockName = ItemUtils.simpleMetaStack(block, meta, 1).getDisplayName(); - } - mLocaleCache.put(mCacheKey, blockName); - //Logger.INFO("Cached New Value."); - return blockName; - } + return LangUtils.getLocalizedNameOfBlock(block, metaData); } public static boolean checkForInvalidItems(ItemStack mInput) { @@ -1270,7 +1237,7 @@ public class ItemUtils { } public static ItemStack getItemListObject(String aObjectFromExperimentalName, String aReplacementName, int aAmount) { - ItemList aItemListObject = getItemListObject(aReplacementName, aReplacementName); + ItemList aItemListObject = getItemListObject(aObjectFromExperimentalName, aReplacementName); if (aItemListObject == ItemList.NULL || aItemListObject == null) { return null; } @@ -1304,4 +1271,47 @@ public class ItemUtils { } } + public static boolean isControlCircuit(ItemStack aStack) { + if (aStack != null) { + Item aItem = aStack.getItem(); + if (aItem == CI.getNumberedBioCircuit(0).getItem() || aItem == CI.getNumberedCircuit(0).getItem()) { + return true; + } + } + return false; + } + + public static boolean isCatalyst(ItemStack aStack) { + + if (GT_Utility.areStacksEqual(aStack, GenericChem.mBlueCatalyst, true)) { + return true; + } + if (GT_Utility.areStacksEqual(aStack, GenericChem.mBrownCatalyst, true)) { + return true; + } + if (GT_Utility.areStacksEqual(aStack, GenericChem.mOrangeCatalyst, true)) { + return true; + } + if (GT_Utility.areStacksEqual(aStack, GenericChem.mPurpleCatalyst, true)) { + return true; + } + if (GT_Utility.areStacksEqual(aStack, GenericChem.mRedCatalyst, true)) { + return true; + } + if (GT_Utility.areStacksEqual(aStack, GenericChem.mYellowCatalyst, true)) { + return true; + } + if (GT_Utility.areStacksEqual(aStack, GenericChem.mPinkCatalyst, true)) { + return true; + } + if (GT_Utility.areStacksEqual(aStack, AgriculturalChem.mGreenCatalyst, true)) { + return true; + } + return false; + } + + public static String getLocalizedNameOfBlock(Block aBlock, int aMeta) { + return LangUtils.getLocalizedNameOfBlock(aBlock, aMeta); + } + } diff --git a/src/Java/gtPlusPlus/core/util/minecraft/LangUtils.java b/src/Java/gtPlusPlus/core/util/minecraft/LangUtils.java index 01d0efac54..0b24e962af 100644 --- a/src/Java/gtPlusPlus/core/util/minecraft/LangUtils.java +++ b/src/Java/gtPlusPlus/core/util/minecraft/LangUtils.java @@ -7,7 +7,13 @@ import java.util.Properties; import cpw.mods.fml.common.registry.LanguageRegistry; import gregtech.api.util.GT_LanguageManager; +import gtPlusPlus.api.objects.Logger; import gtPlusPlus.core.util.reflect.ReflectionUtils; +import net.minecraft.block.Block; +import net.minecraft.item.Item; +import net.minecraft.item.ItemStack; +import net.minecraft.nbt.NBTTagCompound; +import net.minecraft.util.StatCollector; public class LangUtils { @@ -15,7 +21,7 @@ public class LangUtils { public static boolean rewriteEntryForLanguageRegistry(String aKey, String aNewValue){ return rewriteEntryForLanguageRegistry("en_US", aKey, aNewValue); } - + @SuppressWarnings("unchecked") public static boolean rewriteEntryForLanguageRegistry(String aLang, String aKey, String aNewValue){ LanguageRegistry aInstance = LanguageRegistry.instance(); @@ -43,7 +49,7 @@ public class LangUtils { } } catch (IllegalArgumentException | IllegalAccessException e) { - + } } return false; @@ -52,5 +58,93 @@ public class LangUtils { public static String trans(String aNr, String aEnglish) { return GT_LanguageManager.addStringLocalization("Interaction_DESCRIPTION_Index_GTPP_" + aNr, aEnglish, false); } - + + + + /** + * Quick Block Name Lookup that is friendly to servers and locale. + */ + private static final Map<String, String> mLocaleCache = new HashMap<String, String>(); + + public static String getLocalizedNameOfBlock(Block aBlock, int aMeta) { + if (aBlock != null) { + return getLocalizedNameOfItemStack(ItemUtils.simpleMetaStack(aBlock, aMeta, 1)); + } + return "Bad Block Name"; + } + + public static String getLocalizedNameOfItem(Item aItem, int aMeta) { + if (aItem != null) { + return getLocalizedNameOfItemStack(ItemUtils.simpleMetaStack(aItem, aMeta, 1)); + } + return "Bad Item Name"; + } + + public static String getLocalizedNameOfItemStack(ItemStack aStack) { + String aUnlocalized; + if (aStack != null) { + aUnlocalized = ItemUtils.getUnlocalizedItemName(aStack)+"."+aStack.getItemDamage()+".name"; + if (aUnlocalized == null || aUnlocalized.length() <= 0) { + return "Bad Locale Data"; + } + String mCacheKey = aUnlocalized; + if (mLocaleCache.containsKey(mCacheKey)) { + // Recache the key if it's invalid. + if (mLocaleCache.get(mCacheKey).toLowerCase().contains(".name") || mLocaleCache.get(mCacheKey).toLowerCase().contains("|")) { + mLocaleCache.remove(mCacheKey); + String mNew; + try { + mNew = ("" + StatCollector + .translateToLocal(aStack.getItem().getUnlocalizedNameInefficiently(aStack) + ".name")) + .trim(); + if (aStack.hasTagCompound()) { + if (aStack.stackTagCompound != null && aStack.stackTagCompound.hasKey("display", 10)) { + NBTTagCompound nbttagcompound = aStack.stackTagCompound.getCompoundTag("display"); + + if (nbttagcompound.hasKey("Name", 8)) { + mNew = nbttagcompound.getString("Name"); + } + } + } + } catch (Throwable t) { + mNew = "ERROR - Empty Stack"; + } + Logger.INFO("Re-caching "+mNew+" into locale cache. Key: "+mCacheKey); + mLocaleCache.put(mCacheKey, mNew); + } + Logger.INFO("Returning Cached Value. Key: "+mCacheKey); + return mLocaleCache.get(mCacheKey); + } + else { + String unlocalizedName = aStack.getItem().getUnlocalizedName(aStack); + Logger.INFO("Cached New Value. UnlocalName: "+unlocalizedName); + String blockName = StatCollector.translateToLocal(unlocalizedName + ".name"); + Logger.INFO("Cached New Value. TranslatedName: "+unlocalizedName); + if (blockName.toLowerCase().contains(".name") || blockName.toLowerCase().contains("|")) { + try { + blockName = ("" + StatCollector + .translateToLocal(aStack.getItem().getUnlocalizedNameInefficiently(aStack) + ".name")) + .trim(); + if (aStack.hasTagCompound()) { + if (aStack.stackTagCompound != null && aStack.stackTagCompound.hasKey("display", 10)) { + NBTTagCompound nbttagcompound = aStack.stackTagCompound.getCompoundTag("display"); + if (nbttagcompound.hasKey("Name", 8)) { + blockName = nbttagcompound.getString("Name"); + } + } + } + } catch (Throwable t) { + blockName = "ERROR - Empty Stack"; + } + } + mLocaleCache.put(mCacheKey, blockName); + Logger.INFO("Cached New Value. Key: "+mCacheKey); + return blockName; + } + + } + return "Bad ItemStack Name"; + } + + } diff --git a/src/Java/gtPlusPlus/core/util/minecraft/NBTUtils.java b/src/Java/gtPlusPlus/core/util/minecraft/NBTUtils.java index 66abbded15..b0623d429d 100644 --- a/src/Java/gtPlusPlus/core/util/minecraft/NBTUtils.java +++ b/src/Java/gtPlusPlus/core/util/minecraft/NBTUtils.java @@ -464,4 +464,15 @@ public class NBTUtils { return ReflectionUtils.setField(aEntity, "customEntityData", aTag); } + public static boolean hasTagCompound(ItemStack aStack) { + return aStack.hasTagCompound(); + } + + public static void createEmptyTagCompound(ItemStack aStack) { + if (!hasTagCompound(aStack)) { + NBTTagCompound aTag = new NBTTagCompound(); + aStack.setTagCompound(aTag); + } + } + } diff --git a/src/Java/gtPlusPlus/nei/GT_NEI_FluidReactor.java b/src/Java/gtPlusPlus/nei/GT_NEI_FluidReactor.java index b150d94c25..810076743f 100644 --- a/src/Java/gtPlusPlus/nei/GT_NEI_FluidReactor.java +++ b/src/Java/gtPlusPlus/nei/GT_NEI_FluidReactor.java @@ -3,6 +3,7 @@ package gtPlusPlus.nei; import java.awt.Point; import java.awt.Rectangle; import java.util.ArrayList; +import java.util.Collections; import java.util.Iterator; import java.util.List; @@ -26,7 +27,11 @@ import gregtech.api.util.GT_OreDictUnificator; import gregtech.api.util.GT_Recipe; import gregtech.api.util.GT_Recipe.GT_Recipe_Map; import gregtech.api.util.GT_Utility; +import gregtech.api.util.Recipe_GT; +import gregtech.api.util.Recipe_GT.Gregtech_Recipe_Map; import gtPlusPlus.core.lib.CORE; +import gtPlusPlus.core.util.minecraft.ItemUtils; +import gtPlusPlus.nei.GT_NEI_MultiBlockHandler.CachedDefaultRecipe; import net.minecraft.client.Minecraft; import net.minecraft.client.gui.inventory.GuiContainer; import net.minecraft.init.Blocks; @@ -44,31 +49,37 @@ extends TemplateRecipeHandler { GuiContainerManager.addTooltipHandler(new GT_RectHandler()); } - protected final GT_Recipe_Map mRecipeMap; + protected Gregtech_Recipe_Map mRecipeMap; - public GT_NEI_FluidReactor(final GT_Recipe_Map sfluidchemicalreactorrecipes) { - this.mRecipeMap = sfluidchemicalreactorrecipes; - this.transferRects.add(new TemplateRecipeHandler.RecipeTransferRect(new Rectangle(65, 13, 36, 18), this.getOverlayIdentifier(), new Object[0])); + public GT_NEI_FluidReactor() { + this.mRecipeMap = Gregtech_Recipe_Map.sChemicalPlantRecipes; + this.transferRects.add(new TemplateRecipeHandler.RecipeTransferRect(new Rectangle(65, 13, 36, 18), this.getRecipeMapName(), new Object[0])); if (!NEI_GT_Config.sIsAdded) { - FMLInterModComms.sendRuntimeMessage(GT_Values.GT, "NEIPlugins", "register-crafting-handler", "gregtechplusplus@" + this.getRecipeName() + "@" + this.getOverlayIdentifier()); + FMLInterModComms.sendRuntimeMessage(GT_Values.GT, "NEIPlugins", "register-crafting-handler", "gregtechplusplus@" + this.getRecipeName() + "@" + this.getRecipeMapName()); GuiCraftingRecipe.craftinghandlers.add(this); GuiUsageRecipe.usagehandlers.add(this); } } + public List<Recipe_GT> getSortedRecipes() { + List<Recipe_GT> result = new ArrayList<>(this.mRecipeMap.mRecipeList); + Collections.sort(result); + return result; + } + public static void drawText(final int aX, final int aY, final String aString, final int aColor) { Minecraft.getMinecraft().fontRenderer.drawString(aString, aX, aY, aColor); } @Override public TemplateRecipeHandler newInstance() { - return new GT_NEI_FluidReactor(this.mRecipeMap); + return new GT_NEI_FluidReactor(); } @Override public void loadCraftingRecipes(final String outputId, final Object... results) { - if (outputId.equals(this.mRecipeMap.mNEIName)) { - for (final GT_Recipe tRecipe : this.mRecipeMap.mRecipeList) { + if (outputId.equals(getRecipeMapName())) { + for (Recipe_GT tRecipe : getSortedRecipes()) { if (!tRecipe.mHidden) { this.arecipes.add(new CachedDefaultRecipe(tRecipe)); } @@ -80,29 +91,29 @@ extends TemplateRecipeHandler { @Override public void loadCraftingRecipes(final ItemStack aResult) { - final ItemData tPrefixMaterial = GT_OreDictUnificator.getAssociation(aResult); + ItemData tPrefixMaterial = GT_OreDictUnificator.getAssociation(aResult); - final ArrayList<ItemStack> tResults = new ArrayList<ItemStack>(); + ArrayList<ItemStack> tResults = new ArrayList<ItemStack>(); tResults.add(aResult); tResults.add(GT_OreDictUnificator.get(true, aResult)); if ((tPrefixMaterial != null) && (!tPrefixMaterial.mBlackListed) && (!tPrefixMaterial.mPrefix.mFamiliarPrefixes.isEmpty())) { - for (final OrePrefixes tPrefix : tPrefixMaterial.mPrefix.mFamiliarPrefixes) { + for (OrePrefixes tPrefix : tPrefixMaterial.mPrefix.mFamiliarPrefixes) { tResults.add(GT_OreDictUnificator.get(tPrefix, tPrefixMaterial.mMaterial.mMaterial, 1L)); } } - final FluidStack tFluid = GT_Utility.getFluidForFilledItem(aResult, true); + FluidStack tFluid = GT_Utility.getFluidForFilledItem(aResult, true); if (tFluid != null) { tResults.add(GT_Utility.getFluidDisplayStack(tFluid, false)); - for (final FluidContainerRegistry.FluidContainerData tData : FluidContainerRegistry.getRegisteredFluidContainerData()) { + for (FluidContainerRegistry.FluidContainerData tData : FluidContainerRegistry.getRegisteredFluidContainerData()) { if (tData.fluid.isFluidEqual(tFluid)) { tResults.add(GT_Utility.copy(new Object[]{tData.filledContainer})); } } } - for (final GT_Recipe tRecipe : this.mRecipeMap.mRecipeList) { + for (Recipe_GT tRecipe : getSortedRecipes()) { if (!tRecipe.mHidden) { - final CachedDefaultRecipe tNEIRecipe = new CachedDefaultRecipe(tRecipe); - for (final ItemStack tStack : tResults) { + CachedDefaultRecipe tNEIRecipe = new CachedDefaultRecipe(tRecipe); + for (ItemStack tStack : tResults) { if (tNEIRecipe.contains(tNEIRecipe.mOutputs, tStack)) { this.arecipes.add(tNEIRecipe); break; @@ -110,33 +121,33 @@ extends TemplateRecipeHandler { } } } + //CachedDefaultRecipe tNEIRecipe; } - @Override - public void loadUsageRecipes(final ItemStack aInput) { - final ItemData tPrefixMaterial = GT_OreDictUnificator.getAssociation(aInput); + public void loadUsageRecipes(ItemStack aInput) { + ItemData tPrefixMaterial = GT_OreDictUnificator.getAssociation(aInput); - final ArrayList<ItemStack> tInputs = new ArrayList<ItemStack>(); + ArrayList<ItemStack> tInputs = new ArrayList<ItemStack>(); tInputs.add(aInput); tInputs.add(GT_OreDictUnificator.get(false, aInput)); if ((tPrefixMaterial != null) && (!tPrefixMaterial.mPrefix.mFamiliarPrefixes.isEmpty())) { - for (final OrePrefixes tPrefix : tPrefixMaterial.mPrefix.mFamiliarPrefixes) { + for (OrePrefixes tPrefix : tPrefixMaterial.mPrefix.mFamiliarPrefixes) { tInputs.add(GT_OreDictUnificator.get(tPrefix, tPrefixMaterial.mMaterial.mMaterial, 1L)); } } - final FluidStack tFluid = GT_Utility.getFluidForFilledItem(aInput, true); + FluidStack tFluid = GT_Utility.getFluidForFilledItem(aInput, true); if (tFluid != null) { tInputs.add(GT_Utility.getFluidDisplayStack(tFluid, false)); - for (final FluidContainerRegistry.FluidContainerData tData : FluidContainerRegistry.getRegisteredFluidContainerData()) { + for (FluidContainerRegistry.FluidContainerData tData : FluidContainerRegistry.getRegisteredFluidContainerData()) { if (tData.fluid.isFluidEqual(tFluid)) { tInputs.add(GT_Utility.copy(new Object[]{tData.filledContainer})); } } } - for (final GT_Recipe tRecipe : this.mRecipeMap.mRecipeList) { + for (Recipe_GT tRecipe : getSortedRecipes()) { if (!tRecipe.mHidden) { - final CachedDefaultRecipe tNEIRecipe = new CachedDefaultRecipe(tRecipe); - for (final ItemStack tStack : tInputs) { + CachedDefaultRecipe tNEIRecipe = new CachedDefaultRecipe(tRecipe); + for (ItemStack tStack : tInputs) { if (tNEIRecipe.contains(tNEIRecipe.mInputs, tStack)) { this.arecipes.add(tNEIRecipe); break; @@ -144,6 +155,11 @@ extends TemplateRecipeHandler { } } } + //CachedDefaultRecipe tNEIRecipe; + } + + public String getRecipeMapName() { + return this.mRecipeMap.mNEIName; } @Override @@ -195,7 +211,13 @@ extends TemplateRecipeHandler { (tStack.item.stackSize != 0)) { break; } - currenttip.add("Does not get consumed in the process"); + if (ItemUtils.isCatalyst(aStack)) { + currenttip.add("Does not always get consumed in the process"); + currenttip.add("Higher tier pipe casings allow this item to last longer"); + } + else if (ItemUtils.isControlCircuit(aStack)) { + currenttip.add("Does not get consumed in the process"); + } break; } } diff --git a/src/Java/gtPlusPlus/nei/NEI_GT_Config.java b/src/Java/gtPlusPlus/nei/NEI_GT_Config.java index 348b95ecb3..45d406aa96 100644 --- a/src/Java/gtPlusPlus/nei/NEI_GT_Config.java +++ b/src/Java/gtPlusPlus/nei/NEI_GT_Config.java @@ -20,12 +20,12 @@ implements IConfigureNEI { } for (final Gregtech_Recipe_Map tMap : gregtech.api.util.Recipe_GT.Gregtech_Recipe_Map.sMappings) { if (tMap.mNEIAllowed) { - if (!tMap.mUnlocalizedName.equals(Gregtech_Recipe_Map.sFluidChemicalReactorRecipes.mUnlocalizedName)) { + if (!tMap.mUnlocalizedName.equals(Gregtech_Recipe_Map.sChemicalPlantRecipes.mUnlocalizedName)) { new GT_NEI_MultiBlockHandler(tMap); } } } - new GT_NEI_FluidReactor(GregtechMTE_ChemicalPlant.getGeneratedRecipeMap()); + new GT_NEI_FluidReactor(); sIsAdded = true; API.registerRecipeHandler(new DecayableRecipeHandler()); API.registerUsageHandler(new DecayableRecipeHandler()); diff --git a/src/Java/gtPlusPlus/plugin/agrichem/BioRecipes.java b/src/Java/gtPlusPlus/plugin/agrichem/BioRecipes.java index 54e2f55851..541f02cccd 100644 --- a/src/Java/gtPlusPlus/plugin/agrichem/BioRecipes.java +++ b/src/Java/gtPlusPlus/plugin/agrichem/BioRecipes.java @@ -339,7 +339,7 @@ public class BioRecipes { ItemUtils.getSimpleStack(AgriculturalChem.mCompost, 1)); // Plastic - CORE.RA.addFluidReactorRecipe( + CORE.RA.addChemicalPlantRecipe( new ItemStack[] { getBioChip(16), ItemUtils.getSimpleStack(AgriculturalChem.mCellulosePulp, 64), @@ -457,7 +457,7 @@ public class BioRecipes { ItemUtils.getItemStackOfAmountFromOreDict("screwTin", GTNH ? 6 : 3) }, GT_Values.NF, - ItemUtils.getSimpleStack(AgriculturalChem.mCatalystCarrier, 1), + CI.getEmptyCatalyst(1), 300 * 20, 16); } @@ -466,12 +466,12 @@ public class BioRecipes { // Assembly Recipe CORE.RA.addSixSlotAssemblingRecipe(new ItemStack[] { getBioChip(4), - ItemUtils.getSimpleStack(AgriculturalChem.mCatalystCarrier, 10), + CI.getEmptyCatalyst(10), ItemUtils.getItemStackOfAmountFromOreDict("dustAluminium", 4), ItemUtils.getItemStackOfAmountFromOreDict("dustSilver", 4) }, GT_Values.NF, - ItemUtils.getSimpleStack(AgriculturalChem.mGreenCatalyst, 10), + CI.getGreenCatalyst(10), 20 * 20, 30); } @@ -479,7 +479,7 @@ public class BioRecipes { private static void recipeAceticAcid() { /* GT_Values.RA.addMixerRecipe( - ItemUtils.getSimpleStack(AgriculturalChem.mGreenCatalyst, 10), + CI.getGreenCatalyst(10), var2, var3, var4, var5, // Fluid in @@ -489,9 +489,9 @@ public class BioRecipes { var9); // Eu */ - CORE.RA.addFluidReactorRecipe( + CORE.RA.addChemicalPlantRecipe( new ItemStack[] { - ItemUtils.getSimpleStack(AgriculturalChem.mGreenCatalyst, 0) + CI.getGreenCatalyst(0) }, new FluidStack[] { FluidUtils.getFluidStack(BioRecipes.mMethanol, 700), @@ -583,7 +583,7 @@ public class BioRecipes { continue; } if (ItemUtils.checkForInvalidItems(a)) { - CORE.RA.addFluidReactorRecipe( + CORE.RA.addChemicalPlantRecipe( new ItemStack[] { getBioChip(2), ItemUtils.getSimpleStack(a, 10) @@ -605,7 +605,7 @@ public class BioRecipes { } for (ItemStack a : aSeeds) { if (ItemUtils.checkForInvalidItems(a)) { - CORE.RA.addFluidReactorRecipe( + CORE.RA.addChemicalPlantRecipe( new ItemStack[] { getBioChip(3), ItemUtils.getSimpleStack(a, 20) @@ -626,7 +626,7 @@ public class BioRecipes { } // Sugar Cane - CORE.RA.addFluidReactorRecipe( + CORE.RA.addChemicalPlantRecipe( new ItemStack[] { getBioChip(4), ItemUtils.getSimpleStack(Items.reeds, 16) @@ -644,7 +644,7 @@ public class BioRecipes { 30, 1); - CORE.RA.addFluidReactorRecipe( + CORE.RA.addChemicalPlantRecipe( new ItemStack[] { getBioChip(5), ItemUtils.getSimpleStack(Items.reeds, 32), @@ -666,7 +666,7 @@ public class BioRecipes { // Sugar Beet if (OreDictUtils.containsValidEntries("cropSugarbeet")) { - CORE.RA.addFluidReactorRecipe( + CORE.RA.addChemicalPlantRecipe( new ItemStack[] { getBioChip(4), ItemUtils.getItemStackOfAmountFromOreDict("cropSugarbeet", 8), @@ -684,7 +684,7 @@ public class BioRecipes { 30, 1); - CORE.RA.addFluidReactorRecipe( + CORE.RA.addChemicalPlantRecipe( new ItemStack[] { getBioChip(5), ItemUtils.getItemStackOfAmountFromOreDict("cropSugarbeet", 16), @@ -705,7 +705,7 @@ public class BioRecipes { } // Produce Acetone, Butanol and Ethanol - CORE.RA.addFluidReactorRecipe( + CORE.RA.addChemicalPlantRecipe( new ItemStack[] { getBioChip(5), ItemUtils.getItemStackOfAmountFromOreDict("cellFermentationBase", 48), @@ -732,9 +732,9 @@ public class BioRecipes { } private static void recipePropionicAcid() { - CORE.RA.addFluidReactorRecipe( + CORE.RA.addChemicalPlantRecipe( new ItemStack[] { - ItemUtils.getSimpleStack(AgriculturalChem.mGreenCatalyst, 0) + CI.getGreenCatalyst(0) }, new FluidStack[] { FluidUtils.getFluidStack(BioRecipes.mEthylene, 500), @@ -781,7 +781,7 @@ public class BioRecipes { } private static void recipeSodiumHydroxide() { - CORE.RA.addFluidReactorRecipe( + CORE.RA.addChemicalPlantRecipe( new ItemStack[] { getBioChip(4) }, @@ -799,7 +799,7 @@ public class BioRecipes { 120, 1); - CORE.RA.addFluidReactorRecipe( + CORE.RA.addChemicalPlantRecipe( new ItemStack[] { getBioChip(5), ItemUtils.getItemStackOfAmountFromOreDict("dustSodium", 5) @@ -821,7 +821,7 @@ public class BioRecipes { private static void recipeSodiumCarbonate() { if (OreDictUtils.containsValidEntries("fuelCoke")) { - CORE.RA.addFluidReactorRecipe( + CORE.RA.addChemicalPlantRecipe( new ItemStack[] { getBioChip(18), ItemUtils.getItemStackOfAmountFromOreDict("fuelCoke", 3), @@ -844,7 +844,7 @@ public class BioRecipes { } - CORE.RA.addFluidReactorRecipe( + CORE.RA.addChemicalPlantRecipe( new ItemStack[] { getBioChip(18), ItemUtils.getItemStackOfAmountFromOreDict("dustCoal", 6), @@ -938,7 +938,7 @@ public class BioRecipes { } for (String aOreName : aOreNames) { - CORE.RA.addFluidReactorRecipe( + CORE.RA.addChemicalPlantRecipe( new ItemStack[] { CI.getNumberedBioCircuit(14), ItemUtils.getSimpleStack(aOreCache.get(aOreName), aOreData2.get(aOreName)) @@ -1051,7 +1051,7 @@ public class BioRecipes { private static void recipeSulfuricAcid() { - CORE.RA.addFluidReactorRecipe( + CORE.RA.addChemicalPlantRecipe( new ItemStack[] { getBioChip(7), ItemUtils.getSimpleStack(AgriculturalChem.mGoldenBrownCelluloseFiber, 10), @@ -1070,7 +1070,7 @@ public class BioRecipes { 60, 1); - CORE.RA.addFluidReactorRecipe( + CORE.RA.addChemicalPlantRecipe( new ItemStack[] { getBioChip(7), ItemUtils.getSimpleStack(AgriculturalChem.mRedCelluloseFiber, 5), @@ -1094,7 +1094,7 @@ public class BioRecipes { private static void recipeUrea() { - CORE.RA.addFluidReactorRecipe( + CORE.RA.addChemicalPlantRecipe( new ItemStack[] { getBioChip(9), }, @@ -1113,7 +1113,7 @@ public class BioRecipes { 30, 1); - CORE.RA.addFluidReactorRecipe( + CORE.RA.addChemicalPlantRecipe( new ItemStack[] { getBioChip(9), }, @@ -1134,7 +1134,7 @@ public class BioRecipes { private static void recipeRawBioResin() { - CORE.RA.addFluidReactorRecipe( + CORE.RA.addChemicalPlantRecipe( new ItemStack[] { getBioChip(3), ItemUtils.getSimpleStack(AgriculturalChem.mGreenAlgaeBiosmass, 10), @@ -1156,7 +1156,7 @@ public class BioRecipes { private static void recipeLiquidResin() { - CORE.RA.addFluidReactorRecipe( + CORE.RA.addChemicalPlantRecipe( new ItemStack[] { getBioChip(3), ItemUtils.getSimpleStack(AgriculturalChem.mRawBioResin, 1) @@ -1174,7 +1174,7 @@ public class BioRecipes { 30, 1); - CORE.RA.addFluidReactorRecipe( + CORE.RA.addChemicalPlantRecipe( new ItemStack[] { getBioChip(3), ItemUtils.getSimpleStack(AgriculturalChem.mCellulosePulp, 8) @@ -1199,7 +1199,7 @@ public class BioRecipes { ItemStack aFert; if (LoadedMods.Forestry) { aFert = ItemUtils.getSimpleStack(AgriculturalChem.aFertForestry, 2); - CORE.RA.addFluidReactorRecipe( + CORE.RA.addChemicalPlantRecipe( new ItemStack[] { getBioChip(11), ItemUtils.getSimpleStack(AgriculturalChem.mGreenAlgaeBiosmass, 16), @@ -1220,7 +1220,7 @@ public class BioRecipes { } aFert = ItemUtils.getSimpleStack(AgriculturalChem.aFertIC2, 2); - CORE.RA.addFluidReactorRecipe( + CORE.RA.addChemicalPlantRecipe( new ItemStack[] { getBioChip(12), ItemUtils.getSimpleStack(AgriculturalChem.mGreenAlgaeBiosmass, 16), @@ -1243,7 +1243,7 @@ public class BioRecipes { private static void recipeMethane() { - CORE.RA.addFluidReactorRecipe( + CORE.RA.addChemicalPlantRecipe( new ItemStack[] { getBioChip(12), ItemUtils.getSimpleStack(AgriculturalChem.mAlgaeBiosmass, 20) @@ -1261,7 +1261,7 @@ public class BioRecipes { 8, 1); - CORE.RA.addFluidReactorRecipe( + CORE.RA.addChemicalPlantRecipe( new ItemStack[] { getBioChip(13), ItemUtils.getSimpleStack(AgriculturalChem.mCelluloseFiber, 64), @@ -1284,10 +1284,10 @@ public class BioRecipes { private static void recipeBenzene() { - CORE.RA.addFluidReactorRecipe( + CORE.RA.addChemicalPlantRecipe( new ItemStack[] { getBioChip(19), - ItemUtils.getSimpleStack(AgriculturalChem.mGreenCatalyst, 0), + CI.getGreenCatalyst(0), }, new FluidStack[] { FluidUtils.getFluidStack(BioRecipes.mMethane, 1000), @@ -1304,10 +1304,10 @@ public class BioRecipes { private static void recipeStyrene() { - CORE.RA.addFluidReactorRecipe( + CORE.RA.addChemicalPlantRecipe( new ItemStack[] { getBioChip(20), - ItemUtils.getSimpleStack(AgriculturalChem.mGreenCatalyst, 0), + CI.getGreenCatalyst(0), }, new FluidStack[] { FluidUtils.getFluidStack(BioRecipes.mEthylbenzene, 100), diff --git a/src/Java/gtPlusPlus/xmod/cofh/HANDLER_COFH.java b/src/Java/gtPlusPlus/xmod/cofh/HANDLER_COFH.java new file mode 100644 index 0000000000..7bce4ab173 --- /dev/null +++ b/src/Java/gtPlusPlus/xmod/cofh/HANDLER_COFH.java @@ -0,0 +1,15 @@ +package gtPlusPlus.xmod.cofh; + +import gtPlusPlus.core.item.ModItems; +import gtPlusPlus.core.item.general.RF2EU_Battery; +import gtPlusPlus.core.lib.LoadedMods; + +public class HANDLER_COFH { + + public static void initItems() { + if (LoadedMods.CoFHCore && (LoadedMods.IndustrialCraft2 || LoadedMods.IndustrialCraft2Classic)) { + ModItems.RfEuBattery = new RF2EU_Battery(); + } + } + +} diff --git a/src/Java/gtPlusPlus/xmod/gregtech/api/enums/GregtechItemList.java b/src/Java/gtPlusPlus/xmod/gregtech/api/enums/GregtechItemList.java index 28692e25cb..cd4b0947e4 100644 --- a/src/Java/gtPlusPlus/xmod/gregtech/api/enums/GregtechItemList.java +++ b/src/Java/gtPlusPlus/xmod/gregtech/api/enums/GregtechItemList.java @@ -39,6 +39,13 @@ public enum GregtechItemList implements GregtechItemContainer { Emitter_ULV, Sensor_ULV, + // Mixed Components + TransmissionComponent_ULV, TransmissionComponent_LV, + TransmissionComponent_MV, TransmissionComponent_HV, + TransmissionComponent_EV, TransmissionComponent_IV, + TransmissionComponent_LuV, TransmissionComponent_ZPM, + TransmissionComponent_UV, TransmissionComponent_MAX, + //Recipe Circuit Circuit_BioRecipeSelector, @@ -148,6 +155,9 @@ public enum GregtechItemList implements GregtechItemContainer { Industrial_Centrifuge, Casing_Centrifuge1, + // Large Alloy Smelter + Industrial_AlloySmelter, + //Coke Oven Industrial_CokeOven, Casing_CokeOven, @@ -517,6 +527,8 @@ public enum GregtechItemList implements GregtechItemContainer { //512v Creative Buffer Energy_Buffer_CREATIVE, + //Variable voltage RF convertor + Energy_Buffer_RF_Convertor, //Energy Buffers Energy_Buffer_1by1_ULV, Energy_Buffer_1by1_LV, Energy_Buffer_1by1_MV, Energy_Buffer_1by1_HV, @@ -625,7 +637,9 @@ public enum GregtechItemList implements GregtechItemContainer { FakeMachineCasingPlate_MV, FakeMachineCasingPlate_HV, FakeMachineCasingPlate_EV, FakeMachineCasingPlate_IV, FakeMachineCasingPlate_LuV, FakeMachineCasingPlate_ZPM, - FakeMachineCasingPlate_UV, FakeMachineCasingPlate_MAX, + FakeMachineCasingPlate_UV, FakeMachineCasingPlate_MAX, + + //---------------------------------------------------------------------------- diff --git a/src/Java/gtPlusPlus/xmod/gregtech/api/interfaces/internal/IGregtech_RecipeAdder.java b/src/Java/gtPlusPlus/xmod/gregtech/api/interfaces/internal/IGregtech_RecipeAdder.java index 83f052a983..cb889e0233 100644 --- a/src/Java/gtPlusPlus/xmod/gregtech/api/interfaces/internal/IGregtech_RecipeAdder.java +++ b/src/Java/gtPlusPlus/xmod/gregtech/api/interfaces/internal/IGregtech_RecipeAdder.java @@ -271,7 +271,7 @@ public interface IGregtech_RecipeAdder { public boolean addUvLaserRecipe(ItemStack aInput1, ItemStack aInput2, ItemStack aOutput, int time, long eu); public boolean addIrLaserRecipe(ItemStack aInput1, ItemStack aInput2, ItemStack aOutput, int time, long eu); - public boolean addFluidReactorRecipe(ItemStack[] aInputs, FluidStack[] aInputFluids, ItemStack[] aOutputs, FluidStack[] aFluidOutputs, int time, long eu, int aTier); + public boolean addChemicalPlantRecipe(ItemStack[] aInputs, FluidStack[] aInputFluids, ItemStack[] aOutputs, FluidStack[] aFluidOutputs, int time, long eu, int aTier); public boolean addBlastRecipe(ItemStack[] aInputs, FluidStack[] aInputFluids, ItemStack[] aOutputs, FluidStack[] aFluidOutputs, int time, long eu, int aHeat); diff --git a/src/Java/gtPlusPlus/xmod/gregtech/api/items/Gregtech_MetaItem_X32.java b/src/Java/gtPlusPlus/xmod/gregtech/api/items/Gregtech_MetaItem_X32.java index ef92f9919d..a5430846a9 100644 --- a/src/Java/gtPlusPlus/xmod/gregtech/api/items/Gregtech_MetaItem_X32.java +++ b/src/Java/gtPlusPlus/xmod/gregtech/api/items/Gregtech_MetaItem_X32.java @@ -192,22 +192,9 @@ public abstract class Gregtech_MetaItem_X32 extends Gregtech_MetaItem { @Override public int getColorFromItemStack(final ItemStack stack, int HEX_OxFFFFFF) { - 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 if (stack.getDisplayName().contains("Sodium")){ + + int aMeta = stack.getItemDamage(); + if (stack.getDisplayName().contains("Sodium")){ HEX_OxFFFFFF = Utils.rgbtoHexValue(90, 90, 255); } else if (stack.getDisplayName().contains("Cadmium")){ @@ -228,8 +215,28 @@ public abstract class Gregtech_MetaItem_X32 extends Gregtech_MetaItem { else if (stack.getDisplayName().contains("Invar")){ HEX_OxFFFFFF = Utils.rgbtoHexValue(180, 180, 120); } - else { - HEX_OxFFFFFF = 0xffffff; + 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/src/Java/gtPlusPlus/xmod/gregtech/api/metatileentity/implementations/base/GregtechMeta_MultiBlockBase.java b/src/Java/gtPlusPlus/xmod/gregtech/api/metatileentity/implementations/base/GregtechMeta_MultiBlockBase.java index e1849985d0..ef5429af62 100644 --- a/src/Java/gtPlusPlus/xmod/gregtech/api/metatileentity/implementations/base/GregtechMeta_MultiBlockBase.java +++ b/src/Java/gtPlusPlus/xmod/gregtech/api/metatileentity/implementations/base/GregtechMeta_MultiBlockBase.java @@ -415,7 +415,8 @@ public abstract class GregtechMeta_MultiBlockBase extends GT_MetaTileEntity_Mult aToolTip = ArrayUtils.addAll(aToolTip, x); aToolTip = ArrayUtils.addAll(aToolTip, z); - if (aCachedToolTip == null || aCachedToolTip.length <= 0) { + //Valid Cached Tooltip during Run-Time + if (aCachedToolTip == null || aCachedToolTip.length <= 0 || aCachedToolTip.length != aToolTip.length || this.mTotalRunTime % 100 == 0) { aCachedToolTip = aToolTip; } return aCachedToolTip; @@ -2581,7 +2582,7 @@ public abstract class GregtechMeta_MultiBlockBase extends GT_MetaTileEntity_Mult else if (aFoundBlock != aExpectedBlock) { if (GTplusplus.CURRENT_LOAD_PHASE == INIT_PHASE.STARTED) { log("A1 - Found: "+aFoundBlock.getLocalizedName()+":"+aFoundMeta+", Expected: "+aExpectedBlock.getLocalizedName()+":"+aExpectedMeta); - log("Loc: "+(new BlockPos(aBaseMetaTileEntity).getLocationString())); + //log("Loc: "+(new BlockPos(aBaseMetaTileEntity).getLocationString())); } return false; } diff --git a/src/Java/gtPlusPlus/xmod/gregtech/common/Meta_GT_Proxy.java b/src/Java/gtPlusPlus/xmod/gregtech/common/Meta_GT_Proxy.java index 430ae44d64..ef013fa3a2 100644 --- a/src/Java/gtPlusPlus/xmod/gregtech/common/Meta_GT_Proxy.java +++ b/src/Java/gtPlusPlus/xmod/gregtech/common/Meta_GT_Proxy.java @@ -1,16 +1,11 @@ package gtPlusPlus.xmod.gregtech.common; -import static gtPlusPlus.xmod.gregtech.common.covers.GTPP_Cover_Overflow.mOverflowCache; - import java.lang.reflect.Constructor; import java.lang.reflect.InvocationTargetException; import java.util.ArrayList; -import java.util.HashMap; import java.util.LinkedHashMap; import java.util.List; import java.util.Map; -import java.util.Timer; -import java.util.TimerTask; import cpw.mods.fml.common.registry.GameRegistry; import cpw.mods.fml.common.registry.LanguageRegistry; @@ -29,7 +24,6 @@ import gregtech.api.util.Recipe_GT; import gregtech.common.GT_Proxy; import gtPlusPlus.api.objects.Logger; import gtPlusPlus.api.objects.data.AutoMap; -import gtPlusPlus.api.objects.data.ObjMap; import gtPlusPlus.api.objects.minecraft.FormattedTooltipString; import gtPlusPlus.core.handler.AchievementHandler; import gtPlusPlus.core.lib.CORE; @@ -117,7 +111,6 @@ public class Meta_GT_Proxy { } public static void init() { - scheduleCoverMapCleaner(); setValidHeatingCoilMetas(); PollutionUtils.setPollutionFluids(); fixIC2FluidNames(); @@ -435,47 +428,6 @@ public class Meta_GT_Proxy { } } - - public static void scheduleCoverMapCleaner(){ - TimerTask repeatedTask = new TimerTask() { - public void run() { - cleanupOverFlowCoverCache(); - } - }; - Timer timer = new Timer("CoverCleanupManager"); - long delay = 120000L; - long period = 300000L; - timer.scheduleAtFixedRate(repeatedTask, delay, period); - } - - public static int cleanupOverFlowCoverCache() { - ObjMap<String, ?> cache = mOverflowCache; - int aRemoved = 0; - long aCurrentTime = System.currentTimeMillis()/1000; - for (Object o : cache.values()) { - if (o != null && o instanceof HashMap) { - @SuppressWarnings("unchecked") - HashMap<String, Object> m = (HashMap<String, Object>) o; - if (m != null) { - String s = (String) m.get("aCoverKey"); - if (m.containsKey("aLastUpdatedTime")) { - long mapTime = (long) m.get("mLastUpdatedTime"); - if ((aCurrentTime-(mapTime/1000) > 30)){ - mOverflowCache.remove(s); - aRemoved++; - } - } - else { - mOverflowCache.remove(s); - aRemoved++; - } - } - } - } - return aRemoved; - } - - static GT_Proxy[] mProxies = new GT_Proxy[2]; /** diff --git a/src/Java/gtPlusPlus/xmod/gregtech/common/StaticFields59.java b/src/Java/gtPlusPlus/xmod/gregtech/common/StaticFields59.java index 814ed589f0..74e269e932 100644 --- a/src/Java/gtPlusPlus/xmod/gregtech/common/StaticFields59.java +++ b/src/Java/gtPlusPlus/xmod/gregtech/common/StaticFields59.java @@ -238,44 +238,51 @@ public class StaticFields59 { return null; } - public static int getHeatingCapacityForCoil(Block aBlock, int aMeta) { + + + public static int getTierForCoil(Block aBlock, int aMeta) { if (aBlock == GregTech_API.sBlockCasings1 && (aMeta >= 12 && aMeta <= 14)) { - return getHeatingCapacityForCoilTier(aMeta == 12 ? 1 : aMeta == 13 ? 2 : 3); + return aMeta == 12 ? 1 : aMeta == 13 ? 2 : 3; } else if (aBlock == getBlockCasings5() && (aMeta >= 0 && aMeta <= 8)) { - return getHeatingCapacityForCoilTier(aMeta); + return aMeta; } return 0; } + public static int getHeatingCapacityForCoil(Block aBlock, int aMeta) { + int aTier = getTierForCoil(aBlock, aMeta); + return aTier > 0 ? getHeatingCapacityForCoilTier(aTier) : 0; + } + public static int getHeatingCapacityForCoilTier(int aCoilTier) { int mHeatingCapacity = 0; switch (aCoilTier) { - case 0: + case 1: mHeatingCapacity = 1800; break; - case 1: + case 2: mHeatingCapacity = 2700; break; - case 2: + case 3: mHeatingCapacity = 3600; break; - case 3: + case 4: mHeatingCapacity = 4500; break; - case 4: + case 5: mHeatingCapacity = 5400; break; - case 5: + case 6: mHeatingCapacity = 7200; break; - case 6: + case 7: mHeatingCapacity = 9000; break; - case 7: + case 8: mHeatingCapacity = 9900; break; - case 8: + case 9: mHeatingCapacity = 10800; break; default: @@ -285,7 +292,6 @@ public class StaticFields59 { if (CORE.GTNH && aCoilTier <= 6) { mHeatingCapacity += 1; } - return mHeatingCapacity; } diff --git a/src/Java/gtPlusPlus/xmod/gregtech/common/covers/GTPP_Cover_Overflow.java b/src/Java/gtPlusPlus/xmod/gregtech/common/covers/GTPP_Cover_Overflow.java index b220dd74e8..1c1f9c20f9 100644 --- a/src/Java/gtPlusPlus/xmod/gregtech/common/covers/GTPP_Cover_Overflow.java +++ b/src/Java/gtPlusPlus/xmod/gregtech/common/covers/GTPP_Cover_Overflow.java @@ -1,13 +1,9 @@ package gtPlusPlus.xmod.gregtech.common.covers; -import java.util.HashMap; - import gregtech.api.interfaces.tileentity.ICoverable; -import gregtech.api.interfaces.tileentity.IMachineProgress; import gregtech.api.util.GT_CoverBehavior; import gregtech.api.util.GT_Utility; -import gtPlusPlus.api.objects.Logger; -import gtPlusPlus.api.objects.data.ObjMap; +import gtPlusPlus.core.util.minecraft.LangUtils; import net.minecraft.entity.player.EntityPlayer; import net.minecraftforge.common.util.ForgeDirection; import net.minecraftforge.fluids.Fluid; @@ -15,123 +11,90 @@ import net.minecraftforge.fluids.FluidStack; import net.minecraftforge.fluids.IFluidHandler; public class GTPP_Cover_Overflow extends GT_CoverBehavior { + + public final int mTransferRate; + public final int mInitialTransferRate; public final int mMaxTransferRate; - - public static final ObjMap<String, HashMap<String, Object>> mOverflowCache = new ObjMap<String, HashMap<String, Object>>(10000, 0.5f); public GTPP_Cover_Overflow(int aTransferRate) { - this.mMaxTransferRate = aTransferRate*1000; + this.mTransferRate = aTransferRate * 1000 / 10; + this.mInitialTransferRate = aTransferRate; + this.mMaxTransferRate = aTransferRate * 1000; } public int doCoverThings(byte aSide, byte aInputRedstone, int aCoverID, int aCoverVariable, ICoverable aTileEntity, long aTimer) { - - HashMap<String, Object> aCoverData = getCover(aSide, aCoverID, aCoverVariable, aTileEntity); - //Do things - - if (aCoverData != null) { - if (aCoverData.containsKey("aCoverVariable")) - return (int) aCoverData.get("aCoverVariable"); - } - - - if (aCoverVariable % 6 > 1 && aTileEntity instanceof IMachineProgress - && ((IMachineProgress) aTileEntity).isAllowedToWork() != aCoverVariable % 6 < 4) { + if (aCoverVariable == 0) { return aCoverVariable; - } else { - if (aTileEntity instanceof IFluidHandler) { - IFluidHandler tTank2 = aTileEntity.getITankContainerAtSide(aSide); - if (tTank2 != null) { - IFluidHandler tTank1 = (IFluidHandler) aTileEntity; - FluidStack tLiquid; - if (aCoverVariable % 2 == 0) { - tLiquid = tTank1.drain(ForgeDirection.getOrientation(aSide), this.mMaxTransferRate, false); - if (tLiquid != null) { - tLiquid = tLiquid.copy(); - tLiquid.amount = tTank2.fill(ForgeDirection.getOrientation(aSide).getOpposite(), tLiquid, - false); - if (tLiquid.amount > 0) { - if ((aCoverVariable % 2 == 0 || aSide != 1) && (aCoverVariable % 2 != 0 || aSide != 0) - && aTileEntity.getUniversalEnergyCapacity() >= (long) Math.min(1, - tLiquid.amount / 10)) { - if (aTileEntity.isUniversalEnergyStored((long) Math.min(1, tLiquid.amount / 10))) { - aTileEntity.decreaseStoredEnergyUnits((long) Math.min(1, tLiquid.amount / 10), - true); - tTank2.fill(ForgeDirection.getOrientation(aSide).getOpposite(), tTank1.drain( - ForgeDirection.getOrientation(aSide), tLiquid.amount, true), true); - } - } else { - tTank2.fill(ForgeDirection.getOrientation(aSide).getOpposite(), - tTank1.drain(ForgeDirection.getOrientation(aSide), tLiquid.amount, true), - true); - } - } - } - } else { - tLiquid = tTank2.drain(ForgeDirection.getOrientation(aSide).getOpposite(), this.mMaxTransferRate, - false); - if (tLiquid != null) { - tLiquid = tLiquid.copy(); - tLiquid.amount = tTank1.fill(ForgeDirection.getOrientation(aSide), tLiquid, false); - if (tLiquid.amount > 0) { - if ((aCoverVariable % 2 == 0 || aSide != 1) && (aCoverVariable % 2 != 0 || aSide != 0) - && aTileEntity.getUniversalEnergyCapacity() >= (long) Math.min(1, - tLiquid.amount / 10)) { - if (aTileEntity.isUniversalEnergyStored((long) Math.min(1, tLiquid.amount / 10))) { - aTileEntity.decreaseStoredEnergyUnits((long) Math.min(1, tLiquid.amount / 10), - true); - tTank1.fill(ForgeDirection.getOrientation(aSide), - tTank2.drain(ForgeDirection.getOrientation(aSide).getOpposite(), - tLiquid.amount, true), - true); - } - } else { - tTank1.fill(ForgeDirection.getOrientation(aSide), - tTank2.drain(ForgeDirection.getOrientation(aSide).getOpposite(), - tLiquid.amount, true), - true); - } + } + if ((aTileEntity instanceof IFluidHandler)) { + //Logger.INFO("Trying to Void via Overflow."); + IFluidHandler tTank1; + ForgeDirection directionFrom; + directionFrom = ForgeDirection.UNKNOWN; + tTank1 = (IFluidHandler) aTileEntity; + if (tTank1 != null) { + //Logger.INFO("Found Self. "+aSide); + //FluidStack aTankStack = tTank1.drain(ForgeDirection.UNKNOWN, 1, false); + 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; } + return aCoverVariable; } public int onCoverScrewdriverclick(byte aSide, int aCoverID, int aCoverVariable, ICoverable aTileEntity, EntityPlayer aPlayer, float aX, float aY, float aZ) { - - - if ((double) aX > 0.375D && (double) aX < 0.625D || aSide <= 3 || (double) aY > 0.375D && (double) aY < 0.625D - || (double) aZ <= 0.375D || (double) aZ >= 0.625D) { - HashMap<String, Object> aCoverData = getCover(aSide, aCoverID, aCoverVariable, aTileEntity); - float[] tCoords = GT_Utility.getClickedFacingCoords(aSide, aX, aY, aZ); - switch ((byte) ((byte) ((int) (tCoords[0] * 2.0F)) + 2 * (byte) ((int) (tCoords[1] * 2.0F)))) { - case 0 : - aCoverVariable -= 1000; - break; - case 1 : - aCoverVariable += 1000; - break; - case 2 : - aCoverVariable -= 32000; - break; - case 3 : - aCoverVariable += 32000; - } - aCoverData.remove("aCoverVariable"); - aCoverData.put("aCoverVariable", aCoverVariable); - updateCoverMap(aCoverData); - + if (GT_Utility.getClickedFacingCoords(aSide, aX, aY, aZ)[0] >= 0.5F) { + aCoverVariable += aPlayer.isSneaking() ? 4096 : 1024; + } else { + aCoverVariable -= aPlayer.isSneaking() ? 4096 : 1024; } - GT_Utility.sendChatToPlayer(aPlayer, "Overflow Limit: " + aCoverVariable); - + if (aCoverVariable > mMaxTransferRate) { + aCoverVariable = mInitialTransferRate; + } + if (aCoverVariable <= 0) { + aCoverVariable = mInitialTransferRate; + } + GT_Utility.sendChatToPlayer(aPlayer, LangUtils.trans("009", "Overflow point: ") + aCoverVariable + trans("010", "L")); return aCoverVariable; } + public boolean onCoverRightclick(byte aSide, 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(aSide, aX, aY, aZ)[0] >= 0.5F) { + aCoverVariable += aAmount; + } else { + aCoverVariable -= aAmount; + } + if (aCoverVariable > mMaxTransferRate) { + aCoverVariable = mInitialTransferRate; + } + if (aCoverVariable <= 0) { + aCoverVariable = mInitialTransferRate; + } + GT_Utility.sendChatToPlayer(aPlayer, LangUtils.trans("009", "Overflow point: ") + aCoverVariable + trans("010", "L")); + aTileEntity.setCoverDataAtSide(aSide, aCoverVariable); + return true; + } + public boolean letsRedstoneGoIn(byte aSide, int aCoverID, int aCoverVariable, ICoverable aTileEntity) { return true; } @@ -157,17 +120,11 @@ public class GTPP_Cover_Overflow extends GT_CoverBehavior { } public boolean letsFluidIn(byte aSide, int aCoverID, int aCoverVariable, Fluid aFluid, ICoverable aTileEntity) { - return aCoverVariable > 1 && aTileEntity instanceof IMachineProgress - && ((IMachineProgress) aTileEntity).isAllowedToWork() != aCoverVariable % 6 < 4 - ? false - : aCoverVariable >= 6 || aCoverVariable % 2 != 0; + return false; } public boolean letsFluidOut(byte aSide, int aCoverID, int aCoverVariable, Fluid aFluid, ICoverable aTileEntity) { - return aCoverVariable > 1 && aTileEntity instanceof IMachineProgress - && ((IMachineProgress) aTileEntity).isAllowedToWork() != aCoverVariable % 6 < 4 - ? false - : aCoverVariable >= 6 || aCoverVariable % 2 == 0; + return true; } public boolean alwaysLookConnected(byte aSide, int aCoverID, int aCoverVariable, ICoverable aTileEntity) { @@ -175,39 +132,6 @@ public class GTPP_Cover_Overflow extends GT_CoverBehavior { } public int getTickRate(byte aSide, int aCoverID, int aCoverVariable, ICoverable aTileEntity) { - return 1; - } - - public HashMap<String, Object> getCover(byte aSide, int aCoverID, int aCoverVariable, ICoverable aTileEntity){ - //Map this cover - String aTileDataKey = "|"+aTileEntity.getXCoord()+"|"+aTileEntity.getYCoord()+"|"+aTileEntity.getZCoord()+"|"+aTileEntity.getWorld().provider.dimensionId+"|"+aSide+"|"; - HashMap<String, Object> aTileData; - long aCurrentTime = System.currentTimeMillis(); - if (mOverflowCache.get(aTileDataKey) != null) { - aTileData = mOverflowCache.get(aTileDataKey); - aTileData.remove("aLastUpdatedTime"); - aTileData.put("aLastUpdateTime", aCurrentTime); - //Logger.INFO("Found Existing Cover in Cache."); - } - else { - aTileData = new HashMap<String, Object>(); - aTileData.put("aCoverKey", aTileDataKey); - aTileData.put("aSide", aSide); - aTileData.put("aCoverID", aCoverID); - aTileData.put("aCoverVariable", aCoverVariable); - aTileData.put("aLastUpdateTime", aCurrentTime); - mOverflowCache.put(aTileDataKey, aTileData); - Logger.INFO("Adding new Cover to Cache. Storing under key: "+aTileDataKey); - } - return aTileData; - } - - public void updateCoverMap(HashMap<String, Object> aCoverData) { - String mAccessKey = (String) aCoverData.get("aCoverKey"); - if (mOverflowCache.get(mAccessKey) != null) { - mOverflowCache.remove(mAccessKey); - } - mOverflowCache.put(mAccessKey, aCoverData); - return; + return 5; } -}
\ No newline at end of file +} diff --git a/src/Java/gtPlusPlus/xmod/gregtech/common/covers/GTPP_Cover_Overflow2.java b/src/Java/gtPlusPlus/xmod/gregtech/common/covers/GTPP_Cover_Overflow2.java deleted file mode 100644 index 8a378cf6ad..0000000000 --- a/src/Java/gtPlusPlus/xmod/gregtech/common/covers/GTPP_Cover_Overflow2.java +++ /dev/null @@ -1,131 +0,0 @@ -package gtPlusPlus.xmod.gregtech.common.covers; - -import gregtech.api.interfaces.tileentity.ICoverable; -import gregtech.api.util.GT_CoverBehavior; -import gregtech.api.util.GT_Utility; -import gtPlusPlus.core.util.minecraft.LangUtils; -import gtPlusPlus.core.util.sys.KeyboardUtils; -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; - -public class GTPP_Cover_Overflow2 extends GT_CoverBehavior { - - public final int mTransferRate; - public final int mInitialTransferRate; - public final int mMaxTransferRate; - - public GTPP_Cover_Overflow2(int aTransferRate) { - this.mTransferRate = aTransferRate * 1000 / 10; - this.mInitialTransferRate = aTransferRate; - this.mMaxTransferRate = aTransferRate * 1000; - } - - public int doCoverThings(byte aSide, byte aInputRedstone, int aCoverID, int aCoverVariable, ICoverable aTileEntity, - long aTimer) { - if (aCoverVariable == 0) { - return aCoverVariable; - } - if ((aTileEntity instanceof IFluidHandler)) { - IFluidHandler tTank1; - ForgeDirection directionFrom; - directionFrom = ForgeDirection.UNKNOWN; - if (aCoverVariable > 0) { - tTank1 = (IFluidHandler) aTileEntity; - } else { - tTank1 = aTileEntity.getITankContainerAtSide(aSide); - } - if (tTank1 != null) { - FluidStack aTankStack = tTank1.drain(ForgeDirection.UNKNOWN, 0, false); - if (aTankStack != null) { - if (aTankStack.amount > aCoverVariable) { - int aAmountToDrain = aTankStack.amount - aCoverVariable; - if (aAmountToDrain > 0) { - FluidStack tLiquid = tTank1.drain(directionFrom, Math.abs(aAmountToDrain), false); - } - } - } - } - } - return aCoverVariable; - } - - public int onCoverScrewdriverclick(byte aSide, int aCoverID, int aCoverVariable, ICoverable aTileEntity, - EntityPlayer aPlayer, float aX, float aY, float aZ) { - if (GT_Utility.getClickedFacingCoords(aSide, aX, aY, aZ)[0] >= 0.5F) { - aCoverVariable += aPlayer.isSneaking() ? 4096 : 1024; - } else { - aCoverVariable -= aPlayer.isSneaking() ? 4096 : 1024; - } - if (aCoverVariable > mMaxTransferRate) { - aCoverVariable = mInitialTransferRate; - } - if (aCoverVariable <= 0) { - aCoverVariable = mInitialTransferRate; - } - GT_Utility.sendChatToPlayer(aPlayer, LangUtils.trans("009", "Overflow point: ") + aCoverVariable + trans("010", "L/5T")); - return aCoverVariable; - } - - public boolean onCoverRightclick(byte aSide, 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(aSide, aX, aY, aZ)[0] >= 0.5F) { - aCoverVariable += aAmount; - } else { - aCoverVariable -= aAmount; - } - if (aCoverVariable > mMaxTransferRate) { - aCoverVariable = mInitialTransferRate; - } - if (aCoverVariable <= 0) { - aCoverVariable = mInitialTransferRate; - } - GT_Utility.sendChatToPlayer(aPlayer, LangUtils.trans("009", "Overflow point: ") + aCoverVariable + trans("010", "L/5T")); - aTileEntity.setCoverDataAtSide(aSide, aCoverVariable); - return true; - } - - public boolean letsRedstoneGoIn(byte aSide, int aCoverID, int aCoverVariable, ICoverable aTileEntity) { - return true; - } - - public boolean letsRedstoneGoOut(byte aSide, int aCoverID, int aCoverVariable, ICoverable aTileEntity) { - return true; - } - - public boolean letsEnergyIn(byte aSide, int aCoverID, int aCoverVariable, ICoverable aTileEntity) { - return true; - } - - public boolean letsEnergyOut(byte aSide, int aCoverID, int aCoverVariable, ICoverable aTileEntity) { - return true; - } - - public boolean letsItemsIn(byte aSide, int aCoverID, int aCoverVariable, int aSlot, ICoverable aTileEntity) { - return true; - } - - public boolean letsItemsOut(byte aSide, int aCoverID, int aCoverVariable, int aSlot, ICoverable aTileEntity) { - return true; - } - - public boolean letsFluidIn(byte aSide, int aCoverID, int aCoverVariable, Fluid aFluid, ICoverable aTileEntity) { - return false; - } - - public boolean letsFluidOut(byte aSide, int aCoverID, int aCoverVariable, Fluid aFluid, ICoverable aTileEntity) { - return true; - } - - public boolean alwaysLookConnected(byte aSide, int aCoverID, int aCoverVariable, ICoverable aTileEntity) { - return true; - } - - public int getTickRate(byte aSide, int aCoverID, int aCoverVariable, ICoverable aTileEntity) { - return 5; - } -} diff --git a/src/Java/gtPlusPlus/xmod/gregtech/common/items/MetaGeneratedGregtechItems.java b/src/Java/gtPlusPlus/xmod/gregtech/common/items/MetaGeneratedGregtechItems.java index 97621203cd..5d4cf5ea94 100644 --- a/src/Java/gtPlusPlus/xmod/gregtech/common/items/MetaGeneratedGregtechItems.java +++ b/src/Java/gtPlusPlus/xmod/gregtech/common/items/MetaGeneratedGregtechItems.java @@ -2,20 +2,26 @@ package gtPlusPlus.xmod.gregtech.common.items; import static gtPlusPlus.core.util.Utils.getTcAspectStack; -import net.minecraft.item.EnumAction; -import net.minecraft.item.ItemStack; - import gregtech.api.GregTech_API; -import gregtech.api.enums.*; +import gregtech.api.enums.GT_Values; +import gregtech.api.enums.Materials; +import gregtech.api.enums.OrePrefixes; +import gregtech.api.enums.SubTag; +import gregtech.api.enums.TC_Aspects; +import gregtech.api.enums.Textures; import gregtech.api.interfaces.ITexture; -import gregtech.api.objects.*; -import gregtech.api.util.*; +import gregtech.api.objects.GT_MultiTexture; +import gregtech.api.objects.GT_RenderedTexture; +import gregtech.api.objects.ItemData; +import gregtech.api.objects.MaterialStack; +import gregtech.api.util.GT_FoodStat; +import gregtech.api.util.GT_ModHandler; +import gregtech.api.util.Recipe_GT; import gregtech.common.covers.GT_Cover_Arm; import gregtech.common.covers.GT_Cover_Conveyor; import gregtech.common.covers.GT_Cover_Pump; import gregtech.common.items.behaviors.Behaviour_DataOrb; import gregtech.common.items.behaviors.Behaviour_DataStick; - import gtPlusPlus.api.objects.Logger; import gtPlusPlus.core.handler.OldCircuitHandler; import gtPlusPlus.core.lib.CORE; @@ -29,8 +35,9 @@ import gtPlusPlus.xmod.gregtech.api.enums.GregtechOrePrefixes.GT_Materials; 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; -import gtPlusPlus.xmod.gregtech.common.covers.GTPP_Cover_Overflow2; import gtPlusPlus.xmod.gregtech.common.covers.GTPP_Cover_ToggleVisual; +import net.minecraft.item.EnumAction; +import net.minecraft.item.ItemStack; public class MetaGeneratedGregtechItems extends Gregtech_MetaItem_X32 { @@ -263,12 +270,12 @@ public class MetaGeneratedGregtechItems extends Gregtech_MetaItem_X32 { GregtechItemList.Cover_Overflow_EV.set(this.addItem(75, "Overflow Valve (EV)", "Maximum void amount: 32768000", new Object[]{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: 262144000", new Object[]{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_ULV.get(1L), new GT_MultiTexture(new ITexture[]{Textures.BlockIcons.MACHINE_CASINGS[4][0], new GT_RenderedTexture(TexturesGtBlock.Overlay_Overflow_Valve)}), new GTPP_Cover_Overflow2(8)); - GregTech_API.registerCover(GregtechItemList.Cover_Overflow_LV.get(1L), new GT_MultiTexture(new ITexture[]{Textures.BlockIcons.MACHINE_CASINGS[4][0], new GT_RenderedTexture(TexturesGtBlock.Overlay_Overflow_Valve)}), new GTPP_Cover_Overflow2(64)); - GregTech_API.registerCover(GregtechItemList.Cover_Overflow_MV.get(1L), new GT_MultiTexture(new ITexture[]{Textures.BlockIcons.MACHINE_CASINGS[5][0], new GT_RenderedTexture(TexturesGtBlock.Overlay_Overflow_Valve)}), new GTPP_Cover_Overflow2(512)); - GregTech_API.registerCover(GregtechItemList.Cover_Overflow_HV.get(1L), new GT_MultiTexture(new ITexture[]{Textures.BlockIcons.MACHINE_CASINGS[5][0], new GT_RenderedTexture(TexturesGtBlock.Overlay_Overflow_Valve)}), new GTPP_Cover_Overflow2(4096)); - GregTech_API.registerCover(GregtechItemList.Cover_Overflow_EV.get(1L), new GT_MultiTexture(new ITexture[]{Textures.BlockIcons.MACHINE_CASINGS[8][0], new GT_RenderedTexture(TexturesGtBlock.Overlay_Overflow_Valve)}), new GTPP_Cover_Overflow2(32768)); - GregTech_API.registerCover(GregtechItemList.Cover_Overflow_IV.get(1L), new GT_MultiTexture(new ITexture[]{Textures.BlockIcons.MACHINE_CASINGS[8][0], new GT_RenderedTexture(TexturesGtBlock.Overlay_Overflow_Valve)}), new GTPP_Cover_Overflow2(262144)); + GregTech_API.registerCover(GregtechItemList.Cover_Overflow_ULV.get(1L), new GT_MultiTexture(new ITexture[]{Textures.BlockIcons.MACHINE_CASINGS[4][0], new GT_RenderedTexture(TexturesGtBlock.Overlay_Overflow_Valve)}), new GTPP_Cover_Overflow(8)); + GregTech_API.registerCover(GregtechItemList.Cover_Overflow_LV.get(1L), new GT_MultiTexture(new ITexture[]{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(new ITexture[]{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(new ITexture[]{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(new ITexture[]{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(new ITexture[]{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)")); @@ -339,7 +346,23 @@ public class MetaGeneratedGregtechItems extends Gregtech_MetaItem_X32 { } } GregtechItemList.Laser_Lens_WoodsGlass.set(this.addItem(140, "Wood's Glass Lens", "Allows UV & IF to pass through, blocks visible light spectrums")); - + + int aStartID = 141; + GregtechItemList[] aTransParts = new GregtechItemList[] { + GregtechItemList.TransmissionComponent_ULV, + 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_MAX, + }; + for (int aIndex=0;aIndex<10;aIndex++){ + aTransParts[aIndex].set(this.addItem(aStartID++, "Transmission Component ("+GT_Values.VN[aIndex]+")", "", new Object[]{getTcAspectStack(TC_Aspects.ELECTRUM, aIndex), getTcAspectStack(TC_Aspects.MACHINA, aIndex), getTcAspectStack(TC_Aspects.MAGNETO, aIndex)})); + } } diff --git a/src/Java/gtPlusPlus/xmod/gregtech/common/items/behaviours/Behaviour_Electric_Lighter.java b/src/Java/gtPlusPlus/xmod/gregtech/common/items/behaviours/Behaviour_Electric_Lighter.java index a063d334bf..422a29c34e 100644 --- a/src/Java/gtPlusPlus/xmod/gregtech/common/items/behaviours/Behaviour_Electric_Lighter.java +++ b/src/Java/gtPlusPlus/xmod/gregtech/common/items/behaviours/Behaviour_Electric_Lighter.java @@ -1,6 +1,5 @@ package gtPlusPlus.xmod.gregtech.common.items.behaviours; -import java.util.ArrayList; import java.util.List; import codechicken.lib.math.MathHelper; @@ -63,7 +62,7 @@ public class Behaviour_Electric_Lighter extends Behaviour_None { if (!aWorld.isRemote && aStack != null && aStack.stackSize == 1) { if (aPlayer.isSneaking()) { Logger.INFO("Changing Mode"); - boolean aCurrentMode = NBTUtils.getBoolean(aStack, "aFireballMod"); + boolean aCurrentMode = NBTUtils.getBoolean(aStack, "aFireballMode"); Logger.INFO("Is currently in Fireball mode? "+aCurrentMode); boolean aNewMode = Utils.invertBoolean(aCurrentMode); Logger.INFO("Is now set to Fireball mode? "+aNewMode); @@ -72,7 +71,7 @@ public class Behaviour_Electric_Lighter extends Behaviour_None { PlayerUtils.messagePlayer(aPlayer, "Current Mode: "+EnumChatFormatting.RED+(aNewMode ? "Projectile" : "Fire Starter")); } else { - boolean aCurrentMode = NBTUtils.getBoolean(aStack, "aFireballMod"); + 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)); @@ -112,16 +111,16 @@ public class Behaviour_Electric_Lighter extends Behaviour_None { if (!aWorld.isRemote && aStack != null && aStack.stackSize == 1) { if (aPlayer.isSneaking()) { Logger.INFO("Changing Mode"); - boolean aCurrentMode = NBTUtils.getBoolean(aStack, "aFireballMod"); + boolean aCurrentMode = NBTUtils.getBoolean(aStack, "aFireballMode"); Logger.INFO("Is currently in Fireball mode? "+aCurrentMode); boolean aNewMode = Utils.invertBoolean(aCurrentMode); Logger.INFO("Is now set to Fireball mode? "+aNewMode); - aStack.getTagCompound().setBoolean("aFireballMod", 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, "aFireballMod"); + 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)); @@ -199,11 +198,14 @@ public class Behaviour_Electric_Lighter extends Behaviour_None { } } boolean aCurrentMode; + if (!NBTUtils.hasTagCompound(aStack)) { + NBTUtils.createEmptyTagCompound(aStack); + } if (NBTUtils.hasKey(aStack, "aFireballMode")) { - aCurrentMode = NBTUtils.getBoolean(aStack, "aFireballMod"); + aCurrentMode = NBTUtils.getBoolean(aStack, "aFireballMode"); } else { - aStack.getTagCompound().setBoolean("aFireballMod", false); + aStack.getTagCompound().setBoolean("aFireballMode", false); aCurrentMode = false; } aList.add("Current Mode: "+EnumChatFormatting.RED+(aCurrentMode ? "Projectile" : "Fire Starter")); diff --git a/src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/generators/GT_MetaTileEntity_RfConvertor.java b/src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/generators/GT_MetaTileEntity_RfConvertor.java new file mode 100644 index 0000000000..08356dd6ef --- /dev/null +++ b/src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/generators/GT_MetaTileEntity_RfConvertor.java @@ -0,0 +1,344 @@ +package gtPlusPlus.xmod.gregtech.common.tileentities.generators; + +import static gregtech.api.enums.GT_Values.V; + +import cofh.api.energy.IEnergyConnection; +import cofh.api.energy.IEnergyHandler; +import cofh.api.energy.IEnergyProvider; +import cofh.api.energy.IEnergyReceiver; +import cofh.api.energy.IEnergyStorage; +import crazypants.enderio.machine.capbank.TileCapBank; +import crazypants.enderio.machine.capbank.network.ICapBankNetwork; +import crazypants.enderio.power.IPowerContainer; +import gregtech.api.GregTech_API; +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.objects.GT_RenderedTexture; +import gregtech.api.util.GT_Utility; +import gtPlusPlus.api.objects.Logger; +import gtPlusPlus.core.lib.CORE; +import gtPlusPlus.core.lib.LoadedMods; +import gtPlusPlus.core.util.math.MathUtils; +import gtPlusPlus.core.util.minecraft.PlayerUtils; +import gtPlusPlus.xmod.gregtech.common.blocks.textures.TexturesGtBlock; +import gtPlusPlus.xmod.gregtech.common.tileentities.storage.GregtechMetaEnergyBuffer; +import net.minecraft.entity.player.EntityPlayer; +import net.minecraft.entity.player.InventoryPlayer; +import net.minecraft.item.ItemStack; +import net.minecraft.nbt.NBTTagCompound; +import net.minecraft.tileentity.TileEntity; +import net.minecraft.util.EnumChatFormatting; +import net.minecraftforge.common.util.ForgeDirection; + +/** + * NEVER INCLUDE THIS FILE IN YOUR MOD!!! + * + * This is the main construct for my Basic Machines such as the Automatic Extractor + * Extend this class to make a simple Machine + */ +public class GT_MetaTileEntity_RfConvertor extends GregtechMetaEnergyBuffer implements IEnergyReceiver { + + + public GT_MetaTileEntity_RfConvertor(final String aName, final int aTier, + final String aDescription, final ITexture[][][] aTextures, final int aSlotCount) { + super(aName, aTier, aDescription, aTextures, aSlotCount); + } + + public GT_MetaTileEntity_RfConvertor(final int aID, final String aName, + final String aNameRegional, final int aTier, final String aDescription, final int aSlotCount) { + super(aID, aName, aNameRegional, aTier, aDescription, aSlotCount); + } + + @Override + public String[] getDescription() { + return new String[] {"Use Screwdriver to change voltage", "Hold Shift while using Screwdriver to change amperage", EnumChatFormatting.DARK_AQUA+"Variable Output Voltage"}; + } + + @Override + public ITexture[][][] getTextureSet(ITexture[] aTextures) { + ITexture[][][] rTextures = new ITexture[12][17][]; + GT_RenderedTexture aTex = new GT_RenderedTexture(TexturesGtBlock.Casing_Material_ZirconiumCarbide); + for (byte i = -1; i < 16; i++) { + rTextures[0][i + 1] = new ITexture[]{aTex, Textures.BlockIcons.OVERLAYS_ENERGY_OUT[mTier]}; + rTextures[1][i + 1] = new ITexture[]{aTex, Textures.BlockIcons.OVERLAYS_ENERGY_OUT[mTier]}; + rTextures[2][i + 1] = new ITexture[]{aTex, Textures.BlockIcons.OVERLAYS_ENERGY_OUT[mTier]}; + rTextures[3][i + 1] = new ITexture[]{aTex, Textures.BlockIcons.OVERLAYS_ENERGY_IN_MULTI[mTier]}; + rTextures[4][i + 1] = new ITexture[]{aTex, Textures.BlockIcons.OVERLAYS_ENERGY_IN_MULTI[mTier]}; + rTextures[5][i + 1] = new ITexture[]{aTex, Textures.BlockIcons.OVERLAYS_ENERGY_IN_MULTI[mTier]}; + rTextures[6][i + 1] = new ITexture[]{aTex, Textures.BlockIcons.OVERLAYS_ENERGY_IN[mTier]}; + rTextures[7][i + 1] = new ITexture[]{aTex, Textures.BlockIcons.OVERLAYS_ENERGY_IN[mTier]}; + rTextures[8][i + 1] = new ITexture[]{aTex, Textures.BlockIcons.OVERLAYS_ENERGY_IN[mTier]}; + rTextures[9][i + 1] = new ITexture[]{aTex, Textures.BlockIcons.OVERLAYS_ENERGY_OUT_MULTI[mTier]}; + rTextures[10][i + 1] = new ITexture[]{aTex, Textures.BlockIcons.OVERLAYS_ENERGY_OUT_MULTI[mTier]}; + rTextures[11][i + 1] = new ITexture[]{aTex, Textures.BlockIcons.OVERLAYS_ENERGY_OUT_MULTI[mTier]}; + } + return rTextures; + } + + @Override + public ITexture[] getTexture(IGregTechTileEntity aBaseMetaTileEntity, byte aSide, byte aFacing, byte aColorIndex, boolean aActive, boolean aRedstone) { + return mTextures[Math.min(2, aSide) + (aSide == aFacing ? 3 : 0) + (aActive ? 0 : 6)][aColorIndex + 1]; + } + + @Override + public IMetaTileEntity newMetaEntity(final IGregTechTileEntity aTileEntity) { + return new GT_MetaTileEntity_RfConvertor(this.mName, this.mTier, this.mDescription, + this.mTextures, this.mInventory.length); + } + + @Override + public long getMinimumStoredEU() { + return 0; + } + + @Override + public long maxEUStore() { + return Integer.MAX_VALUE; + } + + @Override + public long maxEUInput() { + return 0; + } + + @Override + public long maxEUOutput() { + return V[this.mTier]; + } + + @Override + public long maxAmperesIn() { + return 0; + } + + @Override + public boolean isEnetInput() { + return false; + } + + @Override + public boolean isEnetOutput() { + return true; + } + + @Override + public boolean isInputFacing(byte aSide) { + return !isOutputFacing(aSide); + } + + @Override + public boolean isOutputFacing(byte aSide) { + return aSide == getBaseMetaTileEntity().getFrontFacing(); + } + + @Override public boolean isAccessAllowed(final EntityPlayer aPlayer) {return true;} + + @Override + public Object getServerGUI(final int aID, final InventoryPlayer aPlayerInventory, + final IGregTechTileEntity aBaseMetaTileEntity) { + return null; + } + + @Override + public Object getClientGUI(final int aID, final InventoryPlayer aPlayerInventory, + final IGregTechTileEntity aBaseMetaTileEntity) { + return null; + } + + @Override + public void onPostTick(final IGregTechTileEntity aBaseMetaTileEntity, final long aTick) { + if (aBaseMetaTileEntity.isServerSide()) { + if (!aBaseMetaTileEntity.isActive()) { + aBaseMetaTileEntity.setActive(true); + } + if (this.getEUVar() < this.maxEUStore()) { + for (byte i = 0; i < 6 && aBaseMetaTileEntity.getStoredEU() < aBaseMetaTileEntity.getEUCapacity(); i++) { + if (isInputFacing(i)) { + receiveEnergy(ForgeDirection.getOrientation(i), Integer.MAX_VALUE, false); + } + } + } + return; + } + } + + @Override + public boolean allowPullStack(final IGregTechTileEntity aBaseMetaTileEntity, final int aIndex, final byte aSide, final ItemStack aStack) { + return false; + } + + @Override + public boolean allowPutStack(final IGregTechTileEntity aBaseMetaTileEntity, final int aIndex, final byte aSide, final ItemStack aStack) { + return false; + } + + @Override + public String[] getInfoData() { + String[] infoData = super.getInfoData(); + return new String[] { + infoData[0], + "Converts RF -> GTEU | Tier: "+this.mTier, + infoData[1], + infoData[2] + }; + } + + @Override + public boolean isGivingInformation() { + return true; + } + + @Override + public void saveNBTData(NBTTagCompound aNBT) { + aNBT.setByte("mTier", this.mTier); + super.saveNBTData(aNBT); + } + + @Override + public void loadNBTData(NBTTagCompound aNBT) { + super.loadNBTData(aNBT); + this.mTier = aNBT.getByte("mTier"); + } + + @Override + public void onScrewdriverRightClick(byte aSide, EntityPlayer aPlayer, float aX, float aY, float aZ) { + if (aPlayer.isSneaking()) { + byte aTest = (byte) (aCurrentOutputAmperage + 1); + if (aTest > 16 || aTest <= 0 ) { + aTest = 1; + } + aCurrentOutputAmperage = aTest; + PlayerUtils.messagePlayer(aPlayer, "Now handling "+maxAmperesOut()+" Amps."); + } + else { + if (this.mTier < (CORE.GTNH ? GT_Values.V.length : 9)) { + this.mTier++; + } + else { + this.mTier = 0; + } + PlayerUtils.messagePlayer(aPlayer, "Now running at "+GT_Values.VOLTAGE_NAMES[this.mTier]+"."); + } + + } + + @Override + public boolean canConnectEnergy(ForgeDirection from) { + if (isOutputFacing((byte) from.ordinal())) { + return false; + } + return true; + } + + @Override + public int receiveEnergy(ForgeDirection from, int maxReceive, boolean simulate) { + + // Cannot accept power on the output face. + if (!canConnectEnergy(from) || isOutputFacing((byte) from.ordinal())) { + return 0; + } + + TileEntity tTileEntity = this.getBaseMetaTileEntity().getTileEntityAtSide((byte) from.ordinal()); + if (tTileEntity == null) { + return 0; + } + + Logger.WARNING("Someone is trying to inject RF from "+from+". Type:"+tTileEntity.getClass().getName()); + + // Calculate maximum RF we need to consume + int aInputRF = MathUtils.safeInt(this.maxEUOutput() * GregTech_API.mEUtoRF / 100); + + // Make sure we only consume the correct amount of RF that is pushed into this Tile. + if (aInputRF > maxReceive) { + aInputRF = maxReceive; + } + + int aInjectedRF = 0; + boolean aVal = false; + + long aStoredEU = this.getEUVar(); + long aMaxEU = this.maxEUStore(); + Logger.WARNING("Stored: "+aStoredEU+", Capacity: "+aMaxEU+""); + if (aStoredEU < aMaxEU) { + Logger.WARNING("StoredEU < MaxEU"); + long aRemainingSpace = aMaxEU - aStoredEU; + if (aRemainingSpace > 0) { + long tEU = 0; + byte aSide = (byte) from.ordinal(); + Logger.WARNING("Free: "+aRemainingSpace+"EU"); + if (tTileEntity instanceof IEnergyProvider && ((IEnergyProvider) tTileEntity).extractEnergy(ForgeDirection.getOrientation(GT_Utility.getOppositeSide(aSide)), 1, true) == 1) { + tEU = (long) ((IEnergyProvider) tTileEntity).extractEnergy(ForgeDirection.getOrientation(GT_Utility.getOppositeSide(aSide)), (int) maxEUOutput() * 100 / GregTech_API.mRFtoEU, false); + Logger.WARNING("Drained from IEnergyProvider Tile: "+(tEU * 100 / GregTech_API.mRFtoEU)+""); + tEU = tEU * GregTech_API.mRFtoEU / 100; + } + else if (tTileEntity instanceof IEnergyStorage && ((IEnergyStorage) tTileEntity).extractEnergy(1, true) == 1) { + tEU = (long) ((IEnergyStorage) tTileEntity).extractEnergy((int) maxEUOutput() * 100 / GregTech_API.mRFtoEU, false); + Logger.WARNING("Drained from IEnergyStorage Tile: "+(tEU * 100 / GregTech_API.mRFtoEU)+""); + tEU = tEU * GregTech_API.mRFtoEU / 100; + } + else if (GregTech_API.meIOLoaded && tTileEntity instanceof IPowerContainer && ((IPowerContainer) tTileEntity).getEnergyStored() > 0) { + int storedRF = ((IPowerContainer) tTileEntity).getEnergyStored(); + int extractRF = (int) maxEUOutput() * 100 / GregTech_API.mRFtoEU; + tEU = 0; + if (tTileEntity instanceof TileCapBank) { + ICapBankNetwork network = ((TileCapBank) tTileEntity).getNetwork(); + if (network != null && network.getEnergyStoredL() > 0) { + tEU = Math.min((Math.min(Math.min(network.getEnergyStoredL(), storedRF - extractRF), network.getMaxOutput())) * GregTech_API.mRFtoEU / 100, maxEUOutput()); + Logger.WARNING("Drained from EIO CapBank Tile: "+(tEU * 100 / GregTech_API.mRFtoEU)+""); + network.addEnergy((int) -(tEU * 100 / GregTech_API.mRFtoEU)); + } + } else { + if (storedRF > extractRF) { + ((IPowerContainer) tTileEntity).setEnergyStored(storedRF - extractRF); + tEU = maxEUOutput(); + Logger.WARNING("Drained from EIO Tile: "+(tEU * 100 / GregTech_API.mRFtoEU)+""); + } else { + ((IPowerContainer) tTileEntity).setEnergyStored(0); + tEU = storedRF * GregTech_API.mRFtoEU / 100; + Logger.WARNING("Drained from EIO Tile: "+(tEU * 100 / GregTech_API.mRFtoEU)+""); + } + } + } + Logger.WARNING("EU to inject: "+tEU+"EU"); + if (!simulate) { + aVal = this.getBaseMetaTileEntity().increaseStoredEnergyUnits(tEU, true); + } + if (tEU > 0) { + Logger.WARNING("Tried injecting "+tEU+" eu into self. Success? "+aVal); + } + } + } + return aInjectedRF; + } + + @Override + public int getEnergyStored(ForgeDirection from) { + long aStoredEU = this.getEUVar(); + long aMaxEU = this.maxEUStore(); + if (aStoredEU == 0) { + return 0; + } + if (aStoredEU < aMaxEU) { + long aRemainingSpace = aMaxEU - aStoredEU; + if (aRemainingSpace > 0) { + if (aRemainingSpace > (this.maxEUOutput() / (GregTech_API.mEUtoRF / 100))) { + int aCalculatedFreeSpace = 0; + int aRfPer10Eu = GregTech_API.mEUtoRF / 10; + // Calculate how many lots of '10 + aCalculatedFreeSpace = (int) Math.floor(aRemainingSpace / 10); + // Return value equal to how many lots of '10eu' packets we can fit in. + return Integer.MAX_VALUE - MathUtils.balance(aCalculatedFreeSpace * aRfPer10Eu, 0, Integer.MAX_VALUE); + } + } + } + return Integer.MAX_VALUE; + } + + @Override + public int getMaxEnergyStored(ForgeDirection from) { + return Integer.MAX_VALUE; + } +}
\ No newline at end of file diff --git a/src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/basic/GregtechMetaTileEntityChunkLoader.java b/src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/basic/GregtechMetaTileEntityChunkLoader.java index 2a2b6d5090..140f1d9cd5 100644 --- a/src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/basic/GregtechMetaTileEntityChunkLoader.java +++ b/src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/basic/GregtechMetaTileEntityChunkLoader.java @@ -1,7 +1,6 @@ package gtPlusPlus.xmod.gregtech.common.tileentities.machines.basic; import static gregtech.api.enums.GT_Values.V; -import static gtPlusPlus.core.util.minecraft.gregtech.PollutionUtils.mPollution; import java.util.HashSet; import java.util.Set; @@ -10,20 +9,13 @@ 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_BasicMachine; import gregtech.api.objects.GT_RenderedTexture; import gregtech.api.util.GT_Utility; import gtPlusPlus.api.interfaces.IChunkLoader; -import gtPlusPlus.api.objects.Logger; import gtPlusPlus.core.chunkloading.GTPP_ChunkManager; import gtPlusPlus.core.chunkloading.StaticChunkFunctions; import gtPlusPlus.core.lib.CORE; -import gtPlusPlus.core.util.Utils; -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; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.item.ItemStack; @@ -36,17 +28,7 @@ import net.minecraft.world.chunk.Chunk; public class GregtechMetaTileEntityChunkLoader extends GT_MetaTileEntity_BasicMachine implements IChunkLoader { public GregtechMetaTileEntityChunkLoader(int aID, String aName, String aNameRegional, int aTier) { - super(aID, aName, aNameRegional, aTier, 2, "Loads " + getMaxChunksToLoadForTier(aTier) + " chunks when powered", 0, 0, "Recycler.png", "", - 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) - }); + super(aID, aName, aNameRegional, aTier, 2, "Loads " + getMaxChunksToLoadForTier(aTier) + " chunks when powered", 0, 0, "Recycler.png", "", new ITexture[]{}); } public GregtechMetaTileEntityChunkLoader(String aName, int aTier, String aDescription, ITexture[][][] aTextures, String aGUIName, String aNEIName) { @@ -54,13 +36,27 @@ public class GregtechMetaTileEntityChunkLoader extends GT_MetaTileEntity_BasicMa } public static int getMaxChunksToLoadForTier(int aTier) { - return (aTier * aTier); + if (aTier < 4) { + return 3 * 3; + } + if (aTier < 6) { + return 7 * 7; + } + if (aTier < 8) { + return 15 * 15; + } + else { + return 0; + } } @Override public String[] getDescription() { return new String[] { - this.mDescription, + "Loads " + getMaxChunksToLoadForTier(this.mTier) + " chunks when powered", + "Consumes 2A", + "Behaves Identically to a Railcraft World Anchor", + CORE.GT_Tooltip }; } @@ -89,57 +85,56 @@ public class GregtechMetaTileEntityChunkLoader extends GT_MetaTileEntity_BasicMa public ITexture[] getFront(final byte aColor) { - return new ITexture[]{Textures.BlockIcons.MACHINE_CASINGS[this.mTier][aColor + 1], new GT_RenderedTexture(TexturesGtBlock.Casing_Material_RedSteel)}; + return new ITexture[]{Textures.BlockIcons.MACHINE_CASINGS[this.mTier][aColor + 1], new GT_RenderedTexture(TexturesGtBlock.Casing_Material_MaragingSteel), new GT_RenderedTexture(TexturesGtBlock.TIERED_MACHINE_HULLS[mTier])}; } public ITexture[] getBack(final byte aColor) { - return new ITexture[]{Textures.BlockIcons.MACHINE_CASINGS[this.mTier][aColor + 1], new GT_RenderedTexture(TexturesGtBlock.Casing_Material_RedSteel)}; + return new ITexture[]{Textures.BlockIcons.MACHINE_CASINGS[this.mTier][aColor + 1], new GT_RenderedTexture(TexturesGtBlock.Casing_Material_MaragingSteel), new GT_RenderedTexture(TexturesGtBlock.TIERED_MACHINE_HULLS[mTier])}; } public ITexture[] getBottom(final byte aColor) { - return new ITexture[]{Textures.BlockIcons.MACHINE_CASINGS[this.mTier][aColor + 1], new GT_RenderedTexture(TexturesGtBlock.Casing_Material_Grisium)}; + return new ITexture[]{Textures.BlockIcons.MACHINE_CASINGS[this.mTier][aColor + 1], new GT_RenderedTexture(TexturesGtBlock.Casing_Material_MaragingSteel), new GT_RenderedTexture(TexturesGtBlock.TIERED_MACHINE_HULLS[mTier])}; } public ITexture[] getTop(final byte aColor) { - return new ITexture[]{Textures.BlockIcons.MACHINE_CASINGS[this.mTier][aColor + 1], new GT_RenderedTexture(TexturesGtBlock.Casing_Material_Grisium)}; + return new ITexture[]{Textures.BlockIcons.MACHINE_CASINGS[this.mTier][aColor + 1], new GT_RenderedTexture(TexturesGtBlock.Casing_Material_MaragingSteel), new GT_RenderedTexture(TexturesGtBlock.TIERED_MACHINE_HULLS[mTier])}; } public ITexture[] getSides(final byte aColor) { - return new ITexture[]{Textures.BlockIcons.MACHINE_CASINGS[this.mTier][aColor + 1], new GT_RenderedTexture(TexturesGtBlock.Casing_Redox_3)}; + return new ITexture[]{Textures.BlockIcons.MACHINE_CASINGS[this.mTier][aColor + 1], new GT_RenderedTexture(TexturesGtBlock.Casing_Material_MaragingSteel), new GT_RenderedTexture(TexturesGtBlock.TIERED_MACHINE_HULLS[mTier])}; } public ITexture[] getFrontActive(final byte aColor) { - return new ITexture[]{Textures.BlockIcons.MACHINE_CASINGS[this.mTier][aColor + 1], new GT_RenderedTexture(TexturesGtBlock.Casing_Material_RedSteel)}; + return new ITexture[]{Textures.BlockIcons.MACHINE_CASINGS[this.mTier][aColor + 1], new GT_RenderedTexture(TexturesGtBlock.Casing_Material_MaragingSteel), new GT_RenderedTexture(TexturesGtBlock.TIERED_MACHINE_HULLS[mTier+1])}; } public ITexture[] getBackActive(final byte aColor) { - return new ITexture[]{Textures.BlockIcons.MACHINE_CASINGS[this.mTier][aColor + 1], new GT_RenderedTexture(TexturesGtBlock.Casing_Material_RedSteel)}; + return new ITexture[]{Textures.BlockIcons.MACHINE_CASINGS[this.mTier][aColor + 1], new GT_RenderedTexture(TexturesGtBlock.Casing_Material_MaragingSteel), new GT_RenderedTexture(TexturesGtBlock.TIERED_MACHINE_HULLS[mTier+1])}; } public ITexture[] getBottomActive(final byte aColor) { - return new ITexture[]{Textures.BlockIcons.MACHINE_CASINGS[this.mTier][aColor + 1], new GT_RenderedTexture(TexturesGtBlock.Casing_Material_Grisium)}; + return new ITexture[]{Textures.BlockIcons.MACHINE_CASINGS[this.mTier][aColor + 1], new GT_RenderedTexture(TexturesGtBlock.Casing_Material_MaragingSteel), new GT_RenderedTexture(TexturesGtBlock.TIERED_MACHINE_HULLS[mTier+1])}; } public ITexture[] getTopActive(final byte aColor) { - return new ITexture[]{Textures.BlockIcons.MACHINE_CASINGS[this.mTier][aColor + 1], new GT_RenderedTexture(TexturesGtBlock.Casing_Material_Grisium)}; + return new ITexture[]{Textures.BlockIcons.MACHINE_CASINGS[this.mTier][aColor + 1], new GT_RenderedTexture(TexturesGtBlock.Casing_Material_MaragingSteel), new GT_RenderedTexture(TexturesGtBlock.TIERED_MACHINE_HULLS[mTier+1])}; } public ITexture[] getSidesActive(final byte aColor) { - return new ITexture[]{Textures.BlockIcons.MACHINE_CASINGS[this.mTier][aColor + 1], new GT_RenderedTexture(TexturesGtBlock.Casing_Redox_3)}; + return new ITexture[]{Textures.BlockIcons.MACHINE_CASINGS[this.mTier][aColor + 1], new GT_RenderedTexture(TexturesGtBlock.Casing_Material_MaragingSteel), new GT_RenderedTexture(TexturesGtBlock.TIERED_MACHINE_HULLS[mTier+1])}; } @Override public void onScrewdriverRightClick(byte aSide, EntityPlayer aPlayer, float aX, float aY, float aZ) { - PlayerUtils.messagePlayer(aPlayer, "Running every "+" minutes."); super.onScrewdriverRightClick(aSide, aPlayer, aX, aY, aZ); } @@ -175,9 +170,7 @@ public class GregtechMetaTileEntityChunkLoader extends GT_MetaTileEntity_BasicMa @Override public String[] getInfoData() { - return new String[] { - this.getLocalName() - }; + return super.getInfoData(); } @Override diff --git a/src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/basic/GregtechMetaTileEntity_ChemicalReactor.java b/src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/basic/GregtechMetaTileEntity_ChemicalReactor.java index b7e4618e07..79d256909d 100644 --- a/src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/basic/GregtechMetaTileEntity_ChemicalReactor.java +++ b/src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/basic/GregtechMetaTileEntity_ChemicalReactor.java @@ -43,23 +43,6 @@ public class GregtechMetaTileEntity_ChemicalReactor extends GT_MetaTileEntity_Ba public FluidStack[] mInputFluids = new FluidStack[4]; public FluidStack[] mOutputFluids = new FluidStack[2]; - private static final GT_Recipe_Map mFluidChemicalReactorRecipes = new GT_Recipe_Map( - new HashSet<GT_Recipe>(100), - "gt.recipe.fluidchemicaleactor", - "Chemical Plant", - null, - CORE.MODID+":textures/gui/FluidReactor", - 0, - 0, - 0, - 2, - 1, - "Tier: ", - 1, - E, - true, - false); - public GregtechMetaTileEntity_ChemicalReactor(int aID, String aName, String aNameRegional, int aTier) { super(aID, aName, aNameRegional, aTier, 1, "For mixing fluids", 4, 4, "ChemicalReactor.png", "", @@ -124,12 +107,7 @@ public class GregtechMetaTileEntity_ChemicalReactor extends GT_MetaTileEntity_Ba @Override public GT_Recipe.GT_Recipe_Map getRecipeList() { - if (mFluidChemicalReactorRecipes.mRecipeList.isEmpty()) { - for (Recipe_GT i :Recipe_GT.Gregtech_Recipe_Map.sFluidChemicalReactorRecipes.mRecipeList) { - mFluidChemicalReactorRecipes.add(i); - } - } - return mFluidChemicalReactorRecipes; + return null; } @Override diff --git a/src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/processing/GregtechMetaTileEntity_IndustrialAlloySmelter.java b/src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/processing/GregtechMetaTileEntity_IndustrialAlloySmelter.java new file mode 100644 index 0000000000..ddbd87da64 --- /dev/null +++ b/src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/processing/GregtechMetaTileEntity_IndustrialAlloySmelter.java @@ -0,0 +1,380 @@ +package gtPlusPlus.xmod.gregtech.common.tileentities.machines.multi.processing; + +import static gtPlusPlus.core.util.data.ArrayUtils.removeNulls; + +import java.util.ArrayList; +import java.util.List; + +import org.apache.commons.lang3.ArrayUtils; + +import gregtech.api.enums.TAE; +import gregtech.api.enums.Textures; +import gregtech.api.gui.GT_GUIContainer_MultiMachine; +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_Recipe; +import gregtech.api.util.GT_Utility; +import gtPlusPlus.api.objects.Logger; +import gtPlusPlus.core.block.ModBlocks; +import gtPlusPlus.xmod.gregtech.api.metatileentity.implementations.base.GregtechMeta_MultiBlockBase; +import gtPlusPlus.xmod.gregtech.common.StaticFields59; +import net.minecraft.block.Block; +import net.minecraft.entity.player.InventoryPlayer; +import net.minecraft.item.ItemStack; +import net.minecraftforge.common.util.ForgeDirection; +import net.minecraftforge.fluids.FluidStack; + +public class GregtechMetaTileEntity_IndustrialAlloySmelter extends GregtechMeta_MultiBlockBase { + + public static int CASING_TEXTURE_ID; + private int mHeatingCapacity = 0; + private int mLevel = 0; + + 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); + } + + public IMetaTileEntity newMetaEntity(IGregTechTileEntity aTileEntity) { + return new GregtechMetaTileEntity_IndustrialAlloySmelter(this.mName); + } + + public ITexture[] getTexture(IGregTechTileEntity aBaseMetaTileEntity, byte aSide, byte aFacing, byte aColorIndex, boolean aActive, boolean aRedstone) { + if (aSide == aFacing) { + return new ITexture[]{Textures.BlockIcons.CASING_BLOCKS[CASING_TEXTURE_ID], new GT_RenderedTexture(aActive ? Textures.BlockIcons.OVERLAY_FRONT_MULTI_SMELTER_ACTIVE : Textures.BlockIcons.OVERLAY_FRONT_MULTI_SMELTER)}; + } + return new ITexture[]{Textures.BlockIcons.CASING_BLOCKS[CASING_TEXTURE_ID]}; + } + + public Object getClientGUI(int aID, InventoryPlayer aPlayerInventory, IGregTechTileEntity aBaseMetaTileEntity) { + return new GT_GUIContainer_MultiMachine(aPlayerInventory, aBaseMetaTileEntity, getLocalName(), "MultiFurnace.png"); + } + + public GT_Recipe.GT_Recipe_Map getRecipeMap() { + return GT_Recipe.GT_Recipe_Map.sAlloySmelterRecipes; + } + + public boolean isCorrectMachinePart(ItemStack aStack) { + return true; + } + + public boolean isFacingValid(byte aFacing) { + return aFacing > 1; + } + + public int getMaxEfficiency(ItemStack aStack) { + return 10000; + } + + public int getPollutionPerTick(ItemStack aStack) { + return 15; + } + + public int getDamageToComponent(ItemStack aStack) { + return 0; + } + + public boolean explodesOnComponentBreak(ItemStack aStack) { + return false; + } + + @Override + public boolean hasSlotInGUI() { + return false; + } + + @Override + public String getCustomGUIResourceName() { + return null; + } + + @Override + public String getMachineType() { + return "Alloy Smelter"; + } + + @Override + public String[] getTooltip() { + return new String[]{ + "Controller Block for the Industrial Alloy Smelter", + "Gains one parallel per voltage tier", + "Gains one multiplier per coil tier", + "parallel = tier * coil tier", + "Gains 5% speed bonus per coil tier", + "Size(WxHxD): 3x5x3 (Hollow)", + "Controller (Front middle at bottom)", + "Inconel Reinforced Casings (layers 0/4, 10 at least!)", + "16x Heating Coils (layers 1/3, hollow)", + "8x Integral Encasement V (middle layer, hollow)", + "1x Input Bus", + "1x Output Bus", + "1x Output Hatch", + "1x Energy Hatch", + }; + } + + @Override + public int getMaxParallelRecipes() { + return (this.mLevel * GT_Utility.getTier(this.getMaxInputVoltage())); + } + + @Override + public int getEuDiscountForParallelism() { + return 0; + } + + @Override + public boolean checkMultiblock(IGregTechTileEntity aBaseMetaTileEntity, ItemStack aStack) { + int xDir = ForgeDirection.getOrientation(aBaseMetaTileEntity.getBackFacing()).offsetX; + int zDir = ForgeDirection.getOrientation(aBaseMetaTileEntity.getBackFacing()).offsetZ; + + this.mLevel = 0; + this.mHeatingCapacity = 0; + for (int i=1;i<4;i++) { + if (!aBaseMetaTileEntity.getAirOffset(xDir, i, zDir)) { + Logger.INFO("Did not find air inside on layer "+i); + return false; + } + } + /*if (!addMufflerToMachineList(aBaseMetaTileEntity.getIGregTechTileEntityOffset(xDir, 3, zDir), + CASING_TEXTURE_ID)) { + return false; + }*/ + Block tUsedBlock = aBaseMetaTileEntity.getBlockOffset(xDir + 1, 1, zDir); + byte tUsedMeta = aBaseMetaTileEntity.getMetaIDOffset(xDir + 1, 1, zDir); + this.mLevel = StaticFields59.getTierForCoil(tUsedBlock, tUsedMeta); + this.mHeatingCapacity = StaticFields59.getHeatingCapacityForCoil(tUsedBlock, tUsedMeta); + + int aCasingCount = 0; + + for (int i = -1; i < 2; i++) { + for (int j = -1; j < 2; j++) { + + if ((i != 0) || (j != 0)) { + //Coils 1 + if (!isValidBlockForStructure(null, CASING_TEXTURE_ID, false, aBaseMetaTileEntity.getBlockOffset(xDir + i, 1, zDir + j), (int) aBaseMetaTileEntity.getMetaIDOffset(xDir + i, 1, zDir + j), StaticFields59.getBlockCasings5(), tUsedMeta)) { + Logger.INFO("Heating Coils missing. First Layer"); + return false; + } + + //Integral Casings + if (!isValidBlockForStructure(null, CASING_TEXTURE_ID, false, aBaseMetaTileEntity.getBlockOffset(xDir + i, 2, zDir + j), (int) aBaseMetaTileEntity.getMetaIDOffset(xDir + i, 2, zDir + j), ModBlocks.blockCasingsTieredGTPP, 4)) { + Logger.INFO("Integral Framework missing. Second Layer"); + return false; + } + + //Coils 2 + if (!isValidBlockForStructure(null, CASING_TEXTURE_ID, false, aBaseMetaTileEntity.getBlockOffset(xDir + i, 3, zDir + j), (int) aBaseMetaTileEntity.getMetaIDOffset(xDir + i, 3, zDir + j), StaticFields59.getBlockCasings5(), tUsedMeta)) { + Logger.INFO("Heating Coils missing. Third Layer"); + return false; + } + } + + //Top Layer + + Block aCurrentBlock = aBaseMetaTileEntity.getBlockOffset(xDir + i, 4, zDir + j); + int aCurrentMeta = (int) aBaseMetaTileEntity.getMetaIDOffset(xDir + i, 4, zDir + j); + if (aCurrentBlock == ModBlocks.blockCasings3Misc && aCurrentMeta == 1) { + aCasingCount++; + } + + final IGregTechTileEntity tTileEntity2 = aBaseMetaTileEntity.getIGregTechTileEntityOffset(xDir + i, 4, zDir + j); + if (!isValidBlockForStructure(tTileEntity2, CASING_TEXTURE_ID, true, aCurrentBlock, aCurrentMeta, ModBlocks.blockCasings3Misc, 1)) { + Logger.INFO("Top Layer missing."); + return false; + } + } + } + for (int i = -1; i < 2; i++) { + for (int j = -1; j < 2; j++) { + + + Block aCurrentBlock = aBaseMetaTileEntity.getBlockOffset(xDir + i, 0, zDir + j); + int aCurrentMeta = (int) aBaseMetaTileEntity.getMetaIDOffset(xDir + i, 0, zDir + j); + if (aCurrentBlock == ModBlocks.blockCasings3Misc && aCurrentMeta == 1) { + aCasingCount++; + } + if ((xDir + i != 0) || (zDir + j != 0)) { + IGregTechTileEntity tTileEntity = aBaseMetaTileEntity.getIGregTechTileEntityOffset(xDir + i, 0, zDir + j); + if (!isValidBlockForStructure(tTileEntity, CASING_TEXTURE_ID, true, aCurrentBlock, aCurrentMeta, ModBlocks.blockCasings3Misc, 1)) { + Logger.INFO("Bottom Layer missing."); + return false; + } + } + } + } + + return aCasingCount >= 10; + } + + public boolean checkRecipe(ItemStack aStack) { + return checkRecipeGeneric(this.getMaxParallelRecipes(), 0, 5 * this.mLevel); // Will have to clone the logic from parent class to handle heating coil + // tiers. + } + + @Override + public boolean checkRecipeGeneric(ItemStack[] aItemInputs, FluidStack[] aFluidInputs, int aMaxParallelRecipes, + int aEUPercent, int aSpeedBonusPercent, int aOutputChanceRoll) { + // Based on the Processing Array. A bit overkill, but very flexible. + + // Reset outputs and progress stats + this.mEUt = 0; + this.mMaxProgresstime = 0; + this.mOutputItems = new ItemStack[] {}; + this.mOutputFluids = new FluidStack[] {}; + + long tVoltage = getMaxInputVoltage(); + byte tTier = (byte) Math.max(1, GT_Utility.getTier(tVoltage)); + long tEnergy = getMaxInputEnergy(); + Logger.WARNING("Running checkRecipeGeneric(0)"); + + GT_Recipe tRecipe = this.getRecipeMap().findRecipe(getBaseMetaTileEntity(), mLastRecipe, false, + gregtech.api.enums.GT_Values.V[tTier], aFluidInputs, aItemInputs); + + Logger.WARNING("Running checkRecipeGeneric(1)"); + // Remember last recipe - an optimization for findRecipe() + this.mLastRecipe = tRecipe; + + if (tRecipe == null) { + Logger.WARNING("BAD RETURN - 1"); + return false; + } + + aMaxParallelRecipes = this.canBufferOutputs(tRecipe, aMaxParallelRecipes); + if (aMaxParallelRecipes == 0) { + Logger.WARNING("BAD RETURN - 2"); + return false; + } + + // EU discount + float tRecipeEUt = (tRecipe.mEUt * aEUPercent) / 100.0f; + int tHeatCapacityDivTiers = mHeatingCapacity / 900; + if (tHeatCapacityDivTiers > 0) { + tRecipeEUt = (int) (tRecipeEUt * (Math.pow(0.95, tHeatCapacityDivTiers))); + } + float tTotalEUt = 0.0f; + + int parallelRecipes = 0; + // Count recipes to do in parallel, consuming input items and fluids and + // considering input voltage limits + for (; parallelRecipes < aMaxParallelRecipes && tTotalEUt < (tEnergy - tRecipeEUt); parallelRecipes++) { + if (!tRecipe.isRecipeInputEqual(true, aFluidInputs, aItemInputs)) { + Logger.WARNING("Broke at " + parallelRecipes + "."); + break; + } + Logger.WARNING("Bumped EU from " + tTotalEUt + " to " + (tTotalEUt + tRecipeEUt) + "."); + tTotalEUt += tRecipeEUt; + } + + if (parallelRecipes == 0) { + Logger.WARNING("BAD RETURN - 3"); + return false; + } + + // -- Try not to fail after this point - inputs have already been consumed! -- + + // Convert speed bonus to duration multiplier + // e.g. 100% speed bonus = 200% speed = 100%/200% = 50% recipe duration. + aSpeedBonusPercent = Math.max(-99, aSpeedBonusPercent); + float tTimeFactor = 100.0f / (100.0f + aSpeedBonusPercent); + this.mMaxProgresstime = (int) (tRecipe.mDuration * tTimeFactor); + int rInt = 2; + + this.mEUt = (int) Math.ceil(tTotalEUt); + + this.mEfficiency = (10000 - (getIdealStatus() - getRepairStatus()) * 1000); + this.mEfficiencyIncrease = 10000; + + // Overclock + if (this.mEUt <= 16) { + this.mEUt = (this.mEUt * (1 << tTier - 1) * (1 << tTier - 1)); + this.mMaxProgresstime = (this.mMaxProgresstime / (1 << tTier - 1)); + } else { + while (this.mEUt <= gregtech.api.enums.GT_Values.V[(tTier - 1)]) { + this.mEUt *= 4; + this.mMaxProgresstime /= (tHeatCapacityDivTiers >= rInt ? 4 : 2); + } + } + if (this.mEUt > 0) { + this.mEUt = (-this.mEUt); + } + + this.mMaxProgresstime = Math.max(1, this.mMaxProgresstime); + + // Collect fluid outputs + FluidStack[] tOutputFluids = new FluidStack[tRecipe.mFluidOutputs.length]; + for (int h = 0; h < tRecipe.mFluidOutputs.length; h++) { + if (tRecipe.getFluidOutput(h) != null) { + tOutputFluids[h] = tRecipe.getFluidOutput(h).copy(); + tOutputFluids[h].amount *= parallelRecipes; + } + } + + // Collect output item types + ItemStack[] tOutputItems = new ItemStack[tRecipe.mOutputs.length]; + for (int h = 0; h < tRecipe.mOutputs.length; h++) { + if (tRecipe.getOutput(h) != null) { + tOutputItems[h] = tRecipe.getOutput(h).copy(); + tOutputItems[h].stackSize = 0; + } + } + + // Set output item stack sizes (taking output chance into account) + for (int f = 0; f < tOutputItems.length; f++) { + if (tRecipe.mOutputs[f] != null && tOutputItems[f] != null) { + for (int g = 0; g < parallelRecipes; g++) { + if (getBaseMetaTileEntity().getRandomNumber(aOutputChanceRoll) < tRecipe.getOutputChance(f)) + tOutputItems[f].stackSize += tRecipe.mOutputs[f].stackSize; + } + } + } + + tOutputItems = removeNulls(tOutputItems); + + // Sanitize item stack size, splitting any stacks greater than max stack size + List<ItemStack> splitStacks = new ArrayList<ItemStack>(); + for (ItemStack tItem : tOutputItems) { + while (tItem.getMaxStackSize() < tItem.stackSize) { + ItemStack tmp = tItem.copy(); + tmp.stackSize = tmp.getMaxStackSize(); + tItem.stackSize = tItem.stackSize - tItem.getMaxStackSize(); + splitStacks.add(tmp); + } + } + + if (splitStacks.size() > 0) { + ItemStack[] tmp = new ItemStack[splitStacks.size()]; + tmp = splitStacks.toArray(tmp); + tOutputItems = ArrayUtils.addAll(tOutputItems, tmp); + } + + // Strip empty stacks + List<ItemStack> tSList = new ArrayList<ItemStack>(); + for (ItemStack tS : tOutputItems) { + if (tS.stackSize > 0) + tSList.add(tS); + } + tOutputItems = tSList.toArray(new ItemStack[tSList.size()]); + + // Commit outputs + this.mOutputItems = tOutputItems; + this.mOutputFluids = tOutputFluids; + updateSlots(); + + // Play sounds (GT++ addition - GT multiblocks play no sounds) + startProcess(); + + Logger.WARNING("GOOD RETURN - 1"); + return true; + + } + + +} diff --git a/src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/processing/GregtechMetaTileEntity_IndustrialArcFurnace.java b/src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/processing/GregtechMetaTileEntity_IndustrialArcFurnace.java index c549cf9216..68e060c778 100644 --- a/src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/processing/GregtechMetaTileEntity_IndustrialArcFurnace.java +++ b/src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/processing/GregtechMetaTileEntity_IndustrialArcFurnace.java @@ -137,13 +137,13 @@ extends GregtechMeta_MultiBlockBase { int depth = 1; int mPlascreteCount = 0; for (int i = 1; i < 4; i++) { - Block tBlock = aBaseMetaTileEntity.getBlockOffset(i, 0, 0); - int tMeta = aBaseMetaTileEntity.getMetaIDOffset(i, 0, 0); - if (tBlock == ModBlocks.blockCasings3Misc && tMeta == 1) { - Logger.INFO("Found Correct Top Casing at offset "+i); + if (aBaseMetaTileEntity.getAirOffset(i, -1, 0)) { + Logger.INFO("aitfound "+i); continue; } - else { + Block tBlock = aBaseMetaTileEntity.getBlockOffset(i, -1, 0); + int tMeta = aBaseMetaTileEntity.getMetaIDOffset(i, -1, 0); + { if (isValidCasingBlock(tBlock, tMeta)) { x = i; z = i; @@ -176,7 +176,7 @@ extends GregtechMeta_MultiBlockBase { } //!addToMachineList(tTileEntity, mCasingTextureID) if (depth >= -1) { - Logger.INFO("Structure is not 5 blocks or taller."); + Logger.INFO("Structure is not 5 blocks or taller. depth = "+depth); return false; } @@ -207,7 +207,7 @@ extends GregtechMeta_MultiBlockBase { } else if (dY < 0) { //Check Walls - if (dX == -x || dX == x || dZ == -z || dZ == z) { + if (dY != depth && (dX == -x || dX == x || dZ == -z || dZ == z)) { if (!isValidCasingBlock(tBlock, tMeta) && !addToMachineList(tTileEntity, mCasingTextureID)) { Logger.INFO("Found Incorrect Wall Casing at offset X:"+dX+" | Y:"+dY+" | Z:"+dZ); return false; diff --git a/src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/processing/GregtechMetaTileEntity_IndustrialMixer.java b/src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/processing/GregtechMetaTileEntity_IndustrialMixer.java index 6e4c071ecb..0c7067b3c0 100644 --- a/src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/processing/GregtechMetaTileEntity_IndustrialMixer.java +++ b/src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/processing/GregtechMetaTileEntity_IndustrialMixer.java @@ -14,6 +14,7 @@ import gregtech.api.util.GT_Recipe; import gregtech.api.util.GT_Utility; import gtPlusPlus.api.objects.Logger; import gtPlusPlus.core.block.ModBlocks; +import gtPlusPlus.core.util.data.ArrayUtils; import gtPlusPlus.core.util.minecraft.ItemUtils; import gtPlusPlus.xmod.gregtech.api.metatileentity.implementations.base.GregtechMeta_MultiBlockBase; import gtPlusPlus.xmod.gregtech.common.blocks.textures.TexturesGtBlock; @@ -128,7 +129,7 @@ extends GregtechMeta_MultiBlockBase { } if (inputs.length > 0) { log("Recipe. ["+inputs.length+"]["+getMaxParallelRecipes()+"]"); - if (checkRecipeGeneric(inputs, new FluidStack[]{}, getMaxParallelRecipes(), getEuDiscountForParallelism(), 250, 10000)) { + if (checkRecipeGeneric(inputs, (FluidStack[]) ArrayUtils.getArrayFromArrayList(this.getStoredFluids()), getMaxParallelRecipes(), getEuDiscountForParallelism(), 250, 10000)) { log("Recipe 2."); return true; } diff --git a/src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/processing/GregtechMetaTileEntity_IndustrialMultiMachine.java b/src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/processing/GregtechMetaTileEntity_IndustrialMultiMachine.java index b071c77d15..05aec14500 100644 --- a/src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/processing/GregtechMetaTileEntity_IndustrialMultiMachine.java +++ b/src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/processing/GregtechMetaTileEntity_IndustrialMultiMachine.java @@ -55,12 +55,12 @@ extends GregtechMeta_MultiBlockBase { 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_REPLICATOR = 8; + 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]; static { - for (int id = 0; id < 8; id++) { + for (int id = 0; id < 9; id++) { String aNEI = GT_LanguageManager.getTranslation(getRecipeMap(id).mUnlocalizedName); aToolTipNames[id] = aNEI != null ? aNEI : "BAD NEI NAME (Report to Github)"; } @@ -143,7 +143,17 @@ extends GregtechMeta_MultiBlockBase { tBusItems.add(tBus.getBaseMetaTileEntity().getStackInSlot(i)); } } - + + boolean aFoundCircuitInBus = false; + for (ItemStack aBusItem : tBusItems) { + if (ItemUtils.isControlCircuit(aBusItem)) { + aFoundCircuitInBus = true; + } + } + if (!aFoundCircuitInBus) { + continue; + } + Object[] tempArray = tFluids.toArray(new FluidStack[] {}); FluidStack[] properArray; properArray = ((tempArray != null && tempArray.length > 0) ? (FluidStack[]) tempArray : new FluidStack[] {}); @@ -188,7 +198,7 @@ extends GregtechMeta_MultiBlockBase { if (!isValidBlockForStructure(tTileEntity, getTextureIndex(), true, aBlock, aMeta, ModBlocks.blockCasings3Misc, 2)) { - Logger.INFO("Bad centrifuge casing"); + Logger.INFO("Bad casing"); return false; } ++tAmount; @@ -287,16 +297,14 @@ extends GregtechMeta_MultiBlockBase { else if (aMode == MODE_AUTOCLAVE) { return GT_Recipe.GT_Recipe_Map.sAutoclaveRecipes; } - else if (aMode == MODE_REPLICATOR) { - return null; + else if (aMode == MODE_FLUIDSOLIDIFY) { + return GT_Recipe.GT_Recipe_Map.sFluidSolidficationRecipes; } else { return null; } } - private final AutoMap<ItemStack> mReplicatorOutputMap = new AutoMap<ItemStack>(); - @Override public boolean checkRecipeGeneric( ItemStack[] aItemInputs, FluidStack[] aFluidInputs, @@ -311,12 +319,6 @@ extends GregtechMeta_MultiBlockBase { Logger.MACHINE_INFO("Mode: "+tCircuitID); - // Time to Defer to Special Handling if it's in replicator mode. - if (tCircuitID == MODE_REPLICATOR) { - return false; - // return checkReplicatorRecipe(aItemInputs, aFluidInputs, aMaxParallelRecipes, aEUPercent, aSpeedBonusPercent, aOutputChanceRoll); - } - // Reset outputs and progress stats this.mEUt = 0; this.mMaxProgresstime = 0; @@ -480,396 +482,6 @@ extends GregtechMeta_MultiBlockBase { return true; } - private FluidStack mReplicatorFluidOutput; - //Replicator handling - public boolean checkReplicatorRecipe( - ItemStack[] aItemInputs, FluidStack[] aFluidInputs, - int aMaxParallelRecipes, int aEUPercent, - int aSpeedBonusPercent, int aOutputChanceRoll) { - - // Based on the Processing Array. A bit overkill, but very flexible. - // Reset outputs and progress stats - this.mEUt = 0; - this.mMaxProgresstime = 0; - this.mOutputItems = new ItemStack[]{}; - this.mOutputFluids = new FluidStack[]{}; - this.mReplicatorOutputMap.clear(); - - long tVoltage = getMaxInputVoltage(); - byte tTier = (byte) Math.max(1, GT_Utility.getTier(tVoltage)); - - if (canBufferOutputs(aItemInputs, aMaxParallelRecipes)) { - Logger.WARNING("BAD RETURN - 2.0"); - return false; - } - - ItemStack tDataOrb = null; - ItemStack tCellStack = null; - ItemStack tReplicatedItem; - FluidStack tOutputFluid = null; - FluidStack tInputFluid = null; - final Materials tMaterial = Element.get(Behaviour_DataOrb.getDataName(tDataOrb)).mLinkedMaterials.get(0); - final long tMass = tMaterial.getMass(); - - // Find First Data Orb with Scan Data - for (ItemStack I : aItemInputs) { - if (ItemList.Tool_DataOrb.isStackEqual((Object) I, false, true) && Behaviour_DataOrb.getDataTitle(I).equals("Elemental-Scan")) { - tDataOrb = I.copy(); - break; - } - } - - // Find First empty cell stack - for (ItemStack I : aItemInputs) { - if (ItemList.Cell_Empty.isStackEqual((Object) I)) { - tCellStack = I.copy(); - break; - } - } - - // Find UUM - for (FluidStack F : aFluidInputs) { - if (F != null && F.isFluidEqual(Materials.UUMatter.getFluid(1L))) { - final FluidStack tFluid = F; - if (tFluid.amount >= tMass && tMass > 0L) { - tInputFluid = tFluid; - } - } - } - - // No Data Orb or UUM found? - if (tDataOrb == null || tInputFluid == null) { - return false; - } - // Temp Values - int tEUt = (int) GT_Values.V[(int) this.getInputTier()]; - int tMaxProgresstime = (int) (tMass * 512L / (1 << tTier - 1)); - float tRecipeEUt = (tEUt * aEUPercent) / 100.0f; - float tTotalEUt = 0.0f; - int parallelRecipes = 0; - ItemStack[] expectedInputs = {tDataOrb}; - FluidStack[] expectedFluidInputs = {Materials.UUMatter.getFluid(tMass)}; - - /** - * Magic - */ - - int COST_UUM = 0; - int COST_CELLS = 0; - - // Determine Output Item & Cost. - if ((tReplicatedItem = GT_OreDictUnificator.get(OrePrefixes.dust, (Object) tMaterial, 1L)) == null) { - if ((tReplicatedItem = GT_OreDictUnificator.get(OrePrefixes.cell, (Object) tMaterial, 1L)) != null) { - if ((tOutputFluid = GT_Utility.getFluidForFilledItem(tReplicatedItem, true)) == null) { - if (ItemList.Cell_Empty.isStackEqual((Object) tCellStack) && this.canBufferOutputs(new ItemStack[]{tReplicatedItem}, 1)) { - COST_CELLS = 1; - COST_UUM = (int) tMass; - } - } else { - tReplicatedItem = null; - if (this.getDrainableStack() == null || (this.getDrainableStack().isFluidEqual(tOutputFluid) && this.getDrainableStack().amount < 16000)) { - COST_UUM = (int) tMass; - } - } - } - } else if (this.canBufferOutputs(new ItemStack[]{tReplicatedItem}, 1)) { - COST_UUM = (int) tMass; - } - - // Costs no UUM and no valid outputs? Let's bail gracefully before we consume inputs. - if (COST_UUM <= 0 || (tReplicatedItem == null && tOutputFluid == null)) { - return false; - } - - // Count recipes to do in parallel, consuming input items and fluids and considering input voltage limits - for (; parallelRecipes < aMaxParallelRecipes && tTotalEUt < (tVoltage - tRecipeEUt); parallelRecipes++) { - if (!isRecipeInputEqual(true, aFluidInputs, aItemInputs, expectedFluidInputs, expectedInputs)) { - Logger.WARNING("Broke at "+parallelRecipes+"..0"); - break; - } - Logger.WARNING("Bumped EU from "+tTotalEUt+" to "+(tTotalEUt+tRecipeEUt)+"..0"); - tTotalEUt += tRecipeEUt; - } - - if (parallelRecipes == 0) { - Logger.WARNING("BAD RETURN - 3.0"); - return false; - } - - // Set Vars to Parralel amount - COST_CELLS *= parallelRecipes; - - // Requires a cell? Ok, let's use some. - if (COST_CELLS > 0) { - this.depleteInput(ItemUtils.getEmptyCell(COST_CELLS)); - } - - // Build an output map, for simplicity. - for (int r=0;r<parallelRecipes;r++) { - this.mReplicatorOutputMap.put(ItemUtils.getSimpleStack(tReplicatedItem, 1)); - } - - // -- Try not to fail after this point - inputs have already been consumed! -- - ItemStack[] mBuiltOutput = new ItemStack[this.mReplicatorOutputMap.size()]; - int aIndex = 0; - for (ItemStack i : this.mReplicatorOutputMap) { - mBuiltOutput[aIndex++] = i; - } - - - // Convert speed bonus to duration multiplier - // e.g. 100% speed bonus = 200% speed = 100%/200% = 50% recipe duration. - aSpeedBonusPercent = Math.max(-99, aSpeedBonusPercent); - float tTimeFactor = 100.0f / (100.0f + aSpeedBonusPercent); - this.mMaxProgresstime = (int)(tMaxProgresstime * tTimeFactor); - - this.mEUt = (int)Math.ceil(tTotalEUt); - - this.mEfficiency = (10000 - (getIdealStatus() - getRepairStatus()) * 1000); - this.mEfficiencyIncrease = 10000; - - // Overclock - if (this.mEUt <= 16) { - this.mEUt = (this.mEUt * (1 << tTier - 1) * (1 << tTier - 1)); - this.mMaxProgresstime = (this.mMaxProgresstime / (1 << tTier - 1)); - } else { - while (this.mEUt <= gregtech.api.enums.GT_Values.V[(tTier - 1)]) { - this.mEUt *= 4; - this.mMaxProgresstime /= 2; - } - } - - if (this.mEUt > 0) { - this.mEUt = (-this.mEUt); - } - - this.mMaxProgresstime = Math.max(1, this.mMaxProgresstime); - - // Collect output item types - ItemStack[] tOutputItems = new ItemStack[1]; - for (int h = 0; h < 1; h++) { - if (mBuiltOutput[h] != null) { - tOutputItems[h] = mBuiltOutput[h].copy(); - tOutputItems[h].stackSize = 0; - } - } - - // Set output item stack sizes (taking output chance into account) - for (int f = 0; f < tOutputItems.length; f++) { - if (mBuiltOutput[f] != null && tOutputItems[f] != null) { - for (int g = 0; g < parallelRecipes; g++) { - tOutputItems[f].stackSize += mBuiltOutput[f].stackSize; - } - } - } - - tOutputItems = removeNulls(tOutputItems); - - // Sanitize item stack size, splitting any stacks greater than max stack size - List<ItemStack> splitStacks = new ArrayList<ItemStack>(); - for (ItemStack tItem : tOutputItems) { - while (tItem.getMaxStackSize() < tItem.stackSize) { - ItemStack tmp = tItem.copy(); - tmp.stackSize = tmp.getMaxStackSize(); - tItem.stackSize = tItem.stackSize - tItem.getMaxStackSize(); - splitStacks.add(tmp); - } - } - - if (splitStacks.size() > 0) { - ItemStack[] tmp = new ItemStack[splitStacks.size()]; - tmp = splitStacks.toArray(tmp); - tOutputItems = ArrayUtils.addAll(tOutputItems, tmp); - } - - // Strip empty stacks - List<ItemStack> tSList = new ArrayList<ItemStack>(); - for (ItemStack tS : tOutputItems) { - if (tS.stackSize > 0) tSList.add(tS); - } - tOutputItems = tSList.toArray(new ItemStack[tSList.size()]); - - // Commit outputs - this.mOutputItems = tOutputItems; - //this.mOutputFluids = tOutputFluids; - updateSlots(); - - // Play sounds (GT++ addition - GT multiblocks play no sounds) - startProcess(); - - Logger.WARNING("GOOD RETURN - 1.0"); - return true; - } - - - //Special Space Checking - private boolean canBufferOutputs(ItemStack[] aInputs, int aParallelRecipes) { - // Count slots available in output buses - ArrayList<ItemStack> tBusStacks = new ArrayList<>(); - - int tEmptySlots = 0; - for (final GT_MetaTileEntity_Hatch_OutputBus tBus : this.mOutputBusses) { - if (!isValidMetaTileEntity(tBus)) { - continue; - } - final IInventory tBusInv = tBus.getBaseMetaTileEntity(); - for (int i = 0; i < tBusInv.getSizeInventory(); i++) { - if (tBus.getStackInSlot(i) == null) { - tEmptySlots++; - } - else { - tBusStacks.add(tBus.getStackInSlot(i)); - } - } - } - - int slotsNeeded = aInputs.length; - for (final ItemStack tRecipeOutput: aInputs) { - if (tRecipeOutput == null) continue; - int amount = tRecipeOutput.stackSize * aParallelRecipes; - for (final ItemStack tBusStack : tBusStacks) { - if (GT_Utility.areStacksEqual(tBusStack, tRecipeOutput)) { - if (tBusStack.stackSize + amount <= tBusStack.getMaxStackSize()) { - slotsNeeded--; - break; - } - } - } - } - // Enough open slots? - if (tEmptySlots < slotsNeeded) return false; - return true; - - } - - public FluidStack getDrainableStack() { - return this.mReplicatorFluidOutput; - } - - public FluidStack setDrainableStack(final FluidStack aFluid) { - return this.mReplicatorFluidOutput = aFluid; - } - - public boolean isRecipeInputEqual(final boolean aDecreaseStacksizeBySuccess, - final FluidStack[] aFluidInputs, - final ItemStack[] aInputs, - final FluidStack[] mFluidInputs, - final ItemStack[] mInputs) { - return this.isRecipeInputEqual(aDecreaseStacksizeBySuccess, false, aFluidInputs, aInputs, mFluidInputs, mInputs); - } - - public boolean isRecipeInputEqual( - final boolean aDecreaseStacksizeBySuccess, - final boolean aDontCheckStackSizes, - final FluidStack[] aFluidInputs, - final ItemStack[] aInputs, - final FluidStack[] aExpectedFluidInputs, - final ItemStack[] mExpectedInputs) { - if (aExpectedFluidInputs.length > 0 && aFluidInputs == null) { - return false; - } - for (final FluidStack tFluid : aExpectedFluidInputs) { - if (tFluid != null) { - boolean temp = true; - int amt = tFluid.amount; - for (final FluidStack aFluid : aFluidInputs) { - if (aFluid != null && aFluid.isFluidEqual(tFluid)) { - if (aDontCheckStackSizes) { - temp = false; - break; - } - amt -= aFluid.amount; - if (amt < 1) { - temp = false; - break; - } - } - } - if (temp) { - return false; - } - } - } - if (mExpectedInputs.length > 0 && aInputs == null) { - return false; - } - for (final ItemStack tStack : mExpectedInputs) { - if (tStack != null) { - int amt = tStack.stackSize; - boolean temp = true; - for (final ItemStack aStack : aInputs) { - if (GT_Utility.areUnificationsEqual(aStack, tStack, true) - || GT_Utility.areUnificationsEqual(GT_OreDictUnificator.get(false, aStack), tStack, true)) { - if (aDontCheckStackSizes) { - temp = false; - break; - } - amt -= aStack.stackSize; - if (amt < 1) { - temp = false; - break; - } - } - } - if (temp) { - return false; - } - } - } - if (aDecreaseStacksizeBySuccess) { - if (aFluidInputs != null) { - for (final FluidStack tFluid : aExpectedFluidInputs) { - if (tFluid != null) { - int amt = tFluid.amount; - for (final FluidStack aFluid2 : aFluidInputs) { - if (aFluid2 != null && aFluid2.isFluidEqual(tFluid)) { - if (aDontCheckStackSizes) { - final FluidStack fluidStack = aFluid2; - fluidStack.amount -= amt; - break; - } - if (aFluid2.amount >= amt) { - final FluidStack fluidStack2 = aFluid2; - fluidStack2.amount -= amt; - amt = 0; - break; - } - amt -= aFluid2.amount; - aFluid2.amount = 0; - } - } - } - } - } - if (aInputs != null) { - for (final ItemStack tStack : mExpectedInputs) { - if (tStack != null) { - int amt = tStack.stackSize; - for (final ItemStack aStack2 : aInputs) { - if (GT_Utility.areUnificationsEqual(aStack2, tStack, true) || GT_Utility - .areUnificationsEqual(GT_OreDictUnificator.get(false, aStack2), tStack, true)) { - if (aDontCheckStackSizes) { - final ItemStack itemStack = aStack2; - itemStack.stackSize -= amt; - break; - } - if (aStack2.stackSize >= amt) { - final ItemStack itemStack2 = aStack2; - itemStack2.stackSize -= amt; - amt = 0; - break; - } - amt -= aStack2.stackSize; - aStack2.stackSize = 0; - } - } - } - } - } - } - return true; - } - @Override public void onModeChangeByScrewdriver(byte aSide, EntityPlayer aPlayer, float aX, float aY, float aZ) { if (mInternalMode < 2) { diff --git a/src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/processing/GregtechMetaTileEntity_IndustrialWashPlant.java b/src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/processing/GregtechMetaTileEntity_IndustrialWashPlant.java index ce1fe57e63..ca6eeda207 100644 --- a/src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/processing/GregtechMetaTileEntity_IndustrialWashPlant.java +++ b/src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/processing/GregtechMetaTileEntity_IndustrialWashPlant.java @@ -56,13 +56,14 @@ extends GregtechMeta_MultiBlockBase { "Can be configured with a screwdriver to also process Chemical Bathing", "400% faster than using single block machines of the same voltage", "Processes four item per voltage tier", + "Always requires an Input Hatch full of water to refill structure", "Size: 5x3x7 [WxHxL] (open)", "X X", "X X", "XXXXX", "Controller (front centered)", "1x Input Bus (Any casing)", - "1x Input Hatch (Any casing)", + "2x Input Hatch (Any casing)", "1x Output Bus (Any casing)", "1x Energy Hatch (Any casing)", "Wash Plant Casings for the rest" diff --git a/src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/processing/advanced/GregtechMetaTileEntity_Adv_EBF.java b/src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/processing/advanced/GregtechMetaTileEntity_Adv_EBF.java index 133e10d6f6..96a85a3d1c 100644 --- a/src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/processing/advanced/GregtechMetaTileEntity_Adv_EBF.java +++ b/src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/processing/advanced/GregtechMetaTileEntity_Adv_EBF.java @@ -86,7 +86,7 @@ public class GregtechMetaTileEntity_Adv_EBF extends GregtechMeta_MultiBlockBase "Speed: 120% | Eu Usage: 90% | Parallel: 8", "Consumes 10L of " + mHotFuelName + " per second during operation", "Constructed exactly the same as a normal EBF", - "Use "+mCasingName+"s (10 at least!)", + "Use "+mCasingName+"s (9 at least!)", "1x " + mHatchName + " (Required)", "TAG_HIDE_HATCHES" }; @@ -208,7 +208,7 @@ public class GregtechMetaTileEntity_Adv_EBF extends GregtechMeta_MultiBlockBase } } - return aCasingCount >= 10; + return aCasingCount >= 9; } public int getMaxEfficiency(ItemStack aStack) { diff --git a/src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/production/GT4Entity_AutoCrafter.java b/src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/production/GT4Entity_AutoCrafter.java index f24825ba8a..9754eebbb8 100644 --- a/src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/production/GT4Entity_AutoCrafter.java +++ b/src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/production/GT4Entity_AutoCrafter.java @@ -33,6 +33,7 @@ import gtPlusPlus.xmod.gregtech.api.metatileentity.implementations.base.Gregtech import gtPlusPlus.xmod.gregtech.common.helpers.CraftingHelper; import gtPlusPlus.xmod.gregtech.common.helpers.autocrafter.AC_Helper_Utils; import net.minecraftforge.common.util.ForgeDirection; +import net.minecraftforge.fluids.FluidStack; public class GT4Entity_AutoCrafter extends GregtechMeta_MultiBlockBase { @@ -269,20 +270,53 @@ public class GT4Entity_AutoCrafter extends GregtechMeta_MultiBlockBase { } } +// @Override +// public boolean checkRecipe(final ItemStack aStack) { +// +// final long tVoltage = this.getMaxInputVoltage(); +// final byte tTier = this.mTier = (byte) Math.max(1, GT_Utility.getTier(tVoltage)); +// +// if (mMachineMode == MODE.DISASSEMBLY) { +// return doDisassembly(); +// } else if (mMachineMode == MODE.CRAFTING) { +// return doCrafting(aStack); +// } else { +// return super.checkRecipeGeneric(getMaxParallelRecipes(), 100, 200); +// } +// } + @Override public boolean checkRecipe(final ItemStack aStack) { - - final long tVoltage = this.getMaxInputVoltage(); - final byte tTier = this.mTier = (byte) Math.max(1, GT_Utility.getTier(tVoltage)); - if (mMachineMode == MODE.DISASSEMBLY) { return doDisassembly(); } else if (mMachineMode == MODE.CRAFTING) { return doCrafting(aStack); } else { - return super.checkRecipeGeneric(getMaxParallelRecipes(), 100, 200); + ArrayList<FluidStack> tFluids = getStoredFluids(); + //Logger.MACHINE_INFO("1"); + for (GT_MetaTileEntity_Hatch_InputBus tBus : mInputBusses) { + ArrayList<ItemStack> tBusItems = new ArrayList<ItemStack>(); + tBus.mRecipeMap = getRecipeMap(); + //Logger.MACHINE_INFO("2"); + if (isValidMetaTileEntity(tBus)) { + //Logger.MACHINE_INFO("3"); + for (int i = tBus.getBaseMetaTileEntity().getSizeInventory() - 1; i >= 0; i--) { + if (tBus.getBaseMetaTileEntity().getStackInSlot(i) != null) + tBusItems.add(tBus.getBaseMetaTileEntity().getStackInSlot(i)); + } + } + + Object[] tempArray = tFluids.toArray(new FluidStack[] {}); + FluidStack[] properArray; + properArray = ((tempArray != null && tempArray.length > 0) ? (FluidStack[]) tempArray : new FluidStack[] {}); + + //Logger.MACHINE_INFO("4"); + if (checkRecipeGeneric(tBusItems.toArray(new ItemStack[]{}), properArray, + getMaxParallelRecipes(), 100, 200, 10000)) return true; + } + return false; } - } + } @Override public int getMaxParallelRecipes() { diff --git a/src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/production/GregtechMTE_LargeNaqReactor.java b/src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/production/GregtechMTE_LargeNaqReactor.java index 89bb00f64d..1d3591731a 100644 --- a/src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/production/GregtechMTE_LargeNaqReactor.java +++ b/src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/production/GregtechMTE_LargeNaqReactor.java @@ -1,6 +1,5 @@ package gtPlusPlus.xmod.gregtech.common.tileentities.machines.multi.production; -import java.lang.reflect.InvocationTargetException; import java.util.ArrayList; import gregtech.api.GregTech_API; @@ -10,35 +9,45 @@ import gregtech.api.gui.GT_GUIContainer_MultiMachine; import gregtech.api.interfaces.ITexture; import gregtech.api.interfaces.metatileentity.IMetaTileEntity; import gregtech.api.interfaces.tileentity.IGregTechTileEntity; -import gregtech.api.metatileentity.implementations.GT_MetaTileEntity_Hatch; import gregtech.api.objects.GT_RenderedTexture; import gregtech.api.util.GT_Recipe.GT_Recipe_Map; import gregtech.api.util.GT_Utility; +import gtPlusPlus.api.objects.Logger; import gtPlusPlus.core.block.ModBlocks; -import gtPlusPlus.core.util.minecraft.ItemUtils; +import gtPlusPlus.core.util.minecraft.LangUtils; +import gtPlusPlus.core.util.minecraft.PlayerUtils; import gtPlusPlus.xmod.gregtech.api.metatileentity.implementations.GT_MetaTileEntity_Hatch_Naquadah; import gtPlusPlus.xmod.gregtech.api.metatileentity.implementations.base.GregtechMeta_MultiBlockBase; import gtPlusPlus.xmod.gregtech.common.blocks.textures.TexturesGtBlock; -import gtPlusPlus.xmod.gregtech.common.tileentities.machines.multi.processing.advanced.GregtechMetaTileEntity_Adv_Fusion_MK4; import net.minecraft.block.Block; +import net.minecraft.entity.player.EntityPlayer; import net.minecraft.entity.player.InventoryPlayer; +import net.minecraft.init.Blocks; import net.minecraft.item.ItemStack; import net.minecraftforge.common.util.ForgeDirection; public class GregtechMTE_LargeNaqReactor extends GregtechMeta_MultiBlockBase { - + public ArrayList<GT_MetaTileEntity_Hatch_Naquadah> mNaqHatches = new ArrayList<GT_MetaTileEntity_Hatch_Naquadah>(); public static String[] mCasingName = new String[5]; - public static String mHatchName = "Naquadah Fuel Hatch"; + public static String mHatchName = "Naquadah Fuel Hatch"; + + private final int CASING_TEXTURE_ID = TAE.getIndexFromPage(0, 13); + private final int META_BaseCasing = 0; //4 + private final int META_ContainmentCasing = 15; //3 + private final int META_Shielding = 13; //1 + private final int META_PipeCasing = 1; //4 + private final int META_IntegralCasing = 6; //0 + private final int META_ContainmentChamberCasing = 2; //4 public GregtechMTE_LargeNaqReactor(int aID, String aName, String aNameRegional) { super(aID, aName, aNameRegional); - mCasingName[0] = ItemUtils.getLocalizedNameOfBlock(getCasing(4), 0); - mCasingName[1] = ItemUtils.getLocalizedNameOfBlock(getCasing(4), 1); - mCasingName[2] = ItemUtils.getLocalizedNameOfBlock(getCasing(4), 2); - mCasingName[3] = ItemUtils.getLocalizedNameOfBlock(getCasing(3), 15); - mCasingName[4] = ItemUtils.getLocalizedNameOfBlock(getCasing(3), 3); - mHatchName = ItemUtils.getLocalizedNameOfBlock(GregTech_API.sBlockMachines, 969); + mCasingName[0] = LangUtils.getLocalizedNameOfBlock(getCasing(4), 0); + mCasingName[1] = LangUtils.getLocalizedNameOfBlock(getCasing(4), 1); + mCasingName[2] = LangUtils.getLocalizedNameOfBlock(getCasing(4), 2); + mCasingName[3] = LangUtils.getLocalizedNameOfBlock(getCasing(3), 15); + mCasingName[4] = LangUtils.getLocalizedNameOfBlock(getCasing(1), 13); + mHatchName = LangUtils.getLocalizedNameOfBlock(GregTech_API.sBlockMachines, 969); } public GregtechMTE_LargeNaqReactor(String aName) { @@ -51,22 +60,22 @@ public class GregtechMTE_LargeNaqReactor extends GregtechMeta_MultiBlockBase { public String[] getTooltip() { if (mCasingName[0].toLowerCase().contains(".name")) { - mCasingName[0] = ItemUtils.getLocalizedNameOfBlock(getCasing(4), 0); + mCasingName[0] = LangUtils.getLocalizedNameOfBlock(getCasing(4), 0); } if (mCasingName[1].toLowerCase().contains(".name")) { - mCasingName[1] = ItemUtils.getLocalizedNameOfBlock(getCasing(4), 1); + mCasingName[1] = LangUtils.getLocalizedNameOfBlock(getCasing(4), 1); } if (mCasingName[2].toLowerCase().contains(".name")) { - mCasingName[2] = ItemUtils.getLocalizedNameOfBlock(getCasing(4), 2); + mCasingName[2] = LangUtils.getLocalizedNameOfBlock(getCasing(4), 2); } if (mCasingName[3].toLowerCase().contains(".name")) { - mCasingName[3] = ItemUtils.getLocalizedNameOfBlock(getCasing(3), 15); + mCasingName[3] = LangUtils.getLocalizedNameOfBlock(getCasing(3), 15); } if (mCasingName[4].toLowerCase().contains(".name")) { - mCasingName[4] = ItemUtils.getLocalizedNameOfBlock(getCasing(3), 3); + mCasingName[4] = LangUtils.getLocalizedNameOfBlock(getCasing(1), 13); } if (mHatchName.toLowerCase().contains(".name")) { - mHatchName = ItemUtils.getLocalizedNameOfBlock(GregTech_API.sBlockMachines, 969); + mHatchName = LangUtils.getLocalizedNameOfBlock(GregTech_API.sBlockMachines, 969); } return new String[]{ "Naquadah reacts violently with potassium, ", @@ -83,18 +92,18 @@ public class GregtechMTE_LargeNaqReactor extends GregtechMeta_MultiBlockBase { "1x " + mHatchName + " (Any bottom layer casing)", "1x " + "Maintenance Hatch" + " (Any bottom layer side casing)", "1x " + "Energy Hatch" + " (Any top layer casing)", - - }; + + }; } public ITexture[] getTexture(IGregTechTileEntity aBaseMetaTileEntity, byte aSide, byte aFacing, byte aColorIndex, boolean aActive, boolean aRedstone) { return aSide == aFacing - ? new ITexture[]{BlockIcons.CASING_BLOCKS[TAE.getIndexFromPage(2, 3)], + ? new ITexture[]{BlockIcons.CASING_BLOCKS[TAE.getIndexFromPage(3, 0)], new GT_RenderedTexture(aActive ? TexturesGtBlock.Overlay_Machine_Controller_Default_Active - : TexturesGtBlock.Overlay_Machine_Controller_Default)} - : new ITexture[]{BlockIcons.CASING_BLOCKS[TAE.getIndexFromPage(2, 3)]}; + : TexturesGtBlock.Overlay_Machine_Controller_Default)} + : new ITexture[]{BlockIcons.CASING_BLOCKS[TAE.getIndexFromPage(3, 0)]}; } public Object getClientGUI(int aID, InventoryPlayer aPlayerInventory, IGregTechTileEntity aBaseMetaTileEntity) { @@ -111,13 +120,13 @@ public class GregtechMTE_LargeNaqReactor extends GregtechMeta_MultiBlockBase { } public boolean isFacingValid(byte aFacing) { - return aFacing > 1; + return aFacing == 1; } public boolean checkRecipe(ItemStack aStack) { return false; } - + @Override public int getMaxParallelRecipes() { return 1; @@ -140,7 +149,7 @@ public class GregtechMTE_LargeNaqReactor extends GregtechMeta_MultiBlockBase { public String getSound() { return (String) GregTech_API.sSoundList.get(Integer.valueOf(212)); } - + private Block getCasing(int casingID) { if (casingID == 1) { return ModBlocks.blockCasingsMisc; @@ -155,12 +164,12 @@ public class GregtechMTE_LargeNaqReactor extends GregtechMeta_MultiBlockBase { return ModBlocks.blockCasings4Misc; } else { - return ModBlocks.blockCasingsMisc; + return ModBlocks.blockCasingsTieredGTPP; } } - - - + + + //Casing3, Meta 10 - "Grate Machine Casing"); //Casing2, Meta 0 - "Solid Steel Machine Casing" //Casing2, Meta 5 - "Assembling Line Casing" @@ -168,185 +177,295 @@ public class GregtechMTE_LargeNaqReactor extends GregtechMeta_MultiBlockBase { //Magic Glass - blockAlloyGlass public boolean checkMultiblock(IGregTechTileEntity aBaseMetaTileEntity, ItemStack aStack) { - int xDir = ForgeDirection.getOrientation(aBaseMetaTileEntity.getBackFacing()).offsetX; - int zDir = ForgeDirection.getOrientation(aBaseMetaTileEntity.getBackFacing()).offsetZ; - int r; - int i; - IGregTechTileEntity tTileEntity; - if (xDir != 0) { - for (r = 0; r <= 16; ++r) { - i = r * xDir; - tTileEntity = aBaseMetaTileEntity.getIGregTechTileEntityOffset(0, 0, i); - if (i != 0 - && (aBaseMetaTileEntity.getBlockOffset(0, 0, i) != getCasing(3) - || aBaseMetaTileEntity.getMetaIDOffset(0, 0, i) != 3) - && r == 1 && !this.addNaquadahHatchToMachineInput(tTileEntity, TAE.getIndexFromPage(2, 3))) { - return false; - } - - if (aBaseMetaTileEntity.getBlockOffset(0, -1, i) != getCasing(3) || aBaseMetaTileEntity.getMetaIDOffset(0, -1, i) != 15) { - return false; - } - - tTileEntity = aBaseMetaTileEntity.getIGregTechTileEntityOffset(0, -2, i); - if (!this.addMaintenanceToMachineList(tTileEntity, TAE.getIndexFromPage(3, 0)) - && !this.addInputToMachineList(tTileEntity, TAE.getIndexFromPage(3, 0))) { - if (aBaseMetaTileEntity.getBlockOffset(0, -2, i) != getCasing(4)) { - return false; - } - - if (aBaseMetaTileEntity.getMetaIDOffset(0, -2, i) != 0) { - return false; - } - } - - tTileEntity = aBaseMetaTileEntity.getIGregTechTileEntityOffset(xDir, 1, i); - if (!this.addDynamoToMachineList(tTileEntity, TAE.getIndexFromPage(3, 0))) { - if (aBaseMetaTileEntity.getBlockOffset(xDir, 1, i) != getCasing(4)) { - return false; - } - - if (aBaseMetaTileEntity.getMetaIDOffset(xDir, 1, i) != 0) { - return false; - } - } - - if (i != 0 && (aBaseMetaTileEntity.getBlockOffset(xDir, 0, i) != getCasing(4) - || aBaseMetaTileEntity.getMetaIDOffset(xDir, 0, i) != 1)) { - return false; - } - - if (i != 0 && (aBaseMetaTileEntity.getBlockOffset(xDir, -1, i) != getCasing(4) - || aBaseMetaTileEntity.getMetaIDOffset(xDir, -1, i) != 2)) { - return false; - } - - if (aBaseMetaTileEntity.getBlockOffset(xDir * 2, 0, i) != getCasing(3) - || aBaseMetaTileEntity.getMetaIDOffset(xDir * 2, 0, i) != 3) { - return false; - } - - if (aBaseMetaTileEntity.getBlockOffset(xDir * 2, -1, i) != getCasing(3) || aBaseMetaTileEntity.getMetaIDOffset(xDir * 2, -1, i) != 15) { - return false; - } - - tTileEntity = aBaseMetaTileEntity.getIGregTechTileEntityOffset(xDir * 2, -2, i); - if (!this.addMaintenanceToMachineList(tTileEntity, TAE.getIndexFromPage(3, 0)) - && !this.addInputToMachineList(tTileEntity, TAE.getIndexFromPage(3, 0))) { - if (aBaseMetaTileEntity.getBlockOffset(xDir * 2, -2, i) != getCasing(4)) { - return false; - } - - if (aBaseMetaTileEntity.getMetaIDOffset(xDir * 2, -2, i) != 0) { - return false; - } - } - - tTileEntity = aBaseMetaTileEntity.getIGregTechTileEntityOffset(xDir, -2, i); - if (!this.addInputToMachineList(tTileEntity, TAE.getIndexFromPage(3, 0)) && this.addOutputToMachineList(tTileEntity, TAE.getIndexFromPage(3, 0))) { - return r > 0 && this.mEnergyHatches.size() > 0; - } + int xDir = ForgeDirection.getOrientation(aBaseMetaTileEntity.getBackFacing()).offsetX * 4; + int zDir = ForgeDirection.getOrientation(aBaseMetaTileEntity.getBackFacing()).offsetZ * 4; + + // Counts for all Casing Types + int aBaseCasingCount = 0; + int aContainmentCasingCount = 0; + int aShieldingCount = 0; + int aPipeCount = 0; + int aIntegralCasingCount = 0; + int aContainmentChamberCount = 0; + + // Bottom Layer + aBaseCasingCount += checkEntireLayer(aBaseMetaTileEntity, getCasing(4), META_BaseCasing, -7, xDir, zDir); + log("Bottom Layer is Valid. Moving to Layer 1."); + + // Layer 1 + aShieldingCount += checkOuterRing(aBaseMetaTileEntity, getCasing(1), this.META_Shielding, -6, xDir, zDir); + aIntegralCasingCount += checkIntegralRing(aBaseMetaTileEntity, getCasing(0), this.META_IntegralCasing, -6, xDir, zDir); + aContainmentChamberCount += checkContainmentRing(aBaseMetaTileEntity, getCasing(4), this.META_ContainmentChamberCasing, -6, xDir, zDir); + log("Layer 1 is Valid. Moving to Layer 2."); + + // Layer 2 + aShieldingCount += checkOuterRing(aBaseMetaTileEntity, getCasing(1), this.META_Shielding, -5, xDir, zDir); + aPipeCount += checkPipes(aBaseMetaTileEntity, getCasing(4), this.META_PipeCasing, -5, xDir, zDir); + log("Layer 2 is Valid. Moving to Layer 3."); + + // Layer 3 + aContainmentCasingCount += checkOuterRing(aBaseMetaTileEntity, getCasing(3), this.META_ContainmentCasing, -4, xDir, zDir); + aPipeCount += checkPipes(aBaseMetaTileEntity, getCasing(4), this.META_PipeCasing, -4, xDir, zDir); + log("Layer 3 is Valid. Moving to Layer 4."); + + // Layer 4 + aContainmentCasingCount += checkOuterRing(aBaseMetaTileEntity, getCasing(3), this.META_ContainmentCasing, -3, xDir, zDir); + aPipeCount += checkPipes(aBaseMetaTileEntity, getCasing(4), this.META_PipeCasing, -3, xDir, zDir); + log("Layer 4 is Valid. Moving to Layer 5."); + + // Layer 5 + aShieldingCount += checkOuterRing(aBaseMetaTileEntity, getCasing(1), this.META_Shielding, -2, xDir, zDir); + aPipeCount += checkPipes(aBaseMetaTileEntity, getCasing(4), this.META_PipeCasing, -2, xDir, zDir); + log("Layer 5 is Valid. Moving to Layer 6."); + + // Layer 6 + aShieldingCount += checkOuterRing(aBaseMetaTileEntity, getCasing(1), this.META_Shielding, -1, xDir, zDir); + aIntegralCasingCount += checkIntegralRing(aBaseMetaTileEntity, getCasing(0), this.META_IntegralCasing, -1, xDir, zDir); + aContainmentChamberCount += checkContainmentRing(aBaseMetaTileEntity, getCasing(4), this.META_ContainmentChamberCasing, -1, xDir, zDir); + log("Layer 6 is Valid. Moving to Top Layer."); + + // Top Layer + aBaseCasingCount += checkEntireLayer(aBaseMetaTileEntity, getCasing(4), META_BaseCasing, 0, xDir, zDir); + + log("Found "+aBaseCasingCount+" "+mCasingName[0]+"s"); + log("Found "+aShieldingCount+" "+mCasingName[4]+"s"); + log("Found "+aPipeCount+" "+mCasingName[1]+"s"); + log("Found "+aContainmentCasingCount+" "+mCasingName[3]+"s"); + log("Found "+aIntegralCasingCount+" "+LangUtils.getLocalizedNameOfBlock(getCasing(0), 6)+"s"); + log("Found "+aContainmentChamberCount+" "+mCasingName[2]+"s"); + + // Try mesage player + String aOwnerName = this.getBaseMetaTileEntity().getOwnerName(); + EntityPlayer aOwner = null; + if (aOwnerName != null && aOwnerName.length() > 0) { + aOwner = PlayerUtils.getPlayer(aOwnerName); + } + + if (aShieldingCount != 128) { + log("Not enough "+mCasingName[4]+"s, require 128."); + if (aOwner != null) { + PlayerUtils.messagePlayer(aOwner, "Not enough "+mCasingName[4]+"s, require 128."); + } + return false; + } + if (aPipeCount != 20) { + log("Not enough "+mCasingName[1]+"s, require 20."); + if (aOwner != null) { + PlayerUtils.messagePlayer(aOwner, "Not enough "+mCasingName[1]+"s, require 20."); + } + return false; + } + if (aContainmentCasingCount != 64) { + log("Not enough "+mCasingName[3]+"s, require 64."); + if (aOwner != null) { + PlayerUtils.messagePlayer(aOwner, "Not enough "+mCasingName[3]+"s, require 64."); + } + return false; + } + if (aContainmentChamberCount != 42) { + log("Not enough "+mCasingName[2]+"s, require 42."); + if (aOwner != null) { + PlayerUtils.messagePlayer(aOwner, "Not enough "+mCasingName[2]+"s, require 42."); } + return false; + } + if (aBaseCasingCount < 140) { + log("Not enough "+mCasingName[0]+"s, require 140 at a minimum."); + if (aOwner != null) { + PlayerUtils.messagePlayer(aOwner, "Not enough "+mCasingName[0]+"s, require 140 at a minimum."); + } + return false; + } + if (aIntegralCasingCount != 48) { + log("Not enough "+LangUtils.getLocalizedNameOfBlock(getCasing(0), 6)+"s, require 48."); + if (aOwner != null) { + PlayerUtils.messagePlayer(aOwner, "Not enough "+LangUtils.getLocalizedNameOfBlock(getCasing(0), 6)+"s, require 48."); + } + return false; + } + log("LNR Formed."); + if (aOwner != null) { + PlayerUtils.messagePlayer(aOwner, "Large Naquadah Reactor has formed successfully."); + } + return true; + } + + public boolean addNaquadahHatchToMachineInput(IGregTechTileEntity aTileEntity, int aBaseCasingIndex) { + if (aTileEntity == null) { + return false; } else { - for (r = 0; r <= 16; ++r) { - i = r * -zDir; - tTileEntity = aBaseMetaTileEntity.getIGregTechTileEntityOffset(i, 0, 0); - if (i != 0 - && (aBaseMetaTileEntity.getBlockOffset(i, 0, 0) != getCasing(3) - || aBaseMetaTileEntity.getMetaIDOffset(i, 0, 0) != 3) - && r == 1 && !this.addNaquadahHatchToMachineInput(tTileEntity, TAE.getIndexFromPage(2, 3))) { - return false; - } + IMetaTileEntity aMetaTileEntity = aTileEntity.getMetaTileEntity(); + if (aMetaTileEntity == null) { + return false; + } else if (aMetaTileEntity instanceof GT_MetaTileEntity_Hatch_Naquadah) { + this.updateTexture(aMetaTileEntity, aBaseCasingIndex); + return this.mNaqHatches.add((GT_MetaTileEntity_Hatch_Naquadah) aMetaTileEntity); + } else { + return false; + } + } + } - if (aBaseMetaTileEntity.getBlockOffset(i, -1, 0) != getCasing(3) || aBaseMetaTileEntity.getMetaIDOffset(i, -1, 0) != 15) { - return false; + public int checkEntireLayer(IGregTechTileEntity aBaseMetaTileEntity, Block aBlock, int aMeta, int aY, int xDir, int zDir) { + int aCasingCount = 0; + for (int x = -4; x < 5; x++) { + for (int z = -4; z < 5; z++) { + int aOffsetX = this.getBaseMetaTileEntity().getXCoord() + x; + int aOffsetY = this.getBaseMetaTileEntity().getYCoord() + aY; + int aOffsetZ = this.getBaseMetaTileEntity().getZCoord() + z; + //Skip the corners + if ((x == 4 && z == 4) || (x == -4 && z == -4) || (x == 4 && z == -4) || (x == -4 && z == 4)) { + continue; + } + // Skip controller + if (aY == 0 && x == 0 && z == 0) { + continue; } - - tTileEntity = aBaseMetaTileEntity.getIGregTechTileEntityOffset(i, -2, 0); - if (!this.addMaintenanceToMachineList(tTileEntity, TAE.getIndexFromPage(3, 0)) - && !this.addInputToMachineList(tTileEntity, TAE.getIndexFromPage(3, 0))) { - if (aBaseMetaTileEntity.getBlockOffset(i, -2, 0) != getCasing(4)) { - return false; - } - - if (aBaseMetaTileEntity.getMetaIDOffset(i, -2, 0) != 0) { - return false; - } + + Block aCurrentBlock = aBaseMetaTileEntity.getBlockOffset(xDir + x, aY, zDir + z); + int aCurrentMeta = (int) aBaseMetaTileEntity.getMetaIDOffset(xDir + x, aY, zDir + z); + if (aCurrentBlock == aBlock && aCurrentMeta == aMeta) { + aCasingCount++; + } + final IGregTechTileEntity tTileEntity = aBaseMetaTileEntity.getIGregTechTileEntityOffset(xDir + x, aY, zDir + z); + if (!isValidBlockForStructure(tTileEntity, CASING_TEXTURE_ID, true, aCurrentBlock, aCurrentMeta, aBlock, aMeta)) { + log("Layer has error. Height: "+aY); + //this.getBaseMetaTileEntity().getWorld().setBlock(aOffsetX, aOffsetY, aOffsetZ, aBlock, aMeta, 3); + return 0; } + } + } + return aCasingCount; + } - tTileEntity = aBaseMetaTileEntity.getIGregTechTileEntityOffset(i, 1, zDir); - if (!this.addDynamoToMachineList(tTileEntity, TAE.getIndexFromPage(3, 0))) { - if (aBaseMetaTileEntity.getBlockOffset(i, 1, zDir) != getCasing(4)) { - return false; + public int checkOuterRing(IGregTechTileEntity aBaseMetaTileEntity, Block aBlock, int aMeta, int aY, int xDir, int zDir) { + int aCasingCount = 0; + for (int x = -4; x < 5; x++) { + for (int z = -4; z < 5; z++) { + int aOffsetX = this.getBaseMetaTileEntity().getXCoord() + x; + int aOffsetY = this.getBaseMetaTileEntity().getYCoord() + aY; + int aOffsetZ = this.getBaseMetaTileEntity().getZCoord() + z; + //Skip the corners + if ((x == 4 && z == 4) || (x == -4 && z == -4) || (x == 4 && z == -4) || (x == -4 && z == 4)) { + continue; + } + + // If we are on the 5x5 ring, proceed + if ((x > -4 && x < 4 ) && (z > -4 && z < 4)) { + if ((x == 3 && z == 3) || (x == -3 && z == -3) || (x == 3 && z == -3) || (x == -3 && z == 3)) { + //this.getBaseMetaTileEntity().getWorld().setBlock(aOffsetX, aOffsetY, aOffsetZ, aBlock, aMeta, 3); } - - if (aBaseMetaTileEntity.getMetaIDOffset(i, 1, zDir) != 0) { - return false; + else { + continue; } } - if (i != 0 && (aBaseMetaTileEntity.getBlockOffset(i, 0, zDir) != getCasing(4) - || aBaseMetaTileEntity.getMetaIDOffset(i, 0, zDir) != 1)) { - return false; - } - - if (i != 0 && (aBaseMetaTileEntity.getBlockOffset(i, -1, zDir) != getCasing(4) - || aBaseMetaTileEntity.getMetaIDOffset(i, -1, zDir) != 2)) { - return false; + Block aCurrentBlock = aBaseMetaTileEntity.getBlockOffset(xDir + x, aY, zDir + z); + int aCurrentMeta = (int) aBaseMetaTileEntity.getMetaIDOffset(xDir + x, aY, zDir + z); + if (aCurrentBlock == aBlock && aCurrentMeta == aMeta) { + aCasingCount++; + } + final IGregTechTileEntity tTileEntity = aBaseMetaTileEntity.getIGregTechTileEntityOffset(xDir + x, aY, zDir + z); + if (!isValidBlockForStructure(tTileEntity, CASING_TEXTURE_ID, false, aCurrentBlock, aCurrentMeta, aBlock, aMeta)) { + log("Layer has error. Height: "+aY); + //this.getBaseMetaTileEntity().getWorld().setBlock(aOffsetX, aOffsetY, aOffsetZ, aBlock, aMeta, 3); + return 0; } - - if (aBaseMetaTileEntity.getBlockOffset(i, 0, zDir * 2) != getCasing(3) - || aBaseMetaTileEntity.getMetaIDOffset(i, 0, zDir * 2) != 3) { - return false; - } - - if (aBaseMetaTileEntity.getBlockOffset(i, -1, zDir * 2) != getCasing(3) || aBaseMetaTileEntity.getMetaIDOffset(i, -1, zDir * 2) != 15) { - return false; - } - - tTileEntity = aBaseMetaTileEntity.getIGregTechTileEntityOffset(i, -2, zDir * 2); - if (!this.addMaintenanceToMachineList(tTileEntity, TAE.getIndexFromPage(3, 0)) - && !this.addInputToMachineList(tTileEntity, TAE.getIndexFromPage(3, 0))) { - if (aBaseMetaTileEntity.getBlockOffset(i, -2, zDir * 2) != getCasing(4)) { - return false; + } + } + return aCasingCount; + } + public int checkIntegralRing(IGregTechTileEntity aBaseMetaTileEntity, Block aBlock, int aMeta, int aY, int xDir, int zDir) { + int aCasingCount = 0; + for (int x = -3; x < 4; x++) { + for (int z = -3; z < 4; z++) { + int aOffsetX = this.getBaseMetaTileEntity().getXCoord() + x; + int aOffsetY = this.getBaseMetaTileEntity().getYCoord() + aY; + int aOffsetZ = this.getBaseMetaTileEntity().getZCoord() + z; + //Skip the corners + if ((x == 3 && z == 3) || (x == -3 && z == -3) || (x == 3 && z == -3) || (x == -3 && z == 3)) { + continue; + } + + // If we are on the 5x5 ring, proceed + if ((x > -3 && x < 3 ) && (z > -3 && z < 3)) { + if ((x == 2 && z == 2) || (x == -2 && z == -2) || (x == 2 && z == -2) || (x == -2 && z == 2)) { + //this.getBaseMetaTileEntity().getWorld().setBlock(aOffsetX, aOffsetY, aOffsetZ, aBlock, aMeta, 3); } - - if (aBaseMetaTileEntity.getMetaIDOffset(i, -2, zDir * 2) != 0) { - return false; + else { + continue; } } - tTileEntity = aBaseMetaTileEntity.getIGregTechTileEntityOffset(i, -2, zDir); - if (!this.addInputToMachineList(tTileEntity, TAE.getIndexFromPage(3, 0)) && this.addOutputToMachineList(tTileEntity, TAE.getIndexFromPage(3, 0))) { - return r > 0 && this.mEnergyHatches.size() > 0; + Block aCurrentBlock = aBaseMetaTileEntity.getBlockOffset(xDir + x, aY, zDir + z); + int aCurrentMeta = (int) aBaseMetaTileEntity.getMetaIDOffset(xDir + x, aY, zDir + z); + if (aCurrentBlock == aBlock && aCurrentMeta == aMeta) { + aCasingCount++; + } + final IGregTechTileEntity tTileEntity = aBaseMetaTileEntity.getIGregTechTileEntityOffset(xDir + x, aY, zDir + z); + if (!isValidBlockForStructure(tTileEntity, CASING_TEXTURE_ID, false, aCurrentBlock, aCurrentMeta, aBlock, aMeta)) { + log("Layer has error. Height: "+aY); + //this.getBaseMetaTileEntity().getWorld().setBlock(aOffsetX, aOffsetY, aOffsetZ, aBlock, aMeta, 3); + return 0; } - } + } } - - return false; + return aCasingCount; } - public boolean addNaquadahHatchToMachineInput(IGregTechTileEntity aTileEntity, int aBaseCasingIndex) { - if (aTileEntity == null) { - return false; - } else { - IMetaTileEntity aMetaTileEntity = aTileEntity.getMetaTileEntity(); - if (aMetaTileEntity == null) { - return false; - } else if (aMetaTileEntity instanceof GT_MetaTileEntity_Hatch_Naquadah) { - - try { - GregtechMetaTileEntity_Adv_Fusion_MK4.mUpdateHatchTexture.invoke((GT_MetaTileEntity_Hatch) aMetaTileEntity, aBaseCasingIndex); - } catch (IllegalAccessException | IllegalArgumentException | InvocationTargetException e) { + public int checkPipes(IGregTechTileEntity aBaseMetaTileEntity, Block aBlock, int aMeta, int aY, int xDir, int zDir) { + int aCasingCount = 0; + for (int x = -1; x < 2; x++) { + for (int z = -1; z < 2; z++) { + int aOffsetX = this.getBaseMetaTileEntity().getXCoord() + x; + int aOffsetY = this.getBaseMetaTileEntity().getYCoord() + aY; + int aOffsetZ = this.getBaseMetaTileEntity().getZCoord() + z; + //Skip the corners + if ((x == 1 && z == 1) || (x == -1 && z == -1) || (x == 1 && z == -1) || (x == -1 && z == 1) || (x == 0 && z == 0)) { + Block aCurrentBlock = aBaseMetaTileEntity.getBlockOffset(xDir + x, aY, zDir + z); + int aCurrentMeta = (int) aBaseMetaTileEntity.getMetaIDOffset(xDir + x, aY, zDir + z); + if (aCurrentBlock == aBlock && aCurrentMeta == aMeta) { + aCasingCount++; + } + final IGregTechTileEntity tTileEntity = aBaseMetaTileEntity.getIGregTechTileEntityOffset(xDir + x, aY, zDir + z); + if (!isValidBlockForStructure(tTileEntity, CASING_TEXTURE_ID, false, aCurrentBlock, aCurrentMeta, aBlock, aMeta)) { + log("Pipe has error. Height: "+aY); + //this.getBaseMetaTileEntity().getWorld().setBlock(aOffsetX, aOffsetY, aOffsetZ, aBlock, aMeta, 3); + return 0; + }; } - - //((GT_MetaTileEntity_Hatch) aMetaTileEntity).updateTexture(aBaseCasingIndex); - return this.mNaqHatches.add((GT_MetaTileEntity_Hatch_Naquadah) aMetaTileEntity); - } else { - return false; - } + } } - } + return aCasingCount; + } + + public int checkContainmentRing(IGregTechTileEntity aBaseMetaTileEntity, Block aBlock, int aMeta, int aY, int xDir, int zDir) { + int aCasingCount = 0; + for (int x = -2; x < 3; x++) { + for (int z = -2; z < 3; z++) { + int aOffsetX = this.getBaseMetaTileEntity().getXCoord() + x; + int aOffsetY = this.getBaseMetaTileEntity().getYCoord() + aY; + int aOffsetZ = this.getBaseMetaTileEntity().getZCoord() + z; + //Skip the corners + if ((x == 2 && z == 2) || (x == -2 && z == -2) || (x == 2 && z == -2) || (x == -2 && z == 2)) { + continue; + } + + Block aCurrentBlock = aBaseMetaTileEntity.getBlockOffset(xDir + x, aY, zDir + z); + int aCurrentMeta = (int) aBaseMetaTileEntity.getMetaIDOffset(xDir + x, aY, zDir + z); + if (aCurrentBlock == aBlock && aCurrentMeta == aMeta) { + aCasingCount++; + } + final IGregTechTileEntity tTileEntity = aBaseMetaTileEntity.getIGregTechTileEntityOffset(xDir + x, aY, zDir + z); + if (!isValidBlockForStructure(tTileEntity, CASING_TEXTURE_ID, false, aCurrentBlock, aCurrentMeta, aBlock, aMeta)) { + log("Layer has error. Height: "+aY); + //this.getBaseMetaTileEntity().getWorld().setBlock(aOffsetX, aOffsetY, aOffsetZ, aBlock, aMeta, 3); + return 0; + } + } + } + return aCasingCount; + } public int getMaxEfficiency(ItemStack aStack) { return 10000; diff --git a/src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/production/chemplant/GregtechMTE_ChemicalPlant.java b/src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/production/chemplant/GregtechMTE_ChemicalPlant.java index ebae66fe72..60c0ade62f 100644 --- a/src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/production/chemplant/GregtechMTE_ChemicalPlant.java +++ b/src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/production/chemplant/GregtechMTE_ChemicalPlant.java @@ -37,6 +37,7 @@ import gtPlusPlus.core.item.chemistry.AgriculturalChem; import gtPlusPlus.core.item.chemistry.GenericChem; 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; @@ -51,36 +52,11 @@ import net.minecraftforge.common.util.ForgeDirection; import net.minecraftforge.fluids.FluidStack; public class GregtechMTE_ChemicalPlant extends GregtechMeta_MultiBlockBase { - + private int mSolidCasingTier = 0; private int mMachineCasingTier = 0; private int mPipeCasingTier = 0; - private int mCoilTier = 0; - - public static GT_Recipe_Map getGeneratedRecipeMap() { - return mFluidChemicalReactorRecipes; - } - - /** - * Internal Recipe Map which holds the actual recipes, backed by the real map, shown by NEI. - */ - private static final GT_Recipe_Map mFluidChemicalReactorRecipes = new GT_Recipe_Map( - new HashSet<GT_Recipe>(100), - "gt.recipe.fluidchemicaleactor", - "Chemical Plant", - null, - CORE.MODID+":textures/gui/FluidReactor", - 0, - 0, - 0, - 2, - 1, - "Tier: ", - 1, - E, - true, - false); - + private int mCoilTier = 0; public GregtechMTE_ChemicalPlant(final int aID, final String aName, final String aNameRegional) { super(aID, aName, aNameRegional); @@ -176,15 +152,13 @@ public class GregtechMTE_ChemicalPlant extends GregtechMeta_MultiBlockBase { @Override public GT_Recipe.GT_Recipe_Map getRecipeMap() { - if (mFluidChemicalReactorRecipes.mRecipeList.isEmpty() || mFluidChemicalReactorRecipes.mRecipeList.size() != Recipe_GT.Gregtech_Recipe_Map.sFluidChemicalReactorRecipes.mRecipeList.size()) { - if (!mFluidChemicalReactorRecipes.mRecipeList.isEmpty()) { - mFluidChemicalReactorRecipes.mRecipeList.clear(); - } - for (Recipe_GT i : Recipe_GT.Gregtech_Recipe_Map.sFluidChemicalReactorRecipes.mRecipeList) { - mFluidChemicalReactorRecipes.add(i); - } + return Recipe_GT.Gregtech_Recipe_Map.sChemicalPlant_GT; + } + + public static void generateRecipes() { + for (Recipe_GT i : Recipe_GT.Gregtech_Recipe_Map.sChemicalPlantRecipes.mRecipeList) { + Recipe_GT.Gregtech_Recipe_Map.sChemicalPlant_GT.add(i); } - return mFluidChemicalReactorRecipes; } @Override @@ -764,7 +738,7 @@ public class GregtechMTE_ChemicalPlant extends GregtechMeta_MultiBlockBase { public String getCustomGUIResourceName() { return null; } - + // Same speed bonus as pyro oven public int getSpeedBonus() { return 50 * (this.mCoilTier - 2); @@ -793,14 +767,14 @@ public class GregtechMTE_ChemicalPlant extends GregtechMeta_MultiBlockBase { public boolean checkRecipe(final ItemStack aStack) { return checkRecipeGeneric(getMaxParallelRecipes(), getEuDiscountForParallelism(), getSpeedBonus()); } - - + + @Override public boolean checkRecipeGeneric( ItemStack[] aItemInputs, FluidStack[] aFluidInputs, int aMaxParallelRecipes, int aEUPercent, int aSpeedBonusPercent, int aOutputChanceRoll, GT_Recipe aRecipe) { - + // Based on the Processing Array. A bit overkill, but very flexible. // Reset outputs and progress stats @@ -813,34 +787,34 @@ public class GregtechMTE_ChemicalPlant extends GregtechMeta_MultiBlockBase { byte tTier = (byte) Math.max(1, GT_Utility.getTier(tVoltage)); long tEnergy = getMaxInputEnergy(); log("Running checkRecipeGeneric(0)"); - + GT_Recipe tRecipe = findRecipe( getBaseMetaTileEntity(), mLastRecipe, false, gregtech.api.enums.GT_Values.V[tTier], aFluidInputs, aItemInputs); - - + + log("Running checkRecipeGeneric(1)"); // Remember last recipe - an optimization for findRecipe() this.mLastRecipe = tRecipe; - - + + if (tRecipe == null) { log("BAD RETURN - 1"); return false; } - + if (tRecipe.mSpecialValue > this.mSolidCasingTier) { log("solid tier is too low"); return false; } - - + + aMaxParallelRecipes = this.canBufferOutputs(tRecipe, aMaxParallelRecipes); if (aMaxParallelRecipes == 0) { log("BAD RETURN - 2"); return false; } - + // checks if it has enough catalyst durabilety ArrayList<ItemStack>tCatalysts = null; int tMaxParrallelCatalyst = aMaxParallelRecipes; @@ -850,7 +824,7 @@ public class GregtechMTE_ChemicalPlant extends GregtechMeta_MultiBlockBase { tCatalysts = new ArrayList<ItemStack>(); tMaxParrallelCatalyst = getCatalysts(aItemInputs, tCatalystRecipe, aMaxParallelRecipes,tCatalysts); } - + if (tMaxParrallelCatalyst == 0) { log("found not enough catalists catalyst"); return false; @@ -884,7 +858,7 @@ public class GregtechMTE_ChemicalPlant extends GregtechMeta_MultiBlockBase { log("BAD RETURN - 3"); return false; } - + if (tCatalysts != null) { log("damaging catalyst"); for (int j = 0;j<parallelRecipes;j++) { @@ -900,7 +874,7 @@ public class GregtechMTE_ChemicalPlant extends GregtechMeta_MultiBlockBase { } // -- Try not to fail after this point - inputs have already been consumed! -- - + // Convert speed bonus to duration multiplier // e.g. 100% speed bonus = 200% speed = 100%/200% = 50% recipe duration. @@ -927,7 +901,7 @@ public class GregtechMTE_ChemicalPlant extends GregtechMeta_MultiBlockBase { if (this.mEUt > 0) { this.mEUt = (-this.mEUt); } - + this.mMaxProgresstime = Math.max(1, this.mMaxProgresstime); @@ -1001,19 +975,19 @@ public class GregtechMTE_ChemicalPlant extends GregtechMeta_MultiBlockBase { int allowedParrallel = 0; for (final ItemStack aInput : aItemInputs) { if (aRecipeCatalyst.isItemEqual(aInput)) { - if (aInput.stackSize == 1) { - int damage = getDamage(aInput) + aMaxParrallel; - if (damage > getMaxCatalystDurability() ) { - aOutPut.add(aInput); - allowedParrallel += aMaxParrallel + (getMaxCatalystDurability() - damage); - if (allowedParrallel >aMaxParrallel ) { - return aMaxParrallel; - } - continue; - } + if (aInput.stackSize == 1) { + int damage = getDamage(aInput) + aMaxParrallel; + if (damage > getMaxCatalystDurability() ) { + aOutPut.add(aInput); + allowedParrallel += aMaxParrallel + (getMaxCatalystDurability() - damage); + if (allowedParrallel >aMaxParrallel ) { + return aMaxParrallel; + } + continue; } - aOutPut.add(aInput); - return aMaxParrallel; + } + aOutPut.add(aInput); + return aMaxParrallel; } } return allowedParrallel; @@ -1023,34 +997,23 @@ public class GregtechMTE_ChemicalPlant extends GregtechMeta_MultiBlockBase { if (aItemInputs != null) { for (final ItemStack aInput : aItemInputs) { if (aInput != null) { - if (aInput.isItemEqual(GenericChem.mRedCatalyst)) - return aInput; - else if (aInput.isItemEqual(GenericChem.mYellowCatalyst)) - return aInput; - else if (aInput.isItemEqual(GenericChem.mBlueCatalyst)) - return aInput; - else if (aInput.isItemEqual(GenericChem.mOrangeCatalyst)) - return aInput; - else if (aInput.isItemEqual(GenericChem.mPurpleCatalyst)) - return aInput; - else if (aInput.isItemEqual(AgriculturalChem.mGreenCatalyst)) - return aInput; - else if (aInput.isItemEqual(GenericChem.mBrownCatalyst)) + if (ItemUtils.isCatalyst(aInput)) { return aInput; + } } } } return null; } - - + + private void damageCatalyst(ItemStack aStack) { if (MathUtils.randFloat(0, 10000000)/10000000f < (1.2f - (0.2 * this.mPipeCasingTier))) { int damage = getDamage(aStack) + 1; log("damage catalyst "+damage); if (damage >= getMaxCatalystDurability()) { log("consume catalyst"); - ItemStack emptyCatalyst = ItemUtils.getSimpleStack(AgriculturalChem.mCatalystCarrier,1); + ItemStack emptyCatalyst = CI.getEmptyCatalyst(1); addOutput(emptyCatalyst); setDamage(aStack,0); aStack.stackSize -= 1; @@ -1063,7 +1026,7 @@ public class GregtechMTE_ChemicalPlant extends GregtechMeta_MultiBlockBase { log("not consuming catalyst"); } } - + private int getDamage(ItemStack aStack) { if (aStack.getTagCompound() == null || aStack.getTagCompound().hasNoTags()) { final NBTTagCompound tagMain = new NBTTagCompound(); @@ -1075,13 +1038,13 @@ public class GregtechMTE_ChemicalPlant extends GregtechMeta_MultiBlockBase { NBTTagCompound aNBT = aStack.getTagCompound(); return aNBT.getCompoundTag("catalyst").getInteger("Damage"); } - + private void setDamage(ItemStack aStack,int aAmount) { NBTTagCompound aNBT = aStack.getTagCompound(); aNBT = aNBT.getCompoundTag("catalyst"); aNBT.setInteger("Damage", aAmount); } - + @SideOnly(Side.CLIENT) diff --git a/src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/storage/GregtechMetaEnergyBuffer.java b/src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/storage/GregtechMetaEnergyBuffer.java index 86d02eae9a..4f0197c060 100644 --- a/src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/storage/GregtechMetaEnergyBuffer.java +++ b/src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/storage/GregtechMetaEnergyBuffer.java @@ -26,7 +26,7 @@ import gtPlusPlus.xmod.gregtech.common.blocks.textures.TexturesGtBlock; public class GregtechMetaEnergyBuffer extends GregtechMetaTileEntity { - private byte aCurrentOutputAmperage = 4; + 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); @@ -253,7 +253,7 @@ public class GregtechMetaEnergyBuffer extends GregtechMetaTileEntity { 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(maxAmperesIn())+"A"); + PlayerUtils.messagePlayer(playerIn, "Amperage: " + GT_Utility.formatNumbers(maxAmperesOut())+"A"); } //Utils.LOG_WARNING("Begin Show Energy"); diff --git a/src/Java/gtPlusPlus/xmod/gregtech/loaders/Gregtech_Blocks.java b/src/Java/gtPlusPlus/xmod/gregtech/loaders/Gregtech_Blocks.java index 361fadcb5a..535dfb3faa 100644 --- a/src/Java/gtPlusPlus/xmod/gregtech/loaders/Gregtech_Blocks.java +++ b/src/Java/gtPlusPlus/xmod/gregtech/loaders/Gregtech_Blocks.java @@ -26,7 +26,7 @@ public class Gregtech_Blocks { ModBlocks.blockCasings3Misc = new GregtechMetaCasingBlocks3(); ModBlocks.blockCasings4Misc = new GregtechMetaCasingBlocks4(); - ModBlocks.BlockTieredCasings1 = new GregtechMetaTieredCasingBlocks1(); + ModBlocks.blockCasingsTieredGTPP = new GregtechMetaTieredCasingBlocks1(); } } diff --git a/src/Java/gtPlusPlus/xmod/gregtech/recipes/GregtechRecipeAdder.java b/src/Java/gtPlusPlus/xmod/gregtech/recipes/GregtechRecipeAdder.java index efac0222af..bb3d93172c 100644 --- a/src/Java/gtPlusPlus/xmod/gregtech/recipes/GregtechRecipeAdder.java +++ b/src/Java/gtPlusPlus/xmod/gregtech/recipes/GregtechRecipeAdder.java @@ -1182,7 +1182,7 @@ public class GregtechRecipeAdder implements IGregtech_RecipeAdder { @Override - public boolean addFluidReactorRecipe(ItemStack[] aInputs, FluidStack[] aInputFluids, ItemStack[] aOutputs, FluidStack[] aFluidOutputs, int time, long eu, int aTier) { + public boolean addChemicalPlantRecipe(ItemStack[] aInputs, FluidStack[] aInputFluids, ItemStack[] aOutputs, FluidStack[] aFluidOutputs, int time, long eu, int aTier) { if (aInputs.length > 4 || aInputFluids.length > 4 || aOutputs.length > 4 || aFluidOutputs.length > 2) { Logger.INFO("Inputs: "+ItemUtils.getArrayStackNames(aInputs)); @@ -1205,10 +1205,10 @@ public class GregtechRecipeAdder implements IGregtech_RecipeAdder { (int) eu, aTier); - int aSize = Recipe_GT.Gregtech_Recipe_Map.sFluidChemicalReactorRecipes.mRecipeList.size(); + int aSize = Recipe_GT.Gregtech_Recipe_Map.sChemicalPlantRecipes.mRecipeList.size(); int aSize2 = aSize; - Recipe_GT.Gregtech_Recipe_Map.sFluidChemicalReactorRecipes.add(aSpecialRecipe); - aSize = Recipe_GT.Gregtech_Recipe_Map.sFluidChemicalReactorRecipes.mRecipeList.size(); + Recipe_GT.Gregtech_Recipe_Map.sChemicalPlantRecipes.add(aSpecialRecipe); + aSize = Recipe_GT.Gregtech_Recipe_Map.sChemicalPlantRecipes.mRecipeList.size(); return aSize > aSize2; } diff --git a/src/Java/gtPlusPlus/xmod/gregtech/registration/gregtech/GregtechEnergyBuffer.java b/src/Java/gtPlusPlus/xmod/gregtech/registration/gregtech/GregtechEnergyBuffer.java index e07837c2ba..e82fade029 100644 --- a/src/Java/gtPlusPlus/xmod/gregtech/registration/gregtech/GregtechEnergyBuffer.java +++ b/src/Java/gtPlusPlus/xmod/gregtech/registration/gregtech/GregtechEnergyBuffer.java @@ -7,8 +7,10 @@ import gregtech.api.util.GT_ModHandler; import gtPlusPlus.api.objects.Logger; import gtPlusPlus.core.lib.CORE; +import gtPlusPlus.core.lib.LoadedMods; import gtPlusPlus.xmod.gregtech.api.enums.GregtechItemList; import gtPlusPlus.xmod.gregtech.api.enums.GregtechOreDictNames; +import gtPlusPlus.xmod.gregtech.common.tileentities.generators.GT_MetaTileEntity_RfConvertor; import gtPlusPlus.xmod.gregtech.common.tileentities.generators.creative.GregtechMetaCreativeEnergyBuffer; import gtPlusPlus.xmod.gregtech.common.tileentities.storage.GregtechMetaEnergyBuffer; @@ -22,11 +24,8 @@ public class GregtechEnergyBuffer { if (gtPlusPlus.core.lib.LoadedMods.Gregtech){ Logger.INFO("Gregtech5u Content | Registering Energy Buffer Blocks."); - if (CORE.ConfigSwitches.enableMachine_RocketEngines) { - run1(); - } + run1(); } - } private static void run1() @@ -58,6 +57,15 @@ public class GregtechEnergyBuffer "512V Creative Energy Buffer", 3, "", 0) .getStackForm(1L)); + if (LoadedMods.CoFHCore && CORE.ConfigSwitches.enableMachine_RF_Convetor) { + // RF Convertor Buffer Has Special ID + GregtechItemList.Energy_Buffer_RF_Convertor + .set(new GT_MetaTileEntity_RfConvertor(31022, + "energybuffer.rf.tier.01", + "RF Energy Convertor", 3, "", 0) + .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 }); diff --git a/src/Java/gtPlusPlus/xmod/gregtech/registration/gregtech/GregtechIndustrialAlloySmelter.java b/src/Java/gtPlusPlus/xmod/gregtech/registration/gregtech/GregtechIndustrialAlloySmelter.java new file mode 100644 index 0000000000..6587e3a253 --- /dev/null +++ b/src/Java/gtPlusPlus/xmod/gregtech/registration/gregtech/GregtechIndustrialAlloySmelter.java @@ -0,0 +1,22 @@ +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() { + if (gtPlusPlus.core.lib.LoadedMods.Gregtech) { + 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)); + + } +}
\ No newline at end of file |