diff options
author | Alkalus <3060479+draknyte1@users.noreply.github.com> | 2019-08-15 07:55:35 +0100 |
---|---|---|
committer | Alkalus <3060479+draknyte1@users.noreply.github.com> | 2019-08-15 07:55:35 +0100 |
commit | e7ef217244340fe6984b79815d56d9d5b72582fc (patch) | |
tree | 5ba69d85189d2c6d876c95154b7524cee2859e87 /src | |
parent | 9f9b49884e9496023cd9cd66b0dfe4301f8231bf (diff) | |
download | GT5-Unofficial-e7ef217244340fe6984b79815d56d9d5b72582fc.tar.gz GT5-Unofficial-e7ef217244340fe6984b79815d56d9d5b72582fc.tar.bz2 GT5-Unofficial-e7ef217244340fe6984b79815d56d9d5b72582fc.zip |
+ Attempted to add a buggy NEI page for decayable dusts.
+ Added a way to disable ALL GT++ logging in the ASM config file.
+ Added recipes for Ztones covers.
% Adjusted recipes for Tiered machine covers.
% Updated GT++ debug command to toggle logging if desired. (Useful in-game).
$ Fixed bug where smart covers would lose their state.
Diffstat (limited to 'src')
15 files changed, 686 insertions, 329 deletions
diff --git a/src/Java/gtPlusPlus/api/objects/Logger.java b/src/Java/gtPlusPlus/api/objects/Logger.java index 616a241d89..9c1e3d4338 100644 --- a/src/Java/gtPlusPlus/api/objects/Logger.java +++ b/src/Java/gtPlusPlus/api/objects/Logger.java @@ -6,11 +6,12 @@ import cpw.mods.fml.common.FMLLog; import cpw.mods.fml.relauncher.FMLRelaunchLog; import gtPlusPlus.core.lib.CORE; import gtPlusPlus.core.proxy.ClientProxy; +import gtPlusPlus.preloader.asm.AsmConfig; public class Logger { - + public Logger(String string) { - + } // Logging Functions @@ -22,133 +23,170 @@ public class Logger { return gtPlusPlusLogger; } + private static final boolean enabled = !AsmConfig.disableAllLogging; + public static final org.apache.logging.log4j.Logger getLogger(){ return modLogger; } // Non-Dev Comments public static void INFO(final String s) { - modLogger.info(s); + if (enabled) { + modLogger.info(s); + } } // Non-Dev Comments public static void MACHINE_INFO(final String s) { - - boolean localPlayer = false; - try { - if (ClientProxy.playerName != null){ - if (ClientProxy.playerName.toLowerCase().contains("draknyte1")){ - localPlayer = true; + if (enabled) { + + boolean localPlayer = false; + try { + if (ClientProxy.playerName != null){ + if (ClientProxy.playerName.toLowerCase().contains("draknyte1")){ + localPlayer = true; + } } } - } - catch (final Throwable t){ - - } - - if (CORE.ConfigSwitches.MACHINE_INFO || localPlayer) { - final String name1 = gtPlusPlus.core.util.reflect.ReflectionUtils.getMethodName(2); - modLogger.info("Machine Info: " + s + " | " + name1); + catch (final Throwable t){ + + } + + if (CORE.ConfigSwitches.MACHINE_INFO || localPlayer) { + final String name1 = gtPlusPlus.core.util.reflect.ReflectionUtils.getMethodName(2); + modLogger.info("Machine Info: " + s + " | " + name1); + } } } // Developer Comments public static void WARNING(final String s) { - if (CORE.DEBUG) { - modLogger.warn(s); + if (enabled) { + if (CORE.DEBUG) { + modLogger.warn(s); + } } } // Errors public static void ERROR(final String s) { - if (CORE.DEBUG) { - modLogger.fatal(s); + if (enabled) { + if (CORE.DEBUG) { + modLogger.fatal(s); + } } } // Developer Logger public static void SPECIFIC_WARNING(final String whatToLog, final String msg, final int line) { - // if (!CORE.DEBUG){ - FMLLog.warning("GT++ |" + line + "| " + whatToLog + " | " + msg); - // } + if (enabled) { + // if (!CORE.DEBUG){ + FMLLog.warning("GT++ |" + line + "| " + whatToLog + " | " + msg); + // } + } } // ASM Comments public static void LOG_ASM(final String s) { - FMLRelaunchLog.info("[Special ASM Logging] ", s); - } - - - - - - - - - - + if (enabled) { + FMLRelaunchLog.info("[Special ASM Logging] ", s); + } + } + + + + + + + + + + /** * Special Loggers */ - + /** * Special Logger for Bee related content */ public static void BEES(final String s) { - if (CORE.DEVENV || CORE.DEBUG) - modLogger.info("[Bees] "+s); + if (enabled) { + if (CORE.DEVENV || CORE.DEBUG) { + modLogger.info("[Bees] "+s); + } + } } /** * Special Logger for Debugging Bee related content */ public static void DEBUG_BEES(final String s) { - if (CORE.DEVENV || CORE.DEBUG) - modLogger.info("[Debug][Bees] "+s); + if (enabled) { + if (CORE.DEVENV || CORE.DEBUG) { + modLogger.info("[Debug][Bees] "+s); + } + } } - - - + + + /** * Special Logger for Materials related content */ public static void MATERIALS(final String s) { - if (/* CORE.DEVENV || */CORE.DEBUG) - modLogger.info("[Materials] "+s); + if (enabled) { + if (/* CORE.DEVENV || */CORE.DEBUG) { + modLogger.info("[Materials] "+s); + } + } } /** * Special Logger for Debugging Materials related content */ public static void DEBUG_MATERIALS(final String s) { - if (CORE.DEVENV || CORE.DEBUG) - modLogger.info("[Debug][Materials] "+s); + if (enabled) { + if (CORE.DEVENV || CORE.DEBUG) { + modLogger.info("[Debug][Materials] "+s); + } + } } - + /** * Special Logger for Reflection related content */ public static void REFLECTION(final String s) { - if (CORE.DEVENV || CORE.DEBUG) - modLogger.info("[Reflection] "+s); + if (enabled) { + if (CORE.DEVENV || CORE.DEBUG) { + modLogger.info("[Reflection] "+s); + } + } } - + /** * Special Logger for Darkworld related content */ public static void WORLD(final String s) { - if (CORE.DEVENV || CORE.DEBUG) - modLogger.info("[WorldGen] "+s); + if (enabled) { + if (CORE.DEVENV || CORE.DEBUG) { + modLogger.info("[WorldGen] "+s); + } + } } public static void RECIPE(String string) { - if (/*CORE.DEVENV || */CORE.DEBUG) - modLogger.info("[Recipe] "+string); + if (enabled) { + if (/*CORE.DEVENV || */CORE.DEBUG) { + modLogger.info("[Recipe] "+string); + } + } } public static void SPACE(final String s) { - modLogger.info("[Space] "+s); + if (enabled) { + modLogger.info("[Space] "+s); + } } - - + + } diff --git a/src/Java/gtPlusPlus/api/objects/minecraft/ShapedRecipe.java b/src/Java/gtPlusPlus/api/objects/minecraft/ShapedRecipe.java index 1073e63914..c0e9b20c54 100644 --- a/src/Java/gtPlusPlus/api/objects/minecraft/ShapedRecipe.java +++ b/src/Java/gtPlusPlus/api/objects/minecraft/ShapedRecipe.java @@ -3,11 +3,7 @@ package gtPlusPlus.api.objects.minecraft; import gtPlusPlus.api.objects.Logger; import gtPlusPlus.api.objects.data.AutoMap; import gtPlusPlus.api.objects.data.Pair; -import gtPlusPlus.core.block.ModBlocks; import gtPlusPlus.core.util.minecraft.ItemUtils; -import gtPlusPlus.everglades.dimension.Dimension_Everglades; -import gtPlusPlus.xmod.forestry.bees.items.FR_ItemRegistry; -import gtPlusPlus.xmod.ic2.item.IC2_Items; import net.minecraft.item.Item; import net.minecraft.item.ItemStack; import net.minecraftforge.oredict.ShapedOreRecipe; @@ -36,13 +32,7 @@ public class ShapedRecipe { String[] aLoggingInfo = new String[9]; if (mBlackList == null) { - mBlackList = new ItemStack[] { - ItemUtils.getSimpleStack(ModBlocks.blockNet), - ItemUtils.getSimpleStack(ModBlocks.blockXpConverter), - ItemUtils.getSimpleStack(ModBlocks.blockWitherGuard), - ItemUtils.getSimpleStack(ModBlocks.blockMiningExplosive), - ItemUtils.getSimpleStack(Dimension_Everglades.blockPortalFrame), - }; + mBlackList = new ItemStack[] {}; } //Just to be safe diff --git a/src/Java/gtPlusPlus/core/commands/CommandEnableDebugWhileRunning.java b/src/Java/gtPlusPlus/core/commands/CommandEnableDebugWhileRunning.java index 3a7d4461f4..5b9c17bacf 100644 --- a/src/Java/gtPlusPlus/core/commands/CommandEnableDebugWhileRunning.java +++ b/src/Java/gtPlusPlus/core/commands/CommandEnableDebugWhileRunning.java @@ -7,6 +7,7 @@ import gtPlusPlus.api.objects.Logger; import gtPlusPlus.core.lib.CORE; import gtPlusPlus.core.util.Utils; import gtPlusPlus.core.util.minecraft.PlayerUtils; +import gtPlusPlus.preloader.asm.AsmConfig; import net.minecraft.command.ICommand; import net.minecraft.command.ICommandSender; import net.minecraft.entity.player.EntityPlayer; @@ -33,6 +34,9 @@ public class CommandEnableDebugWhileRunning implements ICommand } + + // Use '/debugmodegtpp' along with 'logging' or 'debug' to toggle Debug mode and Logging. + // Using nothing after the command toggles both to their opposite states respectively. @Override public String getCommandUsage(final ICommandSender var1){ return "/debugmodegtpp"; @@ -47,16 +51,44 @@ public class CommandEnableDebugWhileRunning implements ICommand @Override public void processCommand(final ICommandSender S, final String[] argString){ - Logger.INFO("Toggling Debug Mode"); - final World W = S.getEntityWorld(); - final EntityPlayer P = CommandUtils.getPlayer(S); - - if (PlayerUtils.isPlayerOP(P)) { - CORE.DEBUG = Utils.invertBoolean(CORE.DEBUG); - PlayerUtils.messagePlayer(P, "Toggled GT++ Debug Mode - Enabled: "+CORE.DEBUG); + if (argString == null || argString.length == 0 || argString.length > 1) { + Logger.INFO("Toggling Debug Mode & Logging."); + final EntityPlayer P = CommandUtils.getPlayer(S); + if (PlayerUtils.isPlayerOP(P)) { + CORE.DEBUG = Utils.invertBoolean(CORE.DEBUG); + PlayerUtils.messagePlayer(P, "Toggled GT++ Debug Mode - Enabled: "+CORE.DEBUG); + AsmConfig.disableAllLogging = Utils.invertBoolean(AsmConfig.disableAllLogging); + PlayerUtils.messagePlayer(P, "Toggled GT++ Logging - Enabled: "+(!AsmConfig.disableAllLogging)); + } + } + else { + if (argString[0].toLowerCase().equals("debug")) { + Logger.INFO("Toggling Debug Mode."); + final EntityPlayer P = CommandUtils.getPlayer(S); + if (PlayerUtils.isPlayerOP(P)) { + CORE.DEBUG = Utils.invertBoolean(CORE.DEBUG); + PlayerUtils.messagePlayer(P, "Toggled GT++ Debug Mode - Enabled: "+CORE.DEBUG); + } + } + else if (argString[0].toLowerCase().equals("logging")) { + Logger.INFO("Toggling Logging."); + final EntityPlayer P = CommandUtils.getPlayer(S); + if (PlayerUtils.isPlayerOP(P)) { + AsmConfig.disableAllLogging = Utils.invertBoolean(AsmConfig.disableAllLogging); + PlayerUtils.messagePlayer(P, "Toggled GT++ Logging - Enabled: "+(!AsmConfig.disableAllLogging)); + } + } + else { + final EntityPlayer P = CommandUtils.getPlayer(S); + if (PlayerUtils.isPlayerOP(P)) { + PlayerUtils.messagePlayer(P, "Invalid command, use 'debug' or 'logging'"); + } + } } + + } @Override diff --git a/src/Java/gtPlusPlus/core/common/CommonProxy.java b/src/Java/gtPlusPlus/core/common/CommonProxy.java index 23bd46d5b0..ea106a2c2f 100644 --- a/src/Java/gtPlusPlus/core/common/CommonProxy.java +++ b/src/Java/gtPlusPlus/core/common/CommonProxy.java @@ -190,11 +190,17 @@ public class CommonProxy { } // Compat Handling + Logger.INFO("Removing recipes from other mods."); COMPAT_HANDLER.RemoveRecipesFromOtherMods(); + Logger.INFO("Initialising Handler, Then Adding Recipes"); COMPAT_HANDLER.InitialiseHandlerThenAddRecipes(); + Logger.INFO("Loading Gregtech API recipes."); COMPAT_HANDLER.startLoadingGregAPIBasedRecipes(); + Logger.INFO("Loading Intermod staging."); COMPAT_IntermodStaging.postInit(e); + Logger.INFO("Loading queued recipes."); COMPAT_HANDLER.runQueuedRecipes(); + Logger.INFO("Registering custom mob drops."); registerCustomMobDrops(); } diff --git a/src/Java/gtPlusPlus/core/handler/Recipes/DecayableRecipe.java b/src/Java/gtPlusPlus/core/handler/Recipes/DecayableRecipe.java new file mode 100644 index 0000000000..360b0440a2 --- /dev/null +++ b/src/Java/gtPlusPlus/core/handler/Recipes/DecayableRecipe.java @@ -0,0 +1,39 @@ +package gtPlusPlus.core.handler.Recipes; + +import gregtech.api.util.GT_Utility; +import gtPlusPlus.api.objects.data.AutoMap; +import gtPlusPlus.core.util.minecraft.ItemUtils; +import net.minecraft.item.ItemStack; + +public class DecayableRecipe { + + public static final AutoMap<DecayableRecipe> mRecipes = new AutoMap<DecayableRecipe>(); + + + public final int mTime; + public final ItemStack mInput; + public final ItemStack mOutput; + + public DecayableRecipe(int time, ItemStack input, ItemStack output) { + mTime = time; + mInput = input; + mOutput = output; + mRecipes.put(this); + } + + @Override + public boolean equals(Object o) { + if (o instanceof DecayableRecipe) { + DecayableRecipe i = (DecayableRecipe) o; + if (i.mTime == this.mTime && GT_Utility.areStacksEqual(mInput, i.mInput) && GT_Utility.areStacksEqual(mOutput, i.mOutput)) { + return true; + } + } + return false; + } + + public boolean isValid() { + return (mTime > 0 && ItemUtils.checkForInvalidItems(mInput) && ItemUtils.checkForInvalidItems(mOutput)); + } + +} diff --git a/src/Java/gtPlusPlus/core/item/materials/DustDecayable.java b/src/Java/gtPlusPlus/core/item/materials/DustDecayable.java index aa6fdabacc..9994c7d362 100644 --- a/src/Java/gtPlusPlus/core/item/materials/DustDecayable.java +++ b/src/Java/gtPlusPlus/core/item/materials/DustDecayable.java @@ -1,5 +1,7 @@ package gtPlusPlus.core.item.materials; +import static gtPlusPlus.core.util.minecraft.ItemUtils.getSimpleStack; + import java.util.List; import net.minecraft.client.renderer.texture.IIconRegister; @@ -10,6 +12,7 @@ import net.minecraft.item.ItemStack; import net.minecraft.world.World; import gregtech.api.util.GT_OreDictUnificator; +import gtPlusPlus.core.handler.Recipes.DecayableRecipe; import gtPlusPlus.core.item.base.BaseItemTickable; import gtPlusPlus.core.lib.CORE; import gtPlusPlus.core.util.minecraft.EntityUtils; @@ -25,6 +28,7 @@ public class DustDecayable extends BaseItemTickable { this.turnsIntoItem = turnsInto; this.radLevel = radLevel; GT_OreDictUnificator.registerOre(unlocal, ItemUtils.getSimpleStack(this)); + new DecayableRecipe(maxTicks, getSimpleStack(this), getSimpleStack(turnsInto)); } @Override diff --git a/src/Java/gtPlusPlus/core/recipe/RECIPES_General.java b/src/Java/gtPlusPlus/core/recipe/RECIPES_General.java index 14807f7f3e..02b282b1b3 100644 --- a/src/Java/gtPlusPlus/core/recipe/RECIPES_General.java +++ b/src/Java/gtPlusPlus/core/recipe/RECIPES_General.java @@ -6,7 +6,9 @@ import static gtPlusPlus.core.util.minecraft.ItemUtils.getSimpleStack; import static gtPlusPlus.xmod.gregtech.registration.gregtech.GregtechConduits.generatePipeRecipes; import static gtPlusPlus.xmod.gregtech.registration.gregtech.GregtechConduits.generateWireRecipes; -import gregtech.api.enums.*; +import gregtech.api.enums.ItemList; +import gregtech.api.enums.Materials; +import gregtech.api.enums.OrePrefixes; import gregtech.api.util.GT_ModHandler; import gtPlusPlus.api.objects.Logger; import gtPlusPlus.core.block.ModBlocks; @@ -15,16 +17,13 @@ import gtPlusPlus.core.lib.CORE; import gtPlusPlus.core.lib.LoadedMods; import gtPlusPlus.core.material.ALLOY; import gtPlusPlus.core.material.ELEMENT; -import gtPlusPlus.core.material.nuclear.FLUORIDES; import gtPlusPlus.core.recipe.common.CI; -import gtPlusPlus.core.util.Utils; import gtPlusPlus.core.util.minecraft.FluidUtils; import gtPlusPlus.core.util.minecraft.ItemUtils; import gtPlusPlus.core.util.minecraft.RecipeUtils; import gtPlusPlus.xmod.bop.blocks.BOP_Block_Registrator; import gtPlusPlus.xmod.gregtech.api.enums.GregtechItemList; import gtPlusPlus.xmod.gregtech.api.enums.GregtechOrePrefixes.GT_Materials; -import gtPlusPlus.xmod.gregtech.registration.gregtech.GregtechConduits; import net.minecraft.init.Blocks; import net.minecraft.init.Items; import net.minecraft.item.ItemStack; @@ -119,12 +118,6 @@ public class RECIPES_General { Logger.INFO("Added a recipe for Rainforest oak Saplings."); } - - // Try fix this ore - if (ModBlocks.blockOreFluorite != null){ - RecipeUtils.addShapelessGregtechRecipe(new ItemStack[]{ItemUtils.getSimpleStack(ModBlocks.blockOreFluorite)}, FLUORIDES.FLUORITE.getOre(1)); - } - //Iron bars final ItemStack ironBars; if (CORE.GTNH) { diff --git a/src/Java/gtPlusPlus/core/recipe/RECIPES_Machines.java b/src/Java/gtPlusPlus/core/recipe/RECIPES_Machines.java index 52a6c4889e..0bd5c0cf76 100644 --- a/src/Java/gtPlusPlus/core/recipe/RECIPES_Machines.java +++ b/src/Java/gtPlusPlus/core/recipe/RECIPES_Machines.java @@ -2,6 +2,7 @@ package gtPlusPlus.core.recipe; import static gtPlusPlus.core.lib.CORE.GTNH; +import cpw.mods.fml.common.Loader; import gregtech.api.enums.*; import gregtech.api.util.GT_ModHandler; import gtPlusPlus.api.objects.Logger; @@ -15,8 +16,12 @@ import gtPlusPlus.core.material.Material; import gtPlusPlus.core.recipe.common.CI; import gtPlusPlus.core.util.Utils; import gtPlusPlus.core.util.minecraft.*; +import gtPlusPlus.core.util.reflect.ReflectionUtils; import gtPlusPlus.everglades.dimension.Dimension_Everglades; import gtPlusPlus.xmod.gregtech.api.enums.GregtechItemList; +import gtPlusPlus.xmod.gregtech.common.covers.CoverManager; +import gtPlusPlus.xmod.gregtech.common.items.MetaCustomCoverItem; +import net.minecraft.block.Block; import net.minecraft.init.Blocks; import net.minecraft.init.Items; import net.minecraft.item.Item; @@ -207,7 +212,7 @@ public class RECIPES_Machines { } private static void run(){ - + //Determines Casing Recipe Output if (CORE.MAIN_GREGTECH_5U_EXPERIMENTAL_FORK && !GTNH){ Casing_Amount=2; @@ -215,7 +220,7 @@ public class RECIPES_Machines { else { Casing_Amount=1; } - + initModItems(); controlCores(); energyCores(); @@ -223,6 +228,7 @@ public class RECIPES_Machines { largeArcFurnace(); industrialVacuumFurnace(); fakeMachineCasingCovers(); + ztonesCoverRecipes(); superBuses(); } @@ -289,7 +295,7 @@ public class RECIPES_Machines { private static void runModRecipes(){ if (LoadedMods.Gregtech){ - + //Computer Cube CORE.RA.addSixSlotAssemblingRecipe( new ItemStack[] { @@ -357,7 +363,7 @@ public class RECIPES_Machines { ItemUtils.getSimpleStack(ModBlocks.blockCustomJukebox), 20 * 30, 30); - + //Poo Collector CORE.RA.addSixSlotAssemblingRecipe( new ItemStack[] { @@ -708,7 +714,7 @@ public class RECIPES_Machines { //Semi-Fluid Generators ItemStack mSemiFluidgen = ItemUtils.getItemStackFromFQRN("IC2:blockGenerator:7", 1); mSemiFluidgen.setItemDamage(7); - //ItemUtils.simpleMetaStack("IC2:blockGenerator:7", 7, 1); + //ItemUtils.simpleMetaStack("IC2:blockGenerator:7", 7, 1); ItemStack[] aSemifluids = new ItemStack[] {mSemiFluidgen, GregtechItemList.Generator_SemiFluid_LV.get(1), GregtechItemList.Generator_SemiFluid_MV.get(1), GregtechItemList.Generator_SemiFluid_HV.get(1)}; for (int o=1;o<4;o++) { CORE.RA.addSixSlotAssemblingRecipe( @@ -829,7 +835,7 @@ public class RECIPES_Machines { "plankWood", "frameGtTumbaga", "plankWood", "plankWood", "plankWood", "plankWood", RECIPE_TreeFarmFrame); - } + } if (CORE.ConfigSwitches.enableMachine_Tesseracts){ //Tesseracts @@ -852,8 +858,8 @@ public class RECIPES_Machines { if (CORE.ConfigSwitches.enableMachine_SimpleWasher){ ItemStack plateWrought = ItemUtils.getItemStackOfAmountFromOreDict("plateWroughtIron", 1); ItemStack washerPipe; - - + + if (CORE.ConfigSwitches.enableCustom_Pipes){ washerPipe = ItemUtils.getItemStackOfAmountFromOreDict("pipeLargeClay", 1); RecipeUtils.addShapedGregtechRecipe( @@ -869,7 +875,7 @@ public class RECIPES_Machines { plateWrought, washerPipe, plateWrought, plateWrought, CI.machineCasing_ULV, plateWrought, GregtechItemList.SimpleDustWasher_ULV.get(1)); - + int aSimpleWasherTier = 2; int aSlot = 0; ItemStack[][] aInputsForSimpleWashers = new ItemStack[4][6]; @@ -880,7 +886,7 @@ public class RECIPES_Machines { CI.getTieredComponent(OrePrefixes.plate, 1, GTNH ? 8 : 4), CI.getTieredComponent(OrePrefixes.rod, 2, GTNH ? 4 : 2), CI.getTieredComponent(OrePrefixes.circuit, 2, GTNH ? 3 : 1), - + }; aInputsForSimpleWashers[1] = new ItemStack[] { CI.getTieredMachineHull(4), @@ -888,7 +894,7 @@ public class RECIPES_Machines { CI.getTieredComponent(OrePrefixes.plate, 3, GTNH ? 12 : 6), CI.getTieredComponent(OrePrefixes.rod, 4, GTNH ? 6 : 3), CI.getTieredComponent(OrePrefixes.circuit, 4, GTNH ? 4 : 2), - + }; aInputsForSimpleWashers[2] = new ItemStack[] { CI.getTieredMachineHull(6), @@ -896,7 +902,7 @@ public class RECIPES_Machines { CI.getTieredComponent(OrePrefixes.plate, 5, GTNH ? 16 : 8), CI.getTieredComponent(OrePrefixes.rod, 6, GTNH ? 8 : 4), CI.getTieredComponent(OrePrefixes.circuit, 6, GTNH ? 6 : 3), - + }; aInputsForSimpleWashers[3] = new ItemStack[] { CI.getTieredMachineHull(8), @@ -904,37 +910,37 @@ public class RECIPES_Machines { CI.getTieredComponent(OrePrefixes.plate, 7, GTNH ? 32 : 16), CI.getTieredComponent(OrePrefixes.rod, 8, GTNH ? 10 : 5), CI.getTieredComponent(OrePrefixes.circuit, 8, GTNH ? 8 : 4), - + }; - - - - - - + + + + + + ItemStack[] aSimpleWashers = new ItemStack[] {GregtechItemList.SimpleDustWasher_MV.get(1), GregtechItemList.SimpleDustWasher_EV.get(1), GregtechItemList.SimpleDustWasher_LuV.get(1), GregtechItemList.SimpleDustWasher_UV.get(1)}; for (int i=0;i<4;i++) { - + CORE.RA.addSixSlotAssemblingRecipe( aInputsForSimpleWashers[aSlot], CI.getTieredFluid(aSimpleWasherTier, 144 * aSimpleWasherTier), aSimpleWashers[aSlot], 20 * 15 * aSimpleWasherTier, (int) GT_Values.V[aSimpleWasherTier]); - + aSimpleWasherTier += 2; aSlot++; } - - - - - - + + + + + + } if (CORE.ConfigSwitches.enableMachine_Pollution && CORE.MAIN_GREGTECH_5U_EXPERIMENTAL_FORK){ - + RecipeUtils.addShapedGregtechRecipe( "plateCarbon", "plateCarbon", "plateCarbon", "dustCarbon", "dustCarbon", "dustCarbon", @@ -1164,7 +1170,7 @@ public class RECIPES_Machines { RECIPE_CyclotronController = GregtechItemList.COMET_Cyclotron.get(1); RECIPE_CyclotronOuterCasing = GregtechItemList.Casing_Cyclotron_External.get(Casing_Amount); RECIPE_CyclotronInnerCoil = GregtechItemList.Casing_Cyclotron_Coil.get(1); - + //Outer Casing CORE.RA.addSixSlotAssemblingRecipe( new ItemStack[] { @@ -1179,8 +1185,8 @@ public class RECIPES_Machines { RECIPE_CyclotronOuterCasing, 30 * 20 * 2, MaterialUtils.getVoltageForTier(4)); - - + + //Inner Coil CORE.RA.addSixSlotAssemblingRecipe( new ItemStack[] { @@ -1995,7 +2001,7 @@ public class RECIPES_Machines { } } - + private static void largeArcFurnace() { int aCostMultiplier = GTNH ? 2 : 1; CORE.RA.addSixSlotAssemblingRecipe( @@ -2025,10 +2031,10 @@ public class RECIPES_Machines { 60 * 20 * 8, MaterialUtils.getVoltageForTier(6)); } - + private static void industrialVacuumFurnace() { int aCostMultiplier = GTNH ? 2 : 1; - + CORE.RA.addSixSlotAssemblingRecipe( new ItemStack[] { CI.getTieredMachineHull(-1, 1 * aCostMultiplier), @@ -2041,9 +2047,9 @@ public class RECIPES_Machines { GregtechItemList.Casing_Vacuum_Furnace.get(Casing_Amount), 20 * 10 * 6, MaterialUtils.getVoltageForTier(6)); - + ; - + CORE.RA.addSixSlotAssemblingRecipe( new ItemStack[] { GregtechItemList.Casing_Vacuum_Furnace.get(Casing_Amount), @@ -2058,113 +2064,191 @@ public class RECIPES_Machines { 60 * 20 * 12, MaterialUtils.getVoltageForTier(7)); } - + private static void fakeMachineCasingCovers() { - GregtechItemList[] mMachineCasingCovers = new GregtechItemList[] { - GregtechItemList.FakeMachineCasingPlate_ULV, - GregtechItemList.FakeMachineCasingPlate_LV, - GregtechItemList.FakeMachineCasingPlate_MV, - GregtechItemList.FakeMachineCasingPlate_HV, - GregtechItemList.FakeMachineCasingPlate_EV, - GregtechItemList.FakeMachineCasingPlate_IV, - GregtechItemList.FakeMachineCasingPlate_LuV, - GregtechItemList.FakeMachineCasingPlate_ZPM, - GregtechItemList.FakeMachineCasingPlate_UV, - GregtechItemList.FakeMachineCasingPlate_MAX, - }; - for (int i = 0;i<10;i++) { - GT_Values.RA.addCutterRecipe( - CI.getTieredMachineCasing(i), - mMachineCasingCovers[i].get(5), - null, - 20 * 5 * i, - (int) GT_Values.V[i]); - } + GregtechItemList[] mMachineCasingCovers = new GregtechItemList[] { + GregtechItemList.FakeMachineCasingPlate_ULV, + GregtechItemList.FakeMachineCasingPlate_LV, + GregtechItemList.FakeMachineCasingPlate_MV, + GregtechItemList.FakeMachineCasingPlate_HV, + GregtechItemList.FakeMachineCasingPlate_EV, + GregtechItemList.FakeMachineCasingPlate_IV, + GregtechItemList.FakeMachineCasingPlate_LuV, + GregtechItemList.FakeMachineCasingPlate_ZPM, + GregtechItemList.FakeMachineCasingPlate_UV, + GregtechItemList.FakeMachineCasingPlate_MAX, + }; + int aMaxTier = GT_Values.VOLTAGE_NAMES.length; + if (!GTNH) { + aMaxTier = 10; + } + ItemStack aTier[] = new ItemStack[aMaxTier]; + for (int i=0;i<aMaxTier;i++) { + aTier[i] = ItemUtils.simpleMetaStack(CoverManager.Cover_Gt_Machine_Casing, i, 7); + } + // Deprecate old recipes + for (int i=0;i<10;i++) { + RecipeUtils.addShapelessGregtechRecipe(new ItemStack[] {mMachineCasingCovers[i].get(1)}, ItemUtils.getSimpleStack(aTier[i], 1)); + } + // Add recipes for new ones + for (int i = 0;i<aMaxTier;i++) { + GT_Values.RA.addCutterRecipe( + CI.getTieredMachineCasing(i), + aTier[i], + null, + 20 * 5 * i, + (int) GT_Values.V[i]); + } + } + + private static void ztonesCoverRecipes() { + + if (!Loader.isModLoaded("Ztones")) { + return; + } + Class ModBlocksClass = ReflectionUtils.getClass("com.riciJak.Ztones.init.ModBlocks"); + Block agon = (Block) ReflectionUtils.getFieldValue( ReflectionUtils.getField(ModBlocksClass, "agonBlock")); + Block korp = (Block) ReflectionUtils.getFieldValue( ReflectionUtils.getField(ModBlocksClass, "korpBlock")); + Block jelt = (Block) ReflectionUtils.getFieldValue( ReflectionUtils.getField(ModBlocksClass, "jeltBlock")); + Block bitt = (Block) ReflectionUtils.getFieldValue( ReflectionUtils.getField(ModBlocksClass, "bittBlock")); + Block iszm = (Block) ReflectionUtils.getFieldValue( ReflectionUtils.getField(ModBlocksClass, "iszmBlock")); + + // "agon", "iszm", "korp", "jelt", "bitt" + + ItemStack[] aBlocks = new ItemStack[] { + ItemUtils.getSimpleStack(agon), + ItemUtils.getSimpleStack(iszm), + ItemUtils.getSimpleStack(korp), + ItemUtils.getSimpleStack(jelt), + ItemUtils.getSimpleStack(bitt) + }; + MetaCustomCoverItem[] aCovers = new MetaCustomCoverItem[] { + CoverManager.Cover_Agon, + CoverManager.Cover_Iszm, + CoverManager.Cover_Korp, + CoverManager.Cover_Jelt, + CoverManager.Cover_Bitt + }; + + ItemStack aInputs[][] = new ItemStack[5][16]; + ItemStack aOutputs[][] = new ItemStack[5][16]; + for (int a=0;a<5;a++) { + for (int i=0;i<16;i++) { + aInputs[a][i] = ItemUtils.simpleMetaStack(aBlocks[a].getItem(), i, 1); + aOutputs[a][i] = ItemUtils.simpleMetaStack(aCovers[a], i, 9); + } + } + for (int a=0;a<5;a++) { + for (int i = 0;i<16;i++) { + ItemStack aInput = aInputs[a][i]; + ItemStack aOutput = aOutputs[a][i]; + if (GT_Values.RA.addCutterRecipe( + aInput, + aOutput, + null, + 20 * 5, + 16)) { + Logger.INFO("Added Cutting recipe for "+aInput.getDisplayName()); + } + + if (CORE.RA.addSixSlotAssemblingRecipe( + new ItemStack[] { + CI.getNumberedCircuit((i/4)+4), + aOutput + }, + FluidUtils.getWildcardFluidStack("glue", 250), + aInput, + 20 * 10, + 16)) { + Logger.INFO("Added Assembly recipe for "+aInput.getDisplayName()); + } + } + } } - + private static void superBuses() { - GregtechItemList[] mSuperBusesInput = new GregtechItemList[] { - GregtechItemList.Hatch_SuperBus_Input_ULV, - GregtechItemList.Hatch_SuperBus_Input_LV, - GregtechItemList.Hatch_SuperBus_Input_MV, - GregtechItemList.Hatch_SuperBus_Input_HV, - GregtechItemList.Hatch_SuperBus_Input_EV, - GregtechItemList.Hatch_SuperBus_Input_IV, - GregtechItemList.Hatch_SuperBus_Input_LuV, - GregtechItemList.Hatch_SuperBus_Input_ZPM, - GregtechItemList.Hatch_SuperBus_Input_UV, - GregtechItemList.Hatch_SuperBus_Input_MAX, - }; - - GregtechItemList[] mSuperBusesOutput = new GregtechItemList[] { - GregtechItemList.Hatch_SuperBus_Output_ULV, - GregtechItemList.Hatch_SuperBus_Output_LV, - GregtechItemList.Hatch_SuperBus_Output_MV, - GregtechItemList.Hatch_SuperBus_Output_HV, - GregtechItemList.Hatch_SuperBus_Output_EV, - GregtechItemList.Hatch_SuperBus_Output_IV, - GregtechItemList.Hatch_SuperBus_Output_LuV, - GregtechItemList.Hatch_SuperBus_Output_ZPM, - GregtechItemList.Hatch_SuperBus_Output_UV, - GregtechItemList.Hatch_SuperBus_Output_MAX, - }; - - ItemStack[] mInputHatch = new ItemStack[] { - ItemList.Hatch_Input_Bus_EV.get(1), - ItemList.Hatch_Input_Bus_IV.get(1), - ItemList.Hatch_Input_Bus_LuV.get(1), - ItemList.Hatch_Input_Bus_ZPM.get(1), - ItemList.Hatch_Input_Bus_UV.get(1), - ItemList.Hatch_Input_Bus_MAX.get(1), - GregtechItemList.Hatch_SuperBus_Input_ULV.get(1), - GregtechItemList.Hatch_SuperBus_Input_LV.get(1), - GregtechItemList.Hatch_SuperBus_Input_MV.get(1), - GregtechItemList.Hatch_SuperBus_Input_HV.get(1), - }; - - ItemStack[] mOutputHatch = new ItemStack[] { - ItemList.Hatch_Output_Bus_EV.get(1), - ItemList.Hatch_Output_Bus_IV.get(1), - ItemList.Hatch_Output_Bus_LuV.get(1), - ItemList.Hatch_Output_Bus_ZPM.get(1), - ItemList.Hatch_Output_Bus_UV.get(1), - ItemList.Hatch_Output_Bus_MAX.get(1), - GregtechItemList.Hatch_SuperBus_Output_ULV.get(1), - GregtechItemList.Hatch_SuperBus_Output_LV.get(1), - GregtechItemList.Hatch_SuperBus_Output_MV.get(1), - GregtechItemList.Hatch_SuperBus_Output_HV.get(1), - }; - - //Input Buses - for (int i = 0; i < 10; i++) { - CORE.RA.addSixSlotAssemblingRecipe(new ItemStack[] { - CI.getNumberedCircuit(16), - mInputHatch[i], - CI.getElectricMotor(i, GTNH ? 8 : 2), - CI.getConveyor(i, GTNH ? 10 : 5), - CI.getGear(i, GTNH ? 6 : 3), - CI.getTieredComponent(OrePrefixes.circuit, i, GTNH ? 4 : 2) - }, - CI.getAlternativeTieredFluid(i, 144 * 8), - mSuperBusesInput[i].get(1), 20 * 30 * 2 * i, - (int) GT_Values.V[i]); - } - //Output Buses - for (int i = 0; i < 10; i++) { - CORE.RA.addSixSlotAssemblingRecipe(new ItemStack[] { - CI.getNumberedCircuit(18), - mOutputHatch[i], - CI.getElectricPiston(i, GTNH ? 8 : 2), - CI.getConveyor(i, GTNH ? 10 : 5), - CI.getGear(i, GTNH ? 6 : 3), - CI.getTieredComponent(OrePrefixes.circuit, i, GTNH ? 4 : 2) - }, - CI.getTertiaryTieredFluid(i, 144 * 8), - mSuperBusesOutput[i].get(1), 20 * 30 * 2 * i, - (int) GT_Values.V[i]); - } - + GregtechItemList[] mSuperBusesInput = new GregtechItemList[] { + GregtechItemList.Hatch_SuperBus_Input_ULV, + GregtechItemList.Hatch_SuperBus_Input_LV, + GregtechItemList.Hatch_SuperBus_Input_MV, + GregtechItemList.Hatch_SuperBus_Input_HV, + GregtechItemList.Hatch_SuperBus_Input_EV, + GregtechItemList.Hatch_SuperBus_Input_IV, + GregtechItemList.Hatch_SuperBus_Input_LuV, + GregtechItemList.Hatch_SuperBus_Input_ZPM, + GregtechItemList.Hatch_SuperBus_Input_UV, + GregtechItemList.Hatch_SuperBus_Input_MAX, + }; + + GregtechItemList[] mSuperBusesOutput = new GregtechItemList[] { + GregtechItemList.Hatch_SuperBus_Output_ULV, + GregtechItemList.Hatch_SuperBus_Output_LV, + GregtechItemList.Hatch_SuperBus_Output_MV, + GregtechItemList.Hatch_SuperBus_Output_HV, + GregtechItemList.Hatch_SuperBus_Output_EV, + GregtechItemList.Hatch_SuperBus_Output_IV, + GregtechItemList.Hatch_SuperBus_Output_LuV, + GregtechItemList.Hatch_SuperBus_Output_ZPM, + GregtechItemList.Hatch_SuperBus_Output_UV, + GregtechItemList.Hatch_SuperBus_Output_MAX, + }; + + ItemStack[] mInputHatch = new ItemStack[] { + ItemList.Hatch_Input_Bus_EV.get(1), + ItemList.Hatch_Input_Bus_IV.get(1), + ItemList.Hatch_Input_Bus_LuV.get(1), + ItemList.Hatch_Input_Bus_ZPM.get(1), + ItemList.Hatch_Input_Bus_UV.get(1), + ItemList.Hatch_Input_Bus_MAX.get(1), + GregtechItemList.Hatch_SuperBus_Input_ULV.get(1), + GregtechItemList.Hatch_SuperBus_Input_LV.get(1), + GregtechItemList.Hatch_SuperBus_Input_MV.get(1), + GregtechItemList.Hatch_SuperBus_Input_HV.get(1), + }; + + ItemStack[] mOutputHatch = new ItemStack[] { + ItemList.Hatch_Output_Bus_EV.get(1), + ItemList.Hatch_Output_Bus_IV.get(1), + ItemList.Hatch_Output_Bus_LuV.get(1), + ItemList.Hatch_Output_Bus_ZPM.get(1), + ItemList.Hatch_Output_Bus_UV.get(1), + ItemList.Hatch_Output_Bus_MAX.get(1), + GregtechItemList.Hatch_SuperBus_Output_ULV.get(1), + GregtechItemList.Hatch_SuperBus_Output_LV.get(1), + GregtechItemList.Hatch_SuperBus_Output_MV.get(1), + GregtechItemList.Hatch_SuperBus_Output_HV.get(1), + }; + + //Input Buses + for (int i = 0; i < 10; i++) { + CORE.RA.addSixSlotAssemblingRecipe(new ItemStack[] { + CI.getNumberedCircuit(16), + mInputHatch[i], + CI.getElectricMotor(i, GTNH ? 8 : 2), + CI.getConveyor(i, GTNH ? 10 : 5), + CI.getGear(i, GTNH ? 6 : 3), + CI.getTieredComponent(OrePrefixes.circuit, i, GTNH ? 4 : 2) + }, + CI.getAlternativeTieredFluid(i, 144 * 8), + mSuperBusesInput[i].get(1), 20 * 30 * 2 * i, + (int) GT_Values.V[i]); + } + //Output Buses + for (int i = 0; i < 10; i++) { + CORE.RA.addSixSlotAssemblingRecipe(new ItemStack[] { + CI.getNumberedCircuit(18), + mOutputHatch[i], + CI.getElectricPiston(i, GTNH ? 8 : 2), + CI.getConveyor(i, GTNH ? 10 : 5), + CI.getGear(i, GTNH ? 6 : 3), + CI.getTieredComponent(OrePrefixes.circuit, i, GTNH ? 4 : 2) + }, + CI.getTertiaryTieredFluid(i, 144 * 8), + mSuperBusesOutput[i].get(1), 20 * 30 * 2 * i, + (int) GT_Values.V[i]); + } + } - + } diff --git a/src/Java/gtPlusPlus/core/recipe/common/CI.java b/src/Java/gtPlusPlus/core/recipe/common/CI.java index a9f336d19c..15589ada84 100644 --- a/src/Java/gtPlusPlus/core/recipe/common/CI.java +++ b/src/Java/gtPlusPlus/core/recipe/common/CI.java @@ -447,7 +447,10 @@ public class CI { } public static final ItemStack getTieredMachineCasing(int tier){ - if (tier == 0){ + if (tier == 0){ + if (machineCasing_ULV == null) { + machineCasing_ULV = ItemList.Casing_ULV.get(1); + } return machineCasing_ULV; } else if (tier == 1){ diff --git a/src/Java/gtPlusPlus/core/util/minecraft/ItemUtils.java b/src/Java/gtPlusPlus/core/util/minecraft/ItemUtils.java index be35c40dd8..cd5583e223 100644 --- a/src/Java/gtPlusPlus/core/util/minecraft/ItemUtils.java +++ b/src/Java/gtPlusPlus/core/util/minecraft/ItemUtils.java @@ -33,7 +33,6 @@ import gtPlusPlus.core.material.Material; import gtPlusPlus.core.util.Utils; import gtPlusPlus.core.util.math.MathUtils; import gtPlusPlus.core.util.reflect.ReflectionUtils; -import gtPlusPlus.xmod.gregtech.api.enums.GregtechItemList; import gtPlusPlus.xmod.gregtech.api.items.Gregtech_MetaTool; import gtPlusPlus.xmod.gregtech.common.items.MetaGeneratedGregtechTools; import gtPlusPlus.xmod.gregtech.loaders.RecipeGen_DustGeneration; @@ -44,8 +43,8 @@ import net.minecraft.init.Items; import net.minecraft.inventory.IInventory; import net.minecraft.item.Item; import net.minecraft.item.Item.ToolMaterial; -import net.minecraft.nbt.NBTTagCompound; import net.minecraft.item.ItemStack; +import net.minecraft.nbt.NBTTagCompound; import net.minecraft.util.EnumChatFormatting; import net.minecraft.util.StatCollector; import net.minecraftforge.fluids.FluidStack; @@ -60,13 +59,13 @@ public class ItemUtils { public static ItemStack getSimpleStack(final Block x) { return simpleMetaStack(Item.getItemFromBlock(x), 0, 1); } - + public static ItemStack getSimpleStack(final Block x, int i) { if (i == 0) { return getSimpleStack(x, i, 1); } - + return getSimpleStack(x, 0, i); } @@ -208,29 +207,23 @@ public class ItemUtils { } } - @SuppressWarnings("unused") - public static ItemStack simpleMetaStack(final Item item, final int meta, final int size) { - try { - if (item == null) { - return null; - } - Item em = item; - final Item em1 = item; - Logger.WARNING("Found: " + em1.getUnlocalizedName() + ":" + meta); - if (em1 != null) { - if (null == em) { - em = em1; - } - if (em != null) { - final ItemStack metaStack = new ItemStack(em, size, meta); - return metaStack; - } - } - return null; - } catch (final NullPointerException e) { - // Utils.LOG_ERROR(item.getUnlocalizedName()+" not found. [NULL]"); + public static ItemStack simpleMetaStack(ItemStack simpleStack, int meta, int size) { + return simpleMetaStack(simpleStack.getItem(), meta, size); + } + + public static ItemStack simpleMetaStack(final Item item, int meta, int size) { + if (item == null) { return null; } + if (meta < 0 || meta > Short.MAX_VALUE) { + meta = 0; + } + if (size < 0 || size > 64) { + size = 1; + } + Logger.INFO("Found Metastack: " + item.getUnlocalizedName() + ":" + meta); + final ItemStack metaStack = new ItemStack(item, size, meta); + return metaStack; } public static ItemStack simpleMetaStack(final Block block, final int meta, final int size) { @@ -305,9 +298,9 @@ public class ItemUtils { else { mTemp = Utils.sanitizeString(mTemp); } - - - + + + if (oredictName.contains("rod")) { String s = "stick"+oredictName.substring(3); oredictName = s; @@ -374,7 +367,7 @@ public class ItemUtils { return returnValue.copy(); } } - + Logger.RECIPE(oredictName + " was not valid."); return null; } catch (final Throwable t) { @@ -405,7 +398,7 @@ public class ItemUtils { new BaseItemDustUnique("itemDust" + unlocalizedName, materialName, mChemForm, Colour, "Dust"), new BaseItemDustUnique("itemDustSmall" + unlocalizedName, materialName, mChemForm, Colour, "Small"), new BaseItemDustUnique("itemDustTiny" + unlocalizedName, materialName, mChemForm, Colour, "Tiny") }; - + //Generate Shaped/Shapeless Recipes final ItemStack normalDust = ItemUtils.getSimpleStack(output[0]); @@ -459,7 +452,7 @@ public class ItemUtils { Logger.WARNING("4 Small dust from 1 Dust Recipe: "+materialName+" - Failed"); } } - + return output; } @@ -489,7 +482,7 @@ public class ItemUtils { public static Item[] generateSpecialUseDusts(final Material material, final boolean onlyLargeDust) { return generateSpecialUseDusts(material, onlyLargeDust, false); } - + public static Item[] generateSpecialUseDusts(final Material material, final boolean onlyLargeDust, final boolean disableExtraRecipes) { final String materialName = material.getLocalizedName(); final String unlocalizedName = Utils.sanitizeString(materialName); @@ -697,19 +690,19 @@ public class ItemUtils { public static String[] getArrayStackNamesAsArray(final ItemStack[] aStack) { final String[] itemNames = aStack == null ? new String[] {} : new String[aStack.length]; Logger.INFO(""+aStack.length); - + if (aStack == null || aStack.length < 1) { return itemNames; } - + int arpos = 0; for (final ItemStack alph : aStack) { if (alph == null) { continue; } try { - itemNames[arpos] = alph.getDisplayName(); - arpos++; + itemNames[arpos] = alph.getDisplayName(); + arpos++; } catch (Throwable t) { t.printStackTrace(); @@ -1001,15 +994,15 @@ public class ItemUtils { return true; } - - + + public static IInventory organiseInventory(IInventory aInputInventory) { ItemStack[] p = new ItemStack[aInputInventory.getSizeInventory()]; for (int o = 0; o < aInputInventory.getSizeInventory(); o++) { p[o] = aInputInventory.getStackInSlot(o); } //ItemStack[] g = organiseInventory(p); - + IInventory aTemp = aInputInventory; for (int i = 0; i < p.length; ++i) { for (int j = i + 1; j < p.length; ++j) { @@ -1019,22 +1012,22 @@ public class ItemUtils { } } } - + /* for (int o = 0; o < aInputInventory.getSizeInventory(); o++) { aTemp.setInventorySlotContents(o, g[o]); }*/ return aTemp; } - - + + public static ItemStack[] organiseInventory(ItemStack[] aInputs) { //Update Slots int aInvSize = aInputs.length; ItemStack[] newArray = new ItemStack[aInvSize]; - - + + //Try merge stacks for (int i = 0; i < aInvSize; i++) { for (int i2 = 0; i2 < aInvSize; i2++) { @@ -1048,29 +1041,29 @@ public class ItemUtils { } //Try Merge else { - + if (GT_Utility.areStacksEqual(t1[0], t1[1])) { - while ((t1[0].stackSize < 64 && t1[1].stackSize > 0)) { - t1[0].stackSize++; - t1[1].stackSize--; - if (t1[1].stackSize <= 0) { - t1[1] = null; - break; - } - if (t1[0].stackSize == 64) { - break; - } - } - newArray[i] = t1[1]; - newArray[i2] = t1[0]; + while ((t1[0].stackSize < 64 && t1[1].stackSize > 0)) { + t1[0].stackSize++; + t1[1].stackSize--; + if (t1[1].stackSize <= 0) { + t1[1] = null; + break; + } + if (t1[0].stackSize == 64) { + break; + } + } + newArray[i] = t1[1]; + newArray[i2] = t1[0]; } } } } } - + ItemStack[] newArray2 = new ItemStack[aInvSize]; - + //Move nulls to end int count2 = 0; for (int i = 0; i < aInvSize; i++) @@ -1078,10 +1071,10 @@ public class ItemUtils { newArray2[count2++] = newArray[i]; while (count2 < aInvSize) newArray2[count2++] = null; - + return newArray2; - + } public static String getItemName(ItemStack aStack) { @@ -1092,7 +1085,7 @@ public class ItemUtils { try { aDisplay = ("" + StatCollector .translateToLocal(aStack.getItem().getUnlocalizedNameInefficiently(aStack) + ".name")) - .trim(); + .trim(); if (aStack.hasTagCompound()) { if (aStack.stackTagCompound != null && aStack.stackTagCompound.hasKey("display", 10)) { NBTTagCompound nbttagcompound = aStack.stackTagCompound.getCompoundTag("display"); @@ -1120,7 +1113,7 @@ public class ItemUtils { String aDisplay = null; try { aDisplay = (aStack.getUnlocalizedName()).trim(); - + } catch (Throwable t) { aDisplay = aStack.getItem().getUnlocalizedName(); } @@ -1129,7 +1122,7 @@ public class ItemUtils { } return aDisplay; } - + public static boolean isItemGregtechTool(ItemStack aStack) { if (aStack == null) { return false; @@ -1142,49 +1135,49 @@ public class ItemUtils { } return false; } - + public static boolean isToolWrench(ItemStack aWrench) { if (isItemGregtechTool(aWrench) && (aWrench.getItemDamage() == 16 || aWrench.getItemDamage() == 120 || aWrench.getItemDamage() == 122 || aWrench.getItemDamage() == 124 || aWrench.getItemDamage() == 7734)) { return true; } return false; } - + public static boolean isToolMallet(ItemStack aMallet) { if (isItemGregtechTool(aMallet) && (aMallet.getItemDamage() == 14)) { return true; } return false; } - + public static boolean isToolScrewdriver(ItemStack aScrewdriver) { if (isItemGregtechTool(aScrewdriver) && (aScrewdriver.getItemDamage() == 22 || aScrewdriver.getItemDamage() == 150)) { return true; } return false; } - + public static boolean isToolCrowbar(ItemStack aCrowbar) { if (isItemGregtechTool(aCrowbar) && (aCrowbar.getItemDamage() == 20)) { return true; } return false; } - + public static boolean isToolWirecutters(ItemStack aWirecutters) { if (isItemGregtechTool(aWirecutters) && (aWirecutters.getItemDamage() == 26)) { return true; } return false; } - + public static boolean isToolHammer(ItemStack aHammer) { if (isItemGregtechTool(aHammer) && (aHammer.getItemDamage() == 12 || aHammer.getItemDamage() == 7734)) { return true; } return false; } - + public static boolean isToolSolderingIron(ItemStack aSoldering) { if (isItemGregtechTool(aSoldering) && (aSoldering.getItemDamage() == 160)) { return true; @@ -1213,7 +1206,7 @@ public class ItemUtils { public static ItemStack getEnchantedBook(Enchantment aEnch, int aLevel) { return enchantItem(new ItemStack(Items.enchanted_book), aEnch, aLevel); } - + public static ItemStack enchantItem(ItemStack aStack, Enchantment aEnch, int aLevel) { Items.enchanted_book.addEnchantment(aStack, new EnchantmentData(aEnch, aLevel)); return aStack; @@ -1226,16 +1219,16 @@ public class ItemUtils { public static void hideItemFromNEI(ItemStack aItemToHide) { codechicken.nei.api.API.hideItem(aItemToHide); } - + public static ItemStack getNullStack() { return GT_Values.NI; } - + public static ItemStack depleteStack(ItemStack aStack) { return depleteStack(aStack, 1); } - + public static ItemStack depleteStack(ItemStack aStack, int aAmount) { final int cap = aStack.stackSize; if (cap > 1 && cap > aAmount) { diff --git a/src/Java/gtPlusPlus/nei/DecayableRecipeHandler.java b/src/Java/gtPlusPlus/nei/DecayableRecipeHandler.java new file mode 100644 index 0000000000..6b7f24ed37 --- /dev/null +++ b/src/Java/gtPlusPlus/nei/DecayableRecipeHandler.java @@ -0,0 +1,113 @@ +package gtPlusPlus.nei; + +import java.awt.Rectangle; +import java.util.Collection; +import java.util.List; + +import codechicken.nei.PositionedStack; +import codechicken.nei.recipe.TemplateRecipeHandler; +import crazypants.enderio.gui.IconEIO; +import crazypants.enderio.machine.enchanter.GuiEnchanter; +import gtPlusPlus.core.handler.Recipes.DecayableRecipe; +import gtPlusPlus.core.item.materials.DustDecayable; +import net.minecraft.client.gui.inventory.GuiContainer; +import net.minecraft.item.ItemStack; +import net.minecraft.util.StatCollector; + +public class DecayableRecipeHandler extends TemplateRecipeHandler { + + public String getRecipeName() { + return StatCollector.translateToLocal("gtpp.nei.decayables"); + } + + public String getGuiTexture() { + return "enderio:textures/gui/enchanter.png"; + } + + public Class<? extends GuiContainer> getGuiClass() { + return GuiEnchanter.class; + } + + public String getOverlayIdentifier() { + return "GTPP_Decayables"; + } + + public void loadTransferRects() { + this.transferRects.add(new RecipeTransferRect(new Rectangle(149, -3, 16, 16), "GTPP_Decayables", new Object[0])); + } + + public void loadCraftingRecipes(ItemStack result) { + if (result == null || !DustDecayable.class.isInstance(result.getItem())) { + return; + } + final List<DecayableRecipe> recipes = DecayableRecipe.mRecipes; + for (final DecayableRecipe recipe : recipes) { + if (recipe.isValid()) { + final ItemStack input = recipe.mInput.copy(); + final ItemStack output = recipe.mOutput.copy(); + final DecayableRecipeNEI rec = new DecayableRecipeNEI(input, output, recipe.mTime); + this.arecipes.add(rec); + } + } + } + + public void loadCraftingRecipes(String outputId, Object... results) { + if (outputId.equals(getOverlayIdentifier()) && this.getClass() == DecayableRecipeHandler.class) { + final List<DecayableRecipe> recipes = DecayableRecipe.mRecipes; + for (final DecayableRecipe recipe : recipes) { + if (recipe.isValid()) { + final ItemStack input = recipe.mInput.copy(); + final ItemStack output = recipe.mOutput.copy(); + final DecayableRecipeNEI rec = new DecayableRecipeNEI(input, output, recipe.mTime); + this.arecipes.add(rec); + } + } + } + else { + super.loadCraftingRecipes(outputId, results); + } + } + + public void loadUsageRecipes(ItemStack ingredient) { + final List<DecayableRecipe> recipes = DecayableRecipe.mRecipes; + for (final DecayableRecipe recipe : recipes) { + if (recipe.isValid()) { + final ItemStack input = recipe.mInput.copy(); + final ItemStack output = recipe.mOutput.copy(); + final DecayableRecipeNEI rec = new DecayableRecipeNEI(input, output, recipe.mTime); + if (!rec.contains((Collection)rec.input, ingredient)) { + continue; + } + rec.setIngredientPermutation((Collection) rec.input, ingredient); + this.arecipes.add(rec); + } + }} + + public void drawExtras(int recipeIndex) { + DecayableRecipeNEI recipe = (DecayableRecipeNEI) this.arecipes.get(recipeIndex); + //GuiDraw.drawStringC(recipe.getEnchantName(), 83, 10, 8421504, false); + /* + * int cost = TileEnchanter.getEnchantmentCost(recipe.recipe, 1); if (cost > 0) + * { String s = I18n.format("container.repair.cost", new Object[]{cost}); + * GuiDraw.drawStringC(s, 83, 46, 8453920); } + */ + + IconEIO.RECIPE_BUTTON.renderIcon(149.0D, -3.0D, 16.0D, 16.0D, 0.0D, true); + } + + public class DecayableRecipeNEI extends TemplateRecipeHandler.CachedRecipe + { + private PositionedStack input; + private PositionedStack output; + + public PositionedStack getResult() { + return this.output; + } + + public DecayableRecipeNEI(final ItemStack input, final ItemStack result, final int time) { + super(); + this.input = new PositionedStack(input, 22, 24); + this.output = new PositionedStack(result, 129, 24); + } + } +}
\ No newline at end of file diff --git a/src/Java/gtPlusPlus/nei/NEI_GT_Config.java b/src/Java/gtPlusPlus/nei/NEI_GT_Config.java index aca6dd5662..ab949bd517 100644 --- a/src/Java/gtPlusPlus/nei/NEI_GT_Config.java +++ b/src/Java/gtPlusPlus/nei/NEI_GT_Config.java @@ -1,10 +1,10 @@ package gtPlusPlus.nei; +import codechicken.nei.api.API; +import codechicken.nei.api.IConfigureNEI; import gregtech.api.util.CustomRecipeMap; import gregtech.api.util.Recipe_GT.Gregtech_Recipe_Map; -import codechicken.nei.api.IConfigureNEI; - public class NEI_GT_Config implements IConfigureNEI { public static boolean sIsAdded = true; @@ -23,6 +23,8 @@ implements IConfigureNEI { } } sIsAdded = true; + API.registerRecipeHandler(new DecayableRecipeHandler()); + API.registerUsageHandler(new DecayableRecipeHandler()); } @Override diff --git a/src/Java/gtPlusPlus/preloader/asm/AsmConfig.java b/src/Java/gtPlusPlus/preloader/asm/AsmConfig.java index c29d8423d8..baf62bf64d 100644 --- a/src/Java/gtPlusPlus/preloader/asm/AsmConfig.java +++ b/src/Java/gtPlusPlus/preloader/asm/AsmConfig.java @@ -20,6 +20,8 @@ public class AsmConfig { public static boolean enableGcFuelChanges; public static boolean enableRcFlowFix; public static boolean enableTcAspectSafety; + + public static boolean disableAllLogging; public AsmConfig(File file) { if (!loaded) { @@ -40,7 +42,13 @@ public class AsmConfig { Property prop; - //Debug + //Debug + prop = config.get("debug", "disableAllLogging", false); + prop.comment = "Disables ALL logging from GT++."; + prop.setLanguageKey("gtpp.disableAllLogging").setRequiresMcRestart(false); + disableAllLogging = prop.getBoolean(false); + propOrderDebug.add(prop.getName()); + prop = config.get("debug", "enableChunkDebugging", false); prop.comment = "Enable/Disable Chunk Debugging Features, Must Be enabled on Client and Server."; prop.setLanguageKey("gtpp.enableChunkDebugging").setRequiresMcRestart(true); diff --git a/src/Java/gtPlusPlus/xmod/gregtech/common/covers/GTPP_Cover_ToggleVisual.java b/src/Java/gtPlusPlus/xmod/gregtech/common/covers/GTPP_Cover_ToggleVisual.java index 7e5b07916e..561da54ceb 100644 --- a/src/Java/gtPlusPlus/xmod/gregtech/common/covers/GTPP_Cover_ToggleVisual.java +++ b/src/Java/gtPlusPlus/xmod/gregtech/common/covers/GTPP_Cover_ToggleVisual.java @@ -4,11 +4,12 @@ import java.util.Map; import java.util.concurrent.ConcurrentHashMap; import gregtech.api.interfaces.tileentity.ICoverable; +import gregtech.api.interfaces.tileentity.IGregTechTileEntity; import gregtech.api.util.GT_CoverBehavior; import gtPlusPlus.api.objects.Logger; import gtPlusPlus.api.objects.minecraft.BlockPos; import gtPlusPlus.api.objects.random.XSTR; -import gtPlusPlus.xmod.gregtech.common.items.MetaCustomCoverItem; +import gtPlusPlus.core.util.minecraft.PlayerUtils; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.item.ItemStack; import net.minecraft.nbt.NBTTagCompound; @@ -17,9 +18,11 @@ import net.minecraftforge.fluids.Fluid; public class GTPP_Cover_ToggleVisual extends GT_CoverBehavior { - private static final Map<String, Boolean> sConnectionStateForEntityMap = new ConcurrentHashMap<String, Boolean>(); + private static final Map<String, Integer> sConnectionStateForEntityMap = new ConcurrentHashMap<String, Integer>(); private static final Map<String, String> sPrefixMap = new ConcurrentHashMap<String, String>(); - + private static final int VALUE_OFF = 0; + private static final int VALUE_ON = 1; + public static String generateUniqueKey(byte aSide, ICoverable aEntity) { try { BlockPos aPos = new BlockPos(aEntity.getIGregTechTileEntity(aEntity.getXCoord(), aEntity.getYCoord(), aEntity.getZCoord())); @@ -33,7 +36,8 @@ public class GTPP_Cover_ToggleVisual extends GT_CoverBehavior { } public boolean onCoverRightclick(byte aSide, int aCoverID, int aCoverVariable, ICoverable aTileEntity, - EntityPlayer aPlayer, float aX, float aY, float aZ) { + EntityPlayer aPlayer, float aX, float aY, float aZ) { + PlayerUtils.messagePlayer(aPlayer, this.trans("756", "Connectable: ") + getConnectionState(aCoverVariable)); return super.onCoverRightclick(aSide, aCoverID, aCoverVariable, aTileEntity, aPlayer, aX, aY, aZ); } @@ -43,31 +47,31 @@ public class GTPP_Cover_ToggleVisual extends GT_CoverBehavior { } public boolean letsEnergyIn(byte aSide, int aCoverID, int aCoverVariable, ICoverable aTileEntity) { - return getConnectionState(aSide, aTileEntity); + return getConnectionState(aCoverVariable); } public boolean letsEnergyOut(byte aSide, int aCoverID, int aCoverVariable, ICoverable aTileEntity) { - return getConnectionState(aSide, aTileEntity); + return getConnectionState(aCoverVariable); } public boolean letsFluidIn(byte aSide, int aCoverID, int aCoverVariable, Fluid aFluid, ICoverable aTileEntity) { - return getConnectionState(aSide, aTileEntity); + return getConnectionState(aCoverVariable); } public boolean letsFluidOut(byte aSide, int aCoverID, int aCoverVariable, Fluid aFluid, ICoverable aTileEntity) { - return getConnectionState(aSide, aTileEntity); + return getConnectionState(aCoverVariable); } public boolean letsItemsIn(byte aSide, int aCoverID, int aCoverVariable, int aSlot, ICoverable aTileEntity) { - return getConnectionState(aSide, aTileEntity); + return getConnectionState(aCoverVariable); } public boolean letsItemsOut(byte aSide, int aCoverID, int aCoverVariable, int aSlot, ICoverable aTileEntity) { - return getConnectionState(aSide, aTileEntity); + return getConnectionState(aCoverVariable); } public String getDescription(byte aSide, int aCoverID, int aCoverVariable, ICoverable aTileEntity) { - return this.trans("756", "Connectable: ") + getConnectionState(aSide, aTileEntity); + return this.trans("756", "Connectable: ") + getConnectionState(aCoverVariable); } public int getTickRate(byte aSide, int aCoverID, int aCoverVariable, ICoverable aTileEntity) { @@ -76,18 +80,34 @@ public class GTPP_Cover_ToggleVisual extends GT_CoverBehavior { @Override public int doCoverThings(byte aSide, byte aInputRedstone, int aCoverID, int aCoverVariable, ICoverable aTileEntity, - long aTimer) { + long aTimer) { + try { + String aKey = generateUniqueKey(aSide, aTileEntity); + Integer b = sConnectionStateForEntityMap.get(aKey); + //Logger.INFO("Val: "+aCoverVariable); + if (b != null && aCoverVariable != b) { + aCoverVariable = b; + } + if (b == null) { + b = aCoverVariable; + sConnectionStateForEntityMap.put(aKey, b); + trySetState(aSide, b == VALUE_ON ? VALUE_ON : VALUE_OFF, aTileEntity); + } + } + catch (Throwable t) { + + } return aCoverVariable; } @Override public boolean letsRedstoneGoIn(byte aSide, int aCoverID, int aCoverVariable, ICoverable aTileEntity) { - return getConnectionState(aSide, aTileEntity); + return getConnectionState(aCoverVariable); } @Override public boolean letsRedstoneGoOut(byte aSide, int aCoverID, int aCoverVariable, ICoverable aTileEntity) { - return getConnectionState(aSide, aTileEntity); + return getConnectionState(aCoverVariable); } @Override @@ -98,7 +118,7 @@ public class GTPP_Cover_ToggleVisual extends GT_CoverBehavior { @Override public byte getRedstoneInput(byte aSide, byte aInputRedstone, int aCoverID, int aCoverVariable, ICoverable aTileEntity) { - if (!getConnectionState(aSide, aTileEntity)) { + if (!getConnectionState(aCoverVariable)) { return 0; } return super.getRedstoneInput(aSide, aInputRedstone, aCoverID, aCoverVariable, aTileEntity); @@ -109,8 +129,11 @@ public class GTPP_Cover_ToggleVisual extends GT_CoverBehavior { String aKey = generateUniqueKey(aSide, aTileEntity); boolean state = getCoverConnections(aCover); sPrefixMap.put(aKey, aCover.getUnlocalizedName()); - //Logger.INFO("Mapping key "+aKey+" to "+state); - sConnectionStateForEntityMap.put(aKey, state); + Logger.INFO("Mapping key "+aKey+" to "+state); + sConnectionStateForEntityMap.put(aKey, state ? VALUE_ON : VALUE_OFF); + Logger.INFO("Key Value: "+(state ? VALUE_ON : VALUE_OFF)); + //Try set cover state directly + //trySetState(aSide, state ? VALUE_ON : VALUE_OFF, aTileEntity); super.placeCover(aSide, aCover, aTileEntity); } @@ -122,14 +145,33 @@ public class GTPP_Cover_ToggleVisual extends GT_CoverBehavior { //Logger.INFO("Unmapping key "+aKey+"."); return true; } - + + public static boolean getConnectionState(int aCoverVar) { + return aCoverVar == VALUE_ON; + } + + private static final void trySetState(byte aSide, int aState, ICoverable aTile) { + //Try set cover state directly + if (aTile instanceof IGregTechTileEntity) { + IGregTechTileEntity gTileEntity = (IGregTechTileEntity) aTile; + if (gTileEntity != null) { + gTileEntity.setCoverDataAtSide(aSide, aState); + } + } + } + + public static boolean getConnectionState(byte aSide, ICoverable aTile) { String aKey = generateUniqueKey(aSide, aTile); - boolean b = sConnectionStateForEntityMap.get(aKey); - //Logger.INFO("Get State: "+b+" | "+aKey); - return b; + return getConnectionState(aKey); } + public static boolean getConnectionState(String aKey) { + Integer b = sConnectionStateForEntityMap.get(aKey); + //Logger.INFO("Get State: "+b+" | "+aKey); + return b != null ? b == VALUE_ON : false; + } + public static final boolean getCoverConnections(final ItemStack aStack) { NBTTagCompound aNBT = aStack.getTagCompound(); if (aNBT != null) { diff --git a/src/resources/assets/miscutils/lang/en_US.lang b/src/resources/assets/miscutils/lang/en_US.lang index cf25dad8a9..3aefd6dee2 100644 --- a/src/resources/assets/miscutils/lang/en_US.lang +++ b/src/resources/assets/miscutils/lang/en_US.lang @@ -2957,5 +2957,15 @@ item.GTPP.bauble.fireprotection.0.name=Supreme Pizza Gloves item.itemCellSeleniumDioxide.name=Selenium Dioxide Cell item.itemCellSeleniousAcid.name=Selenious Acid Cell -//Added 25/8/19 +//Added 25/7/19 container.pestkiller=Pest Killer + +//Added 15/8/19 +gtpp.nei.decayables=Decayables Chest +entity.batKing.name=Bat King +item.itemCellCarbyne.name=Carbyne Cell +item.itemCellHydrogenCyanide.name=Cell of Hydrogen Cyanide +item.itemCactusCharcoal.name=Cactus Charcoal +item.itemCactusCoke.name=Cactus Coke +item.itemSugarCharcoal.name=Sugar Charcoal +item.itemSugarCoke.name=Sugar Coke
\ No newline at end of file |