From 5e7d6c24e5c0c4d799433a73abab6388a20bdd53 Mon Sep 17 00:00:00 2001 From: bartimaeusnek <33183715+bartimaeusnek@users.noreply.github.com> Date: Sun, 7 Apr 2019 18:16:55 +0200 Subject: code clean up +made all asm patches disableable +removed secondary configs +added comments for config +fixed megas not working with more than one hatch Signed-off-by: bartimaeusnek <33183715+bartimaeusnek@users.noreply.github.com> Former-commit-id: 97c1b54ee17ec550c7cf03ddce0f5d9fd63bc688 --- .../com/github/bartimaeusnek/ASM/ASMUtils.java | 64 ++++ .../java/com/github/bartimaeusnek/ASM/BWCore.java | 7 - .../com/github/bartimaeusnek/ASM/BWCorePlugin.java | 27 +- .../ASM/BWCoreStaticReplacementMethodes.java | 6 +- .../bartimaeusnek/ASM/BWCoreTransformer.java | 147 ++++---- .../bartworks/API/BioObjectAdder.java | 8 +- .../bartworks/API/WerkstoffAdderRegistry.java | 8 +- .../github/bartimaeusnek/bartworks/MainMod.java | 63 ++-- .../ClientEventHandler/ClientEventHandler.java | 8 +- .../client/renderer/BW_Renderer_Block_Ores.java | 18 +- .../bartworks/common/configs/ConfigHandler.java | 9 + .../bartworks/common/items/BW_ItemBlocks.java | 4 +- .../bartworks/common/items/BW_SimpleWindMeter.java | 4 +- .../bartworks/common/items/BW_Stonage_Rotors.java | 6 +- .../bartworks/common/items/Circuit_Programmer.java | 2 +- .../common/items/GT_Destructopack_Item.java | 2 +- .../bartworks/common/items/GT_Rockcutter_Item.java | 4 +- .../bartworks/common/items/LabParts.java | 6 +- .../bartworks/common/items/SimpleSubItemClass.java | 2 +- .../bartworks/common/loaders/BioRecipeLoader.java | 5 +- .../bartworks/common/loaders/FluidLoader.java | 1 - .../bartworks/common/loaders/ItemRegistry.java | 22 +- .../bartworks/common/loaders/RecipeLoader.java | 3 +- .../bartworks/common/net/OrePacket.java | 10 +- .../BW_TileEntity_ExperimentalFloodGate.java | 33 +- .../classic/BW_TileEntity_HeatedWaterPump.java | 2 +- .../classic/BW_TileEntity_InfinityTank.java | 17 +- .../tileentities/multis/GT_TileEntity_BioVat.java | 6 +- .../multis/GT_TileEntity_CrackingDistillTower.java | 26 +- .../GT_TileEntity_ElectricImplosionCompressor.java | 92 +++-- .../tileentities/multis/GT_TileEntity_LESU.java | 4 +- .../multis/GT_TileEntity_ManualTrafo.java | 6 +- .../multis/GT_TileEntity_Windmill.java | 12 +- .../mega/GT_TileEntity_MegaBlastFurnace.java | 47 ++- .../mega/GT_TileEntity_MegaProcessingArray.java | 14 +- .../mega/GT_TileEntity_MegaVacuumFreezer.java | 35 +- .../tiered/GT_MetaTileEntity_AcidGenerator.java | 4 +- .../tiered/GT_MetaTileEntity_BioLab.java | 10 +- .../tiered/GT_MetaTileEntity_Diode.java | 18 +- .../GT_MetaTileEntity_EnergyDistributor.java | 2 +- .../tiered/GT_MetaTileEntity_RadioHatch.java | 7 +- .../bartworks/neiHandler/BW_NEI_BioLabHandler.java | 6 +- .../bartworks/neiHandler/BW_NEI_BioVatHandler.java | 25 +- .../bartworks/neiHandler/BW_NEI_OreHandler.java | 170 ++++----- .../system/material/BW_MetaGeneratedOreTE.java | 24 +- .../system/material/BW_MetaGeneratedOre_Item.java | 2 +- .../system/material/BW_MetaGenerated_Items.java | 51 ++- .../system/material/BW_MetaGenerated_Ores.java | 70 ++-- .../bartworks/system/material/Werkstoff.java | 339 +++++++++--------- .../bartworks/system/material/WerkstoffLoader.java | 396 +++++++++------------ .../bartimaeusnek/bartworks/util/BWRecipes.java | 17 +- .../bartimaeusnek/bartworks/util/BW_Util.java | 9 +- .../bartimaeusnek/bartworks/util/BioCulture.java | 29 +- .../bartimaeusnek/bartworks/util/BioData.java | 8 +- .../github/bartimaeusnek/bartworks/util/Pair.java | 8 +- .../bartimaeusnek/crossmod/BartWorksCrossmod.java | 5 +- .../crossmod/galacticraft/GalacticraftProxy.java | 52 +-- .../galacticraft/UniversalTeleportType.java | 10 +- .../galacticraft/creativetabs/SpaceTab.java | 8 +- .../ross128/world/oregen/BW_WordGenerator.java | 9 +- .../ross128/world/oregen/BW_WorldGenRoss128.java | 100 +++--- .../world/worldprovider/ChunkProviderRoss128b.java | 56 ++- .../world/worldprovider/SkyProviderRoss128b.java | 2 +- .../world/worldprovider/WorldProviderRoss128b.java | 27 +- .../galacticraft/solarsystems/Ross128.java | 25 +- 65 files changed, 1123 insertions(+), 1096 deletions(-) create mode 100644 src/main/java/com/github/bartimaeusnek/ASM/ASMUtils.java (limited to 'src/main/java/com') diff --git a/src/main/java/com/github/bartimaeusnek/ASM/ASMUtils.java b/src/main/java/com/github/bartimaeusnek/ASM/ASMUtils.java new file mode 100644 index 0000000000..f4b61a17ba --- /dev/null +++ b/src/main/java/com/github/bartimaeusnek/ASM/ASMUtils.java @@ -0,0 +1,64 @@ +/* + * Copyright (c) 2019 bartimaeusnek + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to deal + * in the Software without restriction, including without limitation the rights + * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in all + * copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + * SOFTWARE. + */ + +package com.github.bartimaeusnek.ASM; + +import org.objectweb.asm.tree.MethodNode; + +import java.io.File; +import java.io.FileOutputStream; +import java.io.IOException; +import java.io.OutputStream; + +public class ASMUtils { + + public static String matchAny(String toCompare, String... args) { + for (int i = 0; i < args.length; i++) { + if (toCompare.equalsIgnoreCase(args[i])) + return args[i]; + } + return ""; + } + + /** + * Call this Method twice, one time for the Descriptor and one time for the Name. + */ + public static boolean isCorrectMethod(MethodNode methodNode, String... args) { + for (int i = 0; i < args.length; i++) { + if (methodNode.name.equalsIgnoreCase(args[i]) || methodNode.desc.equalsIgnoreCase(args[i])) + return true; + } + return false; + } + + public static boolean writeClassToDisk(byte[] towrite, String Classname, String Path) { + try { + OutputStream os = new FileOutputStream(new File(Path + Classname + ".class")); + os.write(towrite); + } catch (IOException e) { + e.printStackTrace(); + return false; + } + return true; + } + +} diff --git a/src/main/java/com/github/bartimaeusnek/ASM/BWCore.java b/src/main/java/com/github/bartimaeusnek/ASM/BWCore.java index bddf66ae5e..9c76b3dd82 100644 --- a/src/main/java/com/github/bartimaeusnek/ASM/BWCore.java +++ b/src/main/java/com/github/bartimaeusnek/ASM/BWCore.java @@ -31,7 +31,6 @@ import cpw.mods.fml.common.ModMetadata; import cpw.mods.fml.common.event.FMLPreInitializationEvent; import cpw.mods.fml.common.versioning.ArtifactVersion; import cpw.mods.fml.common.versioning.DefaultArtifactVersion; -import net.minecraftforge.common.config.Configuration; import org.apache.logging.log4j.LogManager; import org.apache.logging.log4j.Logger; @@ -55,12 +54,6 @@ public class BWCore extends DummyModContainer { @Subscribe public void preInit(FMLPreInitializationEvent event) { - Configuration asmconfighandler = new Configuration(event.getSuggestedConfigurationFile()); - for (int i = 0; i < BWCoreTransformer.CLASSESBEEINGTRANSFORMED.length; i++) { - BWCoreTransformer.shouldTransform[i]=asmconfighandler.get("ASM fixes",BWCoreTransformer.DESCRIPTIONFORCONFIG[i]+" in class: "+BWCoreTransformer.CLASSESBEEINGTRANSFORMED[i],true).getBoolean(true); - } - if (asmconfighandler.hasChanged()) - asmconfighandler.save(); } @Override diff --git a/src/main/java/com/github/bartimaeusnek/ASM/BWCorePlugin.java b/src/main/java/com/github/bartimaeusnek/ASM/BWCorePlugin.java index becd28f524..018690d312 100644 --- a/src/main/java/com/github/bartimaeusnek/ASM/BWCorePlugin.java +++ b/src/main/java/com/github/bartimaeusnek/ASM/BWCorePlugin.java @@ -22,16 +22,36 @@ package com.github.bartimaeusnek.ASM; +import cpw.mods.fml.relauncher.FMLInjectionData; import cpw.mods.fml.relauncher.IFMLLoadingPlugin; +import net.minecraftforge.common.config.Configuration; +import java.io.File; import java.util.Map; +@IFMLLoadingPlugin.SortingIndex(999999999)//Load as late as possible (after fastcraft/OptiFine). @IFMLLoadingPlugin.MCVersion("1.7.10") @IFMLLoadingPlugin.TransformerExclusions({"com.github.bartimaeusnek.ASM"}) @IFMLLoadingPlugin.Name(BWCorePlugin.BWCORE_PLUGIN_NAME) public class BWCorePlugin implements IFMLLoadingPlugin { - public static final String BWCORE_PLUGIN_NAME="BartWorks ASM Core Plugin"; + public static final String BWCORE_PLUGIN_NAME = "BartWorks ASM Core Plugin"; + + public static File minecraftDir = null; + + public BWCorePlugin() { + //Injection Code taken from CodeChickenLib + if (minecraftDir != null) + return;//get called twice, once for IFMLCallHook + minecraftDir = (File) FMLInjectionData.data()[6]; + + Configuration asmconfighandler = new Configuration(new File(new File(minecraftDir, "config"), "bartworks.cfg")); + for (int i = 0; i < BWCoreTransformer.CLASSESBEEINGTRANSFORMED.length; i++) { + BWCoreTransformer.shouldTransform[i] = asmconfighandler.get("ASM fixes", BWCoreTransformer.DESCRIPTIONFORCONFIG[i] + " in class: " + BWCoreTransformer.CLASSESBEEINGTRANSFORMED[i], true).getBoolean(true); + } + if (asmconfighandler.hasChanged()) + asmconfighandler.save(); + } @Override public String[] getASMTransformerClass() { @@ -50,10 +70,9 @@ public class BWCorePlugin implements IFMLLoadingPlugin { @Override public void injectData(Map data) { - if (data.get("runtimeDeobfuscationEnabled") != null){ - BWCoreTransformer.obfs=(boolean)data.get("runtimeDeobfuscationEnabled"); + if (data.get("runtimeDeobfuscationEnabled") != null) { + BWCoreTransformer.obfs = (boolean) data.get("runtimeDeobfuscationEnabled"); } - } @Override diff --git a/src/main/java/com/github/bartimaeusnek/ASM/BWCoreStaticReplacementMethodes.java b/src/main/java/com/github/bartimaeusnek/ASM/BWCoreStaticReplacementMethodes.java index 0d98c72564..505612cd35 100644 --- a/src/main/java/com/github/bartimaeusnek/ASM/BWCoreStaticReplacementMethodes.java +++ b/src/main/java/com/github/bartimaeusnek/ASM/BWCoreStaticReplacementMethodes.java @@ -22,10 +22,8 @@ package com.github.bartimaeusnek.ASM; -import com.github.bartimaeusnek.crossmod.galacticraft.planets.ross128.world.worldprovider.WorldProviderRoss128b; -import net.minecraft.client.multiplayer.WorldClient; - public class BWCoreStaticReplacementMethodes { - private BWCoreStaticReplacementMethodes(){} + private BWCoreStaticReplacementMethodes() { + } } diff --git a/src/main/java/com/github/bartimaeusnek/ASM/BWCoreTransformer.java b/src/main/java/com/github/bartimaeusnek/ASM/BWCoreTransformer.java index 0a6f44712d..6a9850e4fe 100644 --- a/src/main/java/com/github/bartimaeusnek/ASM/BWCoreTransformer.java +++ b/src/main/java/com/github/bartimaeusnek/ASM/BWCoreTransformer.java @@ -26,7 +26,6 @@ import net.minecraft.launchwrapper.IClassTransformer; import org.apache.commons.lang3.ArrayUtils; import org.objectweb.asm.ClassReader; import org.objectweb.asm.ClassWriter; -import org.objectweb.asm.Opcodes; import org.objectweb.asm.tree.*; import java.util.Arrays; @@ -35,34 +34,25 @@ import java.util.List; import static org.objectweb.asm.Opcodes.*; public class BWCoreTransformer implements IClassTransformer { - public static boolean obfs = false; public static final String[] DESCRIPTIONFORCONFIG = { "REMOVING RAIN FROM LAST MILLENIUM (EXU)", "REMVOING CREATURES FROM LAST MILLENIUM (EXU)", "PATCHING GLOBAL RENDERER FOR USE WITH MY GALACTIC DIMS" }; - public static final String[] CLASSESBEEINGTRANSFORMED = { "com.rwtema.extrautils.worldgen.endoftime.WorldProviderEndOfTime", "com.rwtema.extrautils.worldgen.endoftime.ChunkProviderEndOfTime", //"micdoodle8.mods.galacticraft.core.client.SkyProviderOverworld", "net.minecraft.client.renderer.RenderGlobal", }; - - public static boolean[] shouldTransform = ArrayUtils.toPrimitive(new Boolean[BWCoreTransformer.CLASSESBEEINGTRANSFORMED.length],true); - - @Override - public byte[] transform(String name, String transformedName, byte[] basicClass) { - for (int i = 0; i < BWCoreTransformer.CLASSESBEEINGTRANSFORMED.length; i++) { - if (name.equalsIgnoreCase(BWCoreTransformer.CLASSESBEEINGTRANSFORMED[i])) - return BWCoreTransformer.transform(i,basicClass); - } - return basicClass; - } + public static boolean obfs = false; + public static boolean[] shouldTransform = ArrayUtils.toPrimitive(new Boolean[BWCoreTransformer.CLASSESBEEINGTRANSFORMED.length], true); public static byte[] transform(int id, byte[] basicClass) { - if (!BWCoreTransformer.shouldTransform[id]) + if (!BWCoreTransformer.shouldTransform[id]) { + BWCore.BWCORE_LOG.info("Patch: " + DESCRIPTIONFORCONFIG[id] + " is disabled, will not patch!"); return basicClass; + } if (id < BWCoreTransformer.CLASSESBEEINGTRANSFORMED.length) { BWCore.BWCORE_LOG.info(DESCRIPTIONFORCONFIG[id]); @@ -72,27 +62,27 @@ public class BWCoreTransformer implements IClassTransformer { List methods = classNode.methods; switch (id) { case 0: { - BWCore.BWCORE_LOG.info("Could find: "+CLASSESBEEINGTRANSFORMED[id]); + BWCore.BWCORE_LOG.info("Could find: " + CLASSESBEEINGTRANSFORMED[id]); String name_deObfs = "canDoRainSnowIce"; String dsc_deObfs = "(Lnet/minecraft/world/chunk/Chunk;)Z"; String dsc_Obfs = "(Lapx;)Z"; for (int i = 0; i < methods.size(); i++) { if (methods.get(i).name.equalsIgnoreCase(name_deObfs)) { - BWCore.BWCORE_LOG.info("Found "+name_deObfs+"! Removing!"); + BWCore.BWCORE_LOG.info("Found " + name_deObfs + "! Removing!"); methods.remove(i); break; } } - BWCore.BWCORE_LOG.info("Creating new "+name_deObfs+"!"); - MethodNode nu = new MethodNode(Opcodes.ACC_PUBLIC, name_deObfs, + BWCore.BWCORE_LOG.info("Creating new " + name_deObfs + "!"); + MethodNode nu = new MethodNode(ACC_PUBLIC, name_deObfs, /*obfs ? dsc_Obfs :*/ dsc_deObfs, - name_deObfs+dsc_deObfs.substring(0,dsc_deObfs.length()-1), + null, new String[0] ); InsnList insnList = new InsnList(); - insnList.add(new InsnNode(Opcodes.ICONST_0)); - insnList.add(new InsnNode(Opcodes.IRETURN)); + insnList.add(new InsnNode(ICONST_0)); + insnList.add(new InsnNode(IRETURN)); nu.instructions = insnList; nu.maxLocals = 1; nu.maxStack = 1; @@ -100,18 +90,20 @@ public class BWCoreTransformer implements IClassTransformer { break; } case 1: { - BWCore.BWCORE_LOG.info("Could find: "+CLASSESBEEINGTRANSFORMED[id]); + BWCore.BWCORE_LOG.info("Could find: " + CLASSESBEEINGTRANSFORMED[id]); String name_deObfs = "getPossibleCreatures"; - String name_Obfs = "func_73155_a"; + String name_src = "func_73155_a"; + String name_Obfs = "a"; String dsc_deObfs = "(Lnet/minecraft/entity/EnumCreatureType;III)Ljava/util/List;"; String dsc_Obfs = "(Lsx;III)Ljava/util/List;"; + for (int i = 0; i < methods.size(); i++) { - if ((methods.get(i).name.equalsIgnoreCase(obfs?name_Obfs:name_deObfs) && methods.get(i).desc.equalsIgnoreCase(obfs?dsc_Obfs:dsc_deObfs))||(methods.get(i).name.equalsIgnoreCase(!obfs?name_Obfs:name_deObfs) && methods.get(i).desc.equalsIgnoreCase(!obfs?dsc_Obfs:dsc_deObfs))) { - BWCore.BWCORE_LOG.info("Found "+(name_deObfs)+"! Patching!"); + if (ASMUtils.isCorrectMethod(methods.get(i), name_deObfs, name_Obfs, name_src) && ASMUtils.isCorrectMethod(methods.get(i), dsc_deObfs, dsc_Obfs)) { + BWCore.BWCORE_LOG.info("Found " + (name_deObfs) + "! Patching!"); MethodNode toPatch = methods.get(i); InsnList insnList = new InsnList(); - insnList.add(new InsnNode(Opcodes.ACONST_NULL)); - insnList.add(new InsnNode(Opcodes.ARETURN)); + insnList.add(new InsnNode(ACONST_NULL)); + insnList.add(new InsnNode(ARETURN)); toPatch.instructions = insnList; toPatch.maxStack = 1; toPatch.maxLocals = 5; @@ -121,92 +113,93 @@ public class BWCoreTransformer implements IClassTransformer { } break; } - case 2:{ + case 2: { String name_deObfs = "renderSky"; - String name_Obfs = "func_72714_a"; - String dsc_deObfs = "(F)V"; - BWCore.BWCORE_LOG.info("Could find: "+CLASSESBEEINGTRANSFORMED[id]); + String name_src = "func_72714_a"; + String name_Obfs = "a"; + String dsc_universal = "(F)V"; + String field_deObfs = "locationSunPng"; + String field_src = "field_110928_i"; + BWCore.BWCORE_LOG.info("Could find: " + CLASSESBEEINGTRANSFORMED[id]); for (int i = 0; i < methods.size(); i++) { MethodNode toPatch = methods.get(i); - if ((toPatch.name.equalsIgnoreCase(name_Obfs) || toPatch.name.equalsIgnoreCase(name_deObfs)) && methods.get(i).desc.equalsIgnoreCase(dsc_deObfs)) { - BWCore.BWCORE_LOG.info("Found "+(name_deObfs)+"! Patching!"); + if (ASMUtils.isCorrectMethod(methods.get(i), name_deObfs, name_Obfs, name_src) && ASMUtils.isCorrectMethod(methods.get(i), dsc_universal)) { + BWCore.BWCORE_LOG.info("Found " + (name_deObfs) + "! Patching!"); InsnList nu = new InsnList(); - LabelNode[] LabelNodes = { new LabelNode(),new LabelNode()}; + LabelNode[] LabelNodes = {new LabelNode(), new LabelNode()}; + + String theWorld_src = "field_72769_h"; + String renderEngine_src = "field_72770_i"; + String provider_src = "field_73011_w"; + String bindTexture_src = "func_110577_a"; + String nameFieldToPatch; + for (int j = 0; j < toPatch.instructions.size(); j++) { - if (toPatch.instructions.get(j) instanceof LineNumberNode && ((LineNumberNode) toPatch.instructions.get(j)).line == 1190) { - nu.add(toPatch.instructions.get(j)); + if (toPatch.instructions.get(j) instanceof FieldInsnNode && ((FieldInsnNode) toPatch.instructions.get(j)).getOpcode() == GETSTATIC && !(nameFieldToPatch = ASMUtils.matchAny(((FieldInsnNode) toPatch.instructions.get(j)).name, field_deObfs, field_src)).isEmpty()) { + boolean useSrc = nameFieldToPatch.equals(field_src); + if (useSrc) + BWCore.BWCORE_LOG.info("Found either Optifine or Fastcraft... this patch was annoying to make compatible to them..."); + nu.add(new VarInsnNode(ALOAD, 0)); - nu.add(new FieldInsnNode(GETFIELD, "net/minecraft/client/renderer/RenderGlobal", "theWorld", "Lnet/minecraft/client/multiplayer/WorldClient;")); - nu.add(new FieldInsnNode(GETFIELD, "net/minecraft/client/multiplayer/WorldClient", "provider", "Lnet/minecraft/world/WorldProvider;")); + nu.add(new FieldInsnNode(GETFIELD, "net/minecraft/client/renderer/RenderGlobal", useSrc ? theWorld_src : "theWorld", "Lnet/minecraft/client/multiplayer/WorldClient;")); + nu.add(new FieldInsnNode(GETFIELD, "net/minecraft/client/multiplayer/WorldClient", useSrc ? provider_src : "provider", "Lnet/minecraft/world/WorldProvider;")); nu.add(new TypeInsnNode(INSTANCEOF, "com/github/bartimaeusnek/crossmod/galacticraft/planets/ross128/world/worldprovider/WorldProviderRoss128b")); nu.add(new JumpInsnNode(IFEQ, LabelNodes[0])); nu.add(new VarInsnNode(ALOAD, 0)); - nu.add(new FieldInsnNode(GETFIELD, "net/minecraft/client/renderer/RenderGlobal", "renderEngine", "Lnet/minecraft/client/renderer/texture/TextureManager;")); + nu.add(new FieldInsnNode(GETFIELD, "net/minecraft/client/renderer/RenderGlobal", useSrc ? renderEngine_src : "renderEngine", "Lnet/minecraft/client/renderer/texture/TextureManager;")); nu.add(new FieldInsnNode(GETSTATIC, "com/github/bartimaeusnek/crossmod/galacticraft/planets/ross128/world/worldprovider/SkyProviderRoss128b", "sunTex", "Lnet/minecraft/util/ResourceLocation;")); - nu.add(new MethodInsnNode(INVOKEVIRTUAL, "net/minecraft/client/renderer/texture/TextureManager", "bindTexture", "(Lnet/minecraft/util/ResourceLocation;)V", false)); + nu.add(new MethodInsnNode(INVOKEVIRTUAL, "net/minecraft/client/renderer/texture/TextureManager", useSrc ? bindTexture_src : "bindTexture", "(Lnet/minecraft/util/ResourceLocation;)V", false)); nu.add(new JumpInsnNode(GOTO, LabelNodes[1])); nu.add(LabelNodes[0]); nu.add(new VarInsnNode(ALOAD, 0)); - nu.add(new FieldInsnNode(GETFIELD, "net/minecraft/client/renderer/RenderGlobal", "renderEngine", "Lnet/minecraft/client/renderer/texture/TextureManager;")); - nu.add(new FieldInsnNode(GETSTATIC, "net/minecraft/client/renderer/RenderGlobal", "locationSunPng", "Lnet/minecraft/util/ResourceLocation;")); - nu.add(new MethodInsnNode(INVOKEVIRTUAL, "net/minecraft/client/renderer/texture/TextureManager", "bindTexture", "(Lnet/minecraft/util/ResourceLocation;)V", false)); + nu.add(new FieldInsnNode(GETFIELD, "net/minecraft/client/renderer/RenderGlobal", useSrc ? renderEngine_src : "renderEngine", "Lnet/minecraft/client/renderer/texture/TextureManager;")); + nu.add(new FieldInsnNode(GETSTATIC, "net/minecraft/client/renderer/RenderGlobal", useSrc ? field_src : "locationSunPng", "Lnet/minecraft/util/ResourceLocation;")); + nu.add(new MethodInsnNode(INVOKEVIRTUAL, "net/minecraft/client/renderer/texture/TextureManager", useSrc ? bindTexture_src : "bindTexture", "(Lnet/minecraft/util/ResourceLocation;)V", false)); nu.add(LabelNodes[1]); - j+=5; - -// if (toPatch.instructions.get(j) instanceof LineNumberNode && ((LineNumberNode) toPatch.instructions.get(j)).line == 308) { -// nu.add(toPatch.instructions.get(j)); -// nu.add(new VarInsnNode(ALOAD, 0)); -// nu.add(new TypeInsnNode(INSTANCEOF, "com/github/bartimaeusnek/crossmod/galacticraft/planets/ross128/world/worldprovider/SkyProviderRoss128b")); -// nu.add(new JumpInsnNode(IFEQ, LabelNodes[0])); -// nu.add(new VarInsnNode(ALOAD, 0)); -// nu.add(new FieldInsnNode(GETFIELD, "micdoodle8/mods/galacticraft/core/client/SkyProviderOverworld", "minecraft", "Lnet/minecraft/client/Minecraft;")); -// nu.add(new FieldInsnNode(GETFIELD, "net/minecraft/client/Minecraft", "renderEngine", "Lnet/minecraft/client/renderer/texture/TextureManager;")); -// nu.add(new FieldInsnNode(GETSTATIC, "com/github/bartimaeusnek/crossmod/galacticraft/planets/ross128/world/worldprovider/SkyProviderRoss128b", "sunTex", "Lnet/minecraft/util/ResourceLocation;")); -// nu.add(new MethodInsnNode(INVOKEVIRTUAL, "net/minecraft/client/renderer/texture/TextureManager", "bindTexture", "(Lnet/minecraft/util/ResourceLocation;)V", false)); -// nu.add(new JumpInsnNode(GOTO, LabelNodes[1])); -// nu.add(LabelNodes[0]); -// nu.add(new VarInsnNode(ALOAD, 0)); -// nu.add(new FieldInsnNode(GETFIELD, "micdoodle8/mods/galacticraft/core/client/SkyProviderOverworld", "minecraft", "Lnet/minecraft/client/Minecraft;")); -// nu.add(new FieldInsnNode(GETFIELD, "net/minecraft/client/Minecraft", "renderEngine", "Lnet/minecraft/client/renderer/texture/TextureManager;")); -// nu.add(new FieldInsnNode(GETSTATIC, "micdoodle8/mods/galacticraft/core/client/SkyProviderOverworld", "sunTexture", "Lnet/minecraft/util/ResourceLocation;")); -// nu.add(new MethodInsnNode(INVOKEVIRTUAL, "net/minecraft/client/renderer/texture/TextureManager", "bindTexture", "(Lnet/minecraft/util/ResourceLocation;)V", false)); -// nu.add(LabelNodes[1]); -// j+=5; + j++; + } else { + if (j < toPatch.instructions.size() - 2) { + if (toPatch.instructions.get(j + 2) instanceof FieldInsnNode && ((FieldInsnNode) toPatch.instructions.get(j + 2)).getOpcode() == GETSTATIC && !ASMUtils.matchAny(((FieldInsnNode) toPatch.instructions.get(j + 2)).name, field_deObfs, field_src).isEmpty()) + continue; + if (toPatch.instructions.get(j + 1) instanceof FieldInsnNode && ((FieldInsnNode) toPatch.instructions.get(j + 1)).getOpcode() == GETSTATIC && !ASMUtils.matchAny(((FieldInsnNode) toPatch.instructions.get(j + 1)).name, field_deObfs, field_src).isEmpty()) + continue; + } nu.add(toPatch.instructions.get(j)); } } - toPatch.instructions=nu; + toPatch.instructions = nu; break; } } break; } default: { - BWCore.BWCORE_LOG.info("Could not find: "+CLASSESBEEINGTRANSFORMED[id]); + BWCore.BWCORE_LOG.info("Could not find: " + CLASSESBEEINGTRANSFORMED[id]); return basicClass; } } - classNode.methods=methods; + classNode.methods = methods; ClassWriter classWriter = new ClassWriter(ClassWriter.COMPUTE_FRAMES); classNode.accept(classWriter); byte[] ret = classWriter.toByteArray(); if (Arrays.hashCode(basicClass) == Arrays.hashCode(ret)) - BWCore.BWCORE_LOG.warn("Could not patch: "+CLASSESBEEINGTRANSFORMED[id]); -// try { -// OutputStream os = new FileOutputStream(new File("C:/test/"+CLASSESBEEINGTRANSFORMED[id]+".class")); -// os.write(classWriter.toByteArray()); -// } catch (FileNotFoundException e) { -// e.printStackTrace(); -// } catch (IOException e) { -// e.printStackTrace(); -// } + BWCore.BWCORE_LOG.warn("Could not patch: " + CLASSESBEEINGTRANSFORMED[id]); return ret; } return basicClass; } + @Override + public byte[] transform(String name, String transformedName, byte[] basicClass) { + for (int i = 0; i < BWCoreTransformer.CLASSESBEEINGTRANSFORMED.length; i++) { + if (name.equalsIgnoreCase(BWCoreTransformer.CLASSESBEEINGTRANSFORMED[i]) || transformedName.equalsIgnoreCase(BWCoreTransformer.CLASSESBEEINGTRANSFORMED[i])) + return BWCoreTransformer.transform(i, basicClass); + } + return basicClass; + } + } diff --git a/src/main/java/com/github/bartimaeusnek/bartworks/API/BioObjectAdder.java b/src/main/java/com/github/bartimaeusnek/bartworks/API/BioObjectAdder.java index 92600b5bfe..3dcd7596fb 100644 --- a/src/main/java/com/github/bartimaeusnek/bartworks/API/BioObjectAdder.java +++ b/src/main/java/com/github/bartimaeusnek/bartworks/API/BioObjectAdder.java @@ -150,19 +150,19 @@ public final class BioObjectAdder { * @param voltageTier (i.e. 6 for LuV, 7 for ZPM, only intresting for LuV+) * @return the propper Bacteria Tier (at least 0) */ - public static int getBacteriaTierFromVoltageTier(int voltageTier){ - return voltageTier-6 > 0 ? voltageTier-6 : 0; + public static int getBacteriaTierFromVoltageTier(int voltageTier) { + return voltageTier - 6 > 0 ? voltageTier - 6 : 0; } /** * If you get NPE's related to BioCultures (most likely because of Load Order or creating BioCultures after the postinit Phase) execute this. */ - public static void regenerateBioFluids(){ + public static void regenerateBioFluids() { for (BioCulture B : BioCulture.BIO_CULTURE_ARRAY_LIST) { if (B.getFluidNotSet()) { B.setFluid(new GT_Fluid(B.getName().replaceAll(" ", "").toLowerCase() + "fluid", "molten.autogenerated", new short[]{(short) B.getColor().getRed(), (short) B.getColor().getBlue(), (short) B.getColor().getGreen()})); if (!FluidRegistry.registerFluid(B.getFluid())) - new Exception("FAILED TO REGISTER FLUID FOR: "+B.getName()).printStackTrace(); + new Exception("FAILED TO REGISTER FLUID FOR: " + B.getName()).printStackTrace(); } } } diff --git a/src/main/java/com/github/bartimaeusnek/bartworks/API/WerkstoffAdderRegistry.java b/src/main/java/com/github/bartimaeusnek/bartworks/API/WerkstoffAdderRegistry.java index 29c45e5074..f35d86218f 100644 --- a/src/main/java/com/github/bartimaeusnek/bartworks/API/WerkstoffAdderRegistry.java +++ b/src/main/java/com/github/bartimaeusnek/bartworks/API/WerkstoffAdderRegistry.java @@ -26,17 +26,17 @@ import java.util.HashSet; public final class WerkstoffAdderRegistry implements Runnable { - private WerkstoffAdderRegistry(){} - static final WerkstoffAdderRegistry INSTANCE = new WerkstoffAdderRegistry(); + final HashSet toRun = new HashSet<>(); - final HashSet toRun= new HashSet<>(); + private WerkstoffAdderRegistry() { + } public static final WerkstoffAdderRegistry getINSTANCE() { return INSTANCE; } - public static void addWerkstoffAdder(Runnable adder){ + public static void addWerkstoffAdder(Runnable adder) { INSTANCE.toRun.add(adder); } diff --git a/src/main/java/com/github/bartimaeusnek/bartworks/MainMod.java b/src/main/java/com/github/bartimaeusnek/bartworks/MainMod.java index 461d8e0f81..8bde0e73b4 100644 --- a/src/main/java/com/github/bartimaeusnek/bartworks/MainMod.java +++ b/src/main/java/com/github/bartimaeusnek/bartworks/MainMod.java @@ -35,8 +35,10 @@ import com.github.bartimaeusnek.bartworks.common.loaders.BioLabLoader; import com.github.bartimaeusnek.bartworks.common.loaders.GTNHBlocks; import com.github.bartimaeusnek.bartworks.common.loaders.LoaderRegistry; import com.github.bartimaeusnek.bartworks.common.net.BW_Network; +import com.github.bartimaeusnek.bartworks.system.material.Werkstoff; import com.github.bartimaeusnek.bartworks.system.material.WerkstoffLoader; import com.github.bartimaeusnek.bartworks.util.BW_Util; +import com.github.bartimaeusnek.cropspp.ConfigValures; import com.github.bartimaeusnek.crossmod.galacticraft.planets.ross128.world.oregen.BW_WordGenerator; import cpw.mods.fml.common.FMLCommonHandler; import cpw.mods.fml.common.Loader; @@ -106,7 +108,10 @@ public final class MainMod { BioCultureLoader bioCultureLoader = new BioCultureLoader(); bioCultureLoader.run(); } - WerkstoffLoader.INSTANCE.init(); + if (ConfigHandler.newStuff) { + WerkstoffLoader.INSTANCE.init(); + Werkstoff.init(); + } } @Mod.EventHandler @@ -116,7 +121,8 @@ public final class MainMod { new LoaderRegistry().run(); if (ConfigHandler.BioLab) new BioLabLoader().run(); - WerkstoffLoader.INSTANCE.runInit(); + if (ConfigHandler.newStuff) + WerkstoffLoader.INSTANCE.runInit(); } @Mod.EventHandler @@ -125,32 +131,33 @@ public final class MainMod { if (ConfigHandler.BioLab) new GTNHBlocks().run(); BioObjectAdder.regenerateBioFluids(); - new BW_WordGenerator(); - WerkstoffLoader.INSTANCE.run(); - } - - @Mod.EventHandler - public void onServerStarted(FMLServerStartedEvent event){ - eicMap = new GT_Recipe.GT_Recipe_Map(new HashSet(GT_Recipe.GT_Recipe_Map.sImplosionRecipes.mRecipeList.size()), "gt.recipe.electricimplosioncompressor", "Electric Implosion Compressor", (String)null, "gregtech:textures/gui/basicmachines/Default", 1, 2, 1, 0, 1, "", 1, "", true, true); - for (GT_Recipe recipe : GT_Recipe.GT_Recipe_Map.sImplosionRecipes.mRecipeList){ - if (recipe == null || recipe.mInputs == null) - continue; - ItemStack input = recipe.mInputs[0]; - int i = 0; - while(checkForExplosives(input)){ - try { - i++; - input = recipe.mInputs[i]; - }catch (ArrayIndexOutOfBoundsException e){ - LOGGER.error("CAUGHT DEFECTIVE IMPLOSION COMPRESSOR RECIPE."); - e.printStackTrace(); - } - } - eicMap.addRecipe(true,new ItemStack[]{input}, recipe.mOutputs,null,null,null,recipe.mDuration, BW_Util.getMachineVoltageFromTier(10),0); - } + if (ConfigHandler.newStuff) + WerkstoffLoader.INSTANCE.run(); + ConfigHandler.setUpComments(); } - private boolean checkForExplosives(ItemStack input){ - return (GT_Utility.areStacksEqual(input,new ItemStack(Blocks.tnt)) || GT_Utility.areStacksEqual(input, GT_ModHandler.getIC2Item("industrialTnt", 1L)) || GT_Utility.areStacksEqual(input, GT_ModHandler.getIC2Item("dynamite", 1L))|| GT_Utility.areStacksEqual(input, ItemList.Block_Powderbarrel.get(1L))); - } +// @Mod.EventHandler +// public void onServerStarted(FMLServerStartedEvent event) { +// eicMap = new GT_Recipe.GT_Recipe_Map(new HashSet(GT_Recipe.GT_Recipe_Map.sImplosionRecipes.mRecipeList.size()), "gt.recipe.electricimplosioncompressor", "Electric Implosion Compressor", (String) null, "gregtech:textures/gui/basicmachines/Default", 1, 2, 1, 0, 1, "", 1, "", true, true); +// for (GT_Recipe recipe : GT_Recipe.GT_Recipe_Map.sImplosionRecipes.mRecipeList) { +// if (recipe == null || recipe.mInputs == null) +// continue; +// ItemStack input = recipe.mInputs[0]; +// int i = 0; +// while (checkForExplosives(input)) { +// try { +// i++; +// input = recipe.mInputs[i]; +// } catch (ArrayIndexOutOfBoundsException e) { +// LOGGER.error("CAUGHT DEFECTIVE IMPLOSION COMPRESSOR RECIPE."); +// e.printStackTrace(); +// } +// } +// eicMap.addRecipe(true, new ItemStack[]{input}, recipe.mOutputs, null, null, null, recipe.mDuration, BW_Util.getMachineVoltageFromTier(10), 0); +// } +// } +// +// private boolean checkForExplosives(ItemStack input) { +// return (GT_Utility.areStacksEqual(input, new ItemStack(Blocks.tnt)) || GT_Utility.areStacksEqual(input, GT_ModHandler.getIC2Item("industrialTnt", 1L)) || GT_Utility.areStacksEqual(input, GT_ModHandler.getIC2Item("dynamite", 1L)) || GT_Utility.areStacksEqual(input, ItemList.Block_Powderbarrel.get(1L))); +// } } diff --git a/src/main/java/com/github/bartimaeusnek/bartworks/client/ClientEventHandler/ClientEventHandler.java b/src/main/java/com/github/bartimaeusnek/bartworks/client/ClientEventHandler/ClientEventHandler.java index 79f3cf387e..b2b152aee9 100644 --- a/src/main/java/com/github/bartimaeusnek/bartworks/client/ClientEventHandler/ClientEventHandler.java +++ b/src/main/java/com/github/bartimaeusnek/bartworks/client/ClientEventHandler/ClientEventHandler.java @@ -56,13 +56,13 @@ public class ClientEventHandler { if (GLASSMAP.containsKey(PAIR)) { int tier = GLASSMAP.get(PAIR); event.toolTip.add( - StatCollector.translateToLocal("tooltip.glas.0.name")+ - " " + StatCollector.translateToLocal("tooltip.glas.0.name") + + " " + BW_Util.getColorForTier(tier) + GT_Values.VN[tier] + ChatColorHelper.RESET); } else if (BLOCK.getMaterial().equals(Material.glass)) { - event.toolTip.add(StatCollector.translateToLocal("tooltip.glas.0.name")+ + event.toolTip.add(StatCollector.translateToLocal("tooltip.glas.0.name") + " " - + BW_Util.getColorForTier(3) + GT_Values.VN[3] + ChatColorHelper.RESET); + + BW_Util.getColorForTier(3) + GT_Values.VN[3] + ChatColorHelper.RESET); } } } \ No newline at end of file diff --git a/src/main/java/com/github/bartimaeusnek/bartworks/client/renderer/BW_Renderer_Block_Ores.java b/src/main/java/com/github/bartimaeusnek/bartworks/client/renderer/BW_Renderer_Block_Ores.java index 1105ae39ea..7f537b5054 100644 --- a/src/main/java/com/github/bartimaeusnek/bartworks/client/renderer/BW_Renderer_Block_Ores.java +++ b/src/main/java/com/github/bartimaeusnek/bartworks/client/renderer/BW_Renderer_Block_Ores.java @@ -41,43 +41,43 @@ public class BW_Renderer_Block_Ores implements ISimpleBlockRenderingHandler { @Override public void renderInventoryBlock(Block aBlock, int aMeta, int modelId, RenderBlocks aRenderer) { BW_MetaGeneratedOreTE tTileEntity = new BW_MetaGeneratedOreTE(); - tTileEntity.mMetaData = (short)aMeta; + tTileEntity.mMetaData = (short) aMeta; aBlock.setBlockBoundsForItemRender(); aRenderer.setRenderBoundsFromBlock(aBlock); GL11.glRotatef(90.0F, 0.0F, 1.0F, 0.0F); GL11.glTranslatef(-0.5F, -0.5F, -0.5F); Tessellator.instance.startDrawingQuads(); Tessellator.instance.setNormal(0.0F, -1.0F, 0.0F); - renderNegativeYFacing((IBlockAccess)null, aRenderer, aBlock, 0, 0, 0, tTileEntity.getTexture(aBlock, (byte)0), true); + renderNegativeYFacing((IBlockAccess) null, aRenderer, aBlock, 0, 0, 0, tTileEntity.getTexture(aBlock, (byte) 0), true); Tessellator.instance.draw(); Tessellator.instance.startDrawingQuads(); Tessellator.instance.setNormal(0.0F, 1.0F, 0.0F); - renderPositiveYFacing((IBlockAccess)null, aRenderer, aBlock, 0, 0, 0, tTileEntity.getTexture(aBlock, (byte)1), true); + renderPositiveYFacing((IBlockAccess) null, aRenderer, aBlock, 0, 0, 0, tTileEntity.getTexture(aBlock, (byte) 1), true); Tessellator.instance.draw(); Tessellator.instance.startDrawingQuads(); Tessellator.instance.setNormal(0.0F, 0.0F, -1.0F); - renderNegativeZFacing((IBlockAccess)null, aRenderer, aBlock, 0, 0, 0, tTileEntity.getTexture(aBlock, (byte)2), true); + renderNegativeZFacing((IBlockAccess) null, aRenderer, aBlock, 0, 0, 0, tTileEntity.getTexture(aBlock, (byte) 2), true); Tessellator.instance.draw(); Tessellator.instance.startDrawingQuads(); Tessellator.instance.setNormal(0.0F, 0.0F, 1.0F); - renderPositiveZFacing((IBlockAccess)null, aRenderer, aBlock, 0, 0, 0, tTileEntity.getTexture(aBlock, (byte)3), true); + renderPositiveZFacing((IBlockAccess) null, aRenderer, aBlock, 0, 0, 0, tTileEntity.getTexture(aBlock, (byte) 3), true); Tessellator.instance.draw(); Tessellator.instance.startDrawingQuads(); Tessellator.instance.setNormal(-1.0F, 0.0F, 0.0F); - renderNegativeXFacing((IBlockAccess)null, aRenderer, aBlock, 0, 0, 0, tTileEntity.getTexture(aBlock, (byte)4), true); + renderNegativeXFacing((IBlockAccess) null, aRenderer, aBlock, 0, 0, 0, tTileEntity.getTexture(aBlock, (byte) 4), true); Tessellator.instance.draw(); Tessellator.instance.startDrawingQuads(); Tessellator.instance.setNormal(1.0F, 0.0F, 0.0F); - renderPositiveXFacing((IBlockAccess)null, aRenderer, aBlock, 0, 0, 0, tTileEntity.getTexture(aBlock, (byte)5), true); + renderPositiveXFacing((IBlockAccess) null, aRenderer, aBlock, 0, 0, 0, tTileEntity.getTexture(aBlock, (byte) 5), true); Tessellator.instance.draw(); aBlock.setBlockBounds(0.0F, 0.0F, 0.0F, 1.0F, 1.0F, 1.0F); aRenderer.setRenderBoundsFromBlock(aBlock); GL11.glTranslatef(0.5F, 0.5F, 0.5F); -} + } @Override public boolean renderWorldBlock(IBlockAccess world, int x, int y, int z, Block block, int modelId, RenderBlocks renderer) { - return GT_Renderer_Block.renderStandardBlock(world,x,y,z,block,renderer); + return GT_Renderer_Block.renderStandardBlock(world, x, y, z, block, renderer); } @Override diff --git a/src/main/java/com/github/bartimaeusnek/bartworks/common/configs/ConfigHandler.java b/src/main/java/com/github/bartimaeusnek/bartworks/common/configs/ConfigHandler.java index cf5e0aab78..1539ec80ac 100644 --- a/src/main/java/com/github/bartimaeusnek/bartworks/common/configs/ConfigHandler.java +++ b/src/main/java/com/github/bartimaeusnek/bartworks/common/configs/ConfigHandler.java @@ -67,4 +67,13 @@ public class ConfigHandler { } + public static void setUpComments(){ + c.addCustomCategoryComment("ASM fixes","Disable ASM fixes here."); + c.addCustomCategoryComment("Multiblocks","Multliblock Options can be set here."); + c.addCustomCategoryComment("Singleblocks","Singleblock Options can be set here."); + c.addCustomCategoryComment("System","Different System Settings can be set here."); + c.addCustomCategoryComment("CrossMod Interactions","CrossMod Interaction Settings can be set here. For Underground Fluid settings change the Gregtech.cfg!"); + c.save(); + } + } diff --git a/src/main/java/com/github/bartimaeusnek/bartworks/common/items/BW_ItemBlocks.java b/src/main/java/com/github/bartimaeusnek/bartworks/common/items/BW_ItemBlocks.java index c9286aec26..ea0457dcc6 100644 --- a/src/main/java/com/github/bartimaeusnek/bartworks/common/items/BW_ItemBlocks.java +++ b/src/main/java/com/github/bartimaeusnek/bartworks/common/items/BW_ItemBlocks.java @@ -67,7 +67,7 @@ public class BW_ItemBlocks extends ItemBlock { @SideOnly(Side.CLIENT) public void addInformation(final ItemStack aStack, final EntityPlayer aPlayer, final List aList, final boolean aF3_H) { if (this.field_150939_a instanceof BW_GlasBlocks) - aList.add(StatCollector.translateToLocal("tooltip.glas.0.name") +" " + BW_Util.getColorForTier(BW_Util.getTierFromGlasMeta(aStack.getItemDamage())) + GT_Values.VN[BW_Util.getTierFromGlasMeta(aStack.getItemDamage())]); + aList.add(StatCollector.translateToLocal("tooltip.glas.0.name") + " " + BW_Util.getColorForTier(BW_Util.getTierFromGlasMeta(aStack.getItemDamage())) + GT_Values.VN[BW_Util.getTierFromGlasMeta(aStack.getItemDamage())]); if (this.field_150939_a instanceof ITileAddsInformation) { for (int i = 0; i < ((ITileAddsInformation) this.field_150939_a).getInfoData().length; i++) { aList.add(((ITileAddsInformation) this.field_150939_a).getInfoData()[i]); @@ -77,7 +77,7 @@ public class BW_ItemBlocks extends ItemBlock { if (!(this.field_150939_a instanceof ITileEntityProvider)) aList.add(this.mNoTileEntityToolTip); - aList.add(StatCollector.translateToLocal("tooltip.bw.0.name")+ ChatColorHelper.DARKGREEN + " BartWorks"); + aList.add(StatCollector.translateToLocal("tooltip.bw.0.name") + ChatColorHelper.DARKGREEN + " BartWorks"); } @Override diff --git a/src/main/java/com/github/bartimaeusnek/bartworks/common/items/BW_SimpleWindMeter.java b/src/main/java/com/github/bartimaeusnek/bartworks/common/items/BW_SimpleWindMeter.java index 66ff1725de..f308420d14 100644 --- a/src/main/java/com/github/bartimaeusnek/bartworks/common/items/BW_SimpleWindMeter.java +++ b/src/main/java/com/github/bartimaeusnek/bartworks/common/items/BW_SimpleWindMeter.java @@ -57,7 +57,7 @@ public class BW_SimpleWindMeter extends Item { public void addInformation(ItemStack itemStack, EntityPlayer entityPlayer, List list, boolean p_77624_4_) { super.addInformation(itemStack, entityPlayer, list, p_77624_4_); list.add(StatCollector.translateToLocal("tooltip.windmeter.0.name")); - list.add(StatCollector.translateToLocal("tooltip.windmeter.1.name")+" " + (this.getMaxDamage() - this.getDamage(itemStack)) + "/" + this.getMaxDamage()); + list.add(StatCollector.translateToLocal("tooltip.windmeter.1.name") + " " + (this.getMaxDamage() - this.getDamage(itemStack)) + "/" + this.getMaxDamage()); list.add(StatCollector.translateToLocal("tooltip.bw.0.name") + ChatColorHelper.DARKGREEN + " BartWorks"); } @@ -68,7 +68,7 @@ public class BW_SimpleWindMeter extends Item { float windStrength = (float) WorldData.get(world).windSim.getWindAt(entityPlayer.posY); String windS = windStrength < 1f ? StatCollector.translateToLocal("tooltip.windmeter.2.name") : windStrength < 10f ? StatCollector.translateToLocal("tooltip.windmeter.3.name") : windStrength < 20f ? StatCollector.translateToLocal("tooltip.windmeter.4.name") : windStrength < 30f ? StatCollector.translateToLocal("tooltip.windmeter.5.name") : windStrength < 50f ? StatCollector.translateToLocal("tooltip.windmeter.6.name") : StatCollector.translateToLocal("tooltip.windmeter.7.name"); - entityPlayer.addChatMessage(new ChatComponentText(StatCollector.translateToLocal("tooltip.windmeter.8.name")+" " + windS + ".")); + entityPlayer.addChatMessage(new ChatComponentText(StatCollector.translateToLocal("tooltip.windmeter.8.name") + " " + windS + ".")); itemStack.damageItem(1, entityPlayer); return itemStack; } diff --git a/src/main/java/com/github/bartimaeusnek/bartworks/common/items/BW_Stonage_Rotors.java b/src/main/java/com/github/bartimaeusnek/bartworks/common/items/BW_Stonage_Rotors.java index 71d9b0886f..f67a912aee 100644 --- a/src/main/java/com/github/bartimaeusnek/bartworks/common/items/BW_Stonage_Rotors.java +++ b/src/main/java/com/github/bartimaeusnek/bartworks/common/items/BW_Stonage_Rotors.java @@ -76,9 +76,9 @@ public class BW_Stonage_Rotors extends Item implements IKineticRotor { } else if (Minecraft.getMinecraft().currentScreen instanceof GuiWindKineticGenerator) { type = WIND; } - info.add(StatCollector.translateToLocal("tooltip.rotor.0.name")+" " + this.DiaMinMax[0]); - info.add(StatCollector.translateToLocal("tooltip.rotor.1.name")+" " + (this.getMaxDamage() - this.getDamage(itemStack)) + "/" + this.getMaxDamage()); - info.add(StatCollector.translateToLocal("tooltip.rotor.2.name")+" " + this.eff); + info.add(StatCollector.translateToLocal("tooltip.rotor.0.name") + " " + this.DiaMinMax[0]); + info.add(StatCollector.translateToLocal("tooltip.rotor.1.name") + " " + (this.getMaxDamage() - this.getDamage(itemStack)) + "/" + this.getMaxDamage()); + info.add(StatCollector.translateToLocal("tooltip.rotor.2.name") + " " + this.eff); if (type != null) { info.add(StatCollector.translateToLocal(("ic2.itemrotor.fitsin." + this.isAcceptedType(itemStack, type)))); } diff --git a/src/main/java/com/github/bartimaeusnek/bartworks/common/items/Circuit_Programmer.java b/src/main/java/com/github/bartimaeusnek/bartworks/common/items/Circuit_Programmer.java index 621394d199..c3491ca6f3 100644 --- a/src/main/java/com/github/bartimaeusnek/bartworks/common/items/Circuit_Programmer.java +++ b/src/main/java/com/github/bartimaeusnek/bartworks/common/items/Circuit_Programmer.java @@ -54,7 +54,7 @@ public class Circuit_Programmer extends GT_Generic_Item implements IElectricItem public void addInformation(ItemStack aStack, EntityPlayer aPlayer, List aList, boolean aF3_H) { super.addInformation(aStack, aPlayer, aList, aF3_H); if (aStack != null && aStack.getTagCompound() != null) - aList.add(StatCollector.translateToLocal("tooltip.cp.0.name")+" " + (aStack.getTagCompound().getBoolean("HasChip") ? StatCollector.translateToLocal("tooltip.bw.yes.name") : StatCollector.translateToLocal("tooltip.bw.no.name"))); + aList.add(StatCollector.translateToLocal("tooltip.cp.0.name") + " " + (aStack.getTagCompound().getBoolean("HasChip") ? StatCollector.translateToLocal("tooltip.bw.yes.name") : StatCollector.translateToLocal("tooltip.bw.no.name"))); aList.add(StatCollector.translateToLocal("tooltip.bw.0.name") + ChatColorHelper.DARKGREEN + " BartWorks"); } diff --git a/src/main/java/com/github/bartimaeusnek/bartworks/common/items/GT_Destructopack_Item.java b/src/main/java/com/github/bartimaeusnek/bartworks/common/items/GT_Destructopack_Item.java index 9d06a3e752..ea43784383 100644 --- a/src/main/java/com/github/bartimaeusnek/bartworks/common/items/GT_Destructopack_Item.java +++ b/src/main/java/com/github/bartimaeusnek/bartworks/common/items/GT_Destructopack_Item.java @@ -48,7 +48,7 @@ public class GT_Destructopack_Item extends GT_Generic_Item { @Override public void addInformation(ItemStack aStack, EntityPlayer aPlayer, List aList, boolean aF3_H) { super.addInformation(aStack, aPlayer, aList, aF3_H); - aList.add(StatCollector.translateToLocal("tooltip.bw.0.name") + ChatColorHelper.DARKGREEN + " BartWorks"); + aList.add(StatCollector.translateToLocal("tooltip.bw.0.name") + ChatColorHelper.DARKGREEN + " BartWorks"); } @Override diff --git a/src/main/java/com/github/bartimaeusnek/bartworks/common/items/GT_Rockcutter_Item.java b/src/main/java/com/github/bartimaeusnek/bartworks/common/items/GT_Rockcutter_Item.java index bcca88531f..f744be70b7 100644 --- a/src/main/java/com/github/bartimaeusnek/bartworks/common/items/GT_Rockcutter_Item.java +++ b/src/main/java/com/github/bartimaeusnek/bartworks/common/items/GT_Rockcutter_Item.java @@ -75,8 +75,8 @@ public class GT_Rockcutter_Item extends ItemTool implements IElectricItem { } public void addInformation(final ItemStack aStack, final EntityPlayer aPlayer, final List aList, final boolean aF3_H) { - aList.add(StatCollector.translateToLocal("tooltip.bw.tier.name") +" " + GT_Values.VN[this.mTier]); - aList.add(StatCollector.translateToLocal("tooltip.bw.0.name") + ChatColorHelper.DARKGREEN + " BartWorks"); + aList.add(StatCollector.translateToLocal("tooltip.bw.tier.name") + " " + GT_Values.VN[this.mTier]); + aList.add(StatCollector.translateToLocal("tooltip.bw.0.name") + ChatColorHelper.DARKGREEN + " BartWorks"); } public void onUpdate(ItemStack aStack, World p_77663_2_, Entity p_77663_3_, int p_77663_4_, boolean p_77663_5_) { diff --git a/src/main/java/com/github/bartimaeusnek/bartworks/common/items/LabParts.java b/src/main/java/com/github/bartimaeusnek/bartworks/common/items/LabParts.java index 4ae906c96e..c04a449103 100644 --- a/src/main/java/com/github/bartimaeusnek/bartworks/common/items/LabParts.java +++ b/src/main/java/com/github/bartimaeusnek/bartworks/common/items/LabParts.java @@ -103,16 +103,16 @@ public class LabParts extends SimpleSubItemClass { switch (itemStack.getItemDamage()) { case 0: - list.add(StatCollector.translateToLocal("tooltip.labparts.5.name")+" " + itemStack.getTagCompound().getString("Name")); + list.add(StatCollector.translateToLocal("tooltip.labparts.5.name") + " " + itemStack.getTagCompound().getString("Name")); if (!itemStack.getTagCompound().getBoolean("Breedable")) { list.add(StatCollector.translateToLocal("tooltip.labparts.6.name")); } break; case 1: - list.add(StatCollector.translateToLocal("tooltip.labparts.7.name")+" " + itemStack.getTagCompound().getString("Name")); + list.add(StatCollector.translateToLocal("tooltip.labparts.7.name") + " " + itemStack.getTagCompound().getString("Name")); break; case 2: - list.add(StatCollector.translateToLocal("tooltip.labparts.8.name")+" "+ itemStack.getTagCompound().getString("Name")); + list.add(StatCollector.translateToLocal("tooltip.labparts.8.name") + " " + itemStack.getTagCompound().getString("Name")); break; default: break; diff --git a/src/main/java/com/github/bartimaeusnek/bartworks/common/items/SimpleSubItemClass.java b/src/main/java/com/github/bartimaeusnek/bartworks/common/items/SimpleSubItemClass.java index c4abbe95b9..f5abfeecf7 100644 --- a/src/main/java/com/github/bartimaeusnek/bartworks/common/items/SimpleSubItemClass.java +++ b/src/main/java/com/github/bartimaeusnek/bartworks/common/items/SimpleSubItemClass.java @@ -59,7 +59,7 @@ public class SimpleSubItemClass extends Item { @Override public void addInformation(ItemStack p_77624_1_, EntityPlayer p_77624_2_, List aList, boolean p_77624_4_) { super.addInformation(p_77624_1_, p_77624_2_, aList, p_77624_4_); - aList.add(StatCollector.translateToLocal("tooltip.bw.0.name") + ChatColorHelper.DARKGREEN + " BartWorks"); + aList.add(StatCollector.translateToLocal("tooltip.bw.0.name") + ChatColorHelper.DARKGREEN + " BartWorks"); } @Override diff --git a/src/main/java/com/github/bartimaeusnek/bartworks/common/loaders/BioRecipeLoader.java b/src/main/java/com/github/bartimaeusnek/bartworks/common/loaders/BioRecipeLoader.java index 00546d6453..fab53818a7 100644 --- a/src/main/java/com/github/bartimaeusnek/bartworks/common/loaders/BioRecipeLoader.java +++ b/src/main/java/com/github/bartimaeusnek/bartworks/common/loaders/BioRecipeLoader.java @@ -28,7 +28,6 @@ import com.github.bartimaeusnek.bartworks.common.tileentities.tiered.GT_MetaTile import com.github.bartimaeusnek.bartworks.common.tileentities.tiered.GT_MetaTileEntity_RadioHatch; import com.github.bartimaeusnek.bartworks.util.BWRecipes; import com.github.bartimaeusnek.bartworks.util.BW_Util; -import com.github.bartimaeusnek.bartworks.util.BioCulture; import cpw.mods.fml.common.Loader; import gregtech.api.enums.GT_Values; import gregtech.api.enums.ItemList; @@ -158,8 +157,8 @@ public class BioRecipeLoader extends RecipeLoader { Materials[] circuits = {Materials.Advanced, Materials.Data, Materials.Elite, Materials.Master, Materials.Ultimate, Materials.Superconductor}; for (int i = 3; i < GT_Values.VN.length; i++) { //12625 - BioLab[(i - 3)] = new GT_MetaTileEntity_BioLab(ConfigHandler.IDOffset + GT_Values.VN.length * 6 + i, "bw.biolab"+GT_Values.VN[i], GT_Values.VN[i] + " "+StatCollector.translateToLocal("tile.biolab.name"), i).getStackForm(1L); - RadioHatch[(i - 3)] = new GT_MetaTileEntity_RadioHatch(ConfigHandler.IDOffset + GT_Values.VN.length * 7 - 2 + i ,"bw.radiohatch"+ GT_Values.VN[i], GT_Values.VN[i] + " "+StatCollector.translateToLocal("tile.radiohatch.name"), i).getStackForm(1L); + BioLab[(i - 3)] = new GT_MetaTileEntity_BioLab(ConfigHandler.IDOffset + GT_Values.VN.length * 6 + i, "bw.biolab" + GT_Values.VN[i], GT_Values.VN[i] + " " + StatCollector.translateToLocal("tile.biolab.name"), i).getStackForm(1L); + RadioHatch[(i - 3)] = new GT_MetaTileEntity_RadioHatch(ConfigHandler.IDOffset + GT_Values.VN.length * 7 - 2 + i, "bw.radiohatch" + GT_Values.VN[i], GT_Values.VN[i] + " " + StatCollector.translateToLocal("tile.radiohatch.name"), i).getStackForm(1L); try { ItemStack machinehull = ItemList.MACHINE_HULLS[i].get(1L); GT_ModHandler.addCraftingRecipe( diff --git a/src/main/java/com/github/bartimaeusnek/bartworks/common/loaders/FluidLoader.java b/src/main/java/com/github/bartimaeusnek/bartworks/common/loaders/FluidLoader.java index 00bd28bde6..f4fc82a7db 100644 --- a/src/main/java/com/github/bartimaeusnek/bartworks/common/loaders/FluidLoader.java +++ b/src/main/java/com/github/bartimaeusnek/bartworks/common/loaders/FluidLoader.java @@ -26,7 +26,6 @@ import com.github.bartimaeusnek.bartworks.client.renderer.RendererGlasBlock; import com.github.bartimaeusnek.bartworks.client.renderer.RendererSwitchingColorFluid; import com.github.bartimaeusnek.bartworks.common.blocks.BioFluidBlock; import com.github.bartimaeusnek.bartworks.common.tileentities.classic.BWTileEntityDimIDBridge; -import com.github.bartimaeusnek.bartworks.util.BW_Util; import com.github.bartimaeusnek.bartworks.util.BioCulture; import cpw.mods.fml.client.registry.RenderingRegistry; import cpw.mods.fml.common.FMLCommonHandler; diff --git a/src/main/java/com/github/bartimaeusnek/bartworks/common/loaders/ItemRegistry.java b/src/main/java/com/github/bartimaeusnek/bartworks/common/loaders/ItemRegistry.java index c4b70a6a54..a12e787ada 100644 --- a/src/main/java/com/github/bartimaeusnek/bartworks/common/loaders/ItemRegistry.java +++ b/src/main/java/com/github/bartimaeusnek/bartworks/common/loaders/ItemRegistry.java @@ -73,7 +73,7 @@ public class ItemRegistry { public static final Item WINDMETER = new BW_SimpleWindMeter(); public static final Block PUMPBLOCK = new BW_TileEntityContainer(Material.anvil, BW_TileEntity_HeatedWaterPump.class, "BWHeatedWaterPump"); public static final Item PUMPPARTS = new SimpleSubItemClass(new String[]{"BWrawtube", "BWmotor"}); - public static final Block EXPPUMP = new BW_TileEntityContainer(Material.coral, BW_TileEntity_ExperimentalFloodGate.class,"ExpReversePump"); + public static final Block EXPPUMP = new BW_TileEntityContainer(Material.coral, BW_TileEntity_ExperimentalFloodGate.class, "ExpReversePump"); public static final Block[] bw_glasses = { new BW_GlasBlocks( @@ -148,24 +148,24 @@ public class ItemRegistry { GameRegistry.registerBlock(PUMPBLOCK, BW_ItemBlocks.class, "BWHeatedWaterPumpBlock"); GameRegistry.registerItem(PUMPPARTS, "BWPumpParts"); GameRegistry.registerItem(WINDMETER, "BW_SimpleWindMeter"); - GameRegistry.registerTileEntity(BW_TileEntity_ExperimentalFloodGate.class,"BWExpReversePump"); - GameRegistry.registerBlock(EXPPUMP,BW_ItemBlocks.class,"BWExpReversePumpBlock"); + GameRegistry.registerTileEntity(BW_TileEntity_ExperimentalFloodGate.class, "BWExpReversePump"); + GameRegistry.registerBlock(EXPPUMP, BW_ItemBlocks.class, "BWExpReversePumpBlock"); for (int i = 0; i < GT_Values.VN.length; i++) { - ItemRegistry.diode2A[i] = new GT_MetaTileEntity_Diode(ConfigHandler.IDOffset + GT_Values.VN.length + 1 + i, "diode"+"2A" + GT_Values.VN[i], StatCollector.translateToLocal("tile.diode.name")+" 2A " + GT_Values.VN[i], i).getStackForm(1L); - ItemRegistry.diode4A[i] = new GT_MetaTileEntity_Diode(ConfigHandler.IDOffset + GT_Values.VN.length * 2 + 1 + i, "diode"+"4A" + GT_Values.VN[i], StatCollector.translateToLocal("tile.diode.name")+" 4A " + GT_Values.VN[i], i).getStackForm(1L); - ItemRegistry.diode8A[i] = new GT_MetaTileEntity_Diode(ConfigHandler.IDOffset + GT_Values.VN.length * 3 + 1 + i, "diode"+"8A" + GT_Values.VN[i], StatCollector.translateToLocal("tile.diode.name")+" 8A " + GT_Values.VN[i], i).getStackForm(1L); - ItemRegistry.diode12A[i] = new GT_MetaTileEntity_Diode(ConfigHandler.IDOffset + GT_Values.VN.length * 4 + 1 + i, "diode"+"12A" + GT_Values.VN[i], StatCollector.translateToLocal("tile.diode.name")+" 12A " + GT_Values.VN[i], i).getStackForm(1L); - ItemRegistry.diode16A[i] = new GT_MetaTileEntity_Diode(ConfigHandler.IDOffset + GT_Values.VN.length * 5 + 1 + i, "diode"+"16A" + GT_Values.VN[i], StatCollector.translateToLocal("tile.diode.name")+" 16A " + GT_Values.VN[i], i).getStackForm(1L); - ItemRegistry.energyDistributor[i] = new GT_MetaTileEntity_EnergyDistributor(ConfigHandler.IDOffset + 1 + i, "energydistributor" + GT_Values.VN[i], StatCollector.translateToLocal("tile.energydistributor.name")+ " " + GT_Values.VN[i], i).getStackForm(1L); + ItemRegistry.diode2A[i] = new GT_MetaTileEntity_Diode(ConfigHandler.IDOffset + GT_Values.VN.length + 1 + i, "diode" + "2A" + GT_Values.VN[i], StatCollector.translateToLocal("tile.diode.name") + " 2A " + GT_Values.VN[i], i).getStackForm(1L); + ItemRegistry.diode4A[i] = new GT_MetaTileEntity_Diode(ConfigHandler.IDOffset + GT_Values.VN.length * 2 + 1 + i, "diode" + "4A" + GT_Values.VN[i], StatCollector.translateToLocal("tile.diode.name") + " 4A " + GT_Values.VN[i], i).getStackForm(1L); + ItemRegistry.diode8A[i] = new GT_MetaTileEntity_Diode(ConfigHandler.IDOffset + GT_Values.VN.length * 3 + 1 + i, "diode" + "8A" + GT_Values.VN[i], StatCollector.translateToLocal("tile.diode.name") + " 8A " + GT_Values.VN[i], i).getStackForm(1L); + ItemRegistry.diode12A[i] = new GT_MetaTileEntity_Diode(ConfigHandler.IDOffset + GT_Values.VN.length * 4 + 1 + i, "diode" + "12A" + GT_Values.VN[i], StatCollector.translateToLocal("tile.diode.name") + " 12A " + GT_Values.VN[i], i).getStackForm(1L); + ItemRegistry.diode16A[i] = new GT_MetaTileEntity_Diode(ConfigHandler.IDOffset + GT_Values.VN.length * 5 + 1 + i, "diode" + "16A" + GT_Values.VN[i], StatCollector.translateToLocal("tile.diode.name") + " 16A " + GT_Values.VN[i], i).getStackForm(1L); + ItemRegistry.energyDistri