diff options
Diffstat (limited to 'src')
165 files changed, 6690 insertions, 2093 deletions
diff --git a/src/Java/gregtech/api/enums/TAE.java b/src/Java/gregtech/api/enums/TAE.java index 2827704f62..d7e16feb09 100644 --- a/src/Java/gregtech/api/enums/TAE.java +++ b/src/Java/gregtech/api/enums/TAE.java @@ -1,10 +1,14 @@ package gregtech.api.enums; import java.lang.reflect.Field; +import java.util.HashMap; +import java.util.HashSet; import gregtech.api.interfaces.ITexture; import gregtech.api.objects.GT_CopiedBlockTexture; import gtPlusPlus.api.objects.Logger; +import gtPlusPlus.api.objects.data.AutoMap; +import gtPlusPlus.core.block.ModBlocks; import gtPlusPlus.core.lib.CORE; import gtPlusPlus.core.util.Utils; import gtPlusPlus.core.util.reflect.ReflectionUtils; @@ -13,40 +17,65 @@ public class TAE { //TAE stands for Texture Array Expansion. - public static int gtTexturesArrayStartOrigin; public static int gtPPLastUsedIndex = 64; public static int secondaryIndex = 0; - public static boolean hasArrayBeenExpanded = false; + + public static HashMap<Integer, GT_CopiedBlockTexture> mTAE = new HashMap<Integer, GT_CopiedBlockTexture>(); + private static final HashSet<Integer> mFreeSlots = new HashSet<Integer>(64); + + static { + for (int i=64;i<128;i++) { + mFreeSlots.add(i); + } + Logger.INFO("Initialising TAE."); + } - public static boolean hookGtTextures() { - /*ITexture[] textureArrayDump = Textures.BlockIcons.CASING_BLOCKS; - ITexture[] newTextureArray = new ITexture[1024]; - Utils.LOG_INFO("|======| Texture Array Start Length: "+textureArrayDump.length+" |======|"); - for (int r=0;r<textureArrayDump.length;r++){ - if (textureArrayDump[r] == null){ - Utils.LOG_WARNING("Texture slot "+r+" is empty."); + /** + * + * @param aPage - The Texture page (0-3) + * @param aID - The ID on the specified page (0-15) + * @param gt_CopiedBlockTexture - The Texture to register + * @return - Did it register correctly? + */ + public static boolean registerTexture(int aPage, int aID, GT_CopiedBlockTexture gt_CopiedBlockTexture) { + int aRealID = aID + (aPage * 16); + return registerTexture(64 + aRealID, gt_CopiedBlockTexture); + } + + private static boolean registerTexture(int aID, GT_CopiedBlockTexture gt_CopiedBlockTexture) { + if (mFreeSlots.contains(aID)) { + mFreeSlots.remove(aID); + mTAE.put(aID, gt_CopiedBlockTexture); + return true; + } + else { + CORE.crash("Tried to register texture with ID "+aID+" to TAE, but it is already in use."); + return false; // Dead Code + } + } + + public static void finalizeTAE() { + String aFreeSpaces = ""; + AutoMap<Integer> aTemp = new AutoMap<Integer>(mFreeSlots); + for (int i = 0; i < mFreeSlots.size() ; i++) { + aFreeSpaces += aTemp.get(i); + if (i != (mFreeSlots.size() - 1)) { + aFreeSpaces += ", "; } } - gtTexturesArrayStartOrigin = textureArrayDump.length; - System.arraycopy(textureArrayDump, 0, newTextureArray, 0, textureArrayDump.length); - Textures.BlockIcons.CASING_BLOCKS = newTextureArray; - if (Textures.BlockIcons.CASING_BLOCKS.length == 1024){ - hasArrayBeenExpanded = true; + Logger.INFO("Free Indexes within TAE: "+aFreeSpaces); + Logger.INFO("Filling them with ERROR textures."); + for (int aFreeSlot : aTemp.values()) { + registerTexture(aFreeSlot, new GT_CopiedBlockTexture(ModBlocks.blockCasingsTieredGTPP, 1, 15)); } - else { - hasArrayBeenExpanded = false; + Logger.INFO("Finalising TAE."); + for (int aKeyTae : mTAE.keySet()) { + Textures.BlockIcons.CASING_BLOCKS[aKeyTae] = mTAE.get(aKeyTae); } - return hasArrayBeenExpanded;*/ - return true; + Logger.INFO("Finalised TAE."); } - /*public static boolean registerTextures(GT_RenderedTexture textureToRegister) { - Textures.BlockIcons.CASING_BLOCKS[gtPPLastUsedIndex] = textureToRegister; - //Just so I know registration is done. - return true; - }*/ - - public static boolean registerTextures(GT_CopiedBlockTexture gt_CopiedBlockTexture) { + private static boolean registerTextures(GT_CopiedBlockTexture gt_CopiedBlockTexture) { try { //Handle page 2. Logger.INFO("[TAE} Registering Texture, Last used casing ID is "+gtPPLastUsedIndex+"."); diff --git a/src/Java/gregtech/api/util/CustomRecipeMap.java b/src/Java/gregtech/api/util/CustomRecipeMap.java index a39050b4e0..ba0ab3dd29 100644 --- a/src/Java/gregtech/api/util/CustomRecipeMap.java +++ b/src/Java/gregtech/api/util/CustomRecipeMap.java @@ -22,7 +22,7 @@ public class CustomRecipeMap/* extends GT_Recipe_Map*/{ //public static final CustomRecipeMap sOreWasherRecipes = new GT_Recipe_Map_OreWasher(new HashSet<GT_Recipe>(0), "ic.recipe.orewasher", "Ore Washer", "ic2.blockOreWashingPlant", RES_PATH_GUI + "basicmachines/OreWasher", 1, 3, 1, 1, 1, E, 1, E, true, false); //Fission Fuel Plant Recipes - public static final CustomRecipeMap sFissionFuelProcessing = new CustomRecipeMap(new HashSet<GT_Recipe>(50), "gt.recipe.fissionfuel", "Fission Fuel Processing", null, RES_PATH_GUI + "basicmachines/FissionFuel", 0, 0, 0, 4, 1, E, 1, E, true, true); + public static final CustomRecipeMap sFissionFuelProcessing = new CustomRecipeMap(new HashSet<GT_Recipe>(50), "gt.recipe.fissionfuel", "Nuclear Fuel Processing", null, RES_PATH_GUI + "basicmachines/FissionFuel", 0, 0, 0, 4, 1, E, 1, E, true, true); public static final CustomRecipeMap mMultiWireMill = new CustomRecipeMap(new HashSet<GT_Recipe>(500), "gt.recipe.multi.wiremill", "Multiblock Wiremill", null, RES_PATH_GUI + "basicmachines/FissionFuel", 1, 1, 0, 0, 1, E, 1, E, true, true); diff --git a/src/Java/gregtech/api/util/Recipe_GT.java b/src/Java/gregtech/api/util/Recipe_GT.java index bfe05d33e7..3ddb25e754 100644 --- a/src/Java/gregtech/api/util/Recipe_GT.java +++ b/src/Java/gregtech/api/util/Recipe_GT.java @@ -14,6 +14,7 @@ import gregtech.api.objects.GT_ItemStack; import gregtech.api.objects.ItemData; import gregtech.api.util.GT_Recipe.GT_Recipe_Map; import gregtech.api.util.GT_Recipe.GT_Recipe_Map_Fuel; +import gregtech.api.util.GT_Recipe.GT_Recipe_Map_Macerator; import gtPlusPlus.api.interfaces.IComparableRecipe; import gtPlusPlus.api.objects.Logger; import gtPlusPlus.api.objects.data.AutoMap; @@ -248,7 +249,7 @@ public class Recipe_GT extends GT_Recipe implements IComparableRecipe{ public static final GT_Recipe_Map sGeoThermalFuels = new GT_Recipe_Map(new HashSet<GT_Recipe>(10), "gt.recipe.geothermalfuel", "GeoThermal Fuel", null, RES_PATH_GUI + "basicmachines/Default", 1, 1, 0, 0, 1, "Fuel Value: ", 1000, " EU", true, true); public static final GT_Recipe_Map sChemicalDehydratorRecipes = new GT_Recipe_Map(new HashSet<GT_Recipe>(200), "gt.recipe.chemicaldehydrator", "Chemical Dehydrator", null, RES_PATH_GUI + "basicmachines/Dehydrator", 2, 9, 0, 0, 1, E, 1, E, true, true); - public static final GT_Recipe_Map sVacuumFurnaceRecipes = new GT_Recipe_Map(new HashSet(500), "gt.recipe.vacfurnace", "Vacuum Furnace", null, "gregtech:textures/gui/basicmachines/Default", 2, 2, 1, 0, 1, "Heat Capacity: ", 1, " K", false, true); + public static final GT_Recipe_Map sVacuumFurnaceRecipes = new GT_Recipe_Map(new HashSet<GT_Recipe>(500), "gt.recipe.vacfurnace", "Vacuum Furnace", null, "gregtech:textures/gui/basicmachines/Default", 2, 2, 1, 0, 1, "Heat Capacity: ", 1, " K", false, true); public static final GT_Recipe_Map sAlloyBlastSmelterRecipes = new GT_Recipe_Map(new HashSet<GT_Recipe>(200), "gt.recipe.alloyblastsmelter", "Alloy Blast Smelter", null, RES_PATH_GUI + "basicmachines/BlastSmelter", 9, 9, 1, 0, 1, E, 1, E, true, true); public static final GT_Recipe_Map sSteamTurbineFuels = new GT_Recipe_Map(new HashSet<GT_Recipe>(10), "gt.recipe.geothermalfuel", "GeoThermal Fuel", null, RES_PATH_GUI + "basicmachines/Default", 1, 1, 0, 0, 1, "Fuel Value: ", 1000, " EU", true, true); @@ -256,6 +257,9 @@ public class Recipe_GT extends GT_Recipe implements IComparableRecipe{ public static final GT_Recipe_Map sLiquidFluorineThoriumReactorRecipes = new GT_Recipe_Map(new HashSet<GT_Recipe>(50), "gt.recipe.lftr", "Liquid Fluoride Thorium Reactor", null, RES_PATH_GUI + "basicmachines/LFTR", 0, 0, 0, 2, 1, "Start: ", 1, " EU", true, true); public static final GT_Recipe_Map sLiquidFluorineThoriumReactorRecipesEx = new GT_Recipe_Map(new NoConflictGTRecipeMap(), "gt.recipe.lftr.2", "Liquid Fluoride Thorium Reactor", null, RES_PATH_GUI + "basicmachines/LFTR", 0, 0, 0, 2, 1, "Start: ", 1, " EU", true, true); + // Ore Milling Map + public static final GT_Recipe_Map sOreMillRecipes = new GT_Recipe_Map(new HashSet<GT_Recipe>(10000), "gt.recipe.oremill", "Milling", null, RES_PATH_GUI + "basicmachines/LFTR", 3, 4, 1, 0, 1, E, 1, E, true, true); + //Fission Fuel Plant Recipes //public static final GT_Recipe_Map sFissionFuelProcessing = new GT_Recipe_Map(new HashSet<GT_Recipe>(50), "gt.recipe.fissionfuel", "Fission Fuel Processing", null, RES_PATH_GUI + "basicmachines/LFTR", 0, 0, 0, 9, 1, E, 1, E, true, true); diff --git a/src/Java/gtPlusPlus/GTplusplus.java b/src/Java/gtPlusPlus/GTplusplus.java index 6f734db111..0e70baf524 100644 --- a/src/Java/gtPlusPlus/GTplusplus.java +++ b/src/Java/gtPlusPlus/GTplusplus.java @@ -43,7 +43,6 @@ import gtPlusPlus.core.handler.events.MissingMappingsEvent; import gtPlusPlus.core.lib.CORE; import gtPlusPlus.core.lib.LoadedMods; import gtPlusPlus.core.material.Material; -import gtPlusPlus.core.material.nuclear.FLUORIDES; import gtPlusPlus.core.util.Utils; import gtPlusPlus.core.util.data.LocaleUtils; import gtPlusPlus.core.util.minecraft.HazmatUtils; @@ -65,7 +64,6 @@ import gtPlusPlus.xmod.gregtech.registration.gregtech.GregtechMiniRaFusion; import gtPlusPlus.xmod.thaumcraft.commands.CommandDumpAspects; import net.minecraft.launchwrapper.Launch; import net.minecraft.util.IIcon; -import net.minecraftforge.oredict.OreDictionary; @MCVersion(value = "1.7.10") @Mod(modid = CORE.MODID, name = CORE.name, version = CORE.VERSION, dependencies = "required-after:Forge; after:TConstruct; after:PlayerAPI; after:dreamcraft; after:IC2; after:ihl; after:psychedelicraft; after:gregtech; after:Forestry; after:MagicBees; after:CoFHCore; after:Growthcraft; after:Railcraft; after:CompactWindmills; after:ForbiddenMagic; after:MorePlanet; after:PneumaticCraft; after:ExtraUtilities; after:Thaumcraft; after:rftools; after:simplyjetpacks; after:BigReactors; after:EnderIO; after:tectech; after:GTRedtech; after:beyondrealitycore; after:OpenBlocks; after:IC2NuclearControl; after:TGregworks; after:StevesCarts; after:xreliquary;") @@ -80,11 +78,11 @@ public class GTplusplus implements ActionListener { STARTED(SERVER_START); protected boolean mIsPhaseActive = false; private final INIT_PHASE mPrev; - + private INIT_PHASE(INIT_PHASE aPreviousPhase) { mPrev = aPreviousPhase; } - + public synchronized final boolean isPhaseActive() { return mIsPhaseActive; } @@ -98,9 +96,9 @@ public class GTplusplus implements ActionListener { } } } - + public static INIT_PHASE CURRENT_LOAD_PHASE = INIT_PHASE.SUPER; - + //Mod Instance @Mod.Instance(CORE.MODID) public static GTplusplus instance; @@ -129,7 +127,7 @@ public class GTplusplus implements ActionListener { // Blocks Logger.WARNING("Processing texture: " + TexturesGtBlock.Casing_Machine_Dimensional.getTextureFile().getResourcePath()); } - + public GTplusplus() { super(); INIT_PHASE.SUPER.setPhaseActive(true); @@ -153,8 +151,10 @@ public class GTplusplus implements ActionListener { //setupMaterialWhitelist(); //HTTP Requests - CORE.MASTER_VERSION = NetworkUtils.getContentFromURL("https://raw.githubusercontent.com/draknyte1/GTplusplus/master/Recommended.txt").toLowerCase(); - CORE.USER_COUNTRY = GeoUtils.determineUsersCountry(); + if (CORE.ConfigSwitches.enableUpdateChecker) { + CORE.MASTER_VERSION = NetworkUtils.getContentFromURL("https://raw.githubusercontent.com/draknyte1/GTplusplus/master/Recommended.txt").toLowerCase(); + CORE.USER_COUNTRY = GeoUtils.determineUsersCountry(); + } // Handle GT++ Config ConfigHandler.handleConfigFile(event); @@ -204,11 +204,7 @@ public class GTplusplus implements ActionListener { Core_Manager.postInit(); //SprinklerHandler.registerModFerts(); - //Set Variables for Fluorite Block handling - Logger.INFO("Setting some Variables for the block break event handler."); - BlockEventHandler.oreLimestone = OreDictionary.getOres("oreLimestone"); - BlockEventHandler.blockLimestone = OreDictionary.getOres("limestone"); - BlockEventHandler.fluoriteOre = FLUORIDES.FLUORITE.getOre(1); + BlockEventHandler.init(); Logger.INFO("~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~"); Logger.INFO("| Recipes succesfully Loaded: " + RegistrationHandler.recipesSuccess + " | Failed: " @@ -220,8 +216,8 @@ public class GTplusplus implements ActionListener { @EventHandler public synchronized void serverStarting(final FMLServerStartingEvent event) { INIT_PHASE.SERVER_START.setPhaseActive(true); - event.registerServerCommand(new CommandMath()); - event.registerServerCommand(new CommandEnableDebugWhileRunning()); + event.registerServerCommand(new CommandMath()); + event.registerServerCommand(new CommandEnableDebugWhileRunning()); event.registerServerCommand(new CommandDebugChunks()); if (LoadedMods.Thaumcraft) { event.registerServerCommand(new CommandDumpAspects()); @@ -242,7 +238,7 @@ public class GTplusplus implements ActionListener { } SystemUtils.invokeGC(); } - + } @Override @@ -281,7 +277,7 @@ public class GTplusplus implements ActionListener { } } } - + protected void generateGregtechRecipeMaps() { int[] mValidCount = new int[] {0, 0, 0}; @@ -324,7 +320,7 @@ public class GTplusplus implements ActionListener { Recipe_GT.Gregtech_Recipe_Map.sMultiblockCentrifugeRecipes_GT.add(a); } } - + //Large Electrolyzer generation mOriginalCount[1] = GT_Recipe.GT_Recipe_Map.sElectrolyzerRecipes.mRecipeList.size(); for (GT_Recipe x : GT_Recipe.GT_Recipe_Map.sElectrolyzerRecipes.mRecipeList) { @@ -349,7 +345,7 @@ public class GTplusplus implements ActionListener { mInvalidCount[1]++; } } - + if (Recipe_GT.Gregtech_Recipe_Map.sMultiblockElectrolyzerRecipes_GT.mRecipeList.size() < 1) { for (GT_Recipe a : Recipe_GT.Gregtech_Recipe_Map.sMultiblockElectrolyzerRecipes.mRecipeList) { Recipe_GT.Gregtech_Recipe_Map.sMultiblockElectrolyzerRecipes_GT.add(a); @@ -373,11 +369,11 @@ public class GTplusplus implements ActionListener { mInvalidCount[2]++; } } - + //Redo plasma recipes in Adv. Vac. //Meta_GT_Proxy.generatePlasmaRecipesForAdvVacFreezer(); - - + + String[] machineName = new String[] {"Centrifuge", "Electrolyzer", "Vacuum Freezer"}; for (int i=0;i<3;i++) { Logger.INFO("[Recipe] Generated "+mValidCount[i]+" recipes for the Industrial "+machineName[i]+". The original machine can process "+mOriginalCount[i]+" recipes, meaning "+mInvalidCount[i]+" are invalid for this Multiblock's processing in some way."); diff --git a/src/Java/gtPlusPlus/api/enums/ParticleNames.java b/src/Java/gtPlusPlus/api/enums/ParticleNames.java new file mode 100644 index 0000000000..d082cd6779 --- /dev/null +++ b/src/Java/gtPlusPlus/api/enums/ParticleNames.java @@ -0,0 +1,37 @@ +package gtPlusPlus.api.enums; + +public enum ParticleNames { + + explode, + largeexplode, + hugeexplosion, + bubble, + splash, + suspended, + depthsuspend, + crit, + magicCrit, + smoke, + largesmoke, + spell, + instantSpell, + mobSpell, + dripWater, + dripLava, + townaura, + note, + portal, + enchantmenttable, + flame, + lava, + footstep, + cloud, + reddust, + snowballpoof, + snowshovel, + slime, + heart, + iconcrack_, + tilecrack_; + +} diff --git a/src/Java/gtPlusPlus/api/objects/Logger.java b/src/Java/gtPlusPlus/api/objects/Logger.java index 9c1e3d4338..6b7ca18590 100644 --- a/src/Java/gtPlusPlus/api/objects/Logger.java +++ b/src/Java/gtPlusPlus/api/objects/Logger.java @@ -5,7 +5,7 @@ import org.apache.logging.log4j.LogManager; 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.CORE_Preloader; import gtPlusPlus.preloader.asm.AsmConfig; public class Logger { @@ -39,19 +39,7 @@ public class Logger { // Non-Dev Comments public static void MACHINE_INFO(final String s) { if (enabled) { - - boolean localPlayer = false; - try { - if (ClientProxy.playerName != null){ - if (ClientProxy.playerName.toLowerCase().contains("draknyte1")){ - localPlayer = true; - } - } - } - catch (final Throwable t){ - - } - + boolean localPlayer = CORE_Preloader.DEV_ENVIRONMENT; if (CORE.ConfigSwitches.MACHINE_INFO || localPlayer) { final String name1 = gtPlusPlus.core.util.reflect.ReflectionUtils.getMethodName(2); modLogger.info("Machine Info: " + s + " | " + name1); @@ -62,7 +50,7 @@ public class Logger { // Developer Comments public static void WARNING(final String s) { if (enabled) { - if (CORE.DEBUG) { + if (CORE_Preloader.DEBUG_MODE) { modLogger.warn(s); } } @@ -71,7 +59,7 @@ public class Logger { // Errors public static void ERROR(final String s) { if (enabled) { - if (CORE.DEBUG) { + if (CORE_Preloader.DEBUG_MODE) { modLogger.fatal(s); } } @@ -80,7 +68,7 @@ public class Logger { // Developer Logger public static void SPECIFIC_WARNING(final String whatToLog, final String msg, final int line) { if (enabled) { - // if (!CORE.DEBUG){ + // if (!CORE_Preloader.DEBUG_MODE){ FMLLog.warning("GT++ |" + line + "| " + whatToLog + " | " + msg); // } } @@ -111,7 +99,7 @@ public class Logger { */ public static void BEES(final String s) { if (enabled) { - if (CORE.DEVENV || CORE.DEBUG) { + if (CORE_Preloader.DEV_ENVIRONMENT || CORE_Preloader.DEBUG_MODE) { modLogger.info("[Bees] "+s); } } @@ -121,7 +109,7 @@ public class Logger { */ public static void DEBUG_BEES(final String s) { if (enabled) { - if (CORE.DEVENV || CORE.DEBUG) { + if (CORE_Preloader.DEV_ENVIRONMENT || CORE_Preloader.DEBUG_MODE) { modLogger.info("[Debug][Bees] "+s); } } @@ -134,7 +122,7 @@ public class Logger { */ public static void MATERIALS(final String s) { if (enabled) { - if (/* CORE.DEVENV || */CORE.DEBUG) { + if (/* CORE_Preloader.DEV_ENVIRONMENT || */CORE_Preloader.DEBUG_MODE) { modLogger.info("[Materials] "+s); } } @@ -144,7 +132,7 @@ public class Logger { */ public static void DEBUG_MATERIALS(final String s) { if (enabled) { - if (CORE.DEVENV || CORE.DEBUG) { + if (CORE_Preloader.DEV_ENVIRONMENT || CORE_Preloader.DEBUG_MODE) { modLogger.info("[Debug][Materials] "+s); } } @@ -155,7 +143,7 @@ public class Logger { */ public static void REFLECTION(final String s) { if (enabled) { - if (CORE.DEVENV || CORE.DEBUG) { + if (CORE_Preloader.DEV_ENVIRONMENT || CORE_Preloader.DEBUG_MODE) { modLogger.info("[Reflection] "+s); } } @@ -167,7 +155,7 @@ public class Logger { */ public static void WORLD(final String s) { if (enabled) { - if (CORE.DEVENV || CORE.DEBUG) { + if (CORE_Preloader.DEV_ENVIRONMENT || CORE_Preloader.DEBUG_MODE) { modLogger.info("[WorldGen] "+s); } } @@ -175,7 +163,7 @@ public class Logger { public static void RECIPE(String string) { if (enabled) { - if (/*CORE.DEVENV || */CORE.DEBUG) { + if (/*CORE_Preloader.DEV_ENVIRONMENT || */CORE_Preloader.DEBUG_MODE) { modLogger.info("[Recipe] "+string); } } diff --git a/src/Java/gtPlusPlus/api/objects/minecraft/multi/NoEUBonusMultiBehaviour.java b/src/Java/gtPlusPlus/api/objects/minecraft/multi/NoEUBonusMultiBehaviour.java new file mode 100644 index 0000000000..78341db7a1 --- /dev/null +++ b/src/Java/gtPlusPlus/api/objects/minecraft/multi/NoEUBonusMultiBehaviour.java @@ -0,0 +1,27 @@ +package gtPlusPlus.api.objects.minecraft.multi; + +import gtPlusPlus.xmod.gregtech.api.enums.GregtechItemList; +import net.minecraft.item.ItemStack; + +public class NoEUBonusMultiBehaviour extends SpecialMultiBehaviour { + + public NoEUBonusMultiBehaviour() { + // Used by other mods which may wish to not obtain bonus outputs on their Sifting or Maceration recipes. + } + + @Override + public ItemStack getTriggerItem() { + return GregtechItemList.Chip_MultiNerf_NoEuBonus.get(1); + } + + @Override + public String getTriggerItemTooltip() { + return "Prevents EU discounts on GT++ multiblocks when used"; + } + + @Override + public int getEUPercent() { + return 0; + } + +} diff --git a/src/Java/gtPlusPlus/api/objects/minecraft/multi/NoOutputBonusMultiBehaviour.java b/src/Java/gtPlusPlus/api/objects/minecraft/multi/NoOutputBonusMultiBehaviour.java index 4dc032d01f..8137f2573d 100644 --- a/src/Java/gtPlusPlus/api/objects/minecraft/multi/NoOutputBonusMultiBehaviour.java +++ b/src/Java/gtPlusPlus/api/objects/minecraft/multi/NoOutputBonusMultiBehaviour.java @@ -1,6 +1,6 @@ package gtPlusPlus.api.objects.minecraft.multi; -import gtPlusPlus.core.recipe.common.CI; +import gtPlusPlus.xmod.gregtech.api.enums.GregtechItemList; import net.minecraft.item.ItemStack; public class NoOutputBonusMultiBehaviour extends SpecialMultiBehaviour { @@ -11,7 +11,7 @@ public class NoOutputBonusMultiBehaviour extends SpecialMultiBehaviour { @Override public ItemStack getTriggerItem() { - return CI.getNumberedBioCircuit(22); + return GregtechItemList.Chip_MultiNerf_NoOutputBonus.get(1); } @Override diff --git a/src/Java/gtPlusPlus/api/objects/minecraft/multi/NoSpeedBonusMultiBehaviour.java b/src/Java/gtPlusPlus/api/objects/minecraft/multi/NoSpeedBonusMultiBehaviour.java new file mode 100644 index 0000000000..fe7a90960d --- /dev/null +++ b/src/Java/gtPlusPlus/api/objects/minecraft/multi/NoSpeedBonusMultiBehaviour.java @@ -0,0 +1,27 @@ +package gtPlusPlus.api.objects.minecraft.multi; + +import gtPlusPlus.xmod.gregtech.api.enums.GregtechItemList; +import net.minecraft.item.ItemStack; + +public class NoSpeedBonusMultiBehaviour extends SpecialMultiBehaviour { + + public NoSpeedBonusMultiBehaviour() { + // Used by other mods which may wish to not obtain bonus outputs on their Sifting or Maceration recipes. + } + + @Override + public ItemStack getTriggerItem() { + return GregtechItemList.Chip_MultiNerf_NoSpeedBonus.get(1); + } + + @Override + public String getTriggerItemTooltip() { + return "Prevents speed bonuses on GT++ multiblocks when used"; + } + + @Override + public int getSpeedBonusPercent() { + return 0; + } + +} diff --git a/src/Java/gtPlusPlus/australia/GTplusplus_Australia.java b/src/Java/gtPlusPlus/australia/GTplusplus_Australia.java index 77562f5691..9a16ad1785 100644 --- a/src/Java/gtPlusPlus/australia/GTplusplus_Australia.java +++ b/src/Java/gtPlusPlus/australia/GTplusplus_Australia.java @@ -26,6 +26,7 @@ import gtPlusPlus.australia.gen.map.structure.StructureManager; import gtPlusPlus.australia.world.AustraliaWorldGenerator; import gtPlusPlus.core.lib.CORE; import gtPlusPlus.core.lib.CORE.Australia; +import gtPlusPlus.preloader.CORE_Preloader; import gtPlusPlus.xmod.gregtech.api.util.GTPP_Config; import net.minecraftforge.common.DimensionManager; import net.minecraftforge.common.config.Configuration; @@ -126,7 +127,7 @@ public class GTplusplus_Australia implements ActionListener { WorldGen_GT_Australia_Base.oreveinPercentage = 16; WorldGen_GT_Australia_Base.oreveinAttempts = 16; WorldGen_GT_Australia_Base.oreveinMaxPlacementAttempts = 2; - if (CORE.DEBUG || CORE.DEVENV){ + if (CORE_Preloader.DEBUG_MODE || CORE.DEVENV){ WorldGen_GT_Australia_Base.debugWorldGen = true; } AustraliaContentLoader.run(); diff --git a/src/Java/gtPlusPlus/core/block/ModBlocks.java b/src/Java/gtPlusPlus/core/block/ModBlocks.java index db9ad2264c..a8536683b5 100644 --- a/src/Java/gtPlusPlus/core/block/ModBlocks.java +++ b/src/Java/gtPlusPlus/core/block/ModBlocks.java @@ -29,7 +29,6 @@ import gtPlusPlus.core.block.machine.Machine_WorkbenchAdvanced; import gtPlusPlus.core.block.machine.bedrock.Mining_Head_Fake; import gtPlusPlus.core.block.machine.bedrock.Mining_Pipe_Fake; import gtPlusPlus.core.fluids.FluidRegistryHandler; -import gtPlusPlus.xmod.gregtech.common.blocks.GregtechMetaTieredCasingBlocks1; import net.minecraft.block.Block; import net.minecraft.block.material.Material; import net.minecraftforge.fluids.Fluid; @@ -56,7 +55,9 @@ public final class ModBlocks { public static Block blockCasings2Misc; public static Block blockCasings3Misc; public static Block blockCasings4Misc; + public static Block blockCasings5Misc; public static Block blockCasingsTieredGTPP; + public static Block blockSpecialMultiCasings; public static Block blockMetaTileEntity; public static Block blockHeliumGenerator; diff --git a/src/Java/gtPlusPlus/core/commands/CommandEnableDebugWhileRunning.java b/src/Java/gtPlusPlus/core/commands/CommandEnableDebugWhileRunning.java index 06b6f14822..903730f767 100644 --- a/src/Java/gtPlusPlus/core/commands/CommandEnableDebugWhileRunning.java +++ b/src/Java/gtPlusPlus/core/commands/CommandEnableDebugWhileRunning.java @@ -2,15 +2,22 @@ package gtPlusPlus.core.commands; import java.util.ArrayList; import java.util.List; +import java.util.Map; import gtPlusPlus.api.objects.Logger; -import gtPlusPlus.core.lib.CORE; +import gtPlusPlus.api.objects.data.AutoMap; import gtPlusPlus.core.util.Utils; +import gtPlusPlus.core.util.minecraft.ItemUtils; +import gtPlusPlus.core.util.minecraft.NBTUtils; import gtPlusPlus.core.util.minecraft.PlayerUtils; +import gtPlusPlus.core.util.reflect.ReflectionUtils; +import gtPlusPlus.preloader.CORE_Preloader; import gtPlusPlus.preloader.asm.AsmConfig; import net.minecraft.command.ICommand; import net.minecraft.command.ICommandSender; import net.minecraft.entity.player.EntityPlayer; +import net.minecraft.item.ItemStack; +import net.minecraft.nbt.NBTTagCompound; import net.minecraft.world.World; @@ -74,8 +81,8 @@ public class CommandEnableDebugWhileRunning implements ICommand 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); + CORE_Preloader.DEBUG_MODE = Utils.invertBoolean(CORE_Preloader.DEBUG_MODE); + PlayerUtils.messagePlayer(P, "Toggled GT++ Debug Mode - Enabled: "+CORE_Preloader.DEBUG_MODE); } } else if (argString[0].toLowerCase().equals("logging")) { @@ -84,6 +91,28 @@ public class CommandEnableDebugWhileRunning implements ICommand AsmConfig.disableAllLogging = Utils.invertBoolean(AsmConfig.disableAllLogging); PlayerUtils.messagePlayer(P, "Toggled GT++ Logging - Enabled: "+(!AsmConfig.disableAllLogging)); } + /* else if (argString[0].toLowerCase().equals("test")) { + ItemStack mSemiFluidgen = ItemUtils.simpleMetaStack("IC2:blockGenerator", 7, 1); + final EntityPlayer P = CommandUtils.getPlayer(S); + if(mSemiFluidgen != null) { + PlayerUtils.messagePlayer(P, ItemUtils.getItemName(mSemiFluidgen)); + } + }*/ + else if (argString[0].toLowerCase().equals("hand")) { + final EntityPlayer P = CommandUtils.getPlayer(S); + if (P != null) { + ItemStack aHeldItem = PlayerUtils.getItemStackInPlayersHand(P); + if (aHeldItem != null) { + String aItemDisplayName = ItemUtils.getItemName(aHeldItem); + String aItemUnlocalName = ItemUtils.getUnlocalizedItemName(aHeldItem); + String aNbtString = tryIterateNBTData(aHeldItem); + PlayerUtils.messagePlayer(P, "["+aItemUnlocalName+"]"+"["+aItemDisplayName+"] "+aNbtString); + } + else { + PlayerUtils.messagePlayer(P, "No item held."); + } + } + } else { final EntityPlayer P = CommandUtils.getPlayer(S); PlayerUtils.messagePlayer(P, "Invalid command, use '?' as an argument for help.'"); @@ -117,5 +146,35 @@ public class CommandEnableDebugWhileRunning implements ICommand public boolean playerUsesCommand(final World W, final EntityPlayer P, final int cost){ return true; } + + public static String tryIterateNBTData(ItemStack aStack) { + try { + AutoMap<String> aItemDataTags = new AutoMap<String>(); + NBTTagCompound aNBT = NBTUtils.getNBT(aStack); + if (aNBT != null) { + if (!aNBT.hasNoTags()) { + Map<?, ?> mInternalMap = ReflectionUtils.getField(aNBT, "tagMap"); + if (mInternalMap != null) { + for (Map.Entry<?, ?> e : mInternalMap.entrySet()) { + aItemDataTags.add(e.getKey().toString()+":"+e.getValue()); + } + int a = 0; + String data = ""; + for (String tag : aItemDataTags) { + data += (tag+","); + } + if (data.endsWith(",")) { + data = data.substring(0, data.length()-2); + } + return data; + } else { + Logger.INFO("Data map reflected from NBTTagCompound was not valid."); + return "Bad NBT"; + } + } + } + } catch (Throwable t) {} + return ""; + } }
\ No newline at end of file diff --git a/src/Java/gtPlusPlus/core/common/CommonProxy.java b/src/Java/gtPlusPlus/core/common/CommonProxy.java index 71a7b37cfc..0aeff5ae16 100644 --- a/src/Java/gtPlusPlus/core/common/CommonProxy.java +++ b/src/Java/gtPlusPlus/core/common/CommonProxy.java @@ -1,7 +1,5 @@ package gtPlusPlus.core.common; -import static gtPlusPlus.core.lib.CORE.DEBUG; - import cpw.mods.fml.common.event.FMLInitializationEvent; import cpw.mods.fml.common.event.FMLLoadCompleteEvent; import cpw.mods.fml.common.event.FMLPostInitializationEvent; @@ -49,8 +47,10 @@ import gtPlusPlus.core.util.minecraft.ItemUtils; import gtPlusPlus.core.util.player.PlayerCache; import gtPlusPlus.core.util.reflect.ReflectionUtils; import gtPlusPlus.plugin.villagers.block.BlockGenericSpawner; +import gtPlusPlus.preloader.CORE_Preloader; import gtPlusPlus.xmod.eio.handler.HandlerTooltip_EIO; import gtPlusPlus.xmod.galacticraft.handler.HandlerTooltip_GC; +import gtPlusPlus.xmod.gregtech.HANDLER_GT; import gtPlusPlus.xmod.gregtech.api.enums.GregtechItemList; import gtPlusPlus.xmod.gregtech.api.util.SpecialBehaviourTooltipHandler; import net.minecraft.enchantment.Enchantment; @@ -80,15 +80,19 @@ public class CommonProxy { LoadedMods.checkLoaded(); Logger.INFO("Making sure we're ready to party!"); - if (!DEBUG) { + if (!CORE_Preloader.DEBUG_MODE) { Logger.WARNING("Development mode not enabled."); - } else if (DEBUG) { + } else if (CORE_Preloader.DEBUG_MODE) { Logger.INFO("Development mode enabled."); } else { Logger.WARNING("Development mode not set."); } AddToCreativeTab.initialiseTabs(); + + if (LoadedMods.Gregtech) { + HANDLER_GT.addNewOrePrefixes(); + } // Moved from Init after Debug Loading. // 29/01/18 - Alkalus @@ -110,7 +114,7 @@ public class CommonProxy { Logger.INFO("[Proxy] Calling Render registrator."); registerRenderThings(); - if (!mFluidsGenerated && ItemList.valueOf("Cell_Empty").hasBeenSet()) { + if (!mFluidsGenerated && ItemList.Cell_Empty.hasBeenSet()) { Material.generateQueuedFluids(); mFluidsGenerated = true; } @@ -119,14 +123,14 @@ public class CommonProxy { public void init(final FMLInitializationEvent e) { // Debug Loading - if (CORE.DEBUG) { + if (CORE_Preloader.DEBUG_MODE) { DEBUG_INIT.registerHandlers(); } registerCustomItemsForMaterials(); ModBlocks.blockCustomMobSpawner = new BlockGenericSpawner(); - if (!mFluidsGenerated && ItemList.valueOf("Cell_Empty").hasBeenSet()) { + if (!mFluidsGenerated && ItemList.Cell_Empty.hasBeenSet()) { Material.generateQueuedFluids(); mFluidsGenerated = true; } else { diff --git a/src/Java/gtPlusPlus/core/config/ConfigHandler.java b/src/Java/gtPlusPlus/core/config/ConfigHandler.java index 61e7045192..0760dfc2cc 100644 --- a/src/Java/gtPlusPlus/core/config/ConfigHandler.java +++ b/src/Java/gtPlusPlus/core/config/ConfigHandler.java @@ -22,8 +22,8 @@ public class ConfigHandler { "Stops mod checking for updates."); // Debug - DEBUG = config.getBoolean("debugMode", "debug", false, - "Enables all sorts of debug logging. (Don't use unless told to, breaks other things.)"); + /* DEBUG = config.getBoolean("debugMode", "debug", false, + "Enables all sorts of debug logging. (Don't use unless told to, breaks other things.)");*/ disableEnderIOIntegration = config.getBoolean("disableEnderIO", "debug", false, "Disables EnderIO Integration."); disableEnderIOIngotTooltips = config.getBoolean("disableEnderIOIngotTooltips", "debug", false, diff --git a/src/Java/gtPlusPlus/core/handler/COMPAT_HANDLER.java b/src/Java/gtPlusPlus/core/handler/COMPAT_HANDLER.java index d7c971e71f..21f3e1d6cd 100644 --- a/src/Java/gtPlusPlus/core/handler/COMPAT_HANDLER.java +++ b/src/Java/gtPlusPlus/core/handler/COMPAT_HANDLER.java @@ -83,6 +83,7 @@ import gtPlusPlus.xmod.gregtech.registration.gregtech.GregtechIndustrialTreeFarm import gtPlusPlus.xmod.gregtech.registration.gregtech.GregtechIndustrialWashPlant; import gtPlusPlus.xmod.gregtech.registration.gregtech.GregtechIndustrialWiremill; import gtPlusPlus.xmod.gregtech.registration.gregtech.GregtechIronBlastFurnace; +import gtPlusPlus.xmod.gregtech.registration.gregtech.GregtechIsaMill; import gtPlusPlus.xmod.gregtech.registration.gregtech.GregtechLFTR; import gtPlusPlus.xmod.gregtech.registration.gregtech.GregtechLargeTurbinesAndHeatExchanger; import gtPlusPlus.xmod.gregtech.registration.gregtech.GregtechMiniRaFusion; @@ -218,6 +219,7 @@ public class COMPAT_HANDLER { GregtechFluidReactor.run(); GregtechAlgaeContent.run(); GregtechIndustrialAlloySmelter.run(); + GregtechIsaMill.run(); //New Horizons Content NewHorizonsAccelerator.run(); diff --git a/src/Java/gtPlusPlus/core/handler/events/BlockEventHandler.java b/src/Java/gtPlusPlus/core/handler/events/BlockEventHandler.java index ee6c15fa67..b3738e6ea2 100644 --- a/src/Java/gtPlusPlus/core/handler/events/BlockEventHandler.java +++ b/src/Java/gtPlusPlus/core/handler/events/BlockEventHandler.java @@ -16,17 +16,28 @@ import net.minecraft.util.ChunkCoordinates; import gtPlusPlus.api.objects.Logger; import gtPlusPlus.core.item.ModItems; import gtPlusPlus.core.lib.LoadedMods; +import gtPlusPlus.core.material.nuclear.FLUORIDES; import gtPlusPlus.core.util.math.MathUtils; import gtPlusPlus.core.util.minecraft.ItemUtils; import net.minecraftforge.common.util.FakePlayer; import net.minecraftforge.event.entity.living.LivingDropsEvent; import net.minecraftforge.event.entity.player.PlayerInteractEvent; import net.minecraftforge.event.world.BlockEvent; +import net.minecraftforge.oredict.OreDictionary; +import thaumcraft.common.lib.FakeThaumcraftPlayer; public class BlockEventHandler { public static ArrayList<ItemStack> oreLimestone; public static ArrayList<ItemStack> blockLimestone; public static ItemStack fluoriteOre; + + public static void init() { + //Set Variables for Fluorite Block handling + Logger.INFO("Setting some Variables for the block break event handler."); + BlockEventHandler.oreLimestone = OreDictionary.getOres("oreLimestone"); + BlockEventHandler.blockLimestone = OreDictionary.getOres("limestone"); + BlockEventHandler.fluoriteOre = FLUORIDES.FLUORITE.getOre(1); + } @SubscribeEvent public void onBlockLeftClicked(final PlayerInteractEvent event) { @@ -90,7 +101,7 @@ public class BlockEventHandler { ChunkCoordinates aChunkLocation = p.getPlayerCoordinates(); // Cache Fake Player - if (p instanceof FakePlayer + if (p instanceof FakePlayer || p instanceof FakeThaumcraftPlayer || (event.harvester.getCommandSenderName() == null || event.harvester.getCommandSenderName().length() <= 0) || (p.isEntityInvulnerable() && !p.canCommandSenderUseCommand(0, "") diff --git a/src/Java/gtPlusPlus/core/item/ModItems.java b/src/Java/gtPlusPlus/core/item/ModItems.java index 354107147b..fd2b98c7be 100644 --- a/src/Java/gtPlusPlus/core/item/ModItems.java +++ b/src/Java/gtPlusPlus/core/item/ModItems.java @@ -35,11 +35,13 @@ import gtPlusPlus.core.item.chemistry.AgriculturalChem; import gtPlusPlus.core.item.chemistry.CoalTar; import gtPlusPlus.core.item.chemistry.GenericChem; import gtPlusPlus.core.item.chemistry.IonParticles; +import gtPlusPlus.core.item.chemistry.MilledOreProcessing; import gtPlusPlus.core.item.chemistry.NuclearChem; import gtPlusPlus.core.item.chemistry.RocketFuels; import gtPlusPlus.core.item.chemistry.StandardBaseParticles; import gtPlusPlus.core.item.crafting.ItemDummyResearch; import gtPlusPlus.core.item.effects.RarityUncommon; +import gtPlusPlus.core.item.food.BaseItemMetaFood; import gtPlusPlus.core.item.general.BaseItemGrindle; import gtPlusPlus.core.item.general.BufferCore; import gtPlusPlus.core.item.general.ItemAirFilter; @@ -94,6 +96,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.preloader.CORE_Preloader; import gtPlusPlus.xmod.cofh.HANDLER_COFH; import gtPlusPlus.xmod.eio.material.MaterialEIO; import gtPlusPlus.xmod.gregtech.common.items.MetaGeneratedGregtechItems; @@ -367,6 +370,8 @@ public final class ModItems { public static CoreItem itemExquisiteIndustrialDiamond; + public static BaseItemMetaFood itemMetaFood; + static { Logger.INFO("Items!"); //Default item used when recipes fail, handy for debugging. Let's make sure they exist when this class is called upon. @@ -384,7 +389,7 @@ public final class ModItems { itemDummyResearch = new ItemDummyResearch(); //Debug Loading - if (CORE.DEBUG){ + if (CORE_Preloader.DEBUG_MODE){ DEBUG_INIT.registerItems(); } @@ -996,6 +1001,8 @@ public final class ModItems { //General Chemistry new GenericChem(); + // Milled Ore Processing + new MilledOreProcessing(); //Bombs itemBombCasing = new CoreItem("itemBombCasing", "Bomb Casing", tabMisc); diff --git a/src/Java/gtPlusPlus/core/item/base/ore/BaseItemMilledOre.java b/src/Java/gtPlusPlus/core/item/base/ore/BaseItemMilledOre.java new file mode 100644 index 0000000000..4edf4ae75d --- /dev/null +++ b/src/Java/gtPlusPlus/core/item/base/ore/BaseItemMilledOre.java @@ -0,0 +1,25 @@ +package gtPlusPlus.core.item.base.ore; + +import gregtech.api.enums.Materials; +import gtPlusPlus.core.lib.CORE; +import gtPlusPlus.core.material.Material; +import gtPlusPlus.core.util.minecraft.MaterialUtils; +import net.minecraft.item.Item; + +public class BaseItemMilledOre extends BaseOreComponent{ + + public BaseItemMilledOre(final Material material, int aMaterialEU) { + super(material, BaseOreComponent.ComponentTypes.MILLED); + CORE.RA.addMillingRecipe(material, aMaterialEU); + } + + public static Item generate(Materials aMat, int aMaterialEU) { + return generate(MaterialUtils.generateMaterialFromGtENUM(aMat), aMaterialEU); + } + + public static Item generate(Material aMat, int aMaterialEU) { + return new BaseItemMilledOre(aMat, aMaterialEU); + } + + +} diff --git a/src/Java/gtPlusPlus/core/item/base/ore/BaseOreComponent.java b/src/Java/gtPlusPlus/core/item/base/ore/BaseOreComponent.java index c5b7191ddd..356fdac24e 100644 --- a/src/Java/gtPlusPlus/core/item/base/ore/BaseOreComponent.java +++ b/src/Java/gtPlusPlus/core/item/base/ore/BaseOreComponent.java @@ -18,6 +18,7 @@ import gtPlusPlus.core.material.state.MaterialState; import gtPlusPlus.core.util.Utils; import gtPlusPlus.core.util.minecraft.EntityUtils; import gtPlusPlus.core.util.minecraft.ItemUtils; +import gtPlusPlus.xmod.gregtech.api.enums.CustomOrePrefix; import net.minecraft.client.renderer.texture.IIconRegister; import net.minecraft.entity.Entity; import net.minecraft.entity.player.EntityPlayer; @@ -48,7 +49,6 @@ public class BaseOreComponent extends Item{ this.setCreativeTab(AddToCreativeTab.tabMisc); this.setUnlocalizedName(this.unlocalName); this.setMaxStackSize(64); - //this.setTextureName(this.getCorrectTextures()); this.componentColour = material.getRgbAsHex(); GameRegistry.registerItem(this, this.unlocalName); registerComponent(); @@ -59,9 +59,9 @@ public class BaseOreComponent extends Item{ //ThaumcraftUtils.addAspectToItem(ItemUtils.getSimpleStack(this), TC_Aspect_Wrapper.generate(TC_Aspects.RADIO.mAspect), componentMaterial.vRadiationLevel); } } - + } - + public boolean registerComponent() { Logger.MATERIALS("Attempting to register "+this.getUnlocalizedName()+"."); if (this.componentMaterial == null) { @@ -92,7 +92,10 @@ public class BaseOreComponent extends Item{ else if (componentType == ComponentTypes.DUSTPURE) { aKey = OrePrefixes.dustPure.name(); } - + else if (componentType == ComponentTypes.MILLED) { + aKey = CustomOrePrefix.milled.get().name(); + } + ItemStack x = aMap.get(aKey); if (x == null) { aMap.put(aKey, ItemUtils.getSimpleStack(this)); @@ -107,13 +110,6 @@ public class BaseOreComponent extends Item{ } } - public String getCorrectTextures(){ - if (!CORE.ConfigSwitches.useGregtechTextures){ - return CORE.MODID + ":" + "item"+this.componentType.COMPONENT_NAME; - } - return "gregtech" + ":" + "materialicons/METALLIC/" + this.componentType.COMPONENT_NAME; - } - /*@Override public String getItemStackDisplayName(final ItemStack p_77653_1_) { return (this.componentType.getPrefix()+this.componentMaterial.getLocalizedName()+this.componentType.DISPLAY_NAME); @@ -181,7 +177,13 @@ public class BaseOreComponent extends Item{ @Override @SideOnly(Side.CLIENT) public void registerIcons(final IIconRegister par1IconRegister){ - if (CORE.ConfigSwitches.useGregtechTextures){ + if (this.componentType == ComponentTypes.MILLED) { + this.base = par1IconRegister.registerIcon(CORE.MODID + ":" + "processing/MilledOre/"+this.componentType.getComponent()); + if (this.componentType.hasOverlay()){ + this.overlay = par1IconRegister.registerIcon(CORE.MODID + ":" + "processing/MilledOre/"+this.componentType.getComponent()+"_Overlay"); + } + } + else if (CORE.ConfigSwitches.useGregtechTextures){ //Logger.MATERIALS(this.componentType.getPrefix()+this.componentMaterial.getLocalizedName()+this.componentType.DISPLAY_NAME+" is using `"+"gregtech" + ":" + "materialicons/METALLIC/" + this.componentType.COMPONENT_NAME+"' as the layer 0 texture path."); this.base = par1IconRegister.registerIcon("gregtech" + ":" + "materialicons/METALLIC/" + this.componentType.COMPONENT_NAME); if (this.componentType.hasOverlay()){ @@ -199,13 +201,21 @@ public class BaseOreComponent extends Item{ @Override public int getColorFromItemStack(final ItemStack stack, final int renderPass) { - if (renderPass == 0 && !CORE.ConfigSwitches.useGregtechTextures){ + if (this.componentType == ComponentTypes.MILLED) { + if (renderPass == 1){ + return Utils.rgbtoHexValue(230, 230, 230); + } return this.componentColour; } - if (renderPass == 1 && CORE.ConfigSwitches.useGregtechTextures){ - return Utils.rgbtoHexValue(230, 230, 230); - } - return this.componentColour; + else { + if (renderPass == 0 && !CORE.ConfigSwitches.useGregtechTextures){ + return this.componentColour; + } + if (renderPass == 1 && CORE.ConfigSwitches.useGregtechTextures){ + return Utils.rgbtoHexValue(230, 230, 230); + } + return this.componentColour; + } } @@ -226,7 +236,8 @@ public class BaseOreComponent extends Item{ DUSTPURE("dustPure", "Purified ", " Dust", true), CRUSHED("crushed", "Crushed ", " Ore", true), CRUSHEDCENTRIFUGED("crushedCentrifuged", "Centrifuged Crushed "," Ore", true), - CRUSHEDPURIFIED("crushedPurified", "Purified Crushed ", " Ore", true); + CRUSHEDPURIFIED("crushedPurified", "Purified Crushed ", " Ore", true), + MILLED("milled", "Milled ", " Ore", true); private String COMPONENT_NAME; private String PREFIX; @@ -252,7 +263,7 @@ public class BaseOreComponent extends Item{ public boolean hasOverlay(){ return this.HAS_OVERLAY; } - + public String getPrefix(){ return this.PREFIX; } diff --git a/src/Java/gtPlusPlus/core/item/chemistry/AgriculturalChem.java b/src/Java/gtPlusPlus/core/item/chemistry/AgriculturalChem.java index 0e23e9a845..3f02ca898d 100644 --- a/src/Java/gtPlusPlus/core/item/chemistry/AgriculturalChem.java +++ b/src/Java/gtPlusPlus/core/item/chemistry/AgriculturalChem.java @@ -12,6 +12,7 @@ import gtPlusPlus.api.objects.data.AutoMap; import gtPlusPlus.api.objects.minecraft.ItemPackage; import gtPlusPlus.core.lib.CORE; import gtPlusPlus.core.lib.LoadedMods; +import gtPlusPlus.core.material.ELEMENT; import gtPlusPlus.core.recipe.common.CI; import gtPlusPlus.core.util.Utils; import gtPlusPlus.core.util.minecraft.FluidUtils; @@ -556,6 +557,22 @@ public class AgriculturalChem extends ItemPackage { CORE.RA.addSemifluidFuel(FluidUtils.getFluidStack(ManureSlurry, 1000), 24); CORE.RA.addSemifluidFuel(FluidUtils.getFluidStack(FertileManureSlurry, 1000), 32); + // Red Slurry / Tailings Processing + GT_Values.RA.addCentrifugeRecipe( + CI.getNumberedBioCircuit(10), + GT_Values.NI, + FluidUtils.getFluidStack(AgriculturalChem.RedMud, 1000), + FluidUtils.getWater(500), + ELEMENT.getInstance().IRON.getSmallDust(1), + ELEMENT.getInstance().COPPER.getSmallDust(1), + ELEMENT.getInstance().TIN.getSmallDust(1), + ELEMENT.getInstance().SULFUR.getSmallDust(1), + ELEMENT.getInstance().NICKEL.getTinyDust(1), + ELEMENT.getInstance().LEAD.getTinyDust(1), + new int[] { 3000, 3000, 2000, 2000, 1000, 1000 }, + 30 * 20, + 30); + } @Override diff --git a/src/Java/gtPlusPlus/core/item/chemistry/CoalTar.java b/src/Java/gtPlusPlus/core/item/chemistry/CoalTar.java index 981bfed479..37428b18d6 100644 --- a/src/Java/gtPlusPlus/core/item/chemistry/CoalTar.java +++ b/src/Java/gtPlusPlus/core/item/chemistry/CoalTar.java @@ -189,20 +189,20 @@ public class CoalTar extends ItemPackage { GT_Values.RA.addDistilleryRecipe( CI.getNumberedCircuit(5), //Circuit FluidUtils.getFluidStack("fluid.coaltar", 1500), //aInput - FluidUtils.getFluidStack("fluid.kerosene", 400), //aOutput + FluidUtils.getFluidStack("fluid.kerosene", 600), //aOutput 300, //aDuration 64,//aEUt false //Hidden? ); GT_Values.RA.addDistillationTowerRecipe( - FluidUtils.getFluidStack("fluid.coaltar", 1000), + FluidUtils.getFluidStack("fluid.coaltar", 1200), new FluidStack[]{ FluidUtils.getFluidStack("fluid.coaltaroil", 500), //aOutput FluidUtils.getFluidStack("liquid_naphtha", 100), //aOutput FluidUtils.getFluidStack("fluid.ethylbenzene", 150), //aOutput FluidUtils.getFluidStack("fluid.anthracene", 50), //aOutput - FluidUtils.getFluidStack("fluid.kerosene", 200), //aOutput + FluidUtils.getFluidStack("fluid.kerosene", 400), //aOutput }, null, 900, @@ -314,9 +314,6 @@ public class CoalTar extends ItemPackage { @Override public void fluids() { - - //Special Compatibility for Coke - ItemUtils.addItemToOreDictionary(ItemUtils.getSimpleStack(ModItems.itemCoalCoke, 1), "fuelCoke"); //Create Coal Gas Coal_Gas = FluidUtils.generateFluidNonMolten("CoalGas", "Coal Gas", 500, new short[]{48, 48, 48, 100}, null, null); //Ethanol diff --git a/src/Java/gtPlusPlus/core/item/chemistry/GenericChem.java b/src/Java/gtPlusPlus/core/item/chemistry/GenericChem.java index 49d3303688..ff55326031 100644 --- a/src/Java/gtPlusPlus/core/item/chemistry/GenericChem.java +++ b/src/Java/gtPlusPlus/core/item/chemistry/GenericChem.java @@ -1,12 +1,15 @@ package gtPlusPlus.core.item.chemistry; +import static gtPlusPlus.core.lib.CORE.GTNH; + import gregtech.api.enums.GT_Values; import gregtech.api.enums.TextureSet; -import gregtech.api.util.GT_ModHandler; +import gregtech.api.util.GT_Utility; import gtPlusPlus.api.objects.minecraft.ItemPackage; import gtPlusPlus.core.item.chemistry.general.ItemGenericChemBase; import gtPlusPlus.core.lib.CORE; import gtPlusPlus.core.material.ELEMENT; +import gtPlusPlus.core.material.MISC_MATERIALS; import gtPlusPlus.core.material.Material; import gtPlusPlus.core.material.MaterialGenerator; import gtPlusPlus.core.material.MaterialStack; @@ -16,8 +19,9 @@ 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.plugin.agrichem.item.algae.ItemAgrichemBase; -import net.minecraft.block.Block; +import gtPlusPlus.plugin.agrichem.BioRecipes; +import gtPlusPlus.plugin.agrichem.block.AgrichemFluids; +import gtPlusPlus.xmod.gregtech.api.enums.GregtechItemList; import net.minecraft.init.Items; import net.minecraft.item.Item; import net.minecraft.item.ItemStack; @@ -28,14 +32,21 @@ import net.minecraftforge.fluids.FluidStack; public class GenericChem extends ItemPackage { /** + * Switches + */ + + private static boolean usingGregtechNitricOxide = false; + private static boolean usingGregtechNitrogenDioxide = false; + + /** * Materials */ - + public static final Material BAKELITE = new Material("Bakelite", MaterialState.SOLID, TextureSet.SET_DULL, new short[]{90, 140, 140}, 120, 240, 23, 24, true, null, 0);//Not a GT Inherited Material public static final Material NYLON = new Material("Nylon", MaterialState.SOLID, TextureSet.SET_SHINY, new short[]{45, 45, 45}, 300, 600, 44, 48, true, null, 0);//Not a GT Inherited Material public static final Material CARBYNE = new Material("Carbyne", MaterialState.SOLID, TextureSet.SET_DULL, new short[]{25, 25, 25}, 2500, 5000, 63, 52, true, null, 0);//Not a GT Inherited Material - - + + //Refined PTFE public static final Material TEFLON = new Material( "Teflon", @@ -52,34 +63,37 @@ public class GenericChem extends ItemPackage { new MaterialStack(NONMATERIAL.PLASTIC, 15), new MaterialStack(ELEMENT.getInstance().CARBON, 5), new MaterialStack(ELEMENT.getInstance().SODIUM, 5) - });// Not a GT - // Inherited - // Material + });// Not a GT + // Inherited + // Material //public static final Material HYPOGEN = new Material("Hypogen", MaterialState.SOLID, TextureSets.NUCLEAR.get(), new short[]{220, 120, 75}, 12255, 19377, 240, 251, true, "Hy⚶", 0);//Not a GT Inherited Material //public static final Material HYPOGEN = new Material("Hypogen", MaterialState.SOLID, TextureSets.NUCLEAR.get(), new short[]{220, 120, 75}, 12255, 19377, 240, 251, true, "Hy⚶", 0);//Not a GT Inherited Material //public static final Material Nylon = new Material(); - + /** * Fluids */ - public Fluid Benzene; - public Fluid NitroBenzene; - public Fluid Aniline; - public Fluid Polyurethane; - public Fluid Phenol; //https://en.wikipedia.org/wiki/Phenol#Uses - public Fluid Cyclohexane; //https://en.wikipedia.org/wiki/Cyclohexane - public Fluid Cyclohexanone; //https://en.wikipedia.org/wiki/Cyclohexanone - - public Fluid Cadaverine; //https://en.wikipedia.org/wiki/Cadaverine - public Fluid Putrescine; //https://en.wikipedia.org/wiki/Putrescine - + public static Fluid Benzene; + public static Fluid NitroBenzene; + public static Fluid Aniline; + public static Fluid Polyurethane; + public static Fluid Phenol; //https://en.wikipedia.org/wiki/Phenol#Uses + public static Fluid Cyclohexane; //https://en.wikipedia.org/wiki/Cyclohexane + public static Fluid Cyclohexanone; //https://en.wikipedia.org/wiki/Cyclohexanone + public static Fluid Cadaverine; //https://en.wikipedia.org/wiki/Cadaverine + public static Fluid Putrescine; //https://en.wikipedia.org/wiki/Putrescine + public static Fluid BoricAcid; + public static Fluid HydrochloricAcid; + public static Fluid Ethylanthraquinone2; public static Fluid Ethylanthrahydroquinone2; public static Fluid Hydrogen_Peroxide; public static Fluid Lithium_Peroxide; + public static Fluid Nitric_Oxide; + public static Fluid Nitrogen_Dioxide; /** * Items @@ -89,6 +103,19 @@ public class GenericChem extends ItemPackage { public Item PhenolicResins; //https://en.wikipedia.org/wiki/Phenol_formaldehyde_resin public static ItemGenericChemBase mGenericChemItem1; + private ItemStack mCatalystCarrier; + + public static ItemStack mRedCatalyst; + public static ItemStack mYellowCatalyst; + public static ItemStack mBlueCatalyst; + public static ItemStack mOrangeCatalyst; + public static ItemStack mPurpleCatalyst; + public static ItemStack mBrownCatalyst; + public static ItemStack mPinkCatalyst; + + public static ItemStack mMillingBallAlumina; + public static ItemStack mMillingBallSoapstone; + @Override @@ -99,26 +126,20 @@ public class GenericChem extends ItemPackage { MaterialGenerator.generate(TEFLON, false); mGenericChemItem1 = new ItemGenericChemBase(); - + registerItemStacks(); registerOreDict(); + + GregtechItemList.Milling_Ball_Alumina.set(mMillingBallAlumina); + GregtechItemList.Milling_Ball_Soapstone.set(mMillingBallSoapstone); + } - private ItemStack mCatalystCarrier; - - public static ItemStack mRedCatalyst; - public static ItemStack mYellowCatalyst; - public static ItemStack mBlueCatalyst; - public static ItemStack mOrangeCatalyst; - public static ItemStack mPurpleCatalyst; - public static ItemStack mBrownCatalyst; - public static ItemStack mPinkCatalyst; - - + public void registerItemStacks() { mCatalystCarrier = ItemUtils.simpleMetaStack(AgriculturalChem.mAgrichemItem1, 13, 1); - + mRedCatalyst = ItemUtils.simpleMetaStack(mGenericChemItem1, 0, 1); mYellowCatalyst = ItemUtils.simpleMetaStack(mGenericChemItem1, 1, 1); mBlueCatalyst = ItemUtils.simpleMetaStack(mGenericChemItem1, 2, 1); @@ -126,9 +147,11 @@ public class GenericChem extends ItemPackage { mPurpleCatalyst = ItemUtils.simpleMetaStack(mGenericChemItem1, 4, 1); mBrownCatalyst = ItemUtils.simpleMetaStack(mGenericChemItem1, 5, 1); mPinkCatalyst = ItemUtils.simpleMetaStack(mGenericChemItem1, 6, 1); - + mMillingBallAlumina = ItemUtils.simpleMetaStack(mGenericChemItem1, 7, 1); + mMillingBallSoapstone = ItemUtils.simpleMetaStack(mGenericChemItem1, 8, 1); + } - + public void registerOreDict() { ItemUtils.addItemToOreDictionary(mRedCatalyst, "catalystIronCopper"); @@ -138,7 +161,9 @@ public class GenericChem extends ItemPackage { ItemUtils.addItemToOreDictionary(mPurpleCatalyst, "catalystIridiumRuthenium"); ItemUtils.addItemToOreDictionary(mBrownCatalyst, "catalystNickelAluminium"); ItemUtils.addItemToOreDictionary(mPinkCatalyst, "catalystPlatinumRhodium"); - + ItemUtils.addItemToOreDictionary(mMillingBallAlumina, "millingballAlumina"); + ItemUtils.addItemToOreDictionary(mMillingBallSoapstone, "millingballSoapstone"); + } @Override @@ -146,33 +171,43 @@ public class GenericChem extends ItemPackage { @Override public void fluids() { - + if (!FluidRegistry.isFluidRegistered("benzene")) { Benzene = FluidUtils.generateFluidNoPrefix("benzene", "Benzene", 278, new short[] { 100, 70, 30, 100 }, true); } else { Benzene = FluidRegistry.getFluid("benzene"); } - + NitroBenzene = FluidUtils.generateFluidNoPrefix("nitrobenzene", "NitroBenzene", 278, new short[] { 70, 50, 40, 100 }, true); - + Aniline = FluidUtils.generateFluidNoPrefix("aniline", "Aniline", 266, new short[] { 100, 100, 30, 100 }, true); - + + BoricAcid = FluidUtils.generateFluidNoPrefix("boricacid", "Boric Acid", 278, new short[] { 90, 30, 120, 100 }, true); + Polyurethane = FluidUtils.generateFluidNoPrefix("polyurethane", "Polyurethane", 350, new short[] { 100, 70, 100, 100 }, true); - + if (!FluidRegistry.isFluidRegistered("phenol")) { Phenol = FluidUtils.generateFluidNoPrefix("phenol", "Phenol", 313, new short[] { 100, 70, 30, 100 }, true); } else { Phenol = FluidRegistry.getFluid("phenol"); - } - + } + + // Use GT's if it exists, else make our own. + if (FluidRegistry.isFluidRegistered("hydrochloricacid_gt5u")) { + HydrochloricAcid = FluidRegistry.getFluid("hydrochloricacid_gt5u"); + } + else { + HydrochloricAcid = FluidUtils.generateFluidNoPrefix("hydrochloricacid", "Hydrochloric Acid", 285, new short[] { 183, 200, 196, 100 }, true); + } + Cyclohexane = FluidUtils.generateFluidNoPrefix("cyclohexane", "Cyclohexane", 32 + 175, new short[] { 100, 70, 30, 100 }, true); Cyclohexanone = FluidUtils.generateFluidNoPrefix("cyclohexanone", "Cyclohexanone", 32 + 175, new short[] { 100, 70, 30, 100 }, true); - + Cadaverine = FluidUtils.generateFluidNoPrefix("cadaverine", "Cadaverine", 32 + 175, new short[] { 100, 70, 30, 100 }, true); Putrescine = FluidUtils.generateFluidNoPrefix("putrescine", "Putrescine", 32 + 175, new short[] { 100, 70, 30, 100 }, true); - + //Create 2-Ethylanthraquinone //2-Ethylanthraquinone is prepared from the reaction of phthalic anhydride and ethylbenzene Ethylanthraquinone2 = FluidUtils.generateFluidNonMolten("2Ethylanthraquinone", "2-Ethylanthraquinone", 415, new short[]{227, 255, 159, 100}, null, null); @@ -183,6 +218,21 @@ public class GenericChem extends ItemPackage { //Compressed Air(1500) + Ethylanthrahydroquinone(500) + Anthracene(5) = 450 Ethylanthraquinone && 200 Peroxide Hydrogen_Peroxide = FluidUtils.generateFluidNonMolten("HydrogenPeroxide", "Hydrogen Peroxide", 150, new short[]{210, 255, 255, 100}, null, null); + if (FluidRegistry.isFluidRegistered("nitricoxide")) { + Nitric_Oxide = FluidRegistry.getFluid("nitricoxide"); + usingGregtechNitricOxide = true; + } + else { + Nitric_Oxide = FluidUtils.generateFluidNoPrefix("nitricoxide", "Nitric Oxide", 200, new short[] {125, 200, 240, 100}); + } + if (FluidRegistry.isFluidRegistered("nitrogendioxide")) { + Nitrogen_Dioxide = FluidRegistry.getFluid("nitrogendioxide"); + usingGregtechNitrogenDioxide = true; + } + else { + Nitrogen_Dioxide = FluidUtils.generateFluidNoPrefix("nitrogendioxide", "Nitrogen Dioxide", 200, new short[] {100, 175, 255, 100}); + } + //Lithium Hydroperoxide - LiOH + H2O2 → LiOOH + 2 H2O @@ -191,8 +241,8 @@ public class GenericChem extends ItemPackage { //Lithium Peroxide - 2 LiOOH → Li2O2 + H2O2 + 2 H2O Lithium_Peroxide = FluidUtils.generateFluidNonMolten("LithiumPeroxide", "Lithium Peroxide", 446, new short[]{135, 135, 135, 100}, null, null); - - + + } @Override @@ -202,7 +252,7 @@ public class GenericChem extends ItemPackage { @Override public boolean generateRecipes() { - + recipeCatalystRed(); recipeCatalystYellow(); recipeCatalystBlue(); @@ -210,24 +260,165 @@ public class GenericChem extends ItemPackage { recipeCatalystPurple(); recipeCatalystBrown(); recipeCatalystPink(); - + + recipeGrindingBallAlumina(); + recipeGrindingBallSoapstone(); + recipeNitroBenzene(); recipeAniline(); recipeCadaverineAndPutrescine(); recipeCyclohexane(); recipeCyclohexanone(); - + recipe2Ethylanthraquinone(); recipe2Ethylanthrahydroquinone(); recipeHydrogenPeroxide(); recipeLithiumHydroperoxide(); - recipeLithiumPeroxide(); - + recipeLithiumPeroxide(); + if (!usingGregtechNitricOxide) { + recipeNitricOxide(); + } + if (!usingGregtechNitrogenDioxide) { + recipeNitrogenDioxide(); + } + + // Add recipes if we are not using GT's fluid. + if (!FluidRegistry.isFluidRegistered("hydrochloricacid_gt5u")) { + recipeHydrochloricAcid(); + } + registerFuels(); + return true; + } + + + private static void registerFuels() { + + // Burnables + + // Gas Fuels + GT_Values.RA.addFuel(ItemUtils.getItemStackOfAmountFromOreDict("cellNitroBenzene", 1), null, 1250, 1); + + } + + private void recipeGrindingBallAlumina() { + CORE.RA.addSixSlotAssemblingRecipe(new ItemStack[] { + CI.getNumberedCircuit(10), + ItemUtils.getSimpleStack(AgriculturalChem.mAlumina, 64) + }, + FluidUtils.getFluidStack(GenericChem.Aniline, 4000), + ItemUtils.getSimpleStack(mMillingBallAlumina, 8), + 180 * 20, + 480); + } + private void recipeGrindingBallSoapstone() { + CORE.RA.addSixSlotAssemblingRecipe(new ItemStack[] { + CI.getNumberedCircuit(10), + ItemUtils.getItemStackOfAmountFromOreDict("dustSoapstone", 32) + }, + FluidUtils.getFluidStack(AgrichemFluids.mLiquidResin, 2500), + ItemUtils.getSimpleStack(mMillingBallSoapstone, 8), + 120 * 20, + 480); + } + + private void recipeNitrogenDioxide() { + ItemStack aNitricOxideCell = ItemUtils.getItemStackOfAmountFromOreDict("cellNitricOxide", 1); + ItemStack aNitrogenDioxideCell = ItemUtils.getItemStackOfAmountFromOreDict("cellNitrogenDioxide", 1); + GT_Values.RA.addChemicalRecipe( ItemUtils.getSimpleStack(aNitricOxideCell, 2), GT_Utility.getIntegratedCircuit(1), ELEMENT.getInstance().OXYGEN.getFluid(1000), FluidUtils.getFluidStack(Nitrogen_Dioxide, 3000), CI.emptyCells(2), 160); + GT_Values.RA.addChemicalRecipe( ELEMENT.getInstance().OXYGEN.getCell(1), GT_Utility.getIntegratedCircuit(1), FluidUtils.getFluidStack(Nitric_Oxide, 2000), FluidUtils.getFluidStack(Nitrogen_Dioxide, 3000), CI.emptyCells(1), 160); + GT_Values.RA.addChemicalRecipeForBasicMachineOnly(ItemUtils.getSimpleStack(aNitricOxideCell, 2), CI.emptyCells(1), ELEMENT.getInstance().OXYGEN.getFluid(1000), GT_Values.NF, ItemUtils.getSimpleStack(aNitrogenDioxideCell, 3), GT_Values.NI, 160, 30); + GT_Values.RA.addChemicalRecipeForBasicMachineOnly(ELEMENT.getInstance().OXYGEN.getCell(1), CI.emptyCells(2), FluidUtils.getFluidStack(Nitric_Oxide, 2000), GT_Values.NF, ItemUtils.getSimpleStack(aNitrogenDioxideCell, 3), GT_Values.NI, 160, 30); + GT_Values.RA.addChemicalRecipeForBasicMachineOnly(ItemUtils.getSimpleStack(aNitricOxideCell, 2), ELEMENT.getInstance().OXYGEN.getCell(1), GT_Values.NF, GT_Values.NF, ItemUtils.getSimpleStack(aNitrogenDioxideCell, 3), GT_Values.NI, 160, 30); + } + + + private void recipeNitricOxide() { + ItemStack aWaterCell = ItemUtils.getItemStackOfAmountFromOreDict("cellWater", 1); + ItemStack aNitricOxideCell = ItemUtils.getItemStackOfAmountFromOreDict("cellNitricOxide", 1); + GT_Values.RA.addChemicalRecipeForBasicMachineOnly(MISC_MATERIALS.AMMONIA.getCell(8), CI.emptyCells(1), ELEMENT.getInstance().OXYGEN.getFluid(5000), FluidUtils.getFluidStack(Nitric_Oxide, 4000), ItemUtils.getSimpleStack(aWaterCell, 9), GT_Values.NI, 160, 30); + GT_Values.RA.addChemicalRecipeForBasicMachineOnly(ELEMENT.getInstance().OXYGEN.getCell(5), CI.emptyCells(4), MISC_MATERIALS.AMMONIA.getFluid(8000), FluidUtils.getFluidStack(Nitric_Oxide, 4000), ItemUtils.getSimpleStack(aWaterCell, 9), GT_Values.NI, 160, 30); + GT_Values.RA.addChemicalRecipe( MISC_MATERIALS.AMMONIA.getCell(8), GT_Utility.getIntegratedCircuit(11), ELEMENT.getInstance().OXYGEN.getFluid(5000), FluidUtils.getWater(9000), ItemUtils.getSimpleStack(aNitricOxideCell, 4), CI.emptyCells(4), 160); + GT_Values.RA.addChemicalRecipe( ELEMENT.getInstance().OXYGEN.getCell(5), GT_Utility.getIntegratedCircuit(11), MISC_MATERIALS.AMMONIA.getFluid(8000), FluidUtils.getWater(9000), ItemUtils.getSimpleStack(aNitricOxideCell, 4), CI.emptyCells(1), 160); + GT_Values.RA.addChemicalRecipe( MISC_MATERIALS.AMMONIA.getCell(8), GT_Utility.getIntegratedCircuit(2), ELEMENT.getInstance().OXYGEN.getFluid(5000), FluidUtils.getFluidStack(Nitric_Oxide, 4000), CI.emptyCells(8), 320); + GT_Values.RA.addChemicalRecipe( ELEMENT.getInstance().OXYGEN.getCell(5), GT_Utility.getIntegratedCircuit(2), MISC_MATERIALS.AMMONIA.getFluid(8000), FluidUtils.getFluidStack(Nitric_Oxide, 4000), CI.emptyCells(5), 320); + GT_Values.RA.addChemicalRecipe( MISC_MATERIALS.AMMONIA.getCell(8), GT_Utility.getIntegratedCircuit(12), ELEMENT.getInstance().OXYGEN.getFluid(5000), GT_Values.NF, ItemUtils.getSimpleStack(aNitricOxideCell, 4), CI.emptyCells(4), 160); + GT_Values.RA.addChemicalRecipe( ELEMENT.getInstance().OXYGEN.getCell(5), GT_Utility.getIntegratedCircuit(12), MISC_MATERIALS.AMMONIA.getFluid(8000), GT_Values.NF, ItemUtils.getSimpleStack(aNitricOxideCell, 4), CI.emptyCells(1), 160); + GT_Values.RA.addChemicalRecipeForBasicMachineOnly(MISC_MATERIALS.AMMONIA.getCell(8), ELEMENT.getInstance().OXYGEN.getCell(5), GT_Values.NF, GT_Values.NF, ItemUtils.getSimpleStack(aNitricOxideCell, 4), ItemUtils.getSimpleStack(aWaterCell, 9), 160, 30); + GT_Values.RA.addMultiblockChemicalRecipe(new ItemStack[]{GT_Utility.getIntegratedCircuit(1)}, new FluidStack[]{MISC_MATERIALS.AMMONIA.getFluid(8000), ELEMENT.getInstance().OXYGEN.getFluid(5000)}, new FluidStack[]{FluidUtils.getFluidStack(Nitric_Oxide, 4000), FluidUtils.getWater(9000)}, null, 160, 30); + } + + + private void recipeHydrochloricAcid() { + + ItemStack aAcidCell = ItemUtils.getItemStackOfAmountFromOreDict("cellHydrochloricAcid", 1); + + CORE.RA.addChemicalRecipe( + ELEMENT.getInstance().CHLORINE.getCell(1), + GT_Utility.getIntegratedCircuit(1), + ELEMENT.getInstance().HYDROGEN.getFluid(1000), + FluidUtils.getFluidStack(HydrochloricAcid, 2000), + CI.emptyCells(1), + 60, + 8); + + CORE.RA.addChemicalRecipe( + ELEMENT.getInstance().HYDROGEN.getCell(1), + GT_Utility.getIntegratedCircuit(1), + ELEMENT.getInstance().CHLORINE.getFluid(1000), + FluidUtils.getFluidStack(HydrochloricAcid, 2000), + CI.emptyCells(1), + 60, + 8); + + GT_Values.RA.addElectrolyzerRecipe( + CI.emptyCells(1), + GT_Utility.getIntegratedCircuit(1), + FluidUtils.getFluidStack(HydrochloricAcid, 2000), + ELEMENT.getInstance().CHLORINE.getFluid(1000), + ELEMENT.getInstance().HYDROGEN.getCell(1), + GT_Values.NI, + GT_Values.NI, + GT_Values.NI, + GT_Values.NI, + GT_Values.NI, + null, + 720, + 30); + + GT_Values.RA.addElectrolyzerRecipe( + CI.emptyCells(1), + GT_Utility.getIntegratedCircuit(11), + FluidUtils.getFluidStack(HydrochloricAcid, 2000), + ELEMENT.getInstance().HYDROGEN.getFluid(1000), + ELEMENT.getInstance().CHLORINE.getCell(1), + GT_Values.NI, + GT_Values.NI, + GT_Values.NI, + GT_Values.NI, + GT_Values.NI, + null, + 720, + 30); + + GT_Values.RA.addElectrolyzerRecipe( + ItemUtils.getSimpleStack(aAcidCell, 2), + GT_Values.NI, + GT_Values.NF, + GT_Values.NF, + ELEMENT.getInstance().HYDROGEN.getCell(1), + ELEMENT.getInstance().CHLORINE.getCell(1), + GT_Values.NI, + GT_Values.NI, + GT_Values.NI, + GT_Values.NI, + null, + 720, + 30); } private void recipeCyclohexane() { - + CORE.RA.addChemicalPlantRecipe( new ItemStack[] { getTierTwoChip(), @@ -238,7 +429,7 @@ public class GenericChem extends ItemPackage { FluidUtils.getFluidStack("hydrogen", 10000) }, new ItemStack[] { - + }, new FluidStack[] { FluidUtils.getFluidStack(Cyclohexane, 1000), @@ -246,11 +437,11 @@ public class GenericChem extends ItemPackage { 20 * 120, 120, 2); - + } private void recipeCyclohexanone() { - + CORE.RA.addChemicalPlantRecipe( new ItemStack[] { getTierTwoChip(), @@ -261,7 +452,7 @@ public class GenericChem extends ItemPackage { FluidUtils.getFluidStack("air", 10000) }, new ItemStack[] { - + }, new FluidStack[] { FluidUtils.getFluidStack(Cyclohexanone, 2000), @@ -269,7 +460,7 @@ public class GenericChem extends ItemPackage { 20 * 120, 120, 2); - + CORE.RA.addChemicalPlantRecipe( new ItemStack[] { getTierTwoChip(), @@ -279,7 +470,7 @@ public class GenericChem extends ItemPackage { FluidUtils.getFluidStack("oxygen", 5000) }, new ItemStack[] { - + }, new FluidStack[] { FluidUtils.getFluidStack(Cyclohexanone, 2000), @@ -287,10 +478,10 @@ public class GenericChem extends ItemPackage { 20 * 120, 120, 2); - - - - + + + + } private void recipeCatalystRed() { @@ -305,7 +496,7 @@ public class GenericChem extends ItemPackage { ItemUtils.getSimpleStack(mRedCatalyst, 10), 20 * 20, 30); - + } private void recipeCatalystYellow() { @@ -320,7 +511,7 @@ public class GenericChem extends ItemPackage { ItemUtils.getSimpleStack(mYellowCatalyst, 10), 60 * 20, 2000); - + } private void recipeCatalystBlue() { @@ -335,7 +526,7 @@ public class GenericChem extends ItemPackage { ItemUtils.getSimpleStack(mBlueCatalyst, 10), 40 * 20, 500); - + } private void recipeCatalystOrange() { @@ -350,7 +541,7 @@ public class GenericChem extends ItemPackage { ItemUtils.getSimpleStack(mOrangeCatalyst, 10), 40 * 20, 500); - + } private void recipeCatalystPurple() { @@ -365,7 +556,7 @@ public class GenericChem extends ItemPackage { ItemUtils.getSimpleStack(mPurpleCatalyst, 10), 120 * 20, 8000); - + } private void recipeCatalystBrown() { @@ -380,7 +571,7 @@ public class GenericChem extends ItemPackage { ItemUtils.getSimpleStack(mBrownCatalyst, 10), 15 * 20, 30); - + } private void recipeCatalystPink() { @@ -395,11 +586,11 @@ public class GenericChem extends ItemPackage { ItemUtils.getSimpleStack(mPinkCatalyst, 10), 30 * 20, 2000); - + } private void recipeCadaverineAndPutrescine() { - + // Basic Recipe CORE.RA.addChemicalPlantRecipe( new ItemStack[] { @@ -410,7 +601,7 @@ public class GenericChem extends ItemPackage { FluidUtils.getHotWater(2000) }, new ItemStack[] { - + }, new FluidStack[] { FluidUtils.getFluidStack(Cadaverine, 250), @@ -431,7 +622,7 @@ public class GenericChem extends ItemPackage { FluidUtils.getHotWater(3000) }, new ItemStack[] { - + }, new FluidStack[] { FluidUtils.getFluidStack(Cadaverine, 750), @@ -440,11 +631,11 @@ public class GenericChem extends ItemPackage { 20 * 120, 240, 2); - + } private void recipeAniline() { - + CORE.RA.addChemicalPlantRecipe( new ItemStack[] { getTierThreeChip(), @@ -455,7 +646,7 @@ public class GenericChem extends ItemPackage { FluidUtils.getFluidStack("hydrogen", 10000) }, new ItemStack[] { - + }, new FluidStack[] { FluidUtils.getFluidStack(Aniline, 2000), @@ -463,11 +654,11 @@ public class GenericChem extends ItemPackage { 20 * 30, 500, 3); - + } private void recipeNitroBenzene() { - + CORE.RA.addChemicalPlantRecipe( new ItemStack[] { getTierThreeChip(), @@ -479,7 +670,7 @@ public class GenericChem extends ItemPackage { FluidUtils.getDistilledWater(10000) }, new ItemStack[] { - + }, new FluidStack[] { FluidUtils.getFluidStack("dilutedsulfuricacid", 3000), @@ -488,11 +679,11 @@ public class GenericChem extends ItemPackage { 20 * 30, 500, 3); - + } private void recipe2Ethylanthraquinone() { - + CORE.RA.addChemicalPlantRecipe( new ItemStack[] { CI.getNumberedCircuit(4), @@ -502,7 +693,7 @@ public class GenericChem extends ItemPackage { FluidUtils.getFluidStack(CoalTar.Ethylbenzene, 2000), }, new ItemStack[] { - + }, new FluidStack[] { FluidUtils.getFluidStack(Ethylanthraquinone2, 2000+(144*4)), @@ -510,7 +701,7 @@ public class GenericChem extends ItemPackage { 20 * 15, 120, 1); - + /*GT_Values.RA.addChemicalRecipe( ItemUtils.getItemStackOfAmountFromOreDict("dustPhthalicAnhydride", 4), ItemUtils.getItemStackOfAmountFromOreDict("cellEthylbenzene", 2), @@ -518,11 +709,11 @@ public class GenericChem extends ItemPackage { FluidUtils.getFluidStack("fluid.2ethylanthraquinone", 2000+(144*4)), ItemUtils.getItemStackOfAmountFromOreDict("cellEmpty", 2), 20*16);*/ - + } private void recipe2Ethylanthrahydroquinone() { - + CORE.RA.addChemicalPlantRecipe( new ItemStack[] { CI.getNumberedCircuit(4), @@ -533,7 +724,7 @@ public class GenericChem extends ItemPackage { FluidUtils.getFluidStack("hydrogen", 2000), }, new ItemStack[] { - + }, new FluidStack[] { FluidUtils.getFluidStack(Ethylanthrahydroquinone2, 5000), @@ -541,7 +732,7 @@ public class GenericChem extends ItemPackage { 20 * 40, 120, 1); - + /*GT_Values.RA.addChemicalRecipe( ItemUtils.getItemStackOfAmountFromOreDict("platePalladium", 0), ItemUtils.getItemStackOfAmountFromOreDict("cell2Ethylanthraquinone", 1), @@ -549,7 +740,7 @@ public class GenericChem extends ItemPackage { FluidUtils.getFluidStack("fluid.2ethylanthrahydroquinone", 1200), ItemUtils.getItemStackOfAmountFromOreDict("cellEmpty", 1), 20*40);*/ - + } private void recipeLithiumPeroxide() { @@ -571,7 +762,7 @@ public class GenericChem extends ItemPackage { } private void recipeLithiumHydroperoxide() { - + CORE.RA.addChemicalPlantRecipe( new ItemStack[] { CI.getNumberedCircuit(4), @@ -584,14 +775,14 @@ public class GenericChem extends ItemPackage { ItemUtils.getItemStackOfAmountFromOreDict("dustLithiumHydroperoxide", 14), }, new FluidStack[] { - + }, 20 * 30, 240, 1); - - - + + + /*CORE.RA.addChemicalRecipe( ItemUtils.getItemStackOfAmountFromOreDict("dustLithiumHydroxide", 7), ItemUtils.getItemStackOfAmountFromOreDict("cellHydrogenPeroxide", 1), @@ -605,7 +796,7 @@ public class GenericChem extends ItemPackage { } private void recipeHydrogenPeroxide() { - + CORE.RA.addChemicalPlantRecipe( new ItemStack[] { CI.getNumberedCircuit(4), @@ -624,7 +815,7 @@ public class GenericChem extends ItemPackage { 20 * 30, 240, 1); - + /* CORE.RA.addChemicalRecipe( GT_ModHandler.getAirCell(15), ItemUtils.getItemStackOfAmountFromOreDict("cell2Ethylanthrahydroquinone", 5), @@ -635,38 +826,38 @@ public class GenericChem extends ItemPackage { CI.emptyCells(18), 20*30, 240);*/ - + } - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + private static final ItemStack getTierOneChip() { return CI.getNumberedBioCircuit(4); } @@ -679,7 +870,7 @@ public class GenericChem extends ItemPackage { private static final ItemStack getTierFourChip() { return CI.getNumberedBioCircuit(16); } - - - + + + } diff --git a/src/Java/gtPlusPlus/core/item/chemistry/MilledOreProcessing.java b/src/Java/gtPlusPlus/core/item/chemistry/MilledOreProcessing.java new file mode 100644 index 0000000000..426f48ecf9 --- /dev/null +++ b/src/Java/gtPlusPlus/core/item/chemistry/MilledOreProcessing.java @@ -0,0 +1,113 @@ +package gtPlusPlus.core.item.chemistry; + +import gregtech.api.enums.Materials; +import gtPlusPlus.api.objects.Logger; +import gtPlusPlus.api.objects.minecraft.ItemPackage; +import gtPlusPlus.core.item.base.ore.BaseItemMilledOre; +import gtPlusPlus.core.util.minecraft.FluidUtils; +import gtPlusPlus.core.util.minecraft.MaterialUtils; +import net.minecraft.item.Item; +import net.minecraftforge.fluids.Fluid; + +public class MilledOreProcessing extends ItemPackage { + + /** + * Fluids + */ + + public static Fluid ZincFlotationFroth; + public static Fluid CopperFlotationFroth; + public static Fluid NickelFlotationFroth; + public static Fluid PlatinumFlotationFroth; + public static Fluid PentlanditeFlotationFroth; + + + /** + * Items + */ + + // Zinc, Iron, Indium, Germanium + public static Item milledSphalerite; + + // Copper, Iron, Cadmium, Indium + public static Item milledChalcopyrite; + + // Nickel, Cobalt, Rhodium, Ruthenium + public static Item milledNickel; + + // Platinum, Rhodium, Selenium, Tellurium + public static Item milledPlatinum; + + // Iron, Nickel, Promethium, Hafnium + public static Item milledPentlandite; + + + @Override + public void items() { + + milledSphalerite = BaseItemMilledOre.generate(Materials.Sphalerite, MaterialUtils.getVoltageForTier(5)); + milledChalcopyrite = BaseItemMilledOre.generate(Materials.Chalcopyrite, MaterialUtils.getVoltageForTier(4)); + milledNickel = BaseItemMilledOre.generate(Materials.Nickel, MaterialUtils.getVoltageForTier(4)); + milledPlatinum = BaseItemMilledOre.generate(Materials.Platinum, MaterialUtils.getVoltageForTier(5)); + milledPentlandite = BaseItemMilledOre.generate(Materials.Pentlandite, MaterialUtils.getVoltageForTier(5)); + + } + + @Override + public void blocks() { + // None yet + } + + @Override + public void fluids() { + + short[] aZincFrothRGB = Materials.Sphalerite.mRGBa; + ZincFlotationFroth = FluidUtils.generateFluidNoPrefix("froth.zincflotation", "Zinc Froth", 32 + 175, new short[] { aZincFrothRGB[0], aZincFrothRGB[1], aZincFrothRGB[2], 100 }, true); + short[] aCopperFrothRGB = Materials.Chalcopyrite.mRGBa; + CopperFlotationFroth = FluidUtils.generateFluidNoPrefix("froth.copperflotation", "Copper Froth", 32 + 175, new short[] { aCopperFrothRGB[0], aCopperFrothRGB[1], aCopperFrothRGB[2], 100 }, true); + short[] aNickelFrothRGB = Materials.Nickel.mRGBa; + NickelFlotationFroth = FluidUtils.generateFluidNoPrefix("froth.nickelflotation", "Nickel Froth", 32 + 175, new short[] { aNickelFrothRGB[0], aNickelFrothRGB[1], aNickelFrothRGB[2], 100 }, true); + short[] aPlatinumFrothRGB = Materials.Platinum.mRGBa; + PlatinumFlotationFroth = FluidUtils.generateFluidNoPrefix("froth.platinumflotation", "Platinum Froth", 32 + 175, new short[] { aPlatinumFrothRGB[0], aPlatinumFrothRGB[1], aPlatinumFrothRGB[2], 100 }, true); + short[] aPentlanditeFrothRGB = Materials.Pentlandite.mRGBa; + PentlanditeFlotationFroth = FluidUtils.generateFluidNoPrefix("froth.pentlanditeflotation", "Pentlandite Froth", 32 + 175, new short[] { aPentlanditeFrothRGB[0], aPentlanditeFrothRGB[1], aPentlanditeFrothRGB[2], 100 }, true); + + } + + + + public MilledOreProcessing() { + super(); + Logger.INFO("Adding Ore Milling content"); + } + + private static void addMiscRecipes() { + + /*GT_Values.RA.addCentrifugeRecipe( + CI.getNumberedBioCircuit(10), + GT_Values.NI, + FluidUtils.getFluidStack(MilledOreProcessing.ZincFlotationFroth, 1000), + FluidUtils.getWater(500), + ELEMENT.getInstance().IRON.getSmallDust(1), + ELEMENT.getInstance().COPPER.getSmallDust(1), + ELEMENT.getInstance().TIN.getSmallDust(1), + ELEMENT.getInstance().SULFUR.getSmallDust(1), + ELEMENT.getInstance().NICKEL.getTinyDust(1), + ELEMENT.getInstance().LEAD.getTinyDust(1), + new int[] { 3000, 3000, 2000, 2000, 1000, 1000 }, + 30 * 20, + 30);*/ + + } + + @Override + public String errorMessage() { + return "Failed to generate recipes for OreMillingProc."; + } + + @Override + public boolean generateRecipes() { + addMiscRecipes(); + return true; + } +} diff --git a/src/Java/gtPlusPlus/core/item/chemistry/RocketFuels.java b/src/Java/gtPlusPlus/core/item/chemistry/RocketFuels.java index e6426dd6df..459acb31b9 100644 --- a/src/Java/gtPlusPlus/core/item/chemistry/RocketFuels.java +++ b/src/Java/gtPlusPlus/core/item/chemistry/RocketFuels.java @@ -6,19 +6,21 @@ import java.util.LinkedHashMap; import cpw.mods.fml.common.event.FMLLoadCompleteEvent; import gregtech.api.enums.GT_Values; -import gregtech.api.enums.Materials; 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 gtPlusPlus.api.helpers.MaterialHelper; +import gtPlusPlus.api.objects.Logger; +import gtPlusPlus.api.objects.data.AutoMap; import gtPlusPlus.api.objects.minecraft.ItemPackage; import gtPlusPlus.core.item.base.BaseItemComponent; import gtPlusPlus.core.lib.CORE; import gtPlusPlus.core.recipe.common.CI; import gtPlusPlus.core.util.Utils; -import gtPlusPlus.core.util.math.MathUtils; import gtPlusPlus.core.util.minecraft.FluidUtils; import gtPlusPlus.core.util.minecraft.ItemUtils; import gtPlusPlus.core.util.minecraft.MaterialUtils; +import gtPlusPlus.xmod.gregtech.common.StaticFields59; import net.minecraft.item.Item; import net.minecraft.item.ItemStack; import net.minecraftforge.fluids.Fluid; @@ -53,36 +55,36 @@ public class RocketFuels extends ItemPackage { public static Item Ammonium_Nitrate_Dust; public static Item Formaldehyde_Catalyst; + public static ItemStack Formaldehyde_Catalyst_Stack; + + public RocketFuels() { + super(true); + } public static void createKerosene(){ - - - FluidStack fuelA = FluidUtils.getFluidStack("diesel", 300); - FluidStack fuelB = FluidUtils.getFluidStack("fuel", 300); - - + FluidStack fuelA = FluidUtils.getFluidStack("diesel", 3000); + FluidStack fuelB = FluidUtils.getFluidStack("fuel", 3000); if (fuelA != null){ //GT_Values.RA.addDistilleryRecipe(23, fuelA, FluidUtils.getFluidStack(Kerosene, 50), 200, 64, false); - GT_Values.RA.addDistilleryRecipe(CI.getNumberedCircuit(23), fuelA, FluidUtils.getFluidStack(Kerosene, 100), 200, 64, false); + GT_Values.RA.addDistilleryRecipe(CI.getNumberedCircuit(23), fuelA, FluidUtils.getFluidStack(Kerosene, 1800), 200, 64, false); } if (fuelA == null && fuelB != null){ //GT_Values.RA.addDistilleryRecipe(23, fuelB, FluidUtils.getFluidStack(Kerosene, 50), 200, 64, false); - GT_Values.RA.addDistilleryRecipe(CI.getNumberedCircuit(23), fuelB, FluidUtils.getFluidStack(Kerosene, 100), 200, 64, false); + GT_Values.RA.addDistilleryRecipe(CI.getNumberedCircuit(23), fuelB, FluidUtils.getFluidStack(Kerosene, 1800), 200, 64, false); } } public static void createRP1(){ - FluidStack fuelA = FluidUtils.getFluidStack(Kerosene, 100); + FluidStack fuelA = FluidUtils.getFluidStack(Kerosene, 1000); if (fuelA != null){ - //GT_Values.RA.addDistilleryRecipe(23, fuelA, FluidUtils.getFluidStack(RP1, 25), 400, 120, false); - GT_Values.RA.addDistilleryRecipe(CI.getNumberedCircuit(23), fuelA, FluidUtils.getFluidStack(RP1, 50), 400, 120, false); + GT_Values.RA.addDistilleryRecipe(CI.getNumberedCircuit(23), fuelA, FluidUtils.getFluidStack(RP1, 750), 20 * 40, 120, false); } } public static void createNitrogenTetroxide(){ - CORE.RA.addDehydratorRecipe( + /*CORE.RA.addDehydratorRecipe( new ItemStack[]{ ItemUtils.getItemStackOfAmountFromOreDict("dustCopper", 4) }, @@ -94,42 +96,78 @@ public class RocketFuels extends ItemPackage { }, new int[]{100, 50}, 20*16, - 500); + 500);*/ + + CORE.RA.addChemicalPlantRecipe( + new ItemStack[]{ + ItemUtils.getItemStackOfAmountFromOreDict("dustCopper", 16), + ItemUtils.getSimpleStack(GenericChem.mOrangeCatalyst, 0), + }, + new FluidStack[] { + FluidUtils.getFluidStack("nitricacid", 4000) + }, + new ItemStack[]{ + ItemUtils.getItemStackOfAmountFromOreDict("dustSmallAsh", 1), + ItemUtils.getItemStackOfAmountFromOreDict("dustSmallDarkAsh", 1), + ItemUtils.getItemStackOfAmountFromOreDict("dustTinyAsh", 1), + ItemUtils.getItemStackOfAmountFromOreDict("dustTinyDarkAsh", 1) + }, + new FluidStack[] { + FluidUtils.getFluidStack(Nitrogen_Tetroxide, 3000), + }, + new int[]{100, 100, 50, 50}, + 20*30, + MaterialUtils.getVoltageForTier(3), + 2); + + } - public static void createHydrazine(){ - GT_Values.RA.addChemicalRecipe( - ItemUtils.getItemStackOfAmountFromOreDict("cellAmmonia", 2), - CI.getNumberedCircuit(23), - FluidUtils.getFluidStack("fluid.hydrogenperoxide", 2000), - FluidUtils.getFluidStack(Hydrazine, 2000), - ItemUtils.getItemStackOfAmountFromOreDict("cellWater", 2), - 20*32); - - GT_Values.RA.addChemicalRecipe( - ItemUtils.getItemStackOfAmountFromOreDict("cellHydrogenPeroxide", 2), - CI.getNumberedCircuit(23), - FluidUtils.getFluidStack("ammonia", 2000), - FluidUtils.getFluidStack(Hydrazine, 2000), - ItemUtils.getItemStackOfAmountFromOreDict("cellWater", 2), - 20*32); + public static void createHydrazine(){ + + CORE.RA.addChemicalPlantRecipe( + new ItemStack[] { + CI.getNumberedCircuit(21) + }, + new FluidStack[] { + FluidUtils.getFluidStack("fluid.hydrogenperoxide", 2000), + FluidUtils.getFluidStack("ammonia", 2000), + }, + new ItemStack[] { + + }, + new FluidStack[] { + FluidUtils.getFluidStack(Hydrazine, 4000), + + }, + 20 * 30, + MaterialUtils.getVoltageForTier(2), + 1); + } public static void createMonomethylhydrazine(){ - CORE.RA.addDehydratorRecipe( + + CORE.RA.addChemicalPlantRecipe( new ItemStack[] { - ItemUtils.getItemStackOfAmountFromOreDict("cellHydrazine", 2), + CI.getNumberedCircuit(21), ItemUtils.getItemStackOfAmountFromOreDict("dustCarbon", 2) }, - FluidUtils.getFluidStack("hydrogen", 2000), - FluidUtils.getFluidStack(Monomethylhydrazine, 3000), + new FluidStack[] { + FluidUtils.getFluidStack("hydrogen", 2000), + FluidUtils.getFluidStack(Hydrazine, 2000), + }, new ItemStack[] { - CI.emptyCells(2) + + }, + new FluidStack[] { + FluidUtils.getFluidStack(Monomethylhydrazine, 4000), + }, - new int[] {10000}, - 20*48, - 240); + 20 * 48, + 240, + 2); } @@ -143,14 +181,26 @@ public class RocketFuels extends ItemPackage { CORE.RA.addAdvancedFreezerRecipe(new ItemStack[] {}, new FluidStack[] {FluidUtils.getFluidStack("hydrogen", 300)}, new FluidStack[] {FluidUtils.getFluidStack(Liquid_Hydrogen, 300)}, new ItemStack[] {}, new int[] {}, 20*4, 540, 0); } - private static void createHydratedAmmoniumNitrateSlurry() { - GT_Values.RA.addChemicalRecipe( - ItemUtils.getItemStackOfAmountFromOreDict("cellAmmonia", 8), - ItemUtils.getItemStackOfAmountFromOreDict("cellNitricAcid", 8), - null, - FluidUtils.getFluidStack(Hydrated_Ammonium_Nitrate_Slurry, 22*144), - null, - 48*16); + private static void createHydratedAmmoniumNitrateSlurry() { + + CORE.RA.addChemicalPlantRecipe( + new ItemStack[] { + CI.getNumberedBioCircuit(21), + }, + new FluidStack[] { + FluidUtils.getFluidStack("ammonia", 4000), + FluidUtils.getFluidStack("nitricacid", 4000), + }, + new ItemStack[] { + + }, + new FluidStack[] { + FluidUtils.getFluidStack(Hydrated_Ammonium_Nitrate_Slurry, 8000), + + }, + 20 * 60, + 120, + 1); } @@ -162,22 +212,32 @@ public class RocketFuels extends ItemPackage { new ItemStack[] {ItemUtils.getSimpleStack(Ammonium_Nitrate_Dust, 8)}, new int[] {10000}, 90*20, - 500); + 480); } - private static void createFormaldehyde() { - CORE.RA.addDehydratorRecipe( + private static void createFormaldehyde() { + + CORE.RA.addChemicalPlantRecipe( new ItemStack[] { - ItemUtils.getSimpleStack(Formaldehyde_Catalyst, 1), - ItemUtils.getItemStackOfAmountFromOreDict("cellOxygen", 16) + CI.getNumberedBioCircuit(21), + ItemUtils.getSimpleStack(Formaldehyde_Catalyst, 0), }, - FluidUtils.getFluidStack("methanol", 32000), - FluidUtils.getFluidStack(Formaldehyde, 8000), - new ItemStack[] {ItemUtils.getItemStackOfAmountFromOreDict("cellWater", 16)}, - new int[] {10000}, - 90*20, - 120); + new FluidStack[] { + FluidUtils.getFluidStack("oxygen", 16000), + FluidUtils.getFluidStack("methanol", 32000), + }, + new ItemStack[] { + + }, + new FluidStack[] { + FluidUtils.getFluidStack(Formaldehyde, 8000), + + }, + 20 * 90, + 120, + 1); + } private static void createFormaldehydeCatalyst() { @@ -194,15 +254,29 @@ public class RocketFuels extends ItemPackage { } - private static void createUnsymmetricalDimethylhydrazine() { - CORE.RA.addChemicalRecipe( - ItemUtils.getItemStackOfAmountFromOreDict("cellHydrazine", 2), - ItemUtils.getItemStackOfAmountFromOreDict("cellFormaldehyde", 2), - FluidUtils.getFluidStack("hydrogen", 4000), - FluidUtils.getFluidStack(Unsymmetrical_Dimethylhydrazine, 1000), - ItemUtils.getItemStackOfAmountFromOreDict("cellWater", 2), - ItemUtils.getItemStackOfAmountFromOreDict("cellEmpty", 2), - 20*60); + private static void createUnsymmetricalDimethylhydrazine() { + + CORE.RA.addChemicalPlantRecipe( + new ItemStack[] { + CI.getNumberedBioCircuit(21), + ItemUtils.getSimpleStack(Formaldehyde_Catalyst, 0), + }, + new FluidStack[] { + FluidUtils.getFluidStack("fluid.hydrazine", 2000), + FluidUtils.getFluidStack(Formaldehyde, 2000), + FluidUtils.getFluidStack("hydrogen", 4000), + }, + new ItemStack[] { + + }, + new FluidStack[] { + FluidUtils.getFluidStack(Unsymmetrical_Dimethylhydrazine, 2000), + FluidUtils.getWater(2000) + + }, + 20 * 60, + 120, + 2); } @@ -275,152 +349,93 @@ public class RocketFuels extends ItemPackage { private static void createRocketFuels() { - //Done - GT_Values.RA.addCentrifugeRecipe( - CI.getNumberedCircuit(23), - ItemUtils.getItemStackOfAmountFromOreDict("cellLiquidOxygen", 2), - FluidUtils.getFluidStack(RP1, 500), - FluidUtils.getFluidStack(RP1_Plus_Liquid_Oxygen, 100), - CI.emptyCells(2), - null, - null, - null, - null, - null, - new int[] {10000}, - 20*32, - 480); - - GT_Values.RA.addCentrifugeRecipe( - CI.getNumberedCircuit(23), - ItemUtils.getItemStackOfAmountFromOreDict("cellRP1", 1), - FluidUtils.getFluidStack(Liquid_Oxygen, 4000), - FluidUtils.getFluidStack(RP1_Plus_Liquid_Oxygen, 200), - CI.emptyCells(1), - null, - null, - null, - null, - null, - new int[] {10000}, - 20*64, - 480); - - GT_Values.RA.addCentrifugeRecipe( - CI.getNumberedCircuit(23), - ItemUtils.getItemStackOfAmountFromOreDict("cellNitrogenTetroxide", 2), - FluidUtils.getFluidStack(Unsymmetrical_Dimethylhydrazine, 2000), - FluidUtils.getFluidStack(Unsymmetrical_Dimethylhydrazine_Plus_Nitrogen_Tetroxide, 1750), - CI.emptyCells(2), - null, - null, - null, - null, - null, - new int[] {10000}, - 20*48, - 480); - - ItemStack aCell11dimethylhydrazine = ItemUtils.getItemStackOfAmountFromOreDict("cell1,1Dimethylhydrazine", 2); - if (ItemUtils.checkForInvalidItems(aCell11dimethylhydrazine)) { - GT_Values.RA.addCentrifugeRecipe( - CI.getNumberedCircuit(23), - aCell11dimethylhydrazine, - FluidUtils.getFluidStack(Nitrogen_Tetroxide, 2000), - FluidUtils.getFluidStack(Unsymmetrical_Dimethylhydrazine_Plus_Nitrogen_Tetroxide, 1750), - CI.emptyCells(2), - null, - null, - null, - null, - null, - new int[] {10000}, - 20*48, - 480); - } - else { - GT_Values.RA.addCentrifugeRecipe( - CI.getNumberedCircuit(23), - ItemUtils.getItemStackOfAmountFromOreDict("cellUnsymmetricalDimethylhydrazine", 2), - FluidUtils.getFluidStack(Nitrogen_Tetroxide, 2000), - FluidUtils.getFluidStack(Unsymmetrical_Dimethylhydrazine_Plus_Nitrogen_Tetroxide, 1750), - CI.emptyCells(2), - null, - null, - null, - null, - null, - new int[] {10000}, - 20*48, - 480); - } + // RP1_Plus_Liquid_Oxygen + CORE.RA.addChemicalPlantRecipe( + new ItemStack[] { + CI.getNumberedCircuit(1), + }, + new FluidStack[] { + FluidUtils.getFluidStack(Liquid_Oxygen, 2000), + FluidUtils.getFluidStack(RP1, 500), + }, + new ItemStack[] { + + }, + new FluidStack[] { + FluidUtils.getFluidStack(RP1_Plus_Liquid_Oxygen, 1500), + }, + 20 * 15, + 240, + 3); - GT_Values.RA.addCentrifugeRecipe( - CI.getNumberedCircuit(23), - ItemUtils.getItemStackOfAmountFromOreDict("cellHydrazine", 4), - FluidUtils.getFluidStack("methanol", 6000), - FluidUtils.getFluidStack(Dense_Hydrazine_Mix, 10000), - CI.emptyCells(4), - null, - null, - null, - null, - null, - new int[] {10000}, - 20*100, - 240); - - GT_Values.RA.addCentrifugeRecipe( - CI.getNumberedCircuit(23), - ItemUtils.getItemStackOfAmountFromOreDict("cellMethanol", 6), - FluidUtils.getFluidStack(Hydrazine, 4000), - FluidUtils.getFluidStack(Dense_Hydrazine_Mix, 10000), - CI.emptyCells(6), - null, - null, - null, - null, - null, - new int[] {10000}, - 20*100, - 240); - - GT_Values.RA.addCentrifugeRecipe( - CI.getNumberedCircuit(23), - ItemUtils.getItemStackOfAmountFromOreDict("cellNitricAcid", 1), - FluidUtils.getFluidStack(Monomethylhydrazine, 1000), - FluidUtils.getFluidStack(Monomethylhydrazine_Plus_Nitric_Acid, 2000), - CI.emptyCells(1), - null, - null, - null, - null, - null, - new int[] {10000}, - 20*32, - 240); - - GT_Values.RA.addCentrifugeRecipe( - CI.getNumberedCircuit(23), - ItemUtils.getItemStackOfAmountFromOreDict("cellMonomethylhydrazine", 1), - FluidUtils.getFluidStack("nitricacid", 1000), - FluidUtils.getFluidStack(Monomethylhydrazine_Plus_Nitric_Acid, 2000), - CI.emptyCells(1), - null, - null, - null, - null, - null, - new int[] {10000}, - 20*32, - 240); + + // Dense_Hydrazine_Mix + CORE.RA.addChemicalPlantRecipe( + new ItemStack[] { + CI.getNumberedCircuit(2), + }, + new FluidStack[] { + FluidUtils.getFluidStack(Hydrazine, 4000), + FluidUtils.getFluidStack("methanol", 6000), + }, + new ItemStack[] { + + }, + new FluidStack[] { + FluidUtils.getFluidStack(Dense_Hydrazine_Mix, 10000), + + }, + 20 * 30, + 240, + 3); + + + // Monomethylhydrazine_Plus_Nitric_Acid + CORE.RA.addChemicalPlantRecipe( + new ItemStack[] { + CI.getNumberedCircuit(3), + }, + new FluidStack[] { + FluidUtils.getFluidStack(Monomethylhydrazine, 1000), + FluidUtils.getFluidStack("nitricacid", 1000), + }, + new ItemStack[] { + + }, + new FluidStack[] { + FluidUtils.getFluidStack(Monomethylhydrazine_Plus_Nitric_Acid, 3000), + + }, + 20 * 45, + 480, + 3); + + + // Unsymmetrical_Dimethylhydrazine_Plus_Nitrogen_Tetroxide + CORE.RA.addChemicalPlantRecipe( + new ItemStack[] { + CI.getNumberedCircuit(4), + }, + new FluidStack[] { + FluidUtils.getFluidStack(Unsymmetrical_Dimethylhydrazine, 2000), + FluidUtils.getFluidStack(Nitrogen_Tetroxide, 2000), + }, + new ItemStack[] { + + }, + new FluidStack[] { + FluidUtils.getFluidStack(Unsymmetrical_Dimethylhydrazine_Plus_Nitrogen_Tetroxide, 4000), + + }, + 20 * 60, + 480, + 3); } @Override public String errorMessage() { - // TODO Auto-generated method stub return "Bad Rocket Fuel Science!"; } @@ -451,218 +466,9 @@ public class RocketFuels extends ItemPackage { } @Override - public boolean onLoadComplete(FMLLoadCompleteEvent event) { - - - if (MathUtils.randInt(1, 2) > 0) { - return false; - } - - - Materials aMaterial_Chloramine = MaterialUtils.getMaterial("Chloramine"); - Materials aMaterial_Dimethylamine = MaterialUtils.getMaterial("Dimethylamine"); - Materials aMaterial_DilutedHydrochloricAcid = MaterialUtils.getMaterial("DilutedHydrochloricAcid"); - Materials aMaterial_NitrogenDioxide = MaterialUtils.getMaterial("NitrogenDioxide"); - Materials aMaterial_DinitrogenTetroxide = MaterialUtils.getMaterial("DinitrogenTetroxide"); - Materials aMaterial_Dimethylhydrazine = MaterialUtils.getMaterial("Dimethylhydrazine"); - - Materials aMaterial_Oxygen = Materials.Oxygen; - Materials aMaterial_Water = Materials.Water; - Materials aMaterial_HypochlorousAcid = MaterialUtils.getMaterial("HypochlorousAcid"); - Materials aMaterial_Ammonia = MaterialUtils.getMaterial("Ammonia"); - Materials aMaterial_Methanol = MaterialUtils.getMaterial("Methanol"); - - if (aMaterial_Chloramine == null || aMaterial_Dimethylamine == null || aMaterial_DilutedHydrochloricAcid == null - || aMaterial_Dimethylhydrazine == null || aMaterial_NitrogenDioxide == null || aMaterial_DinitrogenTetroxide == null - || aMaterial_HypochlorousAcid == null || aMaterial_Ammonia == null || aMaterial_Methanol == null) { - return false; - } - - - MaterialHelper.getCells(aMaterial_Water, 1); - - ItemStack aCellEmpty = CI.emptyCells(1); - ItemStack aCellWater = MaterialHelper.getCells(aMaterial_Water, 1); - ItemStack aCellOxygen = MaterialHelper.getCells(aMaterial_Oxygen, 1); - ItemStack aCellChloramine = MaterialHelper.getCells(aMaterial_Chloramine, 1); - ItemStack aCellDimethylamine = MaterialHelper.getCells(aMaterial_Dimethylamine, 1); - ItemStack aCellDilutedHydrochloricAcid = MaterialHelper.getCells(aMaterial_DilutedHydrochloricAcid, 1); - ItemStack aCellNitrogenDioxide = MaterialHelper.getCells(aMaterial_NitrogenDioxide, 1); - ItemStack aCellDinitrogenTetroxide = MaterialHelper.getCells(aMaterial_DinitrogenTetroxide, 1); - ItemStack aCellDimethylhydrazine = MaterialHelper.getCells(aMaterial_Dimethylhydrazine, 1); - - - - - - - GT_Recipe aChemReactor_1 = new Recipe_GT( - true, //Optimise - new ItemStack[] {}, //I - new ItemStack[] {}, //O - null, //Special - new int[] {}, //Chance - new FluidStack[] {}, //I - new FluidStack[] {}, //O - 0, //Dura - 0, //Eu - 0); //Special - - GT_Recipe aChemReactor_2 = new Recipe_GT( - true, //Optimise - new ItemStack[] {}, //I - new ItemStack[] {}, //O - null, //Special - new int[] {}, //Chance - new FluidStack[] {}, //I - new FluidStack[] {}, //O - 0, //Dura - 0, //Eu - 0); //Special - - - - - GT_Recipe aChemReactor_Basic_1 = new Recipe_GT( - true, //Optimise - new ItemStack[] {}, //I - new ItemStack[] {}, //O - null, //Special - new int[] {}, //Chance - new FluidStack[] {}, //I - new FluidStack[] {}, //O - 0, //Dura - 0, //Eu - 0); //Special - - GT_Recipe aChemReactor_Basic_2 = new Recipe_GT( - true, //Optimise - new ItemStack[] {}, //I - new ItemStack[] {}, //O - null, //Special - new int[] {}, //Chance - new FluidStack[] {}, //I - new FluidStack[] {}, //O - 0, //Dura - 0, //Eu - 0); //Special - - GT_Recipe aChemReactor_Basic_3 = new Recipe_GT( - true, //Optimise - new ItemStack[] {}, //I - new ItemStack[] {}, //O - null, //Special - new int[] {}, //Chance - new FluidStack[] {}, //I - new FluidStack[] {}, //O - 0, //Dura - 0, //Eu - 0); //Special - - GT_Recipe aChemReactor_Basic_4 = new Recipe_GT( - true, //Optimise - new ItemStack[] {}, //I - new ItemStack[] {}, //O - null, //Special - new int[] {}, //Chance - new FluidStack[] {}, //I - new FluidStack[] {}, //O - 0, //Dura - 0, //Eu - 0); //Special - - - - - - - - - - - - - - GT_Recipe aChemReactor_Adv_1 = new Recipe_GT( - true, //Optimise - new ItemStack[] {}, //I - new ItemStack[] {}, //O - null, //Special - new int[] {}, //Chance - new FluidStack[] {}, //I - new FluidStack[] {}, //O - 0, //Dura - 0, //Eu - 0); //Special - - GT_Recipe aChemReactor_Adv_2 = new Recipe_GT( - true, //Optimise - new ItemStack[] {}, //I - new ItemStack[] {}, //O - null, //Special - new int[] {}, //Chance - new FluidStack[] {}, //I - new FluidStack[] {}, //O - 0, //Dura - 0, //Eu - 0); //Special - - - - - //RecipeUtils.removeGtRecipe(aChemReactor_Basic_1, GT_Recipe.GT_Recipe_Map.sChemicalRecipes); - //RecipeUtils.removeGtRecipe(aChemReactor_Basic_1, GT_Recipe.GT_Recipe_Map.sChemicalRecipes); - //RecipeUtils.removeGtRecipe(aChemReactor_Basic_1, GT_Recipe.GT_Recipe_Map.sChemicalRecipes); - //RecipeUtils.removeGtRecipe(aChemReactor_Basic_1, GT_Recipe.GT_Recipe_Map.sChemicalRecipes); - - - - - - - /* GT_Values.RA.addChemicalRecipe( Materials.Chloramine.getCells(2), GT_Utility.getIntegratedCircuit(1), Materials.Dimethylamine.getGas(5000), Materials.Dimethylhydrazine.getFluid(6000), Materials.DilutedHydrochloricAcid.getCells(1), Materials.Empty.getCells(1), 960, 480); - GT_Values.RA.addChemicalRecipe( Materials.Dimethylamine.getCells(5), GT_Utility.getIntegratedCircuit(1), Materials.Chloramine.getFluid(2000), Materials.Dimethylhydrazine.getFluid(6000), Materials.DilutedHydrochloricAcid.getCells(1), Materials.Empty.getCells(4), 960, 480); - GT_Values.RA.addChemicalRecipeForBasicMachineOnly(Materials.Chloramine.getCells(2), Materials.Empty.getCells(4), Materials.Dimethylamine.getGas(5000), Materials.DilutedHydrochloricAcid.getFluid(1000), Materials.Dimethylhydrazine.getCells(6), GT_Values.NI, 960, 480); - GT_Values.RA.addChemicalRecipeForBasicMachineOnly(Materials.Dimethylamine.getCells(5), Materials.Empty.getCells(1), Materials.Chloramine.getFluid(2000), Materials.DilutedHydrochloricAcid.getFluid(1000), Materials.Dimethylhydrazine.getCells(6), GT_Values.NI, 960, 480); - GT_Values.RA.addChemicalRecipeForBasicMachineOnly(Materials.Dimethylamine.getCells(5), Materials.Chloramine.getCells(2), Materials.Chloramine.getFluid(2000), Materials.DilutedHydrochloricAcid.getFluid(1000), Materials.Dimethylhydrazine.getCells(6), Materials.DilutedHydrochloricAcid.getCells(1), 960, 480); - GT_Values.RA.addMultiblockChemicalRecipe(new ItemStack[]{GT_Utility.getIntegratedCircuit(24)}, new FluidStack[]{Materials.HypochlorousAcid.getFluid(3000), Materials.Ammonia.getGas(8000), Materials.Methanol.getFluid(12000)}, new FluidStack[]{Materials.Dimethylhydrazine.getFluid(12000), Materials.DilutedHydrochloricAcid.getFluid(2000), Materials.Water.getFluid(9000)}, null, 1040, 480); - - GT_Values.RA.addChemicalRecipe(GT_Utility.getIntegratedCircuit(2), GT_Values.NI, Materials.NitrogenDioxide.getGas(1000), Materials.DinitrogenTetroxide.getGas(1000), GT_Values.NI, 640); - GT_Values.RA.addChemicalRecipe(Materials.NitrogenDioxide.getCells(1), GT_Utility.getIntegratedCircuit(2), GT_Values.NF, Materials.DinitrogenTetroxide.getGas(1000), Materials.Empty.getCells(1), 640); - GT_Values.RA.addChemicalRecipe(Materials.NitrogenDioxide.getCells(1), GT_Utility.getIntegratedCircuit(12), GT_Values.NF, GT_Values.NF, Materials.DinitrogenTetroxide.getCells(1), 640); - GT_Values.RA.addMultiblockChemicalRecipe(new ItemStack[]{GT_Utility.getIntegratedCircuit(23)}, new FluidStack[]{Materials.Ammonia.getGas(8000), Materials.Oxygen.getGas(7000)}, new FluidStack[]{Materials.DinitrogenTetroxide.getGas(6000), Materials.Water.getFluid(9000)}, null, 480, 30); - GT_Values.RA.addMultiblockChemicalRecipe(new ItemStack[]{GT_Utility.getIntegratedCircuit(23)}, new FluidStack[]{Materials.Nitrogen.getGas(2000), Materials.Hydrogen.getGas(6000), Materials.Oxygen.getGas(7000)}, new FluidStack[]{Materials.DinitrogenTetroxide.getGas(6000), Materials.Water.getFluid(9000)}, null, 1100, 480); - - GT_Values.RA.addMixerRecipe(Materials.Dimethylhydrazine.getCells(1), GT_Values.NI, GT_Values.NI, GT_Values.NI, Materials.DinitrogenTetroxide.getGas(1000), new FluidStack(ItemList.sRocketFuel, 2000), Materials.Empty.getCells(1), 60, 16); - GT_Values.RA.addMixerRecipe(Materials.DinitrogenTetroxide.getCells(1), GT_Values.NI, GT_Values.NI, GT_Values.NI, Materials.Dimethylhydrazine.getFluid(1000), new FluidStack(ItemList.sRocketFuel, 2000), Materials.Empty.getCells(1), 60, 16); - GT_Values.RA.addMixerRecipe(Materials.Dimethylhydrazine.getCells(2), GT_Values.NI, GT_Values.NI, GT_Values.NI, Materials.Oxygen.getGas(1000), new FluidStack(ItemList.sRocketFuel, 3000), Materials.Empty.getCells(2), 60, 16); - GT_Values.RA.addMixerRecipe(Materials.Oxygen.getCells(1), GT_Values.NI, GT_Values.NI, GT_Values.NI, Materials.Dimethylhydrazine.getFluid(2000), new FluidStack(ItemList.sRocketFuel, 3000), Materials.Empty.getCells(1), 60, 16); - - - */ - - - - - - - - - - //Get Rocket Fuel - - //Find recipes using default values - - //Remove - - //Rebake map - - return true; - }; - - @Override public void items() { Formaldehyde_Catalyst = ItemUtils.generateSpecialUseDusts("FormaldehydeCatalyst", "Formaldehyde Catalyst", "Fe16V1", Utils.rgbtoHexValue(25, 5, 25))[0]; + Formaldehyde_Catalyst_Stack = ItemUtils.getSimpleStack(Formaldehyde_Catalyst); } @Override @@ -674,7 +480,7 @@ public class RocketFuels extends ItemPackage { //Register default fluids Diesel = MaterialUtils.getMaterial("Fuel", "Diesel").getFluid(1).getFluid(); - + // 5.08 Compat if (!FluidUtils.doesFluidExist("liquid_heavy_oil")){ Oil_Heavy = FluidUtils.generateFluidNoPrefix("liquid_heavy_oil", "Heavy Oil", 200, new short[]{10, 10, 10, 100}); @@ -763,7 +569,7 @@ public class RocketFuels extends ItemPackage { } } - Formaldehyde = FluidUtils.generateFluidNonMolten("Formaldehyde", "Formaldehyde", -92, new short[]{150, 75, 150, 100}, null, null); + Formaldehyde = FluidUtils.generateFluidNonMolten("Formaldehyde", "Formaldehyde", 185, new short[]{150, 75, 150, 100}, null, null); Unsymmetrical_Dimethylhydrazine_Plus_Nitrogen_Tetroxide = FluidUtils.generateFluidNonMolten("RocketFuelMixA", "H8N4C2O4 Rocket Fuel", -185, new short[]{50, 220, 50, 100}, null, null); RP1_Plus_Liquid_Oxygen = FluidUtils.generateFluidNonMolten("RocketFuelMixB", "Rp-1 Rocket Fuel", -250, new short[]{250, 50, 50, 100}, null, null); @@ -773,6 +579,469 @@ public class RocketFuels extends ItemPackage { } + @Override + public boolean onLoadComplete(FMLLoadCompleteEvent event) { + + Logger.INFO("Trying to remove GT recipes for '1,1dimethylhydrazine' && 'rocket_fuel' if they exist."); + /*if (FluidRegistry.isFluidRegistered("1,1dimethylhydrazine")) { + + // Try Remove recipes for GT/EIO Rocket Fuel Cells + if (FluidRegistry.isFluidRegistered("rocket_fuel")) { + + // Old Recipe + if (MaterialUtils.doesMaterialExist("NitrogenDioxide")) { + GT_Recipe aOldRecipe = getHalfBakedRecipe( + new ItemStack[] { + ItemUtils.getItemStackOfAmountFromOreDict("cellNitrogenDioxide", 1), + ItemUtils.getItemStackOfAmountFromOreDict("cellHydrogen", 3), + }, + new FluidStack[] { + FluidUtils.getFluidStack("air", 500) + }, + 388); + boolean aDidRemove = removeRecipe(aOldRecipe, GT_Recipe_Map.sChemicalRecipes); + Logger.INFO("Removed Old Recipe for Rocket Fuel: "+aDidRemove); + } + + // Simple Recipes + if (MaterialUtils.doesMaterialExist("Ammonia") && MaterialUtils.doesMaterialExist("Methanol")) { + + GT_Recipe aSimpleRecipe1 = getHalfBakedRecipe( + new ItemStack[] { + ItemUtils.getItemStackOfAmountFromOreDict("cellAmmonia", 3), + ItemUtils.getItemStackOfAmountFromOreDict("cellMethanol", 4), + }, + new FluidStack[] { + FluidUtils.getFluidStack("chlorine", 1000) + }, + 480); + GT_Recipe aSimpleRecipe2 = getHalfBakedRecipe( + new ItemStack[] { + ItemUtils.getItemStackOfAmountFromOreDict("cellChlorine", 1), + ItemUtils.getItemStackOfAmountFromOreDict("cellMethanol", 4), + }, + new FluidStack[] { + FluidUtils.getFluidStack("ammonia", 3000) + }, + 480); + GT_Recipe aSimpleRecipe3 = getHalfBakedRecipe( + new ItemStack[] { + ItemUtils.getItemStackOfAmountFromOreDict("cellAmmonia", 3), + ItemUtils.getItemStackOfAmountFromOreDict("cellChlorine", 1), + }, + new FluidStack[] { + FluidUtils.getFluidStack("methanol", 4000) + }, + 480); + + boolean aDidRemove1 = removeRecipe(aSimpleRecipe1, GT_Recipe_Map.sChemicalRecipes); + boolean aDidRemove2 = removeRecipe(aSimpleRecipe2, GT_Recipe_Map.sChemicalRecipes); + boolean aDidRemove3 = removeRecipe(aSimpleRecipe3, GT_Recipe_Map.sChemicalRecipes); + Logger.INFO("Removed Simple Recipe 1 for Rocket Fuel: "+aDidRemove1); + Logger.INFO("Removed Simple Recipe 2 for Rocket Fuel: "+aDidRemove2); + Logger.INFO("Removed Simple Recipe 3 for Rocket Fuel: "+aDidRemove3); + } + + + // Complex Recipes I + if (MaterialUtils.doesMaterialExist("Dimethylhydrazine") && MaterialUtils.doesMaterialExist("DinitrogenTetroxide")) { + + GT_Recipe aAdvRecipe1 = getHalfBakedRecipe( + new ItemStack[] { + ItemUtils.getItemStackOfAmountFromOreDict("cellDimethylhydrazine", 1), + }, + new FluidStack[] { + FluidUtils.getFluidStack("dinitrogentetroxide", 1000) + }, + 16); + GT_Recipe aAdvRecipe2 = getHalfBakedRecipe( + new ItemStack[] { + ItemUtils.getItemStackOfAmountFromOreDict("cellDinitrogenTetroxide", 1), + }, + new FluidStack[] { + FluidUtils.getFluidStack("dimethylhydrazine", 1000) + }, + 16); + + GT_Recipe aAdvRecipe3 = getHalfBakedRecipe( + new ItemStack[] { + ItemUtils.getItemStackOfAmountFromOreDict("cellDimethylhydrazine", 2), + }, + new FluidStack[] { + FluidUtils.getFluidStack("oxygen", 1000) + }, + 16); + GT_Recipe aAdvRecipe4 = getHalfBakedRecipe( + new ItemStack[] { + ItemUtils.getItemStackOfAmountFromOreDict("cellOxygen", 1), + }, + new FluidStack[] { + FluidUtils.getFluidStack("dimethylhydrazine", 2000) + }, + 16); + + boolean aDidRemove1 = removeRecipe(aAdvRecipe1, GT_Recipe_Map.sMixerRecipes); + boolean aDidRemove2 = removeRecipe(aAdvRecipe2, GT_Recipe_Map.sMixerRecipes); + boolean aDidRemove3 = removeRecipe(aAdvRecipe3, GT_Recipe_Map.sMixerRecipes); + boolean aDidRemove4 = removeRecipe(aAdvRecipe4, GT_Recipe_Map.sMixerRecipes); + Logger.INFO("Removed Complex Recipe 1 for Rocket Fuel: "+aDidRemove1); + Logger.INFO("Removed Complex Recipe 2 for Rocket Fuel: "+aDidRemove2); + Logger.INFO("Removed Complex Recipe 3 for Rocket Fuel: "+aDidRemove3); + Logger.INFO("Removed Complex Recipe 4 for Rocket Fuel: "+aDidRemove4); + } + } + + + // Complex Recipes II + if (MaterialUtils.doesMaterialExist("Dimethylhydrazine")) { + + GT_Recipe aAdvRecipe1 = getHalfBakedRecipe( + new ItemStack[] { + ItemUtils.getItemStackOfAmountFromOreDict("cellDimethylhydrazine", 2), + }, + new FluidStack[] { + FluidUtils.getFluidStack("oxygen", 1000) + }, + 16); + GT_Recipe aAdvRecipe2 = getHalfBakedRecipe( + new ItemStack[] { + ItemUtils.getItemStackOfAmountFromOreDict("cellOxygen", 1), + }, + new FluidStack[] { + FluidUtils.getFluidStack("dimethylhydrazine", 2000) + }, + 16); + + boolean aDidRemove1 = removeRecipe(aAdvRecipe1, GT_Recipe_Map.sMixerRecipes); + boolean aDidRemove2 = removeRecipe(aAdvRecipe2, GT_Recipe_Map.sMixerRecipes); + Logger.INFO("Removed Complex Recipe 5 for Rocket Fuel: "+aDidRemove1); + Logger.INFO("Removed Complex Recipe 6 for Rocket Fuel: "+aDidRemove2); + } + + if (MaterialUtils.doesMaterialExist("Chloramine") && MaterialUtils.doesMaterialExist("Dimethylamine")) { + GT_Recipe aSimpleRecipe1 = getHalfBakedRecipe( + new ItemStack[] { + ItemUtils.getItemStackOfAmountFromOreDict("cellChloramine", 2), + GT_Utility.getIntegratedCircuit(1) + }, + new FluidStack[] { + FluidUtils.getFluidStack("dimethylamine", 5000) + }, + 480); + GT_Recipe aSimpleRecipe2 = getHalfBakedRecipe( + new ItemStack[] { + ItemUtils.getItemStackOfAmountFromOreDict("cellDimethylamine", 5), + GT_Utility.getIntegratedCircuit(1) + }, + new FluidStack[] { + FluidUtils.getFluidStack("chloramine", 2000) + }, + 16); + + + + GT_Recipe aAdvRecipe1 = getHalfBakedRecipe( + new ItemStack[] { + ItemUtils.getItemStackOfAmountFromOreDict("cellChloramine", 2), + CI.emptyCells(4) + }, + new FluidStack[] { + FluidUtils.getFluidStack("dimethylamine", 5000) + }, + 480); + GT_Recipe aAdvRecipe2 = getHalfBakedRecipe( + new ItemStack[] { + ItemUtils.getItemStackOfAmountFromOreDict("cellDimethylamine", 5), + CI.emptyCells(1) + }, + new FluidStack[] { + FluidUtils.getFluidStack("chloramine", 2000) + }, + 16); + GT_Recipe aAdvRecipe3 = getHalfBakedRecipe( + new ItemStack[] { + ItemUtils.getItemStackOfAmountFromOreDict("cellChloramine", 2), + ItemUtils.getItemStackOfAmountFromOreDict("cellDimethylamine", 5), + }, + new FluidStack[] { + FluidUtils.getFluidStack("chloramine", 2000) + }, + 480); + + boolean aDidRemove1 = removeRecipe(aSimpleRecipe1, GT_Recipe_Map.sChemicalRecipes); + boolean aDidRemove2 = removeRecipe(aSimpleRecipe2, GT_Recipe_Map.sChemicalRecipes); + boolean aDidRemove3 = removeRecipe(aAdvRecipe1, GT_Recipe_Map.sChemicalRecipes); + boolean aDidRemove4 = removeRecipe(aAdvRecipe2, GT_Recipe_Map.sChemicalRecipes); + boolean aDidRemove5 = removeRecipe(aAdvRecipe3, GT_Recipe_Map.sChemicalRecipes); + Logger.INFO("Removed Complex Recipe 1 for 1,1dimethylhydrazine: "+aDidRemove1); + Logger.INFO("Removed Complex Recipe 2 for 1,1dimethylhydrazine: "+aDidRemove2); + Logger.INFO("Removed Complex Recipe 3 for 1,1dimethylhydrazine: "+aDidRemove3); + Logger.INFO("Removed Complex Recipe 4 for 1,1dimethylhydrazine: "+aDidRemove4); + Logger.INFO("Removed Complex Recipe 5 for 1,1dimethylhydrazine: "+aDidRemove5); + + } + + if (MaterialUtils.doesMaterialExist("Chloramine") && MaterialUtils.doesMaterialExist("Dimethylamine")) { + GT_Recipe aSimpleRecipe1 = getHalfBakedRecipe( + new ItemStack[] { + ItemUtils.getItemStackOfAmountFromOreDict("cellChloramine", 1), + GT_Utility.getIntegratedCircuit(1) + }, + new FluidStack[] { + FluidUtils.getFluidStack("dimethylamine", 1000) + }, + 480); + GT_Recipe aSimpleRecipe2 = getHalfBakedRecipe( + new ItemStack[] { + ItemUtils.getItemStackOfAmountFromOreDict("cellDimethylamine", 1), + GT_Utility.getIntegratedCircuit(1) + }, + new FluidStack[] { + FluidUtils.getFluidStack("chloramine", 1000) + }, + 16); + + + + GT_Recipe aAdvRecipe1 = getHalfBakedRecipe( + new ItemStack[] { + ItemUtils.getItemStackOfAmountFromOreDict("cellChloramine", 1), + GT_Utility.getIntegratedCircuit(11) + }, + new FluidStack[] { + FluidUtils.getFluidStack("dimethylamine", 1000) + }, + 480); + GT_Recipe aAdvRecipe2 = getHalfBakedRecipe( + new ItemStack[] { + ItemUtils.getItemStackOfAmountFromOreDict("cellDimethylamine", 1), + GT_Utility.getIntegratedCircuit(11) + }, + new FluidStack[] { + FluidUtils.getFluidStack("chloramine", 1000) + }, + 16); + + boolean aDidRemove1 = removeRecipe(aSimpleRecipe1, GT_Recipe_Map.sChemicalRecipes); + boolean aDidRemove2 = removeRecipe(aSimpleRecipe2, GT_Recipe_Map.sChemicalRecipes); + boolean aDidRemove3 = removeRecipe(aAdvRecipe1, GT_Recipe_Map.sChemicalRecipes); + boolean aDidRemove4 = removeRecipe(aAdvRecipe2, GT_Recipe_Map.sChemicalRecipes); + Logger.INFO("Removed Complex Recipe 5 for 1,1dimethylhydrazine: "+aDidRemove1); + Logger.INFO("Removed Complex Recipe 6 for 1,1dimethylhydrazine: "+aDidRemove2); + Logger.INFO("Removed Complex Recipe 7 for 1,1dimethylhydrazine: "+aDidRemove3); + Logger.INFO("Removed Complex Recipe 8 for 1,1dimethylhydrazine: "+aDidRemove4); + + } + + if (MaterialUtils.doesMaterialExist("HypochlorousAcid") && MaterialUtils.doesMaterialExist("Ammonia") && MaterialUtils.doesMaterialExist("Methanol")) { + + GT_Recipe aAdvRecipe1 = getHalfBakedRecipe( + new ItemStack[] { + GT_Utility.getIntegratedCircuit(24), + }, + new FluidStack[] { + FluidUtils.getFluidStack("hypochlorousacid", 3000), + FluidUtils.getFluidStack("ammonia", 8000), + FluidUtils.getFluidStack("methanol", 12000) + }, + 480); + + GT_Recipe aAdvRecipe2 = getHalfBakedRecipe( + new ItemStack[] { + GT_Utility.getIntegratedCircuit(24), + }, + new FluidStack[] { + FluidUtils.getFluidStack("hypochlorousacid", 1000), + FluidUtils.getFluidStack("ammonia", 1000), + FluidUtils.getFluidStack("methanol", 2000) + }, + 480); + + boolean aDidRemove1 = removeRecipe(aAdvRecipe1, StaticFields59.getLargeChemicalReactorRecipeMap()); + boolean aDidRemove2 = removeRecipe(aAdvRecipe2, StaticFields59.getLargeChemicalReactorRecipeMap()); + Logger.INFO("Removed Complex Recipe 9 for 1,1dimethylhydrazine: "+aDidRemove1); + Logger.INFO("Removed Complex Recipe 10 for 1,1dimethylhydrazine: "+aDidRemove2); + + + } + }*/ + + // Try Butcher recipes manually + + //1,1Dimethylhydrazine + if (FluidRegistry.isFluidRegistered("1,1dimethylhydrazine")) { + Logger.INFO("Making sure all Chemical Reactor recipes for 1,1dimethylhydrazine have been removed."); + AutoMap<GT_Recipe> aToRemoveSingle = new AutoMap<GT_Recipe>(); + ItemStack aUnsymCell = ItemUtils.getItemStackOfAmountFromOreDict("cell1,1Dimethylhydrazine", 1); + FluidStack aUnsymFluid = FluidUtils.getFluidStack("1,1dimethylhydrazine", 1); + recipe : for (GT_Recipe aRecipeSingleBlock : GT_Recipe_Map.sChemicalRecipes.mRecipeList) { + if (aRecipeSingleBlock != null && aRecipeSingleBlock.mEnabled) { + if (aRecipeSingleBlock.mOutputs != null && aRecipeSingleBlock.mOutputs.length > 0) { + for (ItemStack aOutputItem : aRecipeSingleBlock.mOutputs) { + ItemStack aTemp = aOutputItem.copy(); + aTemp.stackSize = 1; + if (GT_Utility.areStacksEqual(aTemp, aUnsymCell)) { + aToRemoveSingle.add(aRecipeSingleBlock); + continue recipe; + } + } + } + if (aRecipeSingleBlock.mFluidOutputs != null && aRecipeSingleBlock.mFluidOutputs.length > 0) { + for (FluidStack aOutput : aRecipeSingleBlock.mFluidOutputs) { + if (GT_Utility.areFluidsEqual(aOutput, aUnsymFluid)) { + aToRemoveSingle.add(aRecipeSingleBlock); + continue recipe; + } + } + } + } + } + // Handle Multi Also + AutoMap<GT_Recipe> aToRemoveMulti = new AutoMap<GT_Recipe>(); + recipe : for (GT_Recipe aRecipeSingleBlock : StaticFields59.getLargeChemicalReactorRecipeMap().mRecipeList) { + if (aRecipeSingleBlock != null && aRecipeSingleBlock.mEnabled) { + if (aRecipeSingleBlock.mOutputs != null && aRecipeSingleBlock.mOutputs.length > 0) { + for (ItemStack aOutputItem : aRecipeSingleBlock.mOutputs) { + ItemStack aTemp = aOutputItem.copy(); + aTemp.stackSize = 1; + if (GT_Utility.areStacksEqual(aTemp, aUnsymCell)) { + aToRemoveMulti.add(aRecipeSingleBlock); + continue recipe; + } + } + } + if (aRecipeSingleBlock.mFluidOutputs != null && aRecipeSingleBlock.mFluidOutputs.length > 0) { + for (FluidStack aOutput : aRecipeSingleBlock.mFluidOutputs) { + if (GT_Utility.areFluidsEqual(aOutput, aUnsymFluid)) { + aToRemoveMulti.add(aRecipeSingleBlock); + continue recipe; + } + } + } + } + } + if (!aToRemoveSingle.isEmpty()) { + Logger.INFO("Found "+aToRemoveSingle.size()+" single block recipes, removing by force."); + for (GT_Recipe remove : aToRemoveSingle) { + GT_Recipe_Map.sChemicalRecipes.mRecipeList.remove(remove); + } + } + if (!aToRemoveMulti.isEmpty()) { + Logger.INFO("Found "+aToRemoveSingle.size()+" multiblock recipes, removing by force."); + for (GT_Recipe remove : aToRemoveMulti) { + StaticFields59.getLargeChemicalReactorRecipeMap().mRecipeList.remove(remove); + } + } + } + + + if (FluidRegistry.isFluidRegistered("rocket_fuel")) { + Logger.INFO("Making sure all Mixer recipes for rocket_fuel have been removed."); + AutoMap<GT_Recipe> aToRemoveSingle = new AutoMap<GT_Recipe>(); + FluidStack aRocketFluid = FluidUtils.getFluidStack("rocket_fuel", 1); + recipe : for (GT_Recipe aRecipeSingleBlock : GT_Recipe_Map.sMixerRecipes.mRecipeList) { + if (aRecipeSingleBlock != null && aRecipeSingleBlock.mEnabled) { + if (aRecipeSingleBlock.mFluidOutputs != null && aRecipeSingleBlock.mFluidOutputs.length > 0) { + for (FluidStack aOutput : aRecipeSingleBlock.mFluidOutputs) { + if (GT_Utility.areFluidsEqual(aOutput, aRocketFluid)) { + aToRemoveSingle.add(aRecipeSingleBlock); + continue recipe; + } + } + } + } + } + if (!aToRemoveSingle.isEmpty()) { + Logger.INFO("Found "+aToRemoveSingle.size()+" recipes, removing by force."); + for (GT_Recipe remove : aToRemoveSingle) { + GT_Recipe_Map.sMixerRecipes.mRecipeList.remove(remove); + } + aToRemoveSingle.clear(); + } + + Logger.INFO("Making sure all Chemical Reactor recipes for rocket_fuel have been removed."); + recipe : for (GT_Recipe aRecipeSingleBlock : GT_Recipe_Map.sChemicalRecipes.mRecipeList) { + if (aRecipeSingleBlock != null && aRecipeSingleBlock.mEnabled) { + if (aRecipeSingleBlock.mFluidOutputs != null && aRecipeSingleBlock.mFluidOutputs.length > 0) { + for (FluidStack aOutput : aRecipeSingleBlock.mFluidOutputs) { + if (GT_Utility.areFluidsEqual(aOutput, aRocketFluid)) { + aToRemoveSingle.add(aRecipeSingleBlock); + continue recipe; + } + } + } + } + } + // Handle Multi Also + AutoMap<GT_Recipe> aToRemoveMulti = new AutoMap<GT_Recipe>(); + recipe : for (GT_Recipe aRecipeSingleBlock : StaticFields59.getLargeChemicalReactorRecipeMap().mRecipeList) { + if (aRecipeSingleBlock != null && aRecipeSingleBlock.mEnabled) { + if (aRecipeSingleBlock.mFluidOutputs != null && aRecipeSingleBlock.mFluidOutputs.length > 0) { + for (FluidStack aOutput : aRecipeSingleBlock.mFluidOutputs) { + if (GT_Utility.areFluidsEqual(aOutput, aRocketFluid)) { + aToRemoveMulti.add(aRecipeSingleBlock); + continue recipe; + } + } + } + } + } + if (!aToRemoveSingle.isEmpty()) { + Logger.INFO("Found "+aToRemoveSingle.size()+" single block recipes, removing by force."); + for (GT_Recipe remove : aToRemoveSingle) { + GT_Recipe_Map.sChemicalRecipes.mRecipeList.remove(remove); + } + } + if (!aToRemoveMulti.isEmpty()) { + Logger.INFO("Found "+aToRemoveSingle.size()+" multiblock recipes, removing by force."); + for (GT_Recipe remove : aToRemoveMulti) { + StaticFields59.getLargeChemicalReactorRecipeMap().mRecipeList.remove(remove); + } + } + + } + + + + Logger.INFO("Finished clean-up of GT Rocket Fuel Recipes."); + return true; + } + + private static Recipe_GT getHalfBakedRecipe(ItemStack[] aInputs, FluidStack[] aFluidInputs, int aEU) { + return new Recipe_GT(false, aInputs, null, null, null, aFluidInputs, null, 0, aEU, 0); + + } + + public static boolean removeRecipe(GT_Recipe aRecipe, GT_Recipe_Map aMap) { + if (aMap != GT_Recipe_Map.sChemicalRecipes) { + GT_Recipe aFoundRecipe = aMap.findRecipe(null, false, true, aRecipe.mEUt, aRecipe.mFluidInputs, aRecipe.mInputs); + boolean aSingle = false; + if (aFoundRecipe != null) { + Logger.INFO("Found Single Block Recipe, removing."); + aSingle = aMap.mRecipeList.remove(aFoundRecipe); + Logger.INFO("Success? "+aSingle); + } + return aSingle; + } + else { + GT_Recipe aFoundRecipe = aMap.findRecipe(null, false, true, aRecipe.mEUt, aRecipe.mFluidInputs, aRecipe.mInputs); + GT_Recipe aFoundRecipe2 = StaticFields59.getLargeChemicalReactorRecipeMap().findRecipe(null, false, true, aRecipe.mEUt, aRecipe.mFluidInputs, aRecipe.mInputs); + boolean aSingle = false; + boolean aMulti = false; + if (aFoundRecipe != null) { + Logger.INFO("Found Single Block Recipe, removing."); + aSingle = GT_Recipe_Map.sChemicalRecipes.mRecipeList.remove(aFoundRecipe); + Logger.INFO("Success? "+aSingle); + } + if (aFoundRecipe2 != null) { + Logger.INFO("Found Multiblock Recipe, removing."); + aMulti = StaticFields59.getLargeChemicalReactorRecipeMap().mRecipeList.remove(aFoundRecipe2); + Logger.INFO("Success? "+aSingle); + } + return aSingle && aMulti; + } + } + } diff --git a/src/Java/gtPlusPlus/core/item/chemistry/general/ItemGenericChemBase.java b/src/Java/gtPlusPlus/core/item/chemistry/general/ItemGenericChemBase.java index 208fecd57c..7fb5f207f6 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 = 7; + final private int aMetaSize = 9; /* * 0 - Red Metal Catalyst //FeCu @@ -29,7 +29,8 @@ public class ItemGenericChemBase extends Item { * 4 - Purple Metal Catalyst //IrIdium Ruthenium * 5 - Brown Metal Catalyst //NiAl * 6 - Pink Metal Catalyst //PtRh - * + * 7 - Alumina Grinding Ball + * 8 - Soapstone Grinding Ball */ public ItemGenericChemBase() { diff --git a/src/Java/gtPlusPlus/core/item/food/BaseItemMetaFood.java b/src/Java/gtPlusPlus/core/item/food/BaseItemMetaFood.java new file mode 100644 index 0000000000..94d5a8e80f --- /dev/null +++ b/src/Java/gtPlusPlus/core/item/food/BaseItemMetaFood.java @@ -0,0 +1,431 @@ +package gtPlusPlus.core.item.food; + +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; + +import cpw.mods.fml.common.registry.GameRegistry; +import gtPlusPlus.api.objects.data.AutoMap; +import gtPlusPlus.core.creative.AddToCreativeTab; +import gtPlusPlus.core.item.ModItems; +import gtPlusPlus.core.lib.CORE; +import gtPlusPlus.core.util.math.MathUtils; +import gtPlusPlus.core.util.minecraft.EntityUtils; +import gtPlusPlus.core.util.minecraft.ItemUtils; +import net.minecraft.client.renderer.texture.IIconRegister; +import net.minecraft.creativetab.CreativeTabs; +import net.minecraft.entity.Entity; +import net.minecraft.entity.player.EntityPlayer; +import net.minecraft.item.EnumRarity; +import net.minecraft.item.Item; +import net.minecraft.item.ItemFood; +import net.minecraft.item.ItemStack; +import net.minecraft.potion.Potion; +import net.minecraft.potion.PotionEffect; +import net.minecraft.util.IIcon; +import net.minecraft.world.World; + +public class BaseItemMetaFood extends ItemFood { + + private static final HashMap<Integer, IIcon> mIconMap = new HashMap<Integer, IIcon>(); + private static int mTotalMetaItems = 0; + + /* + * 0 - Raw Human Meat + * 1 - Cooked Human Meat + * 2 - Raw Horse Meat + * 3 - Cooked Horse Meat + * 4 - Raw Wolf Meat + * 5 - Cooked Wolf Meat + * 6 - Raw Ocelot Meat + * 7 - Cooked Ocelot Meat + * 8 - Blaze Flesh + */ + + //listAllmeatraw + //listAllmeatcooked + + public static void registerMetaFoods() { + registerNewMetaFood(0, "I wouldn't eat this unless I was starving", 2, 0, 64, getPotionEffectPackage(new EffectWeaknessModerate(80), new EffectSlownessModerate(80)), getOreDictNamesAsArrayList("listAllmeatraw")); + registerNewMetaFood(1, "Doesn't look any better cooked", 4, 1, 64, getPotionEffectPackage(new EffectWeaknessBasic(50), new EffectSlownessBasic(50)), getOreDictNamesAsArrayList("listAllmeatcooked")); + registerNewMetaFood(2, "", 2, 0, 64, getPotionEffectPackage(new EffectWeaknessBasic(30), new EffectSlownessBasic(30)), getOreDictNamesAsArrayList("listAllmeatraw")); + registerNewMetaFood(3, "", 4, 1, 64, getOreDictNamesAsArrayList("listAllmeatcooked")); + registerNewMetaFood(4, "", 2, 0, 64, getPotionEffectPackage(new EffectWeaknessBasic(25), new EffectSlownessBasic(30)), getOreDictNamesAsArrayList("listAllmeatraw")); + registerNewMetaFood(5, "", 4, 1, 64, getOreDictNamesAsArrayList("listAllmeatcooked")); + registerNewMetaFood(6, "", 2, 0, 64, getPotionEffectPackage(new EffectWeaknessBasic(30), new EffectSlownessBasic(25)), getOreDictNamesAsArrayList("listAllmeatraw")); + registerNewMetaFood(7, "", 4, 1, 64, getOreDictNamesAsArrayList("listAllmeatcooked")); + registerNewMetaFood(8, "Warm to the touch", EnumRarity.uncommon, 4, 1, 64, new AutoMap<PotionEffectPackage>(), new setOnFire(), getOreDictNamesAsArrayList("listAllmeatcooked")); + } + + private static final HashMap<Integer, Integer> mMaxStackSizeMap = new HashMap<Integer, Integer>(); + private static final HashMap<Integer, String> mTooltipMap = new HashMap<Integer, String>(); + private static final HashMap<Integer, EnumRarity> mRarityMap = new HashMap<Integer, EnumRarity>(); + private static final HashMap<Integer, Integer> mHealAmountMap = new HashMap<Integer, Integer>(); + private static final HashMap<Integer, Float> mSaturationAmountMap = new HashMap<Integer, Float>(); + private static final HashMap<Integer, AutoMap<PotionEffectPackage>> mPotionEffectsMap = new HashMap<Integer, AutoMap<PotionEffectPackage>>(); + private static final HashMap<Integer, Boolean> mHasSpecialBehaviourMap = new HashMap<Integer, Boolean>(); + private static final HashMap<Integer, SpecialFoodBehaviour> mSpecialBehaviourMap = new HashMap<Integer, SpecialFoodBehaviour>(); + private static final HashMap<Integer, ArrayList<String>> mOreDictNames = new HashMap<Integer, ArrayList<String>>(); + + + public static void registerNewMetaFood(final int aMetaID, String aTooltip, final int aHealAmount, final float aSaturationModifier, final int aMaxStacksize) { + registerNewMetaFood(aMetaID, aTooltip, EnumRarity.common, aHealAmount, aSaturationModifier, aMaxStacksize, new AutoMap<PotionEffectPackage>(), null, new ArrayList<String>()); + } + + public static void registerNewMetaFood(final int aMetaID, String aTooltip, final int aHealAmount, final float aSaturationModifier, final int aMaxStacksize, final ArrayList<String> aOreDictNames) { + registerNewMetaFood(aMetaID, aTooltip, EnumRarity.common, aHealAmount, aSaturationModifier, aMaxStacksize, new AutoMap<PotionEffectPackage>(), null, aOreDictNames); + } + + + public static void registerNewMetaFood(final int aMetaID, String aTooltip, final int aHealAmount, final float aSaturationModifier, final int aMaxStacksize, final AutoMap<PotionEffectPackage> aPotionEffects) { + registerNewMetaFood(aMetaID, aTooltip, EnumRarity.common, aHealAmount, aSaturationModifier, aMaxStacksize, new AutoMap<PotionEffectPackage>(), null, new ArrayList<String>()); + } + + public static void registerNewMetaFood(final int aMetaID, String aTooltip, final int aHealAmount, final float aSaturationModifier, final int aMaxStacksize, final AutoMap<PotionEffectPackage> aPotionEffects, final ArrayList<String> aOreDictNames) { + registerNewMetaFood(aMetaID, aTooltip, EnumRarity.common, aHealAmount, aSaturationModifier, aMaxStacksize, aPotionEffects, null, aOreDictNames); + } + + public static void registerNewMetaFood(final int aMetaID, String aTooltip, EnumRarity aRarity, final int aHealAmount, final float aSaturationModifier, final int aMaxStacksize, final AutoMap<PotionEffectPackage> aPotionEffects, final SpecialFoodBehaviour aSpecialBehaviour) { + registerNewMetaFood(aMetaID, aTooltip, EnumRarity.common, aHealAmount, aSaturationModifier, aMaxStacksize, aPotionEffects, null, new ArrayList<String>()); + } + + public static void registerNewMetaFood(final int aMetaID, String aTooltip, EnumRarity aRarity, final int aHealAmount, final float aSaturationModifier, final int aMaxStacksize, final AutoMap<PotionEffectPackage> aPotionEffects, final SpecialFoodBehaviour aSpecialBehaviour, final ArrayList<String> aOreDictNames) { + mTotalMetaItems++; + mMaxStackSizeMap.put(aMetaID, aMaxStacksize); + mTooltipMap.put(aMetaID, aTooltip); + mRarityMap.put(aMetaID, aRarity); + mHealAmountMap.put(aMetaID, aHealAmount); + mSaturationAmountMap.put(aMetaID, aSaturationModifier); + mPotionEffectsMap.put(aMetaID, aPotionEffects); + mHasSpecialBehaviourMap.put(aMetaID, (aSpecialBehaviour != null)); + if (aSpecialBehaviour != null) { + mSpecialBehaviourMap.put(aMetaID, aSpecialBehaviour); + } + mOreDictNames.put(aMetaID, aOreDictNames); + } + + public static void registerFoodsToOreDict() { + for (int aMetaID=0; aMetaID < mTotalMetaItems; aMetaID++) { + ArrayList<String> aOreDictNames = mOreDictNames.get(aMetaID); + if (aOreDictNames != null && !aOreDictNames.isEmpty()) { + ItemStack aFoodStack = ItemUtils.simpleMetaStack(ModItems.itemMetaFood, aMetaID, 1); + for (String aOreName : aOreDictNames) { + ItemUtils.addItemToOreDictionary(aFoodStack, aOreName); + } + } + } + } + + + public BaseItemMetaFood() { + super(0, 0, false); + this.setHasSubtypes(true); + this.setNoRepair(); + this.setMaxStackSize(64); + this.setMaxDamage(0); + this.setUnlocalizedName("BasicMetaFood"); + this.setCreativeTab(AddToCreativeTab.tabMisc); + GameRegistry.registerItem(this, this.getUnlocalizedName()); + BaseItemMetaFood.registerMetaFoods(); + } + + private static final int getMetaKey(ItemStack aStack) { + return aStack.getItemDamage(); + } + + // Heal Amount + public int func_150905_g(ItemStack aStack) { + return mHealAmountMap.get(getMetaKey(aStack)); + } + + // Saturation Amount + public float func_150906_h(ItemStack aStack) { + return mSaturationAmountMap.get(getMetaKey(aStack)); + } + + // Whether wolves like this food, sadly doesn't support meta items + public boolean isWolfsFavoriteMeat() { + return false; + } + + @Override + protected void onFoodEaten(final ItemStack aStack, final World aWorld, final EntityPlayer aPlayer) { + //super.onFoodEaten(stack, world, player); + AutoMap<PotionEffectPackage> aPotionEffects = mPotionEffectsMap.get(getMetaKey(aStack)); + if (!aWorld.isRemote && aPotionEffects != null && aPotionEffects.size() > 0) { + for (PotionEffectPackage aFoodEffect : aPotionEffects) { + if (MathUtils.randInt(0, 100) <= aFoodEffect.getChance() || aFoodEffect.getChance() == 100) { + PotionEffect aEffect = aFoodEffect.getEffect(); + if (aEffect != null && aEffect.getPotionID() > 0) { + aPlayer.addPotionEffect(new PotionEffect(aEffect.getPotionID(), aEffect.getDuration() * 20, aEffect.getAmplifier(), aEffect.getIsAmbient())); + } + } + } + } + + boolean aHasEpcialBehaviour = mHasSpecialBehaviourMap.get(getMetaKey(aStack)); + if (!aWorld.isRemote && aHasEpcialBehaviour) { + SpecialFoodBehaviour aBehaviour = mSpecialBehaviourMap.get(getMetaKey(aStack)); + if (aBehaviour != null) { + aBehaviour.doBehaviour(aPlayer); + } + } + } + + @Override + public ItemStack onEaten(ItemStack aStack, World aWorld, EntityPlayer aPlayer) { + return super.onEaten(aStack, aWorld, aPlayer); + } + + + @Override + public int getItemStackLimit(ItemStack aStack) { + return mMaxStackSizeMap.get(getMetaKey(aStack)); + } + + + @Override + public boolean isDamageable() { + return false; + } + + @Override + public boolean shouldRotateAroundWhenRendering() { + return super.shouldRotateAroundWhenRendering(); + } + + @Override + public void onUpdate(ItemStack p_77663_1_, World p_77663_2_, Entity p_77663_3_, int p_77663_4_, boolean p_77663_5_) { + super.onUpdate(p_77663_1_, p_77663_2_, p_77663_3_, p_77663_4_, p_77663_5_); + } + + @Override + public String getItemStackDisplayName(ItemStack aStack) { + return super.getItemStackDisplayName(aStack); + } + + @Override + public void addInformation(ItemStack aStack, EntityPlayer p_77624_2_, List aList, boolean p_77624_4_) { + try { + String aTooltip = mTooltipMap.get(getMetaKey(aStack)); + if (aTooltip != null && aTooltip.length() > 0) { + aList.add(aTooltip); + } + } + catch (Throwable t) { + t.printStackTrace(); + } + super.addInformation(aStack, p_77624_2_, aList, p_77624_4_); + } + + @Override + public EnumRarity getRarity(ItemStack aStack) { + return mRarityMap.get(getMetaKey(aStack)); + } + + @Override + public boolean requiresMultipleRenderPasses() { + return false; + } + + @Override + public void getSubItems(Item aItem, CreativeTabs p_150895_2_, List aList) { + for (int i=0;i<mIconMap.size();i++) { + aList.add(ItemUtils.simpleMetaStack(aItem, i, 1)); + } + } + + @Override + public boolean getIsRepairable(ItemStack p_82789_1_, ItemStack p_82789_2_) { + return false; + } + + @Override + public boolean isRepairable() { + return false; + } + + @Override + public boolean isBookEnchantable(ItemStack stack, ItemStack book) { + return false; + } + + @Override + public int getDisplayDamage(ItemStack stack) { + return stack.getItemDamage(); + } + + @Override + public boolean showDurabilityBar(ItemStack stack) { + return false; + } + + @Override + public int getItemEnchantability() { + return 0; + } + + @Override + public int getItemEnchantability(ItemStack stack) { + return 0; + } + + @Override + public void registerIcons(final IIconRegister u) { + for (int i=0;i<mTotalMetaItems;i++) { + String aPath = CORE.MODID + ":" + "food/MetaItem1/"+i; + mIconMap.put(i, u.registerIcon(aPath)); + } + } + + @Override + public IIcon getIconFromDamageForRenderPass(final int damage, final int pass) { + return mIconMap.get(damage); + } + + @Override + public IIcon getIconFromDamage(int damage) { + return mIconMap.get(damage); + } + + @Override + public IIcon getIcon(ItemStack aStack, int renderPass, EntityPlayer player, ItemStack usingItem, int useRemaining) { + return mIconMap.get(getMetaKey(aStack)); + } + + @Override + public IIcon getIcon(ItemStack aStack, int pass) { + return mIconMap.get(getMetaKey(aStack)); + } + + @Override + public String getUnlocalizedName(ItemStack stack) { + return super.getUnlocalizedName() + "." + stack.getItemDamage(); + } + + private static class PotionEffectPackage { + + private final PotionEffect mEffect; + private final int mChance; + + private PotionEffectPackage(PotionEffect aEffect, int aChance) { + mEffect = aEffect; + mChance = aChance; + } + + public PotionEffect getEffect() { + return this.mEffect; + } + + public int getChance() { + return this.mChance; + } + + } + + private static AutoMap<PotionEffectPackage> getPotionEffectPackage(PotionEffectPackage... aEffects){ + AutoMap<PotionEffectPackage> aPackage = new AutoMap<PotionEffectPackage>(); + if (aEffects != null && aEffects.length > 0) { + for (PotionEffectPackage aEffect : aEffects) { + aPackage.put(aEffect); + } + } + return aPackage; + } + + private static ArrayList<String> getOreDictNamesAsArrayList(String... aOreDictNames){ + ArrayList<String> aPackage = new ArrayList<String>(); + if (aOreDictNames != null && aOreDictNames.length > 0) { + for (String aEffect : aOreDictNames) { + aPackage.add(aEffect); + } + } + return aPackage; + } + + private static class EffectWeaknessBasic extends PotionEffectPackage { + + protected EffectWeaknessBasic(int aChance) { + super(new PotionEffect(Potion.weakness.getId(), 1, 20), aChance); + } + + } + + private static class EffectWeaknessModerate extends PotionEffectPackage { + + protected EffectWeaknessModerate(int aChance) { + super(new PotionEffect(Potion.weakness.getId(), 2, 40), aChance); + } + + } + + private static class EffectWeaknessSevere extends PotionEffectPackage { + + protected EffectWeaknessSevere(int aChance) { + super(new PotionEffect(Potion.weakness.getId(), 3, 60), aChance); + } + + } + + private static class EffectSlownessBasic extends PotionEffectPackage { + + protected EffectSlownessBasic(int aChance) { + super(new PotionEffect(Potion.moveSlowdown.getId(), 1, 20), aChance); + } + + } + + private static class EffectSlownessModerate extends PotionEffectPackage { + + protected EffectSlownessModerate(int aChance) { + super(new PotionEffect(Potion.moveSlowdown.getId(), 2, 40), aChance); + } + + } + + private static class EffectSlownessSevere extends PotionEffectPackage { + + protected EffectSlownessSevere(int aChance) { + super(new PotionEffect(Potion.moveSlowdown.getId(), 3, 60), aChance); + } + + } + + + + + private static abstract class SpecialFoodBehaviour { + + protected final int mChance; + + public SpecialFoodBehaviour(int aChance) { + mChance = aChance; + } + + public final void doBehaviour(EntityPlayer aPlayer) { + if (aPlayer != null && !aPlayer.worldObj.isRemote) { + if (MathUtils.randInt(0, 100) < mChance || mChance == 100) { + behaviour(aPlayer); + } + } + } + + protected abstract void behaviour(EntityPlayer aPlayer); + + } + + + private static class setOnFire extends SpecialFoodBehaviour { + + public setOnFire() { + super(100); + } + + @Override + public void behaviour(EntityPlayer aPlayer) { + EntityUtils.setEntityOnFire(aPlayer, 5); + } + + } + +}
\ No newline at end of file diff --git a/src/Java/gtPlusPlus/core/item/general/ItemGiantEgg.java b/src/Java/gtPlusPlus/core/item/general/ItemGiantEgg.java index 4abb84a33c..d98b27d163 100644 --- a/src/Java/gtPlusPlus/core/item/general/ItemGiantEgg.java +++ b/src/Java/gtPlusPlus/core/item/general/ItemGiantEgg.java @@ -4,6 +4,14 @@ import static gtPlusPlus.core.lib.CORE.RANDOM; import java.util.List; +import gregtech.api.enums.ItemList; +import gtPlusPlus.core.entity.item.ItemEntityGiantEgg; +import gtPlusPlus.core.item.base.BaseItemBurnable; +import gtPlusPlus.core.lib.CORE; +import gtPlusPlus.core.util.Utils; +import gtPlusPlus.core.util.math.MathUtils; +import gtPlusPlus.core.util.minecraft.ItemUtils; +import gtPlusPlus.core.util.minecraft.NBTUtils; import net.minecraft.creativetab.CreativeTabs; import net.minecraft.entity.Entity; import net.minecraft.entity.EntityList; @@ -14,16 +22,6 @@ import net.minecraft.util.MathHelper; import net.minecraft.util.StatCollector; import net.minecraft.world.World; -import gregtech.api.enums.ItemList; - -import gtPlusPlus.core.entity.item.ItemEntityGiantEgg; -import gtPlusPlus.core.item.base.BaseItemBurnable; -import gtPlusPlus.core.lib.CORE; -import gtPlusPlus.core.util.Utils; -import gtPlusPlus.core.util.math.MathUtils; -import gtPlusPlus.core.util.minecraft.ItemUtils; -import gtPlusPlus.core.util.minecraft.NBTUtils; - public class ItemGiantEgg extends BaseItemBurnable { public ItemGiantEgg(String unlocalizedName, String displayName, CreativeTabs creativeTab, int stackSize, int maxDmg, @@ -138,7 +136,7 @@ public class ItemGiantEgg extends BaseItemBurnable { if (CORE.MAIN_GREGTECH_5U_EXPERIMENTAL_FORK && Utils.getGregtechSubVersion() > 28) { - ItemList xl = Utils.getValueOfItemList("Circuit_Chip_Stemcell", ItemList.Circuit_Elite); + ItemList xl = ItemUtils.getValueOfItemList("Circuit_Chip_Stemcell", ItemList.Circuit_Elite); if (xl != null && xl.hasBeenSet()) { mCorrectStemCells = xl.get(1); } diff --git a/src/Java/gtPlusPlus/core/item/init/ItemsFoods.java b/src/Java/gtPlusPlus/core/item/init/ItemsFoods.java index 94ebb3ffcb..e5c403c503 100644 --- a/src/Java/gtPlusPlus/core/item/init/ItemsFoods.java +++ b/src/Java/gtPlusPlus/core/item/init/ItemsFoods.java @@ -1,15 +1,22 @@ package gtPlusPlus.core.item.init; -import net.minecraft.potion.Potion; -import net.minecraft.potion.PotionEffect; - import gregtech.api.util.GT_OreDictUnificator; - import gtPlusPlus.core.item.ModItems; import gtPlusPlus.core.item.base.foods.BaseItemFood; import gtPlusPlus.core.item.base.foods.BaseItemHotFood; +import gtPlusPlus.core.item.food.BaseItemMetaFood; import gtPlusPlus.core.lib.CORE; +import gtPlusPlus.core.util.minecraft.EntityUtils; import gtPlusPlus.core.util.minecraft.ItemUtils; +import gtPlusPlus.core.util.minecraft.RecipeUtils; +import net.minecraft.entity.monster.EntityBlaze; +import net.minecraft.entity.passive.EntityHorse; +import net.minecraft.entity.passive.EntityOcelot; +import net.minecraft.entity.passive.EntityVillager; +import net.minecraft.entity.passive.EntityWolf; +import net.minecraft.item.ItemStack; +import net.minecraft.potion.Potion; +import net.minecraft.potion.PotionEffect; public class ItemsFoods { @@ -40,6 +47,34 @@ public class ItemsFoods { ModItems.itemHotFoodCurriedSausages = new BaseItemHotFood("itemHotFoodCurriedSausages", 1, 0.5f, "Curried Sausages", 240, ModItems.itemFoodCurriedSausages); GT_OreDictUnificator.registerOre("foodHotCurriedSausages", ItemUtils.getItemStackFromFQRN(CORE.MODID+":itemHotFoodCurriedSausages", 1)); + ModItems.itemMetaFood = new BaseItemMetaFood(); + BaseItemMetaFood.registerFoodsToOreDict(); + addCookingRecipes(); + addFoodDropsToMobs(); + + } + + private static ItemStack getMetaFoodStack(int aID) { + return ItemUtils.simpleMetaStack(ModItems.itemMetaFood, aID, 1); + } + + private static void addCookingRecipes() { + + RecipeUtils.addSmeltingRecipe(getMetaFoodStack(0), getMetaFoodStack(1), 0.4F); + RecipeUtils.addSmeltingRecipe(getMetaFoodStack(2), getMetaFoodStack(3), 0.35F); + RecipeUtils.addSmeltingRecipe(getMetaFoodStack(4), getMetaFoodStack(5), 0.35F); + RecipeUtils.addSmeltingRecipe(getMetaFoodStack(6), getMetaFoodStack(7), 0.35F); + + } + + private static void addFoodDropsToMobs() { + + EntityUtils.registerDropsForMob(EntityVillager.class, getMetaFoodStack(0), 2, 1500); + EntityUtils.registerDropsForMob(EntityHorse.class, getMetaFoodStack(2), 4, 4000); + EntityUtils.registerDropsForMob(EntityWolf.class, getMetaFoodStack(4), 2, 4000); + EntityUtils.registerDropsForMob(EntityOcelot.class, getMetaFoodStack(6), 2, 4000); + EntityUtils.registerDropsForMob(EntityBlaze.class, getMetaFoodStack(8), 1, 500); + } } diff --git a/src/Java/gtPlusPlus/core/item/tool/misc/GregtechPump.java b/src/Java/gtPlusPlus/core/item/tool/misc/GregtechPump.java index a48573888e..e43dc8546b 100644 --- a/src/Java/gtPlusPlus/core/item/tool/misc/GregtechPump.java +++ b/src/Java/gtPlusPlus/core/item/tool/misc/GregtechPump.java @@ -19,7 +19,6 @@ import gregtech.api.interfaces.IItemBehaviour; import gregtech.api.interfaces.IItemContainer; import gregtech.api.interfaces.metatileentity.IMetaTileEntity; import gregtech.api.interfaces.tileentity.IGregTechTileEntity; -import gregtech.api.metatileentity.implementations.GT_MetaTileEntity_BasicMachine; import gregtech.api.metatileentity.implementations.GT_MetaTileEntity_BasicTank; import gregtech.api.objects.ItemData; import gregtech.api.util.GT_LanguageManager; @@ -200,7 +199,7 @@ public class GregtechPump extends Item implements ISpecialElectricItem, IElectri if (aOffsetMeta <= 3) { FluidStack f = getFluid(aStack); - aList.add("Can also drain any other standard fluid container block"); + aList.add("Cannot drain any other standard fluid container block"); aList.add("Cannot be emptied via RMB, use inside a tank with GUI"); aList.add(EnumChatFormatting.DARK_GRAY+"This is technically just a fancy fluid cell"); aList.add(EnumChatFormatting.BLUE + (f != null ? f.getLocalizedName() : "No Fluids Contained")); @@ -973,7 +972,8 @@ public class GregtechPump extends Item implements ISpecialElectricItem, IElectri } //Try support Standard Fluid Tanks too (May disable if dupes appear again) else if ((tTileEntity instanceof IFluidTank || tTileEntity instanceof IFluidHandler)) { - return this.drainIFluidTank(tTileEntity, aStack, aWorld, aPlayer, aX, aY, aZ); + //return this.drainIFluidTank(tTileEntity, aStack, aWorld, aPlayer, aX, aY, aZ); + return false; } } } diff --git a/src/Java/gtPlusPlus/core/lib/CORE.java b/src/Java/gtPlusPlus/core/lib/CORE.java index 34d7475df3..9e29a381e2 100644 --- a/src/Java/gtPlusPlus/core/lib/CORE.java +++ b/src/Java/gtPlusPlus/core/lib/CORE.java @@ -46,7 +46,6 @@ public class CORE { public static Configuration Config; public static boolean DEVENV = false; - public static boolean DEBUG = false; public static boolean NBT_PERSISTENCY_PATCH_APPLIED = false; //Only can be set in Dev, no config or setting elsewhere. public static final boolean LOAD_ALL_CONTENT = false;; @@ -55,7 +54,7 @@ public class CORE { public static final String name = "GT++"; public static final String MODID = "miscutils"; - public static final String VERSION = "1.7.03.45"; + public static final String VERSION = "1.7.05"; public static String MASTER_VERSION = NetworkUtils.getContentFromURL("https://raw.githubusercontent.com/draknyte1/GTplusplus/master/Recommended.txt").toLowerCase(); public static String USER_COUNTRY = GeoUtils.determineUsersCountry(); public static boolean isModUpToDate = Utils.isModUpToDate(); @@ -290,12 +289,18 @@ public class CORE { public static final String VERSION = "0.1"; } + public static final void crash() { + crash("Generic Crash"); + } + + public static final void crash(String aReason) { Logger.INFO("=========================================================="); Logger.INFO("[GT++ CRASH]"); Logger.INFO("=========================================================="); Logger.INFO("Oooops..."); Logger.INFO("This should only happy in a development environment or when something really bad happens."); + Logger.INFO("Reason: "+aReason); Logger.INFO("=========================================================="); Logger.INFO("Called from: "+ReflectionUtils.getMethodName(0)); Logger.INFO(ReflectionUtils.getMethodName(1)); diff --git a/src/Java/gtPlusPlus/core/material/Material.java b/src/Java/gtPlusPlus/core/material/Material.java index b5922dde53..7d49a8d635 100644 --- a/src/Java/gtPlusPlus/core/material/Material.java +++ b/src/Java/gtPlusPlus/core/material/Material.java @@ -24,6 +24,7 @@ import gtPlusPlus.core.util.math.MathUtils; import gtPlusPlus.core.util.minecraft.FluidUtils; import gtPlusPlus.core.util.minecraft.ItemUtils; import gtPlusPlus.core.util.minecraft.MaterialUtils; +import gtPlusPlus.xmod.gregtech.api.enums.CustomOrePrefix; import gtPlusPlus.xmod.thaumcraft.objects.wrapper.aspect.TC_Aspect_Wrapper; import gtPlusPlus.xmod.tinkers.material.BaseTinkersMaterial; import net.minecraft.block.Block; @@ -890,6 +891,9 @@ public class Material { public final ItemStack getDustImpure(final int stacksize){ return getComponentByPrefix(OrePrefixes.dustImpure, stacksize); } + public final ItemStack getMilled(final int stacksize){ + return getComponentByPrefix(CustomOrePrefix.milled.get(), stacksize); + } public final boolean hasSolidForm() { if (ItemUtils.checkForInvalidItems(new ItemStack[] {getDust(1), getBlock(1), getTinyDust(1), getSmallDust(1)})) { diff --git a/src/Java/gtPlusPlus/core/material/nuclear/NUCLIDE.java b/src/Java/gtPlusPlus/core/material/nuclear/NUCLIDE.java index d2e24b04a1..73751ac49d 100644 --- a/src/Java/gtPlusPlus/core/material/nuclear/NUCLIDE.java +++ b/src/Java/gtPlusPlus/core/material/nuclear/NUCLIDE.java @@ -70,8 +70,60 @@ public final class NUCLIDE { new MaterialStack(ELEMENT.getInstance().URANIUM235, 14) }); + // Secondary material is molten metal + public static final Material NAQ_FUEL_T1 = new Material( + "Naquadah Fuel", + MaterialState.PURE_LIQUID, //State + null, //Material Colour + -1, //Melting Point in C + -1, //Boiling Point in C + -1, //Protons + -1, + false, //Uses Blast furnace? + //Material Stacks with Percentage of required elements. + new MaterialStack[]{ + new MaterialStack(ELEMENT.getInstance().NAQUADAH, 2), + new MaterialStack(ELEMENT.getInstance().TANTALUM, 3) + }); + + // Secondary material is a plasma + public static final Material NAQ_FUEL_T2 = new Material( + "Enriched Naquadah Fuel", + MaterialState.PURE_LIQUID, //State + null, //Material Colour + -1, //Melting Point in C + -1, //Boiling Point in C + -1, //Protons + -1, + false, //Uses Blast furnace? + //Material Stacks with Percentage of required elements. + new MaterialStack[]{ + new MaterialStack(ELEMENT.getInstance().NAQUADAH_ENRICHED, 2), + new MaterialStack(ELEMENT.getInstance().TITANIUM, 3) + }); + + // Secondary material is a plasma + public static final Material NAQ_FUEL_T3 = new Material( + "Naquadria Fuel", + MaterialState.PURE_LIQUID, //State + null, //Material Colour + -1, //Melting Point in C + -1, //Boiling Point in C + -1, //Protons + -1, + false, //Uses Blast furnace? + //Material Stacks with Percentage of required elements. + new MaterialStack[]{ + new MaterialStack(ELEMENT.getInstance().NAQUADRIA, 2), + new MaterialStack(ELEMENT.getInstance().AMERICIUM, 3) + }); + + private static final NUCLIDE INSTANCE = new NUCLIDE(); - public static NUCLIDE getInstance(){return INSTANCE;} + + public static NUCLIDE getInstance(){ + return INSTANCE; + } } diff --git a/src/Java/gtPlusPlus/core/recipe/RECIPES_GREGTECH.java b/src/Java/gtPlusPlus/core/recipe/RECIPES_GREGTECH.java index c7bbe7c7cd..1561f4b475 100644 --- a/src/Java/gtPlusPlus/core/recipe/RECIPES_GREGTECH.java +++ b/src/Java/gtPlusPlus/core/recipe/RECIPES_GREGTECH.java @@ -11,7 +11,6 @@ import gregtech.api.enums.Materials; import gregtech.api.enums.OrePrefixes; import gregtech.api.util.GT_ModHandler; import gregtech.api.util.GT_OreDictUnificator; -import gregtech.api.util.GT_Utility; import gregtech.api.util.HotFuel; import gregtech.api.util.ThermalFuel; import gtPlusPlus.api.objects.Logger; @@ -40,7 +39,6 @@ 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; @@ -114,26 +112,99 @@ public class RECIPES_GREGTECH { private static void chemplantRecipes() { + //This is subsequently absorbed in water to form nitric acid and nitric oxide. + //3 NO2 (g) + H2O (l) → 2 HNO3 (aq) + NO (g) (ΔH = −117 kJ/mol) + //The nitric oxide is cycled back for reoxidation. Alternatively, if the last step is carried out in air: + //4 NO2 (g) + O2 (g) + 2 H2O (l) → 4 HNO3 (aq) + // 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);*/ + CORE.RA.addChemicalPlantRecipe( + new ItemStack[] { + CI.getNumberedBioCircuit(17), + CI.getPinkCatalyst(0), + }, + new FluidStack[] { + FluidUtils.getFluidStack(GenericChem.Nitrogen_Dioxide, 3000), + FluidUtils.getAir(7000) + }, + new ItemStack[] { + + }, + new FluidStack[] { + FluidUtils.getFluidStack("nitricacid", 4000), + FluidUtils.getWater(2000), + }, + 10 * 20, + 480, + 3); + + CORE.RA.addChemicalPlantRecipe( + new ItemStack[] { + CI.getNumberedBioCircuit(16), + CI.getPinkCatalyst(0), + }, + new FluidStack[] { + FluidUtils.getFluidStack(GenericChem.Nitrogen_Dioxide, 3000), + FluidUtils.getDistilledWater(5000) + }, + new ItemStack[] { + + }, + new FluidStack[] { + FluidUtils.getFluidStack("nitricacid", 2000), + FluidUtils.getFluidStack(GenericChem.Nitric_Oxide, 1500), + }, + 10 * 20, + 480, + 2); + + // Produce Boric Acid + CORE.RA.addChemicalPlantRecipe( + new ItemStack[] { + CI.getNumberedCircuit(21), + ItemUtils.getItemStackOfAmountFromOreDict("dustBorax", 4), + }, + new FluidStack[] { + FluidUtils.getFluidStack(GenericChem.HydrochloricAcid, 2000) + }, + new ItemStack[] { + ItemUtils.getItemStackOfAmountFromOreDict("dustSalt", 5), + }, + new FluidStack[] { + FluidUtils.getFluidStack("boricacid", 2000), + FluidUtils.getWater(5000) + + }, + 20 * 30, + MaterialUtils.getVoltageForTier(3), + 2); + // Produce Th232 + CORE.RA.addChemicalPlantRecipe( + new ItemStack[] { + CI.getNumberedCircuit(22), + ELEMENT.getInstance().THORIUM.getDust(16) + }, + new FluidStack[] { + FluidUtils.getDistilledWater(2000), + FluidUtils.getFluidStack("boricacid", 1500) + }, + new ItemStack[] { + ELEMENT.getInstance().THORIUM.getSmallDust(32), + ELEMENT.getInstance().THORIUM232.getDust(2), + ELEMENT.getInstance().THORIUM232.getSmallDust(2), + ELEMENT.getInstance().URANIUM232.getDust(1), + }, + new FluidStack[] { + + }, + new int[] { + 0, 0, 1000, 250 + }, + 20 * 300, + MaterialUtils.getVoltageForTier(4), + 3); + } private static void fluidheaterRecipes() { @@ -587,6 +658,16 @@ public class RECIPES_GREGTECH { 20 * 60 * 5, MaterialUtils.getVoltageForTier(5)); + // Distillus Upgrade Chip + GT_Values.RA.addLaserEngraverRecipe( + GregtechItemList.Laser_Lens_WoodsGlass.get(0), + ItemUtils.simpleMetaStack(AgriculturalChem.mBioCircuit, 20, 1), + GregtechItemList.Distillus_Upgrade_Chip.get(1), + 20 * 60 * 5, + MaterialUtils.getVoltageForTier(5)); + + + } @@ -1482,10 +1563,10 @@ public class RECIPES_GREGTECH { CORE.RA.addSixSlotAssemblingRecipe(new ItemStack[] {ItemUtils.getSimpleStack(Items.nether_star), ItemUtils.getItemStackOfAmountFromOreDict("plateTungstenSteel", 8), ItemUtils.getItemStackOfAmountFromOreDict("stickBlackSteel", 8)}, null, ItemUtils.getSimpleStack(ModBlocks.blockWitherGuard, 32), 30*20, 500); - ItemStack aFluidReg1 = Utils.getValueOfItemList("FluidRegulator_LV", ItemList.Pump_LV).get(1); - ItemStack aFluidReg2 = Utils.getValueOfItemList("FluidRegulator_MV", ItemList.Pump_MV).get(1); - ItemStack aFluidReg3 = Utils.getValueOfItemList("FluidRegulator_HV", ItemList.Pump_HV).get(1); - ItemStack aFluidReg4 = Utils.getValueOfItemList("FluidRegulator_EV", ItemList.Pump_EV).get(1); + ItemStack aFluidReg1 = ItemUtils.getValueOfItemList("FluidRegulator_LV", ItemList.Pump_LV).get(1); + ItemStack aFluidReg2 = ItemUtils.getValueOfItemList("FluidRegulator_MV", ItemList.Pump_MV).get(1); + ItemStack aFluidReg3 = ItemUtils.getValueOfItemList("FluidRegulator_HV", ItemList.Pump_HV).get(1); + ItemStack aFluidReg4 = ItemUtils.getValueOfItemList("FluidRegulator_EV", ItemList.Pump_EV).get(1); CORE.RA.addSixSlotAssemblingRecipe(new ItemStack[] { aFluidReg1, @@ -1807,13 +1888,6 @@ public class RECIPES_GREGTECH { private static void centrifugeRecipes() { - GT_Values.RA.addCentrifugeRecipe(ItemUtils.getItemStackOfAmountFromOreDict("dustThorium", 8), GT_Values.NI, - GT_Values.NF, GT_Values.NF, ELEMENT.getInstance().THORIUM232.getDust(2), - ItemUtils.getItemStackOfAmountFromOreDict("dustSmallThorium", 20), - ELEMENT.getInstance().URANIUM232.getDust(1), GT_Values.NI, GT_Values.NI, GT_Values.NI, - new int[] { 0, 0, 10 }, 500 * 20, 2000); - - //Process Used Fuel Rods for Krypton //Uranium diff --git a/src/Java/gtPlusPlus/core/recipe/RECIPES_Machines.java b/src/Java/gtPlusPlus/core/recipe/RECIPES_Machines.java index 2165f27ec7..ebc2c07a63 100644 --- a/src/Java/gtPlusPlus/core/recipe/RECIPES_Machines.java +++ b/src/Java/gtPlusPlus/core/recipe/RECIPES_Machines.java @@ -2,9 +2,14 @@ package gtPlusPlus.core.recipe; import static gtPlusPlus.core.lib.CORE.GTNH; +import codechicken.nei.api.API; import cpw.mods.fml.common.Loader; -import gregtech.api.enums.*; +import gregtech.api.enums.GT_Values; +import gregtech.api.enums.ItemList; +import gregtech.api.enums.Materials; +import gregtech.api.enums.OrePrefixes; import gregtech.api.util.GT_ModHandler; +import gregtech.common.items.GT_MetaGenerated_Tool_01; import gtPlusPlus.api.objects.Logger; import gtPlusPlus.core.block.ModBlocks; import gtPlusPlus.core.item.ModItems; @@ -15,16 +20,17 @@ import gtPlusPlus.core.material.ALLOY; import gtPlusPlus.core.material.ELEMENT; import gtPlusPlus.core.material.Material; import gtPlusPlus.core.recipe.common.CI; -import gtPlusPlus.core.util.Utils; -import gtPlusPlus.core.util.math.MathUtils; -import gtPlusPlus.core.util.minecraft.*; +import gtPlusPlus.core.util.minecraft.FluidUtils; +import gtPlusPlus.core.util.minecraft.ItemUtils; +import gtPlusPlus.core.util.minecraft.MaterialUtils; +import gtPlusPlus.core.util.minecraft.RecipeUtils; import gtPlusPlus.core.util.minecraft.gregtech.PollutionUtils; import gtPlusPlus.core.util.reflect.ReflectionUtils; import gtPlusPlus.everglades.dimension.Dimension_Everglades; import gtPlusPlus.xmod.gregtech.api.enums.GregtechItemList; -import gtPlusPlus.xmod.gregtech.common.Meta_GT_Proxy; import gtPlusPlus.xmod.gregtech.common.covers.CoverManager; import gtPlusPlus.xmod.gregtech.common.items.MetaCustomCoverItem; +import gtPlusPlus.xmod.gregtech.common.items.MetaGeneratedGregtechTools; import net.minecraft.block.Block; import net.minecraft.init.Blocks; import net.minecraft.init.Items; @@ -241,29 +247,29 @@ public class RECIPES_Machines { distillus(); algaeFarm(); chemPlant(); - + } private static void chemPlant() { - + CORE.RA.addSixSlotAssemblingRecipe( new ItemStack[] { - CI.getNumberedBioCircuit(19), - CI.getTieredGTPPMachineCasing(1, 6), - CI.getTieredComponentOfMaterial(Materials.Steel, OrePrefixes.gearGt, 6), - CI.getTieredComponentOfMaterial(Materials.Aluminium, OrePrefixes.plate, 32), - CI.getTieredComponentOfMaterial(Materials.CobaltBrass, OrePrefixes.dust, 16), - CI.getTieredComponent(OrePrefixes.frameGt, 2, 4), + CI.getNumberedBioCircuit(19), + CI.getTieredGTPPMachineCasing(1, 6), + CI.getTieredComponentOfMaterial(Materials.Steel, OrePrefixes.gearGt, 6), + CI.getTieredComponentOfMaterial(Materials.Aluminium, OrePrefixes.plate, 32), + CI.getTieredComponentOfMaterial(Materials.CobaltBrass, OrePrefixes.dust, 16), + CI.getTieredComponent(OrePrefixes.frameGt, 2, 4), }, ALLOY.STEEL.getFluid(2 * (144 * 4)), GregtechItemList.ChemicalPlant_Controller.get(1), 120 * 20, MaterialUtils.getVoltageForTier(2)); - + } private static void algaeFarm() { - + // Give the shitty algae a use :) CORE.RA.addDistilleryRecipe( ItemUtils.getSimpleStack(AgriculturalChem.mAlgaeBiosmass, 32), @@ -273,26 +279,26 @@ public class RECIPES_Machines { 20 * 15, 16, false); - + CORE.RA.addSixSlotAssemblingRecipe( new ItemStack[] { - CI.getNumberedBioCircuit(21), - CI.getTieredGTPPMachineCasing(0, 4), - CI.getTieredComponentOfMaterial(Materials.Iron, OrePrefixes.rod, 12), - CI.getTieredComponentOfMaterial(Materials.Wood, OrePrefixes.plate, 32), - CI.getTieredComponentOfMaterial(Materials.Bronze, OrePrefixes.bolt, 16), - CI.getTieredComponentOfMaterial(Materials.Redstone, OrePrefixes.dust, 32), + CI.getNumberedBioCircuit(21), + CI.getTieredGTPPMachineCasing(0, 4), + CI.getTieredComponentOfMaterial(Materials.Iron, OrePrefixes.rod, 12), + CI.getTieredComponentOfMaterial(Materials.Wood, OrePrefixes.plate, 32), + CI.getTieredComponentOfMaterial(Materials.Bronze, OrePrefixes.bolt, 16), + CI.getTieredComponentOfMaterial(Materials.Redstone, OrePrefixes.dust, 32), }, ALLOY.POTIN.getFluid(2 * (144 * 4)), GregtechItemList.AlgaeFarm_Controller.get(1), 60 * 20, MaterialUtils.getVoltageForTier(1)); - - + + } private static void distillus() { - + CORE.RA.addChemicalPlantRecipe( new ItemStack[] { CI.getNumberedBioCircuit(19), @@ -310,44 +316,44 @@ public class RECIPES_Machines { GregtechItemList.Machine_Adv_DistillationTower.get(1) }, new FluidStack[] { - + }, 20 * 600, MaterialUtils.getVoltageForTier(6), 3); - + } private static void chunkloaders() { - + ItemStack aOutputs[] = new ItemStack[] { GregtechItemList.GT_Chunkloader_HV.get(1L), GregtechItemList.GT_Chunkloader_IV.get(1L), GregtechItemList.GT_Chunkloader_ZPM.get(1L), }; - + int aIndex = 0; - + for (int i=3;i<8;i++) { if (i == 4 || i == 6) { continue; } CORE.RA.addSixSlotAssemblingRecipe( new ItemStack[] { - CI.getNumberedBioCircuit(21), - CI.getElectricPiston(i, 10), - CI.getFieldGenerator(i + 1, 6), - CI.getPlate(i, 16), - CI.getTransmissionComponent(i - 1, 8), - CI.getTieredComponent(OrePrefixes.cableGt08, i, 16) + CI.getNumberedBioCircuit(21), + CI.getElectricPiston(i, 10), + CI.getFieldGenerator(i + 1, 6), + CI.getPlate(i, 16), + CI.getTransmissionComponent(i - 1, 8), + CI.getTieredComponent(OrePrefixes.cableGt08, i, 16) }, ALLOY.EGLIN_STEEL.getFluid(i * (144 * 4)), aOutputs[aIndex++].copy(), 300 * 20, MaterialUtils.getVoltageForTier(i)); } - - + + } private static void overflowValveCovers() { @@ -359,25 +365,25 @@ public class RECIPES_Machines { GregtechItemList.Cover_Overflow_EV.get(1L), GregtechItemList.Cover_Overflow_IV.get(1L), }; - + for (int i=0;i<6;i++) { CORE.RA.addSixSlotAssemblingRecipe( new ItemStack[] { - CI.getNumberedBioCircuit(19), - CI.getElectricPump(i, 2), - CI.getElectricMotor(i, 2), - CI.getPlate(i, 4) + CI.getNumberedBioCircuit(19), + CI.getElectricPump(i, 2), + CI.getElectricMotor(i, 2), + CI.getPlate(i, 4) }, - FluidUtils.getWater(i * 1500), + FluidUtils.getWater((i+1) * 750), aOutputs[i].copy(), 20 * 20, MaterialUtils.getVoltageForTier(i)); } - + } private static void tieredMachineHulls() { - + GregtechItemList[] aHulls = new GregtechItemList[] { GregtechItemList.GTPP_Casing_ULV, GregtechItemList.GTPP_Casing_LV, @@ -390,7 +396,7 @@ public class RECIPES_Machines { GregtechItemList.GTPP_Casing_UV, GregtechItemList.GTPP_Casing_MAX }; - + for (int i=0;i<10;i++) { CORE.RA.addSixSlotAssemblingRecipe( new ItemStack[] { @@ -401,12 +407,12 @@ public class RECIPES_Machines { CI.getTieredComponent(OrePrefixes.cableGt02, i, 4), CI.getTieredComponent(OrePrefixes.circuit, i, 2) }, - CI.getAlternativeTieredFluid(i, 144 * i * 2), + CI.getAlternativeTieredFluid(i, 144 * (i+1) * 2), aHulls[i].get(1), 20 * 20, MaterialUtils.getVoltageForTier(i)); } - + } private static void initModItems(){ @@ -443,7 +449,7 @@ public class RECIPES_Machines { EV_MACHINE_Wiremill= ItemList.Machine_IV_Wiremill.get(1); HV_MACHINE_Macerator= ItemList.Machine_EV_Macerator.get(1); EV_MACHINE_Macerator= ItemList.Machine_IV_Macerator.get(1); - EV_MACHINE_MassFabricator= CORE.MAIN_GREGTECH_5U_EXPERIMENTAL_FORK ? gtPlusPlus.core.util.Utils.getValueOfItemList("Machine_LuV_Massfab", ItemList.Machine_IV_Massfab).get(1) : ItemList.Machine_IV_Massfab.get(1); + EV_MACHINE_MassFabricator= CORE.MAIN_GREGTECH_5U_EXPERIMENTAL_FORK ? ItemUtils.getValueOfItemList("Machine_LuV_Massfab", ItemList.Machine_IV_Massfab).get(1) : ItemList.Machine_IV_Massfab.get(1); EV_MACHINE_Centrifuge= ItemList.Machine_IV_Centrifuge.get(1); EV_MACHINE_Cutter = ItemList.Machine_IV_Cutter.get(1); EV_MACHINE_Extruder = ItemList.Machine_IV_Extruder.get(1); @@ -541,9 +547,9 @@ public class RECIPES_Machines { 20 * 30, 30); - ItemStack aFluidRegulator1 = ItemUtils.getItemListObject("FluidRegulator_MV", "Pump_HV", GTNH ? 4 : 2); - ItemStack aFluidRegulator2 = ItemUtils.getItemListObject("FluidRegulator_IV", "Pump_LuV", GTNH ? 4 : 2); - + ItemStack aFluidRegulator1 = ItemUtils.getValueOfItemList("FluidRegulator_MV",GTNH ? 4 : 2, ItemList.Electric_Pump_HV); + ItemStack aFluidRegulator2 = ItemUtils.getValueOfItemList("FluidRegulator_IV", GTNH ? 4 : 2, ItemUtils.getValueOfItemList("Electric_Pump_LuV", GTNH ? 8 : 4, ItemList.Electric_Pump_IV)); + //Poo Collector CORE.RA.addSixSlotAssemblingRecipe( new ItemStack[] { @@ -605,7 +611,7 @@ public class RECIPES_Machines { plateEnergeticAlloy, pipeLargeCopper, plateEnergeticAlloy, RECIPE_SteamCondenser); } - + //Steam Condenser if (LoadedMods.CoFHCore && CORE.ConfigSwitches.enableMachine_RF_Convetor){ @@ -900,25 +906,47 @@ public class RECIPES_Machines { } //TODO - //Semi-Fluid Generators - ItemStack mSemiFluidgen = ItemUtils.getItemStackFromFQRN("IC2:blockGenerator:7", 1); - mSemiFluidgen.setItemDamage(7); + //Semi-Fluid Generators + ItemStack[][] aSemiFluidInputs = new ItemStack[3][6]; + aSemiFluidInputs[0] = new ItemStack[]{ + CI.getNumberedBioCircuit(14), + CI.getTieredMachineHull(1, 1), + CI.getElectricPiston(1, GTNH ? 4 : 2), + CI.getTieredComponent(OrePrefixes.circuit, 1, GTNH ? 4 : 2), + CI.getPlate(1, GTNH ? 8 : 4), + CI.getGear(1, GTNH ? 4 : 2) + }; + aSemiFluidInputs[1] = new ItemStack[]{ + CI.getNumberedBioCircuit(14), + CI.getTieredMachineHull(2, 1), + CI.getElectricPiston(2, GTNH ? 4 : 2), + CI.getTieredComponent(OrePrefixes.circuit, 2, GTNH ? 4 : 2), + CI.getPlate(2, GTNH ? 8 : 4), + CI.getGear(2, GTNH ? 4 : 2) + }; + aSemiFluidInputs[2] = new ItemStack[]{ + CI.getNumberedBioCircuit(14), + CI.getTieredMachineHull(3, 1), + CI.getElectricPiston(3, GTNH ? 4 : 2), + CI.getTieredComponent(OrePrefixes.circuit, 3, GTNH ? 4 : 2), + CI.getPlate(3, GTNH ? 8 : 4), + CI.getGear(3, GTNH ? 4 : 2) + }; + FluidStack[] aSemiFluidFluidInputs = new FluidStack[] { + ALLOY.BRONZE.getFluid(144 * 8), + ALLOY.STEEL.getFluid(144 * 8), + ELEMENT.getInstance().ALUMINIUM.getFluid(144 * 8), + }; + //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++) { + ItemStack[] aSemifluids = new ItemStack[] {GregtechItemList.Generator_SemiFluid_LV.get(1), GregtechItemList.Generator_SemiFluid_MV.get(1), GregtechItemList.Generator_SemiFluid_HV.get(1)}; + for (int o=0;o<3;o++) { CORE.RA.addSixSlotAssemblingRecipe( - new ItemStack[] { - aSemifluids[o-1], - CI.getElectricPiston(o, GTNH ? 4 : 2), - CI.getElectricMotor(o, GTNH ? 2 : 1), - CI.getTieredComponent(OrePrefixes.circuit, o, GTNH ? 4 : 2), - CI.getPlate(o, GTNH ? 8 : 4), - CI.getGear(o-1, GTNH ? 4 : 2) - }, - CI.getAlternativeTieredFluid(o, 144 * 4), + aSemiFluidInputs[o], + aSemiFluidFluidInputs[o], aSemifluids[o], 20 * 30, - (int) GT_Values.V[o]); + MaterialUtils.getVoltageForTier(o+1)); } if (CORE.ConfigSwitches.enableMultiblock_AlloyBlastSmelter){ @@ -955,9 +983,9 @@ public class RECIPES_Machines { //Matter Fabricator CPU RecipeUtils.addShapedGregtechRecipe( - "plateDoubleQuantum", CI.circuitTier5, "plateDoubleQuantum", + CI.getDoublePlate(8, 1), CI.circuitTier5, CI.getPlate(8, 1), cableTier8, CI.machineCasing_LuV, cableTier8, - "plateDoubleQuantum", CI.circuitTier5, "plateDoubleQuantum", + CI.getPlate(8, 1), CI.circuitTier5, CI.getPlate(8, 1), RECIPE_IndustrialMatterFabController); //Matter Fabricator Frame Casing RecipeUtils.addShapedGregtechRecipe( @@ -967,9 +995,9 @@ public class RECIPES_Machines { RECIPE_IndustrialMatterFabFrame); //Matter Fabricator Coil RecipeUtils.addShapedGregtechRecipe( - "plateQuantum", "plateQuantum", "plateQuantum", + CI.getPlate(6, 1), CI.getPlate(7, 1), CI.getPlate(6, 1), "frameGtStellite", CI.machineCasing_UV, "frameGtStellite", - "plateQuantum", "plateQuantum", "plateQuantum", + CI.getPlate(6, 1), CI.getPlate(7, 1), CI.getPlate(6, 1), RECIPE_IndustrialMatterFabCoil); } @@ -1120,12 +1148,6 @@ public class RECIPES_Machines { aSimpleWasherTier += 2; aSlot++; } - - - - - - } if (CORE.ConfigSwitches.enableMachine_Pollution && PollutionUtils.isPollutionEnabled()){ @@ -1149,20 +1171,6 @@ public class RECIPES_Machines { CI.getTieredCircuit(1), CI.machineHull_LV, CI.getTieredCircuit(0), GregtechItemList.Pollution_Detector.get(1)); - //Air Intake Hatch - - - - ItemList FluidRegulator_IV = Utils.getValueOfItemList("FluidRegulator_IV", ItemList.Pump_IV); - ItemStack aTieredFluidRegulator = CORE.MAIN_GREGTECH_5U_EXPERIMENTAL_FORK ? FluidRegulator_IV.get(1) : ItemList.Pump_IV.get(1); - - - RecipeUtils.addShapedGregtechRecipe( - CI.component_Plate[6], ItemList.Casing_Grate.get(1), CI.component_Plate[6], - CI.component_Plate[6], aTieredFluidRegulator, CI.component_Plate[6], - CI.getTieredCircuit(4), ItemList.Hatch_Input_IV.get(1), CI.getTieredCircuit(4), - GregtechItemList.Hatch_Air_Intake.get(1)); - //ULV RecipeUtils.addShapedGregtechRecipe( CI.component_Plate[0], ItemUtils.simpleMetaStack(ModItems.itemAirFilter, 0, 1), CI.component_Plate[0], @@ -1267,6 +1275,15 @@ public class RECIPES_Machines { ); } + //Air Intake Hatch + ItemList FluidRegulator_IV = ItemUtils.getValueOfItemList("FluidRegulator_IV", ItemList.Pump_IV); + ItemStack aTieredFluidRegulator = CORE.MAIN_GREGTECH_5U_EXPERIMENTAL_FORK ? FluidRegulator_IV.get(1) : ItemList.Pump_IV.get(1); + RecipeUtils.addShapedGregtechRecipe( + CI.component_Plate[6], ItemList.Casing_Grate.get(1), CI.component_Plate[6], + CI.component_Plate[6], aTieredFluidRegulator, CI.component_Plate[6], + CI.getTieredCircuit(4), ItemList.Hatch_Input_IV.get(1), CI.getTieredCircuit(4), + GregtechItemList.Hatch_Air_Intake.get(1)); + if (CORE.ConfigSwitches.enableMultiblock_LiquidFluorideThoriumReactor){ //Thorium Reactor @@ -1342,15 +1359,6 @@ public class RECIPES_Machines { CI.craftingToolHammer_Hard, "frameGtHastelloyC276", CI.craftingToolWrench, CI.component_Plate[5], CI.getTieredMachineCasing(4), "ringInconel792", GregtechItemList.Casing_Refinery_Structural.get(Casing_Amount)); - - - - - - - - - } //Shelves @@ -1419,15 +1427,25 @@ public class RECIPES_Machines { RECIPE_CyclotronController, 60 * 20 * 5, MaterialUtils.getVoltageForTier(5)); + } + // Mazut + GT_ModHandler.addCraftingRecipe( + GregtechItemList.Controller_LargeSemifluidGenerator.get(1L), + CI.bitsd, + new Object[]{ + "PCP", + "EME", + "GWG", + 'M', ItemList.Hull_EV, + 'P', ItemList.Electric_Piston_EV, + 'E', ItemList.Electric_Pump_EV, + 'C', OrePrefixes.circuit.get(Materials.Data), + 'W', OrePrefixes.cableGt08.get(Materials.Electrum), + 'G', ALLOY.INCONEL_792.getGear(1) + }); - - - - - } - if (CORE.ConfigSwitches.enableMultiblock_PowerSubstation){ RecipeUtils.recipeBuilder( "screwTitanium", "plateIncoloy020", "screwTitanium", @@ -1475,8 +1493,7 @@ public class RECIPES_Machines { if (CORE.ConfigSwitches.enableMultiblock_LargeAutoCrafter) { ItemStack aCoreBlock = CORE.MAIN_GREGTECH_5U_EXPERIMENTAL_FORK - ? ItemList.valueOf("Block_IridiumTungstensteel").get(1, - ItemUtils.getItemStackOfAmountFromOreDict("blockOsmiridium", 1)) + ? ItemUtils.getValueOfItemList("Block_IridiumTungstensteel", 1, ItemUtils.getItemStackOfAmountFromOreDict("blockOsmiridium", 1)) : ItemUtils.getItemStackOfAmountFromOreDict("blockOsmiridium", 1); aCoreBlock.stackSize = GTNH ? 2 : 1; @@ -1622,7 +1639,7 @@ public class RECIPES_Machines { cell1 = CI.conveyorModule_EV; cell2 = CI.electricMotor_IV; ItemStack casingAmazon = GregtechItemList.Casing_AmazonWarehouse.get(1); - ItemStack aTieredUnboxinator = CORE.MAIN_GREGTECH_5U_EXPERIMENTAL_FORK ? ItemList.valueOf("Machine_LuV_Unboxinator").get(1, ItemList.Machine_IV_Unboxinator.get(1)) : ItemList.Machine_IV_Unboxinator.get(1); + ItemStack aTieredUnboxinator = CORE.MAIN_GREGTECH_5U_EXPERIMENTAL_FORK ? ItemUtils.getValueOfItemList("Machine_LuV_Unboxinator", 1, ItemList.Machine_IV_Unboxinator.get(1)) : ItemList.Machine_IV_Unboxinator.get(1); RecipeUtils.recipeBuilder( @@ -1768,7 +1785,7 @@ public class RECIPES_Machines { - ItemStack aDrillController = Utils.getValueOfItemList("OreDrill4", ItemList.Hull_UV).get(1); + ItemStack aDrillController = ItemUtils.getValueOfItemList("OreDrill4", ItemList.Hull_UV).get(1); //Drilling Platform CORE.RA.addSixSlotAssemblingRecipe( diff --git a/src/Java/gtPlusPlus/core/recipe/RECIPES_Old_Circuits.java b/src/Java/gtPlusPlus/core/recipe/RECIPES_Old_Circuits.java index 98ea687747..3ed2f5f168 100644 --- a/src/Java/gtPlusPlus/core/recipe/RECIPES_Old_Circuits.java +++ b/src/Java/gtPlusPlus/core/recipe/RECIPES_Old_Circuits.java @@ -1,24 +1,24 @@ package gtPlusPlus.core.recipe; import cpw.mods.fml.common.Loader; - -import net.minecraft.item.ItemStack; - -import gregtech.api.enums.*; +import gregtech.api.enums.GT_Values; +import gregtech.api.enums.ItemList; +import gregtech.api.enums.Materials; +import gregtech.api.enums.OreDictNames; +import gregtech.api.enums.OrePrefixes; +import gregtech.api.enums.SubTag; import gregtech.api.interfaces.IOreRecipeRegistrator; import gregtech.api.util.GT_ModHandler; import gregtech.api.util.GT_OreDictUnificator; import gregtech.api.util.GT_Utility; - -import codechicken.nei.api.API; import gtPlusPlus.api.objects.Logger; import gtPlusPlus.core.lib.CORE; -import gtPlusPlus.core.lib.LoadedMods; import gtPlusPlus.core.recipe.common.CI; import gtPlusPlus.core.util.Utils; import gtPlusPlus.core.util.minecraft.ItemUtils; import gtPlusPlus.core.util.minecraft.RecipeUtils; import gtPlusPlus.xmod.gregtech.api.enums.GregtechItemList; +import net.minecraft.item.ItemStack; public class RECIPES_Old_Circuits implements IOreRecipeRegistrator { public RECIPES_Old_Circuits() { @@ -445,7 +445,7 @@ public class RECIPES_Old_Circuits implements IOreRecipeRegistrator { for (String component : CircuitToHide){ try { - API.hideItem(Utils.getValueOfItemList(component, null).get(1L, new Object[0])); + ItemUtils.hideItemFromNEI(ItemUtils.getValueOfItemList(component, null).get(1L, new Object[0])); } catch (IllegalArgumentException I){ Logger.INFO("Could not find "+component+" in the Gregtech item list."); Logger.INFO("This is NOT an error, simply a notification."); diff --git a/src/Java/gtPlusPlus/core/recipe/common/CI.java b/src/Java/gtPlusPlus/core/recipe/common/CI.java index 1d3d386da3..d67a372572 100644 --- a/src/Java/gtPlusPlus/core/recipe/common/CI.java +++ b/src/Java/gtPlusPlus/core/recipe/common/CI.java @@ -9,7 +9,6 @@ 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; import gtPlusPlus.core.material.ELEMENT; import gtPlusPlus.core.material.Material; @@ -17,7 +16,6 @@ import gtPlusPlus.core.recipe.LOADER_Machine_Components; import gtPlusPlus.core.util.Utils; import gtPlusPlus.core.util.math.MathUtils; import gtPlusPlus.core.util.minecraft.ItemUtils; -import gtPlusPlus.xmod.eio.material.MaterialEIO; import gtPlusPlus.xmod.gregtech.api.enums.GregtechItemList; import gtPlusPlus.xmod.gregtech.common.StaticFields59; import ic2.core.Ic2Items; @@ -184,7 +182,7 @@ public class CI { public static ItemStack explosiveITNT; public static void preInit(){ - + //Tiered Components component_Plate = new String[]{ getTieredComponent(OrePrefixes.plate, 0), @@ -402,7 +400,7 @@ public class CI { return ItemList.Tool_DataOrb.get(1); } } - + public static ItemStack getDataStick(){ if (CORE.ConfigSwitches.enableOldGTcircuits && CORE.MAIN_GREGTECH_5U_EXPERIMENTAL_FORK && !CORE.GTNH){ return GregtechItemList.Old_Tool_DataStick.get(1); @@ -489,17 +487,7 @@ public class CI { public static void init() { //Set Explosives - try { - ItemList PowerderBarrel = Utils.getValueOfItemList("Block_Powderbarrel", null); - if (PowerderBarrel != null){ - explosivePowderKeg = PowerderBarrel.get(1).copy(); - } - else { - explosivePowderKeg = ItemUtils.getSimpleStack(Items.gunpowder).copy(); - } - } catch (java.lang.IllegalArgumentException Y) { - explosivePowderKeg = ItemUtils.getSimpleStack(Items.gunpowder).copy(); - } + explosivePowderKeg = ItemUtils.getValueOfItemList("Block_Powderbarrel", 1, ItemUtils.getSimpleStack(Items.gunpowder, 16)); explosiveTNT = ItemUtils.getSimpleStack(Blocks.tnt).copy(); explosiveITNT = Ic2Items.industrialTnt.copy(); @@ -540,13 +528,13 @@ public class CI { public static ItemStack emptyCells(int i) { return ItemUtils.getEmptyCell(i); } - - - + + + /* * */ - + private static final Material[] aMaterial_Main = new Material[] { ALLOY.POTIN, ALLOY.TUMBAGA, @@ -561,7 +549,7 @@ public class CI { ALLOY.QUANTUM, ELEMENT.STANDALONE.HYPOGEN }; - + private static final Material[] aMaterial_Secondary = new Material[] { ALLOY.STEEL, ALLOY.SILICON_CARBIDE, @@ -576,7 +564,7 @@ public class CI { ELEMENT.STANDALONE.CELESTIAL_TUNGSTEN, ELEMENT.STANDALONE.HYPOGEN }; - + private static final Material[] aMaterial_Tertiary = new Material[] { ELEMENT.getInstance().LEAD, ELEMENT.getInstance().ALUMINIUM, @@ -591,21 +579,21 @@ public class CI { ELEMENT.STANDALONE.CELESTIAL_TUNGSTEN, ELEMENT.STANDALONE.HYPOGEN }; - + private static final Materials[] aMaterial_Cables = new Materials[] { !CORE.GTNH ? Materials.Lead : Materials.Tin, - Materials.Cobalt, - Materials.AnnealedCopper, - Materials.Gold, - Materials.Titanium, - Materials.Nichrome, - Materials.Platinum, - Materials.YttriumBariumCuprate, - Materials.Naquadah, - Materials.Duranium, - Materials.Superconductor, + Materials.Cobalt, + Materials.AnnealedCopper, + Materials.Gold, + Materials.Titanium, + Materials.Nichrome, + Materials.Platinum, + Materials.YttriumBariumCuprate, + Materials.Naquadah, + Materials.Duranium, + Materials.Superconductor, }; - + private static final Materials[] aMaterial_Circuits = new Materials[] { Materials.Primitive, Materials.Basic, @@ -619,18 +607,18 @@ public class CI { Materials.Superconductor, Materials.Infinite, }; - + private static final Material[][] aMaster = new Material[][] {aMaterial_Main, aMaterial_Secondary, aMaterial_Tertiary}; - - + + public static FluidStack getTieredFluid(int aTier, int aAmount) { return getTieredFluid(aTier, aAmount, 0); } - + public static FluidStack getAlternativeTieredFluid(int aTier, int aAmount) { return getTieredFluid(aTier, aAmount, 1); } - + public static FluidStack getTertiaryTieredFluid(int aTier, int aAmount) { return getTieredFluid(aTier, aAmount, 2); } @@ -642,7 +630,7 @@ public class CI { if (a == null) { a = aMaster[aType][aTier].getFluid(aAmount); }*/ - + // Modern Handling FluidStack a = aMaster[aType][aTier].getFluid(aAmount); if (a == null) { @@ -654,7 +642,7 @@ public class CI { } return a; } - + public static ItemStack getEnergyCore(int aTier, int aAmount) { ItemStack[] aOutput = new ItemStack[] { ItemUtils.getItemStackFromFQRN("miscutils:item.itemBufferCore"+"1", 1), @@ -670,39 +658,43 @@ public class CI { }; return ItemUtils.getSimpleStack(aOutput[MathUtils.balance(aTier, 0, 9)], aAmount); } - + public static ItemStack getPlate(int aTier, int aAmount) { return getTieredComponent(OrePrefixes.plate, aTier, aAmount); } - + + public static ItemStack getDoublePlate(int aTier, int aAmount) { + return getTieredComponent(OrePrefixes.plateDouble, aTier, aAmount); + } + public static ItemStack getGear(int aTier, int aAmount) { return getTieredComponent(OrePrefixes.gearGt, aTier, aAmount); } - + public static ItemStack getIngot(int aTier, int aAmount) { return getTieredComponent(OrePrefixes.ingot, aTier, aAmount); } - + public static ItemStack getBolt(int aTier, int aAmount) { return getTieredComponent(OrePrefixes.bolt, aTier, aAmount); } - + public static ItemStack getTieredComponent(OrePrefixes aPrefix, int aTier, int aAmount) { aTier = Math.max(0, aTier); - + Material m = null; - - - - - - + + + + + + if (aPrefix == OrePrefixes.liquid) { int aMatID = (aTier == 0 || aTier == 2 || aTier == 5 || aTier == 8 ? 0 : (aTier == 1 || aTier == 3 || aTier == 6 || aTier == 9 ? 1 : 2)); ItemStack aCell = aMaster[aMatID][aTier].getCell(aAmount); return aCell; } - + if (aPrefix == OrePrefixes.circuit) { if (aTier == 4) { return ItemUtils.getSimpleStack(CI.getDataStick(), aAmount); @@ -736,19 +728,19 @@ public class CI { else { return ItemUtils.getOrePrefixStack(aPrefix, aMaterial_Cables[aTier], aAmount); } - - + + } if (aPrefix == OrePrefixes.wireGt01 || aPrefix == OrePrefixes.wireGt02 || aPrefix == OrePrefixes.wireGt04 || aPrefix == OrePrefixes.wireGt08 || aPrefix == OrePrefixes.wireGt12 || aPrefix == OrePrefixes.wireGt16) { return ItemUtils.getOrePrefixStack(aPrefix, aMaterial_Cables[aTier], aAmount); } if (aPrefix == OrePrefixes.pipeTiny || aPrefix == OrePrefixes.pipeSmall || aPrefix == OrePrefixes.pipe || aPrefix == OrePrefixes.pipeMedium || aPrefix == OrePrefixes.pipeLarge || aPrefix == OrePrefixes.pipeHuge) { - + if (aPrefix == OrePrefixes.pipe) { aPrefix = OrePrefixes.pipeMedium; } - + if (aTier == 0) { return ItemUtils.getOrePrefixStack(aPrefix, Materials.Lead, aAmount); } @@ -787,12 +779,10 @@ public class CI { } } - ItemStack aTempStack = null; - if (aPrefix == OrePrefixes.rod) { aPrefix = OrePrefixes.stick; } - + if (aPrefix == OrePrefixes.gear || aPrefix == OrePrefixes.gearGt) { m = aMaster[0][aTier]; } @@ -832,24 +822,24 @@ public class CI { else { m = aMaterial_Main[aTier]; } - + ItemStack aReturn = ItemUtils.getOrePrefixStack(aPrefix, m, aAmount); - + //If Invalid, Try First Material if (!ItemUtils.checkForInvalidItems(aReturn)) { m = aMaster[0][aTier]; aReturn = ItemUtils.getOrePrefixStack(aPrefix, m, aAmount); - + //If Invalid, Try Second Material if (!ItemUtils.checkForInvalidItems(aReturn)) { m = aMaster[1][aTier]; aReturn = ItemUtils.getOrePrefixStack(aPrefix, m, aAmount); - + //If Invalid, Try Third Material if (!ItemUtils.checkForInvalidItems(aReturn)) { m = aMaster[2][aTier]; aReturn = ItemUtils.getOrePrefixStack(aPrefix, m, aAmount); - + //All Invalid? Ok, shit. //Let's add a special error ingot. if (!ItemUtils.checkForInvalidItems(aReturn)) { @@ -858,12 +848,12 @@ public class CI { } } } - + return aReturn; - + } - + public static ItemStack getElectricMotor(int aTier, int aSize) { ItemStack aType; int aLazyTier = 0; @@ -902,7 +892,7 @@ public class CI { } return ItemUtils.getSimpleStack(aType, aSize); } - + public static ItemStack getElectricPiston(int aTier, int aSize) { ItemStack aType; int aLazyTier = 0; @@ -941,7 +931,7 @@ public class CI { } return ItemUtils.getSimpleStack(aType, aSize); } - + public static ItemStack getElectricPump(int aTier, int aSize) { ItemStack aType; int aLazyTier = 0; @@ -980,7 +970,7 @@ public class CI { } return ItemUtils.getSimpleStack(aType, aSize); } - + public static ItemStack getRobotArm(int aTier, int aSize) { ItemStack aType; int aLazyTier = 0; @@ -1019,7 +1009,7 @@ public class CI { } return ItemUtils.getSimpleStack(aType, aSize); } - + public static ItemStack getConveyor(int aTier, int aSize) { ItemStack aType; int aLazyTier = 0; @@ -1058,7 +1048,7 @@ public class CI { } return ItemUtils.getSimpleStack(aType, aSize); } - + public static ItemStack getEmitter(int aTier, int aSize) { ItemStack aType; int aLazyTier = 0; @@ -1097,7 +1087,7 @@ public class CI { } return ItemUtils.getSimpleStack(aType, aSize); } - + public static ItemStack getSensor(int aTier, int aSize) { ItemStack aType; int aLazyTier = 0; @@ -1136,7 +1126,7 @@ public class CI { } return ItemUtils.getSimpleStack(aType, aSize); } - + public static ItemStack getFieldGenerator(int aTier, int aSize) { ItemStack aType; int aLazyTier = 0; @@ -1175,9 +1165,9 @@ public class CI { } return ItemUtils.getSimpleStack(aType, aSize); } - - + + public static ItemStack getTieredMachineHull(int aTier, int aSize) { ItemStack aType; int aLazyTier = 0; @@ -1293,7 +1283,7 @@ public class CI { public static ItemStack getGreenCatalyst(int aAmount) { return ItemUtils.simpleMetaStack(AgriculturalChem.mAgrichemItem1, 14, aAmount); } - + /** * Iron + Copper Catalyst * @param aAmount - Stacksize @@ -1302,7 +1292,7 @@ public class CI { public static ItemStack getRedCatalyst(int aAmount) { return ItemUtils.simpleMetaStack(GenericChem.mGenericChemItem1, 0, aAmount); } - + /** * Tungsten + Nickel Catalyst * @param aAmount - Stacksize @@ -1311,7 +1301,7 @@ public class CI { public static ItemStack getYellowCatalyst(int aAmount) { return ItemUtils.simpleMetaStack(GenericChem.mGenericChemItem1, 1, aAmount); } - + /** * Cobalt + Titanium Catalyst * @param aAmount - Stacksize @@ -1320,7 +1310,7 @@ public class CI { public static ItemStack getBlueCatalyst(int aAmount) { return ItemUtils.simpleMetaStack(GenericChem.mGenericChemItem1, 2, aAmount); } - + /** * Vanadium + Palladium Catalyst * @param aAmount - Stacksize @@ -1329,7 +1319,7 @@ public class CI { public static ItemStack getOrangeCatalyst(int aAmount) { return ItemUtils.simpleMetaStack(GenericChem.mGenericChemItem1, 3, aAmount); } - + /** * Iridium + Ruthenium Catalyst * @param aAmount - Stacksize @@ -1338,7 +1328,7 @@ public class CI { public static ItemStack getPurpleCatalyst(int aAmount) { return ItemUtils.simpleMetaStack(GenericChem.mGenericChemItem1, 4, aAmount); } - + /** * Aluminium + Nickel Catalyst * @param aAmount - Stacksize @@ -1347,7 +1337,7 @@ public class CI { public static ItemStack getBrownCatalyst(int aAmount) { return ItemUtils.simpleMetaStack(GenericChem.mGenericChemItem1, 5, aAmount); } - + /** * Platinum + Rhodium Catalyst * @param aAmount - Stacksize diff --git a/src/Java/gtPlusPlus/core/util/Utils.java b/src/Java/gtPlusPlus/core/util/Utils.java index 234b54d2d2..72b13b3067 100644 --- a/src/Java/gtPlusPlus/core/util/Utils.java +++ b/src/Java/gtPlusPlus/core/util/Utils.java @@ -935,22 +935,6 @@ public class Utils { return false; } - public static ItemList getValueOfItemList(String string, ItemList aOther) { - ItemList[] aListValues = ItemList.class.getEnumConstants(); - for (ItemList aItem : aListValues) { - if (aItem != null) { - if (aItem.name().equals(string) || aItem.name().toLowerCase().equals(string.toLowerCase())) { - return aItem; - } - } - } - Logger.INFO("Tried to obtain '"+string+"' from the GT ItemList, however it does not exist."); - if (aOther != null) { - Logger.INFO("Using fallback option instead - "+aOther.name()); - } - return aOther; - } - public static long getMillisSince(long aStartTime, long aCurrentTime) { return (aCurrentTime - aStartTime); } diff --git a/src/Java/gtPlusPlus/core/util/debug/DEBUG_INIT.java b/src/Java/gtPlusPlus/core/util/debug/DEBUG_INIT.java index b1cd1697f5..f8fc15c778 100644 --- a/src/Java/gtPlusPlus/core/util/debug/DEBUG_INIT.java +++ b/src/Java/gtPlusPlus/core/util/debug/DEBUG_INIT.java @@ -1,12 +1,12 @@ package gtPlusPlus.core.util.debug; -import gtPlusPlus.core.lib.CORE; +import gtPlusPlus.preloader.CORE_Preloader; public class DEBUG_INIT { public static void registerBlocks(){ //Debug Loading - if (CORE.DEBUG){ + if (CORE_Preloader.DEBUG_MODE){ } } diff --git a/src/Java/gtPlusPlus/core/util/minecraft/EntityUtils.java b/src/Java/gtPlusPlus/core/util/minecraft/EntityUtils.java index 49aa3a1306..66f9e2453d 100644 --- a/src/Java/gtPlusPlus/core/util/minecraft/EntityUtils.java +++ b/src/Java/gtPlusPlus/core/util/minecraft/EntityUtils.java @@ -29,8 +29,23 @@ import net.minecraft.world.biome.BiomeGenBase; public class EntityUtils { - public static void setEntityOnFire(final Entity entity, final int length){ - entity.setFire(length); + public static void setEntityOnFire(final Entity aEntity, final int length){ + if (!isEntityImmuneToFire(aEntity)) { + aEntity.setFire(length); + } + } + + public static boolean isEntityOnFire(final Entity aEntity) { + Field aIsOnFire = ReflectionUtils.getField(Entity.class, "fire"); + if (aIsOnFire != null) { + int aFireTime = (int) ReflectionUtils.getFieldValue(aIsOnFire, aEntity); + return aFireTime > 0; + } + return false; + } + + public static boolean isEntityImmuneToFire(Entity aEntity) { + return aEntity.isImmuneToFire(); } public static int getFacingDirection(final Entity entity){ @@ -59,6 +74,13 @@ public class EntityUtils { final int blockZ = MathHelper.floor_double(parEntity.posZ); return new BlockPos(blockX, blockY, blockZ, parEntity.worldObj); } + + public static BlockPos findBlockPosOfEntity(final Entity parEntity){ + final int blockX = MathHelper.floor_double(parEntity.posX); + final int blockY = MathHelper.floor_double(parEntity.boundingBox.minY); + final int blockZ = MathHelper.floor_double(parEntity.posZ); + return new BlockPos(blockX, blockY, blockZ, parEntity.worldObj); + } //TODO public static void registerEntityToBiomeSpawns(final Class<EntityLiving> classy, final EnumCreatureType EntityType, final BiomeGenBase baseBiomeGen){ diff --git a/src/Java/gtPlusPlus/core/util/minecraft/FluidUtils.java b/src/Java/gtPlusPlus/core/util/minecraft/FluidUtils.java index d7b6bc0a30..758ec8bab0 100644 --- a/src/Java/gtPlusPlus/core/util/minecraft/FluidUtils.java +++ b/src/Java/gtPlusPlus/core/util/minecraft/FluidUtils.java @@ -1,14 +1,9 @@ package gtPlusPlus.core.util.minecraft; -import net.minecraft.init.Items; -import net.minecraft.item.Item; -import net.minecraft.item.ItemStack; - import gregtech.api.enums.Dyes; import gregtech.api.enums.ItemList; import gregtech.api.enums.Materials; import gregtech.api.util.GT_LanguageManager; - import gtPlusPlus.api.objects.Logger; import gtPlusPlus.api.objects.minecraft.FluidGT6; import gtPlusPlus.core.item.base.BaseItemComponent; @@ -19,7 +14,14 @@ import gtPlusPlus.core.material.MaterialStack; import gtPlusPlus.core.recipe.common.CI; import gtPlusPlus.core.util.Utils; import gtPlusPlus.xmod.gregtech.api.enums.GregtechOrePrefixes.GT_Materials; -import net.minecraftforge.fluids.*; +import net.minecraft.init.Items; +import net.minecraft.item.Item; +import net.minecraft.item.ItemStack; +import net.minecraftforge.fluids.Fluid; +import net.minecraftforge.fluids.FluidContainerRegistry; +import net.minecraftforge.fluids.FluidRegistry; +import net.minecraftforge.fluids.FluidStack; +import net.minecraftforge.fluids.IFluidContainerItem; public class FluidUtils { @@ -611,5 +613,9 @@ public class FluidUtils { } } + public static FluidStack getAir(int aAmount) { + return FluidUtils.getFluidStack("air", aAmount); + } + } diff --git a/src/Java/gtPlusPlus/core/util/minecraft/ItemUtils.java b/src/Java/gtPlusPlus/core/util/minecraft/ItemUtils.java index d7d611a1e4..725799a43d 100644 --- a/src/Java/gtPlusPlus/core/util/minecraft/ItemUtils.java +++ b/src/Java/gtPlusPlus/core/util/minecraft/ItemUtils.java @@ -27,6 +27,7 @@ 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.chemistry.RocketFuels; import gtPlusPlus.core.item.tool.staballoy.MultiPickaxeBase; import gtPlusPlus.core.item.tool.staballoy.MultiSpadeBase; import gtPlusPlus.core.lib.CORE; @@ -36,13 +37,13 @@ import gtPlusPlus.core.recipe.common.CI; import gtPlusPlus.core.util.Utils; import gtPlusPlus.core.util.math.MathUtils; import gtPlusPlus.core.util.reflect.ReflectionUtils; +import gtPlusPlus.preloader.CORE_Preloader; import gtPlusPlus.xmod.gregtech.api.items.Gregtech_MetaTool; import gtPlusPlus.xmod.gregtech.common.items.MetaGeneratedGregtechTools; import gtPlusPlus.xmod.gregtech.loaders.RecipeGen_DustGeneration; import net.minecraft.block.Block; import net.minecraft.enchantment.Enchantment; import net.minecraft.enchantment.EnchantmentData; -import net.minecraft.init.Blocks; import net.minecraft.init.Items; import net.minecraft.inventory.IInventory; import net.minecraft.item.Item; @@ -354,7 +355,7 @@ public class ItemUtils { } public static ItemStack getItemStackOfAmountFromOreDictNoBroken(String oredictName, final int amount) { - if (CORE.DEBUG) { + if (CORE_Preloader.DEBUG_MODE) { Logger.WARNING("Looking up: " + oredictName + " - from method: " + ReflectionUtils.getMethodName(1)); Logger.WARNING("Looking up: " + oredictName + " - from method: " + ReflectionUtils.getMethodName(2)); Logger.WARNING("Looking up: " + oredictName + " - from method: " + ReflectionUtils.getMethodName(3)); @@ -1220,7 +1221,6 @@ public class ItemUtils { return GT_Values.NI; } - public static ItemStack depleteStack(ItemStack aStack) { return depleteStack(aStack, 1); } @@ -1235,41 +1235,6 @@ public class ItemUtils { } return getNullStack(); } - - public static ItemStack getItemListObject(String aObjectFromExperimentalName, String aReplacementName, int aAmount) { - ItemList aItemListObject = getItemListObject(aObjectFromExperimentalName, aReplacementName); - if (aItemListObject == ItemList.NULL || aItemListObject == null) { - return null; - } - else { - return aItemListObject.get(aAmount); - } - } - - public static ItemStack getItemListObject(ItemList aItemListObject, int aAmount) { - if (aItemListObject == ItemList.NULL || aItemListObject == null) { - return null; - } - else { - return aItemListObject.get(aAmount); - } - } - - public static ItemList getItemListObject(String aObjectFromExperimentalName, String aReplacementName) { - ItemList aVal = ItemList.valueOf(aObjectFromExperimentalName); - if (aVal != null) { - return aVal; - } - else { - aVal = ItemList.valueOf(aReplacementName); - if (aVal != null) { - return aVal; - } - else { - return ItemList.NULL; - } - } - } public static boolean isControlCircuit(ItemStack aStack) { if (aStack != null) { @@ -1282,7 +1247,9 @@ public class ItemUtils { } public static boolean isCatalyst(ItemStack aStack) { - + if (GT_Utility.areStacksEqual(aStack, RocketFuels.Formaldehyde_Catalyst_Stack, true)) { + return true; + } if (GT_Utility.areStacksEqual(aStack, GenericChem.mBlueCatalyst, true)) { return true; } @@ -1309,9 +1276,69 @@ public class ItemUtils { } return false; } + + public static boolean isMillingBall(ItemStack aStack) { + if (GT_Utility.areStacksEqual(aStack, GenericChem.mMillingBallAlumina, true)) { + return true; + } + if (GT_Utility.areStacksEqual(aStack, GenericChem.mMillingBallSoapstone, true)) { + return true; + } + return false; + } public static String getLocalizedNameOfBlock(Block aBlock, int aMeta) { return LangUtils.getLocalizedNameOfBlock(aBlock, aMeta); } + + + + public static boolean doesItemListEntryExist(String string) { + ItemList[] aListValues = ItemList.class.getEnumConstants(); + for (ItemList aItem : aListValues) { + if (aItem != null) { + if (aItem.name().equals(string) || aItem.name().toLowerCase().equals(string.toLowerCase())) { + return true; + } + } + } + return false; + } + + public static ItemList getValueOfItemList(String string, ItemList aOther) { + ItemList[] aListValues = ItemList.class.getEnumConstants(); + for (ItemList aItem : aListValues) { + if (aItem != null) { + if (aItem.name().equals(string) || aItem.name().toLowerCase().equals(string.toLowerCase())) { + return aItem; + } + } + } + Logger.INFO("Tried to obtain '"+string+"' from the GT ItemList, however it does not exist."); + if (aOther != null) { + Logger.INFO("Using fallback option instead - "+aOther.name()); + } + return aOther; + } + + public static ItemStack getValueOfItemList(String string, int aAmount, ItemList aOther) { + return getValueOfItemList(string, aOther).get(aAmount); + } + + public static ItemStack getValueOfItemList(String string, int aAmount, ItemStack aOther) { + ItemList[] aListValues = ItemList.class.getEnumConstants(); + for (ItemList aItem : aListValues) { + if (aItem != null) { + if (aItem.name().equals(string) || aItem.name().toLowerCase().equals(string.toLowerCase())) { + return aItem.get(aAmount); + } + } + } + Logger.INFO("Tried to obtain '"+string+"' from the GT ItemList, however it does not exist."); + if (aOther != null) { + Logger.INFO("Using fallback option instead - "+ItemUtils.getItemName(aOther)); + } + return aOther; + } } diff --git a/src/Java/gtPlusPlus/core/util/minecraft/MaterialUtils.java b/src/Java/gtPlusPlus/core/util/minecraft/MaterialUtils.java index 2108087542..64a6c9e820 100644 --- a/src/Java/gtPlusPlus/core/util/minecraft/MaterialUtils.java +++ b/src/Java/gtPlusPlus/core/util/minecraft/MaterialUtils.java @@ -501,5 +501,14 @@ public class MaterialUtils { } + public static boolean doesMaterialExist(String aMatName) { + for (Materials m : Materials.values()) { + if (m.name().toLowerCase().equals(aMatName.toLowerCase())) { + return true; + } + } + return false; + } + }
\ No newline at end of file diff --git a/src/Java/gtPlusPlus/core/util/minecraft/PlayerUtils.java b/src/Java/gtPlusPlus/core/util/minecraft/PlayerUtils.java index 9a8a8e691c..e64414b493 100644 --- a/src/Java/gtPlusPlus/core/util/minecraft/PlayerUtils.java +++ b/src/Java/gtPlusPlus/core/util/minecraft/PlayerUtils.java @@ -188,4 +188,12 @@ public class PlayerUtils { Utils.sendServerMessage(string); } + public static boolean isCreative(EntityPlayer aPlayer) { + return aPlayer.capabilities.isCreativeMode; + } + + public static boolean canTakeDamage(EntityPlayer aPlayer) { + return !aPlayer.capabilities.disableDamage; + } + } diff --git a/src/Java/gtPlusPlus/core/util/minecraft/RecipeUtils.java b/src/Java/gtPlusPlus/core/util/minecraft/RecipeUtils.java index 13bc0c9382..56772f0dc7 100644 --- a/src/Java/gtPlusPlus/core/util/minecraft/RecipeUtils.java +++ b/src/Java/gtPlusPlus/core/util/minecraft/RecipeUtils.java @@ -20,6 +20,7 @@ import gtPlusPlus.api.objects.minecraft.ShapedRecipe; import gtPlusPlus.core.handler.COMPAT_HANDLER; import gtPlusPlus.core.handler.Recipes.LateRegistrationHandler; import gtPlusPlus.core.handler.Recipes.RegistrationHandler; +import gtPlusPlus.core.item.ModItems; import gtPlusPlus.core.recipe.common.CI; import gtPlusPlus.core.util.reflect.ReflectionUtils; import net.minecraft.item.Item; @@ -632,5 +633,16 @@ public static int mInvalidID = 1; } + public static void addSmeltingRecipe(ItemStack aStackInput, ItemStack aStackOutput) { + addSmeltingRecipe(aStackInput, aStackOutput, 0f); + } + + public static void addSmeltingRecipe(ItemStack aStackInput, ItemStack aStackOutput, float aXpGained) { + + GameRegistry.addSmelting(aStackInput, aStackOutput, aXpGained); + + } + + } diff --git a/src/Java/gtPlusPlus/core/util/reflect/ReflectionUtils.java b/src/Java/gtPlusPlus/core/util/reflect/ReflectionUtils.java index 4d8a02d800..e45d27b926 100644 --- a/src/Java/gtPlusPlus/core/util/reflect/ReflectionUtils.java +++ b/src/Java/gtPlusPlus/core/util/reflect/ReflectionUtils.java @@ -365,7 +365,13 @@ public class ReflectionUtils { public static boolean setField(final Object object, final String fieldName, final Object fieldValue) { - Class<?> clazz = object.getClass(); + Class<?> clazz; + if (object instanceof Class) { + clazz = (Class<?>) object; + } + else { + clazz = object.getClass(); + } while (clazz != null) { try { final Field field = getField(clazz, fieldName); @@ -387,7 +393,13 @@ public class ReflectionUtils { } public static boolean setField(final Object object, final Field field, final Object fieldValue) { - Class<?> clazz = object.getClass(); + Class<?> clazz; + if (object instanceof Class) { + clazz = (Class<?>) object; + } + else { + clazz = object.getClass(); + } while (clazz != null) { try { final Field field2 = getField(clazz, field.getName()); @@ -522,6 +534,25 @@ public class ReflectionUtils { return false; } + + public static Object invokeNonBool(Object objectInstance, Method method, Object[] values){ + if (objectInstance == null || method == null || values == null){ + return false; + } + String methodName = method.getName(); + Class<?> mLocalClass = (objectInstance instanceof Class ? (Class<?>) objectInstance : objectInstance.getClass()); + Logger.REFLECTION("Trying to invoke "+methodName+" on an instance of "+mLocalClass.getCanonicalName()+"."); + try { + return method.invoke(objectInstance, values); + } + catch (SecurityException | IllegalAccessException | IllegalArgumentException | InvocationTargetException e) { + Logger.REFLECTION("Failed to Dynamically invoke "+methodName+" on an object of type: "+mLocalClass.getName()); + } + + Logger.REFLECTION("Invoke failed or did something wrong."); + return null; + } + public static Object invokeNonBool(Object objectInstance, String methodName, Class[] parameters, Object[] values){ if (objectInstance == null || methodName == null || parameters == null || values == null){ return false; @@ -973,9 +1004,9 @@ public class ReflectionUtils { */ private static void makeModifiable(Field nameField) throws Exception { nameField.setAccessible(true); - Field modifiers = getField(Field.class, "modifiers"); - modifiers.setAccessible(true); - modifiers.setInt(nameField, nameField.getModifiers() & ~Modifier.FINAL); + Field modifiers = getField(Field.class, "modifiers"); + modifiers.setAccessible(true); + modifiers.setInt(nameField, nameField.getModifiers() & ~Modifier.FINAL); } diff --git a/src/Java/gtPlusPlus/core/util/sys/GeoUtils.java b/src/Java/gtPlusPlus/core/util/sys/GeoUtils.java index 6ec6662a44..0e5a33b948 100644 --- a/src/Java/gtPlusPlus/core/util/sys/GeoUtils.java +++ b/src/Java/gtPlusPlus/core/util/sys/GeoUtils.java @@ -3,17 +3,22 @@ package gtPlusPlus.core.util.sys; import java.io.IOException; import java.io.InputStream; import java.io.InputStreamReader; -import java.net.*; +import java.net.MalformedURLException; +import java.net.URI; +import java.net.URISyntaxException; +import java.net.URL; +import java.net.URLConnection; import org.apache.http.client.utils.URIBuilder; import gtPlusPlus.api.objects.Logger; import gtPlusPlus.core.lib.CORE; +import gtPlusPlus.preloader.CORE_Preloader; public class GeoUtils { public static String determineUsersCountry(){ - if (!CORE.DEBUG && !CORE.DEVENV) { + if (!CORE_Preloader.DEBUG_MODE && !CORE.DEVENV) { try { if (NetworkUtils.checkNetworkIsAvailableWithValidInterface()){ return getUsersCountry(); diff --git a/src/Java/gtPlusPlus/core/util/sys/NetworkUtils.java b/src/Java/gtPlusPlus/core/util/sys/NetworkUtils.java index f1417e8a2d..b883391a86 100644 --- a/src/Java/gtPlusPlus/core/util/sys/NetworkUtils.java +++ b/src/Java/gtPlusPlus/core/util/sys/NetworkUtils.java @@ -121,7 +121,7 @@ public class NetworkUtils { private static boolean checkAddressWithTimeout(String URL, int timeout) { try { - InetAddress.getByName(URL).isReachable(3000); //Replace with your name + InetAddress.getByName(URL).isReachable(timeout); //Replace with your name return true; } catch (Exception e) { return false; diff --git a/src/Java/gtPlusPlus/everglades/GTplusplus_Everglades.java b/src/Java/gtPlusPlus/everglades/GTplusplus_Everglades.java index 6c8a790037..0709f0b1ff 100644 --- a/src/Java/gtPlusPlus/everglades/GTplusplus_Everglades.java +++ b/src/Java/gtPlusPlus/everglades/GTplusplus_Everglades.java @@ -6,10 +6,12 @@ import java.io.File; import cpw.mods.fml.common.Mod; import cpw.mods.fml.common.Mod.EventHandler; -import cpw.mods.fml.common.event.*; +import cpw.mods.fml.common.event.FMLInitializationEvent; +import cpw.mods.fml.common.event.FMLPostInitializationEvent; +import cpw.mods.fml.common.event.FMLPreInitializationEvent; +import cpw.mods.fml.common.event.FMLServerStartingEvent; import cpw.mods.fml.common.registry.GameRegistry; import cpw.mods.fml.relauncher.IFMLLoadingPlugin.MCVersion; - import gtPlusPlus.api.objects.Logger; import gtPlusPlus.core.lib.CORE; import gtPlusPlus.core.lib.CORE.Everglades; @@ -22,6 +24,7 @@ import gtPlusPlus.everglades.block.DarkWorldContentLoader; import gtPlusPlus.everglades.dimension.Dimension_Everglades; import gtPlusPlus.everglades.gen.gt.WorldGen_GT_Base; import gtPlusPlus.everglades.gen.gt.WorldGen_Ores; +import gtPlusPlus.preloader.CORE_Preloader; import gtPlusPlus.xmod.gregtech.HANDLER_GT; import gtPlusPlus.xmod.gregtech.api.util.GTPP_Config; import net.minecraftforge.common.DimensionManager; @@ -171,7 +174,7 @@ public class GTplusplus_Everglades implements ActionListener { WorldGen_GT_Base.oreveinPercentage = 64; WorldGen_GT_Base.oreveinAttempts = 16; WorldGen_GT_Base.oreveinMaxPlacementAttempts = 4; - if (CORE.DEBUG || CORE.DEVENV){ + if (CORE_Preloader.DEBUG_MODE || CORE.DEVENV){ WorldGen_GT_Base.debugWorldGen = true; } DarkWorldContentLoader.run(); diff --git a/src/Java/gtPlusPlus/nei/GT_NEI_FluidReactor.java b/src/Java/gtPlusPlus/nei/GT_NEI_FluidReactor.java index 810076743f..29c3cecb6f 100644 --- a/src/Java/gtPlusPlus/nei/GT_NEI_FluidReactor.java +++ b/src/Java/gtPlusPlus/nei/GT_NEI_FluidReactor.java @@ -25,13 +25,11 @@ import gregtech.api.gui.GT_GUIContainer_BasicMachine; import gregtech.api.objects.ItemData; 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; @@ -62,7 +60,7 @@ extends TemplateRecipeHandler { } public List<Recipe_GT> getSortedRecipes() { - List<Recipe_GT> result = new ArrayList<>(this.mRecipeMap.mRecipeList); + List<Recipe_GT> result = new ArrayList(this.mRecipeMap.mRecipeList); Collections.sort(result); return result; } @@ -206,7 +204,7 @@ extends TemplateRecipeHandler { } } for (final PositionedStack tStack : tRecipe.mInputs) { - if (aStack == tStack.item) { + if (GT_Utility.areStacksEqual(aStack, tStack.item)) { if ((gregtech.api.enums.ItemList.Display_Fluid.isStackEqual(tStack.item, true, true)) || (tStack.item.stackSize != 0)) { break; diff --git a/src/Java/gtPlusPlus/nei/GT_NEI_MillingMachine.java b/src/Java/gtPlusPlus/nei/GT_NEI_MillingMachine.java new file mode 100644 index 0000000000..b868c2422c --- /dev/null +++ b/src/Java/gtPlusPlus/nei/GT_NEI_MillingMachine.java @@ -0,0 +1,472 @@ +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; + +import org.lwjgl.opengl.GL11; + +import codechicken.lib.gui.GuiDraw; +import codechicken.nei.PositionedStack; +import codechicken.nei.guihook.GuiContainerManager; +import codechicken.nei.guihook.IContainerInputHandler; +import codechicken.nei.guihook.IContainerTooltipHandler; +import codechicken.nei.recipe.GuiCraftingRecipe; +import codechicken.nei.recipe.GuiRecipe; +import codechicken.nei.recipe.GuiUsageRecipe; +import codechicken.nei.recipe.TemplateRecipeHandler; +import cpw.mods.fml.common.event.FMLInterModComms; +import gregtech.api.enums.GT_Values; +import gregtech.api.enums.OrePrefixes; +import gregtech.api.gui.GT_GUIContainer_BasicMachine; +import gregtech.api.objects.ItemData; +import gregtech.api.util.GT_LanguageManager; +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.util.minecraft.ItemUtils; +import net.minecraft.client.Minecraft; +import net.minecraft.client.gui.inventory.GuiContainer; +import net.minecraft.init.Blocks; +import net.minecraft.item.ItemStack; +import net.minecraftforge.fluids.FluidContainerRegistry; +import net.minecraftforge.fluids.FluidStack; + +public class GT_NEI_MillingMachine +extends TemplateRecipeHandler { + public static final int sOffsetX = 5; + public static final int sOffsetY = 11; + + static { + GuiContainerManager.addInputHandler(new GT_RectHandler()); + GuiContainerManager.addTooltipHandler(new GT_RectHandler()); + } + + protected GT_Recipe_Map mRecipeMap; + + public GT_NEI_MillingMachine() { + this.mRecipeMap = Gregtech_Recipe_Map.sOreMillRecipes; + 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.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_MillingMachine(); + } + + @Override + public void loadCraftingRecipes(final String outputId, final Object... results) { + if (outputId.equals(getRecipeMapName())) { + for (Recipe_GT tRecipe : getSortedRecipes()) { + if (!tRecipe.mHidden) { + this.arecipes.add(new CachedDefaultRecipe(tRecipe)); + } + } + } else { + super.loadCraftingRecipes(outputId, results); + } + } + + @Override + public void loadCraftingRecipes(final ItemStack aResult) { + ItemData tPrefixMaterial = GT_OreDictUnificator.getAssociation(aResult); + + 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 (OrePrefixes tPrefix : tPrefixMaterial.mPrefix.mFamiliarPrefixes) { + tResults.add(GT_OreDictUnificator.get(tPrefix, tPrefixMaterial.mMaterial.mMaterial, 1L)); + } + } + FluidStack tFluid = GT_Utility.getFluidForFilledItem(aResult, true); + if (tFluid != null) { + tResults.add(GT_Utility.getFluidDisplayStack(tFluid, false)); + for (FluidContainerRegistry.FluidContainerData tData : FluidContainerRegistry.getRegisteredFluidContainerData()) { + if (tData.fluid.isFluidEqual(tFluid)) { + tResults.add(GT_Utility.copy(new Object[]{tData.filledContainer})); + } + } + } + for (Recipe_GT tRecipe : getSortedRecipes()) { + if (!tRecipe.mHidden) { + CachedDefaultRecipe tNEIRecipe = new CachedDefaultRecipe(tRecipe); + for (ItemStack tStack : tResults) { + if (tNEIRecipe.contains(tNEIRecipe.mOutputs, tStack)) { + this.arecipes.add(tNEIRecipe); + break; + } + } + } + } + //CachedDefaultRecipe tNEIRecipe; + } + + public void loadUsageRecipes(ItemStack aInput) { + ItemData tPrefixMaterial = GT_OreDictUnificator.getAssociation(aInput); + + ArrayList<ItemStack> tInputs = new ArrayList<ItemStack>(); + tInputs.add(aInput); + tInputs.add(GT_OreDictUnificator.get(false, aInput)); + if ((tPrefixMaterial != null) && (!tPrefixMaterial.mPrefix.mFamiliarPrefixes.isEmpty())) { + for (OrePrefixes tPrefix : tPrefixMaterial.mPrefix.mFamiliarPrefixes) { + tInputs.add(GT_OreDictUnificator.get(tPrefix, tPrefixMaterial.mMaterial.mMaterial, 1L)); + } + } + FluidStack tFluid = GT_Utility.getFluidForFilledItem(aInput, true); + if (tFluid != null) { + tInputs.add(GT_Utility.getFluidDisplayStack(tFluid, false)); + for (FluidContainerRegistry.FluidContainerData tData : FluidContainerRegistry.getRegisteredFluidContainerData()) { + if (tData.fluid.isFluidEqual(tFluid)) { + tInputs.add(GT_Utility.copy(new Object[]{tData.filledContainer})); + } + } + } + for (Recipe_GT tRecipe : getSortedRecipes()) { + if (!tRecipe.mHidden) { + CachedDefaultRecipe tNEIRecipe = new CachedDefaultRecipe(tRecipe); + for (ItemStack tStack : tInputs) { + if (tNEIRecipe.contains(tNEIRecipe.mInputs, tStack)) { + this.arecipes.add(tNEIRecipe); + break; + } + } + } + } + //CachedDefaultRecipe tNEIRecipe; + } + + public String getRecipeMapName() { + return this.mRecipeMap.mNEIName; + } + + @Override + public String getOverlayIdentifier() { + return this.mRecipeMap.mNEIName; + } + + @Override + public void drawBackground(final int recipe) { + GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F); + GuiDraw.changeTexture(this.getGuiTexture()); + GuiDraw.drawTexturedModalRect(-4, -8, 1, 3, 174, 78); + } + + @Override + public int recipiesPerPage() { + return 1; + } + + @Override + public String getRecipeName() { + return GT_LanguageManager.getTranslation(this.mRecipeMap.mUnlocalizedName); + } + + @Override + public String getGuiTexture() { + return this.mRecipeMap.mNEIGUIPath; + } + + @Override + public List<String> handleItemTooltip(final GuiRecipe gui, final ItemStack aStack, final List<String> currenttip, final int aRecipeIndex) { + final TemplateRecipeHandler.CachedRecipe tObject = this.arecipes.get(aRecipeIndex); + if ((tObject instanceof CachedDefaultRecipe)) { + final CachedDefaultRecipe tRecipe = (CachedDefaultRecipe) tObject; + for (final PositionedStack tStack : tRecipe.mOutputs) { + if (aStack == tStack.item) { + if ((!(tStack instanceof FixedPositionedStack)) || (((FixedPositionedStack) tStack).mChance <= 0) || (((FixedPositionedStack) tStack).mChance == 10000)) { + break; + } + currenttip.add("Chance: " + (((FixedPositionedStack) tStack).mChance / 100) + "." + ((((FixedPositionedStack) tStack).mChance % 100) < 10 ? "0" + (((FixedPositionedStack) tStack).mChance % 100) : Integer.valueOf(((FixedPositionedStack) tStack).mChance % 100)) + "%"); + break; + } + } + for (final PositionedStack tStack : tRecipe.mInputs) { + if (GT_Utility.areStacksEqual(aStack, tStack.item)) { + if ((gregtech.api.enums.ItemList.Display_Fluid.isStackEqual(tStack.item, true, true)) || + (tStack.item.stackSize != 0)) { + break; + } + if (ItemUtils.isMillingBall(aStack)) { + currenttip.add("Does not always get consumed in the process"); + } + else if (ItemUtils.isControlCircuit(aStack)) { + currenttip.add("Does not get consumed in the process"); + } + break; + } + } + } + return currenttip; + } + + @Override + public void drawExtras(final int aRecipeIndex) { + final long tEUt = ((CachedDefaultRecipe) this.arecipes.get(aRecipeIndex)).mRecipe.mEUt; + final int tDuration = ((CachedDefaultRecipe) this.arecipes.get(aRecipeIndex)).mRecipe.mDuration; + if (tEUt != 0) { + drawText(10, 73, "Total: " + (long) (tDuration * tEUt) + " EU", -16777216); + //drawText(10, 83, "Usage: " + tEUt + " EU/t", -16777216); + if (this.mRecipeMap.mShowVoltageAmperageInNEI) { + drawText(10, 83, "Voltage: " + (tEUt / this.mRecipeMap.mAmperage) + " EU/t", -16777216); + drawText(10, 93, "Amperage: " + this.mRecipeMap.mAmperage, -16777216); + } else { + drawText(10, 93, "Voltage: unspecified", -16777216); + drawText(10, 103, "Amperage: unspecified", -16777216); + } + } + if (tDuration > 0) { + drawText(10, 103, "Time: " + (tDuration < 20 ? "< 1" : Integer.valueOf(tDuration / 20)) + " secs", -16777216); + } + if ((GT_Utility.isStringValid(this.mRecipeMap.mNEISpecialValuePre)) || (GT_Utility.isStringValid(this.mRecipeMap.mNEISpecialValuePost))) { + drawText(10, 113, this.mRecipeMap.mNEISpecialValuePre + (((CachedDefaultRecipe) this.arecipes.get(aRecipeIndex)).mRecipe.mSpecialValue * this.mRecipeMap.mNEISpecialValueMultiplier) + this.mRecipeMap.mNEISpecialValuePost, -16777216); + } + } + + public static class GT_RectHandler + implements IContainerInputHandler, IContainerTooltipHandler { + @Override + public boolean mouseClicked(final GuiContainer gui, final int mousex, final int mousey, final int button) { + if (this.canHandle(gui)) { + if (button == 0) { + return this.transferRect(gui, false); + } + if (button == 1) { + return this.transferRect(gui, true); + } + } + return false; + } + + @Override + public boolean lastKeyTyped(final GuiContainer gui, final char keyChar, final int keyCode) { + return false; + } + + public boolean canHandle(final GuiContainer gui) { + return (((gui instanceof GT_GUIContainer_BasicMachine)) && (GT_Utility.isStringValid(((GT_GUIContainer_BasicMachine) gui).mNEI)) /*|| ((gui instanceof GT_GUIContainer_FusionReactor)) && (GT_Utility.isStringValid(((GT_GUIContainer_FusionReactor) gui).mNEI))*/); + } + + @Override + public List<String> handleTooltip(final GuiContainer gui, final int mousex, final int mousey, final List<String> currenttip) { + if ((this.canHandle(gui)) && (currenttip.isEmpty())) { + if ((gui instanceof GT_GUIContainer_BasicMachine) && new Rectangle(65, 13, 36, 18).contains(new Point(GuiDraw.getMousePosition().x - ((GT_GUIContainer_BasicMachine) gui).getLeft() - codechicken.nei.recipe.RecipeInfo.getGuiOffset(gui)[0], GuiDraw.getMousePosition().y - ((GT_GUIContainer_BasicMachine) gui).getTop() - codechicken.nei.recipe.RecipeInfo.getGuiOffset(gui)[1]))) { + currenttip.add("Recipes"); + } /*else if (gui instanceof GT_GUIContainer_FusionReactor && new Rectangle(145, 0, 24, 24).contains(new Point(GuiDraw.getMousePosition().x - ((GT_GUIContainer_FusionReactor) gui).getLeft() - codechicken.nei.recipe.RecipeInfo.getGuiOffset(gui)[0], GuiDraw.getMousePosition().y - ((GT_GUIContainer_FusionReactor) gui).getTop() - codechicken.nei.recipe.RecipeInfo.getGuiOffset(gui)[1]))) { + currenttip.add("Recipes"); + }*/ + + } + return currenttip; + } + + private boolean transferRect(final GuiContainer gui, final boolean usage) { + if (gui instanceof GT_GUIContainer_BasicMachine) { + return (this.canHandle(gui)) && (new Rectangle(65, 13, 36, 18).contains(new Point(GuiDraw.getMousePosition().x - ((GT_GUIContainer_BasicMachine) gui).getLeft() - codechicken.nei.recipe.RecipeInfo.getGuiOffset(gui)[0], GuiDraw.getMousePosition().y - ((GT_GUIContainer_BasicMachine) gui).getTop() - codechicken.nei.recipe.RecipeInfo.getGuiOffset(gui)[1]))) && (usage ? GuiUsageRecipe.openRecipeGui(((GT_GUIContainer_BasicMachine) gui).mNEI, new Object[0]) : GuiCraftingRecipe.openRecipeGui(((GT_GUIContainer_BasicMachine) gui).mNEI, new Object[0])); + } /*else if (gui instanceof GT_GUIContainer_FusionReactor) { + return (canHandle(gui)) && (new Rectangle(145, 0, 24, 24).contains(new Point(GuiDraw.getMousePosition().x - ((GT_GUIContainer_FusionReactor) gui).getLeft() - codechicken.nei.recipe.RecipeInfo.getGuiOffset(gui)[0], GuiDraw.getMousePosition().y - ((GT_GUIContainer_FusionReactor) gui).getTop() - codechicken.nei.recipe.RecipeInfo.getGuiOffset(gui)[1]))) && (usage ? GuiUsageRecipe.openRecipeGui(((GT_GUIContainer_FusionReactor) gui).mNEI, new Object[0]) : GuiCraftingRecipe.openRecipeGui(((GT_GUIContainer_FusionReactor) gui).mNEI, new Object[0])); + }*/ + return false; + } + + @Override + public List<String> handleItemDisplayName(final GuiContainer gui, final ItemStack itemstack, final List<String> currenttip) { + return currenttip; + } + + @Override + public List<String> handleItemTooltip(final GuiContainer gui, final ItemStack itemstack, final int mousex, final int mousey, final List<String> currenttip) { + return currenttip; + } + + @Override + public boolean keyTyped(final GuiContainer gui, final char keyChar, final int keyCode) { + return false; + } + + @Override + public void onKeyTyped(final GuiContainer gui, final char keyChar, final int keyID) { + } + + @Override + public void onMouseClicked(final GuiContainer gui, final int mousex, final int mousey, final int button) { + } + + @Override + public void onMouseUp(final GuiContainer gui, final int mousex, final int mousey, final int button) { + } + + @Override + public boolean mouseScrolled(final GuiContainer gui, final int mousex, final int mousey, final int scrolled) { + return false; + } + + @Override + public void onMouseScrolled(final GuiContainer gui, final int mousex, final int mousey, final int scrolled) { + } + + @Override + public void onMouseDragged(final GuiContainer gui, final int mousex, final int mousey, final int button, final long heldTime) { + } + } + + public class FixedPositionedStack + extends PositionedStack { + public final int mChance; + public boolean permutated = false; + + public FixedPositionedStack(final Object object, final int x, final int y) { + this(object, x, y, 0); + } + + public FixedPositionedStack(final Object object, final int x, final int y, final int aChance) { + super(object, x, y, true); + this.mChance = aChance; + } + + @Override + public void generatePermutations() { + if (this.permutated) { + return; + } + final ArrayList<ItemStack> tDisplayStacks = new ArrayList<ItemStack>(); + for (final ItemStack tStack : this.items) { + if (GT_Utility.isStackValid(tStack)) { + if (tStack.getItemDamage() == 32767) { + final List<ItemStack> permutations = codechicken.nei.ItemList.itemMap.get(tStack.getItem()); + if (!permutations.isEmpty()) { + ItemStack stack; + for (final Iterator<ItemStack> i$ = permutations.iterator(); i$.hasNext(); tDisplayStacks.add(GT_Utility.copyAmount(tStack.stackSize, new Object[]{stack}))) { + stack = i$.next(); + } + } else { + final ItemStack base = new ItemStack(tStack.getItem(), tStack.stackSize); + base.stackTagCompound = tStack.stackTagCompound; + tDisplayStacks.add(base); + } + } else { + tDisplayStacks.add(GT_Utility.copy(new Object[]{tStack})); + } + } + } + this.items = (tDisplayStacks.toArray(new ItemStack[0])); + if (this.items.length == 0) { + this.items = new ItemStack[]{new ItemStack(Blocks.fire)}; + } + this.permutated = true; + this.setPermutationToRender(0); + } + } + + public class CachedDefaultRecipe + extends TemplateRecipeHandler.CachedRecipe { + public final GT_Recipe mRecipe; + public final List<PositionedStack> mOutputs = new ArrayList<PositionedStack>(); + public final List<PositionedStack> mInputs = new ArrayList<PositionedStack>(); + + public CachedDefaultRecipe(final GT_Recipe aRecipe) { + super(); + this.mRecipe = aRecipe; + + int tStartIndex = 0; + + if (aRecipe.getRepresentativeInput(tStartIndex) != null) { + this.mInputs.add(new FixedPositionedStack(aRecipe.getRepresentativeInput(tStartIndex), 12, 14)); + } + tStartIndex++; + if (aRecipe.getRepresentativeInput(tStartIndex) != null) { + this.mInputs.add(new FixedPositionedStack(aRecipe.getRepresentativeInput(tStartIndex), 30, 14)); + } + tStartIndex++; + if (aRecipe.getRepresentativeInput(tStartIndex) != null) { + this.mInputs.add(new FixedPositionedStack(aRecipe.getRepresentativeInput(tStartIndex), 48, 14)); + } + tStartIndex++; + + if (aRecipe.mSpecialItems != null) { + this.mInputs.add(new FixedPositionedStack(aRecipe.mSpecialItems, 120, 52)); + } + tStartIndex = 0; + + //Four Output Slots + if (aRecipe.getOutput(tStartIndex) != null) { + this.mOutputs.add(new FixedPositionedStack(aRecipe.getOutput(tStartIndex), 102, 5, aRecipe.getOutputChance(tStartIndex))); + } + tStartIndex++; + if (aRecipe.getOutput(tStartIndex) != null) { + this.mOutputs.add(new FixedPositionedStack(aRecipe.getOutput(tStartIndex), 120, 5, aRecipe.getOutputChance(tStartIndex))); + } + tStartIndex++; + if (aRecipe.getOutput(tStartIndex) != null) { + this.mOutputs.add(new FixedPositionedStack(aRecipe.getOutput(tStartIndex), 102, 23, aRecipe.getOutputChance(tStartIndex))); + } + tStartIndex++; + if (aRecipe.getOutput(tStartIndex) != null) { + this.mOutputs.add(new FixedPositionedStack(aRecipe.getOutput(tStartIndex), 120, 23, aRecipe.getOutputChance(tStartIndex))); + } + tStartIndex++; + + + //New fluid display behaviour when 3 fluid inputs are detected. (Basically a mix of the code below for outputs an the code above for 9 input slots.) + if (aRecipe.mFluidInputs.length >= 1) { + if ((aRecipe.mFluidInputs[0] != null) && (aRecipe.mFluidInputs[0].getFluid() != null)) { + this.mInputs.add(new FixedPositionedStack(GT_Utility.getFluidDisplayStack(aRecipe.mFluidInputs[0], true), 3, 31)); + } + if ((aRecipe.mFluidInputs.length > 1) && (aRecipe.mFluidInputs[1] != null) && (aRecipe.mFluidInputs[1].getFluid() != null)) { + this.mInputs.add(new FixedPositionedStack(GT_Utility.getFluidDisplayStack(aRecipe.mFluidInputs[1], true), 21, 31)); + } + if ((aRecipe.mFluidInputs.length > 2) && (aRecipe.mFluidInputs[2] != null) && (aRecipe.mFluidInputs[2].getFluid() != null)) { + this.mInputs.add(new FixedPositionedStack(GT_Utility.getFluidDisplayStack(aRecipe.mFluidInputs[2], true), 39, 31)); + } + if ((aRecipe.mFluidInputs.length > 3) && (aRecipe.mFluidInputs[3] != null) && (aRecipe.mFluidInputs[3].getFluid() != null)) { + this.mInputs.add(new FixedPositionedStack(GT_Utility.getFluidDisplayStack(aRecipe.mFluidInputs[3], true), 57, 31)); + } + } + + if (aRecipe.mFluidOutputs.length > 0) { + if ((aRecipe.mFluidOutputs[0] != null) && (aRecipe.mFluidOutputs[0].getFluid() != null)) { + this.mOutputs.add(new FixedPositionedStack(GT_Utility.getFluidDisplayStack(aRecipe.mFluidOutputs[0], true), 138, 5)); + } + if ((aRecipe.mFluidOutputs.length > 1) && (aRecipe.mFluidOutputs[1] != null) && (aRecipe.mFluidOutputs[1].getFluid() != null)) { + this.mOutputs.add(new FixedPositionedStack(GT_Utility.getFluidDisplayStack(aRecipe.mFluidOutputs[1], true), 138, 23)); + } + } + } + + @Override + public List<PositionedStack> getIngredients() { + return this.getCycledIngredients(GT_NEI_MillingMachine.this.cycleticks / 10, this.mInputs); + } + + @Override + public PositionedStack getResult() { + return null; + } + + @Override + public List<PositionedStack> getOtherStacks() { + return this.mOutputs; + } + } +} diff --git a/src/Java/gtPlusPlus/nei/NEI_GT_Config.java b/src/Java/gtPlusPlus/nei/NEI_GT_Config.java index 45d406aa96..438ada00ba 100644 --- a/src/Java/gtPlusPlus/nei/NEI_GT_Config.java +++ b/src/Java/gtPlusPlus/nei/NEI_GT_Config.java @@ -4,15 +4,21 @@ 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 gtPlusPlus.xmod.gregtech.common.tileentities.machines.multi.production.chemplant.GregtechMTE_ChemicalPlant; +import gtPlusPlus.api.objects.data.AutoMap; public class NEI_GT_Config implements IConfigureNEI { public static boolean sIsAdded = true; + + private static final AutoMap<String> mUniqueRecipeMapHandling = new AutoMap<String>(); @Override public synchronized void loadConfig() { sIsAdded = false; + + mUniqueRecipeMapHandling.add(Gregtech_Recipe_Map.sChemicalPlantRecipes.mUnlocalizedName); + mUniqueRecipeMapHandling.add(Gregtech_Recipe_Map.sOreMillRecipes.mUnlocalizedName); + for (final CustomRecipeMap tMap : gregtech.api.util.CustomRecipeMap.sMappings) { if (tMap.mNEIAllowed) { new GT_NEI_DefaultHandler(tMap); @@ -20,12 +26,13 @@ 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.sChemicalPlantRecipes.mUnlocalizedName)) { + if (!mUniqueRecipeMapHandling.contains(tMap.mUnlocalizedName)) { new GT_NEI_MultiBlockHandler(tMap); } } } new GT_NEI_FluidReactor(); + new GT_NEI_MillingMachine(); sIsAdded = true; API.registerRecipeHandler(new DecayableRecipeHandler()); API.registerUsageHandler(new DecayableRecipeHandler()); diff --git a/src/Java/gtPlusPlus/plugin/sulfurchem/Core_SulfuricChemistry.java b/src/Java/gtPlusPlus/plugin/sulfurchem/Core_SulfuricChemistry.java index 6da6ddccaa..ed6762c69d 100644 --- a/src/Java/gtPlusPlus/plugin/sulfurchem/Core_SulfuricChemistry.java +++ b/src/Java/gtPlusPlus/plugin/sulfurchem/Core_SulfuricChemistry.java @@ -1,6 +1,5 @@ package gtPlusPlus.plugin.sulfurchem; -import gregtech.api.enums.GT_Values; import gregtech.api.enums.Materials; import gregtech.api.util.GT_Recipe; import gtPlusPlus.api.interfaces.IPlugin; @@ -11,6 +10,7 @@ import gtPlusPlus.core.util.minecraft.FluidUtils; import gtPlusPlus.core.util.minecraft.ItemUtils; import gtPlusPlus.core.util.minecraft.RecipeUtils; import gtPlusPlus.plugin.manager.Core_Manager; +import gtPlusPlus.preloader.CORE_Preloader; import gtPlusPlus.xmod.gregtech.common.StaticFields59; import net.minecraft.item.ItemStack; import net.minecraftforge.fluids.FluidStack; @@ -57,7 +57,7 @@ public class Core_SulfuricChemistry implements IPlugin { int addedNew = addRevisedGT6Recipes(); log("Added "+addedNew+" new Sulfuric Chemistry recipes."); - if (CORE.DEVENV || CORE.DEBUG) { + if (CORE.DEVENV || CORE_Preloader.DEBUG_MODE) { for (int i=0;i<2;i++) { for (GT_Recipe m : mRemovedRecipes1) { String[] mInfo = RecipeUtils.getRecipeInfo(m); diff --git a/src/Java/gtPlusPlus/preloader/CORE_Preloader.java b/src/Java/gtPlusPlus/preloader/CORE_Preloader.java index b8ebdaf49c..49209307f7 100644 --- a/src/Java/gtPlusPlus/preloader/CORE_Preloader.java +++ b/src/Java/gtPlusPlus/preloader/CORE_Preloader.java @@ -1,14 +1,33 @@ package gtPlusPlus.preloader; +import java.io.File; import java.util.ArrayList; -import java.util.Arrays; +import java.util.Collections; import java.util.List; +import cpw.mods.fml.common.versioning.ArtifactVersion; + public class CORE_Preloader { + public static final String NAME = "GT++ Preloader"; public static final String MODID = "GT++_Preloader"; - public static final String VERSION = "0.4-Beta"; + public static final String VERSION = "0.5-Beta"; + public static final List<ArtifactVersion> DEPENDENCIES; + public static final String JAVA_VERSION = System.getProperty("java.version"); + + public static File MC_DIR; + public static boolean DEV_ENVIRONMENT = false; + public static boolean DEBUG_MODE = false; public static boolean enableOldGTcircuits = false; public static int enableWatchdogBGM = 0; - public static List<?> DEPENDENCIES = new ArrayList<>(Arrays.asList(new String[] {"required-before:gregtech;"})); + + public static void setMinecraftDirectory(File aDir) { + MC_DIR = aDir; + } + + static { + ArrayList<ArtifactVersion> deps = new ArrayList<ArtifactVersion>(); + //deps.add("required-before:gregtech;"); + DEPENDENCIES = Collections.unmodifiableList(deps); + } } diff --git a/src/Java/gtPlusPlus/preloader/DevHelper.java b/src/Java/gtPlusPlus/preloader/DevHelper.java index 81d36d591b..70a3c53073 100644 --- a/src/Java/gtPlusPlus/preloader/DevHelper.java +++ b/src/Java/gtPlusPlus/preloader/DevHelper.java @@ -5,7 +5,6 @@ import java.lang.reflect.Method; import java.util.HashMap; import java.util.Map; -import gtPlusPlus.api.objects.Logger; import gtPlusPlus.api.objects.data.Pair; import gtPlusPlus.api.objects.data.weakref.WeakAutoMap; import gtPlusPlus.core.util.reflect.ReflectionUtils; @@ -118,7 +117,7 @@ public class DevHelper { String aForgeName = DevHelperInternals.srgToForge.get(mSrgName); return aForgeName != null ? aForgeName : "BAD_FORGE_NAME"; } - + public static String getMinecraftClassName(String adeObName, boolean obfuscated) { if (obfuscated) { return getObfuscated(adeObName); @@ -130,7 +129,7 @@ public class DevHelper { String obfuscatedClassname = DevHelperInternals.deObToOb.get(mDeob); obfuscatedClassname = obfuscatedClassname != null ? obfuscatedClassname : "BAD_OBFUSCATED_CLASS_NAME"; if (obfuscatedClassname.equals("BAD_OBFUSCATED_CLASS_NAME")) { - Logger.INFO("[Fix] Failed to Get Deobfuscated name for "+mDeob); + Preloader_Logger.INFO("[Fix] Failed to Get Deobfuscated name for "+mDeob); } return obfuscatedClassname; } @@ -139,15 +138,15 @@ public class DevHelper { String deobfuscatedClassname = DevHelperInternals.obToDeOb.get(mOb); return deobfuscatedClassname != null ? deobfuscatedClassname : "BAD_DEOBFUSCATED_CLASS_NAME"; } - + public static class DevHelperInternals { - public static Map<String, String> srgToForge = new HashMap<String, String>(); - public static Map<String, String> forgeToSrg = new HashMap<String, String>(); + public static final Map<String, String> srgToForge = new HashMap<String, String>(); + public static final Map<String, String> forgeToSrg = new HashMap<String, String>(); private static WeakAutoMap<Pair<String, String>> mInitMap = new WeakAutoMap<Pair<String, String>>(); //Obfuscation - public static Map<String, String> obToDeOb = new HashMap<String, String>(); - public static Map<String, String> deObToOb = new HashMap<String, String>(); + public static final Map<String, String> obToDeOb = new HashMap<String, String>(); + public static final Map<String, String> deObToOb = new HashMap<String, String>(); private static WeakAutoMap<Pair<String, String>> mObInitMap = new WeakAutoMap<Pair<String, String>>(); private static boolean init() { @@ -176,14 +175,90 @@ public class DevHelper { } } } - Logger.INFO("[DevHelper] mInitMap size: "+mInitMap.size()); - Logger.INFO("[DevHelper] mObInitMap size: "+mObInitMap.size()); + Preloader_Logger.INFO("[DevHelper] mInitMap size: "+mInitMap.size()); + Preloader_Logger.INFO("[DevHelper] mObInitMap size: "+mObInitMap.size()); + + Preloader_Logger.INFO("[DevHelper] srgToForge size: "+srgToForge.size()); + Preloader_Logger.INFO("[DevHelper] forgeToSrg size: "+forgeToSrg.size()); + Preloader_Logger.INFO("[DevHelper] obToDeOb size: "+obToDeOb.size()); + Preloader_Logger.INFO("[DevHelper] deObToOb size: "+deObToOb.size()); + + if (srgToForge.size() > 0 && forgeToSrg.size() > 0 && obToDeOb.size() > 0 && deObToOb.size() > 0) { + if (srgToForge.size() == forgeToSrg.size() && obToDeOb.size() == deObToOb.size()) { + return true; + } + else { + if (srgToForge.size() != forgeToSrg.size()) { + int aKey1 = 0; + int aKey2 = 0; + HashMap<Integer, String> aMissingForgeNames = new HashMap<Integer, String>(); + HashMap<Integer, String> aMissingSrgNames = new HashMap<Integer, String>(); + Preloader_Logger.INFO("Mismatch between mapped Forge and Srg names, finding missing values."); + if (srgToForge.size() > forgeToSrg.size()) { + Preloader_Logger.INFO("More SRG Keys detected."); + for (String aKey : srgToForge.keySet()) { + if (!forgeToSrg.containsValue(aKey)) { + aMissingSrgNames.put(aKey1++, aKey); + } + } + } + else if (srgToForge.size() < forgeToSrg.size()) { + Preloader_Logger.INFO("More Forge Keys detected."); + for (String aKey : forgeToSrg.keySet()) { + if (!srgToForge.containsValue(aKey)) { + aMissingForgeNames.put(aKey2++, aKey); + } + } + } + if (!aMissingForgeNames.isEmpty()) { + for (String missingVal : aMissingForgeNames.values()) { + //Preloader_Logger.WARNING("Missing Forge value: "+missingVal); + } + } + if (!aMissingSrgNames.isEmpty()) { + for (String missingVal : aMissingSrgNames.values()) { + //Preloader_Logger.WARNING("Missing SRG value: "+missingVal); + } + } + } + if (obToDeOb.size() != deObToOb.size()) { + int aKey1 = 0; + int aKey2 = 0; + HashMap<Integer, String> aMissingObfNames = new HashMap<Integer, String>(); + HashMap<Integer, String> aMissingDeObfNames = new HashMap<Integer, String>(); + Preloader_Logger.INFO("Mismatch between mapped Obfuscated and Deobfuscated names, finding missing values."); + if (obToDeOb.size() > deObToOb.size()) { + Preloader_Logger.INFO("More Obfuscated Keys detected."); + for (String aKey : obToDeOb.keySet()) { + if (!deObToOb.containsValue(aKey)) { + aMissingObfNames.put(aKey1++, aKey); + } + } + } + else if (obToDeOb.size() < deObToOb.size()) { + Preloader_Logger.INFO("More Deobfuscated Keys detected."); + for (String aKey : deObToOb.keySet()) { + if (!obToDeOb.containsValue(aKey)) { + aMissingDeObfNames.put(aKey2++, aKey); + } + } + } + if (!aMissingObfNames.isEmpty()) { + for (String missingVal : aMissingObfNames.values()) { + Preloader_Logger.WARNING("Missing Obfuscated value: "+missingVal); + } + } + if (!aMissingDeObfNames.isEmpty()) { + for (String missingVal : aMissingDeObfNames.values()) { + Preloader_Logger.WARNING("Missing Deobfuscated value: "+missingVal); + } + } + } + } + } - Logger.INFO("[DevHelper] srgToForge size: "+srgToForge.size()); - Logger.INFO("[DevHelper] forgeToSrg size: "+forgeToSrg.size()); - Logger.INFO("[DevHelper] obToDeOb size: "+obToDeOb.size()); - Logger.INFO("[DevHelper] deObToOb size: "+deObToOb.size()); - return srgToForge.size() > 0 && forgeToSrg.size() > 0 && obToDeOb.size() > 0 && deObToOb.size() > 0; + // return true anyway as some keys will mismatch. + return true; } private static void init1() { @@ -5029,7 +5104,7 @@ public class DevHelper { mObInitMap.put(new Pair<String, String>("bmg", "net/minecraft/client/shader/Framebuffer")); mObInitMap.put(new Pair<String, String>("na", "net/minecraft/client/network/NetHandlerHandshakeMemory")); mObInitMap - .put(new Pair<String, String>("jb", "net/minecraft/network/play/client/C02PacketUseEntity$Action")); + .put(new Pair<String, String>("jb", "net/minecraft/network/play/client/C02PacketUseEntity$Action")); mObInitMap.put(new Pair<String, String>("fc", "net/minecraft/util/MessageDeserializer2")); mObInitMap.put(new Pair<String, String>("bd", "net/minecraft/command/server/CommandPardonIp")); mObInitMap.put(new Pair<String, String>("amw", "net/minecraft/block/BlockPumpkin")); @@ -5104,7 +5179,7 @@ public class DevHelper { mObInitMap.put(new Pair<String, String>("tl", "net/minecraft/entity/ai/attributes/BaseAttributeMap")); mObInitMap.put(new Pair<String, String>("pm", "net/minecraft/stats/IStatType")); mObInitMap - .put(new Pair<String, String>("atc", "net/minecraft/world/gen/structure/StructureMineshaftStart")); + .put(new Pair<String, String>("atc", "net/minecraft/world/gen/structure/StructureMineshaftStart")); mObInitMap.put(new Pair<String, String>("apd", "net/minecraft/tileentity/TileEntityEnchantmentTable")); mObInitMap.put(new Pair<String, String>("ale", "net/minecraft/block/BlockFurnace")); mObInitMap.put(new Pair<String, String>("adg", "net/minecraft/item/ItemLeaves")); @@ -5112,7 +5187,7 @@ public class DevHelper { mObInitMap.put(new Pair<String, String>("axb", "net/minecraft/world/gen/layer/GenLayerAddIsland")); mObInitMap.put(new Pair<String, String>("bpg", "net/minecraft/client/util/JsonBlendingMode")); mObInitMap - .put(new Pair<String, String>("net/minecraft/realms/RealmsMth", "net/minecraft/realms/RealmsMth")); + .put(new Pair<String, String>("net/minecraft/realms/RealmsMth", "net/minecraft/realms/RealmsMth")); mObInitMap.put(new Pair<String, String>("qa", "net/minecraft/util/IntHashMap$Entry")); mObInitMap.put(new Pair<String, String>("mb", "net/minecraft/server/gui/MinecraftServerGui$3")); mObInitMap.put( @@ -5262,13 +5337,13 @@ public class DevHelper { mObInitMap.put(new Pair<String, String>("aaw", "net/minecraft/inventory/InventoryCraftResult")); mObInitMap.put(new Pair<String, String>("w", "net/minecraft/client/audio/SoundCategory")); mObInitMap - .put(new Pair<String, String>("bqv", "net/minecraft/client/resources/IReloadableResourceManager")); + .put(new Pair<String, String>("bqv", "net/minecraft/client/resources/IReloadableResourceManager")); mObInitMap.put(new Pair<String, String>("baz", "net/minecraft/client/Minecraft$3")); mObInitMap.put(new Pair<String, String>("bey", "net/minecraft/client/gui/GuiRepair")); mObInitMap.put(new Pair<String, String>("bix", "net/minecraft/client/model/ModelRenderer")); mObInitMap.put(new Pair<String, String>("bmw", "net/minecraft/client/renderer/culling/ClippingHelperImpl")); mObInitMap - .put(new Pair<String, String>("fs", "net/minecraft/util/ChatComponentTranslationFormatException")); + .put(new Pair<String, String>("fs", "net/minecraft/util/ChatComponentTranslationFormatException")); mObInitMap.put(new Pair<String, String>("bt", "net/minecraft/command/server/CommandStop")); mObInitMap.put(new Pair<String, String>("yy", "net/minecraft/entity/player/InventoryPlayer$1")); mObInitMap.put(new Pair<String, String>("uz", "net/minecraft/entity/ai/EntityAIPanic")); @@ -5290,7 +5365,7 @@ public class DevHelper { mObInitMap.put( new Pair<String, String>("np", "net/minecraft/server/network/NetHandlerLoginServer$LoginState")); mObInitMap - .put(new Pair<String, String>("jq", "net/minecraft/network/handshake/INetHandlerHandshakeServer")); + .put(new Pair<String, String>("jq", "net/minecraft/network/handshake/INetHandlerHandshakeServer")); mObInitMap.put(new Pair<String, String>("fr", "net/minecraft/util/ChatComponentTranslation")); mObInitMap.put(new Pair<String, String>("arf", "net/minecraft/world/gen/feature/WorldGenBlockBlob")); mObInitMap.put(new Pair<String, String>("ang", "net/minecraft/block/BlockRotatedPillar")); @@ -5300,7 +5375,7 @@ public class DevHelper { mObInitMap.put(new Pair<String, String>("ave", "net/minecraft/world/gen/structure/MapGenStructure")); mObInitMap.put(new Pair<String, String>("azd", "net/minecraft/client/AnvilConverterException")); mObInitMap - .put(new Pair<String, String>("net/minecraft/client/main/Main", "net/minecraft/client/main/Main")); + .put(new Pair<String, String>("net/minecraft/client/main/Main", "net/minecraft/client/main/Main")); mObInitMap.put(new Pair<String, String>("bri", "net/minecraft/client/resources/SimpleResource")); mObInitMap.put(new Pair<String, String>("bfl", "net/minecraft/client/gui/inventory/GuiContainerCreative")); mObInitMap.put(new Pair<String, String>("bjk", "net/minecraft/client/entity/EntityClientPlayerMP")); @@ -5310,7 +5385,7 @@ public class DevHelper { mObInitMap.put(new Pair<String, String>("od", "net/minecraft/server/management/PreYggdrasilConverter$4")); mObInitMap.put(new Pair<String, String>("ke", "net/minecraft/network/ServerStatusResponse$Serializer")); mObInitMap - .put(new Pair<String, String>("gf", "net/minecraft/network/play/server/S35PacketUpdateTileEntity")); + .put(new Pair<String, String>("gf", "net/minecraft/network/play/server/S35PacketUpdateTileEntity")); mObInitMap.put(new Pair<String, String>("cg", "net/minecraft/command/PlayerNotFoundException")); mObInitMap.put(new Pair<String, String>("ary", "net/minecraft/world/gen/feature/WorldGenGlowStone1")); mObInitMap.put(new Pair<String, String>("anz", "net/minecraft/block/BlockTallGrass")); @@ -5353,7 +5428,7 @@ public class DevHelper { mObInitMap.put(new Pair<String, String>("btc", "net/minecraft/client/network/LanServerDetector$ThreadLanServerFind")); mObInitMap - .put(new Pair<String, String>("bpd", "net/minecraft/client/renderer/tileentity/RenderWitherSkull")); + .put(new Pair<String, String>("bpd", "net/minecraft/client/renderer/tileentity/RenderWitherSkull")); mObInitMap.put(new Pair<String, String>("bhf", "net/minecraft/client/model/ModelBook")); mObInitMap.put(new Pair<String, String>("ble", "net/minecraft/client/particle/EntityFishWakeFX")); mObInitMap.put(new Pair<String, String>("ea", "net/minecraft/nbt/NBTException")); @@ -5397,11 +5472,11 @@ public class DevHelper { mObInitMap.put(new Pair<String, String>("aye", "net/minecraft/pathfinding/PathPoint")); mObInitMap.put(new Pair<String, String>("bbc", "net/minecraft/client/Minecraft$6")); mObInitMap - .put(new Pair<String, String>("bfb", "net/minecraft/client/gui/inventory/GuiBeacon$ConfirmButton")); + .put(new Pair<String, String>("bfb", "net/minecraft/client/gui/inventory/GuiBeacon$ConfirmButton")); mObInitMap.put(new Pair<String, String>("bui", "net/minecraft/client/stream/IngestServerTester")); mObInitMap.put(new Pair<String, String>("bqj", "net/minecraft/client/renderer/texture/ITickable")); mObInitMap - .put(new Pair<String, String>("zb", "net/minecraft/entity/player/EntityPlayer$EnumChatVisibility")); + .put(new Pair<String, String>("zb", "net/minecraft/entity/player/EntityPlayer$EnumChatVisibility")); mObInitMap.put(new Pair<String, String>("vc", "net/minecraft/entity/ai/EntityAIWander")); mObInitMap.put(new Pair<String, String>("rd", "net/minecraft/world/EnumDifficulty")); mObInitMap.put(new Pair<String, String>("ne", "net/minecraft/network/NetworkSystem$2")); @@ -5428,7 +5503,7 @@ public class DevHelper { mObInitMap.put(new Pair<String, String>("brq", "net/minecraft/client/resources/Language")); mObInitMap.put(new Pair<String, String>("bbu", "net/minecraft/client/gui/FontRenderer")); mObInitMap - .put(new Pair<String, String>("bft", "net/minecraft/client/gui/inventory/GuiScreenHorseInventory")); + .put(new Pair<String, String>("bft", "net/minecraft/client/gui/inventory/GuiScreenHorseInventory")); mObInitMap.put(new Pair<String, String>("bjs", "net/minecraft/client/network/OldServerPinger$2")); mObInitMap.put(new Pair<String, String>("bnr", "net/minecraft/client/renderer/entity/RenderFireball")); mObInitMap.put(new Pair<String, String>("sk", "net/minecraft/command/IEntitySelector$1")); @@ -5554,14 +5629,14 @@ public class DevHelper { "net/minecraft/world/gen/structure/StructureStrongholdPieces$Straight")); mObInitMap.put(new Pair<String, String>("bnz", "net/minecraft/client/renderer/entity/RenderItem$1")); mObInitMap - .put(new Pair<String, String>("gv", "net/minecraft/network/play/server/S2BPacketChangeGameState")); + .put(new Pair<String, String>("gv", "net/minecraft/network/play/server/S2BPacketChangeGameState")); mObInitMap.put(new Pair<String, String>("cw", "net/minecraft/util/RegistryNamespaced")); mObInitMap.put(new Pair<String, String>("net/minecraft/realms/RealmsScrolledSelectionList", "net/minecraft/realms/RealmsScrolledSelectionList")); mObInitMap.put(new Pair<String, String>("aru", "net/minecraft/world/gen/feature/WorldGenBigMushroom")); mObInitMap.put(new Pair<String, String>("anv", "net/minecraft/block/BlockStone")); mObInitMap - .put(new Pair<String, String>("afx", "net/minecraft/enchantment/EnchantmentHelper$DamageIterator")); + .put(new Pair<String, String>("afx", "net/minecraft/enchantment/EnchantmentHelper$DamageIterator")); mObInitMap.put(new Pair<String, String>("ajw", "net/minecraft/block/BlockCauldron")); mObInitMap.put( new Pair<String, String>("avt", "net/minecraft/world/gen/structure/StructureVillagePieces$Torch")); @@ -5569,7 +5644,7 @@ public class DevHelper { mObInitMap.put(new Pair<String, String>("bcq", "net/minecraft/client/gui/GuiScreenRealmsProxy")); mObInitMap.put(new Pair<String, String>("bgp", "net/minecraft/client/gui/stream/GuiStreamUnavailable")); mObInitMap - .put(new Pair<String, String>("brx", "net/minecraft/client/resources/data/IMetadataSerializer$1")); + .put(new Pair<String, String>("brx", "net/minecraft/client/resources/data/IMetadataSerializer$1")); mObInitMap.put(new Pair<String, String>("wq", "net/minecraft/entity/passive/EntitySheep$1")); mObInitMap.put(new Pair<String, String>("sr", "net/minecraft/entity/EntityFlying")); mObInitMap.put(new Pair<String, String>("os", "net/minecraft/server/management/UserListWhitelistEntry")); @@ -5635,7 +5710,7 @@ public class DevHelper { "net/minecraft/world/gen/structure/ComponentScatteredFeaturePieces$JunglePyramid")); mObInitMap.put(new Pair<String, String>("ayb", "net/minecraft/world/gen/layer/GenLayerVoronoiZoom")); mObInitMap - .put(new Pair<String, String>("buf", "net/minecraft/client/stream/ChatController$SwitchChatState")); + .put(new Pair<String, String>("buf", "net/minecraft/client/stream/ChatController$SwitchChatState")); mObInitMap.put(new Pair<String, String>("bqg", "net/minecraft/client/renderer/texture/TextureManager$1")); mObInitMap.put(new Pair<String, String>("bii", "net/minecraft/client/model/PositionTextureVertex")); mObInitMap.put(new Pair<String, String>("bmh", "net/minecraft/client/renderer/Tessellator")); @@ -5670,7 +5745,7 @@ public class DevHelper { mObInitMap.put(new Pair<String, String>("net/minecraft/realms/RealmsLevelSummary", "net/minecraft/realms/RealmsLevelSummary")); mObInitMap - .put(new Pair<String, String>("gk", "net/minecraft/network/play/server/S22PacketMultiBlockChange")); + .put(new Pair<String, String>("gk", "net/minecraft/network/play/server/S22PacketMultiBlockChange")); mObInitMap.put(new Pair<String, String>("cl", "net/minecraft/block/BlockSourceImpl")); mObInitMap.put(new Pair<String, String>("vr", "net/minecraft/entity/ai/EntityAITargetNonTamed")); mObInitMap.put(new Pair<String, String>("rs", "net/minecraft/potion/PotionAttackDamage")); @@ -5688,7 +5763,7 @@ public class DevHelper { mObInitMap.put(new Pair<String, String>("gj", "net/minecraft/network/play/server/S02PacketChat")); mObInitMap.put(new Pair<String, String>("acb", "net/minecraft/creativetab/CreativeTabs$5")); mObInitMap - .put(new Pair<String, String>("aga", "net/minecraft/enchantment/EnchantmentHelper$ModifierLiving")); + .put(new Pair<String, String>("aga", "net/minecraft/enchantment/EnchantmentHelper$ModifierLiving")); mObInitMap.put( new Pair<String, String>("bsa", "net/minecraft/client/resources/data/AnimationMetadataSection")); mObInitMap.put(new Pair<String, String>("bkc", "net/minecraft/client/particle/EntityFireworkOverlayFX")); @@ -5710,7 +5785,7 @@ public class DevHelper { mObInitMap.put(new Pair<String, String>("po", "net/minecraft/util/IJsonSerializable")); mObInitMap.put(new Pair<String, String>("lp", "net/minecraft/scoreboard/ServerScoreboard")); mObInitMap - .put(new Pair<String, String>("hq", "net/minecraft/network/play/server/S13PacketDestroyEntities")); + .put(new Pair<String, String>("hq", "net/minecraft/network/play/server/S13PacketDestroyEntities")); mObInitMap.put(new Pair<String, String>("dr", "net/minecraft/nbt/NBTTagLong")); mObInitMap.put(new Pair<String, String>("adi", "net/minecraft/item/ItemBucketMilk")); mObInitMap.put(new Pair<String, String>("ahh", "net/minecraft/world/IWorldAccess")); @@ -5812,7 +5887,7 @@ public class DevHelper { mObInitMap.put(new Pair<String, String>("acj", "net/minecraft/item/ItemDye")); mObInitMap.put(new Pair<String, String>("agi", "net/minecraft/enchantment/EnchantmentProtection")); mObInitMap - .put(new Pair<String, String>("bsi", "net/minecraft/client/resources/data/TextureMetadataSection")); + .put(new Pair<String, String>("bsi", "net/minecraft/client/resources/data/TextureMetadataSection")); mObInitMap.put(new Pair<String, String>("bcm", "net/minecraft/client/gui/GuiSlot")); mObInitMap.put(new Pair<String, String>("bgl", "net/minecraft/client/gui/GuiResourcePackSelected")); mObInitMap.put(new Pair<String, String>("bkk", "net/minecraft/client/particle/EntityLavaFX")); @@ -5832,7 +5907,7 @@ public class DevHelper { mObInitMap.put(new Pair<String, String>("xa", "net/minecraft/entity/boss/EntityDragon")); mObInitMap.put(new Pair<String, String>("tb", "net/minecraft/entity/item/EntityPainting")); mObInitMap - .put(new Pair<String, String>("asx", "net/minecraft/world/gen/structure/StructureMineshaftPieces")); + .put(new Pair<String, String>("asx", "net/minecraft/world/gen/structure/StructureMineshaftPieces")); mObInitMap.put(new Pair<String, String>("aoy", "net/minecraft/tileentity/TileEntityCommandBlock$1")); mObInitMap.put(new Pair<String, String>("akz", "net/minecraft/block/BlockFence")); mObInitMap.put(new Pair<String, String>("aww", "net/minecraft/block/material/MaterialPortal")); @@ -5861,7 +5936,7 @@ public class DevHelper { "net/minecraft/realms/RealmsServerStatusPinger")); mObInitMap.put(new Pair<String, String>("mk", "net/minecraft/world/demo/DemoWorldServer")); mObInitMap - .put(new Pair<String, String>("il", "net/minecraft/network/play/server/S20PacketEntityProperties")); + .put(new Pair<String, String>("il", "net/minecraft/network/play/server/S20PacketEntityProperties")); mObInitMap.put(new Pair<String, String>("em", "net/minecraft/network/NetworkManager$3")); mObInitMap.put(new Pair<String, String>("an", "net/minecraft/command/server/CommandEmote")); mObInitMap.put(new Pair<String, String>("aqa", "net/minecraft/world/chunk/storage/NibbleArrayReader")); @@ -5997,12 +6072,12 @@ public class DevHelper { mObInitMap.put(new Pair<String, String>("axr", "net/minecraft/world/gen/layer/GenLayerHills")); mObInitMap.put(new Pair<String, String>("bap", "net/minecraft/client/Minecraft$1")); mObInitMap - .put(new Pair<String, String>("beo", "net/minecraft/client/gui/achievement/GuiStats$StatsItem$1")); + .put(new Pair<String, String>("beo", "net/minecraft/client/gui/achievement/GuiStats$StatsItem$1")); mObInitMap.put(new Pair<String, String>("bin", "net/minecraft/client/model/ModelWither")); mObInitMap.put(new Pair<String, String>("bmm", "net/minecraft/client/renderer/tileentity/TileEntityChestRenderer")); mObInitMap - .put(new Pair<String, String>("jh", "net/minecraft/network/play/client/C13PacketPlayerAbilities")); + .put(new Pair<String, String>("jh", "net/minecraft/network/play/client/C13PacketPlayerAbilities")); mObInitMap.put(new Pair<String, String>("fi", "net/minecraft/event/ClickEvent$Action")); mObInitMap.put(new Pair<String, String>("bj", "net/minecraft/command/server/CommandSaveOn")); mObInitMap.put(new Pair<String, String>("yo", "net/minecraft/entity/monster/EntitySpider$GroupData")); @@ -6058,7 +6133,7 @@ public class DevHelper { mObInitMap.put(new Pair<String, String>("avm", "net/minecraft/world/gen/structure/StructureStart")); mObInitMap.put(new Pair<String, String>("bcj", "net/minecraft/client/gui/GuiOptionButton")); mObInitMap - .put(new Pair<String, String>("bgi", "net/minecraft/client/resources/ResourcePackListEntryFound")); + .put(new Pair<String, String>("bgi", "net/minecraft/client/resources/ResourcePackListEntryFound")); mObInitMap.put(new Pair<String, String>("bkh", "net/minecraft/client/particle/EntityHeartFX")); mObInitMap.put(new Pair<String, String>("bog", "net/minecraft/client/renderer/entity/RenderLightningBolt")); mObInitMap.put(new Pair<String, String>("lb", "net/minecraft/client/util/JsonException")); @@ -6153,7 +6228,7 @@ public class DevHelper { mObInitMap.put(new Pair<String, String>("sa", "net/minecraft/entity/Entity")); mObInitMap.put(new Pair<String, String>("ob", "net/minecraft/server/management/PreYggdrasilConverter$2")); mObInitMap - .put(new Pair<String, String>("kc", "net/minecraft/network/ServerStatusResponse$PlayerCountData")); + .put(new Pair<String, String>("kc", "net/minecraft/network/ServerStatusResponse$PlayerCountData")); mObInitMap.put(new Pair<String, String>("gd", "net/minecraft/network/play/server/S37PacketStatistics")); mObInitMap.put(new Pair<String, String>("ce", "net/minecraft/command/NumberInvalidException")); mObInitMap.put(new Pair<String, String>("net/minecraft/realms/Realms", "net/minecraft/realms/Realms")); @@ -6223,7 +6298,7 @@ public class DevHelper { mObInitMap.put(new Pair<String, String>("axo", "net/minecraft/world/gen/layer/GenLayer$1")); mObInitMap.put(new Pair<String, String>("bam", "net/minecraft/client/renderer/RenderHelper")); mObInitMap - .put(new Pair<String, String>("bel", "net/minecraft/client/gui/achievement/GuiStats$StatsBlock$1")); + .put(new Pair<String, String>("bel", "net/minecraft/client/gui/achievement/GuiStats$StatsBlock$1")); mObInitMap.put(new Pair<String, String>("bik", "net/minecraft/client/model/ModelVillager")); mObInitMap.put(new Pair<String, String>("bmj", "net/minecraft/client/renderer/tileentity/TileEntityBeaconRenderer")); @@ -6289,12 +6364,12 @@ public class DevHelper { mObInitMap.put(new Pair<String, String>("wg", "net/minecraft/entity/passive/EntityChicken")); mObInitMap.put(new Pair<String, String>("sh", "net/minecraft/entity/EntityList$EntityEggInfo")); mObInitMap - .put(new Pair<String, String>("oi", "net/minecraft/server/management/ServerConfigurationManager")); + .put(new Pair<String, String>("oi", "net/minecraft/server/management/ServerConfigurationManager")); mObInitMap.put(new Pair<String, String>("kj", "net/minecraft/network/status/client/C00PacketServerQuery")); mObInitMap.put(new Pair<String, String>("aka", "net/minecraft/block/BlockColored")); mObInitMap.put(new Pair<String, String>("acc", "net/minecraft/creativetab/CreativeTabs$6")); mObInitMap - .put(new Pair<String, String>("agb", "net/minecraft/enchantment/EnchantmentHelper$ModifierDamage")); + .put(new Pair<String, String>("agb", "net/minecraft/enchantment/EnchantmentHelper$ModifierDamage")); mObInitMap.put(new Pair<String, String>("bsb", "net/minecraft/client/resources/data/AnimationMetadataSectionSerializer")); mObInitMap.put(new Pair<String, String>("bkd", "net/minecraft/client/particle/EntityFireworkSparkFX")); @@ -6333,7 +6408,7 @@ public class DevHelper { mObInitMap.put( new Pair<String, String>("net/minecraft/realms/Tezzelator", "net/minecraft/realms/Tezzelator")); mObInitMap - .put(new Pair<String, String>("ate", "net/minecraft/world/gen/structure/MapGenNetherBridge$Start")); + .put(new Pair<String, String>("ate", "net/minecraft/world/gen/structure/MapGenNetherBridge$Start")); mObInitMap.put(new Pair<String, String>("apf", "net/minecraft/tileentity/TileEntityFlowerPot")); mObInitMap.put(new Pair<String, String>("alg", "net/minecraft/block/BlockGlowstone")); mObInitMap.put(new Pair<String, String>("axd", "net/minecraft/world/gen/layer/GenLayerAddSnow")); @@ -6370,7 +6445,7 @@ public class DevHelper { mObInitMap.put(new Pair<String, String>("vi", "net/minecraft/entity/ai/EntityAICreeperSwell")); mObInitMap.put(new Pair<String, String>("rj", "net/minecraft/profiler/PlayerUsageSnooper$1")); mObInitMap - .put(new Pair<String, String>("nk", "net/minecraft/network/NetHandlerPlayServer$SwitchEnumState")); + .put(new Pair<String, String>("nk", "net/minecraft/network/NetHandlerPlayServer$SwitchEnumState")); mObInitMap.put(new Pair<String, String>("jl", "net/minecraft/network/play/client/C09PacketHeldItemChange")); mObInitMap.put(new Pair<String, String>("fm", "net/minecraft/event/HoverEvent$Action")); mObInitMap.put(new Pair<String, String>("bn", "net/minecraft/command/server/CommandSetDefaultSpawnpoint")); @@ -6438,7 +6513,7 @@ public class DevHelper { mObInitMap.put(new Pair<String, String>("bdb", "net/minecraft/client/gui/GuiCreateWorld")); mObInitMap.put(new Pair<String, String>("ly", "net/minecraft/server/gui/MinecraftServerGui")); mObInitMap - .put(new Pair<String, String>("hz", "net/minecraft/network/play/server/S04PacketEntityEquipment")); + .put(new Pair<String, String>("hz", "net/minecraft/network/play/server/S04PacketEntityEquipment")); mObInitMap.put(new Pair<String, String>("asy", "net/minecraft/world/gen/structure/StructureMineshaftPieces$Corridor")); mObInitMap.put(new Pair<String, String>("aoz", "net/minecraft/tileentity/TileEntityComparator")); @@ -6482,7 +6557,7 @@ public class DevHelper { mObInitMap.put(new Pair<String, String>("bud", "net/minecraft/client/stream/BroadcastController$BroadcastListener")); mObInitMap - .put(new Pair<String, String>("bqe", "net/minecraft/client/renderer/texture/TextureAtlasSprite$1")); + .put(new Pair<String, String>("bqe", "net/minecraft/client/renderer/texture/TextureAtlasSprite$1")); mObInitMap.put(new Pair<String, String>("beh", "net/minecraft/client/gui/achievement/GuiAchievement")); mObInitMap.put(new Pair<String, String>("big", "net/minecraft/client/model/ModelSpider")); mObInitMap.put(new Pair<String, String>("ja", "net/minecraft/network/play/client/C02PacketUseEntity")); @@ -6662,7 +6737,7 @@ public class DevHelper { mObInitMap.put(new Pair<String, String>("bgj", "net/minecraft/client/gui/GuiResourcePackAvailable")); mObInitMap.put(new Pair<String, String>("bki", "net/minecraft/client/particle/EntityLargeExplodeFX")); mObInitMap - .put(new Pair<String, String>("boh", "net/minecraft/client/renderer/entity/RendererLivingEntity")); + .put(new Pair<String, String>("boh", "net/minecraft/client/renderer/entity/RendererLivingEntity")); mObInitMap.put(new Pair<String, String>("lc", "net/minecraft/client/util/JsonException$1")); mObInitMap.put(new Pair<String, String>("hd", "net/minecraft/network/play/server/S01PacketJoinGame")); mObInitMap.put(new Pair<String, String>("de", "net/minecraft/util/StringTranslate")); @@ -6731,7 +6806,7 @@ public class DevHelper { mObInitMap.put(new Pair<String, String>("bbm", "net/minecraft/client/settings/GameSettings$Options")); mObInitMap.put(new Pair<String, String>("bus", "net/minecraft/realms/RealmsConnect$1")); mObInitMap - .put(new Pair<String, String>("bqt", "net/minecraft/client/resources/FoliageColorReloadListener")); + .put(new Pair<String, String>("bqt", "net/minecraft/client/resources/FoliageColorReloadListener")); mObInitMap.put(new Pair<String, String>("zl", "net/minecraft/entity/projectile/EntityEgg")); mObInitMap.put(new Pair<String, String>("vm", "net/minecraft/entity/ai/EntityAIDefendVillage")); mObInitMap.put(new Pair<String, String>("rn", "net/minecraft/util/CombatTracker")); @@ -6795,7 +6870,7 @@ public class DevHelper { mObInitMap.put(new Pair<String, String>("pi", "net/minecraft/stats/StatBase$1")); mObInitMap.put(new Pair<String, String>("lj", "net/minecraft/server/MinecraftServer$3")); mObInitMap - .put(new Pair<String, String>("hk", "net/minecraft/network/play/server/S39PacketPlayerAbilities")); + .put(new Pair<String, String>("hk", "net/minecraft/network/play/server/S39PacketPlayerAbilities")); mObInitMap.put(new Pair<String, String>("dl", "net/minecraft/nbt/NBTTagEnd")); mObInitMap.put(new Pair<String, String>("ala", "net/minecraft/block/BlockFenceGate")); mObInitMap.put(new Pair<String, String>("adc", "net/minecraft/item/Item$ToolMaterial")); @@ -6829,7 +6904,7 @@ public class DevHelper { mObInitMap.put(new Pair<String, String>("axp", "net/minecraft/world/gen/layer/GenLayer$2")); mObInitMap.put(new Pair<String, String>("ban", "net/minecraft/client/renderer/GLAllocation")); mObInitMap - .put(new Pair<String, String>("bem", "net/minecraft/client/gui/achievement/GuiStats$StatsGeneral")); + .put(new Pair<String, String>("bem", "net/minecraft/client/gui/achievement/GuiStats$StatsGeneral")); mObInitMap.put(new Pair<String, String>("bil", "net/minecraft/client/model/ModelZombieVillager")); mObInitMap.put(new Pair<String, String>("bmk", "net/minecraft/client/renderer/tileentity/TileEntityRendererDispatcher")); @@ -6846,7 +6921,7 @@ public class DevHelper { mObInitMap.put(new Pair<String, String>("ayd", "net/minecraft/pathfinding/Path")); mObInitMap.put(new Pair<String, String>("bbb", "net/minecraft/client/Minecraft$5")); mObInitMap - .put(new Pair<String, String>("bfa", "net/minecraft/client/gui/inventory/GuiBeacon$CancelButton")); + .put(new Pair<String, String>("bfa", "net/minecraft/client/gui/inventory/GuiBeacon$CancelButton")); mObInitMap.put(new Pair<String, String>("buh", "net/minecraft/client/stream/ChatController$ChatListener")); mObInitMap.put(new Pair<String, String>("bqi", "net/minecraft/client/renderer/texture/TextureUtil")); mObInitMap.put(new Pair<String, String>("za", "net/minecraft/entity/player/EntityPlayer$EnumStatus")); diff --git a/src/Java/gtPlusPlus/preloader/Preloader_Logger.java b/src/Java/gtPlusPlus/preloader/Preloader_Logger.java new file mode 100644 index 0000000000..84f0fab012 --- /dev/null +++ b/src/Java/gtPlusPlus/preloader/Preloader_Logger.java @@ -0,0 +1,60 @@ +package gtPlusPlus.preloader; + +import org.apache.logging.log4j.Level; +import org.apache.logging.log4j.LogManager; +import org.apache.logging.log4j.Logger; + +public class Preloader_Logger { + + private Preloader_Logger() { + + } + + // Logging Functions + public static final Logger MODLOGGER = Preloader_Logger.makeLogger(); + + // Generate GT++ Logger + public static Logger makeLogger() { + final Logger gtPlusPlusLogger = LogManager.getLogger("GT++ ASM"); + return gtPlusPlusLogger; + } + + public static final org.apache.logging.log4j.Logger getLogger(){ + return MODLOGGER; + } + + // Non-Dev Comments + + public static void INFO(final String s, final String s2) { + INFO(s); + INFO(s2); + } + + public static void INFO(final String s) { + MODLOGGER.info(s); + } + + // Developer Comments + public static void WARNING(final String s) { + MODLOGGER.warn(s); + } + + // Errors + public static void ERROR(final String s) { + MODLOGGER.fatal(s); + } + + public static void LOG(String string, Level info, String string2) { + if (info.equals(Level.INFO)) { + INFO("["+string+"] "+string2); + } + if (info.equals(Level.WARN)) { + WARNING("["+string+"] "+string2); + } + if (info.equals(Level.ERROR)) { + ERROR("["+string+"] "+string2); + } + + } + +} diff --git a/src/Java/gtPlusPlus/preloader/asm/AsmConfig.java b/src/Java/gtPlusPlus/preloader/asm/AsmConfig.java index 87ac77d5da..d0c59726de 100644 --- a/src/Java/gtPlusPlus/preloader/asm/AsmConfig.java +++ b/src/Java/gtPlusPlus/preloader/asm/AsmConfig.java @@ -1,6 +1,8 @@ package gtPlusPlus.preloader.asm; import cpw.mods.fml.common.FMLLog; +import gtPlusPlus.preloader.Preloader_Logger; + import java.io.File; import java.util.ArrayList; import net.minecraftforge.common.config.Configuration; @@ -11,7 +13,8 @@ public class AsmConfig { public static boolean loaded; public static Configuration config; - + + public static boolean enableOreDictPatch; public static boolean enableTiConFluidLighting; public static boolean enableGtTooltipFix; public static boolean enableGtNbtFix; @@ -27,8 +30,9 @@ public class AsmConfig { public static boolean enableTcAspectSafety; public static boolean enabledLwjglKeybindingFix; public static boolean enabledFixEntitySetHealth; - + public static boolean disableAllLogging; + public static boolean debugMode; public AsmConfig(File file) { if (!loaded) { @@ -56,6 +60,12 @@ public class AsmConfig { disableAllLogging = prop.getBoolean(false); propOrderDebug.add(prop.getName()); + prop = config.get("debug", "debugMode", false); + prop.comment = "Enables all sorts of debug logging. (Don't use unless told to, breaks other things.)"; + prop.setLanguageKey("gtpp.debugMode").setRequiresMcRestart(false); + debugMode = prop.getBoolean(false); + propOrderDebug.add(prop.getName()); + prop = config.get("debug", "enabledFixEntitySetHealth", false); prop.comment = "Enable/Disable entity setHealth() fix."; prop.setLanguageKey("gtpp.enabledFixEntitySetHealth").setRequiresMcRestart(true); @@ -80,6 +90,12 @@ public class AsmConfig { enableCofhPatch = prop.getBoolean(false); propOrderDebug.add(prop.getName()); + prop = config.get("debug", "enableOreDictPatch", false); + prop.comment = "Enable/Disable Forge OreDictionary Patch (Useful for Development)"; + prop.setLanguageKey("gtpp.enableOreDictPatch").setRequiresMcRestart(true); + enableOreDictPatch = prop.getBoolean(false); + propOrderDebug.add(prop.getName()); + @@ -168,15 +184,15 @@ public class AsmConfig { config.save(); } - FMLLog.log(Level.INFO, "[GT++ ASM] Chunk Debugging - Enabled: "+enableChunkDebugging, new Object[0]); - FMLLog.log(Level.INFO, "[GT++ ASM] Gt Nbt Fix - Enabled: "+enableGtNbtFix, new Object[0]); - FMLLog.log(Level.INFO, "[GT++ ASM] TiCon Fluid Lighting - Enabled: "+enableTiConFluidLighting, new Object[0]); - FMLLog.log(Level.INFO, "[GT++ ASM] Gt Tooltip Fix - Enabled: "+enableGtTooltipFix, new Object[0]); - FMLLog.log(Level.INFO, "[GT++ ASM] COFH Patch - Enabled: "+enableCofhPatch, new Object[0]); - FMLLog.log(Level.INFO, "[GT++ ASM] Gc Fuel Changes Patch - Enabled: "+enableGcFuelChanges, new Object[0]); - FMLLog.log(Level.INFO, "[GT++ ASM] Railcraft Fluid Flow Patch - Enabled: "+enableRcFlowFix, new Object[0]); - FMLLog.log(Level.INFO, "[GT++ ASM] Thaumcraft Aspect Safety Patch - Enabled: "+enableTcAspectSafety, new Object[0]); - FMLLog.log(Level.INFO, "[GT++ ASM] Fix bad usage of EntityLivingBase.setHealth Patch - Enabled: "+enabledFixEntitySetHealth, new Object[0]); + Preloader_Logger.INFO("Chunk Debugging - Enabled: "+enableChunkDebugging); + Preloader_Logger.INFO("Gt Nbt Fix - Enabled: "+enableGtNbtFix); + Preloader_Logger.INFO("TiCon Fluid Lighting - Enabled: "+enableTiConFluidLighting); + Preloader_Logger.INFO("Gt Tooltip Fix - Enabled: "+enableGtTooltipFix); + Preloader_Logger.INFO("COFH Patch - Enabled: "+enableCofhPatch); + Preloader_Logger.INFO("Gc Fuel Changes Patch - Enabled: "+enableGcFuelChanges); + Preloader_Logger.INFO("Railcraft Fluid Flow Patch - Enabled: "+enableRcFlowFix); + Preloader_Logger.INFO("Thaumcraft Aspect Safety Patch - Enabled: "+enableTcAspectSafety); + Preloader_Logger.INFO("Fix bad usage of EntityLivingBase.setHealth Patch - Enabled: "+enabledFixEntitySetHealth); } catch (Exception var3) { FMLLog.log(Level.ERROR, var3, "GT++ ASM had a problem loading it's config", new Object[0]); diff --git a/src/Java/gtPlusPlus/preloader/asm/ClassesToTransform.java b/src/Java/gtPlusPlus/preloader/asm/ClassesToTransform.java new file mode 100644 index 0000000000..84593f6597 --- /dev/null +++ b/src/Java/gtPlusPlus/preloader/asm/ClassesToTransform.java @@ -0,0 +1,74 @@ +package gtPlusPlus.preloader.asm; + +public class ClassesToTransform { + + + public static final String LWJGL_KEYBOARD = "org.lwjgl.input.Keyboard"; + + + public static final String MINECRAFT_GAMESETTINGS = "net.minecraft.client.settings.GameSettings"; + public static final String MINECRAFT_GAMESETTINGS_OBF = "bbj"; + + + public static final String FORGE_CHUNK_MANAGER = "net.minecraftforge.common.ForgeChunkManager"; + public static final String FORGE_ORE_DICTIONARY = "net.minecraftforge.oredict.OreDictionary"; + + + public static final String COFH_ORE_DICTIONARY_ARBITER = "cofh.core.util.oredict.OreDictionaryArbiter"; + + + public static final String TINKERS_FLUID_BLOCK = "tconstruct.smeltery.blocks.TConstructFluid"; + + + public static final String RAILCRAFT_FLUID_HELPER = "mods.railcraft.common.fluids.FluidHelper"; + public static final String RAILCRAFT_TILE_FLUID_LOADER = "mods.railcraft.common.blocks.machine.gamma.TileFluidLoader"; + public static final String RAILCRAFT_INVENTORY_TOOLS = "mods.railcraft.common.util.inventory.InvTools"; + + + public static final String GALACTICRAFT_FLUID_UTILS = "micdoodle8.mods.galacticraft.core.util.FluidUtil"; + public static final String GALACTICRAFT_TILE_ENTITY_FUEL_LOADER = "micdoodle8.mods.galacticraft.core.tile.TileEntityFuelLoader"; + public static final String GALACTICRAFT_ENTITY_AUTO_ROCKET = "micdoodle8.mods.galacticraft.api.prefab.entity.EntityAutoRocket"; + + + public static final String GT_UTILITY = "gregtech.api.util.GT_Utility"; + public static final String GT_ACHIEVEMENTS = "gregtech.loaders.misc.GT_Achievements"; + public static final String GT_CLIENT_PROXY = "gregtech.common.GT_Client"; + public static final String GT_PACKET_TILE_ENTITY = "gregtech.api.net.GT_Packet_TileEntity"; + public static final String GT_BASE_META_TILE_ENTITY = "gregtech.api.metatileentity.BaseMetaTileEntity"; + public static final String GT_MTE_CHARCOAL_PIT = "gregtech.common.tileentities.machines.multi.GT_MetaTileEntity_Charcoal_Pit"; + public static final String GT_ITEM_MACHINES = "gregtech.common.blocks.GT_Item_Machines"; + public static final String GT_METAGENERATED_TOOL = "gregtech.api.items.GT_MetaGenerated_Tool"; + public static final String GT_BLOCK_MACHINES = "gregtech.common.blocks.GT_Block_Machines"; + public static final String GT_MTE_HATCH_INPUTBUS = "gregtech.api.metatileentity.implementations.GT_MetaTileEntity_Hatch_InputBus"; + public static final String GT_MTE_HATCH_OUTPUTBUS = "gregtech.api.metatileentity.implementations.GT_MetaTileEntity_Hatch_OutputBus"; + public static final String GT_METAPIPE_ITEM = "gregtech.api.metatileentity.implementations.GT_MetaPipeEntity_Item"; + public static final String GT_METAPIPE_FLUID = "gregtech.api.metatileentity.implementations.GT_MetaPipeEntity_Fluid"; + public static final String GT_METAPIPE_FRAME = "gregtech.api.metatileentity.implementations.GT_MetaPipeEntity_Frame"; + + + public static final String GTPP_MTE_HATCH_SUPER_INPUT_BUS = "gtPlusPlus.xmod.gregtech.api.metatileentity.implementations.GT_MetaTileEntity_SuperBus_Input"; + public static final String GTPP_MTE_HATCH_SUPER_OUTPUT_BUS = "gtPlusPlus.xmod.gregtech.api.metatileentity.implementations.GT_MetaTileEntity_SuperBus_Output"; + public static final String NAME = ""; + + + public static final String THAUMCRAFT_ITEM_WISP_ESSENCE = "thaumcraft.common.items.ItemWispEssence"; + + public static final String IC2_ITEM_ARMOUR_HAZMAT = "ic2.core.item.armor.ItemArmorHazmat"; + public static final String IC2_BLOCK_BASE_TILE_ENTITY = "ic2.core.block.BlockTileEntity"; + public static final String IC2_BLOCK_MACHINE1 = "ic2.core.block.machine.BlockMachine"; + public static final String IC2_BLOCK_MACHINE2 = "ic2.core.block.machine.BlockMachine2"; + public static final String IC2_BLOCK_MACHINE3 = "ic2.core.block.machine.BlockMachine3"; + public static final String IC2_BLOCK_KINETIC_GENERATOR = "ic2.core.block.kineticgenerator.block.BlockKineticGenerator"; + public static final String IC2_BLOCK_HEAT_GENERATOR = "ic2.core.block.heatgenerator.block.BlockHeatGenerator"; + public static final String IC2_BLOCK_GENERATOR = "ic2.core.block.generator.block.BlockGenerator"; + public static final String IC2_BLOCK_REACTOR_ACCESS_HATCH = "ic2.core.block.reactor.block.BlockReactorAccessHatch"; + public static final String IC2_BLOCK_REACTOR_CHAMBER = "ic2.core.block.reactor.block.BlockReactorChamber"; + public static final String IC2_BLOCK_REACTOR_FLUID_PORT = "ic2.core.block.reactor.block.BlockReactorFluidPort"; + public static final String IC2_BLOCK_REACTOR_REDSTONE_PORT = "ic2.core.block.reactor.block.BlockReactorRedstonePort"; + public static final String IC2_BLOCK_REACTOR_VESSEL = "ic2.core.block.reactor.block.BlockReactorVessel"; + public static final String IC2_BLOCK_PERSONAL = "ic2.core.block.personal.BlockPersonal.class"; + public static final String IC2_BLOCK_CHARGEPAD = "ic2.core.block.wiring.BlockChargepad.class"; + public static final String IC2_BLOCK_ELECTRIC = "ic2.core.block.wiring.BlockElectric.class"; + public static final String IC2_BLOCK_LUMINATOR = "ic2.core.block.wiring.BlockLuminator.class"; + +} diff --git a/src/Java/gtPlusPlus/preloader/asm/Preloader_DummyContainer.java b/src/Java/gtPlusPlus/preloader/asm/Preloader_DummyContainer.java index d8a4bf96f5..2a0082754a 100644 --- a/src/Java/gtPlusPlus/preloader/asm/Preloader_DummyContainer.java +++ b/src/Java/gtPlusPlus/preloader/asm/Preloader_DummyContainer.java @@ -2,27 +2,24 @@ package gtPlusPlus.preloader.asm; import java.io.File; import java.util.Arrays; -import java.util.List; import com.google.common.eventbus.EventBus; import com.google.common.eventbus.Subscribe; import cpw.mods.fml.common.DummyModContainer; import cpw.mods.fml.common.LoadController; -import cpw.mods.fml.common.Mod.EventHandler; import cpw.mods.fml.common.ModMetadata; -import cpw.mods.fml.common.event.*; -import cpw.mods.fml.common.versioning.ArtifactVersion; - -import gtPlusPlus.api.objects.Logger; -import gtPlusPlus.core.util.Utils; +import cpw.mods.fml.common.event.FMLConstructionEvent; +import cpw.mods.fml.common.event.FMLInitializationEvent; +import cpw.mods.fml.common.event.FMLPostInitializationEvent; +import cpw.mods.fml.common.event.FMLPreInitializationEvent; import gtPlusPlus.preloader.CORE_Preloader; +import gtPlusPlus.preloader.Preloader_Logger; import net.minecraftforge.common.config.Configuration; public class Preloader_DummyContainer extends DummyModContainer { public Preloader_DummyContainer() { - super(new ModMetadata()); ModMetadata meta = getMetadata(); meta.modId = CORE_Preloader.MODID; @@ -35,7 +32,8 @@ public class Preloader_DummyContainer extends DummyModContainer { meta.updateUrl = ""; meta.screenshots = new String[0]; meta.logoFile = ""; - meta.dependencies = (List<ArtifactVersion>) CORE_Preloader.DEPENDENCIES; + //meta.dependencies = (List<ArtifactVersion>) CORE_Preloader.DEPENDENCIES; + Preloader_Logger.INFO("Initializing DummyModContainer"); } @@ -47,29 +45,26 @@ public class Preloader_DummyContainer extends DummyModContainer { @Subscribe public void modConstruction(FMLConstructionEvent evt){ - - } - - @Subscribe - public void init(FMLInitializationEvent evt) { + Preloader_Logger.INFO("Constructing DummyModContainer"); } - @EventHandler - public void load(final FMLInitializationEvent e) { - Logger.INFO("[GT++ ASM] Begin resource allocation for " + CORE_Preloader.MODID + " V" + CORE_Preloader.VERSION); - } - @Subscribe public void preInit(FMLPreInitializationEvent event) { - Logger.INFO("[GT++ ASM] Loading " + CORE_Preloader.MODID + " V" + CORE_Preloader.VERSION); + Preloader_Logger.INFO("Loading " + CORE_Preloader.MODID + " V" + CORE_Preloader.VERSION); // Handle GT++ Config handleConfigFile(event); } @Subscribe + public void init(FMLInitializationEvent evt) { + Preloader_Logger.INFO("Begin resource allocation for " + CORE_Preloader.MODID + " V" + CORE_Preloader.VERSION); + + } + + @Subscribe public void postInit(FMLPostInitializationEvent evt) { - Logger.INFO("[GT++ ASM] Finished loading GT++ Pre-Loader."); + Preloader_Logger.INFO("Finished loading."); } public static void handleConfigFile(final FMLPreInitializationEvent event) { @@ -84,17 +79,17 @@ public class Preloader_DummyContainer extends DummyModContainer { } public static boolean getConfig(){ - final Configuration config = new Configuration( new File(Utils.getMcDir(), "config/GTplusplus/GTplusplus.cfg")); + final Configuration config = new Configuration( new File(gtPlusPlus.preloader.CORE_Preloader.MC_DIR, "config/GTplusplus/GTplusplus.cfg")); if (config != null){ config.load(); // Circuits CORE_Preloader.enableOldGTcircuits = config.getBoolean("enableOldGTcircuits", "gregtech", false, "Restores circuits and their recipes from Pre-5.09.28 times."); CORE_Preloader.enableWatchdogBGM = config.getInt("enableWatchdogBGM", "features", 0, 0, Short.MAX_VALUE, "Set to a value greater than 0 to reduce the ticks taken to delay between BGM tracks. Acceptable Values are 1-32767, where 0 is disabled. Vanilla Uses 12,000 & 24,000. 200 is 10s."); - Logger.INFO("GT++ Preloader - Loaded the configuration file."); + Preloader_Logger.INFO("Loaded the configuration file."); return true; } - Logger.INFO("GT++ Preloader - Failed loading the configuration file."); + Preloader_Logger.INFO("Failed loading the configuration file."); return false; } }
\ No newline at end of file diff --git a/src/Java/gtPlusPlus/preloader/asm/Preloader_FMLLoadingPlugin.java b/src/Java/gtPlusPlus/preloader/asm/Preloader_FMLLoadingPlugin.java index b208c2f8f0..46196cb87f 100644 --- a/src/Java/gtPlusPlus/preloader/asm/Preloader_FMLLoadingPlugin.java +++ b/src/Java/gtPlusPlus/preloader/asm/Preloader_FMLLoadingPlugin.java @@ -1,12 +1,15 @@ package gtPlusPlus.preloader.asm; +import java.io.File; import java.util.Map; import cpw.mods.fml.relauncher.IFMLLoadingPlugin; import cpw.mods.fml.relauncher.IFMLLoadingPlugin.MCVersion; import cpw.mods.fml.relauncher.IFMLLoadingPlugin.SortingIndex; - +import gtPlusPlus.preloader.CORE_Preloader; +import gtPlusPlus.preloader.Preloader_Logger; import gtPlusPlus.preloader.asm.transformers.Preloader_Transformer_Handler; +import net.minecraft.launchwrapper.Launch; @SortingIndex(10097) @MCVersion(value = "1.7.10") @@ -14,6 +17,10 @@ public class Preloader_FMLLoadingPlugin implements IFMLLoadingPlugin { //-Dfml.coreMods.load=gtPlusPlus.preloader.asm.Preloader_FMLLoadingPlugin + static { + Preloader_Logger.INFO("Initializing IFMLLoadingPlugin"); + } + @Override public String getAccessTransformerClass() { return null; @@ -22,7 +29,9 @@ public class Preloader_FMLLoadingPlugin implements IFMLLoadingPlugin { @Override public String[] getASMTransformerClass() { //This will return the name of the class - return new String[]{Preloader_Transformer_Handler.class.getName()}; + return new String[]{ + Preloader_Transformer_Handler.class.getName() + }; } @Override @@ -33,12 +42,33 @@ public class Preloader_FMLLoadingPlugin implements IFMLLoadingPlugin { @Override public String getSetupClass() { + //return Preloader_SetupClass.class.getName(); return null; } @Override public void injectData(Map<String, Object> data) { - + boolean isDeObf = (boolean) data.get("runtimeDeobfuscationEnabled"); + File mcDir = (File) data.get("mcLocation"); + //LaunchClassLoader classLoader = (LaunchClassLoader) data.get("classLoader"); + File coremodLocation = (File) data.get("coremodLocation"); + String deobfuscationFileName = (String) data.get("deobfuscationFileName"); + if (mcDir != null && mcDir.exists()) { + CORE_Preloader.setMinecraftDirectory(mcDir); + Preloader_Logger.INFO("Set McDir via Preloader_SetupClass"); + } + Preloader_Logger.INFO("runtimeDeobfuscationEnabled: "+isDeObf); + Preloader_Logger.INFO("deobfuscationFileName: "+deobfuscationFileName); + if (coremodLocation != null && coremodLocation.exists()) { + Preloader_Logger.INFO("coremodLocation: "+coremodLocation.getPath()); + } + else { + Preloader_Logger.INFO("coremodLocation: null"); + Preloader_Logger.ERROR("Unable to determine CoreMod location"); + } + CORE_Preloader.DEV_ENVIRONMENT = (Boolean) Launch.blackboard.get("fml.deobfuscatedEnvironment"); + CORE_Preloader.DEBUG_MODE = AsmConfig.debugMode; + Preloader_Logger.INFO("Running on "+gtPlusPlus.preloader.CORE_Preloader.JAVA_VERSION+" | Development Environment: "+CORE_Preloader.DEV_ENVIRONMENT); } }
\ No newline at end of file diff --git a/src/Java/gtPlusPlus/preloader/asm/Preloader_SetupClass.java b/src/Java/gtPlusPlus/preloader/asm/Preloader_SetupClass.java new file mode 100644 index 0000000000..a6d2b6c863 --- /dev/null +++ b/src/Java/gtPlusPlus/preloader/asm/Preloader_SetupClass.java @@ -0,0 +1,23 @@ +package gtPlusPlus.preloader.asm; + +import java.io.File; +import java.util.Map; + +import cpw.mods.fml.relauncher.IFMLCallHook; +import gtPlusPlus.preloader.CORE_Preloader; +import gtPlusPlus.preloader.Preloader_Logger; + +public class Preloader_SetupClass implements IFMLCallHook { + + @Override + public Void call() throws Exception { + Preloader_Logger.INFO("Executing IFMLCallHook"); + return null; + } + + @Override + public void injectData(Map<String, Object> data) { + + } + +} diff --git a/src/Java/gtPlusPlus/preloader/asm/helpers/MethodHelper_GT.java b/src/Java/gtPlusPlus/preloader/asm/helpers/MethodHelper_GT.java new file mode 100644 index 0000000000..8120df81fa --- /dev/null +++ b/src/Java/gtPlusPlus/preloader/asm/helpers/MethodHelper_GT.java @@ -0,0 +1,25 @@ +package gtPlusPlus.preloader.asm.helpers; + +import java.util.List; + +import gregtech.api.enums.Materials; +import gregtech.api.items.GT_MetaGenerated_Tool; +import net.minecraft.creativetab.CreativeTabs; +import net.minecraft.item.Item; +import net.minecraft.item.ItemStack; + +public class MethodHelper_GT { + + public static final void getSubItems(GT_MetaGenerated_Tool aTool, Item var1, CreativeTabs aCreativeTab, List aList) { + for (int i = 0; i < 32766; i += 2) { + if (aTool.getToolStats(new ItemStack(aTool, 1, i)) != null) { + ItemStack tStack = new ItemStack(aTool, 1, i); + aTool.isItemStackUsable(tStack); + aList.add(tStack); + aList.add(aTool.getToolWithStats(i,1,Materials.TungstenSteel,Materials.TungstenSteel,null)); + aList.add(aTool.getToolWithStats(i,1,Materials.Neutronium,Materials.Neutronium,null)); + } + } + } + +} diff --git a/src/Java/gtPlusPlus/preloader/asm/transformers/ClassTransformer_GT_BlockMachines_MetaPipeEntity.java b/src/Java/gtPlusPlus/preloader/asm/transformers/ClassTransformer_GT_BlockMachines_MetaPipeEntity.java index f71615b7c1..dce1fa15d2 100644 --- a/src/Java/gtPlusPlus/preloader/asm/transformers/ClassTransformer_GT_BlockMachines_MetaPipeEntity.java +++ b/src/Java/gtPlusPlus/preloader/asm/transformers/ClassTransformer_GT_BlockMachines_MetaPipeEntity.java @@ -21,7 +21,6 @@ import gregtech.api.GregTech_API; import gregtech.api.enums.Materials; import gregtech.api.enums.SubTag; import gregtech.api.metatileentity.BaseMetaPipeEntity; -import gtPlusPlus.api.objects.Logger; import gtPlusPlus.xmod.gregtech.common.Meta_GT_Proxy; import net.minecraft.tileentity.TileEntity; import net.minecraft.world.World; @@ -149,7 +148,7 @@ public class ClassTransformer_GT_BlockMachines_MetaPipeEntity { int mMode; - public ClassTransformer_GT_BlockMachines_MetaPipeEntity(byte[] basicClass, boolean obfuscated, int aMode) { + public ClassTransformer_GT_BlockMachines_MetaPipeEntity(byte[] basicClass, int aMode) { mMode = aMode; ClassReader aTempReader = null; ClassWriter aTempWriter = null; diff --git a/src/Java/gtPlusPlus/preloader/asm/transformers/ClassTransformer_GT_BusPatch.java b/src/Java/gtPlusPlus/preloader/asm/transformers/ClassTransformer_GT_BusPatch.java index 4394aa0f04..e123c6a9e0 100644 --- a/src/Java/gtPlusPlus/preloader/asm/transformers/ClassTransformer_GT_BusPatch.java +++ b/src/Java/gtPlusPlus/preloader/asm/transformers/ClassTransformer_GT_BusPatch.java @@ -1,6 +1,28 @@ package gtPlusPlus.preloader.asm.transformers; -import static org.objectweb.asm.Opcodes.*; +import static org.objectweb.asm.Opcodes.AALOAD; +import static org.objectweb.asm.Opcodes.AASTORE; +import static org.objectweb.asm.Opcodes.ACC_PUBLIC; +import static org.objectweb.asm.Opcodes.ACONST_NULL; +import static org.objectweb.asm.Opcodes.ALOAD; +import static org.objectweb.asm.Opcodes.ANEWARRAY; +import static org.objectweb.asm.Opcodes.ASM5; +import static org.objectweb.asm.Opcodes.DUP; +import static org.objectweb.asm.Opcodes.F_FULL; +import static org.objectweb.asm.Opcodes.GOTO; +import static org.objectweb.asm.Opcodes.ICONST_0; +import static org.objectweb.asm.Opcodes.ICONST_1; +import static org.objectweb.asm.Opcodes.ICONST_2; +import static org.objectweb.asm.Opcodes.IF_ICMPLT; +import static org.objectweb.asm.Opcodes.ILOAD; +import static org.objectweb.asm.Opcodes.INTEGER; +import static org.objectweb.asm.Opcodes.INVOKESPECIAL; +import static org.objectweb.asm.Opcodes.INVOKESTATIC; +import static org.objectweb.asm.Opcodes.INVOKEVIRTUAL; +import static org.objectweb.asm.Opcodes.NEW; +import static org.objectweb.asm.Opcodes.PUTFIELD; +import static org.objectweb.asm.Opcodes.RETURN; +import static org.objectweb.asm.Opcodes.UNINITIALIZED_THIS; import org.apache.logging.log4j.Level; import org.objectweb.asm.ClassReader; @@ -10,13 +32,14 @@ import org.objectweb.asm.Label; import org.objectweb.asm.MethodVisitor; import cpw.mods.fml.relauncher.FMLRelaunchLog; +import gtPlusPlus.preloader.asm.ClassesToTransform; public class ClassTransformer_GT_BusPatch { - public static final String aSuperInput = "gtPlusPlus.xmod.gregtech.api.metatileentity.implementations.GT_MetaTileEntity_SuperBus_Input"; - public static final String aSuperOutput = "gtPlusPlus.xmod.gregtech.api.metatileentity.implementations.GT_MetaTileEntity_SuperBus_Output"; - public static final String aInput = "gregtech.api.metatileentity.implementations.GT_MetaTileEntity_Hatch_InputBus"; - public static final String aOutput = "gregtech.api.metatileentity.implementations.GT_MetaTileEntity_Hatch_OutputBus"; + private static final String aSuperInputFormatted = ClassesToTransform.GTPP_MTE_HATCH_SUPER_INPUT_BUS.replace(".", "/"); + private static final String aSuperOutputFormatted = ClassesToTransform.GTPP_MTE_HATCH_SUPER_OUTPUT_BUS.replace(".", "/"); + private static final String aInputFormatted = ClassesToTransform.GT_MTE_HATCH_INPUTBUS.replace(".", "/"); + private static final String aOutputFormatted = ClassesToTransform.GT_MTE_HATCH_OUTPUTBUS.replace(".", "/"); private final boolean isValid; private final ClassReader reader; @@ -74,7 +97,7 @@ public class ClassTransformer_GT_BusPatch { //GT_MetaTileEntity_Hatch_InputBus //Constructor - if (aClassName.equals(aInput)){ + if (aClassName.equals(ClassesToTransform.GT_MTE_HATCH_INPUTBUS)){ //Constructor 1 { @@ -131,14 +154,14 @@ public class ClassTransformer_GT_BusPatch { mv.visitLineNumber(16, l4); mv.visitVarInsn(ALOAD, 0); mv.visitInsn(ACONST_NULL); - mv.visitFieldInsn(PUTFIELD, "gregtech/api/metatileentity/implementations/GT_MetaTileEntity_Hatch_InputBus", "mRecipeMap", "Lgregtech/api/util/GT_Recipe$GT_Recipe_Map;"); + mv.visitFieldInsn(PUTFIELD, ""+aInputFormatted+"", "mRecipeMap", "Lgregtech/api/util/GT_Recipe$GT_Recipe_Map;"); Label l5 = new Label(); mv.visitLabel(l5); mv.visitLineNumber(21, l5); mv.visitInsn(RETURN); Label l6 = new Label(); mv.visitLabel(l6); - mv.visitLocalVariable("this", "Lgregtech/api/metatileentity/implementations/GT_MetaTileEntity_Hatch_InputBus;", null, l0, l6, 0); + mv.visitLocalVariable("this", "L"+aInputFormatted+";", null, l0, l6, 0); mv.visitLocalVariable("aID", "I", null, l0, l6, 1); mv.visitLocalVariable("aName", "Ljava/lang/String;", null, l0, l6, 2); mv.visitLocalVariable("aNameRegional", "Ljava/lang/String;", null, l0, l6, 3); @@ -168,14 +191,14 @@ public class ClassTransformer_GT_BusPatch { mv.visitLineNumber(16, l1); mv.visitVarInsn(ALOAD, 0); mv.visitInsn(ACONST_NULL); - mv.visitFieldInsn(PUTFIELD, "gregtech/api/metatileentity/implementations/GT_MetaTileEntity_Hatch_InputBus", "mRecipeMap", "Lgregtech/api/util/GT_Recipe$GT_Recipe_Map;"); + mv.visitFieldInsn(PUTFIELD, ""+aInputFormatted+"", "mRecipeMap", "Lgregtech/api/util/GT_Recipe$GT_Recipe_Map;"); Label l2 = new Label(); mv.visitLabel(l2); mv.visitLineNumber(30, l2); mv.visitInsn(RETURN); Label l3 = new Label(); mv.visitLabel(l3); - mv.visitLocalVariable("this", "Lgregtech/api/metatileentity/implementations/GT_MetaTileEntity_Hatch_InputBus;", null, l0, l3, 0); + mv.visitLocalVariable("this", "L"+aInputFormatted+";", null, l0, l3, 0); mv.visitLocalVariable("aName", "Ljava/lang/String;", null, l0, l3, 1); mv.visitLocalVariable("aTier", "I", null, l0, l3, 2); mv.visitLocalVariable("aSlots", "I", null, l0, l3, 3); @@ -205,14 +228,14 @@ public class ClassTransformer_GT_BusPatch { mv.visitLineNumber(16, l1); mv.visitVarInsn(ALOAD, 0); mv.visitInsn(ACONST_NULL); - mv.visitFieldInsn(PUTFIELD, "gregtech/api/metatileentity/implementations/GT_MetaTileEntity_Hatch_InputBus", "mRecipeMap", "Lgregtech/api/util/GT_Recipe$GT_Recipe_Map;"); + mv.visitFieldInsn(PUTFIELD, ""+aInputFormatted+"", "mRecipeMap", "Lgregtech/api/util/GT_Recipe$GT_Recipe_Map;"); Label l2 = new Label(); mv.visitLabel(l2); mv.visitLineNumber(34, l2); mv.visitInsn(RETURN); Label l3 = new Label(); mv.visitLabel(l3); - mv.visitLocalVariable("this", "Lgregtech/api/metatileentity/implementations/GT_MetaTileEntity_Hatch_InputBus;", null, l0, l3, 0); + mv.visitLocalVariable("this", "L"+aInputFormatted+";", null, l0, l3, 0); mv.visitLocalVariable("aName", "Ljava/lang/String;", null, l0, l3, 1); mv.visitLocalVariable("aTier", "I", null, l0, l3, 2); mv.visitLocalVariable("aSlots", "I", null, l0, l3, 3); @@ -231,7 +254,7 @@ public class ClassTransformer_GT_BusPatch { //GT_MetaTileEntity_Hatch_OutputBus //Constructor - if (aClassName.equals(aOutput)){ + if (aClassName.equals(ClassesToTransform.GT_MTE_HATCH_OUTPUTBUS)){ { mv = cw.visitMethod(ACC_PUBLIC, "<init>", "(ILjava/lang/String;Ljava/lang/String;II)V", null, null); @@ -288,7 +311,7 @@ public class ClassTransformer_GT_BusPatch { mv.visitInsn(RETURN); Label l5 = new Label(); mv.visitLabel(l5); - mv.visitLocalVariable("this", "Lgregtech/api/metatileentity/implementations/GT_MetaTileEntity_Hatch_OutputBus;", null, l0, l5, 0); + mv.visitLocalVariable("this", "L"+aOutputFormatted+";", null, l0, l5, 0); mv.visitLocalVariable("aID", "I", null, l0, l5, 1); mv.visitLocalVariable("aName", "Ljava/lang/String;", null, l0, l5, 2); mv.visitLocalVariable("aNameRegional", "Ljava/lang/String;", null, l0, l5, 3); @@ -317,7 +340,7 @@ public class ClassTransformer_GT_BusPatch { mv.visitInsn(RETURN); Label l2 = new Label(); mv.visitLabel(l2); - mv.visitLocalVariable("this", "Lgregtech/api/metatileentity/implementations/GT_MetaTileEntity_Hatch_OutputBus;", null, l0, l2, 0); + mv.visitLocalVariable("this", "L"+aOutputFormatted+";", null, l0, l2, 0); mv.visitLocalVariable("aName", "Ljava/lang/String;", null, l0, l2, 1); mv.visitLocalVariable("aTier", "I", null, l0, l2, 2); mv.visitLocalVariable("aSlots", "I", null, l0, l2, 3); @@ -346,7 +369,7 @@ public class ClassTransformer_GT_BusPatch { mv.visitInsn(RETURN); Label l2 = new Label(); mv.visitLabel(l2); - mv.visitLocalVariable("this", "Lgregtech/api/metatileentity/implementations/GT_MetaTileEntity_Hatch_OutputBus;", null, l0, l2, 0); + mv.visitLocalVariable("this", "L"+aOutputFormatted+";", null, l0, l2, 0); mv.visitLocalVariable("aName", "Ljava/lang/String;", null, l0, l2, 1); mv.visitLocalVariable("aTier", "I", null, l0, l2, 2); mv.visitLocalVariable("aSlots", "I", null, l0, l2, 3); @@ -363,7 +386,7 @@ public class ClassTransformer_GT_BusPatch { //GT_MetaTileEntity_SuperBus_Input //Constructor - if (aClassName.equals(aSuperInput)){ + if (aClassName.equals(ClassesToTransform.GTPP_MTE_HATCH_SUPER_INPUT_BUS)){ { mv = cw.visitMethod(ACC_PUBLIC, "<init>", "(ILjava/lang/String;Ljava/lang/String;II)V", null, null); @@ -376,20 +399,20 @@ public class ClassTransformer_GT_BusPatch { mv.visitVarInsn(ALOAD, 2); mv.visitVarInsn(ALOAD, 3); mv.visitVarInsn(ILOAD, 4); - mv.visitMethodInsn(INVOKESPECIAL, "gregtech/api/metatileentity/implementations/GT_MetaTileEntity_Hatch_InputBus", "<init>", "(ILjava/lang/String;Ljava/lang/String;I)V", false); + mv.visitMethodInsn(INVOKESPECIAL, ""+aInputFormatted+"", "<init>", "(ILjava/lang/String;Ljava/lang/String;I)V", false); Label l1 = new Label(); mv.visitLabel(l1); mv.visitLineNumber(20, l1); mv.visitVarInsn(ALOAD, 0); mv.visitInsn(ACONST_NULL); - mv.visitFieldInsn(PUTFIELD, "gtPlusPlus/xmod/gregtech/api/metatileentity/implementations/GT_MetaTileEntity_SuperBus_Input", "mRecipeMap", "Lgregtech/api/util/GT_Recipe$GT_Recipe_Map;"); + mv.visitFieldInsn(PUTFIELD, ""+aSuperInputFormatted+"", "mRecipeMap", "Lgregtech/api/util/GT_Recipe$GT_Recipe_Map;"); Label l2 = new Label(); mv.visitLabel(l2); mv.visitLineNumber(28, l2); mv.visitInsn(RETURN); Label l3 = new Label(); mv.visitLabel(l3); - mv.visitLocalVariable("this", "LgtPlusPlus/xmod/gregtech/api/metatileentity/implementations/GT_MetaTileEntity_SuperBus_Input;", null, l0, l3, 0); + mv.visitLocalVariable("this", "L"+aSuperInputFormatted+";", null, l0, l3, 0); mv.visitLocalVariable("aID", "I", null, l0, l3, 1); mv.visitLocalVariable("aName", "Ljava/lang/String;", null, l0, l3, 2); mv.visitLocalVariable("aNameRegional", "Ljava/lang/String;", null, l0, l3, 3); @@ -409,23 +432,23 @@ public class ClassTransformer_GT_BusPatch { mv.visitVarInsn(ALOAD, 1); mv.visitVarInsn(ILOAD, 2); mv.visitVarInsn(ILOAD, 2); - mv.visitMethodInsn(INVOKESTATIC, "gtPlusPlus/xmod/gregtech/api/metatileentity/implementations/GT_MetaTileEntity_SuperBus_Input", "getSlots", "(I)I", false); + mv.visitMethodInsn(INVOKESTATIC, ""+aSuperInputFormatted+"", "getSlots", "(I)I", false); mv.visitVarInsn(ALOAD, 3); mv.visitVarInsn(ALOAD, 4); - mv.visitMethodInsn(INVOKESPECIAL, "gregtech/api/metatileentity/implementations/GT_MetaTileEntity_Hatch_InputBus", "<init>", "(Ljava/lang/String;IILjava/lang/String;[[[Lgregtech/api/interfaces/ITexture;)V", false); + mv.visitMethodInsn(INVOKESPECIAL, ""+aInputFormatted+"", "<init>", "(Ljava/lang/String;IILjava/lang/String;[[[Lgregtech/api/interfaces/ITexture;)V", false); Label l1 = new Label(); mv.visitLabel(l1); mv.visitLineNumber(20, l1); mv.visitVarInsn(ALOAD, 0); mv.visitInsn(ACONST_NULL); - mv.visitFieldInsn(PUTFIELD, "gtPlusPlus/xmod/gregtech/api/metatileentity/implementations/GT_MetaTileEntity_SuperBus_Input", "mRecipeMap", "Lgregtech/api/util/GT_Recipe$GT_Recipe_Map;"); + mv.visitFieldInsn(PUTFIELD, ""+aSuperInputFormatted+"", "mRecipeMap", "Lgregtech/api/util/GT_Recipe$GT_Recipe_Map;"); Label l2 = new Label(); mv.visitLabel(l2); mv.visitLineNumber(28, l2); mv.visitInsn(RETURN); Label l3 = new Label(); mv.visitLabel(l3); - mv.visitLocalVariable("this", "LgtPlusPlus/xmod/gregtech/api/metatileentity/implementations/GT_MetaTileEntity_SuperBus_Input;", null, l0, l3, 0); + mv.visitLocalVariable("this", "L"+aSuperInputFormatted+";", null, l0, l3, 0); mv.visitLocalVariable("aName", "Ljava/lang/String;", null, l0, l3, 1); mv.visitLocalVariable("aTier", "I", null, l0, l3, 2); mv.visitLocalVariable("aDescription", "Ljava/lang/String;", null, l0, l3, 3); @@ -444,25 +467,25 @@ public class ClassTransformer_GT_BusPatch { mv.visitVarInsn(ALOAD, 1); mv.visitVarInsn(ILOAD, 2); mv.visitVarInsn(ILOAD, 2); - mv.visitMethodInsn(INVOKESTATIC, "gtPlusPlus/xmod/gregtech/api/metatileentity/implementations/GT_MetaTileEntity_SuperBus_Input", "getSlots", "(I)I", false); + mv.visitMethodInsn(INVOKESTATIC, ""+aSuperInputFormatted+"", "getSlots", "(I)I", false); mv.visitVarInsn(ALOAD, 3); mv.visitInsn(ICONST_0); mv.visitInsn(AALOAD); mv.visitVarInsn(ALOAD, 4); - mv.visitMethodInsn(INVOKESPECIAL, "gregtech/api/metatileentity/implementations/GT_MetaTileEntity_Hatch_InputBus", "<init>", "(Ljava/lang/String;IILjava/lang/String;[[[Lgregtech/api/interfaces/ITexture;)V", false); + mv.visitMethodInsn(INVOKESPECIAL, ""+aInputFormatted+"", "<init>", "(Ljava/lang/String;IILjava/lang/String;[[[Lgregtech/api/interfaces/ITexture;)V", false); Label l1 = new Label(); mv.visitLabel(l1); mv.visitLineNumber(20, l1); mv.visitVarInsn(ALOAD, 0); mv.visitInsn(ACONST_NULL); - mv.visitFieldInsn(PUTFIELD, "gtPlusPlus/xmod/gregtech/api/metatileentity/implementations/GT_MetaTileEntity_SuperBus_Input", "mRecipeMap", "Lgregtech/api/util/GT_Recipe$GT_Recipe_Map;"); + mv.visitFieldInsn(PUTFIELD, ""+aSuperInputFormatted+"", "mRecipeMap", "Lgregtech/api/util/GT_Recipe$GT_Recipe_Map;"); Label l2 = new Label(); mv.visitLabel(l2); mv.visitLineNumber(32, l2); mv.visitInsn(RETURN); Label l3 = new Label(); mv.visitLabel(l3); - mv.visitLocalVariable("this", "LgtPlusPlus/xmod/gregtech/api/metatileentity/implementations/GT_MetaTileEntity_SuperBus_Input;", null, l0, l3, 0); + mv.visitLocalVariable("this", "L"+aSuperInputFormatted+";", null, l0, l3, 0); mv.visitLocalVariable("aName", "Ljava/lang/String;", null, l0, l3, 1); mv.visitLocalVariable("aTier", "I", null, l0, l3, 2); mv.visitLocalVariable("aDescription", "[Ljava/lang/String;", null, l0, l3, 3); @@ -479,7 +502,7 @@ public class ClassTransformer_GT_BusPatch { //GT_MetaTileEntity_SuperBus_Output //Constructor - if (aClassName.equals(aSuperOutput)){ + if (aClassName.equals(ClassesToTransform.GTPP_MTE_HATCH_SUPER_OUTPUT_BUS)){ { mv = cw.visitMethod(ACC_PUBLIC, "<init>", "(ILjava/lang/String;Ljava/lang/String;II)V", null, null); @@ -492,20 +515,20 @@ public class ClassTransformer_GT_BusPatch { mv.visitVarInsn(ALOAD, 2); mv.visitVarInsn(ALOAD, 3); mv.visitVarInsn(ILOAD, 4); - mv.visitMethodInsn(INVOKESPECIAL, "gregtech/api/metatileentity/implementations/GT_MetaTileEntity_Hatch_OutputBus", "<init>", "(ILjava/lang/String;Ljava/lang/String;I)V", false); + mv.visitMethodInsn(INVOKESPECIAL, ""+aOutputFormatted+"", "<init>", "(ILjava/lang/String;Ljava/lang/String;I)V", false); Label l1 = new Label(); mv.visitLabel(l1); mv.visitLineNumber(18, l1); mv.visitVarInsn(ALOAD, 0); mv.visitInsn(ACONST_NULL); - mv.visitFieldInsn(PUTFIELD, "gtPlusPlus/xmod/gregtech/api/metatileentity/implementations/GT_MetaTileEntity_SuperBus_Output", "mRecipeMap", "Lgregtech/api/util/GT_Recipe$GT_Recipe_Map;"); + mv.visitFieldInsn(PUTFIELD, ""+aSuperOutputFormatted+"", "mRecipeMap", "Lgregtech/api/util/GT_Recipe$GT_Recipe_Map;"); Label l2 = new Label(); mv.visitLabel(l2); mv.visitLineNumber(26, l2); mv.visitInsn(RETURN); Label l3 = new Label(); mv.visitLabel(l3); - mv.visitLocalVariable("this", "LgtPlusPlus/xmod/gregtech/api/metatileentity/implementations/GT_MetaTileEntity_SuperBus_Output;", null, l0, l3, 0); + mv.visitLocalVariable("this", "L"+aSuperOutputFormatted+";", null, l0, l3, 0); mv.visitLocalVariable("aID", "I", null, l0, l3, 1); mv.visitLocalVariable("aName", "Ljava/lang/String;", null, l0, l3, 2); mv.visitLocalVariable("aNameRegional", "Ljava/lang/String;", null, l0, l3, 3); @@ -525,23 +548,23 @@ public class ClassTransformer_GT_BusPatch { mv.visitVarInsn(ALOAD, 1); mv.visitVarInsn(ILOAD, 2); mv.visitVarInsn(ILOAD, 2); - mv.visitMethodInsn(INVOKESTATIC, "gtPlusPlus/xmod/gregtech/api/metatileentity/implementations/GT_MetaTileEntity_SuperBus_Output", "getSlots", "(I)I", false); + mv.visitMethodInsn(INVOKESTATIC, ""+aSuperOutputFormatted+"", "getSlots", "(I)I", false); mv.visitVarInsn(ALOAD, 3); mv.visitVarInsn(ALOAD, 4); - mv.visitMethodInsn(INVOKESPECIAL, "gregtech/api/metatileentity/implementations/GT_MetaTileEntity_Hatch_OutputBus", "<init>", "(Ljava/lang/String;IILjava/lang/String;[[[Lgregtech/api/interfaces/ITexture;)V", false); + mv.visitMethodInsn(INVOKESPECIAL, ""+aOutputFormatted+"", "<init>", "(Ljava/lang/String;IILjava/lang/String;[[[Lgregtech/api/interfaces/ITexture;)V", false); Label l1 = new Label(); mv.visitLabel(l1); mv.visitLineNumber(18, l1); mv.visitVarInsn(ALOAD, 0); mv.visitInsn(ACONST_NULL); - mv.visitFieldInsn(PUTFIELD, "gtPlusPlus/xmod/gregtech/api/metatileentity/implementations/GT_MetaTileEntity_SuperBus_Output", "mRecipeMap", "Lgregtech/api/util/GT_Recipe$GT_Recipe_Map;"); + mv.visitFieldInsn(PUTFIELD, ""+aSuperOutputFormatted+"", "mRecipeMap", "Lgregtech/api/util/GT_Recipe$GT_Recipe_Map;"); Label l2 = new Label(); mv.visitLabel(l2); mv.visitLineNumber(26, l2); mv.visitInsn(RETURN); Label l3 = new Label(); mv.visitLabel(l3); - mv.visitLocalVariable("this", "LgtPlusPlus/xmod/gregtech/api/metatileentity/implementations/GT_MetaTileEntity_SuperBus_Output;", null, l0, l3, 0); + mv.visitLocalVariable("this", "L"+aSuperOutputFormatted+";", null, l0, l3, 0); mv.visitLocalVariable("aName", "Ljava/lang/String;", null, l0, l3, 1); mv.visitLocalVariable("aTier", "I", null, l0, l3, 2); mv.visitLocalVariable("aDescription", "Ljava/lang/String;", null, l0, l3, 3); @@ -560,25 +583,25 @@ public class ClassTransformer_GT_BusPatch { mv.visitVarInsn(ALOAD, 1); mv.visitVarInsn(ILOAD, 2); mv.visitVarInsn(ILOAD, 2); - mv.visitMethodInsn(INVOKESTATIC, "gtPlusPlus/xmod/gregtech/api/metatileentity/implementations/GT_MetaTileEntity_SuperBus_Output", "getSlots", "(I)I", false); + mv.visitMethodInsn(INVOKESTATIC, ""+aSuperOutputFormatted+"", "getSlots", "(I)I", false); mv.visitVarInsn(ALOAD, 3); mv.visitInsn(ICONST_0); mv.visitInsn(AALOAD); mv.visitVarInsn(ALOAD, 4); - mv.visitMethodInsn(INVOKESPECIAL, "gregtech/api/metatileentity/implementations/GT_MetaTileEntity_Hatch_OutputBus", "<init>", "(Ljava/lang/String;IILjava/lang/String;[[[Lgregtech/api/interfaces/ITexture;)V", false); + mv.visitMethodInsn(INVOKESPECIAL, ""+aOutputFormatted+"", "<init>", "(Ljava/lang/String;IILjava/lang/String;[[[Lgregtech/api/interfaces/ITexture;)V", false); Label l1 = new Label(); mv.visitLabel(l1); mv.visitLineNumber(18, l1); mv.visitVarInsn(ALOAD, 0); mv.visitInsn(ACONST_NULL); - mv.visitFieldInsn(PUTFIELD, "gtPlusPlus/xmod/gregtech/api/metatileentity/implementations/GT_MetaTileEntity_SuperBus_Output", "mRecipeMap", "Lgregtech/api/util/GT_Recipe$GT_Recipe_Map;"); + mv.visitFieldInsn(PUTFIELD, ""+aSuperOutputFormatted+"", "mRecipeMap", "Lgregtech/api/util/GT_Recipe$GT_Recipe_Map;"); Label l2 = new Label(); mv.visitLabel(l2); mv.visitLineNumber(30, l2); mv.visitInsn(RETURN); Label l3 = new Label(); mv.visitLabel(l3); - mv.visitLocalVariable("this", "LgtPlusPlus/xmod/gregtech/api/metatileentity/implementations/GT_MetaTileEntity_SuperBus_Output;", null, l0, l3, 0); + mv.visitLocalVariable("this", "L"+aSuperOutputFormatted+";", null, l0, l3, 0); mv.visitLocalVariable("aName", "Ljava/lang/String;", null, l0, l3, 1); mv.visitLocalVariable("aTier", "I", null, l0, l3, 2); mv.visitLocalVariable("aDescription", "[Ljava/lang/String;", null, l0, l3, 3); @@ -612,7 +635,7 @@ public class ClassTransformer_GT_BusPatch { @Override public MethodVisitor visitMethod(int access, String name, String desc, String signature, String[] exceptions) { MethodVisitor methodVisitor; - if ((mClassName.equals(aSuperInput) || mClassName.equals(aSuperOutput)) && access == ACC_PUBLIC && name.equals("<init>") && (desc.equals("(Ljava/lang/String;ILjava/lang/String;[[[Lgregtech/api/interfaces/ITexture;)V") || desc.equals("(Ljava/lang/String;I[Ljava/lang/String;[[[Lgregtech/api/interfaces/ITexture;)V"))) { + if ((mClassName.equals(ClassesToTransform.GTPP_MTE_HATCH_SUPER_INPUT_BUS) || mClassName.equals(ClassesToTransform.GTPP_MTE_HATCH_SUPER_OUTPUT_BUS)) && access == ACC_PUBLIC && name.equals("<init>") && (desc.equals("(Ljava/lang/String;ILjava/lang/String;[[[Lgregtech/api/interfaces/ITexture;)V") || desc.equals("(Ljava/lang/String;I[Ljava/lang/String;[[[Lgregtech/api/interfaces/ITexture;)V"))) { FMLRelaunchLog.log("[GT++ ASM] Gregtech Bus Patch", Level.INFO, "Found Constructor, "+"'"+access+"', "+"'"+name+"', "+"'"+desc+"', "+"'"+signature+"'"); methodVisitor = null; } diff --git a/src/Java/gtPlusPlus/preloader/asm/transformers/ClassTransformer_GT_Client.java b/src/Java/gtPlusPlus/preloader/asm/transformers/ClassTransformer_GT_Client.java index da6abfe57c..e2d34c38e7 100644 --- a/src/Java/gtPlusPlus/preloader/asm/transformers/ClassTransformer_GT_Client.java +++ b/src/Java/gtPlusPlus/preloader/asm/transformers/ClassTransformer_GT_Client.java @@ -152,19 +152,24 @@ public class ClassTransformer_GT_Client { } if (aGregtech != null) { + File file = aGregtech; + FileInputStream fis; + JarInputStream jis; try { - File file = aGregtech; - FileInputStream fis = new FileInputStream(file); - JarInputStream jis = new JarInputStream(fis); + fis = new FileInputStream(file); + jis = new JarInputStream(fis); System.out.println(jis.markSupported()); JarEntry je; while((je=jis.getNextJarEntry())!=null){ if (je.getName().contains("GT_MetaTileEntity_AssemblyLine")) { FMLRelaunchLog.log("[GT++ ASM] Gregtech Client Proxy Patch", Level.INFO, "Patchable class | "+je.getName()); + jis.close(); return true; } } - jis.close(); + if (jis != null) { + jis.close(); + } return true; } catch (IOException e1) { } diff --git a/src/Java/gtPlusPlus/preloader/asm/transformers/ClassTransformer_GT_MetaGenerated_Tool.java b/src/Java/gtPlusPlus/preloader/asm/transformers/ClassTransformer_GT_MetaGenerated_Tool.java new file mode 100644 index 0000000000..b6cd9c8d67 --- /dev/null +++ b/src/Java/gtPlusPlus/preloader/asm/transformers/ClassTransformer_GT_MetaGenerated_Tool.java @@ -0,0 +1,116 @@ +package gtPlusPlus.preloader.asm.transformers; + +import static org.objectweb.asm.Opcodes.ACC_FINAL; +import static org.objectweb.asm.Opcodes.ACC_PUBLIC; +import static org.objectweb.asm.Opcodes.ALOAD; +import static org.objectweb.asm.Opcodes.ASM5; +import static org.objectweb.asm.Opcodes.INVOKESTATIC; +import static org.objectweb.asm.Opcodes.RETURN; + +import org.apache.logging.log4j.Level; +import org.objectweb.asm.AnnotationVisitor; +import org.objectweb.asm.ClassReader; +import org.objectweb.asm.ClassVisitor; +import org.objectweb.asm.ClassWriter; +import org.objectweb.asm.Label; +import org.objectweb.asm.MethodVisitor; + +import gtPlusPlus.preloader.Preloader_Logger; + +public class ClassTransformer_GT_MetaGenerated_Tool { + + private final boolean isValid; + private final ClassReader reader; + private final ClassWriter writer; + + public ClassTransformer_GT_MetaGenerated_Tool(byte[] basicClass) { + ClassReader aTempReader = null; + ClassWriter aTempWriter = null; + aTempReader = new ClassReader(basicClass); + aTempWriter = new ClassWriter(aTempReader, ClassWriter.COMPUTE_FRAMES); + aTempReader.accept(new LocalClassVisitor(aTempWriter), 0); + boolean completed = injectMethod("getSubItems", aTempWriter); + if (aTempReader != null && aTempWriter != null && completed) { + isValid = true; + } else { + isValid = false; + } + Preloader_Logger.LOG("GT Tool Fix", Level.INFO, "Valid? " + isValid + "."); + reader = aTempReader; + writer = aTempWriter; + } + + public boolean isValidTransformer() { + return isValid; + } + + public ClassReader getReader() { + return reader; + } + + public ClassWriter getWriter() { + return writer; + } + + public boolean injectMethod(String aMethodName, ClassWriter cw) { + MethodVisitor mv; + boolean didInject = false; + Preloader_Logger.LOG("GT Tool Fix", Level.INFO, "Injecting " + aMethodName + "."); + if (aMethodName.equals("getSubItems")) { + { + mv = cw.visitMethod(ACC_PUBLIC + ACC_FINAL, "getSubItems", "(Lnet/minecraft/item/Item;Lnet/minecraft/creativetab/CreativeTabs;Ljava/util/List;)V", null, null); + { + AnnotationVisitor av0 = mv.visitAnnotation("Lcpw/mods/fml/relauncher/SideOnly;", true); + av0.visitEnum("value", "Lcpw/mods/fml/relauncher/Side;", "CLIENT"); + av0.visitEnd(); + } + mv.visitCode(); + Label l0 = new Label(); + mv.visitLabel(l0); + mv.visitLineNumber(321, l0); + mv.visitVarInsn(ALOAD, 0); + mv.visitVarInsn(ALOAD, 1); + mv.visitVarInsn(ALOAD, 2); + mv.visitVarInsn(ALOAD, 3); + mv.visitMethodInsn(INVOKESTATIC, "gtPlusPlus/preloader/asm/helpers/MethodHelper_GT", "getSubItems", "(Lgregtech/api/items/GT_MetaGenerated_Tool;Lnet/minecraft/item/Item;Lnet/minecraft/creativetab/CreativeTabs;Ljava/util/List;)V", false); + Label l1 = new Label(); + mv.visitLabel(l1); + mv.visitLineNumber(322, l1); + mv.visitInsn(RETURN); + Label l2 = new Label(); + mv.visitLabel(l2); + mv.visitLocalVariable("this", "Lgregtech/api/items/GT_MetaGenerated_Tool;", null, l0, l2, 0); + mv.visitLocalVariable("var1", "Lnet/minecraft/item/Item;", null, l0, l2, 1); + mv.visitLocalVariable("aCreativeTab", "Lnet/minecraft/creativetab/CreativeTabs;", null, l0, l2, 2); + mv.visitLocalVariable("aList", "Ljava/util/List;", null, l0, l2, 3); + mv.visitMaxs(4, 4); + mv.visitEnd(); + didInject = true; + } + + } + Preloader_Logger.LOG("GT Tool Fix", Level.INFO, "Method injection complete."); + return didInject; + } + + public final class LocalClassVisitor extends ClassVisitor { + + public LocalClassVisitor(ClassVisitor cv) { + super(ASM5, cv); + } + + @Override + public MethodVisitor visitMethod(int access, String name, String desc, String signature, String[] exceptions) { + MethodVisitor methodVisitor; + if (name.equals("getSubItems") && desc.equals("(Lnet/minecraft/item/Item;Lnet/minecraft/creativetab/CreativeTabs;Ljava/util/List;)V")) { + methodVisitor = null; + Preloader_Logger.LOG("GT Tool Fix", Level.INFO, "Found method "+name+", removing."); + } + else { + methodVisitor = super.visitMethod(access, name, desc, signature, exceptions); + } + return methodVisitor; + } + } + +} diff --git a/src/Java/gtPlusPlus/preloader/asm/transformers/ClassTransformer_GT_Utility.java b/src/Java/gtPlusPlus/preloader/asm/transformers/ClassTransformer_GT_Utility.java index 36c09688bc..307900ad9e 100644 --- a/src/Java/gtPlusPlus/preloader/asm/transformers/ClassTransformer_GT_Utility.java +++ b/src/Java/gtPlusPlus/preloader/asm/transformers/ClassTransformer_GT_Utility.java @@ -15,6 +15,7 @@ import org.objectweb.asm.Label; import org.objectweb.asm.MethodVisitor; import cpw.mods.fml.relauncher.FMLRelaunchLog; +import gtPlusPlus.core.util.Utils; public class ClassTransformer_GT_Utility { @@ -66,7 +67,8 @@ public class ClassTransformer_GT_Utility { MethodVisitor mv; boolean didInject = false; ClassWriter cw = getWriter(); - FMLRelaunchLog.log("[GT++ ASM] Gregtech Utilities Patch", Level.INFO, "Injecting " + aMethodName + "."); + String aClassNameFormatted = Utils.class.getName().replace(".", "/"); + FMLRelaunchLog.log("[GT++ ASM] Gregtech Utilities Patch", Level.INFO, "Injecting " + aMethodName + ", static replacement call to "+aClassNameFormatted+"."); if (aMethodName.equals("getTier")) { mv = cw.visitMethod(ACC_PUBLIC + ACC_STATIC, "getTier", "(J)B", null, null); mv.visitCode(); @@ -74,7 +76,7 @@ public class ClassTransformer_GT_Utility { mv.visitLabel(l0); mv.visitLineNumber(23, l0); mv.visitVarInsn(LLOAD, 0); - mv.visitMethodInsn(INVOKESTATIC, "gtPlusPlus/core/util/Utils", "getTier", "(J)B", false); + mv.visitMethodInsn(INVOKESTATIC, aClassNameFormatted, "getTier", "(J)B", false); mv.visitInsn(IRETURN); Label l1 = new Label(); mv.visitLabel(l1); diff --git a/src/Java/gtPlusPlus/preloader/asm/transformers/Preloader_ClassTransformer2.java b/src/Java/gtPlusPlus/preloader/asm/transformers/Preloader_ClassTransformer2.java index 507e2cf974..443337bd35 100644 --- a/src/Java/gtPlusPlus/preloader/asm/transformers/Preloader_ClassTransformer2.java +++ b/src/Java/gtPlusPlus/preloader/asm/transformers/Preloader_ClassTransformer2.java @@ -1,40 +1,5 @@ package gtPlusPlus.preloader.asm.transformers; -import static org.objectweb.asm.Opcodes.*; - -import java.lang.reflect.Field; -import java.util.*; - -import org.apache.logging.log4j.Level; -import org.objectweb.asm.ClassVisitor; -import org.objectweb.asm.FieldVisitor; -import org.objectweb.asm.MethodVisitor; - -import cpw.mods.fml.relauncher.FMLRelaunchLog; - -import net.minecraft.block.Block; -import net.minecraft.block.BlockContainer; -import net.minecraft.entity.Entity; -import net.minecraft.entity.item.EntityItem; -import net.minecraft.init.Blocks; -import net.minecraft.item.ItemStack; -import net.minecraft.nbt.NBTTagCompound; -import net.minecraft.tileentity.TileEntity; -import net.minecraft.world.World; - -import gregtech.api.GregTech_API; -import gregtech.api.interfaces.tileentity.IGregTechTileEntity; -import gregtech.api.metatileentity.BaseMetaTileEntity; -import gregtech.api.metatileentity.MetaTileEntity; -import gregtech.common.blocks.GT_Block_Machines; - -import gtPlusPlus.api.objects.Logger; -import gtPlusPlus.api.objects.minecraft.BlockPos; -import gtPlusPlus.api.objects.random.XSTR; -import gtPlusPlus.core.util.minecraft.ItemUtils; -import gtPlusPlus.core.util.minecraft.NBTUtils; -import gtPlusPlus.core.util.reflect.ReflectionUtils; - public class Preloader_ClassTransformer2 { /** @@ -48,321 +13,4 @@ public class Preloader_ClassTransformer2 { * */ - - - public static boolean mHasSetField = false; - - private final static Class<BaseMetaTileEntity> customTransformer2 = BaseMetaTileEntity.class; - public static final class GT_MetaTile_Visitor extends ClassVisitor { - private boolean isGt_Block_Machines = false; - - public GT_MetaTile_Visitor(ClassVisitor cv, boolean isGt_Block_Machines) { - super(ASM5, cv); - this.isGt_Block_Machines = isGt_Block_Machines; - } - - @Override - public FieldVisitor visitField(int access, String name, String desc, String signature, Object value) { - FieldVisitor j = super.visitField(access, name, desc, signature, value); - if (!mHasSetField && !isGt_Block_Machines) { - mHasSetField = true; - FMLRelaunchLog.log("[GT++ ASM] NBTFixer", Level.INFO, "Injecting field 'mItemStorageNBT' into BaseMetaTileEntity.java. Access OpCode: "+access); - j = cv.visitField(0, "mItemStorageNBT", "Lnet/minecraft/nbt/NBTTagCompound;", null, null); - j.visitEnd(); - } - return j; - } - - @Override - public MethodVisitor visitMethod(int access, String name, String desc, String signature, String[] exceptions) { - MethodVisitor methodVisitor = super.visitMethod(access, name, desc, signature, exceptions); - - if (isGt_Block_Machines) { //Lnet/minecraft/world/World;IIILnet/minecraft/block/Block;I)V - if(name.equals("breakBlock") && desc.equals("(Lnet/minecraft/world/World;IIILnet/minecraft/block/Block;I)V")) { - FMLRelaunchLog.log("[GT++ ASM] NBTFixer", Level.INFO, "Found target method 'breakBlock' [Unobfuscated]. Access OpCode: "+access); - return new swapBreakBlock(methodVisitor); - } - else if (name.equals("breakBlock") && !desc.equals("(Lnet/minecraft/world/World;IIILnet/minecraft/block/Block;I)V")) { - FMLRelaunchLog.log("[GT++ ASM] NBTFixer", Level.INFO, "Found target method 'breakBlock' [Obfuscated]. Access OpCode: "+access); - return new swapBreakBlock(methodVisitor); - } - } - else { - if(name.equals("getDrops") && desc.equals("()Ljava/util/ArrayList;")) { - FMLRelaunchLog.log("[GT++ ASM] NBTFixer", Level.INFO, "Found target method 'getDrops'. Access OpCode: "+access); - return new swapGetDrops(methodVisitor); - } - } - return methodVisitor; - } - - } - - - - - private static final class swapGetDrops extends MethodVisitor { - - public swapGetDrops(MethodVisitor mv) { - super(ASM5, mv); - } - - @Override - public void visitCode() { - FMLRelaunchLog.log("[GT++ ASM] NBTFixer", Level.INFO, "Fixing Greg & Blood's poor attempt at setItemNBT()."); - super.visitCode(); - //ALOAD 0 - //INVOKESTATIC gtPlusPlus/preloader/asm/transformers/Preloader_ClassTransformer2 getDrops (Lgregtech/api/metatileentity/BaseMetaTileEntity;)Ljava/util/ArrayList; - //ARETURN - - super.visitVarInsn(ALOAD, 0); - super.visitMethodInsn(INVOKESTATIC, - "gtPlusPlus/preloader/asm/transformers/Preloader_ClassTransformer2", - "getDrops", - "(Lgregtech/api/metatileentity/BaseMetaTileEntity;)Ljava/util/ArrayList;", - false); - FMLRelaunchLog.log("[GT++ ASM] NBTFixer", Level.INFO, "Method should now be replaced."); - //super.visitVarInsn(ARETURN, 0); - super.visitInsn(ARETURN); - } - - } - - private static final class swapBreakBlock extends MethodVisitor { - - public swapBreakBlock(MethodVisitor mv) { - super(ASM5, mv); - } - - @Override - public void visitCode() { - FMLRelaunchLog.log("[GT++ ASM] NBTFixer", Level.INFO, "Fixing breakBlock() in GT_Block_Machines.class"); - super.visitCode(); - //super.visitVarInsn(ALOAD, 0); - - super.visitVarInsn(ALOAD, 1); - super.visitVarInsn(ILOAD, 2); - super.visitVarInsn(ILOAD, 3); - super.visitVarInsn(ILOAD, 4); - super.visitVarInsn(ALOAD, 5); - super.visitVarInsn(ILOAD, 6); - - super.visitMethodInsn(INVOKESTATIC, - "gtPlusPlus/preloader/asm/transformers/Preloader_ClassTransformer2", - "breakBlock", - "(Lnet/minecraft/world/World;IIILnet/minecraft/block/Block;I)V", - false); - FMLRelaunchLog.log("[GT++ ASM] NBTFixer", Level.INFO, "Method should now be replaced."); - super.visitInsn(RETURN); - } - - } - - - - - - - - - - - - - - - - - - - - - - - - - public static ArrayList<ItemStack> getDrops(BaseMetaTileEntity o) { - Logger.INFO("BaseMetaTileEntity.getDrops(BaseMetaTileEntity(this))"); - try { - short tID = (short) ReflectionUtils.getField(customTransformer2, "mID").get(o); - ItemStack rStack = new ItemStack(GregTech_API.sBlockMachines, 1, tID); - - NBTTagCompound i = new NBTTagCompound(); - - i = stupidFuckingNBTMap.get(new BlockPos(o.xCoord, o.yCoord, o.zCoord, o.getWorld())); - Logger.INFO("Got NBT Tag Value from map."); - - NBTTagCompound tNBT = i; - if (tNBT == null) { - Logger.INFO("Map tag was null."); - tNBT = generateGetDropsNBT(o); - } - if (!tNBT.hasNoTags()) { - rStack.setTagCompound(tNBT); - Logger.INFO("Iterating rStack NBT."); - NBTUtils.tryIterateNBTData(rStack); - } - return new ArrayList<ItemStack>(Arrays.asList(rStack)); - } - catch (IllegalArgumentException | IllegalAccessException a){ - Logger.REFLECTION("getDropsHack2"); - a.printStackTrace(); - } - ArrayList<ItemStack> u = new ArrayList<ItemStack>(Arrays.asList(new ItemStack[]{ItemUtils.getSimpleStack(Blocks.bedrock)})); - return u; - } - - public static Map<BlockPos, NBTTagCompound> stupidFuckingNBTMap = new HashMap<BlockPos, NBTTagCompound>(); - public static void breakBlock(final World aWorld, final int aX, final int aY, final int aZ, final Block block, - final int meta) { - Logger.INFO("GT_Block_Machines.breakBlock()"); - GregTech_API.causeMachineUpdate(aWorld, aX, aY, aZ); - final TileEntity tTileEntity = aWorld.getTileEntity(aX, aY, aZ); - if (tTileEntity instanceof IGregTechTileEntity) { - final IGregTechTileEntity tGregTechTileEntity = (IGregTechTileEntity) tTileEntity; - final Random tRandom = new XSTR(); - GT_Block_Machines.mTemporaryTileEntity.set(tGregTechTileEntity); - - //Try inject this - Logger.INFO("Hopefully saving ItemNBT data."); - - NBTTagCompound tNBT = new NBTTagCompound(); - tNBT = generateGetDropsNBT(tGregTechTileEntity.getMetaTileEntity().getBaseMetaTileEntity()); - tGregTechTileEntity.getMetaTileEntity().setItemNBT(tNBT); - Field fffff; - try { - fffff = ReflectionUtils.getField(tGregTechTileEntity.getClass(), "mItemStorageNBT"); - if (fffff == null) { - Logger.REFLECTION("Injected field is null."); - } - else { - fffff.set(tGregTechTileEntity.getMetaTileEntity().getBaseMetaTileEntity(), tNBT); - Logger.REFLECTION("Hopefully injected field data."); - stupidFuckingNBTMap.put(new BlockPos(aX, aY, aZ, tGregTechTileEntity.getMetaTileEntity().getBaseMetaTileEntity().getWorld()), tNBT); - Logger.INFO("Set NBT Tag Value to map."); - } - } - catch (IllegalArgumentException | IllegalAccessException e) { - e.printStackTrace(); - } - - for (int i = 0; i < tGregTechTileEntity.getSizeInventory(); ++i) { - final ItemStack tItem = tGregTechTileEntity.getStackInSlot(i); - if (tItem != null && tItem.stackSize > 0 && tGregTechTileEntity.isValidSlot(i)) { - - - - final EntityItem tItemEntity = new EntityItem(aWorld, - (double) (aX + tRandom.nextFloat() * 0.8f + 0.1f), - (double) (aY + tRandom.nextFloat() * 0.8f + 0.1f), - (double) (aZ + tRandom.nextFloat() * 0.8f + 0.1f), - new ItemStack(tItem.getItem(), tItem.stackSize, tItem.getItemDamage())); - if (tItem.hasTagCompound()) { - tItemEntity.getEntityItem().setTagCompound((NBTTagCompound) tItem.getTagCompound().copy()); - } - tItemEntity.motionX = tRandom.nextGaussian() * 0.0500000007450581; - tItemEntity.motionY = tRandom.nextGaussian() * 0.0500000007450581 + 0.2000000029802322; - tItemEntity.motionZ = tRandom.nextGaussian() * 0.0500000007450581; - aWorld.spawnEntityInWorld((Entity) tItemEntity); - tItem.stackSize = 0; - tGregTechTileEntity.setInventorySlotContents(i, (ItemStack) null); - } - } - } - - //gtPlusPlus.preloader.asm.transformers.Preloader_ClassTransformer2.breakBlockWorld(aWorld, aX, aY, aZ, block, meta); - aWorld.removeTileEntity(aX, aY, aZ); - } - - public static void breakBlockWorld(World world, int aX, int aY, int aZ, Block block, int meta){ - if (block.hasTileEntity(meta) && !(block instanceof BlockContainer)) - { - world.removeTileEntity(aX, aY, aZ); - } - } - - public static NBTTagCompound generateGetDropsNBT(IGregTechTileEntity iGregTechTileEntity) { - Logger.INFO("generateGetDropsNBT()"); - try { - short tID = (short) ReflectionUtils.getField(customTransformer2, "mID").get(iGregTechTileEntity); - NBTTagCompound tRecipeStuff = (NBTTagCompound) ReflectionUtils.getField(customTransformer2, "mRecipeStuff").get(iGregTechTileEntity); - boolean tMuffler = (boolean) ReflectionUtils.getField(customTransformer2, "mMuffler").get(iGregTechTileEntity); - boolean tLockUpgrade = (boolean) ReflectionUtils.getField(customTransformer2, "mLockUpgrade").get(iGregTechTileEntity); - boolean tSteamConverter = (boolean) ReflectionUtils.getField(customTransformer2, "mSteamConverter").get(iGregTechTileEntity); - byte tColor = (byte) ReflectionUtils.getField(customTransformer2, "mColor").get(iGregTechTileEntity); - byte tOtherUpgrades = (byte) ReflectionUtils.getField(customTransformer2, "mOtherUpgrades").get(iGregTechTileEntity); - byte tStrongRedstone = (byte) ReflectionUtils.getField(customTransformer2, "mStrongRedstone").get(iGregTechTileEntity); - int[] tCoverSides = (int[]) ReflectionUtils.getField(customTransformer2, "mCoverSides").get(iGregTechTileEntity); - int[] tCoverData = (int[]) ReflectionUtils.getField(customTransformer2, "mCoverData").get(iGregTechTileEntity); - - NBTTagCompound mItemStorageNBT; - MetaTileEntity tMetaTileEntity = (MetaTileEntity) ReflectionUtils.getField(customTransformer2, "mMetaTileEntity").get(iGregTechTileEntity); - Field fffff = ReflectionUtils.getField(customTransformer2, "mItemStorageNBT"); - if (fffff == null) { - Logger.REFLECTION("Injected field is null."); - mItemStorageNBT = new NBTTagCompound(); - } - else { - Logger.REFLECTION("Injected field exists."); - if (fffff.get(iGregTechTileEntity) != null) { - Logger.REFLECTION("Injected field has value."); - mItemStorageNBT = (NBTTagCompound) fffff.get(iGregTechTileEntity); - } - else { - Logger.REFLECTION("Injected field has no value."); - mItemStorageNBT = null; - } - } - - //BaseMetaTileEntity tMetaTileEntity = o; - - Logger.REFLECTION("tID: "+(tID != 0)); - Logger.REFLECTION("tRecipeStuff: "+(tRecipeStuff != null)); - Logger.REFLECTION("tMuffler: "+(tMuffler != false)); - Logger.REFLECTION("tLockUpgrade: "+(tLockUpgrade != false)); - Logger.REFLECTION("tSteamConverter: "+(tSteamConverter != false)); - Logger.REFLECTION("tColor: "+(tColor != 0)); - Logger.REFLECTION("tOtherUpgrades: "+(tOtherUpgrades != 0)); - Logger.REFLECTION("tCoverSides: "+(tCoverSides != null)); - Logger.REFLECTION("tCoverData: "+(tCoverData != null)); - Logger.REFLECTION("tMetaTileEntity: "+(tMetaTileEntity != null)); - Logger.REFLECTION("mItemStorageNBT: "+(mItemStorageNBT != null)); - - //mItemStorageNBT - NBTTagCompound tNBT = new NBTTagCompound(); - - if (tRecipeStuff != null && !tRecipeStuff.hasNoTags()) tNBT.setTag("GT.CraftingComponents", tRecipeStuff); - if (mItemStorageNBT != null && !mItemStorageNBT.hasNoTags()) tNBT.setTag("mItemStorageNBT", mItemStorageNBT); - if (tMuffler) tNBT.setBoolean("mMuffler", tMuffler); - if (tLockUpgrade) tNBT.setBoolean("mLockUpgrade", tLockUpgrade); - if (tSteamConverter) tNBT.setBoolean("mSteamConverter", tSteamConverter); - if (tColor > 0) tNBT.setByte("mColor", tColor); - //if (tFluid != null) tFluid.writeToNBT(tNBT); - //if (tFluid != null) tNBT.setTag("mFluid", tFluid); - if (tOtherUpgrades > 0) tNBT.setByte("mOtherUpgrades", tOtherUpgrades); - if (tStrongRedstone > 0) tNBT.setByte("mStrongRedstone", tStrongRedstone); - for (byte i = 0; i < tCoverSides.length; i++) { - if (tCoverSides[i] != 0) { - tNBT.setIntArray("mCoverData", tCoverData); - tNBT.setIntArray("mCoverSides", tCoverSides); - break; - } - } - - //Set stack NBT - if (!tNBT.hasNoTags()) { - Logger.INFO("Returning Valid NBT data"); - return tNBT; - } - else { - Logger.INFO("Returning Invalid NBT data"); - } - } - catch (IllegalArgumentException | IllegalAccessException a){ - Logger.REFLECTION("getDropsHack2"); - a.printStackTrace(); - } - return new NBTTagCompound(); - } - } diff --git a/src/Java/gtPlusPlus/preloader/asm/transformers/Preloader_Transformer_Handler.java b/src/Java/gtPlusPlus/preloader/asm/transformers/Preloader_Transformer_Handler.java index d378883665..5dc7dcfbc8 100644 --- a/src/Java/gtPlusPlus/preloader/asm/transformers/Preloader_Transformer_Handler.java +++ b/src/Java/gtPlusPlus/preloader/asm/transformers/Preloader_Transformer_Handler.java @@ -1,15 +1,65 @@ package gtPlusPlus.preloader.asm.transformers; +import static gtPlusPlus.preloader.asm.ClassesToTransform.COFH_ORE_DICTIONARY_ARBITER; +import static gtPlusPlus.preloader.asm.ClassesToTransform.FORGE_CHUNK_MANAGER; +import static gtPlusPlus.preloader.asm.ClassesToTransform.FORGE_ORE_DICTIONARY; +import static gtPlusPlus.preloader.asm.ClassesToTransform.GALACTICRAFT_ENTITY_AUTO_ROCKET; +import static gtPlusPlus.preloader.asm.ClassesToTransform.GALACTICRAFT_FLUID_UTILS; +import static gtPlusPlus.preloader.asm.ClassesToTransform.GALACTICRAFT_TILE_ENTITY_FUEL_LOADER; +import static gtPlusPlus.preloader.asm.ClassesToTransform.GTPP_MTE_HATCH_SUPER_INPUT_BUS; +import static gtPlusPlus.preloader.asm.ClassesToTransform.GTPP_MTE_HATCH_SUPER_OUTPUT_BUS; +import static gtPlusPlus.preloader.asm.ClassesToTransform.GT_ACHIEVEMENTS; +import static gtPlusPlus.preloader.asm.ClassesToTransform.GT_BASE_META_TILE_ENTITY; +import static gtPlusPlus.preloader.asm.ClassesToTransform.GT_BLOCK_MACHINES; +import static gtPlusPlus.preloader.asm.ClassesToTransform.GT_CLIENT_PROXY; +import static gtPlusPlus.preloader.asm.ClassesToTransform.GT_ITEM_MACHINES; +import static gtPlusPlus.preloader.asm.ClassesToTransform.GT_METAGENERATED_TOOL; +import static gtPlusPlus.preloader.asm.ClassesToTransform.GT_METAPIPE_FLUID; +import static gtPlusPlus.preloader.asm.ClassesToTransform.GT_METAPIPE_FRAME; +import static gtPlusPlus.preloader.asm.ClassesToTransform.GT_METAPIPE_ITEM; +import static gtPlusPlus.preloader.asm.ClassesToTransform.GT_MTE_CHARCOAL_PIT; +import static gtPlusPlus.preloader.asm.ClassesToTransform.GT_MTE_HATCH_INPUTBUS; +import static gtPlusPlus.preloader.asm.ClassesToTransform.GT_MTE_HATCH_OUTPUTBUS; +import static gtPlusPlus.preloader.asm.ClassesToTransform.GT_PACKET_TILE_ENTITY; +import static gtPlusPlus.preloader.asm.ClassesToTransform.GT_UTILITY; +import static gtPlusPlus.preloader.asm.ClassesToTransform.IC2_BLOCK_BASE_TILE_ENTITY; +import static gtPlusPlus.preloader.asm.ClassesToTransform.IC2_BLOCK_CHARGEPAD; +import static gtPlusPlus.preloader.asm.ClassesToTransform.IC2_BLOCK_ELECTRIC; +import static gtPlusPlus.preloader.asm.ClassesToTransform.IC2_BLOCK_GENERATOR; +import static gtPlusPlus.preloader.asm.ClassesToTransform.IC2_BLOCK_HEAT_GENERATOR; +import static gtPlusPlus.preloader.asm.ClassesToTransform.IC2_BLOCK_KINETIC_GENERATOR; +import static gtPlusPlus.preloader.asm.ClassesToTransform.IC2_BLOCK_LUMINATOR; +import static gtPlusPlus.preloader.asm.ClassesToTransform.IC2_BLOCK_MACHINE1; +import static gtPlusPlus.preloader.asm.ClassesToTransform.IC2_BLOCK_MACHINE2; +import static gtPlusPlus.preloader.asm.ClassesToTransform.IC2_BLOCK_MACHINE3; +import static gtPlusPlus.preloader.asm.ClassesToTransform.IC2_BLOCK_PERSONAL; +import static gtPlusPlus.preloader.asm.ClassesToTransform.IC2_BLOCK_REACTOR_ACCESS_HATCH; +import static gtPlusPlus.preloader.asm.ClassesToTransform.IC2_BLOCK_REACTOR_CHAMBER; +import static gtPlusPlus.preloader.asm.ClassesToTransform.IC2_BLOCK_REACTOR_FLUID_PORT; +import static gtPlusPlus.preloader.asm.ClassesToTransform.IC2_BLOCK_REACTOR_REDSTONE_PORT; +import static gtPlusPlus.preloader.asm.ClassesToTransform.IC2_BLOCK_REACTOR_VESSEL; +import static gtPlusPlus.preloader.asm.ClassesToTransform.IC2_ITEM_ARMOUR_HAZMAT; +import static gtPlusPlus.preloader.asm.ClassesToTransform.LWJGL_KEYBOARD; +import static gtPlusPlus.preloader.asm.ClassesToTransform.MINECRAFT_GAMESETTINGS; +import static gtPlusPlus.preloader.asm.ClassesToTransform.MINECRAFT_GAMESETTINGS_OBF; +import static gtPlusPlus.preloader.asm.ClassesToTransform.RAILCRAFT_FLUID_HELPER; +import static gtPlusPlus.preloader.asm.ClassesToTransform.RAILCRAFT_INVENTORY_TOOLS; +import static gtPlusPlus.preloader.asm.ClassesToTransform.RAILCRAFT_TILE_FLUID_LOADER; +import static gtPlusPlus.preloader.asm.ClassesToTransform.THAUMCRAFT_ITEM_WISP_ESSENCE; +import static gtPlusPlus.preloader.asm.ClassesToTransform.TINKERS_FLUID_BLOCK; + import java.io.File; import java.io.IOException; -import org.apache.logging.log4j.Level; import org.objectweb.asm.ClassReader; import org.objectweb.asm.ClassWriter; import cpw.mods.fml.relauncher.CoreModManager; -import cpw.mods.fml.relauncher.FMLRelaunchLog; import cpw.mods.fml.relauncher.ReflectionHelper; +import gtPlusPlus.api.objects.data.AutoMap; +import gtPlusPlus.preloader.CORE_Preloader; +import gtPlusPlus.preloader.DevHelper; +import gtPlusPlus.preloader.Preloader_Logger; import gtPlusPlus.preloader.asm.AsmConfig; import gtPlusPlus.preloader.asm.transformers.Preloader_ClassTransformer.OreDictionaryVisitor; import net.minecraft.launchwrapper.IClassTransformer; @@ -17,18 +67,29 @@ import net.minecraft.launchwrapper.Launch; public class Preloader_Transformer_Handler implements IClassTransformer { - private final boolean mEnabled = false; public static final AsmConfig mConfig; - - private static final String class_Block_Machines = "gregtech.common.blocks.GT_Block_Machines"; - private static final String class_GT_MetaPipeEntity_Item = "gregtech.api.metatileentity.implementations.GT_MetaPipeEntity_Item"; - private static final String class_GT_MetaPipeEntity_Frame = "gregtech.api.metatileentity.implementations.GT_MetaPipeEntity_Frame"; - private static final String class_GT_MetaPipeEntity_Fluid = "gregtech.api.metatileentity.implementations.GT_MetaPipeEntity_Fluid"; + public static final AutoMap<String> IC2_WRENCH_PATCH_CLASS_NAMES = new AutoMap<String>(); static { mConfig = new AsmConfig(new File("config/GTplusplus/asm.cfg")); - System.out.println("[GT++ ASM] Asm Config Location: "+mConfig.config.getConfigFile().getAbsolutePath()); - System.out.println("[GT++ ASM] Is DevHelper Valid? "+gtPlusPlus.preloader.DevHelper.mIsValidHelper); + Preloader_Logger.INFO("Config Location: "+AsmConfig.config.getConfigFile().getAbsolutePath()); + Preloader_Logger.INFO("Is DevHelper Valid? "+DevHelper.mIsValidHelper); + IC2_WRENCH_PATCH_CLASS_NAMES.add(IC2_BLOCK_BASE_TILE_ENTITY); + IC2_WRENCH_PATCH_CLASS_NAMES.add(IC2_BLOCK_MACHINE1); + IC2_WRENCH_PATCH_CLASS_NAMES.add(IC2_BLOCK_MACHINE2); + IC2_WRENCH_PATCH_CLASS_NAMES.add(IC2_BLOCK_MACHINE3); + IC2_WRENCH_PATCH_CLASS_NAMES.add(IC2_BLOCK_KINETIC_GENERATOR); + IC2_WRENCH_PATCH_CLASS_NAMES.add(IC2_BLOCK_HEAT_GENERATOR); + IC2_WRENCH_PATCH_CLASS_NAMES.add(IC2_BLOCK_GENERATOR); + IC2_WRENCH_PATCH_CLASS_NAMES.add(IC2_BLOCK_REACTOR_ACCESS_HATCH); + IC2_WRENCH_PATCH_CLASS_NAMES.add(IC2_BLOCK_REACTOR_CHAMBER); + IC2_WRENCH_PATCH_CLASS_NAMES.add(IC2_BLOCK_REACTOR_FLUID_PORT); + IC2_WRENCH_PATCH_CLASS_NAMES.add(IC2_BLOCK_REACTOR_REDSTONE_PORT); + IC2_WRENCH_PATCH_CLASS_NAMES.add(IC2_BLOCK_REACTOR_VESSEL); + IC2_WRENCH_PATCH_CLASS_NAMES.add(IC2_BLOCK_PERSONAL); + IC2_WRENCH_PATCH_CLASS_NAMES.add(IC2_BLOCK_CHARGEPAD); + IC2_WRENCH_PATCH_CLASS_NAMES.add(IC2_BLOCK_ELECTRIC); + IC2_WRENCH_PATCH_CLASS_NAMES.add(IC2_BLOCK_LUMINATOR); } private static Boolean mObf = null; @@ -65,89 +126,88 @@ public class Preloader_Transformer_Handler implements IClassTransformer { * Only EntityLivingBase is left untouched, as nothing else truly needs to be calling this method and avoiding forge hooks. * May exclude all vanilla/forge class if this causes issues though. */ - PatchForge : if (mConfig.enabledFixEntitySetHealth && !transformedName.contains("gtPlusPlus.preloader")) { - - //Skip Vanilla/Forge Classes - if (transformedName.contains("net.minecraft.") || transformedName.contains("cpw.")) { - //break PatchForge; - } - - ClassTransformer_Forge_EntityLivingBase_SetHealth aForgeHealthFix = new ClassTransformer_Forge_EntityLivingBase_SetHealth(transformedName, basicClass); - if (aForgeHealthFix.isValidTransformer() && aForgeHealthFix.didPatchClass()) { - FMLRelaunchLog.log("[GT++ ASM] Fix EntityLivingBase.setHealth misuse", Level.INFO, "Transforming %s", transformedName); - basicClass = aForgeHealthFix.getWriter().toByteArray(); - } - } + /* PatchForge : if (AsmConfig.enabledFixEntitySetHealth && !transformedName.contains("gtPlusPlus.preloader")) { + + //Skip Vanilla/Forge Classes + if (transformedName.contains("net.minecraft.") || transformedName.contains("cpw.")) { + //break PatchForge; + } + + ClassTransformer_Forge_EntityLivingBase_SetHealth aForgeHealthFix = new ClassTransformer_Forge_EntityLivingBase_SetHealth(transformedName, basicClass); + if (aForgeHealthFix.isValidTransformer() && aForgeHealthFix.didPatchClass()) { + Preloader_Logger.INFO("Fix EntityLivingBase.setHealth misuse", "Transforming "+transformedName); + basicClass = aForgeHealthFix.getWriter().toByteArray(); + } + }*/ // Is this environment obfuscated? (Extra checks just in case some weird shit happens during the check) - boolean obfuscated = checkObfuscated(); - boolean probablyShouldBeFalse = false; + final boolean obfuscated = checkObfuscated(); // Fix LWJGL index array out of bounds on keybinding IDs - if ((transformedName.equals("org.lwjgl.input.Keyboard") || transformedName.equals("bbj") || transformedName.equals("net.minecraft.client.settings.GameSettings")) && mConfig.enabledLwjglKeybindingFix) { + if ((transformedName.equals(LWJGL_KEYBOARD) || transformedName.equals(MINECRAFT_GAMESETTINGS_OBF) || transformedName.equals(MINECRAFT_GAMESETTINGS)) && AsmConfig.enabledLwjglKeybindingFix) { boolean isClientSettingsClass = false; if (!transformedName.equals("org.lwjgl.input.Keyboard")) { isClientSettingsClass = true; } - FMLRelaunchLog.log("[GT++ ASM] LWJGL Keybinding index out of bounds fix", Level.INFO, "Transforming %s", transformedName); + Preloader_Logger.INFO("LWJGL Keybinding index out of bounds fix", "Transforming "+transformedName); return new ClassTransformer_LWJGL_Keyboard(basicClass, isClientSettingsClass).getWriter().toByteArray(); } //Enable mapping of Tickets and loaded chunks. - Forge - if (transformedName.equals("net.minecraftforge.common.ForgeChunkManager") && mConfig.enableChunkDebugging) { - FMLRelaunchLog.log("[GT++ ASM] Chunkloading Patch", Level.INFO, "Transforming %s", transformedName); - return new ClassTransformer_Forge_ChunkLoading(basicClass, probablyShouldBeFalse).getWriter().toByteArray(); + if (transformedName.equals(FORGE_CHUNK_MANAGER) && AsmConfig.enableChunkDebugging) { + Preloader_Logger.INFO("Chunkloading Patch", "Transforming "+transformedName); + return new ClassTransformer_Forge_ChunkLoading(basicClass, false).getWriter().toByteArray(); } // Fix the OreDictionary - Forge - if (transformedName.equals("net.minecraftforge.oredict.OreDictionary")) { - FMLRelaunchLog.log("[GT++ ASM] OreDictTransformer", Level.INFO, "Transforming %s", transformedName); + if (transformedName.equals(FORGE_ORE_DICTIONARY) && AsmConfig.enableOreDictPatch) { + Preloader_Logger.INFO("OreDictTransformer", "Transforming "+transformedName); ClassWriter classWriter = new ClassWriter(ClassWriter.COMPUTE_FRAMES); new ClassReader(basicClass).accept(new OreDictionaryVisitor(classWriter), 0); return classWriter.toByteArray(); } // Fix the OreDictionary COFH - if (transformedName.equals("cofh.core.util.oredict.OreDictionaryArbiter") && (mConfig.enableCofhPatch || !obfuscated)) { - FMLRelaunchLog.log("[GT++ ASM] COFH", Level.INFO, "Transforming %s", transformedName); + if (transformedName.equals(COFH_ORE_DICTIONARY_ARBITER) && (AsmConfig.enableCofhPatch || !obfuscated)) { + Preloader_Logger.INFO("COFH", "Transforming "+transformedName); return new ClassTransformer_COFH_OreDictionaryArbiter(basicClass).getWriter().toByteArray(); } // Fix Tinkers Fluids - if (transformedName.equals("tconstruct.smeltery.blocks.TConstructFluid") && mConfig.enableTiConFluidLighting) { - FMLRelaunchLog.log("[GT++ ASM] Bright Fluids", Level.INFO, "Transforming %s", transformedName); + if (transformedName.equals(TINKERS_FLUID_BLOCK) && AsmConfig.enableTiConFluidLighting) { + Preloader_Logger.INFO("Bright Fluids", "Transforming "+transformedName); return new ClassTransformer_TiConFluids("getLightValue", obfuscated, basicClass).getWriter().toByteArray(); } //Fix RC stuff //Patching PROCESS_VOLUME to allow more transfer limits - if (transformedName.equals("mods.railcraft.common.fluids.FluidHelper") && (mConfig.enableRcFlowFix && mConfig.maxRailcraftTankProcessVolume != 4000)) { - FMLRelaunchLog.log("[GT++ ASM] Railcraft PROCESS_VOLUME Patch", Level.INFO, "Transforming %s", transformedName); + if (transformedName.equals(RAILCRAFT_FLUID_HELPER) && (AsmConfig.enableRcFlowFix && AsmConfig.maxRailcraftTankProcessVolume != 4000)) { + Preloader_Logger.INFO("Railcraft PROCESS_VOLUME Patch", "Transforming "+transformedName); return new ClassTransformer_Railcraft_FluidHelper(basicClass, obfuscated).getWriter().toByteArray(); } //Patching TRANSFER_RATE in Fluid Loaders/Unloaders - if ((transformedName.equals("mods.railcraft.common.blocks.machine.gamma.TileFluidLoader") && mConfig.maxRailcraftFluidLoaderFlow != 20) || (transformedName.equals("mods.railcraft.common.blocks.machine.gamma.TileFluidUnloader") && mConfig.maxRailcraftFluidUnloaderFlow != 80)) { - FMLRelaunchLog.log("[GT++ ASM] Railcraft TRANSFER_RATE Patch", Level.INFO, "Transforming %s", transformedName); + if ((transformedName.equals(RAILCRAFT_TILE_FLUID_LOADER) && AsmConfig.maxRailcraftFluidLoaderFlow != 20) || (transformedName.equals("mods.railcraft.common.blocks.machine.gamma.TileFluidUnloader") && AsmConfig.maxRailcraftFluidUnloaderFlow != 80)) { + Preloader_Logger.INFO("Railcraft TRANSFER_RATE Patch", "Transforming "+transformedName); return new ClassTransformer_Railcraft_FluidCartHandling(basicClass, obfuscated, transformedName).getWriter().toByteArray(); } //Fix Weird glitch involving negative itemstacks. - if (transformedName.equals("mods.railcraft.common.util.inventory.InvTools") && mConfig.enableRcItemDupeFix) { - FMLRelaunchLog.log("[GT++ ASM] Railcraft negative ItemStack Fix", Level.INFO, "Transforming %s", transformedName); + if (transformedName.equals(RAILCRAFT_INVENTORY_TOOLS) && AsmConfig.enableRcItemDupeFix) { + Preloader_Logger.INFO("Railcraft negative ItemStack Fix", "Transforming "+transformedName); return new ClassTransformer_Railcraft_InvTools(basicClass, obfuscated).getWriter().toByteArray(); } //Fix GC stuff - if (mConfig.enableGcFuelChanges) { - if (transformedName.equals("micdoodle8.mods.galacticraft.core.util.FluidUtil")) { - FMLRelaunchLog.log("[GT++ ASM] Galacticraft FluidUtils Patch", Level.INFO, "Transforming %s", transformedName); - return new ClassTransformer_GC_FluidUtil(basicClass, probablyShouldBeFalse).getWriter().toByteArray(); + if (AsmConfig.enableGcFuelChanges) { + if (transformedName.equals(GALACTICRAFT_FLUID_UTILS)) { + Preloader_Logger.INFO("Galacticraft FluidUtils Patch", "Transforming "+transformedName); + return new ClassTransformer_GC_FluidUtil(basicClass, false).getWriter().toByteArray(); } - if (transformedName.equals("micdoodle8.mods.galacticraft.core.tile.TileEntityFuelLoader")) { - FMLRelaunchLog.log("[GT++ ASM] Galacticraft Fuel_Loader Patch", Level.INFO, "Transforming %s", transformedName); - return new ClassTransformer_GC_FuelLoader(basicClass, probablyShouldBeFalse).getWriter().toByteArray(); + if (transformedName.equals(GALACTICRAFT_TILE_ENTITY_FUEL_LOADER)) { + Preloader_Logger.INFO("Galacticraft Fuel_Loader Patch", "Transforming "+transformedName); + return new ClassTransformer_GC_FuelLoader(basicClass, false).getWriter().toByteArray(); } - if (transformedName.equals("micdoodle8.mods.galacticraft.api.prefab.entity.EntityAutoRocket")) { - FMLRelaunchLog.log("[GT++ ASM] Galacticraft EntityAutoRocket Patch", Level.INFO, "Transforming %s", transformedName); - return new ClassTransformer_GC_EntityAutoRocket(basicClass, probablyShouldBeFalse).getWriter().toByteArray(); + if (transformedName.equals(GALACTICRAFT_ENTITY_AUTO_ROCKET)) { + Preloader_Logger.INFO("Galacticraft EntityAutoRocket Patch", "Transforming "+transformedName); + return new ClassTransformer_GC_EntityAutoRocket(basicClass, false).getWriter().toByteArray(); } } @@ -161,42 +221,46 @@ public class Preloader_Transformer_Handler implements IClassTransformer { */ //Make GT_Utilities safer - if (transformedName.equals("gtPlusPlus.preloader.asm.transformers.ClassTransformer_GT_Utility")) { - FMLRelaunchLog.log("[GT++ ASM] Gregtech Utilities Patch", Level.INFO, "Transforming %s", transformedName); + if (transformedName.equals(GT_UTILITY)) { + Preloader_Logger.INFO("Gregtech Utilities Patch", "Transforming "+transformedName); return new ClassTransformer_GT_Utility(basicClass, transformedName).getWriter().toByteArray(); } //Inject Custom constructors for Busses - if (transformedName.equals(ClassTransformer_GT_BusPatch.aInput) || transformedName.equals(ClassTransformer_GT_BusPatch.aOutput) || transformedName.equals(ClassTransformer_GT_BusPatch.aSuperInput) || transformedName.equals(ClassTransformer_GT_BusPatch.aSuperOutput)) { - FMLRelaunchLog.log("[GT++ ASM] Gregtech Bus Patch", Level.INFO, "Transforming %s", transformedName); + if (transformedName.equals(GT_MTE_HATCH_INPUTBUS) || transformedName.equals(GT_MTE_HATCH_OUTPUTBUS) || transformedName.equals(GTPP_MTE_HATCH_SUPER_INPUT_BUS) || transformedName.equals(GTPP_MTE_HATCH_SUPER_OUTPUT_BUS)) { + Preloader_Logger.INFO("Gregtech Bus Patch", "Transforming "+transformedName); return new ClassTransformer_GT_BusPatch(basicClass, transformedName).getWriter().toByteArray(); } //Try patch achievements - if (transformedName.equals("gregtech.loaders.misc.GT_Achievements")) { - FMLRelaunchLog.log("[GT++ ASM] Gregtech Achievements Patch", Level.INFO, "Transforming %s", transformedName); + if (transformedName.equals(GT_ACHIEVEMENTS)) { + Preloader_Logger.INFO("Gregtech Achievements Patch", "Transforming "+transformedName); return new ClassTransformer_GT_Achievements_CrashFix(basicClass, obfuscated).getWriter().toByteArray(); } //Fix bad handling of a loop left from original decompilation //Also Fix Achievements, although currently disabled. - if (transformedName.equals("gregtech.common.GT_Client")) { - FMLRelaunchLog.log("[GT++ ASM] Gregtech Client Proxy Patch", Level.INFO, "Transforming %s", transformedName); + if (transformedName.equals(GT_CLIENT_PROXY)) { + Preloader_Logger.INFO("Gregtech Client Proxy Patch", "Transforming "+transformedName); return new ClassTransformer_GT_Client(basicClass, obfuscated).getByteArray(); } //Make GT packets safer, fill them with debug info. - if (transformedName.equals("gregtech.api.net.GT_Packet_TileEntity")) { - FMLRelaunchLog.log("[GT++ ASM] Gregtech GT_Packet_TileEntity Patch", Level.INFO, "Transforming %s", transformedName); + if (transformedName.equals(GT_PACKET_TILE_ENTITY)) { + Preloader_Logger.INFO("Gregtech GT_Packet_TileEntity Patch", "Transforming "+transformedName); return new ClassTransformer_GT_Packet_TileEntity(basicClass, obfuscated).getWriter().toByteArray(); } //Make the setting of GT Tiles safer, so as not to crash the client. - if (transformedName.equals("gregtech.api.metatileentity.BaseMetaTileEntity")) { - FMLRelaunchLog.log("[GT++ ASM] Gregtech setMetaTileEntity Patch", Level.INFO, "Transforming %s", transformedName); + if (transformedName.equals(GT_BASE_META_TILE_ENTITY)) { + Preloader_Logger.INFO("Gregtech setMetaTileEntity Patch", "Transforming "+transformedName); return new ClassTransformer_GT_BaseMetaTileEntity(basicClass).getWriter().toByteArray(); } - + //Add extra tools if we're in a dev environment. + if (transformedName.equals(GT_METAGENERATED_TOOL) && CORE_Preloader.DEV_ENVIRONMENT) { + Preloader_Logger.INFO("Gregtech Additional Tools Patch", "Transforming "+transformedName); + return new ClassTransformer_GT_MetaGenerated_Tool(basicClass).getWriter().toByteArray(); + } //Fix log handling on the charcoal pit - if (transformedName.equals("gregtech.common.tileentities.machines.multi.GT_MetaTileEntity_Charcoal_Pit") && mConfig.enableGtCharcoalPitFix) { - FMLRelaunchLog.log("[GT++ ASM] GT Charcoal Pit Fix", Level.INFO, "Transforming %s", transformedName); + if (transformedName.equals(GT_MTE_CHARCOAL_PIT) && AsmConfig.enableGtCharcoalPitFix) { + Preloader_Logger.INFO("GT Charcoal Pit Fix", "Transforming "+transformedName); return new ClassTransformer_GT_CharcoalPit(basicClass, obfuscated).getWriter().toByteArray(); } @@ -204,71 +268,53 @@ public class Preloader_Transformer_Handler implements IClassTransformer { //Patching Meta Tile Tooltips - if (transformedName.equals("gregtech.common.blocks.GT_Item_Machines") && mConfig.enableGtTooltipFix) { - FMLRelaunchLog.log("[GT++ ASM] Gregtech Tooltip Patch", Level.INFO, "Transforming %s", transformedName); - return new ClassTransformer_GT_ItemMachines_Tooltip(basicClass, probablyShouldBeFalse).getWriter().toByteArray(); + if (transformedName.equals(GT_ITEM_MACHINES) && AsmConfig.enableGtTooltipFix) { + Preloader_Logger.INFO("Gregtech Tooltip Patch", "Transforming "+transformedName); + return new ClassTransformer_GT_ItemMachines_Tooltip(basicClass, false).getWriter().toByteArray(); } - if (transformedName.equals(class_Block_Machines)) { + if (transformedName.equals(GT_BLOCK_MACHINES)) { //Fix GT NBT Persistency issue - FMLRelaunchLog.log("[GT++ ASM] Gregtech NBT Persistency Patch", Level.INFO, "Transforming %s", transformedName); - byte[] g = new ClassTransformer_GT_BlockMachines_NBT(basicClass, probablyShouldBeFalse).getWriter().toByteArray(); - FMLRelaunchLog.log("[GT++ ASM] Gregtech getTileEntityBaseType Patch", Level.INFO, "Transforming %s", transformedName); - return new ClassTransformer_GT_BlockMachines_MetaPipeEntity(g, probablyShouldBeFalse, 0).getWriter().toByteArray(); + Preloader_Logger.INFO("Gregtech NBT Persistency Patch", "Transforming "+transformedName); + byte[] g = new ClassTransformer_GT_BlockMachines_NBT(basicClass, false).getWriter().toByteArray(); + Preloader_Logger.INFO("Gregtech getTileEntityBaseType Patch", "Transforming "+transformedName); + return new ClassTransformer_GT_BlockMachines_MetaPipeEntity(g, 0).getWriter().toByteArray(); } - if (transformedName.equals(class_GT_MetaPipeEntity_Item) || transformedName.equals(class_GT_MetaPipeEntity_Frame) || transformedName.equals(class_GT_MetaPipeEntity_Fluid)) { - FMLRelaunchLog.log("[GT++ ASM] Gregtech getTileEntityBaseType Patch", Level.INFO, "Transforming %s", transformedName); + if (transformedName.equals(GT_METAPIPE_ITEM) || transformedName.equals(GT_METAPIPE_FRAME) || transformedName.equals(GT_METAPIPE_FLUID)) { + Preloader_Logger.INFO("Gregtech getTileEntityBaseType Patch", "Transforming "+transformedName); int mode = 0; - if (transformedName.equals(class_GT_MetaPipeEntity_Item)) { + if (transformedName.equals(GT_METAPIPE_ITEM)) { mode = 1; } - else if (transformedName.equals(class_GT_MetaPipeEntity_Frame)) { + else if (transformedName.equals(GT_METAPIPE_FRAME)) { mode = 2; } else { mode = 3; } - return new ClassTransformer_GT_BlockMachines_MetaPipeEntity(basicClass, probablyShouldBeFalse, mode).getWriter().toByteArray(); + return new ClassTransformer_GT_BlockMachines_MetaPipeEntity(basicClass, mode).getWriter().toByteArray(); } - String[] aIC2ClassNames = new String[] { - "ic2.core.block.BlockTileEntity", - "ic2.core.block.machine.BlockMachine", - "ic2.core.block.machine.BlockMachine2", - "ic2.core.block.machine.BlockMachine3", - "ic2.core.block.kineticgenerator.block.BlockKineticGenerator", - "ic2.core.block.heatgenerator.block.BlockHeatGenerator", - "ic2.core.block.generator.block.BlockGenerator", - "ic2.core.block.reactor.block.BlockReactorAccessHatch", - "ic2.core.block.reactor.block.BlockReactorChamber", - "ic2.core.block.reactor.block.BlockReactorFluidPort", - "ic2.core.block.reactor.block.BlockReactorRedstonePort", - "ic2.core.block.reactor.block.BlockReactorVessel", - "ic2.core.block.personal.BlockPersonal.class", - "ic2.core.block.wiring.BlockChargepad.class", - "ic2.core.block.wiring.BlockElectric.class", - "ic2.core.block.wiring.BlockLuminator.class", - }; - - //Fix IC2 Shit - for (String y : aIC2ClassNames) { + + //Fix IC2 Wrench Harvesting + for (String y : IC2_WRENCH_PATCH_CLASS_NAMES) { if (transformedName.equals(y)) { - FMLRelaunchLog.log("[GT++ ASM] IC2 getHarvestTool Patch", Level.INFO, "Transforming %s", transformedName); + Preloader_Logger.INFO("IC2 getHarvestTool Patch", "Transforming "+transformedName); return new ClassTransformer_IC2_GetHarvestTool(basicClass, obfuscated, transformedName).getWriter().toByteArray(); } } //Fix IC2 Hazmat - if (transformedName.equals("ic2.core.item.armor.ItemArmorHazmat")) { - FMLRelaunchLog.log("[GT++ ASM] IC2 Hazmat Patch", Level.INFO, "Transforming %s", transformedName); + if (transformedName.equals(IC2_ITEM_ARMOUR_HAZMAT)) { + Preloader_Logger.INFO("IC2 Hazmat Patch", "Transforming "+transformedName); return new ClassTransformer_IC2_Hazmat(basicClass, transformedName).getWriter().toByteArray(); } //Fix Thaumcraft Shit //Patching ItemWispEssence to allow invalid item handling - if (transformedName.equals("thaumcraft.common.items.ItemWispEssence") && mConfig.enableTcAspectSafety) { - FMLRelaunchLog.log("[GT++ ASM] Thaumcraft WispEssence_Patch", Level.INFO, "Transforming %s", transformedName); + if (transformedName.equals(THAUMCRAFT_ITEM_WISP_ESSENCE) && AsmConfig.enableTcAspectSafety) { + Preloader_Logger.INFO("Thaumcraft WispEssence_Patch", "Transforming "+transformedName); return new ClassTransformer_TC_ItemWispEssence(basicClass, obfuscated).getWriter().toByteArray(); } diff --git a/src/Java/gtPlusPlus/xmod/bartcrops/abstracts/BaseAestheticCrop.java b/src/Java/gtPlusPlus/xmod/bartcrops/abstracts/BaseAestheticCrop.java index cddce7beb4..f62b429acb 100644 --- a/src/Java/gtPlusPlus/xmod/bartcrops/abstracts/BaseAestheticCrop.java +++ b/src/Java/gtPlusPlus/xmod/bartcrops/abstracts/BaseAestheticCrop.java @@ -1,6 +1,6 @@ package gtPlusPlus.xmod.bartcrops.abstracts; -import gtPlusPlus.core.lib.CORE; +import gtPlusPlus.preloader.CORE_Preloader; import ic2.api.crops.ICropTile; public abstract class BaseAestheticCrop extends BaseHarvestableCrop { @@ -27,7 +27,7 @@ public abstract class BaseAestheticCrop extends BaseHarvestableCrop { } public int growthDuration(ICropTile crop) { - return CORE.DEBUG ? 1 : 225; + return CORE_Preloader.DEBUG_MODE ? 1 : 225; } public byte getSizeAfterHarvest(ICropTile crop) { diff --git a/src/Java/gtPlusPlus/xmod/bartcrops/abstracts/BaseHarvestableCrop.java b/src/Java/gtPlusPlus/xmod/bartcrops/abstracts/BaseHarvestableCrop.java index fee6cf654c..e877233c67 100644 --- a/src/Java/gtPlusPlus/xmod/bartcrops/abstracts/BaseHarvestableCrop.java +++ b/src/Java/gtPlusPlus/xmod/bartcrops/abstracts/BaseHarvestableCrop.java @@ -1,6 +1,6 @@ package gtPlusPlus.xmod.bartcrops.abstracts; -import gtPlusPlus.core.lib.CORE; +import gtPlusPlus.preloader.CORE_Preloader; import ic2.api.crops.ICropTile; public abstract class BaseHarvestableCrop extends BaseCrop { @@ -44,7 +44,7 @@ public abstract class BaseHarvestableCrop extends BaseCrop { public int growthDuration(ICropTile crop) { short r; - if (CORE.DEBUG) { + if (CORE_Preloader.DEBUG_MODE) { r = 1; } else if (crop.getSize() == 2) { r = 200; diff --git a/src/Java/gtPlusPlus/xmod/bartcrops/crops/Crop_Hemp.java b/src/Java/gtPlusPlus/xmod/bartcrops/crops/Crop_Hemp.java index a921182d66..95e2766aae 100644 --- a/src/Java/gtPlusPlus/xmod/bartcrops/crops/Crop_Hemp.java +++ b/src/Java/gtPlusPlus/xmod/bartcrops/crops/Crop_Hemp.java @@ -1,9 +1,9 @@ package gtPlusPlus.xmod.bartcrops.crops; import gtPlusPlus.core.item.ModItems; -import gtPlusPlus.core.lib.CORE; import gtPlusPlus.core.util.math.MathUtils; import gtPlusPlus.core.util.minecraft.ItemUtils; +import gtPlusPlus.preloader.CORE_Preloader; import gtPlusPlus.xmod.bartcrops.abstracts.BaseAestheticCrop; import ic2.api.crops.ICropTile; import net.minecraft.item.ItemStack; @@ -29,7 +29,7 @@ public class Crop_Hemp extends BaseAestheticCrop { ret = 225; }*/ - if (CORE.DEBUG) { + if (CORE_Preloader.DEBUG_MODE) { ret = 1; } diff --git a/src/Java/gtPlusPlus/xmod/gregtech/HANDLER_GT.java b/src/Java/gtPlusPlus/xmod/gregtech/HANDLER_GT.java index 663804bc81..1cb499479f 100644 --- a/src/Java/gtPlusPlus/xmod/gregtech/HANDLER_GT.java +++ b/src/Java/gtPlusPlus/xmod/gregtech/HANDLER_GT.java @@ -23,7 +23,9 @@ import gtPlusPlus.api.helpers.GregtechPlusPlus_API.Multiblock_API; import gtPlusPlus.api.objects.Logger; import gtPlusPlus.api.objects.data.AutoMap; import gtPlusPlus.api.objects.data.Pair; +import gtPlusPlus.api.objects.minecraft.multi.NoEUBonusMultiBehaviour; import gtPlusPlus.api.objects.minecraft.multi.NoOutputBonusMultiBehaviour; +import gtPlusPlus.api.objects.minecraft.multi.NoSpeedBonusMultiBehaviour; import gtPlusPlus.australia.gen.gt.WorldGen_GT_Australia; import gtPlusPlus.core.handler.COMPAT_HANDLER; import gtPlusPlus.core.handler.OldCircuitHandler; @@ -37,6 +39,7 @@ import gtPlusPlus.core.util.minecraft.RecipeUtils; import gtPlusPlus.core.util.reflect.AddGregtechRecipe; import gtPlusPlus.core.util.reflect.ReflectionUtils; import gtPlusPlus.everglades.gen.gt.WorldGen_GT; +import gtPlusPlus.xmod.gregtech.api.enums.CustomOrePrefix; import gtPlusPlus.xmod.gregtech.api.enums.GregtechOrePrefixes.GT_Materials; import gtPlusPlus.xmod.gregtech.api.util.GTPP_Config; import gtPlusPlus.xmod.gregtech.api.world.GTPP_Worldgen; @@ -78,8 +81,7 @@ public class HANDLER_GT { OldCircuitHandler.preInit(); } - GregtechFluidHandler.run(); - + GregtechFluidHandler.run(); } public static void init(){ @@ -131,6 +133,8 @@ public class HANDLER_GT { // Register the No-Bonus Special Behaviour. Multiblock_API.registerSpecialMultiBehaviour(new NoOutputBonusMultiBehaviour()); + Multiblock_API.registerSpecialMultiBehaviour(new NoSpeedBonusMultiBehaviour()); + Multiblock_API.registerSpecialMultiBehaviour(new NoEUBonusMultiBehaviour()); //Register some custom recipe maps for any enabled multiblocks. //MultiblockRecipeMapHandler.run(); @@ -149,6 +153,13 @@ public class HANDLER_GT { WoodCentrifuging.processLogsForMethane(); } + public static void addNewOrePrefixes() { + for (CustomOrePrefix aPrefixTest : CustomOrePrefix.values()) { + Logger.INFO("Adding "+aPrefixTest.name()+" to OrePrefixes Enum."); + Logger.INFO("Injecting: "+aPrefixTest.addToEnum()); + } + } + private static void convertPyroToCokeOven() { if (ReflectionUtils.doesFieldExist(GT_Recipe.GT_Recipe_Map.class, "sPyrolyseRecipes")) { int aCount = 0; diff --git a/src/Java/gtPlusPlus/xmod/gregtech/api/enums/CustomOrePrefix.java b/src/Java/gtPlusPlus/xmod/gregtech/api/enums/CustomOrePrefix.java new file mode 100644 index 0000000000..9647b00578 --- /dev/null +++ b/src/Java/gtPlusPlus/xmod/gregtech/api/enums/CustomOrePrefix.java @@ -0,0 +1,112 @@ +package gtPlusPlus.xmod.gregtech.api.enums; + +import static gregtech.api.enums.GT_Values.B; + +import gregtech.api.enums.OrePrefixes; +import net.minecraftforge.common.util.EnumHelper; + +public enum CustomOrePrefix { + + milled("Milled Ores", "Milled ", " Ore", true, true, false, false, false, false, false, false, false, true, B[3], -1, 64, -1); + + private final String mRegularLocalName; + private final String mLocalizedMaterialPre; + private final String mLocalizedMaterialPost; + private final boolean mIsUnificatable; + private final boolean mIsMaterialBased; + private final boolean mIsSelfReferencing; + private final boolean mIsContainer; + private final boolean mDontUnificateActively; + private final boolean mIsUsedForBlocks; + private final boolean mAllowNormalRecycling; + private final boolean mGenerateDefaultItem; + private final boolean mIsEnchantable; + private final boolean mIsUsedForOreProcessing; + private final int mMaterialGenerationBits; + private final long mMaterialAmount; + private final int mDefaultStackSize; + private final int mTextureindex; + + private OrePrefixes mSelfReference; + + private CustomOrePrefix( + String aRegularLocalName, + String aLocalizedMaterialPre, + String aLocalizedMaterialPost, + boolean aIsUnificatable, + boolean aIsMaterialBased, + boolean aIsSelfReferencing, + boolean aIsContainer, + boolean aDontUnificateActively, + boolean aIsUsedForBlocks, + boolean aAllowNormalRecycling, + boolean aGenerateDefaultItem, + boolean aIsEnchantable, + boolean aIsUsedForOreProcessing, + int aMaterialGenerationBits, + long aMaterialAmount, + int aDefaultStackSize, + int aTextureindex) { + + mRegularLocalName = aRegularLocalName; + mLocalizedMaterialPre = aLocalizedMaterialPre; + mLocalizedMaterialPost = aLocalizedMaterialPost; + mIsUnificatable = aIsUnificatable; + mIsMaterialBased = aIsMaterialBased; + mIsSelfReferencing = aIsSelfReferencing; + mIsContainer = aIsContainer; + mDontUnificateActively = aDontUnificateActively; + mIsUsedForBlocks = aIsUsedForBlocks; + mAllowNormalRecycling = aAllowNormalRecycling; + mGenerateDefaultItem = aGenerateDefaultItem; + mIsEnchantable = aIsEnchantable; + mIsUsedForOreProcessing = aIsUsedForOreProcessing; + mMaterialGenerationBits = aMaterialGenerationBits; + mMaterialAmount = aMaterialAmount; + mDefaultStackSize = aDefaultStackSize; + mTextureindex = aTextureindex; + + } + + public final boolean addToEnum() { + + mSelfReference = EnumHelper.addEnum(OrePrefixes.class, this.name(), + new Class[] { + String.class, + String.class, String.class, boolean.class, + boolean.class, boolean.class, boolean.class, + boolean.class, boolean.class, boolean.class, + boolean.class, boolean.class, boolean.class, + int.class, long.class, int.class, int.class + }, + new Object[] { + mRegularLocalName, + mLocalizedMaterialPre, + mLocalizedMaterialPost, + mIsUnificatable, + mIsMaterialBased, + mIsSelfReferencing, + mIsContainer, + mDontUnificateActively, + mIsUsedForBlocks, + mAllowNormalRecycling, + mGenerateDefaultItem, + mIsEnchantable, + mIsUsedForOreProcessing, + mMaterialGenerationBits, + mMaterialAmount, + mDefaultStackSize, + mTextureindex}); + + return mSelfReference != null; + } + + public static final boolean checkEntryWasAdded(CustomOrePrefix aCustomPrefixObject) { + return aCustomPrefixObject.mSelfReference != null; + } + + public OrePrefixes get() { + return mSelfReference; + } + +} diff --git a/src/Java/gtPlusPlus/xmod/gregtech/api/enums/GregtechItemList.java b/src/Java/gtPlusPlus/xmod/gregtech/api/enums/GregtechItemList.java index cd4b0947e4..504533c406 100644 --- a/src/Java/gtPlusPlus/xmod/gregtech/api/enums/GregtechItemList.java +++ b/src/Java/gtPlusPlus/xmod/gregtech/api/enums/GregtechItemList.java @@ -2,13 +2,14 @@ package gtPlusPlus.xmod.gregtech.api.enums; import static gregtech.api.enums.GT_Values.W; -import gregtech.api.util.*; +import gregtech.api.util.GT_ModHandler; +import gregtech.api.util.GT_OreDictUnificator; +import gregtech.api.util.GT_Utility; import gtPlusPlus.xmod.gregtech.api.interfaces.GregtechItemContainer; import net.minecraft.block.Block; import net.minecraft.init.Blocks; import net.minecraft.item.Item; import net.minecraft.item.ItemStack; -import net.minecraftforge.fluids.Fluid; /** * Class containing all non-OreDict Items of GregTech. @@ -130,6 +131,19 @@ public enum GregtechItemList implements GregtechItemContainer { Farm_Processor_ZPM, Farm_Processor_UV, + // Upgrade chip for Distillus + Distillus_Upgrade_Chip, + + + // Chips used to nerf my multis via custom behavioural attachments + Chip_MultiNerf_NoOutputBonus, + Chip_MultiNerf_NoSpeedBonus, + Chip_MultiNerf_NoEuBonus, + + // Milling Balls + Milling_Ball_Alumina, + Milling_Ball_Soapstone, + //---------------------------------------------------------------------------- @@ -308,7 +322,9 @@ public enum GregtechItemList implements GregtechItemContainer { Machine_Adv_ImplosionCompressor, Machine_Adv_DistillationTower, - + //Advanced Assembly Line + Machine_Adv_AssemblyLine, + //Advanced Vacuum Freezer Industrial_Cryogenic_Freezer, Casing_AdvancedVacuum, @@ -343,7 +359,9 @@ public enum GregtechItemList implements GregtechItemContainer { //Larger Turbines Large_Steam_Turbine, Large_HPSteam_Turbine, - Casing_Turbine_Shaft, Casing_Turbine_LP, Casing_Turbine_HP, + Casing_Turbine_Shaft, + Casing_Turbine_LP, Casing_Turbine_HP, + Casing_Turbine_Gas, Casing_Turbine_Plasma, //Large Vacuum Furnace Casing_Vacuum_Furnace, @@ -352,6 +370,15 @@ public enum GregtechItemList implements GregtechItemContainer { // Large Rocket Engine Casing_RocketEngine, Controller_RocketEngine, + + // Large Semi-Fluid + Controller_LargeSemifluidGenerator, + + // IsaMill + Controller_IsaMill_Controller, + Casing_IsaMill_Casing, + Casing_IsaMill_Gearbox, + Casing_IsaMill_Pipe, //---------------------------------------------------------------------------- diff --git a/src/Java/gtPlusPlus/xmod/gregtech/api/gui/GUI_SteamCondenser.java b/src/Java/gtPlusPlus/xmod/gregtech/api/gui/GUI_SteamCondenser.java index f472fc9edb..e3f2f9d41b 100644 --- a/src/Java/gtPlusPlus/xmod/gregtech/api/gui/GUI_SteamCondenser.java +++ b/src/Java/gtPlusPlus/xmod/gregtech/api/gui/GUI_SteamCondenser.java @@ -1,11 +1,10 @@ package gtPlusPlus.xmod.gregtech.api.gui; -import net.minecraft.entity.player.InventoryPlayer; - import gregtech.api.gui.GT_GUIContainerMetaTile_Machine; import gregtech.api.interfaces.tileentity.IGregTechTileEntity; - import gtPlusPlus.core.lib.CORE; +import gtPlusPlus.preloader.CORE_Preloader; +import net.minecraft.entity.player.InventoryPlayer; public class GUI_SteamCondenser extends GT_GUIContainerMetaTile_Machine { @@ -20,7 +19,7 @@ public class GUI_SteamCondenser extends GT_GUIContainerMetaTile_Machine protected void drawGuiContainerForegroundLayer(final int par1, final int par2) { this.fontRendererObj.drawString("Condenser", 8, 4, 4210752); - if (CORE.DEBUG){ + if (CORE_Preloader.DEBUG_MODE){ this.tickTime = ((CONTAINER_SteamCondenser)this.mContainer).mTickingTime; this.fontRendererObj.drawString("Tick Time: "+this.tickTime, 8, 12, 4210752); } 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 cb889e0233..688433b3ac 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 @@ -1,5 +1,7 @@ package gtPlusPlus.xmod.gregtech.api.interfaces.internal; +import gregtech.api.enums.Materials; +import gtPlusPlus.core.material.Material; import net.minecraft.item.ItemStack; import net.minecraftforge.fluids.FluidStack; @@ -272,6 +274,7 @@ public interface IGregtech_RecipeAdder { public boolean addIrLaserRecipe(ItemStack aInput1, ItemStack aInput2, ItemStack aOutput, int time, long eu); public boolean addChemicalPlantRecipe(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[] aChances, int time, long eu, int aTier); public boolean addBlastRecipe(ItemStack[] aInputs, FluidStack[] aInputFluids, ItemStack[] aOutputs, FluidStack[] aFluidOutputs, int time, long eu, int aHeat); @@ -282,6 +285,9 @@ public interface IGregtech_RecipeAdder { public boolean addDistilleryRecipe(ItemStack aCircuit, FluidStack aInput, FluidStack aOutput, ItemStack aSolidOutput, int aDuration, int aEUt, boolean aHidden); public boolean addPulverisationRecipe(final ItemStack aInput, ItemStack aOutput1, ItemStack aOutput2, final ItemStack aOutput3); + + public boolean addMillingRecipe(Materials aMat, int aEU); + public boolean addMillingRecipe(Material aMat, int aEU); } 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 ef5429af62..ea14320f93 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 @@ -16,7 +16,6 @@ import org.apache.commons.lang3.ArrayUtils; import gregtech.api.GregTech_API; import gregtech.api.enums.GT_Values; import gregtech.api.enums.Materials; -import gregtech.api.enums.TAE; import gregtech.api.gui.GT_Container_MultiMachine; import gregtech.api.gui.GT_GUIContainer_MultiMachine; import gregtech.api.interfaces.metatileentity.IMetaTileEntity; @@ -56,6 +55,7 @@ import gtPlusPlus.core.recipe.common.CI; import gtPlusPlus.core.util.math.MathUtils; import gtPlusPlus.core.util.minecraft.ItemUtils; import gtPlusPlus.core.util.reflect.ReflectionUtils; +import gtPlusPlus.preloader.CORE_Preloader; import gtPlusPlus.preloader.asm.AsmConfig; import gtPlusPlus.xmod.gregtech.api.gui.CONTAINER_MultiMachine; import gtPlusPlus.xmod.gregtech.api.gui.CONTAINER_MultiMachine_NoPlayerInventory; @@ -90,7 +90,7 @@ public abstract class GregtechMeta_MultiBlockBase extends GT_MetaTileEntity_Mult Logger.MACHINE_INFO("Found .08 findRecipe method? "+(a08 != null)); Logger.MACHINE_INFO("Found .09 findRecipe method? "+(a09 != null)); - if (CORE.DEBUG) { + if (CORE_Preloader.DEBUG_MODE) { aLogger = ReflectionUtils.getMethod(Logger.class, "INFO", String.class); } else { @@ -2213,7 +2213,7 @@ public abstract class GregtechMeta_MultiBlockBase extends GT_MetaTileEntity_Mult } } - return super.addDynamoToMachineList(aTileEntity, aBaseCasingIndex); + return addToMachineList(aTileEntity, aBaseCasingIndex); } @@ -2536,9 +2536,10 @@ public abstract class GregtechMeta_MultiBlockBase extends GT_MetaTileEntity_Mult boolean isHatch = false; if (aBaseMetaTileEntity != null) { - if (aCasingID < 64) { + // Unsure why this check exists? + /*if (aCasingID < 64) { aCasingID = TAE.GTPP_INDEX(aCasingID); - } + }*/ isHatch = this.addToMachineList(aBaseMetaTileEntity, aCasingID); if (isHatch) { 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 ef013fa3a2..76100df0de 100644 --- a/src/Java/gtPlusPlus/xmod/gregtech/common/Meta_GT_Proxy.java +++ b/src/Java/gtPlusPlus/xmod/gregtech/common/Meta_GT_Proxy.java @@ -15,6 +15,7 @@ import gregtech.api.GregTech_API; import gregtech.api.enums.GT_Values; import gregtech.api.enums.ItemList; import gregtech.api.enums.Materials; +import gregtech.api.enums.TAE; import gregtech.api.interfaces.tileentity.IGregTechTileEntity; import gregtech.api.metatileentity.BaseMetaTileEntity; import gregtech.api.util.GT_LanguageManager; @@ -118,7 +119,10 @@ public class Meta_GT_Proxy { public static void postInit() { mAssemblyAchievements = new AchievementHandler(); - fixIC2FluidNames(); + fixIC2FluidNames(); + + // Finalise TAE + TAE.finalizeTAE(); } @SuppressWarnings("deprecation") diff --git a/src/Java/gtPlusPlus/xmod/gregtech/common/blocks/GregtechMetaCasingBlocks.java b/src/Java/gtPlusPlus/xmod/gregtech/common/blocks/GregtechMetaCasingBlocks.java index cd4c3fe7d2..c4b2e4f738 100644 --- a/src/Java/gtPlusPlus/xmod/gregtech/common/blocks/GregtechMetaCasingBlocks.java +++ b/src/Java/gtPlusPlus/xmod/gregtech/common/blocks/GregtechMetaCasingBlocks.java @@ -23,7 +23,10 @@ extends GregtechMetaCasingBlocksAbstract { public GregtechMetaCasingBlocks() { super(GregtechMetaCasingItems.class, "miscutils.blockcasings", GT_Material_Casings.INSTANCE); for (byte i = 0; i < 16; i = (byte) (i + 1)) { - TAE.registerTextures(new GT_CopiedBlockTexture(this, 6, i)); + if (i == 2 || i == 3 || i == 4) { + continue; + } + TAE.registerTexture(0, i, new GT_CopiedBlockTexture(this, 6, i)); } GT_LanguageManager.addStringLocalization(this.getUnlocalizedName() + ".0.name", "Centrifuge Casing"); GT_LanguageManager.addStringLocalization(this.getUnlocalizedName() + ".1.name", "Structural Coke Oven Casing"); diff --git a/src/Java/gtPlusPlus/xmod/gregtech/common/blocks/GregtechMetaCasingBlocks2.java b/src/Java/gtPlusPlus/xmod/gregtech/common/blocks/GregtechMetaCasingBlocks2.java index 528aed2029..596643e06c 100644 --- a/src/Java/gtPlusPlus/xmod/gregtech/common/blocks/GregtechMetaCasingBlocks2.java +++ b/src/Java/gtPlusPlus/xmod/gregtech/common/blocks/GregtechMetaCasingBlocks2.java @@ -32,7 +32,7 @@ extends GregtechMetaCasingBlocksAbstract { public void addInformation(ItemStack aStack, EntityPlayer aPlayer, List aList, boolean aF3_H) { int meta = aStack.getItemDamage(); int tier = GregtechMetaTileEntity_PowerSubStationController.getCellTier(field_150939_a, meta); - if (tier > 0) { + if (meta == 7 && tier > 0) { long capacity = GregtechMetaTileEntity_PowerSubStationController.getCapacityFromCellTier(tier); aList.add("Energy Storage: " + GT_Utility.formatNumbers(capacity)); } @@ -43,7 +43,10 @@ extends GregtechMetaCasingBlocksAbstract { public GregtechMetaCasingBlocks2() { super(GregtechMetaCasingItemBlocks2.class, "gtplusplus.blockcasings.2", GT_Material_Casings.INSTANCE); for (byte i = 0; i < 16; i = (byte) (i + 1)) { - TAE.registerTextures(new GT_CopiedBlockTexture(this, 6, i)); + if (i == 4 || i == 10 || i == 11 || i == 12 || i == 14) { + continue; + } + TAE.registerTexture(1, i, new GT_CopiedBlockTexture(this, 6, i)); } GT_LanguageManager.addStringLocalization(this.getUnlocalizedName() + ".0.name", "Thermal Processing Casing"); GT_LanguageManager.addStringLocalization(this.getUnlocalizedName() + ".1.name", "Hastelloy-N Sealant Block"); @@ -59,7 +62,7 @@ extends GregtechMetaCasingBlocksAbstract { GT_LanguageManager.addStringLocalization(this.getUnlocalizedName() + ".11.name", "Thermal Containment Casing"); GT_LanguageManager.addStringLocalization(this.getUnlocalizedName() + ".12.name", "Autocrafter Frame"); GT_LanguageManager.addStringLocalization(this.getUnlocalizedName() + ".13.name", "Cutting Factory Frame"); - GT_LanguageManager.addStringLocalization(this.getUnlocalizedName() + ".14.name", "Tesla Containment Casing"); + GT_LanguageManager.addStringLocalization(this.getUnlocalizedName() + ".14.name", ""); // Unused GT_LanguageManager.addStringLocalization(this.getUnlocalizedName() + ".15.name", "Sterile Farm Casing"); //Tree Farmer Textures GregtechItemList.Casing_ThermalCentrifuge.set(new ItemStack(this, 1, 0)); GregtechItemList.Casing_Refinery_External.set(new ItemStack(this, 1, 1)); @@ -75,7 +78,7 @@ extends GregtechMetaCasingBlocksAbstract { GregtechItemList.Casing_ThermalContainment.set(new ItemStack(this, 1, 11)); GregtechItemList.Casing_Autocrafter.set(new ItemStack(this, 1, 12)); GregtechItemList.Casing_CuttingFactoryFrame.set(new ItemStack(this, 1, 13)); - GregtechItemList.Casing_TeslaTower.set(new ItemStack(this, 1, 14)); + //GregtechItemList.Casing_TeslaTower.set(new ItemStack(this, 1, 14)); GregtechItemList.Casing_PLACEHOLDER_TreeFarmer.set(new ItemStack(this, 1, 15)); //Tree Farmer Textures } diff --git a/src/Java/gtPlusPlus/xmod/gregtech/common/blocks/GregtechMetaCasingBlocks3.java b/src/Java/gtPlusPlus/xmod/gregtech/common/blocks/GregtechMetaCasingBlocks3.java index 8e6a55c9c5..8cd6dd0ca8 100644 --- a/src/Java/gtPlusPlus/xmod/gregtech/common/blocks/GregtechMetaCasingBlocks3.java +++ b/src/Java/gtPlusPlus/xmod/gregtech/common/blocks/GregtechMetaCasingBlocks3.java @@ -1,27 +1,23 @@ package gtPlusPlus.xmod.gregtech.common.blocks; -import gregtech.api.util.GT_Utility; -import gtPlusPlus.xmod.gregtech.common.tileentities.machines.multi.storage.GregtechMetaTileEntity_PowerSubStationController; -import net.minecraft.block.Block; -import net.minecraft.entity.player.EntityPlayer; -import net.minecraft.item.ItemStack; -import net.minecraft.util.IIcon; -import net.minecraft.world.IBlockAccess; +import java.util.List; +import cpw.mods.fml.relauncher.Side; +import cpw.mods.fml.relauncher.SideOnly; import gregtech.api.enums.TAE; -import gregtech.api.enums.Textures; import gregtech.api.objects.GT_CopiedBlockTexture; import gregtech.api.util.GT_LanguageManager; +import gregtech.api.util.GT_Utility; import gregtech.common.blocks.GT_Material_Casings; - import gtPlusPlus.xmod.gregtech.api.enums.GregtechItemList; import gtPlusPlus.xmod.gregtech.common.blocks.textures.CasingTextureHandler3; import gtPlusPlus.xmod.gregtech.common.blocks.textures.TexturesGtBlock; - -import java.util.List; - -import cpw.mods.fml.relauncher.Side; -import cpw.mods.fml.relauncher.SideOnly; +import gtPlusPlus.xmod.gregtech.common.tileentities.machines.multi.storage.GregtechMetaTileEntity_PowerSubStationController; +import net.minecraft.block.Block; +import net.minecraft.entity.player.EntityPlayer; +import net.minecraft.item.ItemStack; +import net.minecraft.util.IIcon; +import net.minecraft.world.IBlockAccess; public class GregtechMetaCasingBlocks3 extends GregtechMetaCasingBlocksAbstract { @@ -50,7 +46,7 @@ extends GregtechMetaCasingBlocksAbstract { public GregtechMetaCasingBlocks3() { super(GregtechMetaCasingItemBlocks3.class, "gtplusplus.blockcasings.3", GT_Material_Casings.INSTANCE); for (byte i = 0; i < 16; i = (byte) (i + 1)) { - TAE.registerTextures(new GT_CopiedBlockTexture(this, 6, i)); + TAE.registerTexture(2, i, new GT_CopiedBlockTexture(this, 6, i)); } GT_LanguageManager.addStringLocalization(this.getUnlocalizedName() + ".0.name", "Aquatic Casing"); GT_LanguageManager.addStringLocalization(this.getUnlocalizedName() + ".1.name", "Inconel Reinforced Casing"); @@ -66,7 +62,7 @@ extends GregtechMetaCasingBlocksAbstract { GT_LanguageManager.addStringLocalization(this.getUnlocalizedName() + ".11.name", "Volcanus Casing"); GT_LanguageManager.addStringLocalization(this.getUnlocalizedName() + ".12.name", "Fusion Machine Casing MK III"); GT_LanguageManager.addStringLocalization(this.getUnlocalizedName() + ".13.name", "Advanced Fusion Coil"); - GT_LanguageManager.addStringLocalization(this.getUnlocalizedName() + ".14.name", "Unnamed"); + GT_LanguageManager.addStringLocalization(this.getUnlocalizedName() + ".14.name", "Unnamed"); // Can Use, don't change texture (Used for Fusion MK4) GT_LanguageManager.addStringLocalization(this.getUnlocalizedName() + ".15.name", "Containment Casing"); GregtechItemList.Casing_FishPond.set(new ItemStack(this, 1, 0)); GregtechItemList.Casing_Extruder.set(new ItemStack(this, 1, 1)); @@ -365,28 +361,6 @@ extends GregtechMetaCasingBlocksAbstract { } return TexturesGtBlock.CONNECTED_FUSION_HULLS[tStartIndex + 7].getIcon(); } - switch (tMeta) { - case 9 : { - return Textures.BlockIcons.MACHINE_CASING_SOLID_STEEL.getIcon(); - } - case 10 : { - return Textures.BlockIcons.MACHINE_CASING_CLEAN_STAINLESSSTEEL.getIcon(); - } - case 11 : { - return Textures.BlockIcons.MACHINE_CASING_STABLE_TITANIUM.getIcon(); - } - case 12 : { - return Textures.BlockIcons.MACHINE_CASING_ROBUST_TUNGSTENSTEEL.getIcon(); - } - case 14 : { - return TexturesGtBlock.TEXTURE_CASING_FUSION_CASING_ULTRA.getIcon(); - } - case 15 : { - return TexturesGtBlock.TEXTURE_MAGIC_PANEL_A.getIcon(); - } - default : { - return Textures.BlockIcons.MACHINE_CASING_SOLID_STEEL.getIcon(); - } - } + return CasingTextureHandler3.getIcon(aSide, tMeta); } } diff --git a/src/Java/gtPlusPlus/xmod/gregtech/common/blocks/GregtechMetaCasingBlocks4.java b/src/Java/gtPlusPlus/xmod/gregtech/common/blocks/GregtechMetaCasingBlocks4.java index b624649789..a357bd9103 100644 --- a/src/Java/gtPlusPlus/xmod/gregtech/common/blocks/GregtechMetaCasingBlocks4.java +++ b/src/Java/gtPlusPlus/xmod/gregtech/common/blocks/GregtechMetaCasingBlocks4.java @@ -22,40 +22,33 @@ extends GregtechMetaCasingBlocksAbstract { public GregtechMetaCasingBlocks4() { super(GregtechMetaCasingItems.class, "gtplusplus.blockcasings.4", GT_Material_Casings.INSTANCE); for (byte i = 0; i < 16; i = (byte) (i + 1)) { - TAE.registerTextures(new GT_CopiedBlockTexture(this, 6, i)); + if (i == 2 || i == 4 || i == 5 || i == 6 || i == 7 || i == 8 || i == 9 || i == 12 || i == 13 || i == 14 || i == 15) { + continue; + } + TAE.registerTexture(3, i, new GT_CopiedBlockTexture(this, 6, i)); } GT_LanguageManager.addStringLocalization(this.getUnlocalizedName() + ".0.name", "Naquadah Reactor Base"); //48 GT_LanguageManager.addStringLocalization(this.getUnlocalizedName() + ".1.name", "Reactor Piping"); GT_LanguageManager.addStringLocalization(this.getUnlocalizedName() + ".2.name", "Naquadah Containment Chamber"); GT_LanguageManager.addStringLocalization(this.getUnlocalizedName() + ".3.name", "Tempered Arc Furnace Casing"); - GT_LanguageManager.addStringLocalization(this.getUnlocalizedName() + ".4.name", "Structural Solar Casing"); - GT_LanguageManager.addStringLocalization(this.getUnlocalizedName() + ".5.name", "Salt Containment Casing"); - GT_LanguageManager.addStringLocalization(this.getUnlocalizedName() + ".6.name", "Thermal Containment Casing"); - GT_LanguageManager.addStringLocalization(this.getUnlocalizedName() + ".7.name", "Turbine Shaft"); - GT_LanguageManager.addStringLocalization(this.getUnlocalizedName() + ".8.name", "Low Pressure Turbine Casing"); - GT_LanguageManager.addStringLocalization(this.getUnlocalizedName() + ".9.name", "High Pressure Turbine Casing"); + GT_LanguageManager.addStringLocalization(this.getUnlocalizedName() + ".4.name", ""); // Unused + GT_LanguageManager.addStringLocalization(this.getUnlocalizedName() + ".5.name", ""); // Unused + GT_LanguageManager.addStringLocalization(this.getUnlocalizedName() + ".6.name", ""); // Unused + GT_LanguageManager.addStringLocalization(this.getUnlocalizedName() + ".7.name", ""); // Unused + GT_LanguageManager.addStringLocalization(this.getUnlocalizedName() + ".8.name", ""); // Unused + GT_LanguageManager.addStringLocalization(this.getUnlocalizedName() + ".9.name", ""); // Unused GT_LanguageManager.addStringLocalization(this.getUnlocalizedName() + ".10.name", "Vacuum Casing"); GT_LanguageManager.addStringLocalization(this.getUnlocalizedName() + ".11.name", "Turbodyne Casing"); - GT_LanguageManager.addStringLocalization(this.getUnlocalizedName() + ".12.name", ""); - GT_LanguageManager.addStringLocalization(this.getUnlocalizedName() + ".13.name", ""); - GT_LanguageManager.addStringLocalization(this.getUnlocalizedName() + ".14.name", ""); - GT_LanguageManager.addStringLocalization(this.getUnlocalizedName() + ".15.name", " "); + GT_LanguageManager.addStringLocalization(this.getUnlocalizedName() + ".12.name", ""); // Unused + GT_LanguageManager.addStringLocalization(this.getUnlocalizedName() + ".13.name", ""); // Unused + GT_LanguageManager.addStringLocalization(this.getUnlocalizedName() + ".14.name", ""); // Unused + GT_LanguageManager.addStringLocalization(this.getUnlocalizedName() + ".15.name", ""); // Unused GregtechItemList.Casing_Naq_Reactor_A.set(new ItemStack(this, 1, 0)); GregtechItemList.Casing_Naq_Reactor_B.set(new ItemStack(this, 1, 1)); GregtechItemList.Casing_Naq_Reactor_C.set(new ItemStack(this, 1, 2)); GregtechItemList.Casing_Industrial_Arc_Furnace.set(new ItemStack(this, 1, 3)); - GregtechItemList.Casing_SolarTower_Structural.set(new ItemStack(this, 1, 4)); - GregtechItemList.Casing_SolarTower_SaltContainment.set(new ItemStack(this, 1, 5)); - GregtechItemList.Casing_SolarTower_HeatContainment.set(new ItemStack(this, 1, 6)); - GregtechItemList.Casing_Turbine_Shaft.set(new ItemStack(this, 1, 7)); - GregtechItemList.Casing_Turbine_LP.set(new ItemStack(this, 1, 8)); - GregtechItemList.Casing_Turbine_HP.set(new ItemStack(this, 1, 9)); GregtechItemList.Casing_Vacuum_Furnace.set(new ItemStack(this, 1, 10)); GregtechItemList.Casing_RocketEngine.set(new ItemStack(this, 1, 11)); - /*GregtechItemList.Casing_Autocrafter.set(new ItemStack(this, 1, 12)); - GregtechItemList.Casing_CuttingFactoryFrame.set(new ItemStack(this, 1, 13)); - GregtechItemList.Casing_TeslaTower.set(new ItemStack(this, 1, 14)); - GregtechItemList.Casing_PLACEHOLDER_TreeFarmer.set(new ItemStack(this, 1, 15));*/ } private static final LargeTurbineTextureHandler mTurbineTextures = new LargeTurbineTextureHandler(); @@ -76,67 +69,43 @@ extends GregtechMetaCasingBlocksAbstract { //Texture ID's. case 0 == ID[57] if ((aMeta >= 0) && (aMeta < 16)) { switch (aMeta) { - //Centrifuge case 0: return TexturesGtBlock.Casing_Trinium_Titanium.getIcon(); - //Coke Oven Frame case 1: return TexturesGtBlock.TEXTURE_TECH_C.getIcon(); - //Coke Oven Casing Tier 1 case 2: return TexturesGtBlock.TEXTURE_ORGANIC_PANEL_A_GLOWING.getIcon(); - //Coke Oven Casing Tier 2 case 3: return TexturesGtBlock.TEXTURE_METAL_PANEL_A.getIcon(); - //Material Press Casings case 4: - return TexturesGtBlock.Casing_Material_MaragingSteel.getIcon(); - //Sifter Structural + return Textures.BlockIcons.RENDERING_ERROR.getIcon(); case 5: - return TexturesGtBlock.Casing_Material_Stellite.getIcon(); - //Sifter Sieve + return Textures.BlockIcons.RENDERING_ERROR.getIcon(); case 6: - return TexturesGtBlock.Casing_Machine_Simple_Top.getIcon(); - - - //Vanadium Radox Battery + return Textures.BlockIcons.RENDERING_ERROR.getIcon(); case 7: - return TexturesGtBlock.Casing_Redox_1.getIcon(); - //Power Sub-Station Casing + return Textures.BlockIcons.RENDERING_ERROR.getIcon(); case 8: - return TexturesGtBlock.Casing_Machine_Simple_Top.getIcon(); - //Cyclotron Coil + return Textures.BlockIcons.RENDERING_ERROR.getIcon(); case 9: - return TexturesGtBlock.Casing_Material_MaragingSteel.getIcon(); - - - //Cyclotron External Casing - case 10: - + return Textures.BlockIcons.RENDERING_ERROR.getIcon(); + case 10: if (aSide <2) { return TexturesGtBlock.TEXTURE_STONE_RED_B.getIcon(); } else { return TexturesGtBlock.TEXTURE_STONE_RED_A.getIcon(); } - - //Multitank Exterior Casing case 11: return TexturesGtBlock.TEXTURE_CASING_ROCKETDYNE.getIcon(); - //Reactor Casing I case 12: - return TexturesGtBlock.Casing_Machine_Simple_Top.getIcon(); - //Reactor Casing II + return Textures.BlockIcons.RENDERING_ERROR.getIcon(); case 13: - if (aSide <2) { - return TexturesGtBlock.TEXTURE_TECH_A.getIcon(); - } - else { - return TexturesGtBlock.TEXTURE_TECH_B.getIcon(); - } + return Textures.BlockIcons.RENDERING_ERROR.getIcon(); case 14: - return TexturesGtBlock.Casing_Material_RedSteel.getIcon(); + return Textures.BlockIcons.RENDERING_ERROR.getIcon(); case 15: + return Textures.BlockIcons.RENDERING_ERROR.getIcon(); default: return TexturesGtBlock.Casing_Material_MaragingSteel.getIcon(); diff --git a/src/Java/gtPlusPlus/xmod/gregtech/common/blocks/GregtechMetaCasingBlocks5.java b/src/Java/gtPlusPlus/xmod/gregtech/common/blocks/GregtechMetaCasingBlocks5.java new file mode 100644 index 0000000000..f3ad1de188 --- /dev/null +++ b/src/Java/gtPlusPlus/xmod/gregtech/common/blocks/GregtechMetaCasingBlocks5.java @@ -0,0 +1,77 @@ +package gtPlusPlus.xmod.gregtech.common.blocks; + +import cpw.mods.fml.relauncher.Side; +import cpw.mods.fml.relauncher.SideOnly; +import gregtech.api.enums.TAE; +import gregtech.api.enums.Textures; +import gregtech.api.objects.GT_CopiedBlockTexture; +import gregtech.api.util.GT_LanguageManager; +import gregtech.common.blocks.GT_Material_Casings; +import gtPlusPlus.xmod.gregtech.api.enums.GregtechItemList; +import gtPlusPlus.xmod.gregtech.common.blocks.textures.TexturesGrinderMultiblock; +import gtPlusPlus.xmod.gregtech.common.blocks.textures.TexturesGtBlock; +import net.minecraft.item.ItemStack; +import net.minecraft.util.IIcon; +import net.minecraft.world.IBlockAccess; + + +public class GregtechMetaCasingBlocks5 +extends GregtechMetaCasingBlocksAbstract { + + //84, 90, 91, 92, 94, 114, 116, 117, 118, 119, 120, 121, 124, 125, 126, 127 + private static final TexturesGrinderMultiblock mGrinderOverlayHandler = new TexturesGrinderMultiblock(); + + public GregtechMetaCasingBlocks5() { + super(GregtechMetaCasingItems.class, "gtplusplus.blockcasings.5", GT_Material_Casings.INSTANCE); + GT_LanguageManager.addStringLocalization(this.getUnlocalizedName() + ".0.name", "IsaMill Exterior Casing"); // IsaMill Casing + TAE.registerTexture(0, 2, new GT_CopiedBlockTexture(this, 6, 0)); + GT_LanguageManager.addStringLocalization(this.getUnlocalizedName() + ".1.name", "IsaMill Piping"); // IsaMill Pipe + TAE.registerTexture(0, 3, new GT_CopiedBlockTexture(this, 6, 0)); + GT_LanguageManager.addStringLocalization(this.getUnlocalizedName() + ".2.name", "IsaMill Gearbox"); // IsaMill Gearbox + TAE.registerTexture(0, 4, new GT_CopiedBlockTexture(this, 6, 0)); + GT_LanguageManager.addStringLocalization(this.getUnlocalizedName() + ".3.name", ""); // Unused + GT_LanguageManager.addStringLocalization(this.getUnlocalizedName() + ".4.name", ""); // Unused + GT_LanguageManager.addStringLocalization(this.getUnlocalizedName() + ".5.name", ""); // Unused + GT_LanguageManager.addStringLocalization(this.getUnlocalizedName() + ".6.name", ""); // Unused + GT_LanguageManager.addStringLocalization(this.getUnlocalizedName() + ".7.name", ""); // Unused + GT_LanguageManager.addStringLocalization(this.getUnlocalizedName() + ".8.name", ""); // Unused + GT_LanguageManager.addStringLocalization(this.getUnlocalizedName() + ".9.name", ""); // Unused + GT_LanguageManager.addStringLocalization(this.getUnlocalizedName() + ".10.name", ""); // Unused + GT_LanguageManager.addStringLocalization(this.getUnlocalizedName() + ".11.name", ""); // Unused + GT_LanguageManager.addStringLocalization(this.getUnlocalizedName() + ".12.name", ""); // Unused + GT_LanguageManager.addStringLocalization(this.getUnlocalizedName() + ".13.name", ""); // Unused + GT_LanguageManager.addStringLocalization(this.getUnlocalizedName() + ".14.name", ""); // Unused + GT_LanguageManager.addStringLocalization(this.getUnlocalizedName() + ".15.name", ""); // Unused + GregtechItemList.Casing_IsaMill_Casing.set(new ItemStack(this, 1, 0)); + GregtechItemList.Casing_IsaMill_Pipe.set(new ItemStack(this, 1, 1)); + GregtechItemList.Casing_IsaMill_Gearbox.set(new ItemStack(this, 1, 2)); + } + + @Override + public IIcon getIcon(final int aSide, final int aMeta) { + return getStaticIcon(aSide, aMeta); + } + + + public static IIcon getStaticIcon(final int aSide, final int aMeta) { + if ((aMeta >= 0) && (aMeta < 16)) { + switch (aMeta) { + case 0: + return TexturesGtBlock.TEXTURE_CASING_GRINDING_MILL.getIcon(); + case 1: + return TexturesGtBlock.TEXTURE_PIPE_GRINDING_MILL.getIcon(); + case 2: + return TexturesGtBlock.TEXTURE_GEARBOX_GRINDING_MILL.getIcon(); + + } + } + return Textures.BlockIcons.RENDERING_ERROR.getIcon(); + } + + @Override + @SideOnly(Side.CLIENT) + public IIcon getIcon(final IBlockAccess aWorld, final int xCoord, final int yCoord, final int zCoord, final int aSide) { + final GregtechMetaCasingBlocks5 i = this; + return mGrinderOverlayHandler.handleCasingsGT(aWorld, xCoord, yCoord, zCoord, aSide, i); + } +} diff --git a/src/Java/gtPlusPlus/xmod/gregtech/common/blocks/GregtechMetaSpecialMultiCasings.java b/src/Java/gtPlusPlus/xmod/gregtech/common/blocks/GregtechMetaSpecialMultiCasings.java new file mode 100644 index 0000000000..be180bf4e9 --- /dev/null +++ b/src/Java/gtPlusPlus/xmod/gregtech/common/blocks/GregtechMetaSpecialMultiCasings.java @@ -0,0 +1,97 @@ +package gtPlusPlus.xmod.gregtech.common.blocks; + +import java.util.List; + +import gregtech.api.enums.Textures; +import gregtech.api.util.GT_LanguageManager; +import gregtech.common.blocks.GT_Material_Casings; +import gtPlusPlus.xmod.gregtech.api.enums.GregtechItemList; +import gtPlusPlus.xmod.gregtech.common.blocks.textures.TexturesGtBlock; +import net.minecraft.block.Block; +import net.minecraft.entity.player.EntityPlayer; +import net.minecraft.item.ItemStack; +import net.minecraft.util.IIcon; + + +public class GregtechMetaSpecialMultiCasings extends GregtechMetaCasingBlocksAbstract { + + + public static class SpecialCasingItemBlock extends GregtechMetaCasingItems { + + public SpecialCasingItemBlock(Block par1) { + super(par1); + } + + @Override + public void addInformation(ItemStack aStack, EntityPlayer aPlayer, List aList, boolean aF3_H) { + int aMeta = aStack.getItemDamage(); + if (aMeta < 10) { + //aList.add("Tier: "+GT_Values.VN[aMeta]); + } + super.addInformation(aStack, aPlayer, aList, aF3_H); + } + } + + public GregtechMetaSpecialMultiCasings() { + super(SpecialCasingItemBlock.class, "gtplusplus.blockspecialcasings.1", GT_Material_Casings.INSTANCE); + for (byte i = 0; i < 16; i = (byte) (i + 1)) { + //TAE.registerTextures(new GT_CopiedBlockTexture(this, 6, i)); + // Don't register these Textures, They already exist within vanilla GT. (May not exist in 5.08) + } + GT_LanguageManager.addStringLocalization(this.getUnlocalizedName() + ".0.name", "Turbine Shaft"); + GT_LanguageManager.addStringLocalization(this.getUnlocalizedName() + ".1.name", "Reinforced Steam Turbine Casing"); + GT_LanguageManager.addStringLocalization(this.getUnlocalizedName() + ".2.name", "Reinforced HP Steam Turbine Casing"); + GT_LanguageManager.addStringLocalization(this.getUnlocalizedName() + ".3.name", "Reinforced Gas Turbine Casing"); + GT_LanguageManager.addStringLocalization(this.getUnlocalizedName() + ".4.name", "Reinforced Plasma Turbine Casing"); + GT_LanguageManager.addStringLocalization(this.getUnlocalizedName() + ".5.name", "Tesla Containment Casing"); + GT_LanguageManager.addStringLocalization(this.getUnlocalizedName() + ".6.name", "Structural Solar Casing"); + GT_LanguageManager.addStringLocalization(this.getUnlocalizedName() + ".7.name", "Salt Containment Casing"); + GT_LanguageManager.addStringLocalization(this.getUnlocalizedName() + ".8.name", "Thermally Insulated Casing"); + GT_LanguageManager.addStringLocalization(this.getUnlocalizedName() + ".9.name", ""); // Unused + GT_LanguageManager.addStringLocalization(this.getUnlocalizedName() + ".10.name", ""); // Unused + GT_LanguageManager.addStringLocalization(this.getUnlocalizedName() + ".11.name", ""); // Unused + GT_LanguageManager.addStringLocalization(this.getUnlocalizedName() + ".12.name", ""); // Unused + GT_LanguageManager.addStringLocalization(this.getUnlocalizedName() + ".13.name", ""); // Unused + GT_LanguageManager.addStringLocalization(this.getUnlocalizedName() + ".14.name", ""); // Unused + GT_LanguageManager.addStringLocalization(this.getUnlocalizedName() + ".15.name", ""); // Unused + + GregtechItemList.Casing_Turbine_Shaft.set(new ItemStack(this, 1, 0)); + GregtechItemList.Casing_Turbine_LP.set(new ItemStack(this, 1, 1)); + GregtechItemList.Casing_Turbine_HP.set(new ItemStack(this, 1, 2)); + GregtechItemList.Casing_Turbine_Gas.set(new ItemStack(this, 1, 3)); + GregtechItemList.Casing_Turbine_Plasma.set(new ItemStack(this, 1, 4)); + GregtechItemList.Casing_TeslaTower.set(new ItemStack(this, 1, 5)); + GregtechItemList.Casing_SolarTower_Structural.set(new ItemStack(this, 1, 6)); + GregtechItemList.Casing_SolarTower_SaltContainment.set(new ItemStack(this, 1, 7)); + GregtechItemList.Casing_SolarTower_HeatContainment.set(new ItemStack(this, 1, 8)); + } + + public IIcon getIcon(int aSide, int aMeta) { + + switch (aMeta) { + + case 0: + return TexturesGtBlock.Casing_Redox_1.getIcon(); + case 1: + return Textures.BlockIcons.MACHINE_CASING_TURBINE.getIcon(); + case 2: + return Textures.BlockIcons.MACHINE_CASING_CLEAN_STAINLESSSTEEL.getIcon(); + case 3: + return Textures.BlockIcons.MACHINE_CASING_STABLE_TITANIUM.getIcon(); + case 4: + return Textures.BlockIcons.MACHINE_CASING_ROBUST_TUNGSTENSTEEL.getIcon(); + case 5: + return TexturesGtBlock.Casing_Material_RedSteel.getIcon(); + case 6: + return TexturesGtBlock.Casing_Material_MaragingSteel.getIcon(); + case 7: + return TexturesGtBlock.Casing_Material_Stellite.getIcon(); + case 8: + return TexturesGtBlock.Casing_Machine_Simple_Top.getIcon(); + + } + + return Textures.BlockIcons.RENDERING_ERROR.getIcon(); + } + +} diff --git a/src/Java/gtPlusPlus/xmod/gregtech/common/blocks/GregtechMetaTieredCasingBlocks1.java b/src/Java/gtPlusPlus/xmod/gregtech/common/blocks/GregtechMetaTieredCasingBlocks1.java index f09285d514..240af72a3b 100644 --- a/src/Java/gtPlusPlus/xmod/gregtech/common/blocks/GregtechMetaTieredCasingBlocks1.java +++ b/src/Java/gtPlusPlus/xmod/gregtech/common/blocks/GregtechMetaTieredCasingBlocks1.java @@ -66,7 +66,7 @@ public class GregtechMetaTieredCasingBlocks1 extends GregtechMetaCasingBlocksAbs //GT_LanguageManager.addStringLocalization(this.getUnlocalizedName() + ".12.name", ""); //GT_LanguageManager.addStringLocalization(this.getUnlocalizedName() + ".13.name", ""); //GT_LanguageManager.addStringLocalization(this.getUnlocalizedName() + ".14.name", ""); - //GT_LanguageManager.addStringLocalization(this.getUnlocalizedName() + ".15.name", " "); + GT_LanguageManager.addStringLocalization(this.getUnlocalizedName() + ".15.name", "Placeholder Block"); GregtechItemList.GTPP_Casing_ULV.set(new ItemStack(this, 1, 0)); GregtechItemList.GTPP_Casing_LV.set(new ItemStack(this, 1, 1)); @@ -93,9 +93,9 @@ public class GregtechMetaTieredCasingBlocks1 extends GregtechMetaCasingBlocksAbs } switch (aMeta) { case 10: - return Textures.BlockIcons.MACHINE_BRONZEPLATEDBRICKS.getIcon(); + return Textures.BlockIcons.RENDERING_ERROR.getIcon(); case 11: - return Textures.BlockIcons.MACHINE_HEATPROOFCASING.getIcon(); + return Textures.BlockIcons.RENDERING_ERROR.getIcon(); case 12: return Textures.BlockIcons.RENDERING_ERROR.getIcon(); case 13: @@ -103,9 +103,9 @@ public class GregtechMetaTieredCasingBlocks1 extends GregtechMetaCasingBlocksAbs case 14: return Textures.BlockIcons.RENDERING_ERROR.getIcon(); case 15: - return Textures.BlockIcons.MACHINE_COIL_SUPERCONDUCTOR.getIcon(); + return Textures.BlockIcons.RENDERING_ERROR.getIcon(); } - return TexturesGtBlock.TEXTURE_CASING_TIERED_ULV.getIcon(); + return Textures.BlockIcons.RENDERING_ERROR.getIcon(); } } diff --git a/src/Java/gtPlusPlus/xmod/gregtech/common/blocks/textures/CasingTextureHandler2.java b/src/Java/gtPlusPlus/xmod/gregtech/common/blocks/textures/CasingTextureHandler2.java index 1c7109fad2..c980997c64 100644 --- a/src/Java/gtPlusPlus/xmod/gregtech/common/blocks/textures/CasingTextureHandler2.java +++ b/src/Java/gtPlusPlus/xmod/gregtech/common/blocks/textures/CasingTextureHandler2.java @@ -9,47 +9,32 @@ public class CasingTextureHandler2 { public static IIcon getIcon(final int aSide, final int aMeta) { //Texture ID's. case 0 == ID[57] if ((aMeta >= 0) && (aMeta < 16)) { switch (aMeta) { - //Centrifuge case 0: return TexturesGtBlock.Casing_Material_RedSteel.getIcon(); - //Coke Oven Frame case 1: return TexturesGtBlock.Casing_Material_HastelloyX.getIcon(); - //Coke Oven Casing Tier 1 case 2: return TexturesGtBlock.Casing_Material_HastelloyN.getIcon(); - //Coke Oven Casing Tier 2 case 3: return TexturesGtBlock.Casing_Material_Fluid_IncoloyDS.getIcon(); - //Material Press Casings case 4: - return TexturesGtBlock.Casing_Material_Grisium.getIcon(); - //Sifter Structural + return TexturesGtBlock.Casing_Material_Grisium.getIcon(); case 5: return TexturesGtBlock.Casing_Machine_Metal_Panel_A.getIcon(); - //Sifter Sieve case 6: return TexturesGtBlock.Casing_Machine_Metal_Grate_A.getIcon(); - - //Vanadium Radox Battery case 7: return TexturesGtBlock.Casing_Redox_1.getIcon(); - //Power Sub-Station Casing case 8: return TexturesGtBlock.Casing_Machine_Metal_Sheet_A.getIcon(); - //Cyclotron Coil case 9: return TexturesGtBlock.Overlay_Machine_Cyber_A.getIcon(); - //Cyclotron External Casing case 10: return Textures.BlockIcons.MACHINE_CASING_RADIATIONPROOF.getIcon(); - //Multitank Exterior Casing case 11: return TexturesGtBlock.Casing_Material_Tantalloy61.getIcon(); - //Reactor Casing I case 12: return TexturesGtBlock.Casing_Machine_Simple_Top.getIcon(); - //Reactor Casing II case 13: if (aSide <2) { return TexturesGtBlock.TEXTURE_TECH_A.getIcon(); @@ -58,18 +43,9 @@ public class CasingTextureHandler2 { return TexturesGtBlock.TEXTURE_TECH_B.getIcon(); } case 14: - return TexturesGtBlock.Casing_Material_RedSteel.getIcon(); + return Textures.BlockIcons.RENDERING_ERROR.getIcon(); case 15: - return TexturesGtBlock.Casing_Machine_Acacia_Log.getIcon(); - /*if (aSide <2) { - if (aSide == 1) { - return TexturesGtBlock.Casing_Machine_Podzol.getIcon(); - } - return TexturesGtBlock.Casing_Machine_Acacia_Log.getIcon(); - } - else { - return TexturesGtBlock.Casing_Machine_Farm_Manager.getIcon(); - }*/ + return TexturesGtBlock.Casing_Machine_Acacia_Log.getIcon(); default: return TexturesGtBlock.Overlay_UU_Matter.getIcon(); diff --git a/src/Java/gtPlusPlus/xmod/gregtech/common/blocks/textures/TexturesGrinderMultiblock.java b/src/Java/gtPlusPlus/xmod/gregtech/common/blocks/textures/TexturesGrinderMultiblock.java new file mode 100644 index 0000000000..02900c300b --- /dev/null +++ b/src/Java/gtPlusPlus/xmod/gregtech/common/blocks/textures/TexturesGrinderMultiblock.java @@ -0,0 +1,411 @@ +package gtPlusPlus.xmod.gregtech.common.blocks.textures; + +import gregtech.api.enums.Textures; +import gregtech.api.interfaces.metatileentity.IMetaTileEntity; +import gregtech.api.interfaces.tileentity.IGregTechTileEntity; +import gtPlusPlus.xmod.gregtech.common.blocks.GregtechMetaCasingBlocks5; +import gtPlusPlus.xmod.gregtech.common.blocks.textures.TexturesGtBlock.CustomIcon; +import gtPlusPlus.xmod.gregtech.common.tileentities.machines.multi.processing.GregtechMetaTileEntity_IsaMill; +import net.minecraft.tileentity.TileEntity; +import net.minecraft.util.IIcon; +import net.minecraft.world.IBlockAccess; + +public class TexturesGrinderMultiblock { + + private static CustomIcon GT8_1_Active = new CustomIcon("iconsets/Grinder/GRINDER_ACTIVE1"); + private static CustomIcon GT8_1 = new CustomIcon("iconsets/Grinder/GRINDER1"); + private static CustomIcon GT8_2_Active = new CustomIcon("iconsets/Grinder/GRINDER_ACTIVE2"); + private static CustomIcon GT8_2 = new CustomIcon("iconsets/Grinder/GRINDER2"); + private static CustomIcon GT8_3_Active = new CustomIcon("iconsets/Grinder/GRINDER_ACTIVE3"); + private static CustomIcon GT8_3 = new CustomIcon("iconsets/Grinder/GRINDER3"); + private static CustomIcon GT8_4_Active = new CustomIcon("iconsets/Grinder/GRINDER_ACTIVE4"); + private static CustomIcon GT8_4 = new CustomIcon("iconsets/Grinder/GRINDER4"); + private static CustomIcon GT8_5_Active = new CustomIcon("iconsets/Grinder/GRINDER_ACTIVE5"); + private static CustomIcon GT8_5 = new CustomIcon("iconsets/Grinder/GRINDER5"); + private static CustomIcon GT8_6_Active = new CustomIcon("iconsets/Grinder/GRINDER_ACTIVE6"); + private static CustomIcon GT8_6 = new CustomIcon("iconsets/Grinder/GRINDER6"); + private static CustomIcon GT8_7_Active = new CustomIcon("iconsets/Grinder/GRINDER_ACTIVE7"); + private static CustomIcon GT8_7 = new CustomIcon("iconsets/Grinder/GRINDER7"); + private static CustomIcon GT8_8_Active = new CustomIcon("iconsets/Grinder/GRINDER_ACTIVE8"); + private static CustomIcon GT8_8 = new CustomIcon("iconsets/Grinder/GRINDER8"); + private static CustomIcon GT8_9_Active = new CustomIcon("iconsets/Grinder/GRINDER_ACTIVE9"); + private static CustomIcon GT8_9 = new CustomIcon("iconsets/Grinder/GRINDER9"); + + private static CustomIcon frontFace_0 = (GT8_1); + private static CustomIcon frontFaceActive_0 = (GT8_1_Active); + private static CustomIcon frontFace_1 = (GT8_2); + private static CustomIcon frontFaceActive_1 = (GT8_2_Active); + private static CustomIcon frontFace_2 = (GT8_3); + private static CustomIcon frontFaceActive_2 = (GT8_3_Active); + private static CustomIcon frontFace_3 = (GT8_4); + private static CustomIcon frontFaceActive_3 = (GT8_4_Active); + private static CustomIcon frontFace_4 = (GT8_5); + private static CustomIcon frontFaceActive_4 = (GT8_5_Active); + private static CustomIcon frontFace_5 = (GT8_6); + private static CustomIcon frontFaceActive_5 = (GT8_6_Active); + private static CustomIcon frontFace_6 = (GT8_7); + private static CustomIcon frontFaceActive_6 = (GT8_7_Active); + private static CustomIcon frontFace_7 = (GT8_8); + private static CustomIcon frontFaceActive_7 = (GT8_8_Active); + private static CustomIcon frontFace_8 = (GT8_9); + private static CustomIcon frontFaceActive_8 = (GT8_9_Active); + + CustomIcon[] GRINDER = new CustomIcon[]{ + frontFace_0, + frontFace_1, + frontFace_2, + frontFace_3, + frontFace_4, + frontFace_5, + frontFace_6, + frontFace_7, + frontFace_8 + }; + + CustomIcon[] GRINDER_ACTIVE = new CustomIcon[]{ + frontFaceActive_0, + frontFaceActive_1, + frontFaceActive_2, + frontFaceActive_3, + frontFaceActive_4, + frontFaceActive_5, + frontFaceActive_6, + frontFaceActive_7, + frontFaceActive_8 + }; + + public IIcon handleCasingsGT(final IBlockAccess aWorld, final int xCoord, final int yCoord, final int zCoord, final int aSide, final GregtechMetaCasingBlocks5 i) { + final int tMeta = aWorld.getBlockMetadata(xCoord, yCoord, zCoord); + if (tMeta != 0) { + return GregtechMetaCasingBlocks5.getStaticIcon(aSide, tMeta); + } + final int tStartIndex = tMeta == 6 ? 1 : 13; + if (tMeta == 0) { + if ((aSide == 2) || (aSide == 3)) { + TileEntity tTileEntity; + IMetaTileEntity tMetaTileEntity; + if ((null != (tTileEntity = aWorld.getTileEntity(xCoord + (aSide == 3 ? 1 : -1), yCoord - 1, zCoord))) && ((tTileEntity instanceof IGregTechTileEntity)) && (((IGregTechTileEntity) tTileEntity).getFrontFacing() == aSide) && (null != (tMetaTileEntity = ((IGregTechTileEntity) tTileEntity).getMetaTileEntity())) && ((tMetaTileEntity instanceof GregtechMetaTileEntity_IsaMill))) { + return getIconByIndex(tMetaTileEntity, 0); + } + if ((null != (tTileEntity = aWorld.getTileEntity(xCoord + (aSide == 3 ? 1 : -1), yCoord, zCoord))) && ((tTileEntity instanceof IGregTechTileEntity)) && (((IGregTechTileEntity) tTileEntity).getFrontFacing() == aSide) && (null != (tMetaTileEntity = ((IGregTechTileEntity) tTileEntity).getMetaTileEntity())) && ((tMetaTileEntity instanceof GregtechMetaTileEntity_IsaMill))) { + return getIconByIndex(tMetaTileEntity, 3); + } + if ((null != (tTileEntity = aWorld.getTileEntity(xCoord + (aSide == 3 ? 1 : -1), yCoord + 1, zCoord))) && ((tTileEntity instanceof IGregTechTileEntity)) && (((IGregTechTileEntity) tTileEntity).getFrontFacing() == aSide) && (null != (tMetaTileEntity = ((IGregTechTileEntity) tTileEntity).getMetaTileEntity())) && ((tMetaTileEntity instanceof GregtechMetaTileEntity_IsaMill))) { + return getIconByIndex(tMetaTileEntity, 6); + } + if ((null != (tTileEntity = aWorld.getTileEntity(xCoord, yCoord - 1, zCoord))) && ((tTileEntity instanceof IGregTechTileEntity)) && (((IGregTechTileEntity) tTileEntity).getFrontFacing() == aSide) && (null != (tMetaTileEntity = ((IGregTechTileEntity) tTileEntity).getMetaTileEntity())) && ((tMetaTileEntity instanceof GregtechMetaTileEntity_IsaMill))) { + return getIconByIndex(tMetaTileEntity, 1); + } + if ((null != (tTileEntity = aWorld.getTileEntity(xCoord, yCoord + 1, zCoord))) && ((tTileEntity instanceof IGregTechTileEntity)) && (((IGregTechTileEntity) tTileEntity).getFrontFacing() == aSide) && (null != (tMetaTileEntity = ((IGregTechTileEntity) tTileEntity).getMetaTileEntity())) && ((tMetaTileEntity instanceof GregtechMetaTileEntity_IsaMill))) { + return getIconByIndex(tMetaTileEntity, 7); + } + if ((null != (tTileEntity = aWorld.getTileEntity(xCoord + (aSide == 2 ? 1 : -1), yCoord + 1, zCoord))) && ((tTileEntity instanceof IGregTechTileEntity)) && (((IGregTechTileEntity) tTileEntity).getFrontFacing() == aSide) && (null != (tMetaTileEntity = ((IGregTechTileEntity) tTileEntity).getMetaTileEntity())) && ((tMetaTileEntity instanceof GregtechMetaTileEntity_IsaMill))) { + return getIconByIndex(tMetaTileEntity, 8); + } + if ((null != (tTileEntity = aWorld.getTileEntity(xCoord + (aSide == 2 ? 1 : -1), yCoord, zCoord))) && ((tTileEntity instanceof IGregTechTileEntity)) && (((IGregTechTileEntity) tTileEntity).getFrontFacing() == aSide) && (null != (tMetaTileEntity = ((IGregTechTileEntity) tTileEntity).getMetaTileEntity())) && ((tMetaTileEntity instanceof GregtechMetaTileEntity_IsaMill))) { + return getIconByIndex(tMetaTileEntity, 5); + } + if ((null != (tTileEntity = aWorld.getTileEntity(xCoord + (aSide == 2 ? 1 : -1), yCoord - 1, zCoord))) && ((tTileEntity instanceof IGregTechTileEntity)) && (((IGregTechTileEntity) tTileEntity).getFrontFacing() == aSide) && (null != (tMetaTileEntity = ((IGregTechTileEntity) tTileEntity).getMetaTileEntity())) && ((tMetaTileEntity instanceof GregtechMetaTileEntity_IsaMill))) { + return getIconByIndex(tMetaTileEntity, 2); + } + } else if ((aSide == 4) || (aSide == 5)) { + TileEntity tTileEntity; + Object tMetaTileEntity; + if ((null != (tTileEntity = aWorld.getTileEntity(xCoord, yCoord - 1, zCoord + (aSide == 4 ? 1 : -1)))) && ((tTileEntity instanceof IGregTechTileEntity)) && (((IGregTechTileEntity) tTileEntity).getFrontFacing() == aSide) && (null != (tMetaTileEntity = ((IGregTechTileEntity) tTileEntity).getMetaTileEntity())) && ((tMetaTileEntity instanceof GregtechMetaTileEntity_IsaMill))) { + return getIconByIndex((IMetaTileEntity) tMetaTileEntity, 0); + } + if ((null != (tTileEntity = aWorld.getTileEntity(xCoord, yCoord, zCoord + (aSide == 4 ? 1 : -1)))) && ((tTileEntity instanceof IGregTechTileEntity)) && (((IGregTechTileEntity) tTileEntity).getFrontFacing() == aSide) && (null != (tMetaTileEntity = ((IGregTechTileEntity) tTileEntity).getMetaTileEntity())) && ((tMetaTileEntity instanceof GregtechMetaTileEntity_IsaMill))) { + return getIconByIndex((IMetaTileEntity) tMetaTileEntity, 3); + } + if ((null != (tTileEntity = aWorld.getTileEntity(xCoord, yCoord + 1, zCoord + (aSide == 4 ? 1 : -1)))) && ((tTileEntity instanceof IGregTechTileEntity)) && (((IGregTechTileEntity) tTileEntity).getFrontFacing() == aSide) && (null != (tMetaTileEntity = ((IGregTechTileEntity) tTileEntity).getMetaTileEntity())) && ((tMetaTileEntity instanceof GregtechMetaTileEntity_IsaMill))) { + return getIconByIndex((IMetaTileEntity) tMetaTileEntity, 6); + } + if ((null != (tTileEntity = aWorld.getTileEntity(xCoord, yCoord - 1, zCoord))) && ((tTileEntity instanceof IGregTechTileEntity)) && (((IGregTechTileEntity) tTileEntity).getFrontFacing() == aSide) && (null != (tMetaTileEntity = ((IGregTechTileEntity) tTileEntity).getMetaTileEntity())) && ((tMetaTileEntity instanceof GregtechMetaTileEntity_IsaMill))) { + return getIconByIndex((IMetaTileEntity) tMetaTileEntity, 1); + } + if ((null != (tTileEntity = aWorld.getTileEntity(xCoord, yCoord + 1, zCoord))) && ((tTileEntity instanceof IGregTechTileEntity)) && (((IGregTechTileEntity) tTileEntity).getFrontFacing() == aSide) && (null != (tMetaTileEntity = ((IGregTechTileEntity) tTileEntity).getMetaTileEntity())) && ((tMetaTileEntity instanceof GregtechMetaTileEntity_IsaMill))) { + return getIconByIndex((IMetaTileEntity) tMetaTileEntity, 7); + } + if ((null != (tTileEntity = aWorld.getTileEntity(xCoord, yCoord + 1, zCoord + (aSide == 5 ? 1 : -1)))) && ((tTileEntity instanceof IGregTechTileEntity)) && (((IGregTechTileEntity) tTileEntity).getFrontFacing() == aSide) && (null != (tMetaTileEntity = ((IGregTechTileEntity) tTileEntity).getMetaTileEntity())) && ((tMetaTileEntity instanceof GregtechMetaTileEntity_IsaMill))) { + return getIconByIndex((IMetaTileEntity) tMetaTileEntity, 8); + } + if ((null != (tTileEntity = aWorld.getTileEntity(xCoord, yCoord, zCoord + (aSide == 5 ? 1 : -1)))) && ((tTileEntity instanceof IGregTechTileEntity)) && (((IGregTechTileEntity) tTileEntity).getFrontFacing() == aSide) && (null != (tMetaTileEntity = ((IGregTechTileEntity) tTileEntity).getMetaTileEntity())) && ((tMetaTileEntity instanceof GregtechMetaTileEntity_IsaMill))) { + return getIconByIndex((IMetaTileEntity) tMetaTileEntity, 5); + } + if ((null != (tTileEntity = aWorld.getTileEntity(xCoord, yCoord - 1, zCoord + (aSide == 5 ? 1 : -1)))) && ((tTileEntity instanceof IGregTechTileEntity)) && (((IGregTechTileEntity) tTileEntity).getFrontFacing() == aSide) && (null != (tMetaTileEntity = ((IGregTechTileEntity) tTileEntity).getMetaTileEntity())) && ((tMetaTileEntity instanceof GregtechMetaTileEntity_IsaMill))) { + return getIconByIndex((IMetaTileEntity) tMetaTileEntity, 2); + } + } + return TexturesGtBlock.TEXTURE_CASING_GRINDING_MILL.getIcon(); + } + final boolean[] tConnectedSides = {(aWorld.getBlock(xCoord, yCoord - 1, zCoord) == i) && (aWorld.getBlockMetadata(xCoord, yCoord - 1, zCoord) == tMeta), (aWorld.getBlock(xCoord, yCoord + 1, zCoord) == i) && (aWorld.getBlockMetadata(xCoord, yCoord + 1, zCoord) == tMeta), (aWorld.getBlock(xCoord + 1, yCoord, zCoord) == i) && (aWorld.getBlockMetadata(xCoord + 1, yCoord, zCoord) == tMeta), (aWorld.getBlock(xCoord, yCoord, zCoord + 1) == i) && (aWorld.getBlockMetadata(xCoord, yCoord, zCoord + 1) == tMeta), (aWorld.getBlock(xCoord - 1, yCoord, zCoord) == i) && (aWorld.getBlockMetadata(xCoord - 1, yCoord, zCoord) == tMeta), (aWorld.getBlock(xCoord, yCoord, zCoord - 1) == i) && (aWorld.getBlockMetadata(xCoord, yCoord, zCoord - 1) == tMeta)}; + switch (aSide) { + case 0: + if (tConnectedSides[0]) { + return Textures.BlockIcons.CONNECTED_HULLS[(tStartIndex + 7)].getIcon(); + } + if ((tConnectedSides[4]) && (tConnectedSides[5]) && (tConnectedSides[2]) && (tConnectedSides[3])) { + return Textures.BlockIcons.CONNECTED_HULLS[(tStartIndex + 6)].getIcon(); + } + if ((!tConnectedSides[4]) && (tConnectedSides[5]) && (tConnectedSides[2]) && (tConnectedSides[3])) { + return Textures.BlockIcons.CONNECTED_HULLS[(tStartIndex + 2)].getIcon(); + } + if ((tConnectedSides[4]) && (!tConnectedSides[5]) && (tConnectedSides[2]) && (tConnectedSides[3])) { + return Textures.BlockIcons.CONNECTED_HULLS[(tStartIndex + 3)].getIcon(); + } + if ((tConnectedSides[4]) && (tConnectedSides[5]) && (!tConnectedSides[2]) && (tConnectedSides[3])) { + return Textures.BlockIcons.CONNECTED_HULLS[(tStartIndex + 4)].getIcon(); + } + if ((tConnectedSides[4]) && (tConnectedSides[5]) && (tConnectedSides[2]) && (!tConnectedSides[3])) { + return Textures.BlockIcons.CONNECTED_HULLS[(tStartIndex + 5)].getIcon(); + } + if ((!tConnectedSides[4]) && (!tConnectedSides[5]) && (tConnectedSides[2]) && (tConnectedSides[3])) { + return Textures.BlockIcons.CONNECTED_HULLS[(tStartIndex + 8)].getIcon(); + } + if ((tConnectedSides[4]) && (!tConnectedSides[5]) && (!tConnectedSides[2]) && (tConnectedSides[3])) { + return Textures.BlockIcons.CONNECTED_HULLS[(tStartIndex + 9)].getIcon(); + } + if ((tConnectedSides[4]) && (tConnectedSides[5]) && (!tConnectedSides[2]) && (!tConnectedSides[3])) { + return Textures.BlockIcons.CONNECTED_HULLS[(tStartIndex + 10)].getIcon(); + } + if ((!tConnectedSides[4]) && (tConnectedSides[5]) && (tConnectedSides[2]) && (!tConnectedSides[3])) { + return Textures.BlockIcons.CONNECTED_HULLS[(tStartIndex + 11)].getIcon(); + } + if ((!tConnectedSides[4]) && (!tConnectedSides[5]) && (!tConnectedSides[2]) && (!tConnectedSides[3])) { + return Textures.BlockIcons.CONNECTED_HULLS[(tStartIndex + 7)].getIcon(); + } + if ((!tConnectedSides[4]) && (!tConnectedSides[2])) { + return Textures.BlockIcons.CONNECTED_HULLS[(tStartIndex + 1)].getIcon(); + } + if ((!tConnectedSides[5]) && (!tConnectedSides[3])) { + return Textures.BlockIcons.CONNECTED_HULLS[(tStartIndex + 0)].getIcon(); + } + case 1: + if (tConnectedSides[1]) { + return Textures.BlockIcons.CONNECTED_HULLS[(tStartIndex + 7)].getIcon(); + } + if ((tConnectedSides[4]) && (tConnectedSides[5]) && (tConnectedSides[2]) && (tConnectedSides[3])) { + return Textures.BlockIcons.CONNECTED_HULLS[(tStartIndex + 6)].getIcon(); + } + if ((!tConnectedSides[4]) && (tConnectedSides[5]) && (tConnectedSides[2]) && (tConnectedSides[3])) { + return Textures.BlockIcons.CONNECTED_HULLS[(tStartIndex + 2)].getIcon(); + } + if ((tConnectedSides[4]) && (!tConnectedSides[5]) && (tConnectedSides[2]) && (tConnectedSides[3])) { + return Textures.BlockIcons.CONNECTED_HULLS[(tStartIndex + 3)].getIcon(); + } + if ((tConnectedSides[4]) && (tConnectedSides[5]) && (!tConnectedSides[2]) && (tConnectedSides[3])) { + return Textures.BlockIcons.CONNECTED_HULLS[(tStartIndex + 4)].getIcon(); + } + if ((tConnectedSides[4]) && (tConnectedSides[5]) && (tConnectedSides[2]) && (!tConnectedSides[3])) { + return Textures.BlockIcons.CONNECTED_HULLS[(tStartIndex + 5)].getIcon(); + } + if ((!tConnectedSides[4]) && (!tConnectedSides[5]) && (tConnectedSides[2]) && (tConnectedSides[3])) { + return Textures.BlockIcons.CONNECTED_HULLS[(tStartIndex + 8)].getIcon(); + } + if ((tConnectedSides[4]) && (!tConnectedSides[5]) && (!tConnectedSides[2]) && (tConnectedSides[3])) { + return Textures.BlockIcons.CONNECTED_HULLS[(tStartIndex + 9)].getIcon(); + } + if ((tConnectedSides[4]) && (tConnectedSides[5]) && (!tConnectedSides[2]) && (!tConnectedSides[3])) { + return Textures.BlockIcons.CONNECTED_HULLS[(tStartIndex + 10)].getIcon(); + } + if ((!tConnectedSides[4]) && (tConnectedSides[5]) && (tConnectedSides[2]) && (!tConnectedSides[3])) { + return Textures.BlockIcons.CONNECTED_HULLS[(tStartIndex + 11)].getIcon(); + } + if ((!tConnectedSides[4]) && (!tConnectedSides[5]) && (!tConnectedSides[2]) && (!tConnectedSides[3])) { + return Textures.BlockIcons.CONNECTED_HULLS[(tStartIndex + 7)].getIcon(); + } + if ((!tConnectedSides[2]) && (!tConnectedSides[4])) { + return Textures.BlockIcons.CONNECTED_HULLS[(tStartIndex + 1)].getIcon(); + } + if ((!tConnectedSides[3]) && (!tConnectedSides[5])) { + return Textures.BlockIcons.CONNECTED_HULLS[(tStartIndex + 0)].getIcon(); + } + case 2: + if (tConnectedSides[5]) { + return Textures.BlockIcons.CONNECTED_HULLS[(tStartIndex + 7)].getIcon(); + } + if ((tConnectedSides[2]) && (tConnectedSides[0]) && (tConnectedSides[4]) && (tConnectedSides[1])) { + return Textures.BlockIcons.CONNECTED_HULLS[(tStartIndex + 6)].getIcon(); + } + if ((!tConnectedSides[2]) && (tConnectedSides[0]) && (tConnectedSides[4]) && (tConnectedSides[1])) { + return Textures.BlockIcons.CONNECTED_HULLS[(tStartIndex + 2)].getIcon(); + } + if ((tConnectedSides[2]) && (!tConnectedSides[0]) && (tConnectedSides[4]) && (tConnectedSides[1])) { + return Textures.BlockIcons.CONNECTED_HULLS[(tStartIndex + 5)].getIcon(); + } + if ((tConnectedSides[2]) && (tConnectedSides[0]) && (!tConnectedSides[4]) && (tConnectedSides[1])) { + return Textures.BlockIcons.CONNECTED_HULLS[(tStartIndex + 4)].getIcon(); + } + if ((tConnectedSides[2]) && (tConnectedSides[0]) && (tConnectedSides[4]) && (!tConnectedSides[1])) { + return Textures.BlockIcons.CONNECTED_HULLS[(tStartIndex + 3)].getIcon(); + } + if ((!tConnectedSides[2]) && (!tConnectedSides[0]) && (tConnectedSides[4]) && (tConnectedSides[1])) { + return Textures.BlockIcons.CONNECTED_HULLS[(tStartIndex + 11)].getIcon(); + } + if ((tConnectedSides[2]) && (!tConnectedSides[0]) && (!tConnectedSides[4]) && (tConnectedSides[1])) { + return Textures.BlockIcons.CONNECTED_HULLS[(tStartIndex + 10)].getIcon(); + } + if ((tConnectedSides[2]) && (tConnectedSides[0]) && (!tConnectedSides[4]) && (!tConnectedSides[1])) { + return Textures.BlockIcons.CONNECTED_HULLS[(tStartIndex + 9)].getIcon(); + } + if ((!tConnectedSides[2]) && (tConnectedSides[0]) && (tConnectedSides[4]) && (!tConnectedSides[1])) { + return Textures.BlockIcons.CONNECTED_HULLS[(tStartIndex + 8)].getIcon(); + } + if ((!tConnectedSides[2]) && (!tConnectedSides[0]) && (!tConnectedSides[4]) && (!tConnectedSides[1])) { + return Textures.BlockIcons.CONNECTED_HULLS[(tStartIndex + 7)].getIcon(); + } + if ((!tConnectedSides[2]) && (!tConnectedSides[4])) { + return Textures.BlockIcons.CONNECTED_HULLS[(tStartIndex + 1)].getIcon(); + } + if ((!tConnectedSides[0]) && (!tConnectedSides[1])) { + return Textures.BlockIcons.CONNECTED_HULLS[(tStartIndex + 0)].getIcon(); + } + case 3: + if (tConnectedSides[3]) { + return Textures.BlockIcons.CONNECTED_HULLS[(tStartIndex + 7)].getIcon(); + } + if ((tConnectedSides[2]) && (tConnectedSides[0]) && (tConnectedSides[4]) && (tConnectedSides[1])) { + return Textures.BlockIcons.CONNECTED_HULLS[(tStartIndex + 6)].getIcon(); + } + if ((!tConnectedSides[2]) && (tConnectedSides[0]) && (tConnectedSides[4]) && (tConnectedSides[1])) { + return Textures.BlockIcons.CONNECTED_HULLS[(tStartIndex + 4)].getIcon(); + } + if ((tConnectedSides[2]) && (!tConnectedSides[0]) && (tConnectedSides[4]) && (tConnectedSides[1])) { + return Textures.BlockIcons.CONNECTED_HULLS[(tStartIndex + 5)].getIcon(); + } + if ((tConnectedSides[2]) && (tConnectedSides[0]) && (!tConnectedSides[4]) && (tConnectedSides[1])) { + return Textures.BlockIcons.CONNECTED_HULLS[(tStartIndex + 2)].getIcon(); + } + if ((tConnectedSides[2]) && (tConnectedSides[0]) && (tConnectedSides[4]) && (!tConnectedSides[1])) { + return Textures.BlockIcons.CONNECTED_HULLS[(tStartIndex + 3)].getIcon(); + } + if ((!tConnectedSides[2]) && (!tConnectedSides[0]) && (tConnectedSides[4]) && (tConnectedSides[1])) { + return Textures.BlockIcons.CONNECTED_HULLS[(tStartIndex + 10)].getIcon(); + } + if ((tConnectedSides[2]) && (!tConnectedSides[0]) && (!tConnectedSides[4]) && (tConnectedSides[1])) { + return Textures.BlockIcons.CONNECTED_HULLS[(tStartIndex + 11)].getIcon(); + } + if ((tConnectedSides[2]) && (tConnectedSides[0]) && (!tConnectedSides[4]) && (!tConnectedSides[1])) { + return Textures.BlockIcons.CONNECTED_HULLS[(tStartIndex + 8)].getIcon(); + } + if ((!tConnectedSides[2]) && (tConnectedSides[0]) && (tConnectedSides[4]) && (!tConnectedSides[1])) { + return Textures.BlockIcons.CONNECTED_HULLS[(tStartIndex + 9)].getIcon(); + } + if ((!tConnectedSides[2]) && (!tConnectedSides[0]) && (!tConnectedSides[4]) && (!tConnectedSides[1])) { + return Textures.BlockIcons.CONNECTED_HULLS[(tStartIndex + 7)].getIcon(); + } + if ((!tConnectedSides[2]) && (!tConnectedSides[4])) { + return Textures.BlockIcons.CONNECTED_HULLS[(tStartIndex + 1)].getIcon(); + } + if ((!tConnectedSides[0]) && (!tConnectedSides[1])) { + return Textures.BlockIcons.CONNECTED_HULLS[(tStartIndex + 0)].getIcon(); + } + case 4: + if (tConnectedSides[4]) { + return Textures.BlockIcons.CONNECTED_HULLS[(tStartIndex + 7)].getIcon(); + } + if ((tConnectedSides[0]) && (tConnectedSides[3]) && (tConnectedSides[1]) && (tConnectedSides[5])) { + return Textures.BlockIcons.CONNECTED_HULLS[(tStartIndex + 6)].getIcon(); + } + if ((!tConnectedSides[0]) && (tConnectedSides[3]) && (tConnectedSides[1]) && (tConnectedSides[5])) { + return Textures.BlockIcons.CONNECTED_HULLS[(tStartIndex + 5)].getIcon(); + } + if ((tConnectedSides[0]) && (!tConnectedSides[3]) && (tConnectedSides[1]) && (tConnectedSides[5])) { + return Textures.BlockIcons.CONNECTED_HULLS[(tStartIndex + 4)].getIcon(); + } + if ((tConnectedSides[0]) && (tConnectedSides[3]) && (!tConnectedSides[1]) && (tConnectedSides[5])) { + return Textures.BlockIcons.CONNECTED_HULLS[(tStartIndex + 3)].getIcon(); + } + if ((tConnectedSides[0]) && (tConnectedSides[3]) && (tConnectedSides[1]) && (!tConnectedSides[5])) { + return Textures.BlockIcons.CONNECTED_HULLS[(tStartIndex + 2)].getIcon(); + } + if ((!tConnectedSides[0]) && (!tConnectedSides[3]) && (tConnectedSides[1]) && (tConnectedSides[5])) { + return Textures.BlockIcons.CONNECTED_HULLS[(tStartIndex + 10)].getIcon(); + } + if ((tConnectedSides[0]) && (!tConnectedSides[3]) && (!tConnectedSides[1]) && (tConnectedSides[5])) { + return Textures.BlockIcons.CONNECTED_HULLS[(tStartIndex + 9)].getIcon(); + } + if ((tConnectedSides[0]) && (tConnectedSides[3]) && (!tConnectedSides[1]) && (!tConnectedSides[5])) { + return Textures.BlockIcons.CONNECTED_HULLS[(tStartIndex + 8)].getIcon(); + } + if ((!tConnectedSides[0]) && (tConnectedSides[3]) && (tConnectedSides[1]) && (!tConnectedSides[5])) { + return Textures.BlockIcons.CONNECTED_HULLS[(tStartIndex + 11)].getIcon(); + } + if ((!tConnectedSides[0]) && (!tConnectedSides[3]) && (!tConnectedSides[1]) && (!tConnectedSides[5])) { + return Textures.BlockIcons.CONNECTED_HULLS[(tStartIndex + 7)].getIcon(); + } + if ((!tConnectedSides[0]) && (!tConnectedSides[1])) { + return Textures.BlockIcons.CONNECTED_HULLS[(tStartIndex + 0)].getIcon(); + } + if ((!tConnectedSides[3]) && (!tConnectedSides[5])) { + return Textures.BlockIcons.CONNECTED_HULLS[(tStartIndex + 1)].getIcon(); + } + case 5: + if (tConnectedSides[2]) { + return Textures.BlockIcons.CONNECTED_HULLS[(tStartIndex + 7)].getIcon(); + } + if ((tConnectedSides[0]) && (tConnectedSides[3]) && (tConnectedSides[1]) && (tConnectedSides[5])) { + return Textures.BlockIcons.CONNECTED_HULLS[(tStartIndex + 6)].getIcon(); + } + if ((!tConnectedSides[0]) && (tConnectedSides[3]) && (tConnectedSides[1]) && (tConnectedSides[5])) { + return Textures.BlockIcons.CONNECTED_HULLS[(tStartIndex + 5)].getIcon(); + } + if ((tConnectedSides[0]) && (!tConnectedSides[3]) && (tConnectedSides[1]) && (tConnectedSides[5])) { + return Textures.BlockIcons.CONNECTED_HULLS[(tStartIndex + 2)].getIcon(); + } + if ((tConnectedSides[0]) && (tConnectedSides[3]) && (!tConnectedSides[1]) && (tConnectedSides[5])) { + return Textures.BlockIcons.CONNECTED_HULLS[(tStartIndex + 3)].getIcon(); + } + if ((tConnectedSides[0]) && (tConnectedSides[3]) && (tConnectedSides[1]) && (!tConnectedSides[5])) { + return Textures.BlockIcons.CONNECTED_HULLS[(tStartIndex + 4)].getIcon(); + } + if ((!tConnectedSides[0]) && (!tConnectedSides[3]) && (tConnectedSides[1]) && (tConnectedSides[5])) { + return Textures.BlockIcons.CONNECTED_HULLS[(tStartIndex + 11)].getIcon(); + } + if ((tConnectedSides[0]) && (!tConnectedSides[3]) && (!tConnectedSides[1]) && (tConnectedSides[5])) { + return Textures.BlockIcons.CONNECTED_HULLS[(tStartIndex + 8)].getIcon(); + } + if ((tConnectedSides[0]) && (tConnectedSides[3]) && (!tConnectedSides[1]) && (!tConnectedSides[5])) { + return Textures.BlockIcons.CONNECTED_HULLS[(tStartIndex + 9)].getIcon(); + } + if ((!tConnectedSides[0]) && (tConnectedSides[3]) && (tConnectedSides[1]) && (!tConnectedSides[5])) { + return Textures.BlockIcons.CONNECTED_HULLS[(tStartIndex + 10)].getIcon(); + } + if ((!tConnectedSides[0]) && (!tConnectedSides[3]) && (!tConnectedSides[1]) && (!tConnectedSides[5])) { + return Textures.BlockIcons.CONNECTED_HULLS[(tStartIndex + 7)].getIcon(); + } + if ((!tConnectedSides[0]) && (!tConnectedSides[1])) { + return Textures.BlockIcons.CONNECTED_HULLS[(tStartIndex + 0)].getIcon(); + } + if ((!tConnectedSides[3]) && (!tConnectedSides[5])) { + return Textures.BlockIcons.CONNECTED_HULLS[(tStartIndex + 1)].getIcon(); + } + break; + } + return Textures.BlockIcons.CONNECTED_HULLS[(tStartIndex + 7)].getIcon(); + } + + public boolean isCentrifugeRunning(IMetaTileEntity aTile) { + if (aTile == null) { + return false; + } + else { + return aTile.getBaseMetaTileEntity().isActive(); + } + + + } + + public boolean isUsingAnimatedTexture(IMetaTileEntity aMetaTileEntity) { + return true; + } + + public IIcon getIconByIndex(IMetaTileEntity aMetaTileEntity, int aIndex) { + if (isCentrifugeRunning(aMetaTileEntity)) { + return this.GRINDER_ACTIVE[aIndex].getIcon(); + } + + return this.GRINDER[aIndex].getIcon(); + } + +} diff --git a/src/Java/gtPlusPlus/xmod/gregtech/common/blocks/textures/TexturesGtBlock.java b/src/Java/gtPlusPlus/xmod/gregtech/common/blocks/textures/TexturesGtBlock.java index 0e25057d35..7903da8c6d 100644 --- a/src/Java/gtPlusPlus/xmod/gregtech/common/blocks/textures/TexturesGtBlock.java +++ b/src/Java/gtPlusPlus/xmod/gregtech/common/blocks/textures/TexturesGtBlock.java @@ -280,7 +280,13 @@ public class TexturesGtBlock { public static final CustomIcon TEXTURE_CASING_ADVANCED_CRYOGENIC = new CustomIcon("TileEntities/MACHINE_CASING_ADVANCED_CRYOGENIC"); public static final CustomIcon TEXTURE_CASING_ADVANCED_VOLCNUS = new CustomIcon("TileEntities/MACHINE_CASING_ADVANCED_VOLCANUS"); public static final CustomIcon TEXTURE_CASING_ROCKETDYNE = new CustomIcon("TileEntities/MACHINE_CASING_ROCKETDYNE"); + public static final CustomIcon TEXTURE_CASING_GRINDING_MILL = new CustomIcon("TileEntities/MACHINE_CASING_GRINDING_FACTORY"); + // Custom Pipes + public static final CustomIcon TEXTURE_PIPE_GRINDING_MILL = new CustomIcon("TileEntities/MACHINE_CASING_PIPE_T1"); + + // Custom Gearboxes + public static final CustomIcon TEXTURE_GEARBOX_GRINDING_MILL = new CustomIcon("TileEntities/MACHINE_CASING_GEARBOX_T1"); public static final CustomIcon TEXTURE_CASING_FUSION_COIL_II = new CustomIcon("iconsets/MACHINE_CASING_FUSION_3"); public static final CustomIcon TEXTURE_CASING_FUSION_COIL_II_INNER = new CustomIcon("iconsets/MACHINE_CASING_FUSION_COIL_II"); diff --git a/src/Java/gtPlusPlus/xmod/gregtech/common/items/MetaGeneratedGregtechItems.java b/src/Java/gtPlusPlus/xmod/gregtech/common/items/MetaGeneratedGregtechItems.java index 5d4cf5ea94..232d4e2cd7 100644 --- a/src/Java/gtPlusPlus/xmod/gregtech/common/items/MetaGeneratedGregtechItems.java +++ b/src/Java/gtPlusPlus/xmod/gregtech/common/items/MetaGeneratedGregtechItems.java @@ -363,6 +363,15 @@ public class MetaGeneratedGregtechItems extends Gregtech_MetaItem_X32 { 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)})); } + + // Distillus Chip + GregtechItemList.Distillus_Upgrade_Chip.set(this.addItem(151, "Upgrade Chip", "Used to upgrade Distillus to Tier 2")); + + + GregtechItemList.Chip_MultiNerf_NoOutputBonus.set(this.addItem(160, "No-Bonus Chip", "You won't like using this")); + GregtechItemList.Chip_MultiNerf_NoSpeedBonus.set(this.addItem(161, "No-Bonus Chip", "You won't like using this")); + GregtechItemList.Chip_MultiNerf_NoEuBonus.set(this.addItem(162, "No-Bonus Chip", "You won't like using this")); + } diff --git a/src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/generators/GT_MetaTileEntity_SemiFluidGenerator.java b/src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/generators/GT_MetaTileEntity_SemiFluidGenerator.java index 9f50cf6d91..bd9708108b 100644 --- a/src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/generators/GT_MetaTileEntity_SemiFluidGenerator.java +++ b/src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/generators/GT_MetaTileEntity_SemiFluidGenerator.java @@ -8,6 +8,7 @@ import gregtech.api.enums.Textures; import gregtech.api.interfaces.ITexture; import gregtech.api.interfaces.tileentity.IGregTechTileEntity; import gregtech.api.metatileentity.MetaTileEntity; +import gregtech.api.metatileentity.implementations.GT_MetaTileEntity_BasicGenerator; import gregtech.api.objects.GT_ItemStack; import gregtech.api.objects.GT_RenderedTexture; import gregtech.api.util.GT_ModHandler; @@ -15,10 +16,9 @@ import gregtech.api.util.GT_Recipe; import gregtech.api.util.GT_Utility; import gregtech.api.util.Recipe_GT.Gregtech_Recipe_Map; import gtPlusPlus.api.objects.Logger; -import gtPlusPlus.xmod.gregtech.api.metatileentity.custom.power.GTPP_MTE_BasicLosslessGenerator; import net.minecraft.item.ItemStack; -public class GT_MetaTileEntity_SemiFluidGenerator extends GTPP_MTE_BasicLosslessGenerator{ +public class GT_MetaTileEntity_SemiFluidGenerator extends GT_MetaTileEntity_BasicGenerator { public static final int BASE_POLLUTION = 2; public int mEfficiency; diff --git a/src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/processing/GregtechMetaTileEntity_IndustrialPlatePress.java b/src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/processing/GregtechMetaTileEntity_IndustrialPlatePress.java index 0939a9e6be..360939eb41 100644 --- a/src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/processing/GregtechMetaTileEntity_IndustrialPlatePress.java +++ b/src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/processing/GregtechMetaTileEntity_IndustrialPlatePress.java @@ -72,9 +72,9 @@ public class GregtechMetaTileEntity_IndustrialPlatePress extends GregtechMeta_Mu @Override public ITexture[] getTexture(final IGregTechTileEntity aBaseMetaTileEntity, final byte aSide, final byte aFacing, final byte aColorIndex, final boolean aActive, final boolean aRedstone) { if (aSide == aFacing) { - return new ITexture[]{Textures.BlockIcons.CASING_BLOCKS[TAE.GTPP_INDEX(4)], new GT_RenderedTexture(aActive ? TexturesGtBlock.Overlay_Machine_Controller_Default_Active : TexturesGtBlock.Overlay_Machine_Controller_Default)}; + return new ITexture[]{Textures.BlockIcons.CASING_BLOCKS[50], new GT_RenderedTexture(aActive ? TexturesGtBlock.Overlay_Machine_Controller_Default_Active : TexturesGtBlock.Overlay_Machine_Controller_Default)}; } - return new ITexture[]{Textures.BlockIcons.CASING_BLOCKS[TAE.GTPP_INDEX(4)]}; + return new ITexture[]{Textures.BlockIcons.CASING_BLOCKS[50]}; } @Override @@ -148,7 +148,7 @@ public class GregtechMetaTileEntity_IndustrialPlatePress extends GregtechMeta_Mu Block aBlock = aBaseMetaTileEntity.getBlockOffset(xDir + i, h, zDir + j); int aMeta = aBaseMetaTileEntity.getMetaIDOffset(xDir + i, h, zDir + j); - if (!isValidBlockForStructure(tTileEntity, 4, true, aBlock, aMeta, + if (!isValidBlockForStructure(tTileEntity, 50, true, aBlock, aMeta, ModBlocks.blockCasingsMisc, 4)) { Logger.INFO("Bad material press casing"); return false; 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 ca6eeda207..40d12356d8 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 @@ -238,7 +238,7 @@ extends GregtechMeta_MultiBlockBase { public byte getCasingTextureIndex() { - return (byte) TAE.GTPP_INDEX(20); + return (byte) TAE.GTPP_INDEX(11); } private boolean addToMachineList(final IGregTechTileEntity tTileEntity) { diff --git a/src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/processing/GregtechMetaTileEntity_IsaMill.java b/src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/processing/GregtechMetaTileEntity_IsaMill.java new file mode 100644 index 0000000000..d06b7ed0d1 --- /dev/null +++ b/src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/processing/GregtechMetaTileEntity_IsaMill.java @@ -0,0 +1,404 @@ +package gtPlusPlus.xmod.gregtech.common.tileentities.machines.multi.processing; + +import java.util.HashSet; +import java.util.List; + +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.Recipe_GT; +import gtPlusPlus.api.objects.Logger; +import gtPlusPlus.api.objects.data.AutoMap; +import gtPlusPlus.api.objects.minecraft.BlockPos; +import gtPlusPlus.core.block.ModBlocks; +import gtPlusPlus.core.util.math.MathUtils; +import gtPlusPlus.core.util.minecraft.EntityUtils; +import gtPlusPlus.core.util.minecraft.PlayerUtils; +import gtPlusPlus.xmod.gregtech.api.metatileentity.implementations.base.GregtechMeta_MultiBlockBase; +import gtPlusPlus.xmod.gregtech.common.blocks.textures.TexturesGtBlock.CustomIcon; +import net.minecraft.block.Block; +import net.minecraft.entity.EntityLivingBase; +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.util.DamageSource; +import net.minecraft.world.World; +import net.minecraft.world.chunk.Chunk; + +public class GregtechMetaTileEntity_IsaMill extends GregtechMeta_MultiBlockBase { + + protected int fuelConsumption = 0; + protected int fuelValue = 0; + protected int fuelRemaining = 0; + protected boolean boostEu = false; + + private static ITexture frontFace; + private static ITexture frontFaceActive; + + private static final DamageSource mIsaMillDamageSource = new DamageSource("gtpp.grinder").setDamageBypassesArmor(); + + public GregtechMetaTileEntity_IsaMill(int aID, String aName, String aNameRegional) { + super(aID, aName, aNameRegional); + frontFaceActive = new GT_RenderedTexture(new CustomIcon("iconsets/Grinder/GRINDER_ACTIVE5")); + frontFace = new GT_RenderedTexture(new CustomIcon("iconsets/Grinder/GRINDER5")); + } + + public GregtechMetaTileEntity_IsaMill(String aName) { + super(aName); + } + + public String[] getTooltip() { + return new String[]{ + "Controller Block for the Large Grinding Machine", + "Engine Intake Casings must not be obstructed in front (only air blocks)", + "Supply Semifluid Fuels and 2000L of Lubricant per hour to run.", + "Supply 80L of Oxygen per second to boost output (optional).", + "Default: Produces 2048EU/t at 100% efficiency", + "Boosted: Produces 6144EU/t at 150% efficiency", + "Size(WxHxD): 3x3x4, Controller (front centered)", + "3x3x4 of Stable Titanium Machine Casing (hollow, Min 16!)", + "All hatches except dynamo can replace any Stable Titanium casing in middle two segments", + "2x Steel Gear Box Machine Casing inside the Hollow Casing", + "8x Engine Intake Machine Casing (around controller)", + "2x Input Hatch (Fuel/Lubricant)", + "1x Maintenance Hatch", + "1x Muffler Hatch", + "1x Dynamo Hatch (back centered)", + }; + } + + + public ITexture[] getTexture(final IGregTechTileEntity aBaseMetaTileEntity, final byte aSide, final byte aFacing, final byte aColorIndex, final boolean aActive, final boolean aRedstone) { + return new ITexture[]{ + Textures.BlockIcons.CASING_BLOCKS[TAE.GTPP_INDEX(2)], + aFacing == aSide ? aActive ? frontFaceActive : frontFace : Textures.BlockIcons.CASING_BLOCKS[TAE.GTPP_INDEX(2)]}; + } + + @Override + public boolean isCorrectMachinePart(ItemStack aStack) { + return getMaxEfficiency(aStack) > 0; + } + + public Object getClientGUI(int aID, InventoryPlayer aPlayerInventory, IGregTechTileEntity aBaseMetaTileEntity) { + return new GT_GUIContainer_MultiMachine(aPlayerInventory, aBaseMetaTileEntity, getLocalName(), "LargeDieselEngine.png"); + } + + @Override + public GT_Recipe.GT_Recipe_Map getRecipeMap() { + return Recipe_GT.Gregtech_Recipe_Map.sOreMillRecipes; + } + + @Override + public void onPostTick(IGregTechTileEntity aBaseMetaTileEntity, long aTick) { + super.onPostTick(aBaseMetaTileEntity, aTick); + if (aTick % 20 == 0) { + checkForEntities(aBaseMetaTileEntity, aTick); + } + } + + private final AutoMap<BlockPos> mFrontBlockPosCache = new AutoMap<BlockPos>(); + + public void checkForEntities(IGregTechTileEntity aBaseMetaTileEntity, long aTime) { + + if (aTime % 100 == 0) { + mFrontBlockPosCache.clear(); + } + if (mFrontBlockPosCache.isEmpty()) { + byte tSide = aBaseMetaTileEntity.getBackFacing(); + int aTileX = aBaseMetaTileEntity.getXCoord(); + int aTileY = aBaseMetaTileEntity.getYCoord(); + int aTileZ = aBaseMetaTileEntity.getZCoord(); + boolean xFacing = (tSide == 4 || tSide == 5); + boolean zFacing = (tSide == 2 || tSide == 3); + + // Check Casings + int aDepthOffset = (tSide == 2 || tSide == 4) ? 1 : -1; + for (int aHorizontalOffset = -1; aHorizontalOffset < 2; aHorizontalOffset++) { + for (int aVerticalOffset = -1; aVerticalOffset < 2; aVerticalOffset++) { + int aX = !xFacing ? (aTileX + aHorizontalOffset) : (aTileX + aDepthOffset); + int aY = aTileY + aVerticalOffset; + int aZ = !zFacing ? (aTileZ + aHorizontalOffset) : (aTileZ + aDepthOffset); + mFrontBlockPosCache.add(new BlockPos(aX, aY, aZ, aBaseMetaTileEntity.getWorld())); + } + } + } + + AutoMap<EntityLivingBase> aEntities = getEntities(mFrontBlockPosCache, aBaseMetaTileEntity.getWorld()); + if (!aEntities.isEmpty()) { + for (EntityLivingBase aFoundEntity : aEntities) { + if (aFoundEntity instanceof EntityPlayer) { + EntityPlayer aPlayer = (EntityPlayer) aFoundEntity; + if (PlayerUtils.isCreative(aPlayer) || !PlayerUtils.canTakeDamage(aPlayer)) { + continue; + } + else { + if (aFoundEntity.getHealth() > 0) { + EntityUtils.doDamage(aFoundEntity, mIsaMillDamageSource, (int) (aFoundEntity.getMaxHealth() / 5)); + if ((aBaseMetaTileEntity.isClientSide()) && (aBaseMetaTileEntity.isActive())) { + generateParticles(aFoundEntity); + } + } + } + } + if (aFoundEntity.getHealth() > 0) { + EntityUtils.doDamage(aFoundEntity, mIsaMillDamageSource, Math.max(1, (int) (aFoundEntity.getMaxHealth() / 3))); + if ((aBaseMetaTileEntity.isClientSide()) && (aBaseMetaTileEntity.isActive())) { + generateParticles(aFoundEntity); + } + } + } + } + } + + private static final AutoMap<EntityLivingBase> getEntities(AutoMap<BlockPos> aPositionsToCheck, World aWorld){ + AutoMap<EntityLivingBase> aEntities = new AutoMap<EntityLivingBase>(); + HashSet<Chunk> aChunksToCheck = new HashSet<Chunk>(); + if (!aPositionsToCheck.isEmpty()) { + Chunk aLocalChunk; + for (BlockPos aPos : aPositionsToCheck) { + aLocalChunk = aWorld.getChunkFromBlockCoords(aPos.xPos, aPos.zPos); + aChunksToCheck.add(aLocalChunk); + } + } + if (!aChunksToCheck.isEmpty()) { + AutoMap<EntityLivingBase> aEntitiesFound = new AutoMap<EntityLivingBase>(); + for (Chunk aChunk : aChunksToCheck) { + if (aChunk.isChunkLoaded) { + List[] aEntityLists = aChunk.entityLists; + for (List aEntitySubList : aEntityLists) { + for (Object aEntity : aEntitySubList) { + if (aEntity instanceof EntityLivingBase) { + EntityLivingBase aPlayer = (EntityLivingBase) aEntity; + aEntitiesFound.add(aPlayer); + } + } + } + } + } + if (!aEntitiesFound.isEmpty()) { + for (EntityLivingBase aEntity : aEntitiesFound) { + BlockPos aPlayerPos = EntityUtils.findBlockPosOfEntity(aEntity); + for (BlockPos aBlockSpaceToCheck : aPositionsToCheck) { + if (aBlockSpaceToCheck.equals(aPlayerPos)) { + aEntities.add(aEntity); + } + } + } + } + } + return aEntities; + } + + private static void generateParticles(EntityLivingBase aEntity) { + BlockPos aPlayerPosBottom = EntityUtils.findBlockPosOfEntity(aEntity); + BlockPos aPlayerPosTop = aPlayerPosBottom.getUp(); + AutoMap<BlockPos> aEntityPositions = new AutoMap<BlockPos>(); + aEntityPositions.add(aPlayerPosBottom); + aEntityPositions.add(aPlayerPosTop); + for (int i = 0; i < 64; i++) { + BlockPos aEffectPos = aEntityPositions.get(aEntity.height > 1f ? MathUtils.randInt(0, 1) : 0); + float aOffsetX = MathUtils.randFloat(-0.35f, 0.35f); + float aOffsetY = MathUtils.randFloat(-0.25f, 0.35f); + float aOffsetZ = MathUtils.randFloat(-0.35f, 0.35f); + aEntity.worldObj.spawnParticle("reddust", aEffectPos.xPos + aOffsetX, aEffectPos.yPos + 0.3f + aOffsetY, aEffectPos.zPos + aOffsetZ, 0.0D, 0.0D, 0.0D); + } + } + + @Override + public boolean isFacingValid(final byte aFacing) { + return aFacing > 1; + } + + @Override + public boolean checkRecipe(ItemStack aStack) { + return checkRecipeGeneric(); + } + + @Override + public boolean checkMultiblock(IGregTechTileEntity aBaseMetaTileEntity, ItemStack aStack) { + byte tSide = aBaseMetaTileEntity.getBackFacing(); + int aTileX = aBaseMetaTileEntity.getXCoord(); + int aTileY = aBaseMetaTileEntity.getYCoord(); + int aTileZ = aBaseMetaTileEntity.getZCoord(); + boolean xFacing = (tSide == 4 || tSide == 5); + boolean zFacing = (tSide == 2 || tSide == 3); + int aCasingCount = 0; + // Check Intake Hatches + for (int aHorizontalOffset = -1; aHorizontalOffset < 2; aHorizontalOffset++) { + for (int aVerticalOffset = -1; aVerticalOffset < 2; aVerticalOffset++) { + if (aHorizontalOffset == 0 && aVerticalOffset == 0) { + continue; + } + int aX = !xFacing ? (aTileX + aHorizontalOffset) : aTileX; + int aY = aTileY + aVerticalOffset; + int aZ = !zFacing ? (aTileZ + aHorizontalOffset) : aTileZ; + Block aIntakeBlock = aBaseMetaTileEntity.getBlock(aX, aY, aZ); + int aIntakeMeta = aBaseMetaTileEntity.getMetaID(aX, aY, aZ); + if (!isValidBlockForStructure(null, 0, false, aIntakeBlock, aIntakeMeta, getIntakeBlock(), getIntakeMeta())) { + return false; // Not intake casing surrounding controller + } + } + } + // Check Casings + int aStartDepthOffset = (tSide == 2 || tSide == 4) ? -1 : 1; + int aFinishDepthOffset = (tSide == 2 || tSide == 4) ? -8 : 8; + for (int aDepthOffset = aStartDepthOffset; aDepthOffset != aFinishDepthOffset;) { + for (int aHorizontalOffset = -1; aHorizontalOffset < 2; aHorizontalOffset++) { + for (int aVerticalOffset = -1; aVerticalOffset < 2; aVerticalOffset++) { + if (aHorizontalOffset == 0 && aVerticalOffset == 0) { + continue; + } + int aX = !xFacing ? (aTileX + aHorizontalOffset) : (aTileX + aDepthOffset); + int aY = aTileY + aVerticalOffset; + int aZ = !zFacing ? (aTileZ + aHorizontalOffset) : (aTileZ + aDepthOffset); + Block aCasingBlock = aBaseMetaTileEntity.getBlock(aX, aY, aZ); + int aCasingMeta = aBaseMetaTileEntity.getMetaID(aX, aY, aZ); + IGregTechTileEntity aTileEntity = aBaseMetaTileEntity.getIGregTechTileEntity(aX, aY, aZ); + if (aTileEntity != null) { + final IMetaTileEntity aMetaTileEntity = aTileEntity.getMetaTileEntity(); + if (aMetaTileEntity != null) { + if (aMetaTileEntity instanceof GregtechMetaTileEntity_IsaMill) { + Logger.INFO("Don't be cheeky, only one controller per Mill."); + return false; + } + } + } + + if (!isValidBlockForStructure(aTileEntity, getCasingTextureIndex(), true, aCasingBlock, aCasingMeta, getCasingBlock(), getCasingMeta())) { + Logger.INFO("Bad casing."); + return false; // Not valid casing + } + else { + if (aTileEntity == null) { + aCasingCount++; + } + } + } + } + // Count Backwards for 2 axis + if (aStartDepthOffset == -1) { + aDepthOffset--; + } + // Count Forwards for 2 axis + else { + aDepthOffset++; + } + } + + // Check Gear Boxes + for (int aInternalDepthAxis = 1; aInternalDepthAxis < 7; aInternalDepthAxis++) { + if(aBaseMetaTileEntity.getBlockAtSideAndDistance(tSide, aInternalDepthAxis) != getGearboxBlock() || aBaseMetaTileEntity.getMetaIDAtSideAndDistance(tSide, aInternalDepthAxis) != getGearboxMeta()) { + Logger.INFO("Missing Gearbox at depth "+aInternalDepthAxis); + return false; + } + } + return aCasingCount >= 48; + } + + public Block getCasingBlock() { + return ModBlocks.blockCasings5Misc; + } + + public byte getCasingMeta() { + return 0; + } + + public Block getIntakeBlock() { + return ModBlocks.blockCasings5Misc; + } + + public byte getIntakeMeta() { + return 0; + } + + public Block getGearboxBlock() { + return ModBlocks.blockCasings5Misc; + } + + public byte getGearboxMeta() { + return 2; + } + + public byte getCasingTextureIndex() { + return 66; + } + + @Override + public IMetaTileEntity newMetaEntity(IGregTechTileEntity aTileEntity) { + return new GregtechMetaTileEntity_IsaMill(this.mName); + } + + @Override + public void saveNBTData(NBTTagCompound aNBT) { + super.saveNBTData(aNBT); + } + + @Override + public void loadNBTData(NBTTagCompound aNBT) { + super.loadNBTData(aNBT); + } + + @Override + public int getDamageToComponent(ItemStack aStack) { + return 1; + } + + public int getMaxEfficiency(ItemStack aStack) { + return boostEu ? 20000 : 10000; + } + + @Override + public int getPollutionPerTick(ItemStack aStack) { + return 64; + } + + @Override + public boolean explodesOnComponentBreak(ItemStack aStack) { + return false; + } + + @Override + public String[] getExtraInfoData() { + return new String[]{ + "IsaMill Grinding Machine", + "Current Efficiency: " + (mEfficiency / 100) + "%", + getIdealStatus() == getRepairStatus() ? "No Maintainance issues" : "Needs Maintainance" + }; + } + + @Override + public boolean isGivingInformation() { + return true; + } + + @Override + public boolean hasSlotInGUI() { + return false; + } + + @Override + public String getCustomGUIResourceName() { + return null; + } + + @Override + public String getMachineType() { + return "Grinding Machine"; + } + + @Override + public int getMaxParallelRecipes() { + return 1; + } + + @Override + public int getEuDiscountForParallelism() { + return 0; + } +} diff --git a/src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/processing/advanced/GregtechMetaTileEntity_Adv_AssemblyLine.java b/src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/processing/advanced/GregtechMetaTileEntity_Adv_AssemblyLine.java new file mode 100644 index 0000000000..eab997adb4 --- /dev/null +++ b/src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/processing/advanced/GregtechMetaTileEntity_Adv_AssemblyLine.java @@ -0,0 +1,623 @@ +package gtPlusPlus.xmod.gregtech.common.tileentities.machines.multi.processing.advanced; + +import java.util.ArrayList; +import gregtech.api.GregTech_API; +import gregtech.api.enums.GT_Values; +import gregtech.api.enums.ItemList; +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.metatileentity.implementations.GT_MetaTileEntity_Hatch; +import gregtech.api.metatileentity.implementations.GT_MetaTileEntity_Hatch_DataAccess; +import gregtech.api.objects.GT_RenderedTexture; +import gregtech.api.util.GT_Recipe; +import gregtech.api.util.GT_Utility; +import gtPlusPlus.core.block.ModBlocks; +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 net.minecraft.block.Block; +import net.minecraft.entity.player.EntityPlayer; +import net.minecraft.entity.player.InventoryPlayer; +import net.minecraft.item.ItemStack; +import net.minecraft.nbt.NBTTagCompound; +import net.minecraftforge.common.util.ForgeDirection; +import net.minecraftforge.fluids.FluidStack; + +public class GregtechMetaTileEntity_Adv_AssemblyLine + extends GregtechMeta_MultiBlockBase { + + public ArrayList<GT_MetaTileEntity_Hatch_DataAccess> mDataAccessHatches = new ArrayList<GT_MetaTileEntity_Hatch_DataAccess>(); + + public static String[] mCasingName = new String[5]; + 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 GregtechMetaTileEntity_Adv_AssemblyLine(int aID, String aName, String aNameRegional) { + super(aID, aName, aNameRegional); + 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); + } + + public GregtechMetaTileEntity_Adv_AssemblyLine(String aName) { + super(aName); + } + + public IMetaTileEntity newMetaEntity(IGregTechTileEntity aTileEntity) { + return new GregtechMetaTileEntity_Adv_AssemblyLine(this.mName); + } + + public String[] getTooltip() { + if (mCasingName[0].toLowerCase().contains(".name")) { + mCasingName[0] = LangUtils.getLocalizedNameOfBlock(getCasing(4), 0); + } + if (mCasingName[1].toLowerCase().contains(".name")) { + mCasingName[1] = LangUtils.getLocalizedNameOfBlock(getCasing(4), 1); + } + if (mCasingName[2].toLowerCase().contains(".name")) { + mCasingName[2] = LangUtils.getLocalizedNameOfBlock(getCasing(4), 2); + } + if (mCasingName[3].toLowerCase().contains(".name")) { + mCasingName[3] = LangUtils.getLocalizedNameOfBlock(getCasing(3), 15); + } + if (mCasingName[4].toLowerCase().contains(".name")) { + mCasingName[4] = LangUtils.getLocalizedNameOfBlock(getCasing(1), 13); + } + return new String[]{ + "Advanced Integrated Assembly Line" + }; + } + + private Block getCasing(int casingID) { + if (casingID == 1) { + return ModBlocks.blockCasingsMisc; + } + else if (casingID == 2) { + return ModBlocks.blockCasings2Misc; + } + else if (casingID == 3) { + return ModBlocks.blockCasings3Misc; + } + else if (casingID == 4) { + return ModBlocks.blockCasings4Misc; + } + else { + return ModBlocks.blockCasingsTieredGTPP; + } + } + + 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[16], new GT_RenderedTexture(aActive ? Textures.BlockIcons.OVERLAY_FRONT_ASSEMBLY_LINE_ACTIVE : Textures.BlockIcons.OVERLAY_FRONT_ASSEMBLY_LINE)}; + } + return new ITexture[]{Textures.BlockIcons.CASING_BLOCKS[16]}; + } + + public Object getClientGUI(int aID, InventoryPlayer aPlayerInventory, IGregTechTileEntity aBaseMetaTileEntity) { + return new GT_GUIContainer_MultiMachine(aPlayerInventory, aBaseMetaTileEntity, getLocalName(), "AssemblyLine.png"); + } + + public GT_Recipe.GT_Recipe_Map getRecipeMap() { + return null; + } + + public boolean isCorrectMachinePart(ItemStack aStack) { + return true; + } + + public boolean isFacingValid(byte aFacing) { + return aFacing > 1; + } + + public boolean checkRecipe(ItemStack aStack) { + if(GT_Values.D1)System.out.println("Start ALine recipe check"); + ArrayList<ItemStack> tDataStickList = getDataItems(2); + if (tDataStickList.size() == 0) return false; + if(GT_Values.D1)System.out.println("Stick accepted, " + tDataStickList.size() + " Data Sticks found"); + + ItemStack tStack[] = new ItemStack[15]; + FluidStack[] tFluids = new FluidStack[4]; + boolean findRecipe = false; + nextDS:for (ItemStack tDataStick : tDataStickList){ + NBTTagCompound tTag = tDataStick.getTagCompound(); + if (tTag == null) continue; + for (int i = 0; i < 15; i++) { + int count = tTag.getInteger("a"+i); + if (!tTag.hasKey("" + i) && count <= 0) continue; + if (mInputBusses.get(i) == null) { + continue nextDS; + } + + ItemStack stackInSlot = mInputBusses.get(i).getBaseMetaTileEntity().getStackInSlot(0); + boolean flag = true; + if (count > 0) { + for (int j = 0; j < count; j++) { + tStack[i] = GT_Utility.loadItem(tTag, "a" + i + ":" + j); + if (tStack[i] == null) continue; + if(GT_Values.D1)System.out.println("Item "+i+" : "+tStack[i].getUnlocalizedName()); + if (GT_Utility.areStacksEqual(tStack[i], stackInSlot, true) && tStack[i].stackSize <= stackInSlot.stackSize) { + flag = false; + break; + } + } + } + if (flag) { + tStack[i] = GT_Utility.loadItem(tTag, "" + i); + if (tStack[i] == null) { + flag = false; + continue; + } + if(GT_Values.D1)System.out.println("Item "+i+" : "+tStack[i].getUnlocalizedName()); + if (GT_Utility.areStacksEqual(tStack[i], stackInSlot, true) && tStack[i].stackSize <= stackInSlot.stackSize) { + flag = false; + } + } + if(GT_Values.D1) System.out.println(i + (flag ? " not accepted" : " accepted")); + if (flag) continue nextDS; + } + + if(GT_Values.D1)System.out.println("All Items done, start fluid check"); + for (int i = 0; i < 4; i++) { + if (!tTag.hasKey("f" + i)) continue; + tFluids[i] = GT_Utility.loadFluid(tTag, "f" + i); + if (tFluids[i] == null) continue; + if(GT_Values.D1)System.out.println("Fluid "+i+" "+tFluids[i].getUnlocalizedName()); + if (mInputHatches.get(i) == null) { + continue nextDS; + } + FluidStack fluidInHatch = mInputHatches.get(i).mFluid; + if (fluidInHatch == null || !GT_Utility.areFluidsEqual(fluidInHatch, tFluids[i], true) || fluidInHatch.amount < tFluids[i].amount) { + if(GT_Values.D1)System.out.println(i+" not accepted"); + continue nextDS; + } + if(GT_Values.D1)System.out.println(i+" accepted"); + } + + if(GT_Values.D1)System.out.println("Input accepted, check other values"); + if (!tTag.hasKey("output")) continue; + mOutputItems = new ItemStack[]{GT_Utility.loadItem(tTag, "output")}; + if (mOutputItems[0] == null || !GT_Utility.isStackValid(mOutputItems[0])) + continue; + + if (!tTag.hasKey("time")) continue; + mMaxProgresstime = tTag.getInteger("time"); + if (mMaxProgresstime <= 0) continue; + + if (!tTag.hasKey("eu")) continue; + mEUt = tTag.getInteger("eu"); + + if(GT_Values.D1)System.out.println("Find avaiable recipe"); + findRecipe = true; + break; + } + if (!findRecipe) return false; + + if(GT_Values.D1)System.out.println("All checked start consuming inputs"); + for (int i = 0; i < 15; i++) { + if (tStack[i] == null) continue; + ItemStack stackInSlot = mInputBusses.get(i).getBaseMetaTileEntity().getStackInSlot(0); + stackInSlot.stackSize -= tStack[i].stackSize; + } + + for (int i = 0; i < 4; i++) { + if (tFluids[i] == null) continue; + mInputHatches.get(i).mFluid.amount -= tFluids[i].amount; + if (mInputHatches.get(i).mFluid.amount <= 0) { + mInputHatches.get(i).mFluid = null; + } + } + if(GT_Values.D1)System.out.println("Check overclock"); + + byte tTier = (byte) Math.max(1, GT_Utility.getTier(getMaxInputVoltage())); + this.mEfficiency = (10000 - (getIdealStatus() - getRepairStatus()) * 1000); + this.mEfficiencyIncrease = 10000; + if (mEUt <= 16) { + this.mEUt = (mEUt * (1 << tTier - 1) * (1 << tTier - 1)); + this.mMaxProgresstime = (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); + updateSlots(); + if(GT_Values.D1)System.out.println("Recipe sucessfull"); + return true; + } + + public void startSoundLoop(byte aIndex, double aX, double aY, double aZ) { + super.startSoundLoop(aIndex, aX, aY, aZ); + if (aIndex == 20) { + GT_Utility.doSoundAtClient(GregTech_API.sSoundList.get(212), 10, 1.0F, aX, aY, aZ); + } + } + + public boolean checkMultiblock(IGregTechTileEntity aBaseMetaTileEntity, ItemStack aStack) { + 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; + } + IMetaTileEntity aMetaTileEntity = aTileEntity.getMetaTileEntity(); + if (aMetaTileEntity == null) { + return false; + } + if (aMetaTileEntity instanceof GT_MetaTileEntity_Hatch_DataAccess) { + ((GT_MetaTileEntity_Hatch) aMetaTileEntity).updateTexture(aBaseCasingIndex); + return mDataAccessHatches.add((GT_MetaTileEntity_Hatch_DataAccess) aMetaTileEntity); + } + 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; + } + + 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; + } + + 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); + } + else { + 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 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); + } + else { + 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 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; + }; + } + } + } + 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; + } + + /** + * @param state using bitmask, 1 for IntegratedCircuit, 2 for DataStick, 4 for DataOrb + */ + private boolean isCorrectDataItem(ItemStack aStack, int state){ + if ((state & 1) != 0 && ItemList.Circuit_Integrated.isStackEqual(aStack, true, true)) return true; + if ((state & 2) != 0 && ItemList.Tool_DataStick.isStackEqual(aStack, false, true)) return true; + if ((state & 4) != 0 && ItemList.Tool_DataOrb.isStackEqual(aStack, false, true)) return true; + return false; + } + + /** + * @param state using bitmask, 1 for IntegratedCircuit, 2 for DataStick, 4 for DataOrb + */ + public ArrayList<ItemStack> getDataItems(int state) { + ArrayList<ItemStack> rList = new ArrayList<ItemStack>(); + if (GT_Utility.isStackValid(mInventory[1]) && isCorrectDataItem(mInventory[1], state)) { + rList.add(mInventory[1]); + } + for (GT_MetaTileEntity_Hatch_DataAccess tHatch : mDataAccessHatches) { + if (isValidMetaTileEntity(tHatch)) { + for (int i = 0; i < tHatch.getBaseMetaTileEntity().getSizeInventory(); i++) { + if (tHatch.getBaseMetaTileEntity().getStackInSlot(i) != null + && isCorrectDataItem(tHatch.getBaseMetaTileEntity().getStackInSlot(i), state)) + rList.add(tHatch.getBaseMetaTileEntity().getStackInSlot(i)); + } + } + } + return rList; + } + + public boolean addDataAccessToMachineList(IGregTechTileEntity aTileEntity, int aBaseCasingIndex) { + if (aTileEntity == null) return false; + IMetaTileEntity aMetaTileEntity = aTileEntity.getMetaTileEntity(); + if (aMetaTileEntity == null) return false; + if (aMetaTileEntity instanceof GT_MetaTileEntity_Hatch_DataAccess) { + ((GT_MetaTileEntity_Hatch) aMetaTileEntity).updateTexture(aBaseCasingIndex); + return mDataAccessHatches.add((GT_MetaTileEntity_Hatch_DataAccess) aMetaTileEntity); + } + return false; + } + + public int getMaxEfficiency(ItemStack aStack) { + return 10000; + } + + public int getPollutionPerTick(ItemStack aStack) { + return 0; + } + + 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 "Assembly Line"; + } + + @Override + public int getMaxParallelRecipes() { + return 0; + } + + @Override + public int getEuDiscountForParallelism() { + return 0; + } +} diff --git a/src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/processing/advanced/GregtechMetaTileEntity_Adv_DistillationTower.java b/src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/processing/advanced/GregtechMetaTileEntity_Adv_DistillationTower.java index e5387d8c6f..46ba445586 100644 --- a/src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/processing/advanced/GregtechMetaTileEntity_Adv_DistillationTower.java +++ b/src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/processing/advanced/GregtechMetaTileEntity_Adv_DistillationTower.java @@ -1,5 +1,9 @@ package gtPlusPlus.xmod.gregtech.common.tileentities.machines.multi.processing.advanced; +import java.util.ArrayList; + +import cpw.mods.fml.relauncher.Side; +import cpw.mods.fml.relauncher.SideOnly; import gregtech.api.GregTech_API; import gregtech.api.enums.Textures; import gregtech.api.gui.GT_GUIContainer_MultiMachine; @@ -8,13 +12,16 @@ import gregtech.api.interfaces.metatileentity.IMetaTileEntity; import gregtech.api.interfaces.tileentity.IGregTechTileEntity; import gregtech.api.metatileentity.implementations.GT_MetaTileEntity_Hatch_InputBus; import gregtech.api.metatileentity.implementations.GT_MetaTileEntity_Hatch_Output; -import gregtech.api.metatileentity.implementations.GT_MetaTileEntity_MultiBlockBase; +import gregtech.api.metatileentity.implementations.GT_MetaTileEntity_TieredMachineBlock; import gregtech.api.objects.GT_RenderedTexture; import gregtech.api.util.GT_ModHandler; import gregtech.api.util.GT_Recipe; import gregtech.api.util.GT_Utility; -import gtPlusPlus.core.util.Utils; +import gtPlusPlus.api.objects.Logger; +import gtPlusPlus.core.block.ModBlocks; +import gtPlusPlus.core.util.minecraft.ItemUtils; import gtPlusPlus.core.util.minecraft.PlayerUtils; +import gtPlusPlus.xmod.gregtech.api.enums.GregtechItemList; import gtPlusPlus.xmod.gregtech.api.metatileentity.implementations.base.GregtechMeta_MultiBlockBase; import net.minecraft.block.Block; import net.minecraft.entity.player.EntityPlayer; @@ -23,94 +30,86 @@ import net.minecraft.item.ItemStack; import net.minecraft.nbt.NBTTagCompound; import net.minecraftforge.common.util.ForgeDirection; import net.minecraftforge.fluids.FluidStack; -import org.apache.commons.lang3.ArrayUtils; - -import java.util.ArrayList; public class GregtechMetaTileEntity_Adv_DistillationTower extends GregtechMeta_MultiBlockBase { - - private static final int CASING_INDEX = 49; - - private short mControllerY = 0; - - private byte mMode = 0; - - public GregtechMetaTileEntity_Adv_DistillationTower(int aID, String aName, String aNameRegional) { - super(aID, aName, aNameRegional); - } - - public GregtechMetaTileEntity_Adv_DistillationTower(String aName) { - super(aName); - } - - public IMetaTileEntity newMetaEntity(IGregTechTileEntity aTileEntity) { - return new GregtechMetaTileEntity_Adv_DistillationTower(this.mName); - } - - public String[] getTooltip() { + + private short mControllerY = 0; + private byte mMode = 0; + private boolean mUpgraded = false; + + public GregtechMetaTileEntity_Adv_DistillationTower(int aID, String aName, String aNameRegional) { + super(aID, aName, aNameRegional); + } + + public GregtechMetaTileEntity_Adv_DistillationTower(String aName) { + super(aName); + } + + public IMetaTileEntity newMetaEntity(IGregTechTileEntity aTileEntity) { + return new GregtechMetaTileEntity_Adv_DistillationTower(this.mName); + } + + public String[] getTooltip() { String s = "Max parallel dictated by tower tier and mode"; String s1 = "DTower Mode: T1=4, T2=12"; String s2 = "Distilery Mode: Tower Tier * (4*InputTier)"; - return new String[]{ - "Controller Block for the Advanced Distillation Tower", - "T1 constructed identical to standard DT", - "T2 is currently disabled.", - "T2 is not variable height", - "Size(WxHxD): 3x26x3", - "Controller (Front bottom)", - "1x Input Hatch (Any bottom layer casing)", - "24x Output Hatch (One per layer except bottom/top layer)", - "1x Output Bus (Any bottom layer casing)", - "1x Maintenance Hatch (Any casing)", - "1x Energy Hatch (Any casing)", - "Integral Framework I's for the rest", - s, - s1, - s2}; - } - - 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_INDEX], new GT_RenderedTexture(aActive ? Textures.BlockIcons.OVERLAY_FRONT_DISTILLATION_TOWER_ACTIVE : Textures.BlockIcons.OVERLAY_FRONT_DISTILLATION_TOWER)}; - } - return new ITexture[]{Textures.BlockIcons.CASING_BLOCKS[CASING_INDEX]}; - } - - public Object getClientGUI(int aID, InventoryPlayer aPlayerInventory, IGregTechTileEntity aBaseMetaTileEntity) { - return new GT_GUIContainer_MultiMachine(aPlayerInventory, aBaseMetaTileEntity, getLocalName(), "DistillationTower.png"); - } - - public GT_Recipe.GT_Recipe_Map getRecipeMap() { - return mMode == 0 ? GT_Recipe.GT_Recipe_Map.sDistillationRecipes : GT_Recipe.GT_Recipe_Map.sDistilleryRecipes; - } - - 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 new String[]{ + "Controller Block for the Advanced Distillation Tower", + "T1 constructed identical to standard DT", + "Place Distillus Upgrade Chip into Controller GUI to upgrade to T2", + "T2 is not variable height", + "Size(WxHxD): 3x26x3", + "Controller (Front bottom)", + "1x Input Hatch (Any bottom layer casing)", + "24x Output Hatch (One per layer except bottom/top layer)", + "1x Output Bus (Any bottom layer casing)", + "1x Maintenance Hatch (Any casing)", + "1x Energy Hatch (Any casing)", + "Integral Framework I's for the rest", + s, + s1, + s2}; + } + + public Object getClientGUI(int aID, InventoryPlayer aPlayerInventory, IGregTechTileEntity aBaseMetaTileEntity) { + return new GT_GUIContainer_MultiMachine(aPlayerInventory, aBaseMetaTileEntity, getLocalName()+(mUpgraded ? " T2" : ""), "MultiblockDisplay.png"); + } + + public GT_Recipe.GT_Recipe_Map getRecipeMap() { + return mMode == 0 ? GT_Recipe.GT_Recipe_Map.sDistillationRecipes : GT_Recipe.GT_Recipe_Map.sDistilleryRecipes; + } + + 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 this.mMode == 1 ? 12 : 24; - } - + } + @Override public void saveNBTData(NBTTagCompound aNBT) { aNBT.setByte("mMode", mMode); + aNBT.setInteger("mCasingTier", this.mCasingTier); + aNBT.setBoolean("mUpgraded", mUpgraded); super.saveNBTData(aNBT); } @Override public void loadNBTData(NBTTagCompound aNBT) { mMode = aNBT.getByte("mMode"); + mCasingTier = aNBT.getInteger("mCasingTier"); + mUpgraded = aNBT.getBoolean("mUpgraded"); super.loadNBTData(aNBT); - } + } @Override public String getSound() { @@ -134,44 +133,44 @@ public class GregtechMetaTileEntity_Adv_DistillationTower extends GregtechMeta_M } } - public int getDamageToComponent(ItemStack aStack) { - return 0; - } - - public boolean explodesOnComponentBreak(ItemStack aStack) { - return false; - } - - @Override - public boolean addOutput(FluidStack aLiquid) { - if (aLiquid == null) return false; - FluidStack tLiquid = aLiquid.copy(); - for (GT_MetaTileEntity_Hatch_Output tHatch : mOutputHatches) { - if (isValidMetaTileEntity(tHatch) && GT_ModHandler.isSteam(aLiquid) ? tHatch.outputsSteam() : tHatch.outputsLiquids()) { - if (tHatch.getBaseMetaTileEntity().getYCoord() == this.mControllerY + 1) { - int tAmount = tHatch.fill(tLiquid, false); - if (tAmount >= tLiquid.amount) { - return tHatch.fill(tLiquid, true) >= tLiquid.amount; - } else if (tAmount > 0) { - tLiquid.amount = tLiquid.amount - tHatch.fill(tLiquid, true); - } - } - } - } - return false; - } - - @Override - protected void addFluidOutputs(FluidStack[] mOutputFluids2) { - for (int i = 0; i < mOutputFluids2.length; i++) { - if (mOutputHatches.size() > i && mOutputHatches.get(i) != null && mOutputFluids2[i] != null && isValidMetaTileEntity(mOutputHatches.get(i))) { - if (mOutputHatches.get(i).getBaseMetaTileEntity().getYCoord() == this.mControllerY + 1 + i) { - mOutputHatches.get(i).fill(mOutputFluids2[i], true); - } - } - } - - } + public int getDamageToComponent(ItemStack aStack) { + return 0; + } + + public boolean explodesOnComponentBreak(ItemStack aStack) { + return false; + } + + @Override + public boolean addOutput(FluidStack aLiquid) { + if (aLiquid == null) return false; + FluidStack tLiquid = aLiquid.copy(); + for (GT_MetaTileEntity_Hatch_Output tHatch : mOutputHatches) { + if (isValidMetaTileEntity(tHatch) && GT_ModHandler.isSteam(aLiquid) ? tHatch.outputsSteam() : tHatch.outputsLiquids()) { + if (tHatch.getBaseMetaTileEntity().getYCoord() == this.mControllerY + 1) { + int tAmount = tHatch.fill(tLiquid, false); + if (tAmount >= tLiquid.amount) { + return tHatch.fill(tLiquid, true) >= tLiquid.amount; + } else if (tAmount > 0) { + tLiquid.amount = tLiquid.amount - tHatch.fill(tLiquid, true); + } + } + } + } + return false; + } + + @Override + protected void addFluidOutputs(FluidStack[] mOutputFluids2) { + for (int i = 0; i < mOutputFluids2.length; i++) { + if (mOutputHatches.size() > i && mOutputHatches.get(i) != null && mOutputFluids2[i] != null && isValidMetaTileEntity(mOutputHatches.get(i))) { + if (mOutputHatches.get(i).getBaseMetaTileEntity().getYCoord() == this.mControllerY + 1 + i) { + mOutputHatches.get(i).fill(mOutputFluids2[i], true); + } + } + } + + } @Override public boolean hasSlotInGUI() { @@ -192,34 +191,40 @@ public class GregtechMetaTileEntity_Adv_DistillationTower extends GregtechMeta_M public String getMachineType() { return "Distillery, Distillation Tower"; } - + @Override - public boolean checkRecipe(final ItemStack aStack) { - for (GT_MetaTileEntity_Hatch_InputBus tBus : mInputBusses) { - ArrayList<ItemStack> tBusItems = new ArrayList<ItemStack>(); - tBus.mRecipeMap = getRecipeMap(); - if (isValidMetaTileEntity(tBus)) { - for (int i = tBus.getBaseMetaTileEntity().getSizeInventory() - 1; i >= 0; i--) { - if (tBus.getBaseMetaTileEntity().getStackInSlot(i) != null) - tBusItems.add(tBus.getBaseMetaTileEntity().getStackInSlot(i)); - } - } - ItemStack[] inputs = new ItemStack[tBusItems.size()]; - int slot = 0; - for (ItemStack g : tBusItems) { - inputs[slot++] = g; - } - if (inputs.length > 0) { - int para = (4* GT_Utility.getTier(this.getMaxInputVoltage())); - log("Recipe. ["+inputs.length+"]["+para+"]"); - if (checkRecipeGeneric(inputs, new FluidStack[]{}, para, 100, 250, 10000)) { - log("Recipe 2."); - return true; - } - } + public boolean checkRecipe(final ItemStack aStack) { + // Run standard recipe handling for distillery recipes + if (mMode == 1) { + return this.checkRecipeGeneric(getMaxParallelRecipes(), getEuDiscountForParallelism(), 100); + } + else { + for (GT_MetaTileEntity_Hatch_InputBus tBus : mInputBusses) { + ArrayList<ItemStack> tBusItems = new ArrayList<ItemStack>(); + tBus.mRecipeMap = getRecipeMap(); + if (isValidMetaTileEntity(tBus)) { + for (int i = tBus.getBaseMetaTileEntity().getSizeInventory() - 1; i >= 0; i--) { + if (tBus.getBaseMetaTileEntity().getStackInSlot(i) != null) + tBusItems.add(tBus.getBaseMetaTileEntity().getStackInSlot(i)); + } + } + ItemStack[] inputs = new ItemStack[tBusItems.size()]; + int slot = 0; + for (ItemStack g : tBusItems) { + inputs[slot++] = g; + } + if (inputs.length > 0) { + int para = (4* GT_Utility.getTier(this.getMaxInputVoltage())); + log("Recipe. ["+inputs.length+"]["+para+"]"); + if (checkRecipeGeneric(inputs, new FluidStack[]{}, para, 100, 250, 10000)) { + log("Recipe 2."); + return true; + } + } + } + return false; } - return false; } @Override @@ -251,28 +256,28 @@ public class GregtechMetaTileEntity_Adv_DistillationTower extends GregtechMeta_M } return false; } - + private int getTierOfTower() { - return 1; + return mUpgraded ? 2 : 1; } - + private boolean checkTierOneTower(IGregTechTileEntity aBaseMetaTileEntity, ItemStack aStack) { - mControllerY = aBaseMetaTileEntity.getYCoord(); - int xDir = ForgeDirection.getOrientation(aBaseMetaTileEntity.getBackFacing()).offsetX; - int zDir = ForgeDirection.getOrientation(aBaseMetaTileEntity.getBackFacing()).offsetZ; - int y = 0; //height - int casingAmount = 0; - boolean reachedTop = false; - - for (int x = xDir - 1; x <= xDir + 1; x++) { //x=width + mControllerY = aBaseMetaTileEntity.getYCoord(); + int xDir = ForgeDirection.getOrientation(aBaseMetaTileEntity.getBackFacing()).offsetX; + int zDir = ForgeDirection.getOrientation(aBaseMetaTileEntity.getBackFacing()).offsetZ; + int y = 0; //height + int casingAmount = 0; + boolean reachedTop = false; + + for (int x = xDir - 1; x <= xDir + 1; x++) { //x=width for (int z = zDir - 1; z <= zDir + 1; z++) { //z=depth if (x != 0 || z != 0) { IGregTechTileEntity tileEntity = aBaseMetaTileEntity.getIGregTechTileEntityOffset(x, y, z); Block block = aBaseMetaTileEntity.getBlockOffset(x, y, z); - if (!addInputToMachineList(tileEntity, CASING_INDEX) - && !addOutputToMachineList(tileEntity, CASING_INDEX) - && !addMaintenanceToMachineList(tileEntity, CASING_INDEX) - && !addEnergyInputToMachineList(tileEntity, CASING_INDEX)) { + if (!addInputToMachineList(tileEntity, getCasingTextureID()) + && !addOutputToMachineList(tileEntity, getCasingTextureID()) + && !addMaintenanceToMachineList(tileEntity, getCasingTextureID()) + && !addEnergyInputToMachineList(tileEntity, getCasingTextureID())) { if (block == GregTech_API.sBlockCasings4 && aBaseMetaTileEntity.getMetaIDOffset(x, y, z) == 1) { casingAmount++; } else { @@ -282,55 +287,55 @@ public class GregtechMetaTileEntity_Adv_DistillationTower extends GregtechMeta_M } } } - y++; - - while (y < 12 && !reachedTop) { - for (int x = xDir - 1; x <= xDir + 1; x++) { //x=width - for (int z = zDir - 1; z <= zDir + 1; z++) { //z=depth - IGregTechTileEntity tileEntity = aBaseMetaTileEntity.getIGregTechTileEntityOffset(x, y, z); - Block block = aBaseMetaTileEntity.getBlockOffset(x, y, z); - if (aBaseMetaTileEntity.getAirOffset(x, y, z)) { - if (x != xDir || z != zDir) { - return false; - } - } else { - if (x == xDir && z == zDir) { - reachedTop = true; - } - if (!addOutputToMachineList(tileEntity, CASING_INDEX) - && !addMaintenanceToMachineList(tileEntity, CASING_INDEX) - && !addEnergyInputToMachineList(tileEntity, CASING_INDEX)) { - if (block == GregTech_API.sBlockCasings4 && aBaseMetaTileEntity.getMetaIDOffset(x, y, z) == 1) { - casingAmount++; - } else { - return false; - } - } - } - } - } - y++; - } - return casingAmount >= 7 * y - 5 && y >= 3 && y <= 12 && reachedTop; - } - + y++; + + while (y < 12 && !reachedTop) { + for (int x = xDir - 1; x <= xDir + 1; x++) { //x=width + for (int z = zDir - 1; z <= zDir + 1; z++) { //z=depth + IGregTechTileEntity tileEntity = aBaseMetaTileEntity.getIGregTechTileEntityOffset(x, y, z); + Block block = aBaseMetaTileEntity.getBlockOffset(x, y, z); + if (aBaseMetaTileEntity.getAirOffset(x, y, z)) { + if (x != xDir || z != zDir) { + return false; + } + } else { + if (x == xDir && z == zDir) { + reachedTop = true; + } + if (!addOutputToMachineList(tileEntity, getCasingTextureID()) + && !addMaintenanceToMachineList(tileEntity, getCasingTextureID()) + && !addEnergyInputToMachineList(tileEntity, getCasingTextureID())) { + if (block == GregTech_API.sBlockCasings4 && aBaseMetaTileEntity.getMetaIDOffset(x, y, z) == 1) { + casingAmount++; + } else { + return false; + } + } + } + } + } + y++; + } + return casingAmount >= 7 * y - 5 && y >= 3 && y <= 12 && reachedTop; + } + private boolean checkTierTwoTower(IGregTechTileEntity aBaseMetaTileEntity, ItemStack aStack) { - mControllerY = aBaseMetaTileEntity.getYCoord(); - int xDir = ForgeDirection.getOrientation(aBaseMetaTileEntity.getBackFacing()).offsetX; - int zDir = ForgeDirection.getOrientation(aBaseMetaTileEntity.getBackFacing()).offsetZ; - int y = 0; //height - int casingAmount = 0; - boolean reachedTop = false; - - for (int x = xDir - 1; x <= xDir + 1; x++) { //x=width + mControllerY = aBaseMetaTileEntity.getYCoord(); + int xDir = ForgeDirection.getOrientation(aBaseMetaTileEntity.getBackFacing()).offsetX; + int zDir = ForgeDirection.getOrientation(aBaseMetaTileEntity.getBackFacing()).offsetZ; + int y = 0; //height + int casingAmount = 0; + boolean reachedTop = false; + + for (int x = xDir - 1; x <= xDir + 1; x++) { //x=width for (int z = zDir - 1; z <= zDir + 1; z++) { //z=depth if (x != 0 || z != 0) { IGregTechTileEntity tileEntity = aBaseMetaTileEntity.getIGregTechTileEntityOffset(x, y, z); Block block = aBaseMetaTileEntity.getBlockOffset(x, y, z); - if (!addInputToMachineList(tileEntity, CASING_INDEX) - && !addOutputToMachineList(tileEntity, CASING_INDEX) - && !addMaintenanceToMachineList(tileEntity, CASING_INDEX) - && !addEnergyInputToMachineList(tileEntity, CASING_INDEX)) { + if (!addInputToMachineList(tileEntity, getCasingTextureID()) + && !addOutputToMachineList(tileEntity, getCasingTextureID()) + && !addMaintenanceToMachineList(tileEntity, getCasingTextureID()) + && !addEnergyInputToMachineList(tileEntity, getCasingTextureID())) { if (block == GregTech_API.sBlockCasings4 && aBaseMetaTileEntity.getMetaIDOffset(x, y, z) == 1) { casingAmount++; } else { @@ -340,36 +345,165 @@ public class GregtechMetaTileEntity_Adv_DistillationTower extends GregtechMeta_M } } } - y++; - - while (y < 12 && !reachedTop) { - for (int x = xDir - 1; x <= xDir + 1; x++) { //x=width - for (int z = zDir - 1; z <= zDir + 1; z++) { //z=depth - IGregTechTileEntity tileEntity = aBaseMetaTileEntity.getIGregTechTileEntityOffset(x, y, z); - Block block = aBaseMetaTileEntity.getBlockOffset(x, y, z); - if (aBaseMetaTileEntity.getAirOffset(x, y, z)) { - if (x != xDir || z != zDir) { - return false; - } - } else { - if (x == xDir && z == zDir) { - reachedTop = true; - } - if (!addOutputToMachineList(tileEntity, CASING_INDEX) - && !addMaintenanceToMachineList(tileEntity, CASING_INDEX) - && !addEnergyInputToMachineList(tileEntity, CASING_INDEX)) { - if (block == GregTech_API.sBlockCasings4 && aBaseMetaTileEntity.getMetaIDOffset(x, y, z) == 1) { - casingAmount++; - } else { - return false; - } - } - } - } - } - y++; - } - return casingAmount >= 7 * y - 5 && y >= 3 && y <= 12 && reachedTop; - } - + y++; + + while (y < 12 && !reachedTop) { + for (int x = xDir - 1; x <= xDir + 1; x++) { //x=width + for (int z = zDir - 1; z <= zDir + 1; z++) { //z=depth + IGregTechTileEntity tileEntity = aBaseMetaTileEntity.getIGregTechTileEntityOffset(x, y, z); + Block block = aBaseMetaTileEntity.getBlockOffset(x, y, z); + if (aBaseMetaTileEntity.getAirOffset(x, y, z)) { + if (x != xDir || z != zDir) { + return false; + } + } else { + if (x == xDir && z == zDir) { + reachedTop = true; + } + if (!addOutputToMachineList(tileEntity, getCasingTextureID()) + && !addMaintenanceToMachineList(tileEntity, getCasingTextureID()) + && !addEnergyInputToMachineList(tileEntity, getCasingTextureID())) { + if (block == GregTech_API.sBlockCasings4 && aBaseMetaTileEntity.getMetaIDOffset(x, y, z) == 1) { + casingAmount++; + } else { + return false; + } + } + } + } + } + y++; + } + return casingAmount >= 7 * y - 5 && y >= 3 && y <= 12 && reachedTop; + } + + + private int mCasingTier = 0; + + private int getMachineCasingTier() { + return mCasingTier; + } + + @Override + public ITexture[] getTexture(final IGregTechTileEntity aBaseMetaTileEntity, final byte aSide, final byte aFacing, final byte aColorIndex, final boolean aActive, final boolean aRedstone) { + + ITexture aOriginalTexture; + + // Check things exist client side (The worst code ever) + if (aBaseMetaTileEntity.getWorld() != null) { + + } + // Check the Tier Client Side + int aTier = mCasingTier; + + if (aTier == 0) { + aOriginalTexture = Textures.BlockIcons.CASING_BLOCKS[49]; + } + else if (aTier == 1) { + aOriginalTexture = Textures.BlockIcons.CASING_BLOCKS[43]; + } + else { + aOriginalTexture = Textures.BlockIcons.CASING_BLOCKS[49]; + } + + if (aSide == aFacing) { + return new ITexture[]{aOriginalTexture, new GT_RenderedTexture(aActive ? Textures.BlockIcons.OVERLAY_FRONT_DISTILLATION_TOWER_ACTIVE : Textures.BlockIcons.OVERLAY_FRONT_DISTILLATION_TOWER)}; + } + return new ITexture[]{aOriginalTexture}; + } + + private int getCasingTextureID() { + // Check the Tier Client Side + int aTier = mCasingTier; + + if (aTier == 1) { + return 49; + } + else if (aTier == 2) { + return 43; + } + else { + return 49; + } + } + + public boolean addToMachineList(IGregTechTileEntity aTileEntity) { + int aMaxTier = getMachineCasingTier(); + final IMetaTileEntity aMetaTileEntity = aTileEntity.getMetaTileEntity(); + if (aMetaTileEntity instanceof GT_MetaTileEntity_TieredMachineBlock) { + GT_MetaTileEntity_TieredMachineBlock aMachineBlock = (GT_MetaTileEntity_TieredMachineBlock) aMetaTileEntity; + int aTileTier = aMachineBlock.mTier; + if (aTileTier > aMaxTier) { + Logger.INFO("Hatch tier too high."); + return false; + } + else { + return addToMachineList(aTileEntity, getCasingTextureID()); + } + } + else { + Logger.INFO("Bad Tile Entity being added to hatch map."); // Shouldn't ever happen, but.. ya know.. + return false; + } + } + + @Override + public void onPostTick(IGregTechTileEntity aBaseMetaTileEntity, long aTick) { + super.onPostTick(aBaseMetaTileEntity, aTick); + if (aTick % 20 == 0 && !mUpgraded) { + ItemStack aGuiStack = this.getGUIItemStack(); + if (aGuiStack != null) { + if (GT_Utility.areStacksEqual(aGuiStack, GregtechItemList.Distillus_Upgrade_Chip.get(1))) { + this.mUpgraded = true; + ItemUtils.depleteStack(aGuiStack); + } + } + } + // Silly Client Syncing + if (aBaseMetaTileEntity.isClientSide()) { + this.mCasingTier = getCasingTierOnClientSide(); + } + } + + + + @SideOnly(Side.CLIENT) + private final int getCasingTierOnClientSide() { + if (this == null || this.getBaseMetaTileEntity().getWorld() == null) { + return 0; + } + try { + Block aInitStructureCheck; + int aInitStructureCheckMeta; + IGregTechTileEntity aBaseMetaTileEntity = this.getBaseMetaTileEntity(); + if (aBaseMetaTileEntity == null || aBaseMetaTileEntity.getWorld() == null || aBaseMetaTileEntity.getWorld().getChunkFromBlockCoords(aBaseMetaTileEntity.getXCoord(), aBaseMetaTileEntity.getZCoord()) == null) { + return 0; + } + for (int i=1;i<10;i++) { + aInitStructureCheck = aBaseMetaTileEntity.getBlockOffset(0, i, 0); + aInitStructureCheckMeta = aBaseMetaTileEntity.getMetaIDOffset(0, i, 0); + if (aInitStructureCheck == null) { + continue; + } + if (aInitStructureCheck == GregTech_API.sBlockCasings4 && aInitStructureCheckMeta == 1) { + return 0; + } + else if (aInitStructureCheck == ModBlocks.blockCasingsTieredGTPP) { + return 1; + } + } + } + catch (Throwable t) { + //t.printStackTrace(); + } + return 0; + + } + + @Override + public void setItemNBT(NBTTagCompound aNBT) { + aNBT.setBoolean("mUpgraded", mUpgraded); + super.setItemNBT(aNBT); + } + }
\ No newline at end of file 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 b8e6d0c252..01243343b4 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 @@ -154,11 +154,11 @@ public class GT4Entity_AutoCrafter extends GregtechMeta_MultiBlockBase { public ITexture[] getTexture(final IGregTechTileEntity aBaseMetaTileEntity, final byte aSide, final byte aFacing, final byte aColorIndex, final boolean aActive, final boolean aRedstone) { if (aSide == aFacing) { - return new ITexture[] { Textures.BlockIcons.CASING_BLOCKS[TAE.GTPP_INDEX(28)], + return new ITexture[] { Textures.BlockIcons.CASING_BLOCKS[TAE.getIndexFromPage(0, 10)], new GT_RenderedTexture(aActive ? Textures.BlockIcons.OVERLAY_FRONT_DISASSEMBLER_ACTIVE : Textures.BlockIcons.OVERLAY_FRONT_DISASSEMBLER) }; } - return new ITexture[] { Textures.BlockIcons.CASING_BLOCKS[TAE.GTPP_INDEX(28)] }; + return new ITexture[] { Textures.BlockIcons.CASING_BLOCKS[TAE.getIndexFromPage(0, 10)] }; } @Override @@ -179,7 +179,7 @@ public class GT4Entity_AutoCrafter extends GregtechMeta_MultiBlockBase { Block aBlock = aBaseMetaTileEntity.getBlockOffset(xDir + i, h, zDir + j); int aMeta = aBaseMetaTileEntity.getMetaIDOffset(xDir + i, h, zDir + j); - if (!isValidBlockForStructure(tTileEntity, TAE.GTPP_INDEX(28), true, aBlock, aMeta, + if (!isValidBlockForStructure(tTileEntity, TAE.getIndexFromPage(0, 10), true, aBlock, aMeta, ModBlocks.blockCasings2Misc, 12)) { Logger.INFO("Bad Autcrafter casing"); return false; diff --git a/src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/production/GT4Entity_ThermalBoiler.java b/src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/production/GT4Entity_ThermalBoiler.java index 6e7039f8ca..45077f4cf7 100644 --- a/src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/production/GT4Entity_ThermalBoiler.java +++ b/src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/production/GT4Entity_ThermalBoiler.java @@ -251,7 +251,7 @@ extends GregtechMeta_MultiBlockBase Block aBlock = aBaseMetaTileEntity.getBlockOffset(xDir + i, h, zDir + j); int aMeta = aBaseMetaTileEntity.getMetaIDOffset(xDir + i, h, zDir + j); - if (!isValidBlockForStructure(tTileEntity, 1, true, aBlock, aMeta, + if (!isValidBlockForStructure(tTileEntity, TAE.getIndexFromPage(0, 1), true, aBlock, aMeta, ModBlocks.blockCasings2Misc, 11)) { log("Bad Thermal Boiler casing"); return false; diff --git a/src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/production/GregtechMTE_MiniFusionPlant.java b/src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/production/GregtechMTE_MiniFusionPlant.java index cb8b7590ee..579a26dc16 100644 --- a/src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/production/GregtechMTE_MiniFusionPlant.java +++ b/src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/production/GregtechMTE_MiniFusionPlant.java @@ -87,18 +87,18 @@ public class GregtechMTE_MiniFusionPlant extends GregtechMeta_MultiBlockBase { public ITexture[] getTexture(final IGregTechTileEntity aBaseMetaTileEntity, final byte aSide, final byte aFacing, final byte aColorIndex, final boolean aActive, final boolean aRedstone) { if (aSide == this.getBaseMetaTileEntity().getBackFacing()) { - return new ITexture[]{Textures.BlockIcons.CASING_BLOCKS[TAE.GTPP_INDEX(28)], + return new ITexture[]{Textures.BlockIcons.CASING_BLOCKS[TAE.GTPP_INDEX(10)], Textures.BlockIcons.OVERLAYS_ENERGY_IN_MULTI[(int) this.getInputTier()]}; } if (aSide == 1) { - return new ITexture[]{Textures.BlockIcons.CASING_BLOCKS[TAE.GTPP_INDEX(28)], + return new ITexture[]{Textures.BlockIcons.CASING_BLOCKS[TAE.GTPP_INDEX(10)], Textures.BlockIcons.OVERLAYS_ENERGY_OUT_MULTI[(int) this.getOutputTier()]}; } if (aSide == aFacing) { - return new ITexture[]{Textures.BlockIcons.CASING_BLOCKS[TAE.GTPP_INDEX(28)], + return new ITexture[]{Textures.BlockIcons.CASING_BLOCKS[TAE.GTPP_INDEX(10)], new GT_RenderedTexture(aActive ? Textures.BlockIcons.OVERLAY_FRONT_DISASSEMBLER_ACTIVE : Textures.BlockIcons.OVERLAY_FRONT_DISASSEMBLER)}; } - return new ITexture[]{Textures.BlockIcons.CASING_BLOCKS[TAE.GTPP_INDEX(28)]}; + return new ITexture[]{Textures.BlockIcons.CASING_BLOCKS[TAE.GTPP_INDEX(10)]}; } @@ -166,7 +166,7 @@ public class GregtechMTE_MiniFusionPlant extends GregtechMeta_MultiBlockBase { if (h != 0 || (xDir + i != 0 || zDir + j != 0) && (i != 0 || j != 0)) { IGregTechTileEntity tTileEntity = aBaseMetaTileEntity.getIGregTechTileEntityOffset(xDir + i, h, zDir + j); - if (this.addToMachineList(tTileEntity, TAE.GTPP_INDEX(28))) { + if (this.addToMachineList(tTileEntity, TAE.GTPP_INDEX(10))) { tAmount++; } } diff --git a/src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/production/GregtechMetaTileEntity_Cyclotron.java b/src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/production/GregtechMetaTileEntity_Cyclotron.java index 6070e3604a..f7cf3839fb 100644 --- a/src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/production/GregtechMetaTileEntity_Cyclotron.java +++ b/src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/production/GregtechMetaTileEntity_Cyclotron.java @@ -210,7 +210,7 @@ public class GregtechMetaTileEntity_Cyclotron extends GregtechMeta_MultiBlockBas final int aMeta = getBaseMetaTileEntity().getMetaID(aX, aY, aZ); final IGregTechTileEntity tTileEntity2 = getBaseMetaTileEntity().getIGregTechTileEntity(aX, aY, aZ); - boolean debug = isValidBlockForStructure(tTileEntity2, TAE.GTPP_INDEX(26), true, aBlock, aMeta, getCasing(), getCasingMeta()); + boolean debug = isValidBlockForStructure(tTileEntity2, 44, true, aBlock, aMeta, getCasing(), getCasingMeta()); /*if (!debug) { this.getBaseMetaTileEntity().getWorld().setBlock(aX, aY, aZ, ModBlocks.blockCompressedObsidian); @@ -275,12 +275,12 @@ public class GregtechMetaTileEntity_Cyclotron extends GregtechMeta_MultiBlockBas public ITexture[] getTexture(IGregTechTileEntity aBaseMetaTileEntity, byte aSide, byte aFacing, byte aColorIndex, boolean aActive, boolean aRedstone) { ITexture[] sTexture; if (aSide == aFacing) { - sTexture = new ITexture[]{new GT_RenderedTexture(Textures.BlockIcons.MACHINE_CASING_RADIATIONPROOF, Dyes.getModulation(-1, Dyes._NULL.mRGBa)), new GT_RenderedTexture(getIconOverlay())}; + sTexture = new ITexture[]{Textures.BlockIcons.CASING_BLOCKS[44], new GT_RenderedTexture(getIconOverlay())}; } else { if (!aActive) { - sTexture = new ITexture[]{new GT_RenderedTexture(Textures.BlockIcons.MACHINE_CASING_RADIATIONPROOF, Dyes.getModulation(-1, Dyes._NULL.mRGBa))}; + sTexture = new ITexture[]{Textures.BlockIcons.CASING_BLOCKS[44]}; } else { - sTexture = new ITexture[]{new GT_RenderedTexture(Textures.BlockIcons.MACHINE_CASING_RADIATIONPROOF, Dyes.getModulation(-1, Dyes._NULL.mRGBa))}; + sTexture = new ITexture[]{Textures.BlockIcons.CASING_BLOCKS[44]}; } } return sTexture; @@ -467,22 +467,22 @@ public class GregtechMetaTileEntity_Cyclotron extends GregtechMeta_MultiBlockBas public boolean turnCasingActive(final boolean status) { if (this.mEnergyHatches != null) { for (final GT_MetaTileEntity_Hatch_Muffler hatch : this.mMufflerHatches) { - hatch.mMachineBlock = status ? (byte) TAE.GTPP_INDEX(26) : (byte) TAE.GTPP_INDEX(26); + hatch.mMachineBlock = status ? (byte) 44 : (byte) 44; } } if (this.mOutputHatches != null) { for (final GT_MetaTileEntity_Hatch_Output hatch : this.mOutputHatches) { - hatch.mMachineBlock = status ? (byte) TAE.GTPP_INDEX(26) : (byte) TAE.GTPP_INDEX(26); + hatch.mMachineBlock = status ? (byte) 44 : (byte) 44; } } if (this.mInputHatches != null) { for (final GT_MetaTileEntity_Hatch_Input hatch : this.mInputHatches) { - hatch.mMachineBlock = status ? (byte) TAE.GTPP_INDEX(26) : (byte) TAE.GTPP_INDEX(26); + hatch.mMachineBlock = status ? (byte) 44 : (byte) 44; } } if (this.mMaintenanceHatches != null) { for (final GT_MetaTileEntity_Hatch_Maintenance hatch : this.mMaintenanceHatches) { - hatch.mMachineBlock = status ? (byte) TAE.GTPP_INDEX(26) : (byte) TAE.GTPP_INDEX(26); + hatch.mMachineBlock = status ? (byte) 44 : (byte) 44; } } return true; diff --git a/src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/production/GregtechMetaTileEntity_LargeSemifluidGenerator.java b/src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/production/GregtechMetaTileEntity_LargeSemifluidGenerator.java new file mode 100644 index 0000000000..2425e86c30 --- /dev/null +++ b/src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/production/GregtechMetaTileEntity_LargeSemifluidGenerator.java @@ -0,0 +1,317 @@ +package gtPlusPlus.xmod.gregtech.common.tileentities.machines.multi.production; + +import java.util.ArrayList; +import java.util.Collection; + +import gregtech.api.GregTech_API; +import gregtech.api.enums.Materials; +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.metatileentity.implementations.GT_MetaTileEntity_Hatch_Dynamo; +import gregtech.api.objects.GT_RenderedTexture; +import gregtech.api.util.GT_Recipe; +import gregtech.api.util.GT_Utility; +import gregtech.api.util.Recipe_GT.Gregtech_Recipe_Map; +import gtPlusPlus.xmod.gregtech.api.metatileentity.implementations.base.GregtechMeta_MultiBlockBase; +import net.minecraft.block.Block; +import net.minecraft.entity.player.InventoryPlayer; +import net.minecraft.item.ItemStack; +import net.minecraft.nbt.NBTTagCompound; +import net.minecraftforge.fluids.FluidStack; + +public class GregtechMetaTileEntity_LargeSemifluidGenerator extends GregtechMeta_MultiBlockBase { + + protected int fuelConsumption = 0; + protected int fuelValue = 0; + protected int fuelRemaining = 0; + protected boolean boostEu = false; + + public GregtechMetaTileEntity_LargeSemifluidGenerator(int aID, String aName, String aNameRegional) { + super(aID, aName, aNameRegional); + } + + public GregtechMetaTileEntity_LargeSemifluidGenerator(String aName) { + super(aName); + } + + public String[] getTooltip() { + return new String[]{ + "Controller Block for the Large Semifluid Generator", + "Engine Intake Casings must not be obstructed in front (only air blocks)", + "Supply Semifluid Fuels and 2000L of Lubricant per hour to run.", + "Supply 80L of Oxygen per second to boost output (optional).", + "Default: Produces 2048EU/t at 100% efficiency", + "Boosted: Produces 6144EU/t at 150% efficiency", + "Size(WxHxD): 3x3x4, Controller (front centered)", + "3x3x4 of Stable Titanium Machine Casing (hollow, Min 16!)", + "All hatches except dynamo can replace any Stable Titanium casing in middle two segments", + "2x Steel Gear Box Machine Casing inside the Hollow Casing", + "8x Engine Intake Machine Casing (around controller)", + "2x Input Hatch (Fuel/Lubricant)", + "1x Maintenance Hatch", + "1x Muffler Hatch", + "1x Dynamo Hatch (back centered)", + }; + } + + 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[50], new GT_RenderedTexture(aActive ? Textures.BlockIcons.OVERLAY_FRONT_DIESEL_ENGINE_ACTIVE : Textures.BlockIcons.OVERLAY_FRONT_DIESEL_ENGINE)}; + } + return new ITexture[]{Textures.BlockIcons.CASING_BLOCKS[50]}; + } + + @Override + public boolean isCorrectMachinePart(ItemStack aStack) { + return getMaxEfficiency(aStack) > 0; + } + + public Object getClientGUI(int aID, InventoryPlayer aPlayerInventory, IGregTechTileEntity aBaseMetaTileEntity) { + return new GT_GUIContainer_MultiMachine(aPlayerInventory, aBaseMetaTileEntity, getLocalName(), "LargeDieselEngine.png"); + } + + @Override + public boolean checkRecipe(ItemStack aStack) { + ArrayList<FluidStack> tFluids = getStoredFluids(); + Collection<GT_Recipe> tRecipeList = Gregtech_Recipe_Map.sSemiFluidLiquidFuels.mRecipeList; + + if(tFluids.size() > 0 && tRecipeList != null) { //Does input hatch have a semifluid fuel? + for (FluidStack hatchFluid1 : tFluids) { //Loops through hatches + for(GT_Recipe aFuel : tRecipeList) { //Loops through semifluid fuel recipes + FluidStack tLiquid; + if ((tLiquid = GT_Utility.getFluidForFilledItem(aFuel.getRepresentativeInput(0), true)) != null) { //Create fluidstack from current recipe + if (hatchFluid1.isFluidEqual(tLiquid)) { //Has a semifluid fluid + fuelConsumption = tLiquid.amount = boostEu ? (4096 / aFuel.mSpecialValue) : (2048 / aFuel.mSpecialValue); //Calc fuel consumption + if(depleteInput(tLiquid)) { //Deplete that amount + boostEu = depleteInput(Materials.Oxygen.getGas(4L)); + if(tFluids.contains(Materials.Lubricant.getFluid(2L))) { //Has lubricant? + //Deplete Lubricant. 2000L should = 1 hour of runtime (if baseEU = 2048) + if(mRuntime % 72 == 0 || mRuntime == 0) { + depleteInput(Materials.Lubricant.getFluid(boostEu ? 2 : 1)); + } + } + else { + return false; + } + + fuelValue = aFuel.mSpecialValue; + fuelRemaining = hatchFluid1.amount; //Record available fuel + this.mEUt = mEfficiency < 2000 ? 0 : 2048; //Output 0 if startup is less than 20% + this.mProgresstime = 1; + this.mMaxProgresstime = 1; + this.mEfficiencyIncrease = 15; + return true; + } + } + } + } + } + } + this.mEUt = 0; + this.mEfficiency = 0; + return false; + } + + @Override + public boolean checkMultiblock(IGregTechTileEntity aBaseMetaTileEntity, ItemStack aStack) { + byte tSide = aBaseMetaTileEntity.getBackFacing(); + int aTileX = aBaseMetaTileEntity.getXCoord(); + int aTileY = aBaseMetaTileEntity.getYCoord(); + int aTileZ = aBaseMetaTileEntity.getZCoord(); + boolean xFacing = (tSide == 4 || tSide == 5); + boolean zFacing = (tSide == 2 || tSide == 3); + int aCasingCount = 0; + // Check Intake Hatches + for (int aHorizontalOffset = -1; aHorizontalOffset < 2; aHorizontalOffset++) { + for (int aVerticalOffset = -1; aVerticalOffset < 2; aVerticalOffset++) { + if (aHorizontalOffset == 0 && aVerticalOffset == 0) { + continue; + } + int aX = !xFacing ? (aTileX + aHorizontalOffset) : aTileX; + int aY = aTileY + aVerticalOffset; + int aZ = !zFacing ? (aTileZ + aHorizontalOffset) : aTileZ; + Block aIntakeBlock = aBaseMetaTileEntity.getBlock(aX, aY, aZ); + int aIntakeMeta = aBaseMetaTileEntity.getMetaID(aX, aY, aZ); + if (!isValidBlockForStructure(null, 0, false, aIntakeBlock, aIntakeMeta, getIntakeBlock(), getIntakeMeta())) { + return false; // Not intake casing surrounding controller + } + } + } + // Check Casings + int aStartDepthOffset = (tSide == 2 || tSide == 4) ? -1 : 1; + int aFinishDepthOffset = (tSide == 2 || tSide == 4) ? -4 : 4; + for (int aDepthOffset = aStartDepthOffset; aDepthOffset != aFinishDepthOffset;) { + for (int aHorizontalOffset = -1; aHorizontalOffset < 2; aHorizontalOffset++) { + for (int aVerticalOffset = -1; aVerticalOffset < 2; aVerticalOffset++) { + if (aHorizontalOffset == 0 && aVerticalOffset == 0) { + continue; + } + int aX = !xFacing ? (aTileX + aHorizontalOffset) : (aTileX + aDepthOffset); + int aY = aTileY + aVerticalOffset; + int aZ = !zFacing ? (aTileZ + aHorizontalOffset) : (aTileZ + aDepthOffset); + Block aCasingBlock = aBaseMetaTileEntity.getBlock(aX, aY, aZ); + int aCasingMeta = aBaseMetaTileEntity.getMetaID(aX, aY, aZ); + IGregTechTileEntity aTileEntity = getBaseMetaTileEntity().getIGregTechTileEntity(aX, aY, aZ); + // Side areas + if (aDepthOffset < 3) { + if (!isValidBlockForStructure(aTileEntity, getCasingTextureIndex(), true, aCasingBlock, aCasingMeta, getCasingBlock(), getCasingMeta())) { + return false; // Not valid casing + } + else { + if (aTileEntity == null) { + aCasingCount++; + } + } + } + else { + if (!isValidBlockForStructure(null, 0, false, aCasingBlock, aCasingMeta, getCasingBlock(), getCasingMeta())) { + return false; // Not valid casing + } + else { + aCasingCount++; + } + } + } + } + // Count Backwards for 2 axis + if (aStartDepthOffset == -1) { + aDepthOffset--; + } + // Count Forwards for 2 axis + else { + aDepthOffset++; + } + } + + // Check Gear Boxes + if(aBaseMetaTileEntity.getBlockAtSideAndDistance(tSide, 1) != getGearboxBlock() && aBaseMetaTileEntity.getBlockAtSideAndDistance(tSide, 2) != getGearboxBlock()) { + return false; + } + if(aBaseMetaTileEntity.getMetaIDAtSideAndDistance(tSide, 1) != getGearboxMeta() && aBaseMetaTileEntity.getMetaIDAtSideAndDistance(tSide, 2) != getGearboxMeta()) { + return false; + } + + // Check Dynamo + this.mDynamoHatches.clear(); + IGregTechTileEntity tTileEntity = getBaseMetaTileEntity().getIGregTechTileEntityAtSideAndDistance(getBaseMetaTileEntity().getBackFacing(), 3); + if ((tTileEntity != null) && (tTileEntity.getMetaTileEntity() != null)) { + if ((tTileEntity.getMetaTileEntity() instanceof GT_MetaTileEntity_Hatch_Dynamo)) { + this.addDynamoToMachineList(tTileEntity, getCasingTextureIndex()); + } else { + return false; + } + } + return aCasingCount >= 16; + } + + public Block getCasingBlock() { + return GregTech_API.sBlockCasings4; + } + + public byte getCasingMeta() { + return 2; + } + + public Block getIntakeBlock() { + return GregTech_API.sBlockCasings4; + } + + public byte getIntakeMeta() { + return 13; + } + + public Block getGearboxBlock() { + return GregTech_API.sBlockCasings2; + } + + public byte getGearboxMeta() { + return 3; + } + + public byte getCasingTextureIndex() { + return 50; + } + + private boolean addToMachineList(IGregTechTileEntity tTileEntity) { + return ((addMaintenanceToMachineList(tTileEntity, getCasingTextureIndex())) || (addInputToMachineList(tTileEntity, getCasingTextureIndex())) || (addOutputToMachineList(tTileEntity, getCasingTextureIndex())) || (addMufflerToMachineList(tTileEntity, getCasingTextureIndex()))); + } + + @Override + public IMetaTileEntity newMetaEntity(IGregTechTileEntity aTileEntity) { + return new GregtechMetaTileEntity_LargeSemifluidGenerator(this.mName); + } + + @Override + public void saveNBTData(NBTTagCompound aNBT) { + super.saveNBTData(aNBT); + } + + @Override + public void loadNBTData(NBTTagCompound aNBT) { + super.loadNBTData(aNBT); + } + + @Override + public int getDamageToComponent(ItemStack aStack) { + return 1; + } + + public int getMaxEfficiency(ItemStack aStack) { + return boostEu ? 20000 : 10000; + } + + @Override + public int getPollutionPerTick(ItemStack aStack) { + return 64; + } + + @Override + public boolean explodesOnComponentBreak(ItemStack aStack) { + return true; + } + + @Override + public String[] getExtraInfoData() { + return new String[]{ + "Large Semifluid Generator", + "Current Output: " + mEUt * mEfficiency / 10000 + " EU/t", + "Fuel Consumption: " + fuelConsumption + "L/t", + "Fuel Value: " + fuelValue + " EU/L", + "Fuel Remaining: " + fuelRemaining + " Litres", + "Current Efficiency: " + (mEfficiency / 100) + "%", + getIdealStatus() == getRepairStatus() ? "No Maintainance issues" : "Needs Maintainance"}; + } + + @Override + public boolean isGivingInformation() { + return true; + } + + @Override + public boolean hasSlotInGUI() { + return false; + } + + @Override + public String getCustomGUIResourceName() { + return null; + } + + @Override + public String getMachineType() { + return "Semifluid Generator"; + } + + @Override + public int getMaxParallelRecipes() { + return 0; + } + + @Override + public int getEuDiscountForParallelism() { + return 0; + } +} diff --git a/src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/production/GregtechMetaTileEntity_Refinery.java b/src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/production/GregtechMetaTileEntity_Refinery.java index 24db72fbe0..4a508f2f0f 100644 --- a/src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/production/GregtechMetaTileEntity_Refinery.java +++ b/src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/production/GregtechMetaTileEntity_Refinery.java @@ -72,7 +72,7 @@ public class GregtechMetaTileEntity_Refinery extends GregtechMeta_MultiBlockBase return "MatterFabricator"; } - private static final GT_Recipe_Map mGregTypeRecipeMap = new GT_Recipe_Map(new HashSet<GT_Recipe>(), "internal.recipe.fissionfuel", "Fission Fuel Processing", null, RES_PATH_GUI + "basicmachines/FissionFuel", 0, 0, 0, 4, 1, E, 1, E, true, true); + private static final GT_Recipe_Map mGregTypeRecipeMap = new GT_Recipe_Map(new HashSet<GT_Recipe>(), "internal.recipe.fissionfuel", "Nuclear Fuel Processing", null, RES_PATH_GUI + "basicmachines/FissionFuel", 0, 0, 0, 4, 1, E, 1, E, true, false); @Override public GT_Recipe_Map getRecipeMap() { @@ -242,6 +242,12 @@ public class GregtechMetaTileEntity_Refinery extends GregtechMeta_MultiBlockBase (this.mOutputBusses.size() != 1) || (this.mMufflerHatches.size() != 1) || (this.mMaintenanceHatches.size() != 1) || (this.mEnergyHatches.size() != 1)){ Logger.INFO("Wrong Hatch count."); + Logger.INFO("I-Hatch Count: "+this.mInputHatches.size()); + Logger.INFO("O-Hatch Count: "+this.mOutputHatches.size()); + Logger.INFO("O-Bus Count: "+this.mOutputBusses.size()); + Logger.INFO("Muffler Count: "+this.mMufflerHatches.size()); + Logger.INFO("Maint Count: "+this.mMaintenanceHatches.size()); + Logger.INFO("Energy Count: "+this.mEnergyHatches.size()); return false; } if (this.mMufflerHatches.size() == 1){ diff --git a/src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/production/algae/GregtechMTE_AlgaePondBase.java b/src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/production/algae/GregtechMTE_AlgaePondBase.java index b59f9be3c7..2896cdeba3 100644 --- a/src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/production/algae/GregtechMTE_AlgaePondBase.java +++ b/src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/production/algae/GregtechMTE_AlgaePondBase.java @@ -66,7 +66,7 @@ public class GregtechMTE_AlgaePondBase extends GregtechMeta_MultiBlockBase { "X X", "X X", "XXXXXXXXX", - "Machine Hulls (all bottom layer)", + "Machine Casings (all bottom layer)", "Sterile Farm Casings (rest)", "Controller (front centered)", "All hatches must be on the bottom layer", 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 60c0ade62f..81d1581724 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 @@ -1,12 +1,8 @@ package gtPlusPlus.xmod.gregtech.common.tileentities.machines.multi.production.chemplant; -import static gregtech.api.enums.GT_Values.E; import static gtPlusPlus.core.util.data.ArrayUtils.removeNulls; -import java.lang.reflect.InvocationTargetException; import java.util.ArrayList; -import java.util.Collection; -import java.util.HashSet; import java.util.List; import org.apache.commons.lang3.ArrayUtils; @@ -14,28 +10,17 @@ import org.apache.commons.lang3.ArrayUtils; import cpw.mods.fml.relauncher.Side; import cpw.mods.fml.relauncher.SideOnly; import gregtech.api.GregTech_API; -import gregtech.api.enums.ItemList; -import gregtech.api.enums.Materials; import gregtech.api.enums.Textures; import gregtech.api.interfaces.ITexture; import gregtech.api.interfaces.metatileentity.IMetaTileEntity; import gregtech.api.interfaces.tileentity.IGregTechTileEntity; -import gregtech.api.interfaces.tileentity.IHasWorldObjectAndCoords; import gregtech.api.metatileentity.implementations.GT_MetaTileEntity_TieredMachineBlock; -import gregtech.api.objects.GT_ItemStack; import gregtech.api.objects.GT_RenderedTexture; -import gregtech.api.util.GT_OreDictUnificator; import gregtech.api.util.GT_Recipe; import gregtech.api.util.GT_Utility; -import gregtech.api.util.GT_Recipe.GT_Recipe_Map; import gregtech.api.util.Recipe_GT; -import gtPlusPlus.api.helpers.GregtechPlusPlus_API.Multiblock_API; import gtPlusPlus.api.objects.Logger; import gtPlusPlus.api.objects.data.AutoMap; -import gtPlusPlus.api.objects.minecraft.multi.SpecialMultiBehaviour; -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; @@ -45,7 +30,6 @@ import gtPlusPlus.xmod.gregtech.common.Meta_GT_Proxy; import gtPlusPlus.xmod.gregtech.common.StaticFields59; import gtPlusPlus.xmod.gregtech.common.blocks.textures.TexturesGtBlock; import net.minecraft.block.Block; -import net.minecraft.item.Item; import net.minecraft.item.ItemStack; import net.minecraft.nbt.NBTTagCompound; import net.minecraftforge.common.util.ForgeDirection; @@ -755,7 +739,6 @@ public class GregtechMTE_ChemicalPlant extends GregtechMeta_MultiBlockBase { if (aBaseMetaTileEntity.isClientSide()) { this.mSolidCasingTier = getCasingTierOnClientSide(); } - } @Override @@ -820,13 +803,13 @@ public class GregtechMTE_ChemicalPlant extends GregtechMeta_MultiBlockBase { int tMaxParrallelCatalyst = aMaxParallelRecipes; ItemStack tCatalystRecipe = findCatalyst(tRecipe.mInputs); if (tCatalystRecipe != null) { - log("needs catalyst"); + log("has catalyst"); tCatalysts = new ArrayList<ItemStack>(); tMaxParrallelCatalyst = getCatalysts(aItemInputs, tCatalystRecipe, aMaxParallelRecipes,tCatalysts); } if (tMaxParrallelCatalyst == 0) { - log("found not enough catalists catalyst"); + log("found not enough catalysts"); return false; } diff --git a/src/Java/gtPlusPlus/xmod/gregtech/loaders/Gregtech_Blocks.java b/src/Java/gtPlusPlus/xmod/gregtech/loaders/Gregtech_Blocks.java index 535dfb3faa..a8af3dcb11 100644 --- a/src/Java/gtPlusPlus/xmod/gregtech/loaders/Gregtech_Blocks.java +++ b/src/Java/gtPlusPlus/xmod/gregtech/loaders/Gregtech_Blocks.java @@ -1,32 +1,27 @@ package gtPlusPlus.xmod.gregtech.loaders; -import gregtech.api.enums.TAE; -import gregtech.api.enums.Textures; - -import gtPlusPlus.api.objects.Logger; import gtPlusPlus.core.block.ModBlocks; import gtPlusPlus.xmod.gregtech.common.blocks.GregtechMetaCasingBlocks; import gtPlusPlus.xmod.gregtech.common.blocks.GregtechMetaCasingBlocks2; import gtPlusPlus.xmod.gregtech.common.blocks.GregtechMetaCasingBlocks3; import gtPlusPlus.xmod.gregtech.common.blocks.GregtechMetaCasingBlocks4; +import gtPlusPlus.xmod.gregtech.common.blocks.GregtechMetaCasingBlocks5; +import gtPlusPlus.xmod.gregtech.common.blocks.GregtechMetaSpecialMultiCasings; import gtPlusPlus.xmod.gregtech.common.blocks.GregtechMetaTieredCasingBlocks1; public class Gregtech_Blocks { public static void run(){ - - //Logger.INFO("Expanding Gregtech Texture Array from 128 -> 1024."); - boolean didExpand = TAE.hookGtTextures(); - //Logger.INFO("Did Texture Array expand correctly? "+didExpand); - Logger.INFO("|======| Texture Array Length: "+Textures.BlockIcons.CASING_BLOCKS.length+" |======|"); //Casing Blocks ModBlocks.blockCasingsMisc = new GregtechMetaCasingBlocks(); ModBlocks.blockCasings2Misc = new GregtechMetaCasingBlocks2(); ModBlocks.blockCasings3Misc = new GregtechMetaCasingBlocks3(); ModBlocks.blockCasings4Misc = new GregtechMetaCasingBlocks4(); - + ModBlocks.blockCasings5Misc = new GregtechMetaCasingBlocks5(); + ModBlocks.blockCasingsTieredGTPP = new GregtechMetaTieredCasingBlocks1(); + ModBlocks.blockSpecialMultiCasings = new GregtechMetaSpecialMultiCasings(); } } diff --git a/src/Java/gtPlusPlus/xmod/gregtech/loaders/RecipeGen_Fluids.java b/src/Java/gtPlusPlus/xmod/gregtech/loaders/RecipeGen_Fluids.java index 2b4e52abb9..3c74c4166d 100644 --- a/src/Java/gtPlusPlus/xmod/gregtech/loaders/RecipeGen_Fluids.java +++ b/src/Java/gtPlusPlus/xmod/gregtech/loaders/RecipeGen_Fluids.java @@ -210,11 +210,11 @@ public class RecipeGen_Fluids extends RecipeGen_Base { // Shape_Mold_Ring, - ItemList mold_Rod = gtPlusPlus.core.util.Utils.getValueOfItemList("Shape_Mold_Rod", null); - ItemList mold_Rod_Long = gtPlusPlus.core.util.Utils.getValueOfItemList("Shape_Mold_Rod_Long", null); - ItemList mold_Bolt = gtPlusPlus.core.util.Utils.getValueOfItemList("Shape_Mold_Bolt", null); - ItemList mold_Screw = gtPlusPlus.core.util.Utils.getValueOfItemList("Shape_Mold_Screw", null); - ItemList mold_Ring = gtPlusPlus.core.util.Utils.getValueOfItemList("Shape_Mold_Ring", null); + ItemList mold_Rod = ItemUtils.getValueOfItemList("Shape_Mold_Rod", null); + ItemList mold_Rod_Long = ItemUtils.getValueOfItemList("Shape_Mold_Rod_Long", null); + ItemList mold_Bolt = ItemUtils.getValueOfItemList("Shape_Mold_Bolt", null); + ItemList mold_Screw = ItemUtils.getValueOfItemList("Shape_Mold_Screw", null); + ItemList mold_Ring = ItemUtils.getValueOfItemList("Shape_Mold_Ring", null); // Rod if (ItemUtils.checkForInvalidItems(material.getRod(1))) diff --git a/src/Java/gtPlusPlus/xmod/gregtech/recipes/GregtechRecipeAdder.java b/src/Java/gtPlusPlus/xmod/gregtech/recipes/GregtechRecipeAdder.java index bb3d93172c..cc3130af98 100644 --- a/src/Java/gtPlusPlus/xmod/gregtech/recipes/GregtechRecipeAdder.java +++ b/src/Java/gtPlusPlus/xmod/gregtech/recipes/GregtechRecipeAdder.java @@ -23,10 +23,12 @@ import gtPlusPlus.api.objects.Logger; import gtPlusPlus.api.objects.data.AutoMap; import gtPlusPlus.core.lib.CORE; import gtPlusPlus.core.lib.LoadedMods; +import gtPlusPlus.core.material.Material; import gtPlusPlus.core.material.MaterialGenerator; import gtPlusPlus.core.recipe.common.CI; import gtPlusPlus.core.util.data.ArrayUtils; import gtPlusPlus.core.util.minecraft.ItemUtils; +import gtPlusPlus.core.util.minecraft.MaterialUtils; import gtPlusPlus.core.util.reflect.ReflectionUtils; import gtPlusPlus.xmod.gregtech.api.enums.GregtechItemList; import gtPlusPlus.xmod.gregtech.api.interfaces.internal.IGregtech_RecipeAdder; @@ -1183,6 +1185,11 @@ public class GregtechRecipeAdder implements IGregtech_RecipeAdder { @Override public boolean addChemicalPlantRecipe(ItemStack[] aInputs, FluidStack[] aInputFluids, ItemStack[] aOutputs, FluidStack[] aFluidOutputs, int time, long eu, int aTier) { + return addChemicalPlantRecipe(aInputs, aInputFluids, aOutputs, aFluidOutputs, new int[] {}, time, eu, aTier); + } + + @Override + public boolean addChemicalPlantRecipe(ItemStack[] aInputs, FluidStack[] aInputFluids, ItemStack[] aOutputs, FluidStack[] aFluidOutputs, int[] aChances, int time, long eu, int aTier) { if (aInputs.length > 4 || aInputFluids.length > 4 || aOutputs.length > 4 || aFluidOutputs.length > 2) { Logger.INFO("Inputs: "+ItemUtils.getArrayStackNames(aInputs)); @@ -1198,7 +1205,7 @@ public class GregtechRecipeAdder implements IGregtech_RecipeAdder { aInputs, aOutputs, null, - new int[] {}, + aChances, aInputFluids, aFluidOutputs, time, @@ -1304,6 +1311,93 @@ public class GregtechRecipeAdder implements IGregtech_RecipeAdder { } + @Override + public boolean addMillingRecipe(Materials aMat, int aEU) { + return addMillingRecipe(MaterialUtils.generateMaterialFromGtENUM(aMat), aEU); + } + + @Override + public boolean addMillingRecipe(Material aMat, int aEU) { + + ItemStack aOreStack = aMat.getOre(16); + ItemStack aCrushedStack = aMat.getCrushed(16); + + ItemStack aMilledStackOres1 = aMat.getMilled(64); + ItemStack aMilledStackCrushed1 = aMat.getMilled(48); + ItemStack aMilledStackOres2 = aMat.getMilled(48); + ItemStack aMilledStackCrushed2 = aMat.getMilled(32); + + ItemStack aMillingBall_Alumina = GregtechItemList.Milling_Ball_Alumina.get(0); + ItemStack aMillingBall_Soapstone = GregtechItemList.Milling_Ball_Soapstone.get(0); + + // Inputs + ItemStack[] aInputsOre1 = new ItemStack[] { + CI.getNumberedCircuit(10), + aOreStack, + aMillingBall_Alumina + }; + + ItemStack[] aInputsOre2 = new ItemStack[] { + CI.getNumberedCircuit(11), + aOreStack, + aMillingBall_Soapstone + }; + + ItemStack[] aInputsCrushed1 = new ItemStack[] { + CI.getNumberedCircuit(10), + aCrushedStack, + aMillingBall_Alumina + }; + + ItemStack[] aInputsCrushed2 = new ItemStack[] { + CI.getNumberedCircuit(11), + aCrushedStack, + aMillingBall_Soapstone + }; + + // Outputs + ItemStack[] aOutputsOre1 = new ItemStack[] { + aMilledStackOres1 + }; + + ItemStack[] aOutputsOre2 = new ItemStack[] { + aMilledStackOres2 + }; + + ItemStack[] aOutputsCrushed1 = new ItemStack[] { + aMilledStackCrushed1 + }; + + ItemStack[] aOutputsCrushed2 = new ItemStack[] { + aMilledStackCrushed2 + }; + + ItemStack[][] aInputArray = new ItemStack[][] {aInputsOre1, aInputsOre2, aInputsCrushed1, aInputsCrushed2}; + ItemStack[][] aOutputArray = new ItemStack[][] {aOutputsOre1, aOutputsOre2, aOutputsCrushed1, aOutputsCrushed2}; + int[] aTime = new int[] {6000, 7500, 7500, 9000}; + + int aSize = Recipe_GT.Gregtech_Recipe_Map.sOreMillRecipes.mRecipeList.size(); + int aSize2 = aSize; + + for (int i=0;i<4;i++) { + Recipe_GT aOreRecipe = new Recipe_GT( + false, + aInputArray[i], + aOutputArray[i], + null, + new int[] {}, + null, + null, + aTime[i], + aEU, + 0); + Recipe_GT.Gregtech_Recipe_Map.sOreMillRecipes.add(aOreRecipe); + } + + aSize = Recipe_GT.Gregtech_Recipe_Map.sOreMillRecipes.mRecipeList.size(); + return aSize > aSize2; + } + diff --git a/src/Java/gtPlusPlus/xmod/gregtech/registration/gregtech/GregtechComponentAssembler.java b/src/Java/gtPlusPlus/xmod/gregtech/registration/gregtech/GregtechComponentAssembler.java index 3490e8d8be..5d2f5b414d 100644 --- a/src/Java/gtPlusPlus/xmod/gregtech/registration/gregtech/GregtechComponentAssembler.java +++ b/src/Java/gtPlusPlus/xmod/gregtech/registration/gregtech/GregtechComponentAssembler.java @@ -197,7 +197,7 @@ public class GregtechComponentAssembler { ItemStack Input[] = { wireStack, cableStack, rodStack, magrodStack }; return CORE.RA.addComponentMakerRecipe(Input, GT_Values.NF, - ItemList.valueOf("Electric_Motor_" + GT_Values.VN[tier]).get(1), (tier * 40), + CI.getElectricMotor(tier, 1), (tier * 40), ((int) GT_Values.V[tier] / 16) * 15); } catch (Throwable t) { @@ -213,12 +213,12 @@ public class GregtechComponentAssembler { ItemStack rodStack = ItemUtils.getGregtechOreStack(OrePrefixes.stick, mat, 2); ItemStack plateStack = ItemUtils.getGregtechOreStack(OrePrefixes.plate, mat, 3); ItemStack gearStack = ItemUtils.getGregtechOreStack(OrePrefixes.gearGtSmall, mat, 1); - ItemStack motorStack = ItemList.valueOf("Electric_Motor_" + GT_Values.VN[tier]).get(1); + ItemStack motorStack = CI.getElectricMotor(tier, 1); ItemStack Input[] = { plateStack, cableStack, rodStack, gearStack, motorStack }; return CORE.RA.addComponentMakerRecipe(Input, GT_Values.NF, - ItemList.valueOf("Electric_Piston_" + GT_Values.VN[tier]).get(1), (tier * 40), + CI.getElectricPiston(tier, 1), (tier * 40), ((int) GT_Values.V[tier] / 16) * 15); } catch (Throwable t) { @@ -230,7 +230,7 @@ public class GregtechComponentAssembler { try { OrePrefixes prefixCable = OrePrefixes.cableGt01; ItemStack cableStack = ItemUtils.getGregtechOreStack(prefixCable, cable, 1); - ItemStack motorStack = ItemList.valueOf("Electric_Motor_" + GT_Values.VN[tier]).get(2); + ItemStack motorStack = CI.getElectricMotor(tier, 2); boolean mAdd[]; final ArrayList<ItemStack> oreDictList = OreDictionary.getOres("plateAnyRubber"); if (!oreDictList.isEmpty()) { @@ -241,7 +241,7 @@ public class GregtechComponentAssembler { returnValue.stackSize = 6; ItemStack Input[] = { cableStack, motorStack, returnValue }; mAdd[mcount++] = CORE.RA.addComponentMakerRecipe(Input, GT_Values.NF, - ItemList.valueOf("Conveyor_Module_" + GT_Values.VN[tier]).get(1), (tier * 40), + CI.getConveyor(tier, 1), (tier * 40), ((int) GT_Values.V[tier] / 16) * 15); } int added = 0; @@ -261,7 +261,7 @@ public class GregtechComponentAssembler { ItemStack Input[] = { cableStack, motorStack, ItemUtils.getItemStackOfAmountFromOreDictNoBroken("plateRubber", 6) }; return CORE.RA.addComponentMakerRecipe(Input, GT_Values.NF, - ItemList.valueOf("Conveyor_Module_" + GT_Values.VN[tier]).get(1), (tier * 40), + CI.getConveyor(tier, 1), (tier * 40), ((int) GT_Values.V[tier] / 16) * 15); } @@ -277,7 +277,7 @@ public class GregtechComponentAssembler { ItemStack screwStack = ItemUtils.getGregtechOreStack(OrePrefixes.screw, main, 1); ItemStack rotorStack = ItemUtils.getGregtechOreStack(OrePrefixes.rotor, main, 1); ItemStack pipeStack = ItemUtils.getGregtechOreStack(OrePrefixes.pipeMedium, pipe, 1); - ItemStack motorStack = ItemList.valueOf("Electric_Motor_" + GT_Values.VN[tier]).get(1); + ItemStack motorStack = CI.getElectricMotor(tier, 1); boolean mAdd[]; final ArrayList<ItemStack> oreDictList = OreDictionary.getOres("ringAnyRubber"); if (!oreDictList.isEmpty()) { @@ -288,7 +288,7 @@ public class GregtechComponentAssembler { returnValue.stackSize = 2; ItemStack Input[] = { cableStack, screwStack, rotorStack, pipeStack, motorStack, returnValue }; mAdd[mcount++] = CORE.RA.addComponentMakerRecipe(Input, GT_Values.NF, - ItemList.valueOf("Electric_Pump_" + GT_Values.VN[tier]).get(1), (tier * 40), + CI.getElectricPump(tier, 1), (tier * 40), ((int) GT_Values.V[tier] / 16) * 15); } int added = 0; @@ -308,7 +308,7 @@ public class GregtechComponentAssembler { ItemStack Input[] = { cableStack, screwStack, rotorStack, pipeStack, motorStack, ItemUtils.getItemStackOfAmountFromOreDictNoBroken("ringRubber", 2) }; return CORE.RA.addComponentMakerRecipe(Input, GT_Values.NF, - ItemList.valueOf("Electric_Pump_" + GT_Values.VN[tier]).get(1), (tier * 40), + CI.getElectricPump(tier, 1), (tier * 40), ((int) GT_Values.V[tier] / 16) * 15); } @@ -322,8 +322,8 @@ public class GregtechComponentAssembler { try { ItemStack cableStack = ItemUtils.getGregtechOreStack(OrePrefixes.cableGt01, cable, 3); ItemStack rodStack = ItemUtils.getGregtechOreStack(OrePrefixes.stick, stick, 2); - ItemStack motorStack = ItemList.valueOf("Electric_Motor_" + GT_Values.VN[tier]).get(2); - ItemStack pistonStack = ItemList.valueOf("Electric_Piston_" + GT_Values.VN[tier]).get(1); + ItemStack motorStack = CI.getElectricMotor(tier, 2); + ItemStack pistonStack = CI.getElectricPiston(tier, 1); boolean mAdd[]; final ItemStack oreDictList[] = CI.getAllCircuitsOfTier(tier); @@ -335,7 +335,7 @@ public class GregtechComponentAssembler { returnValue.stackSize = 1; ItemStack Input[] = { returnValue, cableStack, rodStack, pistonStack, motorStack }; mAdd[mcount++] = CORE.RA.addComponentMakerRecipe(Input, GT_Values.NF, - ItemList.valueOf("Robot_Arm_" + GT_Values.VN[tier]).get(1), (tier * 40), + CI.getRobotArm(tier, 1), (tier * 40), ((int) GT_Values.V[tier] / 16) * 15); } for (boolean y : mAdd) { @@ -353,7 +353,7 @@ public class GregtechComponentAssembler { else { ItemStack Input[] = { ItemUtils.getItemStackOfAmountFromOreDict(CI.getTieredCircuitOreDictName(tier), 1), cableStack, rodStack, pistonStack, motorStack }; return CORE.RA.addComponentMakerRecipe(Input, GT_Values.NF, - ItemList.valueOf("Robot_Arm_" + GT_Values.VN[tier]).get(1), (tier * 40), + CI.getRobotArm(tier, 1), (tier * 40), ((int) GT_Values.V[tier] / 16) * 15); } @@ -381,8 +381,8 @@ public class GregtechComponentAssembler { else mWT = "01"; - ItemStack eyeQuantum = ItemList.valueOf("QuantumEye").get(1); - ItemStack starQuantum = ItemList.valueOf("QuantumStar").get(1); + ItemStack eyeQuantum = ItemUtils.getValueOfItemList("QuantumEye", 1, ItemUtils.getSimpleStack(Items.ender_eye, 4)); + ItemStack starQuantum = ItemUtils.getValueOfItemList("QuantumStar", 1, ItemUtils.getSimpleStack(Items.nether_star, 4)); if (tier == 1) gem = ItemUtils.getSimpleStack(Items.ender_pearl); @@ -410,7 +410,7 @@ public class GregtechComponentAssembler { returnValue.stackSize = 4; ItemStack Input[] = { returnValue, wireStack, gem }; mAdd[mcount++] = CORE.RA.addComponentMakerRecipe(Input, GT_Values.NF, - ItemList.valueOf("Field_Generator_" + GT_Values.VN[tier]).get(1), (tier * 40), + CI.getFieldGenerator(tier, 1), (tier * 40), ((int) GT_Values.V[tier] / 16) * 15); } for (boolean y : mAdd) { @@ -428,7 +428,7 @@ public class GregtechComponentAssembler { else { ItemStack Input[] = { ItemUtils.getItemStackOfAmountFromOreDict(CI.getTieredCircuitOreDictName(tier), 4), wireStack, gem }; return CORE.RA.addComponentMakerRecipe(Input, GT_Values.NF, - ItemList.valueOf("Field_Generator_" + GT_Values.VN[tier]).get(1), (tier * 40), + CI.getFieldGenerator(tier, 1), (tier * 40), ((int) GT_Values.V[tier] / 16) * 15); } @@ -454,7 +454,7 @@ public class GregtechComponentAssembler { returnValue.stackSize = 2; ItemStack Input[] = { returnValue, cableStack, gemstack, magrodStack }; mAdd[mcount++] = CORE.RA.addComponentMakerRecipe(Input, GT_Values.NF, - ItemList.valueOf("Emitter_" + GT_Values.VN[tier]).get(1), (tier * 40), + CI.getEmitter(tier, 1), (tier * 40), ((int) GT_Values.V[tier] / 16) * 15); } for (boolean y : mAdd) { @@ -472,7 +472,7 @@ public class GregtechComponentAssembler { else { ItemStack Input[] = { ItemUtils.getItemStackOfAmountFromOreDict(CI.getTieredCircuitOreDictName(tier), 2), cableStack, gemstack, magrodStack }; return CORE.RA.addComponentMakerRecipe(Input, GT_Values.NF, - ItemList.valueOf("Emitter_" + GT_Values.VN[tier]).get(1), (tier * 40), + CI.getEmitter(tier, 1), (tier * 40), ((int) GT_Values.V[tier] / 16) * 15); } @@ -500,7 +500,7 @@ public class GregtechComponentAssembler { returnValue.stackSize = 1; ItemStack Input[] = { gemStack, cableStack, returnValue, magrodStack }; mAdd[mcount++] = CORE.RA.addComponentMakerRecipe(Input, GT_Values.NF, - ItemList.valueOf("Sensor_" + GT_Values.VN[tier]).get(1), (tier * 40), + CI.getSensor(tier, 1), (tier * 40), ((int) GT_Values.V[tier] / 16) * 15); } for (boolean y : mAdd) { @@ -518,7 +518,7 @@ public class GregtechComponentAssembler { else { ItemStack Input[] = { gemStack, cableStack, magrodStack, ItemUtils.getItemStackOfAmountFromOreDict(CI.getTieredCircuitOreDictName(tier), 1) }; return CORE.RA.addComponentMakerRecipe(Input, GT_Values.NF, - ItemList.valueOf("Sensor_" + GT_Values.VN[tier]).get(1), (tier * 40), + CI.getSensor(tier, 1), (tier * 40), ((int) GT_Values.V[tier] / 16) * 15); } diff --git a/src/Java/gtPlusPlus/xmod/gregtech/registration/gregtech/GregtechCustomHatches.java b/src/Java/gtPlusPlus/xmod/gregtech/registration/gregtech/GregtechCustomHatches.java index 54e4fbf024..2c622b9d8e 100644 --- a/src/Java/gtPlusPlus/xmod/gregtech/registration/gregtech/GregtechCustomHatches.java +++ b/src/Java/gtPlusPlus/xmod/gregtech/registration/gregtech/GregtechCustomHatches.java @@ -5,8 +5,8 @@ import java.lang.reflect.InvocationTargetException; import gregtech.api.interfaces.metatileentity.IMetaTileEntity; import gtPlusPlus.api.objects.Logger; -import gtPlusPlus.core.lib.CORE; import gtPlusPlus.core.util.minecraft.FluidUtils; +import gtPlusPlus.core.util.minecraft.gregtech.PollutionUtils; import gtPlusPlus.xmod.gregtech.api.enums.GregtechItemList; import gtPlusPlus.xmod.gregtech.api.metatileentity.implementations.GT_MetaTileEntity_Hatch_AirIntake; import gtPlusPlus.xmod.gregtech.api.metatileentity.implementations.GT_MetaTileEntity_Hatch_ControlCore; @@ -23,12 +23,9 @@ public class GregtechCustomHatches { if (gtPlusPlus.core.lib.LoadedMods.Gregtech) { Logger.INFO("Gregtech5u Content | Registering Custom Fluid Hatches."); run1(); - - //No pollution in 5.08 - if (CORE.MAIN_GREGTECH_5U_EXPERIMENTAL_FORK) { + if (PollutionUtils.isPollutionEnabled()) { run2(); - } - + } run3(); } } @@ -201,32 +198,31 @@ public class GregtechCustomHatches { Class<?> aBusEntity = aClass; Constructor<?> constructor; try { - constructor = aBusEntity.getConstructor(int.class, String.class, String.class, int.class, int.class); + constructor = aBusEntity.getConstructor(int.class, String.class, String.class, int.class, int.class); if (constructor != null) { - Object aPipe; + Object aBus; try { - aPipe = constructor.newInstance( + aBus = constructor.newInstance( aID, aUnlocalName, aLocalName, aTier, (1+ aTier) * 32); - if (aPipe == null) { - //Logger.INFO("Failed to Generate "+aMaterial+" Hexadecuple pipes."); + if (aBus == null) { + Logger.INFO("Failed to Generate "+aLocalName+"."); } else { Logger.INFO("Generated "+aLocalName+"."); - return aPipe; - //GT_OreDictUnificator.registerOre("pipeHexadecuple" + aMaterial, aPipe.getStackForm(1L)); + return aBus; } } catch (InstantiationException | IllegalAccessException | IllegalArgumentException | InvocationTargetException e) { - //Logger.INFO("Failed to Generate "+aMaterial+" Hexadecuple pipes. [Ecx]"); e.printStackTrace(); + Logger.INFO("Failed to Generate "+aLocalName+"."); } } } catch (NoSuchMethodException | SecurityException e1) { - // TODO Auto-generated catch block e1.printStackTrace(); + Logger.INFO("Failed to Generate "+aLocalName+"."); } return null; } diff --git a/src/Java/gtPlusPlus/xmod/gregtech/registration/gregtech/GregtechFactoryGradeReplacementMultis.java b/src/Java/gtPlusPlus/xmod/gregtech/registration/gregtech/GregtechFactoryGradeReplacementMultis.java index 86cbdb75fa..67c54a7699 100644 --- a/src/Java/gtPlusPlus/xmod/gregtech/registration/gregtech/GregtechFactoryGradeReplacementMultis.java +++ b/src/Java/gtPlusPlus/xmod/gregtech/registration/gregtech/GregtechFactoryGradeReplacementMultis.java @@ -1,8 +1,10 @@ package gtPlusPlus.xmod.gregtech.registration.gregtech; import gtPlusPlus.api.objects.Logger; +import gtPlusPlus.core.lib.CORE; import gtPlusPlus.xmod.gregtech.api.enums.GregtechItemList; import gtPlusPlus.xmod.gregtech.common.tileentities.machines.multi.processing.GregtechMetaTileEntity_IndustrialVacuumFreezer; +import gtPlusPlus.xmod.gregtech.common.tileentities.machines.multi.processing.advanced.GregtechMetaTileEntity_Adv_AssemblyLine; import gtPlusPlus.xmod.gregtech.common.tileentities.machines.multi.processing.advanced.GregtechMetaTileEntity_Adv_DistillationTower; import gtPlusPlus.xmod.gregtech.common.tileentities.machines.multi.processing.advanced.GregtechMetaTileEntity_Adv_EBF; import gtPlusPlus.xmod.gregtech.common.tileentities.machines.multi.processing.advanced.GregtechMetaTileEntity_Adv_Fusion_MK4; @@ -24,6 +26,9 @@ public class GregtechFactoryGradeReplacementMultis { //31021 GregtechItemList.Machine_Adv_DistillationTower.set(new GregtechMetaTileEntity_Adv_DistillationTower(31021, "multimachine.adv.distillationtower", "Dangote Distillus").getStackForm(1L)); + if (CORE.MAIN_GREGTECH_5U_EXPERIMENTAL_FORK) { + GregtechItemList.Machine_Adv_AssemblyLine.set(new GregtechMetaTileEntity_Adv_AssemblyLine(31024, "multimachine.adv.assemblyline", "Compound Fabricator").getStackForm(1L)); + } } diff --git a/src/Java/gtPlusPlus/xmod/gregtech/registration/gregtech/GregtechIndustrialFuelRefinery.java b/src/Java/gtPlusPlus/xmod/gregtech/registration/gregtech/GregtechIndustrialFuelRefinery.java index 1787b57014..bbe23b542c 100644 --- a/src/Java/gtPlusPlus/xmod/gregtech/registration/gregtech/GregtechIndustrialFuelRefinery.java +++ b/src/Java/gtPlusPlus/xmod/gregtech/registration/gregtech/GregtechIndustrialFuelRefinery.java @@ -20,7 +20,7 @@ public class GregtechIndustrialFuelRefinery { private static void run1() { // Industrial Maceration Stack Multiblock GregtechItemList.Industrial_FuelRefinery.set(new GregtechMetaTileEntity_Refinery(835, - "industrialrefinery.controller.tier.single", "Fission Fuel Processing Plant").getStackForm(1L)); + "industrialrefinery.controller.tier.single", "Reactor Fuel Processing Plant").getStackForm(1L)); } }
\ No newline at end of file diff --git a/src/Java/gtPlusPlus/xmod/gregtech/registration/gregtech/GregtechIsaMill.java b/src/Java/gtPlusPlus/xmod/gregtech/registration/gregtech/GregtechIsaMill.java new file mode 100644 index 0000000000..9c5fb483a7 --- /dev/null +++ b/src/Java/gtPlusPlus/xmod/gregtech/registration/gregtech/GregtechIsaMill.java @@ -0,0 +1,14 @@ +package gtPlusPlus.xmod.gregtech.registration.gregtech; + +import gtPlusPlus.xmod.gregtech.api.enums.GregtechItemList; +import gtPlusPlus.xmod.gregtech.common.tileentities.machines.multi.processing.GregtechMetaTileEntity_IsaMill; + +public class GregtechIsaMill { + + public static void run(){ + + GregtechItemList.Controller_IsaMill_Controller.set(new GregtechMetaTileEntity_IsaMill(31027, "gtpp.multimachine.isamill", "IsaMill Grinding Machine").getStackForm(1L)); + + } + +} diff --git a/src/Java/gtPlusPlus/xmod/gregtech/registration/gregtech/GregtechRocketFuelGenerator.java b/src/Java/gtPlusPlus/xmod/gregtech/registration/gregtech/GregtechRocketFuelGenerator.java index 2d548a57b7..5a7d3a50d7 100644 --- a/src/Java/gtPlusPlus/xmod/gregtech/registration/gregtech/GregtechRocketFuelGenerator.java +++ b/src/Java/gtPlusPlus/xmod/gregtech/registration/gregtech/GregtechRocketFuelGenerator.java @@ -12,7 +12,7 @@ import gtPlusPlus.core.lib.CORE; import gtPlusPlus.core.lib.LoadedMods; import gtPlusPlus.core.material.ALLOY; import gtPlusPlus.core.recipe.common.CI; -import gtPlusPlus.core.util.Utils; +import gtPlusPlus.core.util.minecraft.ItemUtils; import gtPlusPlus.xmod.gregtech.api.enums.GregtechItemList; import gtPlusPlus.xmod.gregtech.common.tileentities.generators.GregtechMetaTileEntityRocketFuelGenerator; import gtPlusPlus.xmod.gregtech.common.tileentities.machines.multi.production.GregtechMetaTileEntity_LargeRocketEngine; @@ -28,13 +28,13 @@ public class GregtechRocketFuelGenerator { } } - + private static void run1() { GregtechItemList.Controller_RocketEngine.set( new GregtechMetaTileEntity_LargeRocketEngine(996, "gtpp.multimachine.rocketengine", "Rocketdyne F-1A Engine").getStackForm(1L)); - ItemList aDieselEngine = Utils.getValueOfItemList("Machine_Multi_DieselEngine", ItemList.Machine_Multi_LargeBoiler_TungstenSteel); + ItemList aDieselEngine = ItemUtils.getValueOfItemList("Machine_Multi_DieselEngine", ItemList.Machine_Multi_LargeBoiler_TungstenSteel); GT_ModHandler.addCraftingRecipe( GregtechItemList.Controller_RocketEngine.get(1L), diff --git a/src/Java/gtPlusPlus/xmod/gregtech/registration/gregtech/GregtechSemiFluidgenerators.java b/src/Java/gtPlusPlus/xmod/gregtech/registration/gregtech/GregtechSemiFluidgenerators.java index c4141a6a77..6b38415db1 100644 --- a/src/Java/gtPlusPlus/xmod/gregtech/registration/gregtech/GregtechSemiFluidgenerators.java +++ b/src/Java/gtPlusPlus/xmod/gregtech/registration/gregtech/GregtechSemiFluidgenerators.java @@ -2,6 +2,7 @@ package gtPlusPlus.xmod.gregtech.registration.gregtech; import gtPlusPlus.xmod.gregtech.api.enums.GregtechItemList; import gtPlusPlus.xmod.gregtech.common.tileentities.generators.GT_MetaTileEntity_SemiFluidGenerator; +import gtPlusPlus.xmod.gregtech.common.tileentities.machines.multi.production.GregtechMetaTileEntity_LargeSemifluidGenerator; public class GregtechSemiFluidgenerators { @@ -12,6 +13,8 @@ public class GregtechSemiFluidgenerators { "Advanced Semi-Fluid Generator", 2).getStackForm(1L)); GregtechItemList.Generator_SemiFluid_HV.set(new GT_MetaTileEntity_SemiFluidGenerator(839, "basicgenerator.semifluid.tier.03", "Turbo Semi-Fluid Generator", 3).getStackForm(1L)); + GregtechItemList.Controller_LargeSemifluidGenerator.set(new GregtechMetaTileEntity_LargeSemifluidGenerator(31026, "gtpp.multimachine.semifluidgenerator", "Large Semifluid Burner").getStackForm(1L)); + } } diff --git a/src/Java/gtPlusPlus/xmod/thaumcraft/util/ThaumcraftUtils.java b/src/Java/gtPlusPlus/xmod/thaumcraft/util/ThaumcraftUtils.java index f23a5db6fe..4f1006693e 100644 --- a/src/Java/gtPlusPlus/xmod/thaumcraft/util/ThaumcraftUtils.java +++ b/src/Java/gtPlusPlus/xmod/thaumcraft/util/ThaumcraftUtils.java @@ -159,7 +159,9 @@ public class ThaumcraftUtils { rResearch.setItemTriggers(aResearchTriggers); rResearch.setHidden(); } - rResearch.setPages((TC_ResearchPage_Wrapper[]) tPages.toArray(new TC_ResearchPage_Wrapper[tPages.size()])); + + Object[] aVarArgs = (TC_ResearchPage_Wrapper[]) tPages.toArray(new TC_ResearchPage_Wrapper[tPages.size()]); + rResearch.setPages(aVarArgs); return rResearch.registerResearchItem(); } diff --git a/src/resources/GradleStartClient.java b/src/resources/GradleStartClient.java new file mode 100644 index 0000000000..97edde8b04 --- /dev/null +++ b/src/resources/GradleStartClient.java @@ -0,0 +1,103 @@ +import java.io.File; +import java.lang.reflect.Field; +import java.lang.reflect.InvocationTargetException; +import java.lang.reflect.Method; +import java.util.Arrays; + +import com.google.common.base.Strings; + +import net.minecraftforge.gradle.GradleStartCommon; + +public class GradleStartClient extends GradleStart { + + public static void main(String[] args) { + + // hack natives. + try { + GradleStartCommon.LOGGER.info("Injecting Natives!"); + hack(); + GradleStartCommon.LOGGER.info("Natives Injected!"); + // launch + Method launch = GradleStartCommon.class.getDeclaredMethod("launch", String[].class); + if (launch != null) { + launch.setAccessible(true); + GradleStart aStart = new GradleStart(); + GradleStartCommon.LOGGER.info("Launching!"); + launch.invoke(aStart, new Object[]{args}); + } + } + catch (NoSuchMethodException | SecurityException | IllegalAccessException | IllegalArgumentException | InvocationTargetException e) { + e.printStackTrace(); + } + } + + private static final void hack() { + GradleStartCommon.LOGGER.info("[FG_1.3] Doing Classloader hack."); + String paths = System.getProperty("java.library.path"); + String nativesDir = "@@NATIVESDIR@@"; + + if (Strings.isNullOrEmpty(paths)) + paths = nativesDir; + else + paths += File.pathSeparator + nativesDir; + + hackNativesFixed(paths); + //addLibraryPath(nativesDir); + //addLibraryPath(paths); + } + + private static final void hackNativesFixed(String paths) { + System.setProperty("java.library.path", paths); + // hack the classloader now. + try + { + String aPathData = System.getProperty("java.library.path"); + final Method initializePathMethod = ClassLoader.class.getDeclaredMethod("initializePath", String.class); + GradleStartCommon.LOGGER.info("[FG_1.3] Setting private method 'initializePath' to be accessible."); + initializePathMethod.setAccessible(true); + GradleStartCommon.LOGGER.info("[FG_1.3] Invoking 'initializePath' with arg 'java.library.path'."); + GradleStartCommon.LOGGER.info("[FG_1.3] Path Value: "+aPathData); + final Object usrPathsValue = initializePathMethod.invoke(null, "java.library.path"); + final Field usrPathsField = ClassLoader.class.getDeclaredField("usr_paths"); + GradleStartCommon.LOGGER.info("[FG_1.3] Setting private field 'usr_paths' to be accessible."); + usrPathsField.setAccessible(true); + GradleStartCommon.LOGGER.info("[FG_1.3] Injecting path data."); + usrPathsField.set(null, usrPathsValue); + GradleStartCommon.LOGGER.info("[FG_1.3] Finished Classloader hack."); + } + catch(Throwable t) { + GradleStartCommon.LOGGER.info("[FG_1.3] Error handling Classloader hack, printing stack trace."); + t.printStackTrace(); + }; + } + + public static void addLibraryPath(String pathToAdd){ + Field usrPathsField; + try { + usrPathsField = ClassLoader.class.getDeclaredField("usr_paths"); + usrPathsField.setAccessible(true); + + //get array of paths + final String[] paths = (String[])usrPathsField.get(null); + + //check if the path to add is already present + for(String path : paths) { + if(path.equals(pathToAdd)) { + GradleStartCommon.LOGGER.info("[FG_1.3] Found existing PATH data, skipping."); + return; + } + } + GradleStartCommon.LOGGER.info("[FG_1.3] Injecting path data. ["+pathToAdd+"]"); + //add the new path + final String[] newPaths = Arrays.copyOf(paths, paths.length + 1); + newPaths[newPaths.length-1] = pathToAdd; + usrPathsField.set(null, newPaths); + } + catch (NoSuchFieldException | SecurityException | IllegalArgumentException | IllegalAccessException e) { + GradleStartCommon.LOGGER.info("[FG_1.3] Error handling Classloader hack, printing stack trace."); + e.printStackTrace(); + } + + } + +} diff --git a/src/resources/assets/miscutils/lang/en_US.lang b/src/resources/assets/miscutils/lang/en_US.lang index 6e1b64cc9a..8064848316 100644 --- a/src/resources/assets/miscutils/lang/en_US.lang +++ b/src/resources/assets/miscutils/lang/en_US.lang @@ -20,6 +20,7 @@ tile.fluidSludge.0.name=Stagnant Waste Water //Death Messages death.attack.plasmabolt=%s died by burning hot plasma. death.attack.plasmabolt.player=%1$s was killed by %2$s using plasma. +death.attack.gtpp.grinder=%s was ground into nothingness by an IsaMill. //Alternative Materials item.itemPlateBatteryAlloy.name=Plate of Battery Alloy @@ -3111,5 +3112,47 @@ item.BasicAlgaeItem.4.name=Algae Spore (V) item.BasicAlgaeItem.5.name=Algae Spore (VI) item.BasicAlgaeItem.6.name=Algae Spore (VII) -//Added17/01/20 +//Added 17/01/20 item.BasicGenericChemItem.6.name=Pink Metal Catalyst + +//Added 23/03/20 +item.BasicMetaFood.0.name=Raw Human Meat +item.BasicMetaFood.1.name=Cooked Human Meat +item.BasicMetaFood.2.name=Raw Horse Meat +item.BasicMetaFood.3.name=Cooked Horse Meat +item.BasicMetaFood.4.name=Raw Wolf Meat +item.BasicMetaFood.5.name=Cooked Wolf Meat +item.BasicMetaFood.6.name=Raw Ocelot Meat +item.BasicMetaFood.7.name=Cooked Ocelot Meat +item.BasicMetaFood.8.name=Blaze Flesh + +item.itemCellNaquadahFuel.name=Naquadah Fuel Cell +item.itemCellEnrichedNaquadahFuel.name=Enriched Naquadah Fuel Cell +item.itemCellNaquadriaFuel.name=Naquadria Fuel Cell +item.boricacid.name=Boric Acid Cell +item.hydrochloricacid.name=Hydrochloric Acid Cell + +item.BasicAlgaeItem.name=Breedable Algae +item.BasicAlgaeItem.0.name=Breedable Algae +item.BasicAlgaeItem.1.name=Breedable Algae +item.BasicAlgaeItem.2.name=Breedable Algae +item.BasicAlgaeItem.3.name=Breedable Algae +item.BasicAlgaeItem.4.name=Breedable Algae +item.BasicAlgaeItem.5.name=Breedable Algae +item.BasicAlgaeItem.6.name=Breedable Algae + +//Added 30/03/20 +item.milledChalcopyrite.name=Milled Chalcopyrite +item.milledSphalerite.name=Milled Sphalerite +item.milledNickel.name=Milled Nickel +item.milledPlatinum.name=Milled Platinum +item.milledPentlandite.name=Milled Pentlandite + +item.BasicGenericChemItem.7.name=Alumina Milling Ball +item.BasicGenericChemItem.8.name=Soapstone Milling Ball + +item.FrothZincflotation.name=Sphalerite Flotation Froth Cell +item.FrothCopperflotation.name=Chalcopyrite Flotation Froth Cell +item.FrothNickelflotation.name=Nickel Flotation Froth Cell +item.FrothPlatinumflotation.name=Platinum Flotation Froth Cell +item.FrothPentlanditeflotation.name=Pentlandite Flotation Froth Cell
\ No newline at end of file diff --git a/src/resources/assets/miscutils/textures/blocks/TileEntities/MACHINE_CASING_GEARBOX_T1.png b/src/resources/assets/miscutils/textures/blocks/TileEntities/MACHINE_CASING_GEARBOX_T1.png Binary files differnew file mode 100644 index 0000000000..df4e3a1a41 --- /dev/null +++ b/src/resources/assets/miscutils/textures/blocks/TileEntities/MACHINE_CASING_GEARBOX_T1.png diff --git a/src/resources/assets/miscutils/textures/blocks/TileEntities/MACHINE_CASING_GRINDING_FACTORY.png b/src/resources/assets/miscutils/textures/blocks/TileEntities/MACHINE_CASING_GRINDING_FACTORY.png Binary files differnew file mode 100644 index 0000000000..d8677eda87 --- /dev/null +++ b/src/resources/assets/miscutils/textures/blocks/TileEntities/MACHINE_CASING_GRINDING_FACTORY.png diff --git a/src/resources/assets/miscutils/textures/blocks/TileEntities/MACHINE_CASING_PIPE_T1.png b/src/resources/assets/miscutils/textures/blocks/TileEntities/MACHINE_CASING_PIPE_T1.png Binary files differnew file mode 100644 index 0000000000..c0065f8379 --- /dev/null +++ b/src/resources/assets/miscutils/textures/blocks/TileEntities/MACHINE_CASING_PIPE_T1.png diff --git a/src/resources/assets/miscutils/textures/blocks/TileEntities/RoundRobinator/MACHINE_CASING_VENT.png b/src/resources/assets/miscutils/textures/blocks/TileEntities/RoundRobinator/MACHINE_CASING_VENT.png Binary files differnew file mode 100644 index 0000000000..6d9fb32d7e --- /dev/null +++ b/src/resources/assets/miscutils/textures/blocks/TileEntities/RoundRobinator/MACHINE_CASING_VENT.png diff --git a/src/resources/assets/miscutils/textures/blocks/iconsets/Grinder/GRINDER1.png b/src/resources/assets/miscutils/textures/blocks/iconsets/Grinder/GRINDER1.png Binary files differnew file mode 100644 index 0000000000..ce1c2ef3d8 --- /dev/null +++ b/src/resources/assets/miscutils/textures/blocks/iconsets/Grinder/GRINDER1.png diff --git a/src/resources/assets/miscutils/textures/blocks/iconsets/Grinder/GRINDER2.png b/src/resources/assets/miscutils/textures/blocks/iconsets/Grinder/GRINDER2.png Binary files differnew file mode 100644 index 0000000000..84e1ac6350 --- /dev/null +++ b/src/resources/assets/miscutils/textures/blocks/iconsets/Grinder/GRINDER2.png diff --git a/src/resources/assets/miscutils/textures/blocks/iconsets/Grinder/GRINDER3.png b/src/resources/assets/miscutils/textures/blocks/iconsets/Grinder/GRINDER3.png Binary files differnew file mode 100644 index 0000000000..4f716e4c61 --- /dev/null +++ b/src/resources/assets/miscutils/textures/blocks/iconsets/Grinder/GRINDER3.png diff --git a/src/resources/assets/miscutils/textures/blocks/iconsets/Grinder/GRINDER4.png b/src/resources/assets/miscutils/textures/blocks/iconsets/Grinder/GRINDER4.png Binary files differnew file mode 100644 index 0000000000..fa9e98a6f5 --- /dev/null +++ b/src/resources/assets/miscutils/textures/blocks/iconsets/Grinder/GRINDER4.png diff --git a/src/resources/assets/miscutils/textures/blocks/iconsets/Grinder/GRINDER5.png b/src/resources/assets/miscutils/textures/blocks/iconsets/Grinder/GRINDER5.png Binary files differnew file mode 100644 index 0000000000..6c05b315b6 --- /dev/null +++ b/src/resources/assets/miscutils/textures/blocks/iconsets/Grinder/GRINDER5.png diff --git a/src/resources/assets/miscutils/textures/blocks/iconsets/Grinder/GRINDER6.png b/src/resources/assets/miscutils/textures/blocks/iconsets/Grinder/GRINDER6.png Binary files differnew file mode 100644 index 0000000000..d4a3888fe5 --- /dev/null +++ b/src/resources/assets/miscutils/textures/blocks/iconsets/Grinder/GRINDER6.png diff --git a/src/resources/assets/miscutils/textures/blocks/iconsets/Grinder/GRINDER7.png b/src/resources/assets/miscutils/textures/blocks/iconsets/Grinder/GRINDER7.png Binary files differnew file mode 100644 index 0000000000..8346cccf41 --- /dev/null +++ b/src/resources/assets/miscutils/textures/blocks/iconsets/Grinder/GRINDER7.png diff --git a/src/resources/assets/miscutils/textures/blocks/iconsets/Grinder/GRINDER8.png b/src/resources/assets/miscutils/textures/blocks/iconsets/Grinder/GRINDER8.png Binary files differnew file mode 100644 index 0000000000..31bbffb4d4 --- /dev/null +++ b/src/resources/assets/miscutils/textures/blocks/iconsets/Grinder/GRINDER8.png diff --git a/src/resources/assets/miscutils/textures/blocks/iconsets/Grinder/GRINDER9.png b/src/resources/assets/miscutils/textures/blocks/iconsets/Grinder/GRINDER9.png Binary files differnew file mode 100644 index 0000000000..0858b2d399 --- /dev/null +++ b/src/resources/assets/miscutils/textures/blocks/iconsets/Grinder/GRINDER9.png diff --git a/src/resources/assets/miscutils/textures/blocks/iconsets/Grinder/GRINDER_ACTIVE1.png b/src/resources/assets/miscutils/textures/blocks/iconsets/Grinder/GRINDER_ACTIVE1.png Binary files differnew file mode 100644 index 0000000000..1bc399315d --- /dev/null +++ b/src/resources/assets/miscutils/textures/blocks/iconsets/Grinder/GRINDER_ACTIVE1.png diff --git a/src/resources/assets/miscutils/textures/blocks/iconsets/Grinder/GRINDER_ACTIVE1.png.mcmeta b/src/resources/assets/miscutils/textures/blocks/iconsets/Grinder/GRINDER_ACTIVE1.png.mcmeta new file mode 100644 index 0000000000..d746756cbd --- /dev/null +++ b/src/resources/assets/miscutils/textures/blocks/iconsets/Grinder/GRINDER_ACTIVE1.png.mcmeta @@ -0,0 +1,3 @@ +{ + "animation":{} +}
\ No newline at end of file diff --git a/src/resources/assets/miscutils/textures/blocks/iconsets/Grinder/GRINDER_ACTIVE2.png b/src/resources/assets/miscutils/textures/blocks/iconsets/Grinder/GRINDER_ACTIVE2.png Binary files differnew file mode 100644 index 0000000000..32ea4edd45 --- /dev/null +++ b/src/resources/assets/miscutils/textures/blocks/iconsets/Grinder/GRINDER_ACTIVE2.png diff --git a/src/resources/assets/miscutils/textures/blocks/iconsets/Grinder/GRINDER_ACTIVE2.png.mcmeta b/src/resources/assets/miscutils/textures/blocks/iconsets/Grinder/GRINDER_ACTIVE2.png.mcmeta new file mode 100644 index 0000000000..d746756cbd --- /dev/null +++ b/src/resources/assets/miscutils/textures/blocks/iconsets/Grinder/GRINDER_ACTIVE2.png.mcmeta @@ -0,0 +1,3 @@ +{ + "animation":{} +}
\ No newline at end of file diff --git a/src/resources/assets/miscutils/textures/blocks/iconsets/Grinder/GRINDER_ACTIVE3.png b/src/resources/assets/miscutils/textures/blocks/iconsets/Grinder/GRINDER_ACTIVE3.png Binary files differnew file mode 100644 index 0000000000..eb530ffb75 --- /dev/null +++ b/src/resources/assets/miscutils/textures/blocks/iconsets/Grinder/GRINDER_ACTIVE3.png diff --git a/src/resources/assets/miscutils/textures/blocks/iconsets/Grinder/GRINDER_ACTIVE3.png.mcmeta b/src/resources/assets/miscutils/textures/blocks/iconsets/Grinder/GRINDER_ACTIVE3.png.mcmeta new file mode 100644 index 0000000000..d746756cbd --- /dev/null +++ b/src/resources/assets/miscutils/textures/blocks/iconsets/Grinder/GRINDER_ACTIVE3.png.mcmeta @@ -0,0 +1,3 @@ +{ + "animation":{} +}
\ No newline at end of file diff --git a/src/resources/assets/miscutils/textures/blocks/iconsets/Grinder/GRINDER_ACTIVE4.pdn b/src/resources/assets/miscutils/textures/blocks/iconsets/Grinder/GRINDER_ACTIVE4.pdn Binary files differnew file mode 100644 index 0000000000..3c8bbeb696 --- /dev/null +++ b/src/resources/assets/miscutils/textures/blocks/iconsets/Grinder/GRINDER_ACTIVE4.pdn diff --git a/src/resources/assets/miscutils/textures/blocks/iconsets/Grinder/GRINDER_ACTIVE4.png b/src/resources/assets/miscutils/textures/blocks/iconsets/Grinder/GRINDER_ACTIVE4.png Binary files differnew file mode 100644 index 0000000000..1050d78b01 --- /dev/null +++ b/src/resources/assets/miscutils/textures/blocks/iconsets/Grinder/GRINDER_ACTIVE4.png diff --git a/src/resources/assets/miscutils/textures/blocks/iconsets/Grinder/GRINDER_ACTIVE4.png.mcmeta b/src/resources/assets/miscutils/textures/blocks/iconsets/Grinder/GRINDER_ACTIVE4.png.mcmeta new file mode 100644 index 0000000000..d746756cbd --- /dev/null +++ b/src/resources/assets/miscutils/textures/blocks/iconsets/Grinder/GRINDER_ACTIVE4.png.mcmeta @@ -0,0 +1,3 @@ +{ + "animation":{} +}
\ No newline at end of file diff --git a/src/resources/assets/miscutils/textures/blocks/iconsets/Grinder/GRINDER_ACTIVE5.png b/src/resources/assets/miscutils/textures/blocks/iconsets/Grinder/GRINDER_ACTIVE5.png Binary files differnew file mode 100644 index 0000000000..b59c940f5e --- /dev/null +++ b/src/resources/assets/miscutils/textures/blocks/iconsets/Grinder/GRINDER_ACTIVE5.png diff --git a/src/resources/assets/miscutils/textures/blocks/iconsets/Grinder/GRINDER_ACTIVE5.png.mcmeta b/src/resources/assets/miscutils/textures/blocks/iconsets/Grinder/GRINDER_ACTIVE5.png.mcmeta new file mode 100644 index 0000000000..d746756cbd --- /dev/null +++ b/src/resources/assets/miscutils/textures/blocks/iconsets/Grinder/GRINDER_ACTIVE5.png.mcmeta @@ -0,0 +1,3 @@ +{ + "animation":{} +}
\ No newline at end of file diff --git a/src/resources/assets/miscutils/textures/blocks/iconsets/Grinder/GRINDER_ACTIVE6.png b/src/resources/assets/miscutils/textures/blocks/iconsets/Grinder/GRINDER_ACTIVE6.png Binary files differnew file mode 100644 index 0000000000..8bde3ca423 --- /dev/null +++ b/src/resources/assets/miscutils/textures/blocks/iconsets/Grinder/GRINDER_ACTIVE6.png diff --git a/src/resources/assets/miscutils/textures/blocks/iconsets/Grinder/GRINDER_ACTIVE6.png.mcmeta b/src/resources/assets/miscutils/textures/blocks/iconsets/Grinder/GRINDER_ACTIVE6.png.mcmeta new file mode 100644 index 0000000000..d746756cbd --- /dev/null +++ b/src/resources/assets/miscutils/textures/blocks/iconsets/Grinder/GRINDER_ACTIVE6.png.mcmeta @@ -0,0 +1,3 @@ +{ + "animation":{} +}
\ No newline at end of file diff --git a/src/resources/assets/miscutils/textures/blocks/iconsets/Grinder/GRINDER_ACTIVE7.png b/src/resources/assets/miscutils/textures/blocks/iconsets/Grinder/GRINDER_ACTIVE7.png Binary files differnew file mode 100644 index 0000000000..1b1b12db3b --- /dev/null +++ b/src/resources/assets/miscutils/textures/blocks/iconsets/Grinder/GRINDER_ACTIVE7.png diff --git a/src/resources/assets/miscutils/textures/blocks/iconsets/Grinder/GRINDER_ACTIVE7.png.mcmeta b/src/resources/assets/miscutils/textures/blocks/iconsets/Grinder/GRINDER_ACTIVE7.png.mcmeta new file mode 100644 index 0000000000..d746756cbd --- /dev/null +++ b/src/resources/assets/miscutils/textures/blocks/iconsets/Grinder/GRINDER_ACTIVE7.png.mcmeta @@ -0,0 +1,3 @@ +{ + "animation":{} +}
\ No newline at end of file diff --git a/src/resources/assets/miscutils/textures/blocks/iconsets/Grinder/GRINDER_ACTIVE8.png b/src/resources/assets/miscutils/textures/blocks/iconsets/Grinder/GRINDER_ACTIVE8.png Binary files differnew file mode 100644 index 0000000000..da672b0e24 --- /dev/null +++ b/src/resources/assets/miscutils/textures/blocks/iconsets/Grinder/GRINDER_ACTIVE8.png diff --git a/src/resources/assets/miscutils/textures/blocks/iconsets/Grinder/GRINDER_ACTIVE8.png.mcmeta b/src/resources/assets/miscutils/textures/blocks/iconsets/Grinder/GRINDER_ACTIVE8.png.mcmeta new file mode 100644 index 0000000000..d746756cbd --- /dev/null +++ b/src/resources/assets/miscutils/textures/blocks/iconsets/Grinder/GRINDER_ACTIVE8.png.mcmeta @@ -0,0 +1,3 @@ +{ + "animation":{} +}
\ No newline at end of file diff --git a/src/resources/assets/miscutils/textures/blocks/iconsets/Grinder/GRINDER_ACTIVE9.png b/src/resources/assets/miscutils/textures/blocks/iconsets/Grinder/GRINDER_ACTIVE9.png Binary files differnew file mode 100644 index 0000000000..f082c94c55 --- /dev/null +++ b/src/resources/assets/miscutils/textures/blocks/iconsets/Grinder/GRINDER_ACTIVE9.png diff --git a/src/resources/assets/miscutils/textures/blocks/iconsets/Grinder/GRINDER_ACTIVE9.png.mcmeta b/src/resources/assets/miscutils/textures/blocks/iconsets/Grinder/GRINDER_ACTIVE9.png.mcmeta new file mode 100644 index 0000000000..d746756cbd --- /dev/null +++ b/src/resources/assets/miscutils/textures/blocks/iconsets/Grinder/GRINDER_ACTIVE9.png.mcmeta @@ -0,0 +1,3 @@ +{ + "animation":{} +}
\ No newline at end of file diff --git a/src/resources/assets/miscutils/textures/items/MU-metaitem.01/151.png b/src/resources/assets/miscutils/textures/items/MU-metaitem.01/151.png Binary files differnew file mode 100644 index 0000000000..29ba464570 --- /dev/null +++ b/src/resources/assets/miscutils/textures/items/MU-metaitem.01/151.png diff --git a/src/resources/assets/miscutils/textures/items/MU-metaitem.01/160.png b/src/resources/assets/miscutils/textures/items/MU-metaitem.01/160.png Binary files differnew file mode 100644 index 0000000000..fa7f814d3a --- /dev/null +++ b/src/resources/assets/miscutils/textures/items/MU-metaitem.01/160.png diff --git a/src/resources/assets/miscutils/textures/items/MU-metaitem.01/161.png b/src/resources/assets/miscutils/textures/items/MU-metaitem.01/161.png Binary files differnew file mode 100644 index 0000000000..673c6e011b --- /dev/null +++ b/src/resources/assets/miscutils/textures/items/MU-metaitem.01/161.png diff --git a/src/resources/assets/miscutils/textures/items/MU-metaitem.01/162.png b/src/resources/assets/miscutils/textures/items/MU-metaitem.01/162.png Binary files differnew file mode 100644 index 0000000000..65fc3f7d6e --- /dev/null +++ b/src/resources/assets/miscutils/textures/items/MU-metaitem.01/162.png diff --git a/src/resources/assets/miscutils/textures/items/food/MetaItem1/0.png b/src/resources/assets/miscutils/textures/items/food/MetaItem1/0.png Binary files differnew file mode 100644 index 0000000000..944ab47126 --- /dev/null +++ b/src/resources/assets/miscutils/textures/items/food/MetaItem1/0.png diff --git a/src/resources/assets/miscutils/textures/items/food/MetaItem1/1.png b/src/resources/assets/miscutils/textures/items/food/MetaItem1/1.png Binary files differnew file mode 100644 index 0000000000..2d235ca65d --- /dev/null +++ b/src/resources/assets/miscutils/textures/items/food/MetaItem1/1.png diff --git a/src/resources/assets/miscutils/textures/items/food/MetaItem1/2.png b/src/resources/assets/miscutils/textures/items/food/MetaItem1/2.png Binary files differnew file mode 100644 index 0000000000..ec81acba2c --- /dev/null +++ b/src/resources/assets/miscutils/textures/items/food/MetaItem1/2.png diff --git a/src/resources/assets/miscutils/textures/items/food/MetaItem1/3.png b/src/resources/assets/miscutils/textures/items/food/MetaItem1/3.png Binary files differnew file mode 100644 index 0000000000..1fc103297a --- /dev/null +++ b/src/resources/assets/miscutils/textures/items/food/MetaItem1/3.png diff --git a/src/resources/assets/miscutils/textures/items/food/MetaItem1/4.png b/src/resources/assets/miscutils/textures/items/food/MetaItem1/4.png Binary files differnew file mode 100644 index 0000000000..db5ddf0063 --- /dev/null +++ b/src/resources/assets/miscutils/textures/items/food/MetaItem1/4.png diff --git a/src/resources/assets/miscutils/textures/items/food/MetaItem1/5.png b/src/resources/assets/miscutils/textures/items/food/MetaItem1/5.png Binary files differnew file mode 100644 index 0000000000..2497c88e2d --- /dev/null +++ b/src/resources/assets/miscutils/textures/items/food/MetaItem1/5.png diff --git a/src/resources/assets/miscutils/textures/items/food/MetaItem1/6.png b/src/resources/assets/miscutils/textures/items/food/MetaItem1/6.png Binary files differnew file mode 100644 index 0000000000..083db84ef1 --- /dev/null +++ b/src/resources/assets/miscutils/textures/items/food/MetaItem1/6.png diff --git a/src/resources/assets/miscutils/textures/items/food/MetaItem1/7.png b/src/resources/assets/miscutils/textures/items/food/MetaItem1/7.png Binary files differnew file mode 100644 index 0000000000..27927d0db6 --- /dev/null +++ b/src/resources/assets/miscutils/textures/items/food/MetaItem1/7.png diff --git a/src/resources/assets/miscutils/textures/items/food/MetaItem1/8.png b/src/resources/assets/miscutils/textures/items/food/MetaItem1/8.png Binary files differnew file mode 100644 index 0000000000..7013c41d6b --- /dev/null +++ b/src/resources/assets/miscutils/textures/items/food/MetaItem1/8.png diff --git a/src/resources/assets/miscutils/textures/items/processing/MilledOre/milled.png b/src/resources/assets/miscutils/textures/items/processing/MilledOre/milled.png Binary files differnew file mode 100644 index 0000000000..2c56204a7e --- /dev/null +++ b/src/resources/assets/miscutils/textures/items/processing/MilledOre/milled.png diff --git a/src/resources/assets/miscutils/textures/items/processing/MilledOre/milled_OVERLAY.png b/src/resources/assets/miscutils/textures/items/processing/MilledOre/milled_OVERLAY.png Binary files differnew file mode 100644 index 0000000000..cfec0f5d8e --- /dev/null +++ b/src/resources/assets/miscutils/textures/items/processing/MilledOre/milled_OVERLAY.png diff --git a/src/resources/assets/miscutils/textures/items/science/general/MetaItem1/7.png b/src/resources/assets/miscutils/textures/items/science/general/MetaItem1/7.png Binary files differnew file mode 100644 index 0000000000..985954250c --- /dev/null +++ b/src/resources/assets/miscutils/textures/items/science/general/MetaItem1/7.png diff --git a/src/resources/assets/miscutils/textures/items/science/general/MetaItem1/8.png b/src/resources/assets/miscutils/textures/items/science/general/MetaItem1/8.png Binary files differnew file mode 100644 index 0000000000..9b857a9277 --- /dev/null +++ b/src/resources/assets/miscutils/textures/items/science/general/MetaItem1/8.png |