From f39e8134fcef5da8bd04503c5233b2b6de249b3a Mon Sep 17 00:00:00 2001 From: Alkalus Date: Sat, 28 Mar 2020 02:09:24 +0000 Subject: + Added more 'Special Behaviour' items for my multiblocks as Examples. + Added '/gtpp hand' command. + Added TungstenSteel & Neutronium tool variants to NEI while in dev. + Added Large Semifluid Generator and a crafting recipe for it. + Added Placeholder for Adv. Assembly Line. + Added Distillus Upgrade Chip and a crafting recipe for it. % Updated build.gradle. % Reworked a few recipes. $ Fixed ULV Overflow Covers using 0L Water in assembler. (https://github.com/GTNewHorizons/NewHorizons/issues/5700) $ Fixed Integral Encasement I using 0L Steel in assembler. (https://github.com/GTNewHorizons/NewHorizons/issues/5617) $ Fixed Thaumcraft based FakePlayer's triggering Fluorite drops. (https://github.com/GTNewHorizons/NewHorizons/issues/5744) $ Fixed bad handling of hatch textures on a few multiblocks. $ Semi-Fixed Distillus. $ Fixed Semifluid Generator recipes. $ Fixed Semifluid Generators crashing the game when mined. $ Fixed bad handling of calls to ItemList.java. $ Began work fixing all ASM to be more compatible with ProGuard. $ Fixed compiler complaining about varargs. ^ Bumped version to 1.7.05.x. --- src/Java/gtPlusPlus/preloader/CORE_Preloader.java | 24 +- src/Java/gtPlusPlus/preloader/DevHelper.java | 181 +++++++---- .../gtPlusPlus/preloader/Preloader_Logger.java | 60 ++++ src/Java/gtPlusPlus/preloader/asm/AsmConfig.java | 29 +- .../preloader/asm/ClassesToTransform.java | 74 +++++ .../preloader/asm/Preloader_DummyContainer.java | 43 ++- .../preloader/asm/Preloader_FMLLoadingPlugin.java | 35 +- .../preloader/asm/Preloader_SetupClass.java | 23 ++ .../preloader/asm/helpers/MethodHelper_GT.java | 25 ++ ...ransformer_GT_BlockMachines_MetaPipeEntity.java | 3 +- .../transformers/ClassTransformer_GT_BusPatch.java | 105 +++--- .../transformers/ClassTransformer_GT_Client.java | 13 +- .../ClassTransformer_GT_MetaGenerated_Tool.java | 116 +++++++ .../transformers/ClassTransformer_GT_Utility.java | 6 +- .../transformers/Preloader_ClassTransformer2.java | 352 --------------------- .../Preloader_Transformer_Handler.java | 213 ++++++------- 16 files changed, 702 insertions(+), 600 deletions(-) create mode 100644 src/Java/gtPlusPlus/preloader/Preloader_Logger.java create mode 100644 src/Java/gtPlusPlus/preloader/asm/ClassesToTransform.java create mode 100644 src/Java/gtPlusPlus/preloader/asm/Preloader_SetupClass.java create mode 100644 src/Java/gtPlusPlus/preloader/asm/helpers/MethodHelper_GT.java create mode 100644 src/Java/gtPlusPlus/preloader/asm/transformers/ClassTransformer_GT_MetaGenerated_Tool.java (limited to 'src/Java/gtPlusPlus/preloader') diff --git a/src/Java/gtPlusPlus/preloader/CORE_Preloader.java b/src/Java/gtPlusPlus/preloader/CORE_Preloader.java index b8ebdaf49c..e7101bc025 100644 --- a/src/Java/gtPlusPlus/preloader/CORE_Preloader.java +++ b/src/Java/gtPlusPlus/preloader/CORE_Preloader.java @@ -1,14 +1,32 @@ 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 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 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 deps = new ArrayList(); + //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 srgToForge = new HashMap(); - public static Map forgeToSrg = new HashMap(); + public static final Map srgToForge = new HashMap(); + public static final Map forgeToSrg = new HashMap(); private static WeakAutoMap> mInitMap = new WeakAutoMap>(); //Obfuscation - public static Map obToDeOb = new HashMap(); - public static Map deObToOb = new HashMap(); + public static final Map obToDeOb = new HashMap(); + public static final Map deObToOb = new HashMap(); private static WeakAutoMap> mObInitMap = new WeakAutoMap>(); 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 aMissingForgeNames = new HashMap(); + HashMap aMissingSrgNames = new HashMap(); + 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 aMissingObfNames = new HashMap(); + HashMap aMissingDeObfNames = new HashMap(); + 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("bmg", "net/minecraft/client/shader/Framebuffer")); mObInitMap.put(new Pair("na", "net/minecraft/client/network/NetHandlerHandshakeMemory")); mObInitMap - .put(new Pair("jb", "net/minecraft/network/play/client/C02PacketUseEntity$Action")); + .put(new Pair("jb", "net/minecraft/network/play/client/C02PacketUseEntity$Action")); mObInitMap.put(new Pair("fc", "net/minecraft/util/MessageDeserializer2")); mObInitMap.put(new Pair("bd", "net/minecraft/command/server/CommandPardonIp")); mObInitMap.put(new Pair("amw", "net/minecraft/block/BlockPumpkin")); @@ -5104,7 +5179,7 @@ public class DevHelper { mObInitMap.put(new Pair("tl", "net/minecraft/entity/ai/attributes/BaseAttributeMap")); mObInitMap.put(new Pair("pm", "net/minecraft/stats/IStatType")); mObInitMap - .put(new Pair("atc", "net/minecraft/world/gen/structure/StructureMineshaftStart")); + .put(new Pair("atc", "net/minecraft/world/gen/structure/StructureMineshaftStart")); mObInitMap.put(new Pair("apd", "net/minecraft/tileentity/TileEntityEnchantmentTable")); mObInitMap.put(new Pair("ale", "net/minecraft/block/BlockFurnace")); mObInitMap.put(new Pair("adg", "net/minecraft/item/ItemLeaves")); @@ -5112,7 +5187,7 @@ public class DevHelper { mObInitMap.put(new Pair("axb", "net/minecraft/world/gen/layer/GenLayerAddIsland")); mObInitMap.put(new Pair("bpg", "net/minecraft/client/util/JsonBlendingMode")); mObInitMap - .put(new Pair("net/minecraft/realms/RealmsMth", "net/minecraft/realms/RealmsMth")); + .put(new Pair("net/minecraft/realms/RealmsMth", "net/minecraft/realms/RealmsMth")); mObInitMap.put(new Pair("qa", "net/minecraft/util/IntHashMap$Entry")); mObInitMap.put(new Pair("mb", "net/minecraft/server/gui/MinecraftServerGui$3")); mObInitMap.put( @@ -5262,13 +5337,13 @@ public class DevHelper { mObInitMap.put(new Pair("aaw", "net/minecraft/inventory/InventoryCraftResult")); mObInitMap.put(new Pair("w", "net/minecraft/client/audio/SoundCategory")); mObInitMap - .put(new Pair("bqv", "net/minecraft/client/resources/IReloadableResourceManager")); + .put(new Pair("bqv", "net/minecraft/client/resources/IReloadableResourceManager")); mObInitMap.put(new Pair("baz", "net/minecraft/client/Minecraft$3")); mObInitMap.put(new Pair("bey", "net/minecraft/client/gui/GuiRepair")); mObInitMap.put(new Pair("bix", "net/minecraft/client/model/ModelRenderer")); mObInitMap.put(new Pair("bmw", "net/minecraft/client/renderer/culling/ClippingHelperImpl")); mObInitMap - .put(new Pair("fs", "net/minecraft/util/ChatComponentTranslationFormatException")); + .put(new Pair("fs", "net/minecraft/util/ChatComponentTranslationFormatException")); mObInitMap.put(new Pair("bt", "net/minecraft/command/server/CommandStop")); mObInitMap.put(new Pair("yy", "net/minecraft/entity/player/InventoryPlayer$1")); mObInitMap.put(new Pair("uz", "net/minecraft/entity/ai/EntityAIPanic")); @@ -5290,7 +5365,7 @@ public class DevHelper { mObInitMap.put( new Pair("np", "net/minecraft/server/network/NetHandlerLoginServer$LoginState")); mObInitMap - .put(new Pair("jq", "net/minecraft/network/handshake/INetHandlerHandshakeServer")); + .put(new Pair("jq", "net/minecraft/network/handshake/INetHandlerHandshakeServer")); mObInitMap.put(new Pair("fr", "net/minecraft/util/ChatComponentTranslation")); mObInitMap.put(new Pair("arf", "net/minecraft/world/gen/feature/WorldGenBlockBlob")); mObInitMap.put(new Pair("ang", "net/minecraft/block/BlockRotatedPillar")); @@ -5300,7 +5375,7 @@ public class DevHelper { mObInitMap.put(new Pair("ave", "net/minecraft/world/gen/structure/MapGenStructure")); mObInitMap.put(new Pair("azd", "net/minecraft/client/AnvilConverterException")); mObInitMap - .put(new Pair("net/minecraft/client/main/Main", "net/minecraft/client/main/Main")); + .put(new Pair("net/minecraft/client/main/Main", "net/minecraft/client/main/Main")); mObInitMap.put(new Pair("bri", "net/minecraft/client/resources/SimpleResource")); mObInitMap.put(new Pair("bfl", "net/minecraft/client/gui/inventory/GuiContainerCreative")); mObInitMap.put(new Pair("bjk", "net/minecraft/client/entity/EntityClientPlayerMP")); @@ -5310,7 +5385,7 @@ public class DevHelper { mObInitMap.put(new Pair("od", "net/minecraft/server/management/PreYggdrasilConverter$4")); mObInitMap.put(new Pair("ke", "net/minecraft/network/ServerStatusResponse$Serializer")); mObInitMap - .put(new Pair("gf", "net/minecraft/network/play/server/S35PacketUpdateTileEntity")); + .put(new Pair("gf", "net/minecraft/network/play/server/S35PacketUpdateTileEntity")); mObInitMap.put(new Pair("cg", "net/minecraft/command/PlayerNotFoundException")); mObInitMap.put(new Pair("ary", "net/minecraft/world/gen/feature/WorldGenGlowStone1")); mObInitMap.put(new Pair("anz", "net/minecraft/block/BlockTallGrass")); @@ -5353,7 +5428,7 @@ public class DevHelper { mObInitMap.put(new Pair("btc", "net/minecraft/client/network/LanServerDetector$ThreadLanServerFind")); mObInitMap - .put(new Pair("bpd", "net/minecraft/client/renderer/tileentity/RenderWitherSkull")); + .put(new Pair("bpd", "net/minecraft/client/renderer/tileentity/RenderWitherSkull")); mObInitMap.put(new Pair("bhf", "net/minecraft/client/model/ModelBook")); mObInitMap.put(new Pair("ble", "net/minecraft/client/particle/EntityFishWakeFX")); mObInitMap.put(new Pair("ea", "net/minecraft/nbt/NBTException")); @@ -5397,11 +5472,11 @@ public class DevHelper { mObInitMap.put(new Pair("aye", "net/minecraft/pathfinding/PathPoint")); mObInitMap.put(new Pair("bbc", "net/minecraft/client/Minecraft$6")); mObInitMap - .put(new Pair("bfb", "net/minecraft/client/gui/inventory/GuiBeacon$ConfirmButton")); + .put(new Pair("bfb", "net/minecraft/client/gui/inventory/GuiBeacon$ConfirmButton")); mObInitMap.put(new Pair("bui", "net/minecraft/client/stream/IngestServerTester")); mObInitMap.put(new Pair("bqj", "net/minecraft/client/renderer/texture/ITickable")); mObInitMap - .put(new Pair("zb", "net/minecraft/entity/player/EntityPlayer$EnumChatVisibility")); + .put(new Pair("zb", "net/minecraft/entity/player/EntityPlayer$EnumChatVisibility")); mObInitMap.put(new Pair("vc", "net/minecraft/entity/ai/EntityAIWander")); mObInitMap.put(new Pair("rd", "net/minecraft/world/EnumDifficulty")); mObInitMap.put(new Pair("ne", "net/minecraft/network/NetworkSystem$2")); @@ -5428,7 +5503,7 @@ public class DevHelper { mObInitMap.put(new Pair("brq", "net/minecraft/client/resources/Language")); mObInitMap.put(new Pair("bbu", "net/minecraft/client/gui/FontRenderer")); mObInitMap - .put(new Pair("bft", "net/minecraft/client/gui/inventory/GuiScreenHorseInventory")); + .put(new Pair("bft", "net/minecraft/client/gui/inventory/GuiScreenHorseInventory")); mObInitMap.put(new Pair("bjs", "net/minecraft/client/network/OldServerPinger$2")); mObInitMap.put(new Pair("bnr", "net/minecraft/client/renderer/entity/RenderFireball")); mObInitMap.put(new Pair("sk", "net/minecraft/command/IEntitySelector$1")); @@ -5554,14 +5629,14 @@ public class DevHelper { "net/minecraft/world/gen/structure/StructureStrongholdPieces$Straight")); mObInitMap.put(new Pair("bnz", "net/minecraft/client/renderer/entity/RenderItem$1")); mObInitMap - .put(new Pair("gv", "net/minecraft/network/play/server/S2BPacketChangeGameState")); + .put(new Pair("gv", "net/minecraft/network/play/server/S2BPacketChangeGameState")); mObInitMap.put(new Pair("cw", "net/minecraft/util/RegistryNamespaced")); mObInitMap.put(new Pair("net/minecraft/realms/RealmsScrolledSelectionList", "net/minecraft/realms/RealmsScrolledSelectionList")); mObInitMap.put(new Pair("aru", "net/minecraft/world/gen/feature/WorldGenBigMushroom")); mObInitMap.put(new Pair("anv", "net/minecraft/block/BlockStone")); mObInitMap - .put(new Pair("afx", "net/minecraft/enchantment/EnchantmentHelper$DamageIterator")); + .put(new Pair("afx", "net/minecraft/enchantment/EnchantmentHelper$DamageIterator")); mObInitMap.put(new Pair("ajw", "net/minecraft/block/BlockCauldron")); mObInitMap.put( new Pair("avt", "net/minecraft/world/gen/structure/StructureVillagePieces$Torch")); @@ -5569,7 +5644,7 @@ public class DevHelper { mObInitMap.put(new Pair("bcq", "net/minecraft/client/gui/GuiScreenRealmsProxy")); mObInitMap.put(new Pair("bgp", "net/minecraft/client/gui/stream/GuiStreamUnavailable")); mObInitMap - .put(new Pair("brx", "net/minecraft/client/resources/data/IMetadataSerializer$1")); + .put(new Pair("brx", "net/minecraft/client/resources/data/IMetadataSerializer$1")); mObInitMap.put(new Pair("wq", "net/minecraft/entity/passive/EntitySheep$1")); mObInitMap.put(new Pair("sr", "net/minecraft/entity/EntityFlying")); mObInitMap.put(new Pair("os", "net/minecraft/server/management/UserListWhitelistEntry")); @@ -5635,7 +5710,7 @@ public class DevHelper { "net/minecraft/world/gen/structure/ComponentScatteredFeaturePieces$JunglePyramid")); mObInitMap.put(new Pair("ayb", "net/minecraft/world/gen/layer/GenLayerVoronoiZoom")); mObInitMap - .put(new Pair("buf", "net/minecraft/client/stream/ChatController$SwitchChatState")); + .put(new Pair("buf", "net/minecraft/client/stream/ChatController$SwitchChatState")); mObInitMap.put(new Pair("bqg", "net/minecraft/client/renderer/texture/TextureManager$1")); mObInitMap.put(new Pair("bii", "net/minecraft/client/model/PositionTextureVertex")); mObInitMap.put(new Pair("bmh", "net/minecraft/client/renderer/Tessellator")); @@ -5670,7 +5745,7 @@ public class DevHelper { mObInitMap.put(new Pair("net/minecraft/realms/RealmsLevelSummary", "net/minecraft/realms/RealmsLevelSummary")); mObInitMap - .put(new Pair("gk", "net/minecraft/network/play/server/S22PacketMultiBlockChange")); + .put(new Pair("gk", "net/minecraft/network/play/server/S22PacketMultiBlockChange")); mObInitMap.put(new Pair("cl", "net/minecraft/block/BlockSourceImpl")); mObInitMap.put(new Pair("vr", "net/minecraft/entity/ai/EntityAITargetNonTamed")); mObInitMap.put(new Pair("rs", "net/minecraft/potion/PotionAttackDamage")); @@ -5688,7 +5763,7 @@ public class DevHelper { mObInitMap.put(new Pair("gj", "net/minecraft/network/play/server/S02PacketChat")); mObInitMap.put(new Pair("acb", "net/minecraft/creativetab/CreativeTabs$5")); mObInitMap - .put(new Pair("aga", "net/minecraft/enchantment/EnchantmentHelper$ModifierLiving")); + .put(new Pair("aga", "net/minecraft/enchantment/EnchantmentHelper$ModifierLiving")); mObInitMap.put( new Pair("bsa", "net/minecraft/client/resources/data/AnimationMetadataSection")); mObInitMap.put(new Pair("bkc", "net/minecraft/client/particle/EntityFireworkOverlayFX")); @@ -5710,7 +5785,7 @@ public class DevHelper { mObInitMap.put(new Pair("po", "net/minecraft/util/IJsonSerializable")); mObInitMap.put(new Pair("lp", "net/minecraft/scoreboard/ServerScoreboard")); mObInitMap - .put(new Pair("hq", "net/minecraft/network/play/server/S13PacketDestroyEntities")); + .put(new Pair("hq", "net/minecraft/network/play/server/S13PacketDestroyEntities")); mObInitMap.put(new Pair("dr", "net/minecraft/nbt/NBTTagLong")); mObInitMap.put(new Pair("adi", "net/minecraft/item/ItemBucketMilk")); mObInitMap.put(new Pair("ahh", "net/minecraft/world/IWorldAccess")); @@ -5812,7 +5887,7 @@ public class DevHelper { mObInitMap.put(new Pair("acj", "net/minecraft/item/ItemDye")); mObInitMap.put(new Pair("agi", "net/minecraft/enchantment/EnchantmentProtection")); mObInitMap - .put(new Pair("bsi", "net/minecraft/client/resources/data/TextureMetadataSection")); + .put(new Pair("bsi", "net/minecraft/client/resources/data/TextureMetadataSection")); mObInitMap.put(new Pair("bcm", "net/minecraft/client/gui/GuiSlot")); mObInitMap.put(new Pair("bgl", "net/minecraft/client/gui/GuiResourcePackSelected")); mObInitMap.put(new Pair("bkk", "net/minecraft/client/particle/EntityLavaFX")); @@ -5832,7 +5907,7 @@ public class DevHelper { mObInitMap.put(new Pair("xa", "net/minecraft/entity/boss/EntityDragon")); mObInitMap.put(new Pair("tb", "net/minecraft/entity/item/EntityPainting")); mObInitMap - .put(new Pair("asx", "net/minecraft/world/gen/structure/StructureMineshaftPieces")); + .put(new Pair("asx", "net/minecraft/world/gen/structure/StructureMineshaftPieces")); mObInitMap.put(new Pair("aoy", "net/minecraft/tileentity/TileEntityCommandBlock$1")); mObInitMap.put(new Pair("akz", "net/minecraft/block/BlockFence")); mObInitMap.put(new Pair("aww", "net/minecraft/block/material/MaterialPortal")); @@ -5861,7 +5936,7 @@ public class DevHelper { "net/minecraft/realms/RealmsServerStatusPinger")); mObInitMap.put(new Pair("mk", "net/minecraft/world/demo/DemoWorldServer")); mObInitMap - .put(new Pair("il", "net/minecraft/network/play/server/S20PacketEntityProperties")); + .put(new Pair("il", "net/minecraft/network/play/server/S20PacketEntityProperties")); mObInitMap.put(new Pair("em", "net/minecraft/network/NetworkManager$3")); mObInitMap.put(new Pair("an", "net/minecraft/command/server/CommandEmote")); mObInitMap.put(new Pair("aqa", "net/minecraft/world/chunk/storage/NibbleArrayReader")); @@ -5997,12 +6072,12 @@ public class DevHelper { mObInitMap.put(new Pair("axr", "net/minecraft/world/gen/layer/GenLayerHills")); mObInitMap.put(new Pair("bap", "net/minecraft/client/Minecraft$1")); mObInitMap - .put(new Pair("beo", "net/minecraft/client/gui/achievement/GuiStats$StatsItem$1")); + .put(new Pair("beo", "net/minecraft/client/gui/achievement/GuiStats$StatsItem$1")); mObInitMap.put(new Pair("bin", "net/minecraft/client/model/ModelWither")); mObInitMap.put(new Pair("bmm", "net/minecraft/client/renderer/tileentity/TileEntityChestRenderer")); mObInitMap - .put(new Pair("jh", "net/minecraft/network/play/client/C13PacketPlayerAbilities")); + .put(new Pair("jh", "net/minecraft/network/play/client/C13PacketPlayerAbilities")); mObInitMap.put(new Pair("fi", "net/minecraft/event/ClickEvent$Action")); mObInitMap.put(new Pair("bj", "net/minecraft/command/server/CommandSaveOn")); mObInitMap.put(new Pair("yo", "net/minecraft/entity/monster/EntitySpider$GroupData")); @@ -6058,7 +6133,7 @@ public class DevHelper { mObInitMap.put(new Pair("avm", "net/minecraft/world/gen/structure/StructureStart")); mObInitMap.put(new Pair("bcj", "net/minecraft/client/gui/GuiOptionButton")); mObInitMap - .put(new Pair("bgi", "net/minecraft/client/resources/ResourcePackListEntryFound")); + .put(new Pair("bgi", "net/minecraft/client/resources/ResourcePackListEntryFound")); mObInitMap.put(new Pair("bkh", "net/minecraft/client/particle/EntityHeartFX")); mObInitMap.put(new Pair("bog", "net/minecraft/client/renderer/entity/RenderLightningBolt")); mObInitMap.put(new Pair("lb", "net/minecraft/client/util/JsonException")); @@ -6153,7 +6228,7 @@ public class DevHelper { mObInitMap.put(new Pair("sa", "net/minecraft/entity/Entity")); mObInitMap.put(new Pair("ob", "net/minecraft/server/management/PreYggdrasilConverter$2")); mObInitMap - .put(new Pair("kc", "net/minecraft/network/ServerStatusResponse$PlayerCountData")); + .put(new Pair("kc", "net/minecraft/network/ServerStatusResponse$PlayerCountData")); mObInitMap.put(new Pair("gd", "net/minecraft/network/play/server/S37PacketStatistics")); mObInitMap.put(new Pair("ce", "net/minecraft/command/NumberInvalidException")); mObInitMap.put(new Pair("net/minecraft/realms/Realms", "net/minecraft/realms/Realms")); @@ -6223,7 +6298,7 @@ public class DevHelper { mObInitMap.put(new Pair("axo", "net/minecraft/world/gen/layer/GenLayer$1")); mObInitMap.put(new Pair("bam", "net/minecraft/client/renderer/RenderHelper")); mObInitMap - .put(new Pair("bel", "net/minecraft/client/gui/achievement/GuiStats$StatsBlock$1")); + .put(new Pair("bel", "net/minecraft/client/gui/achievement/GuiStats$StatsBlock$1")); mObInitMap.put(new Pair("bik", "net/minecraft/client/model/ModelVillager")); mObInitMap.put(new Pair("bmj", "net/minecraft/client/renderer/tileentity/TileEntityBeaconRenderer")); @@ -6289,12 +6364,12 @@ public class DevHelper { mObInitMap.put(new Pair("wg", "net/minecraft/entity/passive/EntityChicken")); mObInitMap.put(new Pair("sh", "net/minecraft/entity/EntityList$EntityEggInfo")); mObInitMap - .put(new Pair("oi", "net/minecraft/server/management/ServerConfigurationManager")); + .put(new Pair("oi", "net/minecraft/server/management/ServerConfigurationManager")); mObInitMap.put(new Pair("kj", "net/minecraft/network/status/client/C00PacketServerQuery")); mObInitMap.put(new Pair("aka", "net/minecraft/block/BlockColored")); mObInitMap.put(new Pair("acc", "net/minecraft/creativetab/CreativeTabs$6")); mObInitMap - .put(new Pair("agb", "net/minecraft/enchantment/EnchantmentHelper$ModifierDamage")); + .put(new Pair("agb", "net/minecraft/enchantment/EnchantmentHelper$ModifierDamage")); mObInitMap.put(new Pair("bsb", "net/minecraft/client/resources/data/AnimationMetadataSectionSerializer")); mObInitMap.put(new Pair("bkd", "net/minecraft/client/particle/EntityFireworkSparkFX")); @@ -6333,7 +6408,7 @@ public class DevHelper { mObInitMap.put( new Pair("net/minecraft/realms/Tezzelator", "net/minecraft/realms/Tezzelator")); mObInitMap - .put(new Pair("ate", "net/minecraft/world/gen/structure/MapGenNetherBridge$Start")); + .put(new Pair("ate", "net/minecraft/world/gen/structure/MapGenNetherBridge$Start")); mObInitMap.put(new Pair("apf", "net/minecraft/tileentity/TileEntityFlowerPot")); mObInitMap.put(new Pair("alg", "net/minecraft/block/BlockGlowstone")); mObInitMap.put(new Pair("axd", "net/minecraft/world/gen/layer/GenLayerAddSnow")); @@ -6370,7 +6445,7 @@ public class DevHelper { mObInitMap.put(new Pair("vi", "net/minecraft/entity/ai/EntityAICreeperSwell")); mObInitMap.put(new Pair("rj", "net/minecraft/profiler/PlayerUsageSnooper$1")); mObInitMap - .put(new Pair("nk", "net/minecraft/network/NetHandlerPlayServer$SwitchEnumState")); + .put(new Pair("nk", "net/minecraft/network/NetHandlerPlayServer$SwitchEnumState")); mObInitMap.put(new Pair("jl", "net/minecraft/network/play/client/C09PacketHeldItemChange")); mObInitMap.put(new Pair("fm", "net/minecraft/event/HoverEvent$Action")); mObInitMap.put(new Pair("bn", "net/minecraft/command/server/CommandSetDefaultSpawnpoint")); @@ -6438,7 +6513,7 @@ public class DevHelper { mObInitMap.put(new Pair("bdb", "net/minecraft/client/gui/GuiCreateWorld")); mObInitMap.put(new Pair("ly", "net/minecraft/server/gui/MinecraftServerGui")); mObInitMap - .put(new Pair("hz", "net/minecraft/network/play/server/S04PacketEntityEquipment")); + .put(new Pair("hz", "net/minecraft/network/play/server/S04PacketEntityEquipment")); mObInitMap.put(new Pair("asy", "net/minecraft/world/gen/structure/StructureMineshaftPieces$Corridor")); mObInitMap.put(new Pair("aoz", "net/minecraft/tileentity/TileEntityComparator")); @@ -6482,7 +6557,7 @@ public class DevHelper { mObInitMap.put(new Pair("bud", "net/minecraft/client/stream/BroadcastController$BroadcastListener")); mObInitMap - .put(new Pair("bqe", "net/minecraft/client/renderer/texture/TextureAtlasSprite$1")); + .put(new Pair("bqe", "net/minecraft/client/renderer/texture/TextureAtlasSprite$1")); mObInitMap.put(new Pair("beh", "net/minecraft/client/gui/achievement/GuiAchievement")); mObInitMap.put(new Pair("big", "net/minecraft/client/model/ModelSpider")); mObInitMap.put(new Pair("ja", "net/minecraft/network/play/client/C02PacketUseEntity")); @@ -6662,7 +6737,7 @@ public class DevHelper { mObInitMap.put(new Pair("bgj", "net/minecraft/client/gui/GuiResourcePackAvailable")); mObInitMap.put(new Pair("bki", "net/minecraft/client/particle/EntityLargeExplodeFX")); mObInitMap - .put(new Pair("boh", "net/minecraft/client/renderer/entity/RendererLivingEntity")); + .put(new Pair("boh", "net/minecraft/client/renderer/entity/RendererLivingEntity")); mObInitMap.put(new Pair("lc", "net/minecraft/client/util/JsonException$1")); mObInitMap.put(new Pair("hd", "net/minecraft/network/play/server/S01PacketJoinGame")); mObInitMap.put(new Pair("de", "net/minecraft/util/StringTranslate")); @@ -6731,7 +6806,7 @@ public class DevHelper { mObInitMap.put(new Pair("bbm", "net/minecraft/client/settings/GameSettings$Options")); mObInitMap.put(new Pair("bus", "net/minecraft/realms/RealmsConnect$1")); mObInitMap - .put(new Pair("bqt", "net/minecraft/client/resources/FoliageColorReloadListener")); + .put(new Pair("bqt", "net/minecraft/client/resources/FoliageColorReloadListener")); mObInitMap.put(new Pair("zl", "net/minecraft/entity/projectile/EntityEgg")); mObInitMap.put(new Pair("vm", "net/minecraft/entity/ai/EntityAIDefendVillage")); mObInitMap.put(new Pair("rn", "net/minecraft/util/CombatTracker")); @@ -6795,7 +6870,7 @@ public class DevHelper { mObInitMap.put(new Pair("pi", "net/minecraft/stats/StatBase$1")); mObInitMap.put(new Pair("lj", "net/minecraft/server/MinecraftServer$3")); mObInitMap - .put(new Pair("hk", "net/minecraft/network/play/server/S39PacketPlayerAbilities")); + .put(new Pair("hk", "net/minecraft/network/play/server/S39PacketPlayerAbilities")); mObInitMap.put(new Pair("dl", "net/minecraft/nbt/NBTTagEnd")); mObInitMap.put(new Pair("ala", "net/minecraft/block/BlockFenceGate")); mObInitMap.put(new Pair("adc", "net/minecraft/item/Item$ToolMaterial")); @@ -6829,7 +6904,7 @@ public class DevHelper { mObInitMap.put(new Pair("axp", "net/minecraft/world/gen/layer/GenLayer$2")); mObInitMap.put(new Pair("ban", "net/minecraft/client/renderer/GLAllocation")); mObInitMap - .put(new Pair("bem", "net/minecraft/client/gui/achievement/GuiStats$StatsGeneral")); + .put(new Pair("bem", "net/minecraft/client/gui/achievement/GuiStats$StatsGeneral")); mObInitMap.put(new Pair("bil", "net/minecraft/client/model/ModelZombieVillager")); mObInitMap.put(new Pair("bmk", "net/minecraft/client/renderer/tileentity/TileEntityRendererDispatcher")); @@ -6846,7 +6921,7 @@ public class DevHelper { mObInitMap.put(new Pair("ayd", "net/minecraft/pathfinding/Path")); mObInitMap.put(new Pair("bbb", "net/minecraft/client/Minecraft$5")); mObInitMap - .put(new Pair("bfa", "net/minecraft/client/gui/inventory/GuiBeacon$CancelButton")); + .put(new Pair("bfa", "net/minecraft/client/gui/inventory/GuiBeacon$CancelButton")); mObInitMap.put(new Pair("buh", "net/minecraft/client/stream/ChatController$ChatListener")); mObInitMap.put(new Pair("bqi", "net/minecraft/client/renderer/texture/TextureUtil")); mObInitMap.put(new Pair("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..476d07b674 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; @@ -80,6 +83,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 +177,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) CORE_Preloader.DEPENDENCIES; + //meta.dependencies = (List) 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..8a9258f07d 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,32 @@ public class Preloader_FMLLoadingPlugin implements IFMLLoadingPlugin { @Override public String getSetupClass() { + //return Preloader_SetupClass.class.getName(); return null; } @Override public void injectData(Map 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"); + 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 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, "", "(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, "", "(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", "", "(ILjava/lang/String;Ljava/lang/String;I)V", false); + mv.visitMethodInsn(INVOKESPECIAL, ""+aInputFormatted+"", "", "(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", "", "(Ljava/lang/String;IILjava/lang/String;[[[Lgregtech/api/interfaces/ITexture;)V", false); + mv.visitMethodInsn(INVOKESPECIAL, ""+aInputFormatted+"", "", "(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", "", "(Ljava/lang/String;IILjava/lang/String;[[[Lgregtech/api/interfaces/ITexture;)V", false); + mv.visitMethodInsn(INVOKESPECIAL, ""+aInputFormatted+"", "", "(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, "", "(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", "", "(ILjava/lang/String;Ljava/lang/String;I)V", false); + mv.visitMethodInsn(INVOKESPECIAL, ""+aOutputFormatted+"", "", "(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", "", "(Ljava/lang/String;IILjava/lang/String;[[[Lgregtech/api/interfaces/ITexture;)V", false); + mv.visitMethodInsn(INVOKESPECIAL, ""+aOutputFormatted+"", "", "(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", "", "(Ljava/lang/String;IILjava/lang/String;[[[Lgregtech/api/interfaces/ITexture;)V", false); + mv.visitMethodInsn(INVOKESPECIAL, ""+aOutputFormatted+"", "", "(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("") && (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("") && (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 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 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(Arrays.asList(rStack)); - } - catch (IllegalArgumentException | IllegalAccessException a){ - Logger.REFLECTION("getDropsHack2"); - a.printStackTrace(); - } - ArrayList u = new ArrayList(Arrays.asList(new ItemStack[]{ItemUtils.getSimpleStack(Blocks.bedrock)})); - return u; - } - - public static Map stupidFuckingNBTMap = new HashMap(); - 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..22a53465ff 100644 --- a/src/Java/gtPlusPlus/preloader/asm/transformers/Preloader_Transformer_Handler.java +++ b/src/Java/gtPlusPlus/preloader/asm/transformers/Preloader_Transformer_Handler.java @@ -1,34 +1,50 @@ package gtPlusPlus.preloader.asm.transformers; +import static gtPlusPlus.preloader.asm.ClassesToTransform.*; + 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.ClassesToTransform; import gtPlusPlus.preloader.asm.transformers.Preloader_ClassTransformer.OreDictionaryVisitor; import net.minecraft.launchwrapper.IClassTransformer; 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 IC2_WRENCH_PATCH_CLASS_NAMES = new AutoMap(); 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 +81,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 +176,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 +223,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(); } -- cgit From 75ea33600537047847091b55a46f5b88c3c75dbb Mon Sep 17 00:00:00 2001 From: Alkalus Date: Tue, 31 Mar 2020 01:25:58 +0100 Subject: + Added Custom NEI Handler for IsaMIll. + Added Death by IsaMIll. % Moved debug mode switch to AsmConfig. $ Fixed handling of custom OrePrefixes. $ Fixed OreDict registration of MetaFoodItems. $ Improved handling of Core Classes being static initialised too early. $ Fixed client-side bug in Distillus which would cause an infinite loop. $ Fixed bug in ForgeEnumHelper. $ Fixed bug in setField methods from ReflectionUtils. --- .gitignore | 1 + src/Java/gregtech/api/util/Recipe_GT.java | 4 +- src/Java/gtPlusPlus/api/enums/ParticleNames.java | 37 ++ src/Java/gtPlusPlus/api/objects/Logger.java | 36 +- .../gtPlusPlus/australia/GTplusplus_Australia.java | 3 +- .../commands/CommandEnableDebugWhileRunning.java | 6 +- src/Java/gtPlusPlus/core/common/CommonProxy.java | 14 +- src/Java/gtPlusPlus/core/config/ConfigHandler.java | 4 +- src/Java/gtPlusPlus/core/item/ModItems.java | 3 +- .../core/item/base/ore/BaseOreComponent.java | 3 +- .../core/item/food/BaseItemMetaFood.java | 17 +- src/Java/gtPlusPlus/core/item/init/ItemsFoods.java | 1 + src/Java/gtPlusPlus/core/lib/CORE.java | 1 - src/Java/gtPlusPlus/core/material/Material.java | 2 +- .../gtPlusPlus/core/util/debug/DEBUG_INIT.java | 4 +- .../core/util/minecraft/EntityUtils.java | 7 + .../gtPlusPlus/core/util/minecraft/ItemUtils.java | 13 +- .../core/util/minecraft/PlayerUtils.java | 8 + .../core/util/reflect/ReflectionUtils.java | 41 +- src/Java/gtPlusPlus/core/util/sys/GeoUtils.java | 9 +- .../everglades/GTplusplus_Everglades.java | 9 +- src/Java/gtPlusPlus/nei/GT_NEI_FluidReactor.java | 2 +- src/Java/gtPlusPlus/nei/GT_NEI_MillingMachine.java | 472 +++++++++++++++++++++ src/Java/gtPlusPlus/nei/NEI_GT_Config.java | 11 +- .../plugin/sulfurchem/Core_SulfuricChemistry.java | 4 +- src/Java/gtPlusPlus/preloader/CORE_Preloader.java | 1 + src/Java/gtPlusPlus/preloader/asm/AsmConfig.java | 9 +- .../preloader/asm/Preloader_FMLLoadingPlugin.java | 3 + .../Preloader_Transformer_Handler.java | 49 ++- .../bartcrops/abstracts/BaseAestheticCrop.java | 4 +- .../bartcrops/abstracts/BaseHarvestableCrop.java | 4 +- .../gtPlusPlus/xmod/bartcrops/crops/Crop_Hemp.java | 4 +- src/Java/gtPlusPlus/xmod/gregtech/HANDLER_GT.java | 11 +- .../xmod/gregtech/api/enums/CustomOrePrefix.java | 123 +++--- .../xmod/gregtech/api/gui/GUI_SteamCondenser.java | 7 +- .../base/GregtechMeta_MultiBlockBase.java | 3 +- .../blocks/textures/TexturesGrinderMultiblock.java | 1 - .../processing/GregtechMetaTileEntity_IsaMill.java | 139 +++++- ...egtechMetaTileEntity_Adv_DistillationTower.java | 16 +- .../xmod/gregtech/recipes/GregtechRecipeAdder.java | 4 + src/Java/sun/repackage/ForgeEnumHelper.java | 37 +- src/resources/assets/miscutils/lang/en_US.lang | 3 + 42 files changed, 973 insertions(+), 157 deletions(-) create mode 100644 src/Java/gtPlusPlus/api/enums/ParticleNames.java create mode 100644 src/Java/gtPlusPlus/nei/GT_NEI_MillingMachine.java (limited to 'src/Java/gtPlusPlus/preloader') diff --git a/.gitignore b/.gitignore index bd55342d81..5d9d3f3b37 100644 --- a/.gitignore +++ b/.gitignore @@ -139,3 +139,4 @@ scripts /GregTech.lang /GTPP.dat /PlayerCache.dat +wip diff --git a/src/Java/gregtech/api/util/Recipe_GT.java b/src/Java/gregtech/api/util/Recipe_GT.java index d31e1e3a82..3ddb25e754 100644 --- a/src/Java/gregtech/api/util/Recipe_GT.java +++ b/src/Java/gregtech/api/util/Recipe_GT.java @@ -249,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(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(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(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(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(10), "gt.recipe.geothermalfuel", "GeoThermal Fuel", null, RES_PATH_GUI + "basicmachines/Default", 1, 1, 0, 0, 1, "Fuel Value: ", 1000, " EU", true, true); @@ -258,7 +258,7 @@ public class Recipe_GT extends GT_Recipe implements IComparableRecipe{ 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_Macerator(new HashSet(10000), "gt.recipe.oremill", "Milling", null, RES_PATH_GUI + "basicmachines/LFTR", 1, 4, 1, 0, 1, E, 1, E, true, true); + public static final GT_Recipe_Map sOreMillRecipes = new GT_Recipe_Map(new HashSet(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(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/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/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/commands/CommandEnableDebugWhileRunning.java b/src/Java/gtPlusPlus/core/commands/CommandEnableDebugWhileRunning.java index 5e0a5594d5..903730f767 100644 --- a/src/Java/gtPlusPlus/core/commands/CommandEnableDebugWhileRunning.java +++ b/src/Java/gtPlusPlus/core/commands/CommandEnableDebugWhileRunning.java @@ -6,12 +6,12 @@ import java.util.Map; import gtPlusPlus.api.objects.Logger; import gtPlusPlus.api.objects.data.AutoMap; -import gtPlusPlus.core.lib.CORE; 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; @@ -81,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")) { diff --git a/src/Java/gtPlusPlus/core/common/CommonProxy.java b/src/Java/gtPlusPlus/core/common/CommonProxy.java index 0398b1619f..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 @@ -119,7 +123,7 @@ public class CommonProxy { public void init(final FMLInitializationEvent e) { // Debug Loading - if (CORE.DEBUG) { + if (CORE_Preloader.DEBUG_MODE) { DEBUG_INIT.registerHandlers(); } 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/item/ModItems.java b/src/Java/gtPlusPlus/core/item/ModItems.java index 6f3e62659f..fd2b98c7be 100644 --- a/src/Java/gtPlusPlus/core/item/ModItems.java +++ b/src/Java/gtPlusPlus/core/item/ModItems.java @@ -96,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; @@ -388,7 +389,7 @@ public final class ModItems { itemDummyResearch = new ItemDummyResearch(); //Debug Loading - if (CORE.DEBUG){ + if (CORE_Preloader.DEBUG_MODE){ DEBUG_INIT.registerItems(); } diff --git a/src/Java/gtPlusPlus/core/item/base/ore/BaseOreComponent.java b/src/Java/gtPlusPlus/core/item/base/ore/BaseOreComponent.java index 24c87c3334..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; @@ -92,7 +93,7 @@ public class BaseOreComponent extends Item{ aKey = OrePrefixes.dustPure.name(); } else if (componentType == ComponentTypes.MILLED) { - aKey = "milled"; + aKey = CustomOrePrefix.milled.get().name(); } ItemStack x = aMap.get(aKey); diff --git a/src/Java/gtPlusPlus/core/item/food/BaseItemMetaFood.java b/src/Java/gtPlusPlus/core/item/food/BaseItemMetaFood.java index d6922fbf92..94d5a8e80f 100644 --- a/src/Java/gtPlusPlus/core/item/food/BaseItemMetaFood.java +++ b/src/Java/gtPlusPlus/core/item/food/BaseItemMetaFood.java @@ -102,16 +102,17 @@ public class BaseItemMetaFood extends ItemFood { mSpecialBehaviourMap.put(aMetaID, aSpecialBehaviour); } mOreDictNames.put(aMetaID, aOreDictNames); - registerFoodToOreDict(aMetaID); } - private static void registerFoodToOreDict(int aMetaID) { - ArrayList 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 static void registerFoodsToOreDict() { + for (int aMetaID=0; aMetaID < mTotalMetaItems; aMetaID++) { + ArrayList 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); + } + } } } diff --git a/src/Java/gtPlusPlus/core/item/init/ItemsFoods.java b/src/Java/gtPlusPlus/core/item/init/ItemsFoods.java index 7f1ba720cc..e5c403c503 100644 --- a/src/Java/gtPlusPlus/core/item/init/ItemsFoods.java +++ b/src/Java/gtPlusPlus/core/item/init/ItemsFoods.java @@ -48,6 +48,7 @@ public class ItemsFoods { GT_OreDictUnificator.registerOre("foodHotCurriedSausages", ItemUtils.getItemStackFromFQRN(CORE.MODID+":itemHotFoodCurriedSausages", 1)); ModItems.itemMetaFood = new BaseItemMetaFood(); + BaseItemMetaFood.registerFoodsToOreDict(); addCookingRecipes(); addFoodDropsToMobs(); diff --git a/src/Java/gtPlusPlus/core/lib/CORE.java b/src/Java/gtPlusPlus/core/lib/CORE.java index 06d8331606..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;; diff --git a/src/Java/gtPlusPlus/core/material/Material.java b/src/Java/gtPlusPlus/core/material/Material.java index 9cdf16fe01..7d49a8d635 100644 --- a/src/Java/gtPlusPlus/core/material/Material.java +++ b/src/Java/gtPlusPlus/core/material/Material.java @@ -892,7 +892,7 @@ public class Material { return getComponentByPrefix(OrePrefixes.dustImpure, stacksize); } public final ItemStack getMilled(final int stacksize){ - return getComponentByPrefix(CustomOrePrefix.get(CustomOrePrefix.Milled), stacksize); + return getComponentByPrefix(CustomOrePrefix.milled.get(), stacksize); } public final boolean hasSolidForm() { 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 bba2e55bc2..66f9e2453d 100644 --- a/src/Java/gtPlusPlus/core/util/minecraft/EntityUtils.java +++ b/src/Java/gtPlusPlus/core/util/minecraft/EntityUtils.java @@ -74,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 classy, final EnumCreatureType EntityType, final BiomeGenBase baseBiomeGen){ diff --git a/src/Java/gtPlusPlus/core/util/minecraft/ItemUtils.java b/src/Java/gtPlusPlus/core/util/minecraft/ItemUtils.java index b2f048565f..725799a43d 100644 --- a/src/Java/gtPlusPlus/core/util/minecraft/ItemUtils.java +++ b/src/Java/gtPlusPlus/core/util/minecraft/ItemUtils.java @@ -37,6 +37,7 @@ 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; @@ -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)); @@ -1275,6 +1276,16 @@ 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); 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/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/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 df437c4d23..29c3cecb6f 100644 --- a/src/Java/gtPlusPlus/nei/GT_NEI_FluidReactor.java +++ b/src/Java/gtPlusPlus/nei/GT_NEI_FluidReactor.java @@ -60,7 +60,7 @@ extends TemplateRecipeHandler { } public List getSortedRecipes() { - List result = new ArrayList<>(this.mRecipeMap.mRecipeList); + List result = new ArrayList(this.mRecipeMap.mRecipeList); Collections.sort(result); return result; } 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 getSortedRecipes() { + List 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 tResults = new ArrayList(); + 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 tInputs = new ArrayList(); + 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 handleItemTooltip(final GuiRecipe gui, final ItemStack aStack, final List 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 handleTooltip(final GuiContainer gui, final int mousex, final int mousey, final List 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 handleItemDisplayName(final GuiContainer gui, final ItemStack itemstack, final List currenttip) { + return currenttip; + } + + @Override + public List handleItemTooltip(final GuiContainer gui, final ItemStack itemstack, final int mousex, final int mousey, final List 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 tDisplayStacks = new ArrayList(); + for (final ItemStack tStack : this.items) { + if (GT_Utility.isStackValid(tStack)) { + if (tStack.getItemDamage() == 32767) { + final List permutations = codechicken.nei.ItemList.itemMap.get(tStack.getItem()); + if (!permutations.isEmpty()) { + ItemStack stack; + for (final Iterator 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 mOutputs = new ArrayList(); + public final List mInputs = new ArrayList(); + + 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 getIngredients() { + return this.getCycledIngredients(GT_NEI_MillingMachine.this.cycleticks / 10, this.mInputs); + } + + @Override + public PositionedStack getResult() { + return null; + } + + @Override + public List 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 mUniqueRecipeMapHandling = new AutoMap(); @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 e7101bc025..49209307f7 100644 --- a/src/Java/gtPlusPlus/preloader/CORE_Preloader.java +++ b/src/Java/gtPlusPlus/preloader/CORE_Preloader.java @@ -17,6 +17,7 @@ public class CORE_Preloader { 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; diff --git a/src/Java/gtPlusPlus/preloader/asm/AsmConfig.java b/src/Java/gtPlusPlus/preloader/asm/AsmConfig.java index 476d07b674..d0c59726de 100644 --- a/src/Java/gtPlusPlus/preloader/asm/AsmConfig.java +++ b/src/Java/gtPlusPlus/preloader/asm/AsmConfig.java @@ -30,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) { @@ -59,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); diff --git a/src/Java/gtPlusPlus/preloader/asm/Preloader_FMLLoadingPlugin.java b/src/Java/gtPlusPlus/preloader/asm/Preloader_FMLLoadingPlugin.java index 8a9258f07d..6eb6070853 100644 --- a/src/Java/gtPlusPlus/preloader/asm/Preloader_FMLLoadingPlugin.java +++ b/src/Java/gtPlusPlus/preloader/asm/Preloader_FMLLoadingPlugin.java @@ -10,6 +10,7 @@ import gtPlusPlus.preloader.CORE_Preloader; import gtPlusPlus.preloader.Preloader_Logger; import gtPlusPlus.preloader.asm.transformers.Preloader_Transformer_Handler; import net.minecraft.launchwrapper.Launch; +import sun.repackage.ForgeEnumHelper; @SortingIndex(10097) @MCVersion(value = "1.7.10") @@ -67,6 +68,8 @@ public class Preloader_FMLLoadingPlugin implements IFMLLoadingPlugin { Preloader_Logger.ERROR("Unable to determine CoreMod location"); } CORE_Preloader.DEV_ENVIRONMENT = (Boolean) Launch.blackboard.get("fml.deobfuscatedEnvironment"); + CORE_Preloader.DEBUG_MODE = AsmConfig.debugMode; + ForgeEnumHelper.setup(); Preloader_Logger.INFO("Running on "+gtPlusPlus.preloader.CORE_Preloader.JAVA_VERSION+" | Development Environment: "+CORE_Preloader.DEV_ENVIRONMENT); } 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 22a53465ff..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,6 +1,52 @@ package gtPlusPlus.preloader.asm.transformers; -import static gtPlusPlus.preloader.asm.ClassesToTransform.*; +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; @@ -15,7 +61,6 @@ import gtPlusPlus.preloader.CORE_Preloader; import gtPlusPlus.preloader.DevHelper; import gtPlusPlus.preloader.Preloader_Logger; import gtPlusPlus.preloader.asm.AsmConfig; -import gtPlusPlus.preloader.asm.ClassesToTransform; import gtPlusPlus.preloader.asm.transformers.Preloader_ClassTransformer.OreDictionaryVisitor; import net.minecraft.launchwrapper.IClassTransformer; import net.minecraft.launchwrapper.Launch; 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 aaaf9700f9..1cb499479f 100644 --- a/src/Java/gtPlusPlus/xmod/gregtech/HANDLER_GT.java +++ b/src/Java/gtPlusPlus/xmod/gregtech/HANDLER_GT.java @@ -81,9 +81,7 @@ public class HANDLER_GT { OldCircuitHandler.preInit(); } - GregtechFluidHandler.run(); - addNewOrePrefixes(); - + GregtechFluidHandler.run(); } public static void init(){ @@ -155,8 +153,11 @@ public class HANDLER_GT { WoodCentrifuging.processLogsForMethane(); } - private static void addNewOrePrefixes() { - CustomOrePrefix.init(); + 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() { diff --git a/src/Java/gtPlusPlus/xmod/gregtech/api/enums/CustomOrePrefix.java b/src/Java/gtPlusPlus/xmod/gregtech/api/enums/CustomOrePrefix.java index 050081fc82..9647b00578 100644 --- a/src/Java/gtPlusPlus/xmod/gregtech/api/enums/CustomOrePrefix.java +++ b/src/Java/gtPlusPlus/xmod/gregtech/api/enums/CustomOrePrefix.java @@ -3,23 +3,31 @@ package gtPlusPlus.xmod.gregtech.api.enums; import static gregtech.api.enums.GT_Values.B; import gregtech.api.enums.OrePrefixes; -import gtPlusPlus.api.objects.Logger; -import gtPlusPlus.core.lib.CORE; import net.minecraftforge.common.util.EnumHelper; -public class CustomOrePrefix { +public enum CustomOrePrefix { - public static CustomOrePrefix Milled; - - static { - Milled = new CustomOrePrefix("Milled Ores", "Milled ", " Ore", true, true, false, false, false, false, false, false, false, true, B[3], -1, 64, -1); - } + milled("Milled Ores", "Milled ", " Ore", true, true, false, false, false, false, false, false, false, true, B[3], -1, 64, -1); - public static void init() { - // Does nothing except run the static{} block - } - + 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, @@ -38,52 +46,67 @@ public class CustomOrePrefix { int aMaterialGenerationBits, long aMaterialAmount, int aDefaultStackSize, - int aTextureindex) { - + 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; - // Add this to the GT Enum - EnumHelper.addEnum(OrePrefixes.class, aLocalizedMaterialPre, new Object[] { - aRegularLocalName, - aLocalizedMaterialPre, - aLocalizedMaterialPost, - aIsUnificatable, - aIsMaterialBased, - aIsSelfReferencing, - aIsContainer, - aDontUnificateActively, - aIsUsedForBlocks, - aAllowNormalRecycling, - aGenerateDefaultItem, - aIsEnchantable, - aIsUsedForOreProcessing, - aMaterialGenerationBits, - aMaterialAmount, - aDefaultStackSize, - aTextureindex} - ); + } + + public final boolean addToEnum() { - Logger.INFO("Registered custom OrePrefixes '"+aLocalizedMaterialPre+"'. Success? "+checkEntryWasAdded(this)); + 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; } - private static final boolean checkEntryWasAdded(CustomOrePrefix aCustomPrefixObject) { - for (OrePrefixes o :OrePrefixes.values()) { - if (o.mLocalizedMaterialPre.equals(aCustomPrefixObject.mLocalizedMaterialPre)) { - return true; - } - } - return false; + public static final boolean checkEntryWasAdded(CustomOrePrefix aCustomPrefixObject) { + return aCustomPrefixObject.mSelfReference != null; } - public static OrePrefixes get(CustomOrePrefix aCustomPrefixObject) { - for (OrePrefixes o :OrePrefixes.values()) { - if (o.mLocalizedMaterialPre.equals(aCustomPrefixObject.mLocalizedMaterialPre)) { - return o; - } - } - CORE.crash("Tried to obtain an invalid custom OrePrefixes object"); - return null; + public OrePrefixes get() { + return mSelfReference; } } 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/metatileentity/implementations/base/GregtechMeta_MultiBlockBase.java b/src/Java/gtPlusPlus/xmod/gregtech/api/metatileentity/implementations/base/GregtechMeta_MultiBlockBase.java index b6b75808fc..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 @@ -55,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; @@ -89,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 { diff --git a/src/Java/gtPlusPlus/xmod/gregtech/common/blocks/textures/TexturesGrinderMultiblock.java b/src/Java/gtPlusPlus/xmod/gregtech/common/blocks/textures/TexturesGrinderMultiblock.java index 0af29aaf7e..02900c300b 100644 --- a/src/Java/gtPlusPlus/xmod/gregtech/common/blocks/textures/TexturesGrinderMultiblock.java +++ b/src/Java/gtPlusPlus/xmod/gregtech/common/blocks/textures/TexturesGrinderMultiblock.java @@ -3,7 +3,6 @@ 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.GregtechMetaCasingBlocks; 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; 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 index 53d7c2ea20..77cd6777b5 100644 --- 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 @@ -1,5 +1,9 @@ package gtPlusPlus.xmod.gregtech.common.tileentities.machines.multi.processing; +import java.util.HashSet; +import java.util.List; +import java.util.Random; + import gregtech.api.enums.TAE; import gregtech.api.enums.Textures; import gregtech.api.gui.GT_GUIContainer_MultiMachine; @@ -8,15 +12,26 @@ import gregtech.api.interfaces.metatileentity.IMetaTileEntity; import gregtech.api.interfaces.tileentity.IGregTechTileEntity; import gregtech.api.objects.GT_RenderedTexture; import gregtech.api.util.GT_Recipe; -import gregtech.api.util.GT_Recipe.GT_Recipe_Map; +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.lib.CORE; +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 { @@ -27,6 +42,8 @@ public class GregtechMetaTileEntity_IsaMill extends GregtechMeta_MultiBlockBase 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); @@ -76,7 +93,123 @@ public class GregtechMetaTileEntity_IsaMill extends GregtechMeta_MultiBlockBase @Override public GT_Recipe.GT_Recipe_Map getRecipeMap() { - return GT_Recipe_Map.sMaceratorRecipes; + 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 mFrontBlockPosCache = new AutoMap(); + + 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 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 getEntities(AutoMap aPositionsToCheck, World aWorld){ + AutoMap aEntities = new AutoMap(); + HashSet aChunksToCheck = new HashSet(); + if (!aPositionsToCheck.isEmpty()) { + Chunk aLocalChunk; + for (BlockPos aPos : aPositionsToCheck) { + aLocalChunk = aWorld.getChunkFromBlockCoords(aPos.xPos, aPos.zPos); + aChunksToCheck.add(aLocalChunk); + } + } + if (!aChunksToCheck.isEmpty()) { + AutoMap aEntitiesFound = new AutoMap(); + for (Chunk aChunk : aChunksToCheck) { + if (aChunk.isChunkLoaded) { + List[] aEntityLists = aChunk.entityLists; + for (List aEntitySubList : aEntityLists) { + for (Object aEntity : aEntitySubList) { + if (aEntity instanceof EntityLivingBase) { + 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 aEntityPositions = new AutoMap(); + aEntityPositions.add(aPlayerPosBottom); + aEntityPositions.add(aPlayerPosTop); + for (int i = 0; i < 64; i++) { + BlockPos aEffectPos = aEntityPositions.get(aEntity.height > 1f ? MathUtils.randInt(0, 1) : 0); + float aOffsetX = MathUtils.randFloat(-0.35f, 0.35f); + float aOffsetY = MathUtils.randFloat(-0.25f, 0.35f); + float aOffsetZ = MathUtils.randFloat(-0.35f, 0.35f); + aEntity.worldObj.spawnParticle("reddust", aEffectPos.xPos + aOffsetX, aEffectPos.yPos + 0.3f + aOffsetY, aEffectPos.zPos + aOffsetZ, 0.0D, 0.0D, 0.0D); + } } @Override @@ -128,7 +261,7 @@ public class GregtechMetaTileEntity_IsaMill extends GregtechMeta_MultiBlockBase 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); + IGregTechTileEntity aTileEntity = aBaseMetaTileEntity.getIGregTechTileEntity(aX, aY, aZ); if (aTileEntity != null) { final IMetaTileEntity aMetaTileEntity = aTileEntity.getMetaTileEntity(); if (aMetaTileEntity != null) { 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 753132dd27..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 @@ -475,10 +475,16 @@ public class GregtechMetaTileEntity_Adv_DistillationTower extends GregtechMeta_M try { Block aInitStructureCheck; int aInitStructureCheckMeta; - IGregTechTileEntity aBaseMetaTileEntity = this.getBaseMetaTileEntity(); - for (int i=1;1<10;i++) { + 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); + aInitStructureCheckMeta = aBaseMetaTileEntity.getMetaIDOffset(0, i, 0); + if (aInitStructureCheck == null) { + continue; + } if (aInitStructureCheck == GregTech_API.sBlockCasings4 && aInitStructureCheckMeta == 1) { return 0; } @@ -488,9 +494,9 @@ public class GregtechMetaTileEntity_Adv_DistillationTower extends GregtechMeta_M } } catch (Throwable t) { - t.printStackTrace(); - return 0; + //t.printStackTrace(); } + return 0; } diff --git a/src/Java/gtPlusPlus/xmod/gregtech/recipes/GregtechRecipeAdder.java b/src/Java/gtPlusPlus/xmod/gregtech/recipes/GregtechRecipeAdder.java index c22b9fc2ca..cc3130af98 100644 --- a/src/Java/gtPlusPlus/xmod/gregtech/recipes/GregtechRecipeAdder.java +++ b/src/Java/gtPlusPlus/xmod/gregtech/recipes/GregtechRecipeAdder.java @@ -1332,21 +1332,25 @@ public class GregtechRecipeAdder implements IGregtech_RecipeAdder { // 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 }; diff --git a/src/Java/sun/repackage/ForgeEnumHelper.java b/src/Java/sun/repackage/ForgeEnumHelper.java index 8d77877cee..2f7732574c 100644 --- a/src/Java/sun/repackage/ForgeEnumHelper.java +++ b/src/Java/sun/repackage/ForgeEnumHelper.java @@ -5,17 +5,19 @@ import java.lang.reflect.Field; import java.lang.reflect.Method; import gtPlusPlus.core.util.reflect.ReflectionUtils; +import gtPlusPlus.preloader.Preloader_Logger; +import net.minecraftforge.common.util.EnumHelper; -public class ForgeEnumHelper -{ +public class ForgeEnumHelper { private static Object reflectionFactory = null; private static Method newConstructorAccessor = null; private static Method newInstance = null; private static Method newFieldAccessor = null; private static Method fieldAccessorSet = null; private static boolean isSetup = false; + - private static void setup() + public static void setup() { if (isSetup) { @@ -25,18 +27,36 @@ public class ForgeEnumHelper try { + Preloader_Logger.INFO("Patching Fields in Forge's EnumHelper."); + Class aRefFac = ReflectionUtils.getClass("sun.repackage.ReflectionFactory"); Class aConAcc = ReflectionUtils.getClass("sun.repackage.ConstructorAccessor"); Class aFieAcc = ReflectionUtils.getClass("sun.repackage.FieldAccessor"); Method getReflectionFactory = ReflectionUtils.getMethod(aRefFac, "getReflectionFactory", new Class[] {}); - reflectionFactory = ReflectionUtils.invoke(aRefFac, getReflectionFactory, new Object[] {}); + reflectionFactory = ReflectionUtils.invokeNonBool(aRefFac, getReflectionFactory, new Object[] {}); newConstructorAccessor = ReflectionUtils.getMethod(aRefFac, "newConstructorAccessor", new Class[] {Constructor.class}); newFieldAccessor = ReflectionUtils.getMethod(aRefFac, "newFieldAccessor", new Class[] {Field.class, boolean.class}); newInstance = ReflectionUtils.getMethod(aConAcc, "newInstance", new Class[] {Object[].class}); fieldAccessorSet = ReflectionUtils.getMethod(aFieAcc, "set", new Class[] {Object.class, Object.class}); + + Field aIsSetup = ReflectionUtils.getField(EnumHelper.class, "isSetup"); + Field aReflectionFactory = ReflectionUtils.getField(EnumHelper.class, "reflectionFactory"); + Field aNewConstructorAccessor = ReflectionUtils.getField(EnumHelper.class, "newConstructorAccessor"); + Field aNewInstance = ReflectionUtils.getField(EnumHelper.class, "newInstance"); + Field aNewFieldAccessor = ReflectionUtils.getField(EnumHelper.class, "newFieldAccessor"); + Field aFieldAccessorSet = ReflectionUtils.getField(EnumHelper.class, "fieldAccessorSet"); + + ReflectionUtils.setField(EnumHelper.class, aIsSetup, true); + ReflectionUtils.setField(EnumHelper.class, aReflectionFactory, reflectionFactory); + ReflectionUtils.setField(EnumHelper.class, aNewConstructorAccessor, newConstructorAccessor); + ReflectionUtils.setField(EnumHelper.class, aNewInstance, newInstance); + ReflectionUtils.setField(EnumHelper.class, aNewFieldAccessor, newFieldAccessor); + ReflectionUtils.setField(EnumHelper.class, aFieldAccessorSet, fieldAccessorSet); + + Preloader_Logger.INFO("Finished patching Fields in Forge's EnumHelper."); - + Preloader_Logger.INFO("Testing: "+ReflectionUtils.getFieldValue(aReflectionFactory).getClass().getCanonicalName()); } catch (Exception e) @@ -47,11 +67,4 @@ public class ForgeEnumHelper isSetup = true; } - static - { - if (!isSetup) - { - setup(); - } - } } \ No newline at end of file diff --git a/src/resources/assets/miscutils/lang/en_US.lang b/src/resources/assets/miscutils/lang/en_US.lang index a63c57f44c..e358c2d272 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 @@ -3141,5 +3142,7 @@ 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.BasicGenericChemItem.7.name=Alumina Milling Ball item.BasicGenericChemItem.8.name=Soapstone Milling Ball \ No newline at end of file -- cgit