diff options
Diffstat (limited to 'src/main')
65 files changed, 1123 insertions, 1096 deletions
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<String, Object> 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<MethodNode> 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<Runnable> toRun = new HashSet<>(); - final HashSet<Runnable> 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.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); } for (int i = 0; i < 3; i++) { - ItemRegistry.acidGens[i] = new GT_MetaTileEntity_AcidGenerator(ConfigHandler.IDOffset + GT_Values.VN.length * 8 - 2 + i, "acidgenerator"+GT_Values.VN[i + 2], StatCollector.translateToLocal("tile.acidgenerator.name")+" " + GT_Values.VN[i + 2], i + 2).getStackForm(1); + ItemRegistry.acidGens[i] = new GT_MetaTileEntity_AcidGenerator(ConfigHandler.IDOffset + GT_Values.VN.length * 8 - 2 + i, "acidgenerator" + GT_Values.VN[i + 2], StatCollector.translateToLocal("tile.acidgenerator.name") + " " + GT_Values.VN[i + 2], i + 2).getStackForm(1); } dehp = new GT_TileEntity_DEHP(ConfigHandler.IDOffset + GT_Values.VN.length * 8 + 1, 1, "DEHP", "Deep Earth Heating Pump").getStackForm(1L); megaMachines[0] = new GT_TileEntity_MegaBlastFurnace(ConfigHandler.IDOffset + GT_Values.VN.length * 8 + 2, "MegaBlastFurnace", StatCollector.translateToLocal("tile.bw.mbf.name")).getStackForm(1L); megaMachines[1] = new GT_TileEntity_MegaVacuumFreezer(ConfigHandler.IDOffset + GT_Values.VN.length * 8 + 3, "MegaVacuumFreezer", StatCollector.translateToLocal("tile.bw.mvf.name")).getStackForm(1L); - new GT_TileEntity_ElectricImplosionCompressor( ConfigHandler.IDOffset + GT_Values.VN.length * 8 + 4,"Electric Implosion Compressor","Electric Implosion Compressor"); +// new GT_TileEntity_ElectricImplosionCompressor(ConfigHandler.IDOffset + GT_Values.VN.length * 8 + 4, "Electric Implosion Compressor", "Electric Implosion Compressor"); } diff --git a/src/main/java/com/github/bartimaeusnek/bartworks/common/loaders/RecipeLoader.java b/src/main/java/com/github/bartimaeusnek/bartworks/common/loaders/RecipeLoader.java index fe2af47746..eef7b29c49 100644 --- a/src/main/java/com/github/bartimaeusnek/bartworks/common/loaders/RecipeLoader.java +++ b/src/main/java/com/github/bartimaeusnek/bartworks/common/loaders/RecipeLoader.java @@ -24,7 +24,6 @@ package com.github.bartimaeusnek.bartworks.common.loaders; import com.github.bartimaeusnek.bartworks.MainMod; import com.github.bartimaeusnek.bartworks.common.configs.ConfigHandler; -import com.github.bartimaeusnek.bartworks.common.tileentities.multis.GT_TileEntity_ElectricImplosionCompressor; import com.github.bartimaeusnek.bartworks.common.tileentities.multis.GT_TileEntity_LESU; import com.github.bartimaeusnek.bartworks.common.tileentities.multis.GT_TileEntity_ManualTrafo; import com.github.bartimaeusnek.bartworks.common.tileentities.multis.GT_TileEntity_Windmill; @@ -730,6 +729,6 @@ public class RecipeLoader implements Runnable { ); } - } + } } diff --git a/src/main/java/com/github/bartimaeusnek/bartworks/common/net/OrePacket.java b/src/main/java/com/github/bartimaeusnek/bartworks/common/net/OrePacket.java index 74f8aad3ee..36fd4dfa36 100644 --- a/src/main/java/com/github/bartimaeusnek/bartworks/common/net/OrePacket.java +++ b/src/main/java/com/github/bartimaeusnek/bartworks/common/net/OrePacket.java @@ -43,9 +43,9 @@ public class OrePacket extends GT_Packet { public OrePacket(int x, int y, int z, int meta) { super(false); this.x = x; - this.y = (short)y; + this.y = (short) y; this.z = z; - this.meta = (short)meta; + this.meta = (short) meta; } public OrePacket() { @@ -59,7 +59,7 @@ public class OrePacket extends GT_Packet { @Override public byte[] encode() { - int hash = MurmurHash3.murmurhash3_x86_32(ByteBuffer.allocate(12).putInt(x).putInt(z).putShort(y).putShort(meta).array(),0,12,31); + int hash = MurmurHash3.murmurhash3_x86_32(ByteBuffer.allocate(12).putInt(x).putInt(z).putShort(y).putShort(meta).array(), 0, 12, 31); return ByteBuffer.allocate(16).putInt(x).putInt(z).putShort(y).putShort(meta).putInt(hash).array(); } @@ -72,8 +72,8 @@ public class OrePacket extends GT_Packet { z = buff.getInt(); y = buff.getShort(); meta = buff.getShort(); - OrePacket todecode = new OrePacket(x,y,z,meta); - if (buff.getInt() != MurmurHash3.murmurhash3_x86_32(ByteBuffer.allocate(12).putInt(x).putInt(z).putShort(y).putShort(meta).array(),0,12,31)) { + OrePacket todecode = new OrePacket(x, y, z, meta); + if (buff.getInt() != MurmurHash3.murmurhash3_x86_32(ByteBuffer.allocate(12).putInt(x).putInt(z).putShort(y).putShort(meta).array(), 0, 12, 31)) { MainMod.LOGGER.error("PACKET HASH DOES NOT MATCH!"); return null; } diff --git a/src/main/java/com/github/bartimaeusnek/bartworks/common/tileentities/classic/BW_TileEntity_ExperimentalFloodGate.java b/src/main/java/com/github/bartimaeusnek/bartworks/common/tileentities/classic/BW_TileEntity_ExperimentalFloodGate.java index 86b9ed0e20..d71969e12b 100644 --- a/src/main/java/com/github/bartimaeusnek/bartworks/common/tileentities/classic/BW_TileEntity_ExperimentalFloodGate.java +++ b/src/main/java/com/github/bartimaeusnek/bartworks/common/tileentities/classic/BW_TileEntity_ExperimentalFloodGate.java @@ -23,7 +23,6 @@ package com.github.bartimaeusnek.bartworks.common.tileentities.classic; import com.github.bartimaeusnek.bartworks.API.ITileAddsInformation; -import com.github.bartimaeusnek.bartworks.MainMod; import com.github.bartimaeusnek.bartworks.util.Coords; import net.minecraft.block.Block; import net.minecraft.init.Blocks; @@ -36,8 +35,8 @@ import java.util.List; public class BW_TileEntity_ExperimentalFloodGate extends TileFluidHandler implements ITileAddsInformation { - private long ticks = 0; recursiveBelowCheck check = new recursiveBelowCheck(); + private long ticks = 0; private long noOfIts = 0; private Coords paused; @@ -47,8 +46,8 @@ public class BW_TileEntity_ExperimentalFloodGate extends TileFluidHandler implem @Override public void updateEntity() { - if (paused == null){ - this.paused = new Coords(this.xCoord,this.yCoord,this.zCoord,this.worldObj.provider.dimensionId); + if (paused == null) { + this.paused = new Coords(this.xCoord, this.yCoord, this.zCoord, this.worldObj.provider.dimensionId); } ticks++; if (check.called != -1) { @@ -61,15 +60,15 @@ public class BW_TileEntity_ExperimentalFloodGate extends TileFluidHandler implem check.hashset.removeAll(toRem); } } else { - noOfIts=0; + noOfIts = 0; setUpHashSet(); - this.paused=check.hashset.get(check.hashset.size()-1); + this.paused = check.hashset.get(check.hashset.size() - 1); } if (ticks % 50 == 0) ticks = 0; } - private synchronized void setUpHashSet(){ + private synchronized void setUpHashSet() { check = new recursiveBelowCheck(); Thread t = new Thread(check); t.run(); @@ -80,7 +79,7 @@ public class BW_TileEntity_ExperimentalFloodGate extends TileFluidHandler implem e.printStackTrace(); } } - check.hashset.remove(new Coords(this.xCoord, this.yCoord, this.zCoord,this.worldObj.provider.dimensionId)); + check.hashset.remove(new Coords(this.xCoord, this.yCoord, this.zCoord, this.worldObj.provider.dimensionId)); } @Override @@ -90,8 +89,8 @@ public class BW_TileEntity_ExperimentalFloodGate extends TileFluidHandler implem private class recursiveBelowCheck implements Runnable { - int called = -1; private final List<Coords> hashset = new ArrayList<Coords>(); + int called = -1; public int getCalled() { return this.called; @@ -145,8 +144,8 @@ public class BW_TileEntity_ExperimentalFloodGate extends TileFluidHandler implem int wID = w.provider.dimensionId; byte sides = check_sourroundings(w, x, y, z, b); - if (((sides | 0b111110) == 0b111111) && !hashset.contains(new Coords(x, y + 1, z, wID)) && y+1 <= yCoord) { - tail=get_connected(w, x, y + 1, z, b,iterations); + if (((sides | 0b111110) == 0b111111) && !hashset.contains(new Coords(x, y + 1, z, wID)) && y + 1 <= yCoord) { + tail = get_connected(w, x, y + 1, z, b, iterations); if (tail == -1) return tail; ret++; @@ -154,7 +153,7 @@ public class BW_TileEntity_ExperimentalFloodGate extends TileFluidHandler implem } if (((sides | 0b111101) == 0b111111) && !hashset.contains(new Coords(x, y - 1, z, wID))) { - tail=get_connected(w, x, y - 1, z, b,iterations); + tail = get_connected(w, x, y - 1, z, b, iterations); if (tail == -1) return tail; ret++; @@ -162,7 +161,7 @@ public class BW_TileEntity_ExperimentalFloodGate extends TileFluidHandler implem } if (((sides | 0b111011) == 0b111111) && !hashset.contains(new Coords(x + 1, y, z, wID))) { - tail= get_connected(w, x + 1, y, z, b,iterations); + tail = get_connected(w, x + 1, y, z, b, iterations); if (tail == -1) return tail; ret++; @@ -170,7 +169,7 @@ public class BW_TileEntity_ExperimentalFloodGate extends TileFluidHandler implem } if (((sides | 0b110111) == 0b111111) && !hashset.contains(new Coords(x - 1, y, z, wID))) { - tail= get_connected(w, x - 1, y, z, b,iterations); + tail = get_connected(w, x - 1, y, z, b, iterations); if (tail == -1) return tail; ret++; @@ -178,7 +177,7 @@ public class BW_TileEntity_ExperimentalFloodGate extends TileFluidHandler implem } if (((sides | 0b101111) == 0b111111) && !hashset.contains(new Coords(x, y, z + 1, wID))) { - tail= get_connected(w, x, y, z+1, b,iterations); + tail = get_connected(w, x, y, z + 1, b, iterations); if (tail == -1) return tail; ret++; @@ -187,7 +186,7 @@ public class BW_TileEntity_ExperimentalFloodGate extends TileFluidHandler implem } if (((sides | 0b011111) == 0b111111) && !hashset.contains(new Coords(x, y, z - 1, wID))) { - tail= get_connected(w, x, y, z-1, b,iterations); + tail = get_connected(w, x, y, z - 1, b, iterations); if (tail == -1) return tail; ret++; @@ -199,7 +198,7 @@ public class BW_TileEntity_ExperimentalFloodGate extends TileFluidHandler implem @Override public synchronized void run() { - called=check.get_connected(worldObj, paused.x, paused.y, paused.z, Blocks.air,0); + called = check.get_connected(worldObj, paused.x, paused.y, paused.z, Blocks.air, 0); notifyAll(); } } diff --git a/src/main/java/com/github/bartimaeusnek/bartworks/common/tileentities/classic/BW_TileEntity_HeatedWaterPump.java b/src/main/java/com/github/bartimaeusnek/bartworks/common/tileentities/classic/BW_TileEntity_HeatedWaterPump.java index cca50bce6a..4c86a8e9b8 100644 --- a/src/main/java/com/github/bartimaeusnek/bartworks/common/tileentities/classic/BW_TileEntity_HeatedWaterPump.java +++ b/src/main/java/com/github/bartimaeusnek/bartworks/common/tileentities/classic/BW_TileEntity_HeatedWaterPump.java @@ -268,7 +268,7 @@ public class BW_TileEntity_HeatedWaterPump extends TileEntity implements ISidedI @Override public String[] getInfoData() { - return new String[]{StatCollector.translateToLocal("tooltip.tile.waterpump.0.name")+" " + ConfigHandler.mbWaterperSec + StatCollector.translateToLocal("tooltip.tile.waterpump.1.name"), StatCollector.translateToLocal("tooltip.tile.waterpump.2.name")}; + return new String[]{StatCollector.translateToLocal("tooltip.tile.waterpump.0.name") + " " + ConfigHandler.mbWaterperSec + StatCollector.translateToLocal("tooltip.tile.waterpump.1.name"), StatCollector.translateToLocal("tooltip.tile.waterpump.2.name")}; } @Override diff --git a/src/main/java/com/github/bartimaeusnek/bartworks/common/tileentities/classic/BW_TileEntity_InfinityTank.java b/src/main/java/com/github/bartimaeusnek/bartworks/common/tileentities/classic/BW_TileEntity_InfinityTank.java index 79ac59f5c1..989e1618b9 100644 --- a/src/main/java/com/github/bartimaeusnek/bartworks/common/tileentities/classic/BW_TileEntity_InfinityTank.java +++ b/src/main/java/com/github/bartimaeusnek/bartworks/common/tileentities/classic/BW_TileEntity_InfinityTank.java @@ -35,7 +35,7 @@ import java.util.HashSet; public class BW_TileEntity_InfinityTank extends TileEntity implements IFluidTank, IFluidHandler, ITileWithGUI { - final ArrayList<FluidStack> INTERNALTANKS =new ArrayList<FluidStack>(); + final ArrayList<FluidStack> INTERNALTANKS = new ArrayList<FluidStack>(); int selectedTank; @@ -46,12 +46,12 @@ public class BW_TileEntity_InfinityTank extends TileEntity implements IFluidTank @Override public FluidStack drain(ForgeDirection from, FluidStack resource, boolean doDrain) { - return drain(from,resource != null ? resource.amount : 0,doDrain); + return drain(from, resource != null ? resource.amount : 0, doDrain); } @Override public FluidStack drain(ForgeDirection from, int maxDrain, boolean doDrain) { - return drain(maxDrain,doDrain); + return drain(maxDrain, doDrain); } @Override @@ -78,8 +78,8 @@ public class BW_TileEntity_InfinityTank extends TileEntity implements IFluidTank @Override public FluidStack getFluid() { if (INTERNALTANKS.get(selectedTank) == null || INTERNALTANKS.get(selectedTank).amount == 0) - if (selectedTank>0) - selectedTank = this.INTERNALTANKS.size()-1; + if (selectedTank > 0) + selectedTank = this.INTERNALTANKS.size() - 1; return INTERNALTANKS.get(selectedTank); } @@ -103,10 +103,9 @@ public class BW_TileEntity_InfinityTank extends TileEntity implements IFluidTank lInternalTank.appendTag(entry); } } - p_145841_1_.setTag("InternalTank",lInternalTank); + p_145841_1_.setTag("InternalTank", lInternalTank); } - @Override public int getCapacity() { @@ -128,7 +127,7 @@ public class BW_TileEntity_InfinityTank extends TileEntity implements IFluidTank int id = 0; - if (canDrain(null,resource.getFluid())) { + if (canDrain(null, resource.getFluid())) { for (FluidStack stack : INTERNALTANKS) if (GT_Utility.areFluidsEqual(stack, resource)) { this.INTERNALTANKS.get(id = this.INTERNALTANKS.indexOf(stack)).amount += resource.amount; @@ -136,7 +135,7 @@ public class BW_TileEntity_InfinityTank extends TileEntity implements IFluidTank } } else { this.INTERNALTANKS.add(resource); - id = this.INTERNALTANKS.size()-1; + id = this.INTERNALTANKS.size() - 1; selectedTank = id; } return this.INTERNALTANKS.get(id).amount; diff --git a/src/main/java/com/github/bartimaeusnek/bartworks/common/tileentities/multis/GT_TileEntity_BioVat.java b/src/main/java/com/github/bartimaeusnek/bartworks/common/tileentities/multis/GT_TileEntity_BioVat.java index f8801f25af..7042fba1b8 100644 --- a/src/main/java/com/github/bartimaeusnek/bartworks/common/tileentities/multis/GT_TileEntity_BioVat.java +++ b/src/main/java/com/github/bartimaeusnek/bartworks/common/tileentities/multis/GT_TileEntity_BioVat.java @@ -600,10 +600,10 @@ public class GT_TileEntity_BioVat extends GT_MetaTileEntity_MultiBlockBase { @Override public String[] getDescription() { String[] dsc = StatCollector.translateToLocal("tooltip.tile.bvat.0.name").split(";"); - String[] fdsc = new String[dsc.length+1]; + String[] fdsc = new String[dsc.length + 1]; for (int i = 0; i < dsc.length; i++) { - fdsc[i]=dsc[i]; - fdsc[dsc.length]=StatCollector.translateToLocal("tooltip.bw.1.name") + ChatColorHelper.DARKGREEN + " BartWorks"; + fdsc[i] = dsc[i]; + fdsc[dsc.length] = StatCollector.translateToLocal("tooltip.bw.1.name") + ChatColorHelper.DARKGREEN + " BartWorks"; } return fdsc; } diff --git a/src/main/java/com/github/bartimaeusnek/bartworks/common/tileentities/multis/GT_TileEntity_CrackingDistillTower.java b/src/main/java/com/github/bartimaeusnek/bartworks/common/tileentities/multis/GT_TileEntity_CrackingDistillTower.java index d0a242b23f..f7ac05a7f9 100644 --- a/src/main/java/com/github/bartimaeusnek/bartworks/common/tileentities/multis/GT_TileEntity_CrackingDistillTower.java +++ b/src/main/java/com/github/bartimaeusnek/bartworks/common/tileentities/multis/GT_TileEntity_CrackingDistillTower.java @@ -45,33 +45,33 @@ public class GT_TileEntity_CrackingDistillTower extends GT_MetaTileEntity_Distil @Override public boolean checkRecipe(ItemStack itemStack) { - if (!GT_Utility.areStacksEqual(itemStack, GT_Utility.getIntegratedCircuit(0),true)) + if (!GT_Utility.areStacksEqual(itemStack, GT_Utility.getIntegratedCircuit(0), true)) return false; - else{ + else { FluidStack[] array = new FluidStack[0]; ArrayList<FluidStack> fluidInputs = new ArrayList<FluidStack>(); - for (GT_MetaTileEntity_Hatch_Input hatch : this.mInputHatches){ - if (hatch != null){ + for (GT_MetaTileEntity_Hatch_Input hatch : this.mInputHatches) { + if (hatch != null) { fluidInputs.add(hatch.getFluid()); } } array = fluidInputs.toArray(array); GT_Recipe.GT_Recipe_Map rMapCracking = GT_Recipe.GT_Recipe_Map.sCrakingRecipes; GT_Recipe.GT_Recipe_Map rMapDistillTower = GT_Recipe.GT_Recipe_Map.sDistillationRecipes; - GT_Recipe recipeCracking = rMapCracking.findRecipe(this.getBaseMetaTileEntity(),false,this.getMaxInputVoltage(),array,itemStack); + GT_Recipe recipeCracking = rMapCracking.findRecipe(this.getBaseMetaTileEntity(), false, this.getMaxInputVoltage(), array, itemStack); if (recipeCracking == null) return false; - GT_Recipe recipeDistill = rMapDistillTower.findRecipe(this.getBaseMetaTileEntity(),false,this.getMaxInputVoltage(),recipeCracking.mFluidOutputs); + GT_Recipe recipeDistill = rMapDistillTower.findRecipe(this.getBaseMetaTileEntity(), false, this.getMaxInputVoltage(), recipeCracking.mFluidOutputs); if (recipeDistill == null) return false; - float ratio = (float)recipeCracking.mFluidOutputs[0].amount/(float)recipeDistill.mFluidInputs[0].amount; + float ratio = (float) recipeCracking.mFluidOutputs[0].amount / (float) recipeDistill.mFluidInputs[0].amount; FluidStack[] nuoutputs = new FluidStack[recipeDistill.mFluidOutputs.length]; for (int i = 0; i < nuoutputs.length; i++) { - nuoutputs[i]=recipeDistill.mFluidOutputs[i]; - nuoutputs[i].amount=(int)(Math.floor(recipeDistill.mFluidOutputs[i].amount*ratio)); + nuoutputs[i] = recipeDistill.mFluidOutputs[i]; + nuoutputs[i].amount = (int) (Math.floor(recipeDistill.mFluidOutputs[i].amount * ratio)); } - BWRecipes.DynamicGTRecipe combined = new BWRecipes.DynamicGTRecipe(true,null,recipeDistill.mOutputs,null,recipeDistill.mChances,recipeCracking.mFluidInputs,nuoutputs,(int)(Math.floor(recipeDistill.mDuration*ratio))+recipeCracking.mDuration,Math.max((int)(Math.floor(recipeDistill.mEUt*ratio)),recipeCracking.mEUt),0); - if (combined.isRecipeInputEqual(true, array)){ + BWRecipes.DynamicGTRecipe combined = new BWRecipes.DynamicGTRecipe(true, null, recipeDistill.mOutputs, null, recipeDistill.mChances, recipeCracking.mFluidInputs, nuoutputs, (int) (Math.floor(recipeDistill.mDuration * ratio)) + recipeCracking.mDuration, Math.max((int) (Math.floor(recipeDistill.mEUt * ratio)), recipeCracking.mEUt), 0); + if (combined.isRecipeInputEqual(true, array)) { this.mEfficiency = (10000 - (getIdealStatus() - getRepairStatus()) * 1000); this.mEfficiencyIncrease = 10000; BW_Util.calculateOverclockedNessMulti(combined.mEUt, combined.mDuration, 1, this.getMaxInputVoltage(), this); @@ -81,8 +81,8 @@ public class GT_TileEntity_CrackingDistillTower extends GT_MetaTileEntity_Distil this.mEUt = (-this.mEUt); } this.mMaxProgresstime = Math.max(1, this.mMaxProgresstime); - this.mOutputFluids=combined.mFluidOutputs.clone(); - this.mOutputItems=combined.mOutputs.clone(); + this.mOutputFluids = combined.mFluidOutputs.clone(); + this.mOutputItems = combined.mOutputs.clone(); this.updateSlots(); return true; } diff --git a/src/main/java/com/github/bartimaeusnek/bartworks/common/tileentities/multis/GT_TileEntity_ElectricImplosionCompressor.java b/src/main/java/com/github/bartimaeusnek/bartworks/common/tileentities/multis/GT_TileEntity_ElectricImplosionCompressor.java index 2c326887ed..74efa145e5 100644 --- a/src/main/java/com/github/bartimaeusnek/bartworks/common/tileentities/multis/GT_TileEntity_ElectricImplosionCompressor.java +++ b/src/main/java/com/github/bartimaeusnek/bartworks/common/tileentities/multis/GT_TileEntity_ElectricImplosionCompressor.java @@ -23,29 +23,25 @@ package com.github.bartimaeusnek.bartworks.common.tileentities.multis; import gregtech.api.GregTech_API; -import gregtech.api.enums.GT_Values; import gregtech.api.enums.Materials; import gregtech.api.interfaces.metatileentity.IMetaTileEntity; import gregtech.api.interfaces.tileentity.IGregTechTileEntity; -import gregtech.api.metatileentity.MetaTileEntity; import gregtech.api.util.GT_Recipe; import gregtech.api.util.GT_Utility; -import gregtech.common.GT_Pollution; import gregtech.common.tileentities.machines.multi.GT_MetaTileEntity_ImplosionCompressor; import net.minecraft.block.Block; import net.minecraft.item.ItemStack; import net.minecraft.nbt.NBTTagCompound; -import net.minecraft.tileentity.TileEntity; import net.minecraftforge.common.util.ForgeDirection; import net.minecraftforge.fluids.FluidStack; import java.util.ArrayList; -import java.util.Iterator; import static com.github.bartimaeusnek.bartworks.common.loaders.ItemRegistry.BW_BLOCKS; public class GT_TileEntity_ElectricImplosionCompressor extends GT_MetaTileEntity_ImplosionCompressor { + public static GT_Recipe.GT_Recipe_Map eicMap; private boolean piston; public GT_TileEntity_ElectricImplosionCompressor(int aID, String aName, String aNameRegional) { @@ -56,21 +52,19 @@ public class GT_TileEntity_ElectricImplosionCompressor extends GT_MetaTileEntity super(aName); } - public static GT_Recipe.GT_Recipe_Map eicMap; - @Override public boolean checkRecipe(ItemStack aStack) { - if (this.mEnergyHatches.get(0).getEUVar() <= 0 || this.mEnergyHatches.get(1).getEUVar() <= 0 ) + if (this.mEnergyHatches.get(0).getEUVar() <= 0 || this.mEnergyHatches.get(1).getEUVar() <= 0) return false; ArrayList<ItemStack> tInputList = this.getStoredInputs(); int tInputList_sS = tInputList.size(); - for(int i = 0; i < tInputList_sS - 1; ++i) { - for(int j = i + 1; j < tInputList_sS; ++j) { - if (GT_Utility.areStacksEqual((ItemStack)tInputList.get(i), (ItemStack)tInputList.get(j))) { - if (((ItemStack)tInputList.get(i)).stackSize < ((ItemStack)tInputList.get(j)).stackSize) { + for (int i = 0; i < tInputList_sS - 1; ++i) { + for (int j = i + 1; j < tInputList_sS; ++j) { + if (GT_Utility.areStacksEqual((ItemStack) tInputList.get(i), (ItemStack) tInputList.get(j))) { + if (((ItemStack) tInputList.get(i)).stackSize < ((ItemStack) tInputList.get(j)).stackSize) { tInputList.remove(i--); tInputList_sS = tInputList.size(); break; @@ -82,16 +76,16 @@ public class GT_TileEntity_ElectricImplosionCompressor extends GT_MetaTileEntity } } - ItemStack[] tInputs = (ItemStack[])tInputList.toArray(new ItemStack[tInputList.size()]); + ItemStack[] tInputs = (ItemStack[]) tInputList.toArray(new ItemStack[tInputList.size()]); if (tInputList.size() > 0) { - GT_Recipe tRecipe = eicMap.findRecipe(this.getBaseMetaTileEntity(), false, 9223372036854775807L, (FluidStack[])null, tInputs); - if (tRecipe != null && tRecipe.isRecipeInputEqual(true, (FluidStack[])null, tInputs)) { + GT_Recipe tRecipe = eicMap.findRecipe(this.getBaseMetaTileEntity(), false, 9223372036854775807L, (FluidStack[]) null, tInputs); + if (tRecipe != null && tRecipe.isRecipeInputEqual(true, (FluidStack[]) null, tInputs)) { this.mEfficiency = 10000 - (this.getIdealStatus() - this.getRepairStatus()) * 1000; this.mEfficiencyIncrease = 10000; this.mEUt = -tRecipe.mEUt; this.mMaxProgresstime = Math.max(1, tRecipe.mDuration); this.mOutputItems = new ItemStack[]{tRecipe.getOutput(0), tRecipe.getOutput(1)}; - this.sendLoopStart((byte)20); + this.sendLoopStart((byte) 20); this.updateSlots(); return true; } @@ -107,7 +101,7 @@ public class GT_TileEntity_ElectricImplosionCompressor extends GT_MetaTileEntity return super.onRunningTick(aStack); } - public void stopMachine(){ + public void stopMachine() { resetPiston(); super.stopMachine(); } @@ -117,13 +111,13 @@ public class GT_TileEntity_ElectricImplosionCompressor extends GT_MetaTileEntity piston = true; } - private void resetPiston(){ + private void resetPiston() { if (this.getBaseMetaTileEntity().getWorld().isRemote) return; - if (!piston){ + if (!piston) { int xDir = ForgeDirection.getOrientation(this.getBaseMetaTileEntity().getBackFacing()).offsetX; int zDir = ForgeDirection.getOrientation(this.getBaseMetaTileEntity().getBackFacing()).offsetZ; - int aX = this.getBaseMetaTileEntity().getXCoord(),aY = this.getBaseMetaTileEntity().getYCoord() ,aZ = this.getBaseMetaTileEntity().getZCoord(); + int aX = this.getBaseMetaTileEntity().getXCoord(), aY = this.getBaseMetaTileEntity().getYCoord(), aZ = this.getBaseMetaTileEntity().getZCoord(); for (int x = -1; x <= 1; x++) { for (int z = -1; z <= 1; z++) { if (!(Math.abs(x) == 1 && Math.abs(z) == 1)) @@ -134,34 +128,35 @@ public class GT_TileEntity_ElectricImplosionCompressor extends GT_MetaTileEntity piston = !piston; } } + private void togglePiston() { if (this.getBaseMetaTileEntity().getWorld().isRemote) return; int xDir = ForgeDirection.getOrientation(this.getBaseMetaTileEntity().getBackFacing()).offsetX; int zDir = ForgeDirection.getOrientation(this.getBaseMetaTileEntity().getBackFacing()).offsetZ; - int aX = this.getBaseMetaTileEntity().getXCoord(),aY = this.getBaseMetaTileEntity().getYCoord() ,aZ = this.getBaseMetaTileEntity().getZCoord(); + int aX = this.getBaseMetaTileEntity().getXCoord(), aY = this.getBaseMetaTileEntity().getYCoord(), aZ = this.getBaseMetaTileEntity().getZCoord(); boolean hax = false; - if(piston){ + if (piston) { for (int x = -1; x <= 1; x++) { for (int z = -1; z <= 1; z++) { if (!(Math.abs(x) == 1 && Math.abs(z) == 1)) { - if (this.getBaseMetaTileEntity().getBlock(xDir+aX+x,aY+2,zDir+aZ+z) != GregTech_API.sBlockMetal5 && this.getBaseMetaTileEntity().getMetaID(xDir+aX+x,aY+2,zDir+aZ+z) != 2 ) { + if (this.getBaseMetaTileEntity().getBlock(xDir + aX + x, aY + 2, zDir + aZ + z) != GregTech_API.sBlockMetal5 && this.getBaseMetaTileEntity().getMetaID(xDir + aX + x, aY + 2, zDir + aZ + z) != 2) { hax = true; } this.getBaseMetaTileEntity().getWorld().setBlockToAir(xDir + aX + x, aY + 2, zDir + aZ + z); } } } - GT_Utility.doSoundAtClient((String)GregTech_API.sSoundList.get(5), 10, 1.0F, aX, aY, aZ); - piston=!piston; + GT_Utility.doSoundAtClient((String) GregTech_API.sSoundList.get(5), 10, 1.0F, aX, aY, aZ); + piston = !piston; } else { for (int x = -1; x <= 1; x++) { for (int z = -1; z <= 1; z++) { if (!(Math.abs(x) == 1 && Math.abs(z) == 1)) - this.getBaseMetaTileEntity().getWorld().setBlock(xDir+aX+x,aY+2,zDir+aZ+z,GregTech_API.sBlockMetal5,2,3); + this.getBaseMetaTileEntity().getWorld().setBlock(xDir + aX + x, aY + 2, zDir + aZ + z, GregTech_API.sBlockMetal5, 2, 3); } } - GT_Utility.doSoundAtClient((String)GregTech_API.sSoundList.get(5), 10, 1.0F, aX, aY, aZ); + GT_Utility.doSoundAtClient((String) GregTech_API.sSoundList.get(5), 10, 1.0F, aX, aY, aZ); piston = !piston; } if (hax) @@ -170,13 +165,13 @@ public class GT_TileEntity_ElectricImplosionCompressor extends GT_MetaTileEntity @Override public void saveNBTData(NBTTagCompound aNBT) { - aNBT.setBoolean("piston",piston); + aNBT.setBoolean("piston", piston); super.saveNBTData(aNBT); } @Override public void loadNBTData(NBTTagCompound aNBT) { - piston=aNBT.getBoolean("piston"); + piston = aNBT.getBoolean("piston"); super.loadNBTData(aNBT); } @@ -188,18 +183,17 @@ public class GT_TileEntity_ElectricImplosionCompressor extends GT_MetaTileEntity for (int x = -1; x <= 1; x++) { for (int y = -2; y < 7; y++) { for (int z = -1; z <= 1; z++) { - IGregTechTileEntity te = aBaseMetaTileEntity.getIGregTechTileEntityOffset(xDir+x,y,z+zDir); + IGregTechTileEntity te = aBaseMetaTileEntity.getIGregTechTileEntityOffset(xDir + x, y, z + zDir); if (y == -2 || y == 6) { if (!(x == 0 && z == 0)) { if (!this.addMaintenanceToMachineList(te, 16) && !this.addMufflerToMachineList(te, 16) && !this.addInputToMachineList(te, 16) && !this.addOutputToMachineList(te, 16)) { - Block tBlock = aBaseMetaTileEntity.getBlockOffset(xDir + x, y, zDir + z); - byte tMeta = aBaseMetaTileEntity.getMetaIDOffset(xDir + x, y, zDir + z); - if ((tBlock != GregTech_API.sBlockCasings2 || tMeta != 0) && (tBlock != GregTech_API.sBlockCasings3 || tMeta != 4)) { - return false; - } + Block tBlock = aBaseMetaTileEntity.getBlockOffset(xDir + x, y, zDir + z); + byte tMeta = aBaseMetaTileEntity.getMetaIDOffset(xDir + x, y, zDir + z); + if ((tBlock != GregTech_API.sBlockCasings2 || tMeta != 0) && (tBlock != GregTech_API.sBlockCasings3 || tMeta != 4)) { + return false; } - } - else if (x == 0 && z == 0) { + } + } else if (x == 0 && z == 0) { if (y == -2) if (!this.addEnergyInputToMachineList(te, 16)) return false; @@ -207,36 +201,32 @@ public class GT_TileEntity_ElectricImplosionCompressor extends GT_MetaTileEntity if (!this.addEnergyInputToMachineList(te, 16)) return false; } - } - else if ((y > -2 && y < 1) || (y > 3 && y < 6)){ - if (y == 0 && xDir+x == 0 && zDir+z==0) + } else if ((y > -2 && y < 1) || (y > 3 && y < 6)) { + if (y == 0 && xDir + x == 0 && zDir + z == 0) continue; Block tBlock = aBaseMetaTileEntity.getBlockOffset(xDir + x, y, zDir + z); byte tMeta = aBaseMetaTileEntity.getMetaIDOffset(xDir + x, y, zDir + z); if (x == 0 && z == 0) { if (tBlock != BW_BLOCKS[2] || tMeta != 0) return false; - }else{ + } else { if (tBlock != BW_BLOCKS[2] || tMeta != 1) return false; } - } - else if (y == 1) { - if (!GT_Utility.areStacksEqual(new ItemStack(aBaseMetaTileEntity.getBlockOffset(xDir + x, 1, zDir + z),1,aBaseMetaTileEntity.getMetaIDOffset(xDir + x, y, zDir + z)), Materials.Neutronium.getBlocks(1))) + } else if (y == 1) { + if (!GT_Utility.areStacksEqual(new ItemStack(aBaseMetaTileEntity.getBlockOffset(xDir + x, 1, zDir + z), 1, aBaseMetaTileEntity.getMetaIDOffset(xDir + x, y, zDir + z)), Materials.Neutronium.getBlocks(1))) return false; - } - else if (y == 2) { + } else if (y == 2) { if (!piston) { if (Math.abs(x) == 1 && Math.abs(z) == 1) { - if (!GT_Utility.areStacksEqual(new ItemStack(aBaseMetaTileEntity.getBlockOffset(xDir + x, 2, zDir + z),1,aBaseMetaTileEntity.getMetaIDOffset(xDir + x, y, zDir + z)), Materials.Neutronium.getBlocks(1))) + if (!GT_Utility.areStacksEqual(new ItemStack(aBaseMetaTileEntity.getBlockOffset(xDir + x, 2, zDir + z), 1, aBaseMetaTileEntity.getMetaIDOffset(xDir + x, y, zDir + z)), Materials.Neutronium.getBlocks(1))) return false; } - }else if (!GT_Utility.areStacksEqual(new ItemStack(aBaseMetaTileEntity.getBlockOffset(xDir + x, 2, zDir + z),1,aBaseMetaTileEntity.getMetaIDOffset(xDir + x, y, zDir + z)), Materials.Neutronium.getBlocks(1))) + } else if (!GT_Utility.areStacksEqual(new ItemStack(aBaseMetaTileEntity.getBlockOffset(xDir + x, 2, zDir + z), 1, aBaseMetaTileEntity.getMetaIDOffset(xDir + x, y, zDir + z)), Materials.Neutronium.getBlocks(1))) return false; - } - else if (y == 3) { - if (!GT_Utility.areStacksEqual(new ItemStack(aBaseMetaTileEntity.getBlockOffset(xDir + x, 3, zDir + z),1,aBaseMetaTileEntity.getMetaIDOffset(xDir + x, y, zDir + z)), Materials.Neutronium.getBlocks(1))) + } else if (y == 3) { + if (!GT_Utility.areStacksEqual(new ItemStack(aBaseMetaTileEntity.getBlockOffset(xDir + x, 3, zDir + z), 1, aBaseMetaTileEntity.getMetaIDOffset(xDir + x, y, zDir + z)), Materials.Neutronium.getBlocks(1))) return false; } } diff --git a/src/main/java/com/github/bartimaeusnek/bartworks/common/tileentities/multis/GT_TileEntity_LESU.java b/src/main/java/com/github/bartimaeusnek/bartworks/common/tileentities/multis/GT_TileEntity_LESU.java index c3aabbd0da..42eeada394 100644 --- a/src/main/java/com/github/bartimaeusnek/bartworks/common/tileentities/multis/GT_TileEntity_LESU.java +++ b/src/main/java/com/github/bartimaeusnek/bartworks/common/tileentities/multis/GT_TileEntity_LESU.java @@ -160,12 +160,12 @@ public class GT_TileEntity_LESU extends GT_MetaTileEntity_MultiBlockBase { for (int i = 0; i < dsc.length; i++) { e.add(dsc[i]); } - e.add(StatCollector.translateToLocal("tooltip.tile.lesu.1.name")+" " + ConfigHandler.energyPerCell + "EU"); + e.add(StatCollector.translateToLocal("tooltip.tile.lesu.1.name") + " " + ConfigHandler.energyPerCell + "EU"); dsc = StatCollector.translateToLocal("tooltip.tile.lesu.2.name").split(";"); for (int i = 0; i < dsc.length; i++) { e.add(dsc[i]); } - e.add(ChatColorHelper.RED +StatCollector.translateToLocal("tooltip.tile.lesu.3.name")); + e.add(ChatColorHelper.RED + StatCollector.translateToLocal("tooltip.tile.lesu.3.name")); e.add(StatCollector.translateToLocal("tooltip.bw.1.name") + ChatColorHelper.DARKGREEN + " BartWorks"); return e.toArray(new String[0]); } diff --git a/src/main/java/com/github/bartimaeusnek/bartworks/common/tileentities/multis/GT_TileEntity_ManualTrafo.java b/src/main/java/com/github/bartimaeusnek/bartworks/common/tileentities/multis/GT_TileEntity_ManualTrafo.java index 0cf9d1f2df..c403d990d6 100644 --- a/src/main/java/com/github/bartimaeusnek/bartworks/common/tileentities/multis/GT_TileEntity_ManualTrafo.java +++ b/src/main/java/com/github/bartimaeusnek/bartworks/common/tileentities/multis/GT_TileEntity_ManualTrafo.java @@ -382,10 +382,10 @@ public class GT_TileEntity_ManualTrafo extends GT_MetaTileEntity_MultiBlockBase @Override public String[] getDescription() { String[] dsc = StatCollector.translateToLocal("tooltip.tile.manualtravo.0.name").split(";"); - String[] fdsc = new String[dsc.length+1]; + String[] fdsc = new String[dsc.length + 1]; for (int i = 0; i < dsc.length; i++) { - fdsc[i]=dsc[i]; - fdsc[dsc.length]=StatCollector.translateToLocal("tooltip.bw.1.name") + ChatColorHelper.DARKGREEN + " BartWorks"; + fdsc[i] = dsc[i]; + fdsc[dsc.length] = StatCollector.translateToLocal("tooltip.bw.1.name") + ChatColorHelper.DARKGREEN + " BartWorks"; } return fdsc; } diff --git a/src/main/java/com/github/bartimaeusnek/bartworks/common/tileentities/multis/GT_TileEntity_Windmill.java b/src/main/java/com/github/bartimaeusnek/bartworks/common/tileentities/multis/GT_TileEntity_Windmill.java index a7d4ce12ba..5cd012821c 100644 --- a/src/main/java/com/github/bartimaeusnek/bartworks/common/tileentities/multis/GT_TileEntity_Windmill.java +++ b/src/main/java/com/github/bartimaeusnek/bartworks/common/tileentities/multis/GT_TileEntity_Windmill.java @@ -114,11 +114,11 @@ public class GT_TileEntity_Windmill extends GT_MetaTileEntity_MultiBlockBase { if (new XSTR().nextInt(2) == 0) { if (tRecipe.getOutput(1) != null) mOutputItems[1] = tRecipe.getOutput(1); - else if( !BW_Util.checkStackAndPrefix(mOutputItems[0]) || + else if (!BW_Util.checkStackAndPrefix(mOutputItems[0]) || !( BW_Util.checkStackAndPrefix(mOutputItems[0]) && GT_OreDictUnificator.getAssociation(mOutputItems[0]).mMaterial.mMaterial.mSubTags.contains(SubTag.METAL) || - BW_Util.checkStackAndPrefix(mOutputItems[0]) && GT_OreDictUnificator.getAssociation(mOutputItems[0]).mMaterial.mMaterial.mSubTags.contains(SubTag.CRYSTAL)|| - BW_Util.checkStackAndPrefix(mOutputItems[0]) && GT_OreDictUnificator.getAssociation(mOutputItems[0]).mMaterial.mMaterial.mSubTags.contains(SubTag.CRYSTALLISABLE) + BW_Util.checkStackAndPrefix(mOutputItems[0]) && GT_OreDictUnificator.getAssociation(mOutputItems[0]).mMaterial.mMaterial.mSubTags.contains(SubTag.CRYSTAL) || + BW_Util.checkStackAndPrefix(mOutputItems[0]) && GT_OreDictUnificator.getAssociation(mOutputItems[0]).mMaterial.mMaterial.mSubTags.contains(SubTag.CRYSTALLISABLE) ) || BW_Util.checkStackAndPrefix(mOutputItems[0]) && GT_OreDictUnificator.getAssociation(mOutputItems[0]).mMaterial.mMaterial == Materials.Flint || @@ -563,10 +563,10 @@ public class GT_TileEntity_Windmill extends GT_MetaTileEntity_MultiBlockBase { @Override public String[] getDescription() { String[] dsc = StatCollector.translateToLocal("tooltip.tile.windmill.0.name").split(";"); - String[] fdsc = new String[dsc.length+1]; + String[] fdsc = new String[dsc.length + 1]; for (int i = 0; i < dsc.length; i++) { - fdsc[i]=dsc[i]; - fdsc[dsc.length]=StatCollector.translateToLocal("tooltip.bw.1.name") + ChatColorHelper.DARKGREEN + " BartWorks"; + fdsc[i] = dsc[i]; + fdsc[dsc.length] = StatCollector.translateToLocal("tooltip.bw.1.name") + ChatColorHelper.DARKGREEN + " BartWorks"; } return fdsc; } diff --git a/src/main/java/com/github/bartimaeusnek/bartworks/common/tileentities/multis/mega/GT_TileEntity_MegaBlastFurnace.java b/src/main/java/com/github/bartimaeusnek/bartworks/common/tileentities/multis/mega/GT_TileEntity_MegaBlastFurnace.java index 97e7bb9fac..b74b826da5 100644 --- a/src/main/java/com/github/bartimaeusnek/bartworks/common/tileentities/multis/mega/GT_TileEntity_MegaBlastFurnace.java +++ b/src/main/java/com/github/bartimaeusnek/bartworks/common/tileentities/multis/mega/GT_TileEntity_MegaBlastFurnace.java @@ -31,7 +31,6 @@ import gregtech.api.interfaces.metatileentity.IMetaTileEntity; import gregtech.api.interfaces.tileentity.IGregTechTileEntity; import gregtech.api.metatileentity.implementations.GT_MetaTileEntity_Hatch_Energy; import gregtech.api.metatileentity.implementations.GT_MetaTileEntity_Hatch_Output; -import gregtech.api.metatileentity.implementations.GT_MetaTileEntity_MultiBlockBase; import gregtech.api.util.GT_Recipe; import gregtech.api.util.GT_Utility; import gregtech.common.tileentities.machines.multi.GT_MetaTileEntity_ElectricBlastFurnace; @@ -41,7 +40,9 @@ import net.minecraft.util.StatCollector; import net.minecraftforge.common.util.ForgeDirection; import net.minecraftforge.fluids.FluidStack; -import java.util.*; +import java.util.ArrayList; +import java.util.HashSet; +import java.util.List; import static gregtech.api.enums.GT_Values.V; @@ -61,16 +62,38 @@ public class GT_TileEntity_MegaBlastFurnace extends GT_MetaTileEntity_ElectricBl public String[] getDescription() { String[] dsc = StatCollector.translateToLocal("tooltip.tile.mbf.0.name").split(";"); - String tmp = dsc[dsc.length-1]; - dsc[dsc.length-1]=tmp+" "+Integer.toString(20 * this.getPollutionPerTick((ItemStack) null))+" "+StatCollector.translateToLocal("tooltip.tile.mbf.1.name"); - String[] fdsc = new String[dsc.length+1]; + String tmp = dsc[dsc.length - 1]; + dsc[dsc.length - 1] = tmp + " " + Integer.toString(20 * this.getPollutionPerTick((ItemStack) null)) + " " + StatCollector.translateToLocal("tooltip.tile.mbf.1.name"); + String[] fdsc = new String[dsc.length + 1]; for (int i = 0; i < dsc.length; i++) { - fdsc[i]=dsc[i]; - fdsc[dsc.length]=StatCollector.translateToLocal("tooltip.bw.1.name") + ChatColorHelper.DARKGREEN + " BartWorks"; + fdsc[i] = dsc[i]; + fdsc[dsc.length] = StatCollector.translateToLocal("tooltip.bw.1.name") + ChatColorHelper.DARKGREEN + " BartWorks"; } return fdsc; } + public boolean drainEnergyInput(long aEU) { + if (aEU <= 0) + return true; + long allTheEu = 0; + int hatches = 0; + for (GT_MetaTileEntity_Hatch_Energy tHatch : mEnergyHatches) + if (isValidMetaTileEntity(tHatch)) { + allTheEu += tHatch.getEUVar(); + hatches++; + } + if (allTheEu < aEU) + return false; + long euperhatch = aEU / hatches; + HashSet<Boolean> returnset = new HashSet<>(); + for (GT_MetaTileEntity_Hatch_Energy tHatch : mEnergyHatches) + if (tHatch.getBaseMetaTileEntity().decreaseStoredEnergyUnits(euperhatch, false)) + returnset.add(true); + else + returnset.add(false); + return returnset.size() > 0 && !returnset.contains(false); + } + @Override public boolean checkRecipe(ItemStack itemStack) { ItemStack[] tInputs = (ItemStack[]) this.getStoredInputs().toArray(new ItemStack[0]); @@ -90,10 +113,10 @@ public class GT_TileEntity_MegaBlastFurnace extends GT_MetaTileEntity_ElectricBl long nominalV = BW_Util.getnominalVoltage(this); int tHeatCapacityDivTiers = (mHeatingCapacity - tRecipe.mSpecialValue) / 900; - long precutRecipeVoltage = (long) (tRecipe.mEUt*Math.pow(0.95, tHeatCapacityDivTiers)); + long precutRecipeVoltage = (long) (tRecipe.mEUt * Math.pow(0.95, tHeatCapacityDivTiers)); while (this.getStoredInputs().size() > 0 && processed < ConfigHandler.megaMachinesMax) { - if (this.mHeatingCapacity >= tRecipe.mSpecialValue && (precutRecipeVoltage*(processed+1)) < nominalV && tRecipe.isRecipeInputEqual(true, tFluids, tInputs)) { + if (this.mHeatingCapacity >= tRecipe.mSpecialValue && (precutRecipeVoltage * (processed + 1)) < nominalV && tRecipe.isRecipeInputEqual(true, tFluids, tInputs)) { found_Recipe = true; for (int i = 0; i < tRecipe.mOutputs.length; i++) { outputItems.add(tRecipe.getOutput(i)); @@ -118,9 +141,9 @@ public class GT_TileEntity_MegaBlastFurnace extends GT_MetaTileEntity_ElectricBl actualEUT = actualEUT / 2; divider++; } - overclockCount = calculateOverclockednessEBF((int) (actualEUT / (divider * 2)), tRecipe.mDuration * (divider * 2), tVoltage); + overclockCount = calculateOverclockednessEBF((int) (actualEUT / (divider * 2)), tRecipe.mDuration * (divider * 2), nominalV); } else - overclockCount = calculateOverclockednessEBF(actualEUT, tRecipe.mDuration, tVoltage); + overclockCount = calculateOverclockednessEBF(actualEUT, tRecipe.mDuration, nominalV); //In case recipe is too OP for that machine if (mMaxProgresstime == Integer.MAX_VALUE - 1 && mEUt == Integer.MAX_VALUE - 1) return false; @@ -129,7 +152,7 @@ public class GT_TileEntity_MegaBlastFurnace extends GT_MetaTileEntity_ElectricBl } if (tHeatCapacityDivTiers > 0) { this.mEUt = (int) (this.mEUt * (Math.pow(0.95, tHeatCapacityDivTiers))); - this.mMaxProgresstime >>= Math.min(tHeatCapacityDivTiers / 2, overclockCount);//extra free overclocking if possible + this.mMaxProgresstime >>= Math.min(tHeatCapacityDivTiers / 2, overclockCount); //extra free overclocking if possible if (this.mMaxProgresstime < 1) this.mMaxProgresstime = 1;//no eu efficiency correction } diff --git a/src/main/java/com/github/bartimaeusnek/bartworks/common/tileentities/multis/mega/GT_TileEntity_MegaProcessingArray.java b/src/main/java/com/github/bartimaeusnek/bartworks/common/tileentities/multis/mega/GT_TileEntity_MegaProcessingArray.java index 414b7b3122..56b9197a2d 100644 --- a/src/main/java/com/github/bartimaeusnek/bartworks/common/tileentities/multis/mega/GT_TileEntity_MegaProcessingArray.java +++ b/src/main/java/com/github/bartimaeusnek/bartworks/common/tileentities/multis/mega/GT_TileEntity_MegaProcessingArray.java @@ -39,6 +39,11 @@ import java.util.List; import static gregtech.api.metatileentity.implementations.GT_MetaTileEntity_BasicMachine.isValidForLowGravity; public class GT_TileEntity_MegaProcessingArray extends GT_MetaTileEntity_ProcessingArray { + private GT_Recipe mLastRecipe; + private int tTier = 0; + private int mMult = 0; + private String mMachine = ""; + private GT_MetaTileEntity_Hatch_InputBus machineBus; public GT_TileEntity_MegaProcessingArray(int aID, String aName, String aNameRegional) { super(aID, aName, aNameRegional); } @@ -47,13 +52,6 @@ public class GT_TileEntity_MegaProcessingArray extends GT_MetaTileEntity_Process super(aName); } - private GT_Recipe mLastRecipe; - private int tTier = 0; - private int mMult = 0; - private String mMachine = ""; - - private GT_MetaTileEntity_Hatch_InputBus machineBus; - public boolean checkRecipe(ItemStack aStack) { if (!isCorrectMachinePart(machineBus.mInventory[0])) { return false; @@ -138,7 +136,7 @@ public class GT_TileEntity_MegaProcessingArray extends GT_MetaTileEntity_Process this.mMaxProgresstime = tRecipe.mDuration; this.mEfficiency = (10000 - (getIdealStatus() - getRepairStatus()) * 1000); this.mEfficiencyIncrease = 10000; - BW_Util.calculateOverclockedNessMulti(tRecipe.mEUt, tRecipe.mDuration, map.mAmperage, GT_Values.V[tTier],this); + BW_Util.calculateOverclockedNessMulti(tRecipe.mEUt, tRecipe.mDuration, map.mAmperage, GT_Values.V[tTier], this); //In case recipe is too OP for that machine if (mMaxProgresstime == Integer.MAX_VALUE - 1 && mEUt == Integer.MAX_VALUE - 1) return false; diff --git a/src/main/java/com/github/bartimaeusnek/bartworks/common/tileentities/multis/mega/GT_TileEntity_MegaVacuumFreezer.java b/src/main/java/com/github/bartimaeusnek/bartworks/common/tileentities/multis/mega/GT_TileEntity_MegaVacuumFreezer.java index 14af3300a9..a2227eb7a4 100644 --- a/src/main/java/com/github/bartimaeusnek/bartworks/common/tileentities/multis/mega/GT_TileEntity_MegaVacuumFreezer.java +++ b/src/main/java/com/github/bartimaeusnek/bartworks/common/tileentities/multis/mega/GT_TileEntity_MegaVacuumFreezer.java @@ -28,6 +28,7 @@ import com.github.bartimaeusnek.bartworks.util.ChatColorHelper; import gregtech.api.GregTech_API; import gregtech.api.interfaces.metatileentity.IMetaTileEntity; import gregtech.api.interfaces.tileentity.IGregTechTileEntity; +import gregtech.api.metatileentity.implementations.GT_MetaTileEntity_Hatch_Energy; import gregtech.api.util.GT_Recipe; import gregtech.api.util.GT_Utility; import gregtech.common.tileentities.machines.multi.GT_MetaTileEntity_VacuumFreezer; @@ -52,10 +53,10 @@ public class GT_TileEntity_MegaVacuumFreezer extends GT_MetaTileEntity_VacuumFre public String[] getDescription() { String[] dsc = StatCollector.translateToLocal("tooltip.tile.mvf.0.name").split(";"); - String[] fdsc = new String[dsc.length+1]; + String[] fdsc = new String[dsc.length + 1]; for (int i = 0; i < dsc.length; i++) { - fdsc[i]=dsc[i]; - fdsc[dsc.length]=StatCollector.translateToLocal("tooltip.bw.1.name") + ChatColorHelper.DARKGREEN + " BartWorks"; + fdsc[i] = dsc[i]; + fdsc[dsc.length] = StatCollector.translateToLocal("tooltip.bw.1.name") + ChatColorHelper.DARKGREEN + " BartWorks"; } return fdsc; } @@ -65,6 +66,28 @@ public class GT_TileEntity_MegaVacuumFreezer extends GT_MetaTileEntity_VacuumFre return new GT_TileEntity_MegaVacuumFreezer(this.mName); } + public boolean drainEnergyInput(long aEU) { + if (aEU <= 0) + return true; + long allTheEu = 0; + int hatches = 0; + for (GT_MetaTileEntity_Hatch_Energy tHatch : mEnergyHatches) + if (isValidMetaTileEntity(tHatch)) { + allTheEu += tHatch.getEUVar(); + hatches++; + } + if (allTheEu < aEU) + return false; + long euperhatch = aEU / hatches; + HashSet<Boolean> returnset = new HashSet<>(); + for (GT_MetaTileEntity_Hatch_Energy tHatch : mEnergyHatches) + if (tHatch.getBaseMetaTileEntity().decreaseStoredEnergyUnits(euperhatch, false)) + returnset.add(true); + else + returnset.add(false); + return returnset.size() > 0 && !returnset.contains(false); + } + @Override public boolean checkRecipe(ItemStack itemStack) { ItemStack[] tInputs = (ItemStack[]) this.getStoredInputs().toArray(new ItemStack[0]); @@ -78,7 +101,7 @@ public class GT_TileEntity_MegaVacuumFreezer extends GT_MetaTileEntity_VacuumFre int processed = 0; long nominalV = BW_Util.getnominalVoltage(this); while (this.getStoredInputs().size() > 0 && processed < ConfigHandler.megaMachinesMax) { - if (tRecipe != null && (tRecipe.mEUt*(processed+1)) < nominalV && tRecipe.isRecipeInputEqual(true, null, tInputs)) { + if (tRecipe != null && (tRecipe.mEUt * (processed + 1)) < nominalV && tRecipe.isRecipeInputEqual(true, null, tInputs)) { found_Recipe = true; for (int i = 0; i < tRecipe.mOutputs.length; i++) { outputItems.add(tRecipe.getOutput(i)); @@ -98,9 +121,9 @@ public class GT_TileEntity_MegaVacuumFreezer extends GT_MetaTileEntity_VacuumFre actualEUT = actualEUT / 2; divider++; } - BW_Util.calculateOverclockedNessMulti((int) (actualEUT / (divider * 2)), tRecipe.mDuration * (divider * 2), 1, this.getMaxInputVoltage(), this); + BW_Util.calculateOverclockedNessMulti((int) (actualEUT / (divider * 2)), tRecipe.mDuration * (divider * 2), 1, nominalV, this); } else - BW_Util.calculateOverclockedNessMulti((int) actualEUT, tRecipe.mDuration, 1, this.getMaxInputVoltage(), this); + BW_Util.calculateOverclockedNessMulti((int) actualEUT, tRecipe.mDuration, 1, nominalV, this); //In case recipe is too OP for that machine if (mMaxProgresstime == Integer.MAX_VALUE - 1 && mEUt == Integer.MAX_VALUE - 1) return false; diff --git a/src/main/java/com/github/bartimaeusnek/bartworks/common/tileentities/tiered/GT_MetaTileEntity_AcidGenerator.java b/src/main/java/com/github/bartimaeusnek/bartworks/common/tileentities/tiered/GT_MetaTileEntity_AcidGenerator.java index d749ce3c54..e138445f01 100644 --- a/src/main/java/com/github/bartimaeusnek/bartworks/common/tileentities/tiered/GT_MetaTileEntity_AcidGenerator.java +++ b/src/main/java/com/github/bartimaeusnek/bartworks/common/tileentities/tiered/GT_MetaTileEntity_AcidGenerator.java @@ -36,7 +36,7 @@ import net.minecraft.util.StatCollector; public class GT_MetaTileEntity_AcidGenerator extends GT_MetaTileEntity_BasicGenerator { - public GT_MetaTileEntity_AcidGenerator(int aID, String aName, String aNameRegional, int aTier, ITexture... aTextures) { + public GT_MetaTileEntity_AcidGenerator(int aID, String aName, String aNameRegional, int aTier, ITexture... aTextures) { super(aID, aName, aNameRegional, aTier, new String[]{}, aTextures); } @@ -110,6 +110,6 @@ public class GT_MetaTileEntity_AcidGenerator extends GT_MetaTileEntity_BasicGene @SuppressWarnings("deprecation") public String[] getDescription() { - return new String[]{StatCollector.translateToLocal("tooltip.tile.acidgen.0.name"), StatCollector.translateToLocal("tooltip.tile.acidgen.1.name"), StatCollector.translateToLocal("tooltip.tile.tiereddsc.0.name")+" "+ ChatColorHelper.YELLOW + GT_Values.V[this.mTier], StatCollector.translateToLocal("tooltip.rotor.2.name")+" "+ ChatColorHelper.YELLOW + getEfficiency(), StatCollector.translateToLocal("tooltip.tile.tiereddsc.2.name")+" "+ ChatColorHelper.YELLOW + maxAmperesOut(), StatCollector.translateToLocal("tooltip.bw.1.name") + ChatColorHelper.DARKGREEN + " BartWorks"}; + return new String[]{StatCollector.translateToLocal("tooltip.tile.acidgen.0.name"), StatCollector.translateToLocal("tooltip.tile.acidgen.1.name"), StatCollector.translateToLocal("tooltip.tile.tiereddsc.0.name") + " " + ChatColorHelper.YELLOW + GT_Values.V[this.mTier], StatCollector.translateToLocal("tooltip.rotor.2.name") + " " + ChatColorHelper.YELLOW + getEfficiency(), StatCollector.translateToLocal("tooltip.tile.tiereddsc.2.name") + " " + ChatColorHelper.YELLOW + maxAmperesOut(), StatCollector.translateToLocal("tooltip.bw.1.name") + ChatColorHelper.DARKGREEN + " BartWorks"}; } } diff --git a/src/main/java/com/github/bartimaeusnek/bartworks/common/tileentities/tiered/GT_MetaTileEntity_BioLab.java b/src/main/java/com/github/bartimaeusnek/bartworks/common/tileentities/tiered/GT_MetaTileEntity_BioLab.java index 1fd3cfcfd6..e26b50cdd1 100644 --- a/src/main/java/com/github/bartimaeusnek/bartworks/common/tileentities/tiered/GT_MetaTileEntity_BioLab.java +++ b/src/main/java/com/github/bartimaeusnek/bartworks/common/tileentities/tiered/GT_MetaTileEntity_BioLab.java @@ -194,9 +194,9 @@ public class GT_MetaTileEntity_BioLab extends GT_MetaTileEntity_BasicMachine { case 3: { if ( GT_Utility.isStackValid(this.mInventory[4]) && GT_Utility.areStacksEqual(this.mInventory[4], BioItemList.getPetriDish(null), true) && this.mInventory[4].getTagCompound() != null && - GT_Utility.isStackValid(this.mInventory[5]) && GT_Utility.areStacksEqual(this.mInventory[5], BioItemList.getPlasmidCell(null), true) && this.mInventory[5].getTagCompound() != null && - GT_Utility.isStackValid(this.mInventory[6]) && GT_Utility.areStacksEqual(this.mInventory[6], FluidLoader.BioLabFluidCells[2]) && - this.mFluid.isFluidEqual(FluidRegistry.getFluidStack("ic2distilledwater", 1000)) && this.mFluid.amount >= 1000) { + GT_Utility.isStackValid(this.mInventory[5]) && GT_Utility.areStacksEqual(this.mInventory[5], BioItemList.getPlasmidCell(null), true) && this.mInventory[5].getTagCompound() != null && + GT_Utility.isStackValid(this.mInventory[6]) && GT_Utility.areStacksEqual(this.mInventory[6], FluidLoader.BioLabFluidCells[2]) && + this.mFluid.isFluidEqual(FluidRegistry.getFluidStack("ic2distilledwater", 1000)) && this.mFluid.amount >= 1000) { BioData cultureDNABioData = BioData.getBioDataFromNBTTag(this.mInventory[5].getTagCompound()); BioCulture bioCulture = BioCulture.getBioCultureFromNBTTag(this.mInventory[4].getTagCompound()); if (cultureDNABioData == null || bioCulture == null) @@ -257,7 +257,7 @@ public class GT_MetaTileEntity_BioLab extends GT_MetaTileEntity_BasicMachine { return super.checkRecipe(skipOC); } - private BioCulture checkForExisting(BioCulture culture){ + private BioCulture checkForExisting(BioCulture culture) { if (culture == null) return null; for (BioCulture bc : BioCulture.BIO_CULTURE_ARRAY_LIST) @@ -269,6 +269,6 @@ public class GT_MetaTileEntity_BioLab extends GT_MetaTileEntity_BasicMachine { @Override @SuppressWarnings("deprecation") public String[] getDescription() { - return new String[]{ StatCollector.translateToLocal("tooltip.tile.biolab.0.name"), StatCollector.translateToLocal("tooltip.bw.1.name") + ChatColorHelper.DARKGREEN + " BartWorks"}; + return new String[]{StatCollector.translateToLocal("tooltip.tile.biolab.0.name"), StatCollector.translateToLocal("tooltip.bw.1.name") + ChatColorHelper.DARKGREEN + " BartWorks"}; } } diff --git a/src/main/java/com/github/bartimaeusnek/bartworks/common/tileentities/tiered/GT_MetaTileEntity_Diode.java b/src/main/java/com/github/bartimaeusnek/bartworks/common/tileentities/tiered/GT_MetaTileEntity_Diode.java index b85e1137fe..e3a1da3966 100644 --- a/src/main/java/com/github/bartimaeusnek/bartworks/common/tileentities/tiered/GT_MetaTileEntity_Diode.java +++ b/src/main/java/com/github/bartimaeusnek/bartworks/common/tileentities/tiered/GT_MetaTileEntity_Diode.java @@ -42,7 +42,7 @@ public class GT_MetaTileEntity_Diode extends GT_MetaTileEntity_BasicHull { public GT_MetaTileEntity_Diode(int aID, String aName, String aNameRegional, int aTier) { super(aID, aName, aNameRegional, aTier, StatCollector.translateToLocal("tooltip.tile.diode.0.name")); maxAmps = getAmpsfromMeta(aID); - aAmps=maxAmps; + aAmps = maxAmps; } public GT_MetaTileEntity_Diode(String aName, int aTier, String[] aDescription, ITexture[][][] aTextures) { @@ -54,7 +54,7 @@ public class GT_MetaTileEntity_Diode extends GT_MetaTileEntity_BasicHull { super.onFirstTick(aBaseMetaTileEntity); if (maxAmps == 0 && !this.getBaseMetaTileEntity().getWorld().isRemote) { maxAmps = getAmpsfromMeta(this.getBaseMetaTileEntity().getMetaTileID()); - aAmps=maxAmps; + aAmps = maxAmps; } } @@ -100,16 +100,16 @@ public class GT_MetaTileEntity_Diode extends GT_MetaTileEntity_BasicHull { return new GT_MetaTileEntity_Diode(this.mName, this.mTier, this.mDescriptionArray, this.mTextures); } - private long getAmpsfromMeta(int meta){ - if (meta > ConfigHandler.IDOffset + GT_Values.VN.length && meta <= ConfigHandler.IDOffset + GT_Values.VN.length*2) + private long getAmpsfromMeta(int meta) { + if (meta > ConfigHandler.IDOffset + GT_Values.VN.length && meta <= ConfigHandler.IDOffset + GT_Values.VN.length * 2) return 2L; - else if (meta > ConfigHandler.IDOffset + GT_Values.VN.length*2 && meta <= ConfigHandler.IDOffset + GT_Values.VN.length*3) + else if (meta > ConfigHandler.IDOffset + GT_Values.VN.length * 2 && meta <= ConfigHandler.IDOffset + GT_Values.VN.length * 3) return 4L; - else if (meta > ConfigHandler.IDOffset + GT_Values.VN.length*3 && meta <= ConfigHandler.IDOffset + GT_Values.VN.length*4) + else if (meta > ConfigHandler.IDOffset + GT_Values.VN.length * 3 && meta <= ConfigHandler.IDOffset + GT_Values.VN.length * 4) return 8L; - else if (meta > ConfigHandler.IDOffset + GT_Values.VN.length*4 && meta <= ConfigHandler.IDOffset + GT_Values.VN.length*5) + else if (meta > ConfigHandler.IDOffset + GT_Values.VN.length * 4 && meta <= ConfigHandler.IDOffset + GT_Values.VN.length * 5) return 12L; - else if (meta > ConfigHandler.IDOffset + GT_Values.VN.length*5 && meta <= ConfigHandler.IDOffset + GT_Values.VN.length*6) + else if (meta > ConfigHandler.IDOffset + GT_Values.VN.length * 5 && meta <= ConfigHandler.IDOffset + GT_Values.VN.length * 6) return 16L; else return 0L; @@ -117,6 +117,6 @@ public class GT_MetaTileEntity_Diode extends GT_MetaTileEntity_BasicHull { @SuppressWarnings("deprecation") public String[] getDescription() { - return new String[]{mDescription, StatCollector.translateToLocal("tooltip.tile.tiereddsc.0.name")+ " " + ChatColorHelper.YELLOW + GT_Values.V[this.mTier], StatCollector.translateToLocal("tooltip.tile.tiereddsc.1.name") + " " + ChatColorHelper.YELLOW + maxAmperesIn(), StatCollector.translateToLocal("tooltip.tile.tiereddsc.2.name") +" " + ChatColorHelper.YELLOW + maxAmperesOut(), StatCollector.translateToLocal("tooltip.bw.1.name") + ChatColorHelper.DARKGREEN + " BartWorks"}; + return new String[]{mDescription, StatCollector.translateToLocal("tooltip.tile.tiereddsc.0.name") + " " + ChatColorHelper.YELLOW + GT_Values.V[this.mTier], StatCollector.translateToLocal("tooltip.tile.tiereddsc.1.name") + " " + ChatColorHelper.YELLOW + maxAmperesIn(), StatCollector.translateToLocal("tooltip.tile.tiereddsc.2.name") + " " + ChatColorHelper.YELLOW + maxAmperesOut(), StatCollector.translateToLocal("tooltip.bw.1.name") + ChatColorHelper.DARKGREEN + " BartWorks"}; } } diff --git a/src/main/java/com/github/bartimaeusnek/bartworks/common/tileentities/tiered/GT_MetaTileEntity_EnergyDistributor.java b/src/main/java/com/github/bartimaeusnek/bartworks/common/tileentities/tiered/GT_MetaTileEntity_EnergyDistributor.java index 25fad9103e..8c4c13d171 100644 --- a/src/main/java/com/github/bartimaeusnek/bartworks/common/tileentities/tiered/GT_MetaTileEntity_EnergyDistributor.java +++ b/src/main/java/com/github/bartimaeusnek/bartworks/common/tileentities/tiered/GT_MetaTileEntity_EnergyDistributor.java @@ -71,7 +71,7 @@ public class GT_MetaTileEntity_EnergyDistributor extends GT_MetaTileEntity_Trans @SuppressWarnings("deprecation") public String[] getDescription() { - return new String[]{StatCollector.translateToLocal("tooltip.tile.energydistributor.0.name"), StatCollector.translateToLocal("tooltip.tile.tiereddsc.0.name")+ " " + ChatColorHelper.YELLOW + GT_Values.V[this.mTier], StatCollector.translateToLocal("tooltip.tile.tiereddsc.1.name")+ " " + ChatColorHelper.YELLOW + this.maxAmperesIn(), StatCollector.translateToLocal("tooltip.tile.tiereddsc.2.name")+ " " + ChatColorHelper.YELLOW + this.maxAmperesOut(), StatCollector.translateToLocal("tooltip.bw.1.name") + ChatColorHelper.DARKGREEN + " BartWorks"}; + return new String[]{StatCollector.translateToLocal("tooltip.tile.energydistributor.0.name"), StatCollector.translateToLocal("tooltip.tile.tiereddsc.0.name") + " " + ChatColorHelper.YELLOW + GT_Values.V[this.mTier], StatCollector.translateToLocal("tooltip.tile.tiereddsc.1.name") + " " + ChatColorHelper.YELLOW + this.maxAmperesIn(), StatCollector.translateToLocal("tooltip.tile.tiereddsc.2.name") + " " + ChatColorHelper.YELLOW + this.maxAmperesOut(), StatCollector.translateToLocal("tooltip.bw.1.name") + ChatColorHelper.DARKGREEN + " BartWorks"}; } } diff --git a/src/main/java/com/github/bartimaeusnek/bartworks/common/tileentities/tiered/GT_MetaTileEntity_RadioHatch.java b/src/main/java/com/github/bartimaeusnek/bartworks/common/tileentities/tiered/GT_MetaTileEntity_RadioHatch.java index 6ee28527c4..479681d492 100644 --- a/src/main/java/com/github/bartimaeusnek/bartworks/common/tileentities/tiered/GT_MetaTileEntity_RadioHatch.java +++ b/src/main/java/com/github/bartimaeusnek/bartworks/common/tileentities/tiered/GT_MetaTileEntity_RadioHatch.java @@ -58,7 +58,7 @@ public class GT_MetaTileEntity_RadioHatch extends GT_MetaTileEntity_Hatch { private byte coverage = 0; public GT_MetaTileEntity_RadioHatch(int aID, String aName, String aNameRegional, int aTier) { - super(aID, aName, aNameRegional, aTier, 1, new String[]{StatCollector.translateToLocal("tooltip.tile.radhatch.0.name"), StatCollector.translateToLocal("tooltip.tile.tiereddsc.3.name")+" " + (aTier - 2) + " " + ((aTier - 2) >= 2 ? StatCollector.translateToLocal("tooltip.bw.kg.1.name") : StatCollector.translateToLocal("tooltip.bw.kg.0.name")), StatCollector.translateToLocal("tooltip.tile.radhatch.1.name"), StatCollector.translateToLocal("tooltip.bw.1.name") + ChatColorHelper.DARKGREEN + " BartWorks"}); + super(aID, aName, aNameRegional, aTier, 1, new String[]{StatCollector.translateToLocal("tooltip.tile.radhatch.0.name"), StatCollector.translateToLocal("tooltip.tile.tiereddsc.3.name") + " " + (aTier - 2) + " " + ((aTier - 2) >= 2 ? StatCollector.translateToLocal("tooltip.bw.kg.1.name") : StatCollector.translateToLocal("tooltip.bw.kg.0.name")), StatCollector.translateToLocal("tooltip.tile.radhatch.1.name"), StatCollector.translateToLocal("tooltip.bw.1.name") + ChatColorHelper.DARKGREEN + " BartWorks"}); cap = aTier - 2; } @@ -253,8 +253,9 @@ public class GT_MetaTileEntity_RadioHatch extends GT_MetaTileEntity_Hatch { @Override public String[] getInfoData() { if (calcDecayTicks(this.sievert) != 0) - return new String[]{StatCollector.translateToLocal("tooltip.tile.radhatch.2.name")+" "+ material, StatCollector.translateToLocal("tooltip.tile.radhatch.3.name")+" "+ sievert, StatCollector.translateToLocal("tooltip.tile.radhatch.4.name")+" "+mass, StatCollector.translateToLocal("tooltip.tile.radhatch.5.name")+" "+ + ((calcDecayTicks(this.sievert)) - timer % (calcDecayTicks(this.sievert) * 60)) + StatCollector.translateToLocal("tooltip.tile.radhatch.6.name")+"/" + ((calcDecayTicks(this.sievert)) - timer % (calcDecayTicks(this.sievert))) / 20 + StatCollector.translateToLocal("tooltip.tile.radhatch.7.name")+"/" + ((calcDecayTicks(this.sievert)) - timer % (calcDecayTicks(this.sievert))) / 20 / 60 + StatCollector.translateToLocal("tooltip.tile.radhatch.8.name")+"/" + ((calcDecayTicks(this.sievert)) - timer % (calcDecayTicks(this.sievert))) / 20 / 60 / 60 + StatCollector.translateToLocal("tooltip.tile.radhatch.9.name")}; - else return new String[]{StatCollector.translateToLocal("tooltip.tile.radhatch.2.name")+" "+StatCollector.translateToLocal("tooltip.bw.empty.name"), StatCollector.translateToLocal("tooltip.tile.radhatch.3.name")+" "+"0", StatCollector.translateToLocal("tooltip.tile.radhatch.4.name")+" "+"0"}; + return new String[]{StatCollector.translateToLocal("tooltip.tile.radhatch.2.name") + " " + material, StatCollector.translateToLocal("tooltip.tile.radhatch.3.name") + " " + sievert, StatCollector.translateToLocal("tooltip.tile.radhatch.4.name") + " " + mass, StatCollector.translateToLocal("tooltip.tile.radhatch.5.name") + " " + +((calcDecayTicks(this.sievert)) - timer % (calcDecayTicks(this.sievert) * 60)) + StatCollector.translateToLocal("tooltip.tile.radhatch.6.name") + "/" + ((calcDecayTicks(this.sievert)) - timer % (calcDecayTicks(this.sievert))) / 20 + StatCollector.translateToLocal("tooltip.tile.radhatch.7.name") + "/" + ((calcDecayTicks(this.sievert)) - timer % (calcDecayTicks(this.sievert))) / 20 / 60 + StatCollector.translateToLocal("tooltip.tile.radhatch.8.name") + "/" + ((calcDecayTicks(this.sievert)) - timer % (calcDecayTicks(this.sievert))) / 20 / 60 / 60 + StatCollector.translateToLocal("tooltip.tile.radhatch.9.name")}; + else + return new String[]{StatCollector.translateToLocal("tooltip.tile.radhatch.2.name") + " " + StatCollector.translateToLocal("tooltip.bw.empty.name"), StatCollector.translateToLocal("tooltip.tile.radhatch.3.name") + " " + "0", StatCollector.translateToLocal("tooltip.tile.radhatch.4.name") + " " + "0"}; } public boolean isSimpleMachine() { diff --git a/src/main/java/com/github/bartimaeusnek/bartworks/neiHandler/BW_NEI_BioLabHandler.java b/src/main/java/com/github/bartimaeusnek/bartworks/neiHandler/BW_NEI_BioLabHandler.java index b0b1fe61df..8590f1f713 100644 --- a/src/main/java/com/github/bartimaeusnek/bartworks/neiHandler/BW_NEI_BioLabHandler.java +++ b/src/main/java/com/github/bartimaeusnek/bartworks/neiHandler/BW_NEI_BioLabHandler.java @@ -62,8 +62,7 @@ public class BW_NEI_BioLabHandler extends GT_NEI_DefaultHandler { } } - } - else + } else super.loadCraftingRecipes(aResult); } @@ -81,8 +80,7 @@ public class BW_NEI_BioLabHandler extends GT_NEI_DefaultHandler { } } - } - else + } else super.loadCraftingRecipes(aResult); } } diff --git a/src/main/java/com/github/bartimaeusnek/bartworks/neiHandler/BW_NEI_BioVatHandler.java b/src/main/java/com/github/bartimaeusnek/bartworks/neiHandler/BW_NEI_BioVatHandler.java index dda5661c69..4cf03fb000 100644 --- a/src/main/java/com/github/bartimaeusnek/bartworks/neiHandler/BW_NEI_BioVatHandler.java +++ b/src/main/java/com/github/bartimaeusnek/bartworks/neiHandler/BW_NEI_BioVatHandler.java @@ -56,17 +56,17 @@ public class BW_NEI_BioVatHandler extends GT_NEI_DefaultHandler { public void drawExtras(int aRecipeIndex) { int base = 70; - int[] lines ={ base,base+8,base+16,base+24,base+32,base+40,base+48,base+56,base+64}; - int tEUt = ((GT_NEI_DefaultHandler.CachedDefaultRecipe)this.arecipes.get(aRecipeIndex)).mRecipe.mEUt; - int tDuration = ((GT_NEI_DefaultHandler.CachedDefaultRecipe)this.arecipes.get(aRecipeIndex)).mRecipe.mDuration; - String[] recipeDesc = ((GT_NEI_DefaultHandler.CachedDefaultRecipe)this.arecipes.get(aRecipeIndex)).mRecipe.getNeiDesc(); + int[] lines = {base, base + 8, base + 16, base + 24, base + 32, base + 40, base + 48, base + 56, base + 64}; + int tEUt = ((GT_NEI_DefaultHandler.CachedDefaultRecipe) this.arecipes.get(aRecipeIndex)).mRecipe.mEUt; + int tDuration = ((GT_NEI_DefaultHandler.CachedDefaultRecipe) this.arecipes.get(aRecipeIndex)).mRecipe.mDuration; + String[] recipeDesc = ((GT_NEI_DefaultHandler.CachedDefaultRecipe) this.arecipes.get(aRecipeIndex)).mRecipe.getNeiDesc(); int tSpecial; if (recipeDesc == null) { if (tEUt != 0) { - drawText(10, lines[0], this.trans("152", "Total: ") + (long)tDuration * (long)tEUt + " EU", -16777216); + drawText(10, lines[0], this.trans("152", "Total: ") + (long) tDuration * (long) tEUt + " EU", -16777216); drawText(10, lines[1], this.trans("153", "Usage: ") + tEUt + " EU/t", -16777216); if (this.mRecipeMap.mShowVoltageAmperageInNEI) { - drawText(10,lines[2], this.trans("154", "Voltage: ") + tEUt / this.mRecipeMap.mAmperage + " EU", -16777216); + drawText(10, lines[2], this.trans("154", "Voltage: ") + tEUt / this.mRecipeMap.mAmperage + " EU", -16777216); drawText(10, lines[3], this.trans("155", "Amperage: ") + this.mRecipeMap.mAmperage, -16777216); } else { drawText(10, lines[2], this.trans("156", "Voltage: unspecified"), -16777216); @@ -75,16 +75,15 @@ public class BW_NEI_BioVatHandler extends GT_NEI_DefaultHandler { } - if (tDuration > 0) { - drawText(10, lines[4], this.trans("158", "Time: ") + String.format("%.2f " + this.trans("161", " secs"), 0.05F * (float)tDuration), -16777216); + drawText(10, lines[4], this.trans("158", "Time: ") + String.format("%.2f " + this.trans("161", " secs"), 0.05F * (float) tDuration), -16777216); } - tSpecial = ((GT_NEI_DefaultHandler.CachedDefaultRecipe)this.arecipes.get(aRecipeIndex)).mRecipe.mSpecialValue; + tSpecial = ((GT_NEI_DefaultHandler.CachedDefaultRecipe) this.arecipes.get(aRecipeIndex)).mRecipe.mSpecialValue; int[] tSpecialA = GT_TileEntity_BioVat.specialValueUnpack(tSpecial); - drawText(10, lines[5], StatCollector.translateToLocal("nei.biovat.0.name")+" " + tSpecialA[0],-16777216); + drawText(10, lines[5], StatCollector.translateToLocal("nei.biovat.0.name") + " " + tSpecialA[0], -16777216); if (tSpecialA[1] == -100 && GT_Mod.gregtechproxy.mLowGravProcessing) { drawText(10, lines[7], this.trans("159", "Needs Low Gravity"), -16777216); @@ -95,14 +94,14 @@ public class BW_NEI_BioVatHandler extends GT_NEI_DefaultHandler { } else if (tSpecialA[1] == -400) { drawText(10, lines[7], this.trans("216", "Deprecated Recipe"), -16777216); } else if (GT_Utility.isStringValid(this.mRecipeMap.mNEISpecialValuePre) || GT_Utility.isStringValid(this.mRecipeMap.mNEISpecialValuePost)) { - drawText(10, lines[6],(tSpecialA[2] == 1 ? StatCollector.translateToLocal("nei.biovat.1.name"): StatCollector.translateToLocal("nei.biovat.2.name")) + this.mRecipeMap.mNEISpecialValuePre + tSpecialA[3] * this.mRecipeMap.mNEISpecialValueMultiplier + this.mRecipeMap.mNEISpecialValuePost, -16777216); + drawText(10, lines[6], (tSpecialA[2] == 1 ? StatCollector.translateToLocal("nei.biovat.1.name") : StatCollector.translateToLocal("nei.biovat.2.name")) + this.mRecipeMap.mNEISpecialValuePre + tSpecialA[3] * this.mRecipeMap.mNEISpecialValueMultiplier + this.mRecipeMap.mNEISpecialValuePost, -16777216); } } else { tSpecial = 0; String[] var6 = recipeDesc; int var7 = recipeDesc.length; - for(int var8 = 0; var8 < var7; ++var8) { + for (int var8 = 0; var8 < var7; ++var8) { String descLine = var6[var8]; drawText(10, 73 + 10 * tSpecial, descLine, -16777216); ++tSpecial; @@ -127,7 +126,7 @@ public class BW_NEI_BioVatHandler extends GT_NEI_DefaultHandler { @Override public void loadCraftingRecipes(ItemStack aResult) { - if (aResult == null || !(aResult.getItem() instanceof LabParts && aResult.getItemDamage() < 3 )) { + if (aResult == null || !(aResult.getItem() instanceof LabParts && aResult.getItemDamage() < 3)) { super.loadCraftingRecipes(aResult); } } diff --git a/src/main/java/com/github/bartimaeusnek/bartworks/neiHandler/BW_NEI_OreHandler.java b/src/main/java/com/github/bartimaeusnek/bartworks/neiHandler/BW_NEI_OreHandler.java index 1c76a84a05..38104bf7f2 100644 --- a/src/main/java/com/github/bartimaeusnek/bartworks/neiHandler/BW_NEI_OreHandler.java +++ b/src/main/java/com/github/bartimaeusnek/bartworks/neiHandler/BW_NEI_OreHandler.java @@ -45,7 +45,7 @@ public class BW_NEI_OreHandler extends TemplateRecipeHandler { public BW_NEI_OreHandler() { if (!NEI_BW_Config.sIsAdded) { - FMLInterModComms.sendRuntimeMessage(MainMod.MOD_ID, "NEIPlugins", "register-crafting-handler", MainMod.MOD_ID+"@" + getRecipeName() + "@" + getOverlayIdentifier()); + FMLInterModComms.sendRuntimeMessage(MainMod.MOD_ID, "NEIPlugins", "register-crafting-handler", MainMod.MOD_ID + "@" + getRecipeName() + "@" + getOverlayIdentifier()); GuiCraftingRecipe.craftinghandlers.add(this); // GuiUsageRecipe.usagehandlers.add(this); } @@ -53,7 +53,7 @@ public class BW_NEI_OreHandler extends TemplateRecipeHandler { @Override public void drawBackground(int recipe) { - GuiDraw.drawRect(0,0,166, 65,0x888888); + GuiDraw.drawRect(0, 0, 166, 65, 0x888888); } @Override @@ -63,97 +63,97 @@ public class BW_NEI_OreHandler extends TemplateRecipeHandler { @Override public void loadCraftingRecipes(String outputId, Object... results) { - if (outputId.equalsIgnoreCase("quickanddirtyneihandler")){ - for (int i = 0; i < Werkstoff.werkstoffHashMap.values().size(); i++) { - ItemStack result = new ItemStack(WerkstoffLoader.BWOres,1,i); - if (Block.getBlockFromItem(result.getItem()) instanceof BW_MetaGenerated_Ores){ - CachedRecipe tmp = new CachedRecipe() { - - PositionedStack stack = new PositionedStack(result, 0, 0); - - @Override - public PositionedStack getResult() { - return stack; - } - - @Override - public List<PositionedStack> getOtherStacks() { - ArrayList<PositionedStack> ret = new ArrayList<>(); - for (int i = 0; i < GT_Worldgen_GT_Ore_Layer.sList.size(); i++) { - if (BW_WorldGenRoss128.sList.get(i) instanceof BW_WorldGenRoss128) { - int baseMeta = result.getItemDamage(); - BW_WorldGenRoss128 worldGen = ((BW_WorldGenRoss128) BW_WorldGenRoss128.sList.get(i)); - if (worldGen.mPrimaryMeta == baseMeta || worldGen.mSecondaryMeta == baseMeta || worldGen.mBetweenMeta == baseMeta || worldGen.mSporadicMeta == baseMeta) { - ItemStack other; - other=result.copy().setStackDisplayName(result.getDisplayName().replaceAll("Ore","Vein")); - stack = new PositionedStack(other, 83, 0); - if (((worldGen.bwOres & 0b1000) != 0)) { - other = result.copy(); - other.setItemDamage(worldGen.mPrimaryMeta); - ret.add(new PositionedStack(other, 0, 12)); - } else { - other = new ItemStack(GregTech_API.sBlockOres1); - other.setItemDamage(worldGen.mPrimaryMeta); - ret.add(new PositionedStack(other, 0, 12)); - } - if (((worldGen.bwOres & 0b0100) != 0)) { - other = result.copy(); - other.setItemDamage(worldGen.mSecondaryMeta); - ret.add(new PositionedStack(other, 20, 12)); - } else { - other = new ItemStack(GregTech_API.sBlockOres1); - other.setItemDamage(worldGen.mSecondaryMeta); - ret.add(new PositionedStack(other, 20, 12)); - } - if (((worldGen.bwOres & 0b0010) != 0)) { - other = result.copy(); - other.setItemDamage(worldGen.mBetweenMeta); - ret.add(new PositionedStack(other, 40, 12)); - } else { - other = new ItemStack(GregTech_API.sBlockOres1); - other.setItemDamage(worldGen.mBetweenMeta); - ret.add(new PositionedStack(other, 40, 12)); - } - if (((worldGen.bwOres & 0b0001) != 0)) { - other = result.copy(); - other.setItemDamage(worldGen.mSporadicMeta); - ret.add(new PositionedStack(other, 60, 12)); - } else { - other = new ItemStack(GregTech_API.sBlockOres1); - other.setItemDamage(worldGen.mSporadicMeta); - ret.add(new PositionedStack(other, 60, 12)); - } - break; - } - } - } - return ret; - } - }; - this.arecipes.add(tmp); - } - } - } else super.loadCraftingRecipes(outputId, results); + if (outputId.equalsIgnoreCase("quickanddirtyneihandler")) { + for (int i = 0; i < Werkstoff.werkstoffHashMap.values().size(); i++) { + ItemStack result = new ItemStack(WerkstoffLoader.BWOres, 1, i); + if (Block.getBlockFromItem(result.getItem()) instanceof BW_MetaGenerated_Ores) { + CachedRecipe tmp = new CachedRecipe() { + + PositionedStack stack = new PositionedStack(result, 0, 0); + + @Override + public PositionedStack getResult() { + return stack; + } + + @Override + public List<PositionedStack> getOtherStacks() { + ArrayList<PositionedStack> ret = new ArrayList<>(); + for (int i = 0; i < GT_Worldgen_GT_Ore_Layer.sList.size(); i++) { + if (BW_WorldGenRoss128.sList.get(i) instanceof BW_WorldGenRoss128) { + int baseMeta = result.getItemDamage(); + BW_WorldGenRoss128 worldGen = ((BW_WorldGenRoss128) BW_WorldGenRoss128.sList.get(i)); + if (worldGen.mPrimaryMeta == baseMeta || worldGen.mSecondaryMeta == baseMeta || worldGen.mBetweenMeta == baseMeta || worldGen.mSporadicMeta == baseMeta) { + ItemStack other; + other = result.copy().setStackDisplayName(result.getDisplayName().replaceAll("Ore", "Vein")); + stack = new PositionedStack(other, 83, 0); + if (((worldGen.bwOres & 0b1000) != 0)) { + other = result.copy(); + other.setItemDamage(worldGen.mPrimaryMeta); + ret.add(new PositionedStack(other, 0, 12)); + } else { + other = new ItemStack(GregTech_API.sBlockOres1); + other.setItemDamage(worldGen.mPrimaryMeta); + ret.add(new PositionedStack(other, 0, 12)); + } + if (((worldGen.bwOres & 0b0100) != 0)) { + other = result.copy(); + other.setItemDamage(worldGen.mSecondaryMeta); + ret.add(new PositionedStack(other, 20, 12)); + } else { + other = new ItemStack(GregTech_API.sBlockOres1); + other.setItemDamage(worldGen.mSecondaryMeta); + ret.add(new PositionedStack(other, 20, 12)); + } + if (((worldGen.bwOres & 0b0010) != 0)) { + other = result.copy(); + other.setItemDamage(worldGen.mBetweenMeta); + ret.add(new PositionedStack(other, 40, 12)); + } else { + other = new ItemStack(GregTech_API.sBlockOres1); + other.setItemDamage(worldGen.mBetweenMeta); + ret.add(new PositionedStack(other, 40, 12)); + } + if (((worldGen.bwOres & 0b0001) != 0)) { + other = result.copy(); + other.setItemDamage(worldGen.mSporadicMeta); + ret.add(new PositionedStack(other, 60, 12)); + } else { + other = new ItemStack(GregTech_API.sBlockOres1); + other.setItemDamage(worldGen.mSporadicMeta); + ret.add(new PositionedStack(other, 60, 12)); + } + break; + } + } + } + return ret; + } + }; + this.arecipes.add(tmp); + } + } + } else super.loadCraftingRecipes(outputId, results); } @Override public void drawExtras(int recipe) { - GuiDraw.drawString(ChatColorHelper.BOLD+"DIM:"+ChatColorHelper.RESET+" Ross128",0,40,0,false); - GuiDraw.drawString(ChatColorHelper.BOLD+"Primary:",0,50,0,false); - GuiDraw.drawString(this.arecipes.get(recipe).getOtherStacks().get(0).item.getDisplayName(),0,60,0,false); - GuiDraw.drawString(ChatColorHelper.BOLD+"Secondary:",0,70,0,false); - GuiDraw.drawString(this.arecipes.get(recipe).getOtherStacks().get(1).item.getDisplayName(),0,80,0,false); - GuiDraw.drawString(ChatColorHelper.BOLD+"InBetween:",0,90,0,false); - GuiDraw.drawString(this.arecipes.get(recipe).getOtherStacks().get(2).item.getDisplayName(),0,100,0,false); - GuiDraw.drawString(ChatColorHelper.BOLD+"Sporadic:",0,110,0,false); - GuiDraw.drawString(this.arecipes.get(recipe).getOtherStacks().get(3).item.getDisplayName(),0,120,0,false); + GuiDraw.drawString(ChatColorHelper.BOLD + "DIM:" + ChatColorHelper.RESET + " Ross128", 0, 40, 0, false); + GuiDraw.drawString(ChatColorHelper.BOLD + "Primary:", 0, 50, 0, false); + GuiDraw.drawString(this.arecipes.get(recipe).getOtherStacks().get(0).item.getDisplayName(), 0, 60, 0, false); + GuiDraw.drawString(ChatColorHelper.BOLD + "Secondary:", 0, 70, 0, false); + GuiDraw.drawString(this.arecipes.get(recipe).getOtherStacks().get(1).item.getDisplayName(), 0, 80, 0, false); + GuiDraw.drawString(ChatColorHelper.BOLD + "InBetween:", 0, 90, 0, false); + GuiDraw.drawString(this.arecipes.get(recipe).getOtherStacks().get(2).item.getDisplayName(), 0, 100, 0, false); + GuiDraw.drawString(ChatColorHelper.BOLD + "Sporadic:", 0, 110, 0, false); + GuiDraw.drawString(this.arecipes.get(recipe).getOtherStacks().get(3).item.getDisplayName(), 0, 120, 0, false); super.drawExtras(recipe); } @Override public void loadCraftingRecipes(ItemStack result) { - if (Block.getBlockFromItem(result.getItem()) instanceof BW_MetaGenerated_Ores){ + if (Block.getBlockFromItem(result.getItem()) instanceof BW_MetaGenerated_Ores) { CachedRecipe tmp = new CachedRecipe() { PositionedStack stack = new PositionedStack(result, 0, 0); @@ -172,7 +172,7 @@ public class BW_NEI_OreHandler extends TemplateRecipeHandler { BW_WorldGenRoss128 worldGen = ((BW_WorldGenRoss128) BW_WorldGenRoss128.sList.get(i)); if (worldGen.mPrimaryMeta == baseMeta || worldGen.mSecondaryMeta == baseMeta || worldGen.mBetweenMeta == baseMeta || worldGen.mSporadicMeta == baseMeta) { ItemStack other; - other=result.copy().setStackDisplayName(result.getDisplayName().replaceAll("Ore","Vein")); + other = result.copy().setStackDisplayName(result.getDisplayName().replaceAll("Ore", "Vein")); stack = new PositionedStack(other, 83, 0); if (((worldGen.bwOres & 0b1000) != 0)) { other = result.copy(); @@ -214,7 +214,7 @@ public class BW_NEI_OreHandler extends TemplateRecipeHandler { } } } - return ret; + return ret; } }; this.arecipes.add(tmp); diff --git a/src/main/java/com/github/bartimaeusnek/bartworks/system/material/BW_MetaGeneratedOreTE.java b/src/main/java/com/github/bartimaeusnek/bartworks/system/material/BW_MetaGeneratedOreTE.java index 1db9bcb8aa..81ab1e54b9 100644 --- a/src/main/java/com/github/bartimaeusnek/bartworks/system/material/BW_MetaGeneratedOreTE.java +++ b/src/main/java/com/github/bartimaeusnek/bartworks/system/material/BW_MetaGeneratedOreTE.java @@ -29,16 +29,12 @@ import gregtech.api.interfaces.ITexture; import gregtech.api.interfaces.tileentity.ITexturedTileEntity; import gregtech.api.objects.GT_CopiedBlockTexture; import gregtech.api.objects.GT_RenderedTexture; -import gregtech.common.blocks.GT_Packet_Ores; import net.minecraft.block.Block; import net.minecraft.init.Blocks; import net.minecraft.item.ItemStack; import net.minecraft.nbt.NBTTagCompound; -import net.minecraft.network.NetworkManager; import net.minecraft.network.Packet; -import net.minecraft.network.play.server.S35PacketUpdateTileEntity; import net.minecraft.tileentity.TileEntity; -import net.minecraft.world.IBlockAccess; import net.minecraft.world.World; import java.util.ArrayList; @@ -49,6 +45,16 @@ public class BW_MetaGeneratedOreTE extends TileEntity implements ITexturedTileEn public short mMetaData = 0; + public static boolean placeOre(World aWorld, Coords coords, Werkstoff werkstoff) { + short meta = werkstoff.getmID(); + aWorld.setBlock(coords.x, coords.y, coords.z, WerkstoffLoader.BWOres, 0, 0); + TileEntity tTileEntity = aWorld.getTileEntity(coords.x, coords.y, coords.z); + if ((tTileEntity instanceof BW_MetaGeneratedOreTE)) { + ((BW_MetaGeneratedOreTE) tTileEntity).mMetaData = meta; + } + return true; + } + public boolean canUpdate() { return false; } @@ -63,16 +69,6 @@ public class BW_MetaGeneratedOreTE extends TileEntity implements ITexturedTileEn aNBT.setShort("m", this.mMetaData); } - public static boolean placeOre(World aWorld,Coords coords, Werkstoff werkstoff) { - short meta = werkstoff.getmID(); - aWorld.setBlock(coords.x, coords.y, coords.z, WerkstoffLoader.BWOres, 0, 0); - TileEntity tTileEntity = aWorld.getTileEntity(coords.x, coords.y, coords.z); - if ((tTileEntity instanceof BW_MetaGeneratedOreTE)) { - ((BW_MetaGeneratedOreTE) tTileEntity).mMetaData = meta; - } - return true; - } - public ArrayList<ItemStack> getDrops(Block aDroppedOre) { ArrayList<ItemStack> rList = new ArrayList(); if (this.mMetaData < 0) { diff --git a/src/main/java/com/github/bartimaeusnek/bartworks/system/material/BW_MetaGeneratedOre_Item.java b/src/main/java/com/github/bartimaeusnek/bartworks/system/material/BW_MetaGeneratedOre_Item.java index 4ebf9a47b8..46a9894572 100644 --- a/src/main/java/com/github/bartimaeusnek/bartworks/system/material/BW_MetaGeneratedOre_Item.java +++ b/src/main/java/com/github/bartimaeusnek/bartworks/system/material/BW_MetaGeneratedOre_Item.java @@ -44,7 +44,7 @@ public class BW_MetaGeneratedOre_Item extends BW_ItemBlocks { } public String getItemStackDisplayName(ItemStack aStack) { - return GT_LanguageManager.getTranslation("bw.blockores.01."+aStack.getItemDamage()+".name"); + return GT_LanguageManager.getTranslation("bw.blockores.01." + aStack.getItemDamage() + ".name"); } public boolean placeBlockAt(ItemStack aStack, EntityPlayer aPlayer, World aWorld, int aX, int aY, int aZ, int side, float hitX, float hitY, float hitZ, int aMeta) { diff --git a/src/main/java/com/github/bartimaeusnek/bartworks/system/material/BW_MetaGenerated_Items.java b/src/main/java/com/github/bartimaeusnek/bartworks/system/material/BW_MetaGenerated_Items.java index dfd192863f..cbdfd9f2d4 100644 --- a/src/main/java/com/github/bartimaeusnek/bartworks/system/material/BW_MetaGenerated_Items.java +++ b/src/main/java/com/github/bartimaeusnek/bartworks/system/material/BW_MetaGenerated_Items.java @@ -22,12 +22,9 @@ package com.github.bartimaeusnek.bartworks.system.material; -import com.github.bartimaeusnek.bartworks.MainMod; import com.github.bartimaeusnek.bartworks.util.ChatColorHelper; import cpw.mods.fml.relauncher.Side; import cpw.mods.fml.relauncher.SideOnly; -import gregtech.api.GregTech_API; -import gregtech.api.enums.ItemList; import gregtech.api.enums.Materials; import gregtech.api.enums.OrePrefixes; import gregtech.api.interfaces.IIconContainer; @@ -51,29 +48,35 @@ import static com.github.bartimaeusnek.bartworks.system.material.Werkstoff.werks public class BW_MetaGenerated_Items extends GT_MetaGenerated_Item { - private final short aNumToGen= (short) werkstoffHashMap.size(); + public static final CreativeTabs metaTab = new CreativeTabs("bartworksMetaMaterials") { + @Override + public Item getTabIconItem() { + return new ItemStack(Blocks.iron_ore).getItem(); + } + }; protected final OrePrefixes orePrefixes; + private final short aNumToGen = (short) werkstoffHashMap.size(); public BW_MetaGenerated_Items(OrePrefixes orePrefixes) { - super("bwMetaGenerated"+orePrefixes.name(), (short) 32766, (short) 0); + super("bwMetaGenerated" + orePrefixes.name(), (short) 32766, (short) 0); this.orePrefixes = orePrefixes; this.setCreativeTab(metaTab); for (int i = 0; i < aNumToGen; i++) { ItemStack tStack = new ItemStack(this, 1, i); - Werkstoff w = werkstoffHashMap.get((short)i); - if (w == null || ((w.getFeatures().toGenerate & orePrefixes.mMaterialGenerationBits) == 0) ) + Werkstoff w = werkstoffHashMap.get((short) i); + if (w == null || ((w.getGenerationFeatures().toGenerate & orePrefixes.mMaterialGenerationBits) == 0)) continue; GT_LanguageManager.addStringLocalization(this.getUnlocalizedName(tStack) + ".name", this.getDefaultLocalization(w)); GT_LanguageManager.addStringLocalization(this.getUnlocalizedName(tStack) + ".tooltip", w.getToolTip()); - GT_OreDictUnificator.registerOre(this.orePrefixes.name()+w.getDefaultName(),tStack); + GT_OreDictUnificator.registerOre(this.orePrefixes.name() + w.getDefaultName(), tStack); } } public boolean onEntityItemUpdate(EntityItem aItemEntity) { int aDamage = aItemEntity.getEntityItem().getItemDamage(); - if ( (aDamage >= 0) && (!aItemEntity.worldObj.isRemote) ) { - Werkstoff aMaterial = werkstoffHashMap.get((short)aDamage); + if ((aDamage >= 0) && (!aItemEntity.worldObj.isRemote)) { + Werkstoff aMaterial = werkstoffHashMap.get((short) aDamage); if ((aMaterial != null) && (aMaterial != Werkstoff.default_null_Werkstoff)) { int tX = MathHelper.floor_double(aItemEntity.posX); int tY = MathHelper.floor_double(aItemEntity.posY); @@ -108,11 +111,11 @@ public class BW_MetaGenerated_Items extends GT_MetaGenerated_Item { if (orePrefixes == OrePrefixes.dustImpure || orePrefixes == OrePrefixes.dustPure) { aList.add(GT_LanguageManager.getTranslation("metaitem.01.tooltip.purify")); } - aList.add(StatCollector.translateToLocal("tooltip.bw.0.name")+ ChatColorHelper.DARKGREEN + " BartWorks"); + aList.add(StatCollector.translateToLocal("tooltip.bw.0.name") + ChatColorHelper.DARKGREEN + " BartWorks"); } - public String getDefaultLocalization(Werkstoff werkstoff){ - return werkstoff != null ? orePrefixes.mLocalizedMaterialPre+ werkstoff.getDefaultName()+orePrefixes.mLocalizedMaterialPost : Werkstoff.default_null_Werkstoff.getDefaultName(); + public String getDefaultLocalization(Werkstoff werkstoff) { + return werkstoff != null ? orePrefixes.mLocalizedMaterialPre + werkstoff.getDefaultName() + orePrefixes.mLocalizedMaterialPost : Werkstoff.default_null_Werkstoff.getDefaultName(); } @Override @@ -122,17 +125,17 @@ public class BW_MetaGenerated_Items extends GT_MetaGenerated_Item { @Override public final IIconContainer getIconContainer(int aMetaData) { - return werkstoffHashMap.get((short)aMetaData) == null ? null : werkstoffHashMap.get((short)aMetaData).getTexSet().mTextures[orePrefixes.mTextureIndex]; + return werkstoffHashMap.get((short) aMetaData) == null ? null : werkstoffHashMap.get((short) aMetaData).getTexSet().mTextures[orePrefixes.mTextureIndex]; } @Override @SideOnly(Side.CLIENT) public final void getSubItems(Item var1, CreativeTabs aCreativeTab, List aList) { for (int i = 0; i < aNumToGen; i++) { - Werkstoff werkstoff = werkstoffHashMap.get((short)i); - if (werkstoff != null && ((werkstoff.getFeatures().toGenerate & orePrefixes.mMaterialGenerationBits) != 0)) { - ItemStack tStack = new ItemStack(this, 1, i); - aList.add(tStack); + Werkstoff werkstoff = werkstoffHashMap.get((short) i); + if (werkstoff != null && ((werkstoff.getGenerationFeatures().toGenerate & orePrefixes.mMaterialGenerationBits) != 0)) { + ItemStack tStack = new ItemStack(this, 1, i); + aList.add(tStack); } } super.getSubItems(var1, aCreativeTab, aList); @@ -140,7 +143,7 @@ public class BW_MetaGenerated_Items extends GT_MetaGenerated_Item { @Override public short[] getRGBa(ItemStack aStack) { - Werkstoff werkstoff = werkstoffHashMap.get((short)getDamage(aStack)); + Werkstoff werkstoff = werkstoffHashMap.get((short) getDamage(aStack)); return werkstoff == null ? Materials._NULL.mRGBa : werkstoff.getRGBA(); } @@ -148,7 +151,7 @@ public class BW_MetaGenerated_Items extends GT_MetaGenerated_Item { public final IIcon getIconFromDamage(int aMetaData) { if (aMetaData < 0) return null; - Werkstoff tMaterial = werkstoffHashMap.get((short)aMetaData); + Werkstoff tMaterial = werkstoffHashMap.get((short) aMetaData); if (tMaterial == null) return null; IIconContainer tIcon = getIconContainer(aMetaData); @@ -161,12 +164,4 @@ public class BW_MetaGenerated_Items extends GT_MetaGenerated_Item { public int getItemStackLimit(ItemStack aStack) { return 64; } - - public static final CreativeTabs metaTab = new CreativeTabs("bartworksMetaMaterials") { - - @Override - public Item getTabIconItem() { - return new ItemStack(Blocks.iron_ore).getItem(); - } - }; } diff --git a/src/main/java/com/github/bartimaeusnek/bartworks/system/material/BW_MetaGenerated_Ores.java b/src/main/java/com/github/bartimaeusnek/bartworks/system/material/BW_MetaGenerated_Ores.java index 599b93dbf9..088f4040fc 100644 --- a/src/main/java/com/github/bartimaeusnek/bartworks/system/material/BW_MetaGenerated_Ores.java +++ b/src/main/java/com/github/bartimaeusnek/bartworks/system/material/BW_MetaGenerated_Ores.java @@ -24,13 +24,10 @@ package com.github.bartimaeusnek.bartworks.system.material; import com.github.bartimaeusnek.bartworks.client.renderer.BW_Renderer_Block_Ores; import com.github.bartimaeusnek.bartworks.common.blocks.BW_TileEntityContainer; -import gregtech.api.GregTech_API; import gregtech.api.enums.OrePrefixes; import gregtech.api.util.GT_LanguageManager; import gregtech.api.util.GT_ModHandler; import gregtech.api.util.GT_OreDictUnificator; -import gregtech.common.blocks.GT_Block_Ores_Abstract; -import gregtech.common.blocks.GT_TileEntity_Ores; import net.minecraft.block.Block; import net.minecraft.block.material.Material; import net.minecraft.creativetab.CreativeTabs; @@ -50,6 +47,8 @@ import static com.github.bartimaeusnek.bartworks.system.material.BW_MetaGenerate public class BW_MetaGenerated_Ores extends BW_TileEntityContainer { + public static ThreadLocal<BW_MetaGeneratedOreTE> mTemporaryTileEntity = new ThreadLocal(); + public BW_MetaGenerated_Ores(Material p_i45386_1_, Class<? extends TileEntity> tileEntity, String blockName) { super(p_i45386_1_, tileEntity, blockName); @@ -57,17 +56,42 @@ public class BW_MetaGenerated_Ores extends BW_TileEntityContainer { this.setResistance(5.0F); this.setBlockTextureName("stone"); this.setCreativeTab(metaTab); - for (Werkstoff w: Werkstoff.werkstoffHashSet) { + for (Werkstoff w : Werkstoff.werkstoffHashSet) { if (w != null) { - if ((w.getFeatures().toGenerate & 0b1000) == 0) + if ((w.getGenerationFeatures().toGenerate & 0b1000) == 0) continue; GT_ModHandler.addValuableOre(this, w.getmID(), 1); - GT_LanguageManager.addStringLocalization(getUnlocalizedName() + "." + w.getmID() +".name", w.getDefaultName() + OrePrefixes.ore.mLocalizedMaterialPost); + GT_LanguageManager.addStringLocalization(getUnlocalizedName() + "." + w.getmID() + ".name", w.getDefaultName() + OrePrefixes.ore.mLocalizedMaterialPost); GT_OreDictUnificator.registerOre(OrePrefixes.ore + w.getDefaultName(), new ItemStack(this, 1, w.getmID())); } } } + public static boolean setOreBlock(World aWorld, int aX, int aY, int aZ, int aMetaData, boolean air) { + if (!air) { + aY = Math.min(aWorld.getActualHeight(), Math.max(aY, 1)); + } + + Block tBlock = aWorld.getBlock(aX, aY, aZ); + Block tOreBlock = WerkstoffLoader.BWOres; + if (aMetaData < 0 || tBlock == Blocks.air && !air) { + return false; + } else { + + if (!tBlock.isReplaceableOreGen(aWorld, aX, aY, aZ, Blocks.stone)) { + return false; + } + + aWorld.setBlock(aX, aY, aZ, tOreBlock, aMetaData, 0); + TileEntity tTileEntity = aWorld.getTileEntity(aX, aY, aZ); + if (tTileEntity instanceof BW_MetaGeneratedOreTE) { + ((BW_MetaGeneratedOreTE) tTileEntity).mMetaData = (short) aMetaData; + } + + return true; + } + } + public String getLocalizedName() { return StatCollector.translateToLocal(getUnlocalizedName() + ".name"); } @@ -105,7 +129,6 @@ public class BW_MetaGenerated_Ores extends BW_TileEntityContainer { } return 0; } - public static ThreadLocal<BW_MetaGeneratedOreTE> mTemporaryTileEntity = new ThreadLocal(); public void breakBlock(World aWorld, int aX, int aY, int aZ, Block par5, int par6) { TileEntity tTileEntity = aWorld.getTileEntity(aX, aY, aZ); @@ -124,7 +147,7 @@ public class BW_MetaGenerated_Ores extends BW_TileEntityContainer { return mTemporaryTileEntity.get() == null ? new ArrayList() : ((BW_MetaGeneratedOreTE) mTemporaryTileEntity.get()).getDrops(WerkstoffLoader.BWOres); } - public int getHarvestLevel(int metadata){ + public int getHarvestLevel(int metadata) { return 3; } @@ -136,8 +159,8 @@ public class BW_MetaGenerated_Ores extends BW_TileEntityContainer { @Override public void getSubBlocks(Item aItem, CreativeTabs aTab, List aList) { for (int i = 0; i < Werkstoff.werkstoffHashSet.size(); i++) { - Werkstoff tMaterial = Werkstoff.werkstoffHashMap.get((short)i); - if ((tMaterial != null) && ((tMaterial.getFeatures().toGenerate & 0x8) != 0) ) { + Werkstoff tMaterial = Werkstoff.werkstoffHashMap.get((short) i); + if ((tMaterial != null) && ((tMaterial.getGenerationFeatures().toGenerate & 0x8) != 0)) { aList.add(new ItemStack(aItem, 1, i)); } } @@ -145,36 +168,11 @@ public class BW_MetaGenerated_Ores extends BW_TileEntityContainer { @Override public void onNeighborBlockChange(World aWorld, int aX, int aY, int aZ, Block p_149695_5_) { - aWorld.getTileEntity(aX, aY, aZ).getDescriptionPacket(); + aWorld.getTileEntity(aX, aY, aZ).getDescriptionPacket(); } @Override public void onNeighborChange(IBlockAccess aWorld, int aX, int aY, int aZ, int tileX, int tileY, int tileZ) { aWorld.getTileEntity(aX, aY, aZ).getDescriptionPacket(); } - - public static boolean setOreBlock(World aWorld, int aX, int aY, int aZ, int aMetaData, boolean air) { - if (!air) { - aY = Math.min(aWorld.getActualHeight(), Math.max(aY, 1)); - } - - Block tBlock = aWorld.getBlock(aX, aY, aZ); - Block tOreBlock = WerkstoffLoader.BWOres; - if (aMetaData < 0 || tBlock == Blocks.air && !air) { - return false; - } else { - - if (!tBlock.isReplaceableOreGen(aWorld, aX, aY, aZ, Blocks.stone)) { - return false; - } - - aWorld.setBlock(aX, aY, aZ, tOreBlock, aMetaData, 0); - TileEntity tTileEntity = aWorld.getTileEntity(aX, aY, aZ); - if (tTileEntity instanceof BW_MetaGeneratedOreTE) { - ((BW_MetaGeneratedOreTE)tTileEntity).mMetaData = (short)aMetaData; - } - - return true; - } - } } diff --git a/src/main/java/com/github/bartimaeusnek/bartworks/system/material/Werkstoff.java b/src/main/java/com/github/bartimaeusnek/bartworks/system/material/Werkstoff.java index 7522c40205..65ab699c57 100644 --- a/src/main/java/com/github/bartimaeusnek/bartworks/system/material/Werkstoff.java +++ b/src/main/java/com/github/bartimaeusnek/bartworks/system/material/Werkstoff.java @@ -40,15 +40,103 @@ import java.util.*; public class Werkstoff implements IColorModulationContainer, ISubTagContainer { public static final LinkedHashSet<Werkstoff> werkstoffHashSet = new LinkedHashSet<>(); - private static final HashSet<Short> idHashSet = new HashSet<>(); - public static final LinkedHashMap<Short, Werkstoff> werkstoffHashMap = new LinkedHashMap<>(); + private static final HashSet<Short> idHashSet = new HashSet<>(); - public static final Werkstoff.Stats default_null_stats = new Werkstoff.Stats(); - public static final Werkstoff.Features default_null_features = new Werkstoff.Features(); - public static final Werkstoff default_null_Werkstoff = new Werkstoff(new short[3], "_NULL", "Default null Werkstoff", default_null_stats, Werkstoff.Types.UNDEFINED, default_null_features, -1, TextureSet.SET_NONE); + public static final Werkstoff.Stats DEFAULT_NULL_STATS = new Werkstoff.Stats(); + public static final GenerationFeatures DEFAULT_NULL_GENERATION_FEATURES = new GenerationFeatures(); + public static Werkstoff default_null_Werkstoff; private final List<ISubTagContainer> mOreByProducts = new ArrayList<ISubTagContainer>(); + private final LinkedHashSet<Pair<ISubTagContainer, Integer>> contents = new LinkedHashSet<>(); + HashSet<SubTag> subtags = new HashSet<>(); + private byte[] rgb = new byte[3]; + private String defaultName; + private String toolTip; + private Fluid fluid; + private Fluid gas; + private Werkstoff.Stats stats; + private Werkstoff.Types type; + private GenerationFeatures generationFeatures; + private short mID; + private TextureSet texSet; + + public static void init(){ + default_null_Werkstoff = new Werkstoff(new short[3], "_NULL", "Default null Werkstoff", DEFAULT_NULL_STATS, Werkstoff.Types.UNDEFINED, DEFAULT_NULL_GENERATION_FEATURES, -1, TextureSet.SET_NONE); + } + + + public Werkstoff(short[] rgba, String defaultName, Werkstoff.Types type, GenerationFeatures generationFeatures, int mID, TextureSet texSet, List<ISubTagContainer> oreByProduct, Pair<ISubTagContainer, Integer>... contents) { + this(rgba, defaultName, Types.getDefaultStatForType(type), type, generationFeatures, mID, texSet, oreByProduct, contents); + } + public Werkstoff(short[] rgba, String toolTip, String defaultName, Werkstoff.Types type, GenerationFeatures generationFeatures, int mID, TextureSet texSet, List<ISubTagContainer> oreByProduct, Pair<ISubTagContainer, Integer>... contents) { + this(rgba, toolTip, defaultName, Types.getDefaultStatForType(type), type, generationFeatures, mID, texSet, oreByProduct, contents); + } + + public Werkstoff(short[] rgba, String defaultName, Werkstoff.Stats stats, Werkstoff.Types type, GenerationFeatures generationFeatures, int mID, TextureSet texSet, List<ISubTagContainer> oreByProduct, Pair<ISubTagContainer, Integer>... contents) { + this(rgba, defaultName, "", stats, type, generationFeatures, mID, texSet, contents); + this.mOreByProducts.addAll(oreByProduct); + } + + public Werkstoff(short[] rgba, String defaultName, Werkstoff.Stats stats, Werkstoff.Types type, GenerationFeatures generationFeatures, int mID, TextureSet texSet, Pair<ISubTagContainer, Integer>... contents) { + this(rgba, defaultName, "", stats, type, generationFeatures, mID, texSet, contents); + } + + public Werkstoff(short[] rgba, String defaultName, String toolTip, Werkstoff.Stats stats, Werkstoff.Types type, GenerationFeatures generationFeatures, int mID, TextureSet texSet, List<ISubTagContainer> oreByProduct, Pair<ISubTagContainer, Integer>... contents) { + this(rgba, defaultName, toolTip, stats, type, generationFeatures, mID, texSet, contents); + this.mOreByProducts.addAll(oreByProduct); + } + + public Werkstoff(short[] rgba, String defaultName, String toolTip, Werkstoff.Stats stats, Werkstoff.Types type, GenerationFeatures generationFeatures, int mID, TextureSet texSet, Pair<ISubTagContainer, Integer>... contents) { + + if (idHashSet.contains((short) mID)) + throw new UnsupportedOperationException("ID (" + mID + ") is already in use!"); + idHashSet.add((short) mID); + if (type == null) + type = Werkstoff.Types.UNDEFINED; + + this.defaultName = defaultName; + + this.type = type; + this.mID = (short) mID; + this.generationFeatures = generationFeatures; + this.setRgb(rgba); + this.contents.addAll(Arrays.asList(contents)); + this.toolTip = ""; + if (toolTip.isEmpty()) { + for (Pair<ISubTagContainer, Integer> p : contents) { + if (p.getKey() instanceof Materials) { + this.toolTip += ((Materials) p.getKey()).mChemicalFormula + (p.getValue() > 1 ? p.getValue() : ""); + } + if (p.getKey() instanceof Werkstoff) + this.toolTip += ((Werkstoff) p.getKey()).toolTip + (p.getValue() > 1 ? p.getValue() : ""); + } + } else + this.toolTip = toolTip; + long tmpprotons = 0; + for (Pair<ISubTagContainer, Integer> p : contents) { + if (p.getKey() instanceof Materials) { + tmpprotons += ((Materials) p.getKey()).getProtons() * p.getValue(); + } else if (p.getKey() instanceof Werkstoff) { + tmpprotons += ((Werkstoff) p.getKey()).getStats().protons * p.getValue(); + } + } + this.stats = stats.setProtons(tmpprotons); + + long tmpmass = 0; + for (Pair<ISubTagContainer, Integer> p : contents) { + if (p.getKey() instanceof Materials) { + tmpmass += ((Materials) p.getKey()).getMass() * p.getValue(); + } else if (p.getKey() instanceof Werkstoff) { + tmpprotons += ((Werkstoff) p.getKey()).getStats().mass * p.getValue(); + } + } + this.stats = stats.setMass(tmpmass); + + this.texSet = texSet; + werkstoffHashSet.add(this); + werkstoffHashMap.put(this.mID, this); + } public Pair<Integer, LinkedHashSet<Pair<ISubTagContainer, Integer>>> getContents() { int ret = 0; @@ -67,11 +155,7 @@ public class Werkstoff implements IColorModulationContainer, ISubTagContainer { return new Pair<>(ret, this.contents); } - private final LinkedHashSet<Pair<ISubTagContainer, Integer>> contents = new LinkedHashSet<>(); - private byte[] rgb = new byte[3]; - private String defaultName; - - public int getNoOfByProducts(){ + public int getNoOfByProducts() { return mOreByProducts.size(); } @@ -100,13 +184,6 @@ public class Werkstoff implements IColorModulationContainer, ISubTagContainer { return this.toolTip; } - private String toolTip; - private Fluid fluid; - private Fluid gas; - private Werkstoff.Stats stats; - private Werkstoff.Types type; - private Werkstoff.Features features; - public Werkstoff.Stats getStats() { return this.stats; } @@ -115,96 +192,26 @@ public class Werkstoff implements IColorModulationContainer, ISubTagContainer { return this.mID; } - private short mID; - - public Werkstoff.Features getFeatures() { - return this.features; + public GenerationFeatures getGenerationFeatures() { + return this.generationFeatures; } public TextureSet getTexSet() { return this.texSet; } - private TextureSet texSet; - - public Werkstoff(short[] rgba, String defaultName, Werkstoff.Types type, Werkstoff.Features features, int mID, TextureSet texSet, List<ISubTagContainer> oreByProduct, Pair<ISubTagContainer,Integer>... contents) { - this(rgba,defaultName,Types.getDefaultStatForType(type),type,features,mID,texSet,oreByProduct,contents); - } - - public Werkstoff(short[] rgba, String defaultName, Werkstoff.Stats stats, Werkstoff.Types type, Werkstoff.Features features, int mID, TextureSet texSet, List<ISubTagContainer> oreByProduct, Pair<ISubTagContainer,Integer>... contents) { - this(rgba,defaultName,"",stats,type,features,mID,texSet,contents); - this.mOreByProducts.addAll(oreByProduct); - } - - public Werkstoff(short[] rgba, String defaultName, Werkstoff.Stats stats, Werkstoff.Types type, Werkstoff.Features features, int mID, TextureSet texSet, Pair<ISubTagContainer,Integer>... contents) { - this(rgba,defaultName,"",stats,type,features,mID,texSet,contents); - } - public Werkstoff(short[] rgba, String defaultName, String toolTip, Werkstoff.Stats stats, Werkstoff.Types type, Werkstoff.Features features, int mID, TextureSet texSet, List<ISubTagContainer> oreByProduct, Pair<ISubTagContainer,Integer>... contents) { - this(rgba, defaultName, toolTip, stats, type, features, mID, texSet, contents); - this.mOreByProducts.addAll(oreByProduct); - } - - public Werkstoff(short[] rgba, String defaultName, String toolTip, Werkstoff.Stats stats, Werkstoff.Types type, Werkstoff.Features features, int mID, TextureSet texSet, Pair<ISubTagContainer,Integer>... contents) { - - if (idHashSet.contains((short) mID)) - throw new UnsupportedOperationException("ID ("+mID+") is already in use!"); - - if (type == null) - type = Werkstoff.Types.UNDEFINED; - - this.defaultName=defaultName; - - this.type = type; - this.mID = (short) mID; - this.features=features; - this.setRgb(rgba); - this.contents.addAll(Arrays.asList(contents)); - this.toolTip=""; - if (toolTip.isEmpty()) { - for (Pair<ISubTagContainer,Integer> p : contents) { - if (p.getKey() instanceof Materials) { - this.toolTip += ((Materials) p.getKey()).mChemicalFormula + (p.getValue() > 1 ? p.getValue() : ""); - } - if (p.getKey() instanceof Werkstoff) - this.toolTip += ((Werkstoff) p.getKey()).toolTip + (p.getValue() > 1 ? p.getValue() : ""); - } - } else - this.toolTip = toolTip; - long tmpprotons=0; - for (Pair<ISubTagContainer,Integer> p : contents) { - if (p.getKey() instanceof Materials) { - tmpprotons += ((Materials) p.getKey()).getProtons()* p.getValue(); - } - } - this.stats = stats.setProtons(tmpprotons); - - long tmpmass=0; - for (Pair<ISubTagContainer,Integer> p : contents) { - if (p.getKey() instanceof Materials) { - tmpmass += ((Materials) p.getKey()).getMass()* p.getValue(); - } - } - this.stats = stats.setMass(tmpmass); - - this.texSet=texSet; - werkstoffHashSet.add(this); - werkstoffHashMap.put(this.mID,this); - } - public void setRgb(short[] rgb) { - this.rgb = new byte[]{(byte) (rgb[0]-128), (byte) (rgb[1]-128), (byte) (rgb[2]-128)}; + this.rgb = new byte[]{(byte) (rgb[0] - 128), (byte) (rgb[1] - 128), (byte) (rgb[2] - 128)}; } @Override public short[] getRGBA() { - return new short[] {(short) (rgb[0]+128), (short) (rgb[1]+128), (short) (rgb[2]+128),0}; + return new short[]{(short) (rgb[0] + 128), (short) (rgb[1] + 128), (short) (rgb[2] + 128), 0}; } - HashSet<SubTag> subtags = new HashSet<>(); - @Override public boolean contains(SubTag subTag) { - for (Pair<ISubTagContainer,Integer> p: contents) + for (Pair<ISubTagContainer, Integer> p : contents) if (p.getKey().contains(subTag)) return true; if (subtags.contains(subTag)) @@ -223,15 +230,31 @@ public class Werkstoff implements IColorModulationContainer, ISubTagContainer { return subtags.remove(subTag); } - public ItemStack get(OrePrefixes prefixes){ - return WerkstoffLoader.getCorresopndingItemStack(prefixes,this); + public ItemStack get(OrePrefixes prefixes) { + return WerkstoffLoader.getCorresopndingItemStack(prefixes, this); + } + + public ItemStack get(OrePrefixes prefixes, int amount) { + return WerkstoffLoader.getCorresopndingItemStack(prefixes, this, amount); } - public ItemStack get(OrePrefixes prefixes, int amount){ - return WerkstoffLoader.getCorresopndingItemStack(prefixes,this, amount); + public enum Types { + MATERIAL, COMPOUND, MIXTURE, BIOLOGICAL, UNDEFINED; + + public static Stats getDefaultStatForType(Types T) { + switch (T) { + case COMPOUND: + case BIOLOGICAL: + return new Stats().setElektrolysis(true); + case MIXTURE: + return new Stats().setCentrifuge(true); + default: + return new Stats(); + } + } } - public static class Features { + public static class GenerationFeatures { //logic gate shit /* dust 1 @@ -241,16 +264,16 @@ public class Werkstoff implements IColorModulationContainer, ISubTagContainer { */ public byte toGenerate = 0b0001001; - public boolean hasGems(){ + public boolean hasGems() { return (toGenerate & 4) != 0; } - public Features onlyDust(){ + public GenerationFeatures onlyDust() { toGenerate = (byte) (1); return this; } - public Features addGems(){ + public GenerationFeatures addGems() { toGenerate = (byte) (toGenerate | 0x4); return this; } @@ -258,9 +281,17 @@ public class Werkstoff implements IColorModulationContainer, ISubTagContainer { } - public static class Stats { + int boilingPoint; + int meltingPoint; + long protons; + long neutrons; + long electrons; + long mass; + //logic gate shit + byte quality = ~0b111111; + @Override public boolean equals(Object o) { if (this == o) return true; @@ -279,112 +310,90 @@ public class Werkstoff implements IColorModulationContainer, ISubTagContainer { @Override public int hashCode() { - return MurmurHash3.murmurhash3_x86_32(ByteBuffer.allocate(49).put(quality).putInt(boilingPoint).putInt(meltingPoint).putLong(protons).putLong(neutrons).putLong(electrons).putLong(mass).array(),0,49,31); + return MurmurHash3.murmurhash3_x86_32(ByteBuffer.allocate(49).put(quality).putInt(boilingPoint).putInt(meltingPoint).putLong(protons).putLong(neutrons).putLong(electrons).putLong(mass).array(), 0, 49, 31); } - int boilingPoint; - int meltingPoint; - long protons; - long neutrons; - long electrons; - long mass; - - - public Stats setMass(long mass) { this.mass = protons; return this; } + public Stats setProtons(long protons) { this.protons = protons; return this; } - //logic gate shit - byte quality = ~0b111111; - public boolean isSublimation() { - return (quality&0b1) == 0b1; - } - - public boolean isToxic() { - return (quality>>1&0b1) == 0b1; - } - - public boolean isRadioactive() { - return (quality>>2&0b1) == 0b1; - } - - public boolean isBlastFurnace() { - return (quality>>3&0b1) == 0b1; - } - - public boolean isElektrolysis() { - return (quality>>4&0b1) == 0b1; - } - - public boolean isCentrifuge() { - return (quality>>5&0b1) == 0b1; + return (quality & 0b1) == 0b1; } public Werkstoff.Stats setSublimation(boolean sublimation) { - if(sublimation) - quality= (byte) (quality|0b000001); - else - quality= (byte) (quality&0b111110); + if (sublimation) + quality = (byte) (quality | 0b000001); + else + quality = (byte) (quality & 0b111110); return this; } + public boolean isToxic() { + return (quality >> 1 & 0b1) == 0b1; + } + public Werkstoff.Stats setToxic(boolean toxic) { - if(toxic) - quality= (byte) (quality|0b000010); + if (toxic) + quality = (byte) (quality | 0b000010); else - quality= (byte) (quality&0b111101); + quality = (byte) (quality & 0b111101); return this; } + public boolean isRadioactive() { + return (quality >> 2 & 0b1) == 0b1; + } + public Werkstoff.Stats setRadioactive(boolean radioactive) { - if(radioactive) - quality= (byte) (quality|0b000100); + if (radioactive) + quality = (byte) (quality | 0b000100); else - quality= (byte) (quality&0b111011); + quality = (byte) (quality & 0b111011); return this; } + public boolean isBlastFurnace() { + return (quality >> 3 & 0b1) == 0b1; + } + public Werkstoff.Stats setBlastFurnace(boolean blastFurnace) { - if(blastFurnace) - quality= (byte) (quality|0b001000); + if (blastFurnace) + quality = (byte) (quality | 0b001000); else - quality= (byte) (quality&0b110111); + quality = (byte) (quality & 0b110111); return this; } + public boolean isElektrolysis() { + return (quality >> 4 & 0b1) == 0b1; + } + public Werkstoff.Stats setElektrolysis(boolean elektrolysis) { - if(elektrolysis) - quality= (byte) (quality|0b010000); + if (elektrolysis) + quality = (byte) (quality | 0b010000); else - quality= (byte) (quality&0b101111); + quality = (byte) (quality & 0b101111); return this; } + public boolean isCentrifuge() { + return (quality >> 5 & 0b1) == 0b1; + } + public Werkstoff.Stats setCentrifuge(boolean centrifuge) { - if(centrifuge) - quality= (byte) (quality|0b100000); + if (centrifuge) + quality = (byte) (quality | 0b100000); else - quality=(byte) (quality&0b011111); + quality = (byte) (quality & 0b011111); return this; } } - public enum Types { - MATERIAL, COMPOUND, MIXTURE, BIOLOGICAL, UNDEFINED; - public static Stats getDefaultStatForType(Types T){ - switch (T){ - case COMPOUND: case BIOLOGICAL: return new Stats().setElektrolysis(true); - case MIXTURE: return new Stats().setCentrifuge(true); - default:return new Stats(); - } - } - } - } diff --git a/src/main/java/com/github/bartimaeusnek/bartworks/system/material/WerkstoffLoader.java b/src/main/java/com/github/bartimaeusnek/bartworks/system/material/WerkstoffLoader.java index 89f69948fa..948051eff8 100644 --- a/src/main/java/com/github/bartimaeusnek/bartworks/system/material/WerkstoffLoader.java +++ b/src/main/java/com/github/bartimaeusnek/bartworks/system/material/WerkstoffLoader.java @@ -36,10 +36,8 @@ import gregtech.api.interfaces.ISubTagContainer; import gregtech.api.util.GT_ModHandler; import gregtech.api.util.GT_OreDictUnificator; import gregtech.api.util.GT_Recipe; -import gregtech.api.util.GT_Utility; import net.minecraft.block.Block; import net.minecraft.block.material.Material; -import net.minecraft.creativetab.CreativeTabs; import net.minecraft.item.ItemStack; import net.minecraftforge.fluids.FluidStack; @@ -52,23 +50,15 @@ import static gregtech.api.enums.OrePrefixes.*; public class WerkstoffLoader implements Runnable { - private WerkstoffLoader(){} + private WerkstoffLoader() {} - public static WerkstoffLoader INSTANCE = new WerkstoffLoader(); - - public boolean registered = false; - - public void init(){ - } - - public static HashMap<OrePrefixes, BW_MetaGenerated_Items> items = new HashMap<>(); - public static Block BWOres; + public static final WerkstoffLoader INSTANCE = new WerkstoffLoader(); public static final Werkstoff Bismutite = new Werkstoff( new short[]{255, 233, 0, 0}, "Bismutite", Werkstoff.Types.COMPOUND, - new Werkstoff.Features().addGems(), + new Werkstoff.GenerationFeatures().addGems(), 1, TextureSet.SET_FLINT, Arrays.asList(Materials.Bismuth), @@ -80,161 +70,102 @@ public class WerkstoffLoader implements Runnable { new short[]{192, 192, 192, 0}, "Bismuthinite", Werkstoff.Types.COMPOUND, - new Werkstoff.Features(), + new Werkstoff.GenerationFeatures(), 2, TextureSet.SET_METALLIC, Arrays.asList(Materials.Bismuth, Materials.Sulfur), new Pair<ISubTagContainer, Integer>(Materials.Bismuth, 2), new Pair<ISubTagContainer, Integer>(Materials.Sulfur, 3) ); - - public static final Werkstoff CyclosilicateSi6O18 = new Werkstoff( - new short[]{255,255,255,0}, - "CycloHexaSilicate", - "(Si6O18)", - Werkstoff.Types.getDefaultStatForType(Werkstoff.Types.COMPOUND), - Werkstoff.Types.COMPOUND, - new Werkstoff.Features().onlyDust(), - 3, - TextureSet.SET_DULL, - new Pair<ISubTagContainer, Integer>(Materials.Silicon, 6), - new Pair<ISubTagContainer, Integer>(Materials.Oxygen, 18) - ); - - public static final Werkstoff Borat = new Werkstoff( - new short[]{255,255,255,0}, - "Borate", - "(BO3)", - Werkstoff.Types.getDefaultStatForType(Werkstoff.Types.COMPOUND), - Werkstoff.Types.COMPOUND, - new Werkstoff.Features().onlyDust(), - 4, - TextureSet.SET_DULL, - new Pair<ISubTagContainer, Integer>(Materials.Boron, 1), - new Pair<ISubTagContainer, Integer>(Materials.Oxygen, 3) - ); - - //Na Fe3+3 Al6 (Si6O18) (BO3)3 O3 F public static final Werkstoff FluorBuergerit = new Werkstoff( - new short[]{0x20,0x20,0x20,0}, + new short[]{0x20, 0x20, 0x20, 0}, "Fluor-Buergerit", + "NaFe3Al6(Si6O18)(BO3)3O3F", Werkstoff.Types.COMPOUND, - new Werkstoff.Features().addGems(), + new Werkstoff.GenerationFeatures().addGems(), 5, TextureSet.SET_RUBY, - Arrays.asList(Materials.Sodium,Materials.Boron,Materials.Silicon), + Arrays.asList(Materials.Sodium, Materials.Boron, Materials.Silicon), new Pair<ISubTagContainer, Integer>(Materials.Sodium, 1), new Pair<ISubTagContainer, Integer>(Materials.Iron, 3), new Pair<ISubTagContainer, Integer>(Materials.Aluminium, 6), - new Pair<ISubTagContainer, Integer>(CyclosilicateSi6O18, 1), - new Pair<ISubTagContainer, Integer>(Borat, 3), - new Pair<ISubTagContainer, Integer>(Materials.Oxygen, 1), + new Pair<ISubTagContainer, Integer>(Materials.Silicon, 6), + new Pair<ISubTagContainer, Integer>(Materials.Boron, 3), + new Pair<ISubTagContainer, Integer>(Materials.Oxygen, 30), new Pair<ISubTagContainer, Integer>(Materials.Fluorine, 1) ); - - public static final Werkstoff AluminiumMagnesite = new Werkstoff( - new short[]{255,255,255,0}, - "AluminiumMagnesite", - "(Al4Mg2)", - Werkstoff.Types.getDefaultStatForType(Werkstoff.Types.COMPOUND), - Werkstoff.Types.COMPOUND, - new Werkstoff.Features().onlyDust(), - 6, - TextureSet.SET_DULL, - new Pair<ISubTagContainer, Integer>(Materials.Aluminium, 4), - new Pair<ISubTagContainer, Integer>(Materials.Magnesium, 2) - ); - -// public static final Werkstoff Hydroxide = new Werkstoff( -// new short[]{255,255,255,0}, -// "Hydroxide", -// "(OH)", -// new Werkstoff.Stats(), -// Werkstoff.Types.COMPOUND, -// new Werkstoff.Features().onlyDust(), -// 7, -// TextureSet.SET_DULL, -// new Pair<ISubTagContainer, Integer>(Materials.Aluminium, 4), -// new Pair<ISubTagContainer, Integer>(Materials.Magnesium, 2) -// ); - public static final Werkstoff ChromoAluminoPovondrait = new Werkstoff( - new short[]{0,0x79,0x6A,0}, + new short[]{0, 0x79, 0x6A, 0}, "Chromo-Alumino-Povondraite", "NaCr3(Al4Mg2)(Si6O18)(BO3)3(OH)3O", Werkstoff.Types.getDefaultStatForType(Werkstoff.Types.COMPOUND), Werkstoff.Types.COMPOUND, - new Werkstoff.Features().addGems(), + new Werkstoff.GenerationFeatures().addGems(), 7, TextureSet.SET_RUBY, - Arrays.asList(Materials.Sodium,Materials.Boron,Materials.Silicon), - //Na Cr3 (Al4Mg2) (Si6O18) (BO3)3 (OH)3 O + Arrays.asList(Materials.Sodium, Materials.Boron, Materials.Silicon), new Pair<ISubTagContainer, Integer>(Materials.Sodium, 1), new Pair<ISubTagContainer, Integer>(Materials.Chrome, 3), - new Pair<ISubTagContainer, Integer>(AluminiumMagnesite,1), - new Pair<ISubTagContainer, Integer>(CyclosilicateSi6O18, 1), - new Pair<ISubTagContainer, Integer>(Borat, 3), - new Pair<ISubTagContainer, Integer>(Materials.Oxygen, 4), + new Pair<ISubTagContainer, Integer>(Materials.Magnalium, 6), + new Pair<ISubTagContainer, Integer>(Materials.Silicon, 6), + new Pair<ISubTagContainer, Integer>(Materials.Boron, 3), + new Pair<ISubTagContainer, Integer>(Materials.Oxygen, 31), new Pair<ISubTagContainer, Integer>(Materials.Hydrogen, 3) ); - public static final Werkstoff VanadioOxyDravit = new Werkstoff( - new short[]{0x60,0xA0,0xA0,0}, + new short[]{0x60, 0xA0, 0xA0, 0}, "Vanadio-Oxy-Dravite", "NaV3(Al4Mg2)(Si6O18)(BO3)3(OH)3O", Werkstoff.Types.getDefaultStatForType(Werkstoff.Types.COMPOUND), Werkstoff.Types.COMPOUND, - new Werkstoff.Features().addGems(), + new Werkstoff.GenerationFeatures().addGems(), 8, TextureSet.SET_RUBY, - Arrays.asList(Materials.Sodium,Materials.Boron,Materials.Silicon), - //Na Cr3 (Al4Mg2) (Si6O18) (BO3)3 (OH)3 O + Arrays.asList(Materials.Sodium, Materials.Boron, Materials.Silicon), new Pair<ISubTagContainer, Integer>(Materials.Sodium, 1), new Pair<ISubTagContainer, Integer>(Materials.Vanadium, 3), - new Pair<ISubTagContainer, Integer>(AluminiumMagnesite,1), - new Pair<ISubTagContainer, Integer>(CyclosilicateSi6O18, 1), - new Pair<ISubTagContainer, Integer>(Borat, 3), - new Pair<ISubTagContainer, Integer>(Materials.Oxygen, 4), + new Pair<ISubTagContainer, Integer>(Materials.Magnalium, 6), + new Pair<ISubTagContainer, Integer>(Materials.Silicon, 6), + new Pair<ISubTagContainer, Integer>(Materials.Boron, 3), + new Pair<ISubTagContainer, Integer>(Materials.Oxygen, 31), new Pair<ISubTagContainer, Integer>(Materials.Hydrogen, 3) ); + //TODO: FREE ID RANGE: 3,4,6,19-32766 public static final Werkstoff Olenit = new Werkstoff( - new short[]{210,210,210,0}, + new short[]{210, 210, 210, 0}, "Olenite", "NaAl3Al6(Si6O18)(BO3)3O3OH", Werkstoff.Types.getDefaultStatForType(Werkstoff.Types.COMPOUND), Werkstoff.Types.COMPOUND, - new Werkstoff.Features().addGems(), + new Werkstoff.GenerationFeatures().addGems(), 9, TextureSet.SET_RUBY, - Arrays.asList(Materials.Sodium,Materials.Boron,Materials.Silicon), - //Na Cr3 (Al4Mg2) (Si6O18) (BO3)3 (OH)3 O + Arrays.asList(Materials.Sodium, Materials.Boron, Materials.Silicon), new Pair<ISubTagContainer, Integer>(Materials.Sodium, 1), new Pair<ISubTagContainer, Integer>(Materials.Aluminium, 9), new Pair<ISubTagContainer, Integer>(Materials.Silicon, 6), - new Pair<ISubTagContainer, Integer>(Borat, 3), - new Pair<ISubTagContainer, Integer>(Materials.Oxygen, 22), + new Pair<ISubTagContainer, Integer>(Materials.Boron, 3), + new Pair<ISubTagContainer, Integer>(Materials.Oxygen, 31), new Pair<ISubTagContainer, Integer>(Materials.Hydrogen, 1) ); - public static final Werkstoff Arsenopyrite = new Werkstoff( new short[]{0xB0, 0xB0, 0xB0, 0}, "Arsenopyrite", Werkstoff.Types.COMPOUND, - new Werkstoff.Features(), + new Werkstoff.GenerationFeatures(), 10, TextureSet.SET_METALLIC, - Arrays.asList(Materials.Sulfur, Materials.Arsenic,Materials.Iron), + Arrays.asList(Materials.Sulfur, Materials.Arsenic, Materials.Iron), new Pair<ISubTagContainer, Integer>(Materials.Iron, 1), new Pair<ISubTagContainer, Integer>(Materials.Arsenic, 1), new Pair<ISubTagContainer, Integer>(Materials.Sulfur, 1) ); - public static final Werkstoff Ferberite = new Werkstoff( new short[]{0xB0, 0xB0, 0xB0, 0}, "Ferberite", Werkstoff.Types.COMPOUND, - new Werkstoff.Features(), + new Werkstoff.GenerationFeatures(), 11, TextureSet.SET_METALLIC, Arrays.asList(Materials.Iron, Materials.Tungsten), @@ -242,24 +173,22 @@ public class WerkstoffLoader implements Runnable { new Pair<ISubTagContainer, Integer>(Materials.Tungsten, 1), new Pair<ISubTagContainer, Integer>(Materials.Oxygen, 3) ); - public static final Werkstoff Loellingit = new Werkstoff( new short[]{0xD0, 0xD0, 0xD0, 0}, "Loellingite", Werkstoff.Types.COMPOUND, - new Werkstoff.Features(), + new Werkstoff.GenerationFeatures(), 12, TextureSet.SET_METALLIC, Arrays.asList(Materials.Iron, Materials.Arsenic), new Pair<ISubTagContainer, Integer>(Materials.Iron, 1), new Pair<ISubTagContainer, Integer>(Materials.Arsenic, 2) ); - - public static final Werkstoff Roquesit= new Werkstoff( + public static final Werkstoff Roquesit = new Werkstoff( new short[]{0xA0, 0xA0, 0xA0, 0}, "Roquesite", Werkstoff.Types.COMPOUND, - new Werkstoff.Features(), + new Werkstoff.GenerationFeatures(), 13, TextureSet.SET_METALLIC, Arrays.asList(Materials.Copper, Materials.Sulfur), @@ -267,26 +196,26 @@ public class WerkstoffLoader implements Runnable { new Pair<ISubTagContainer, Integer>(Materials.Indium, 1), new Pair<ISubTagContainer, Integer>(Materials.Sulfur, 2) ); - public static final Werkstoff Bornite= new Werkstoff( + public static final Werkstoff Bornite = new Werkstoff( new short[]{0x97, 0x66, 0x2B, 0}, "Bornite", Werkstoff.Types.COMPOUND, - new Werkstoff.Features(), + new Werkstoff.GenerationFeatures(), 14, TextureSet.SET_METALLIC, - Arrays.asList(Materials.Copper,Materials.Iron, Materials.Sulfur), + Arrays.asList(Materials.Copper, Materials.Iron, Materials.Sulfur), new Pair<ISubTagContainer, Integer>(Materials.Copper, 5), new Pair<ISubTagContainer, Integer>(Materials.Iron, 1), new Pair<ISubTagContainer, Integer>(Materials.Sulfur, 4) ); - public static final Werkstoff Wittichenit= new Werkstoff( + public static final Werkstoff Wittichenit = new Werkstoff( Materials.Copper.mRGBa, "Wittichenite", Werkstoff.Types.COMPOUND, - new Werkstoff.Features(), + new Werkstoff.GenerationFeatures(), 15, TextureSet.SET_METALLIC, - Arrays.asList(Materials.Copper,Materials.Bismuth, Materials.Sulfur), + Arrays.asList(Materials.Copper, Materials.Bismuth, Materials.Sulfur), new Pair<ISubTagContainer, Integer>(Materials.Copper, 5), new Pair<ISubTagContainer, Integer>(Materials.Bismuth, 1), new Pair<ISubTagContainer, Integer>(Materials.Sulfur, 4) @@ -295,49 +224,63 @@ public class WerkstoffLoader implements Runnable { new short[]{0x60, 0x60, 0x60, 0}, "Djurleite", Werkstoff.Types.COMPOUND, - new Werkstoff.Features(), + new Werkstoff.GenerationFeatures(), 16, TextureSet.SET_METALLIC, - Arrays.asList(Materials.Copper,Materials.Copper, Materials.Sulfur), + Arrays.asList(Materials.Copper, Materials.Copper, Materials.Sulfur), new Pair<ISubTagContainer, Integer>(Materials.Copper, 31), new Pair<ISubTagContainer, Integer>(Materials.Sulfur, 16) ); - public static final Werkstoff Huebnerit = new Werkstoff( new short[]{0x80, 0x60, 0x60, 0}, "Huebnerite", Werkstoff.Types.COMPOUND, - new Werkstoff.Features(), + new Werkstoff.GenerationFeatures(), 17, TextureSet.SET_METALLIC, - Arrays.asList(Materials.Manganese,Materials.Tungsten), + Arrays.asList(Materials.Manganese, Materials.Tungsten), new Pair<ISubTagContainer, Integer>(Materials.Manganese, 1), new Pair<ISubTagContainer, Integer>(Materials.Tungsten, 1), new Pair<ISubTagContainer, Integer>(Materials.Oxygen, 3) ); - public static final Werkstoff Thorianit = new Werkstoff( new short[]{0x30, 0x30, 0x30, 0}, "Thorianit", Werkstoff.Types.COMPOUND, - new Werkstoff.Features(), + new Werkstoff.GenerationFeatures(), 18, TextureSet.SET_METALLIC, Arrays.asList(Materials.Thorium), new Pair<ISubTagContainer, Integer>(Materials.Thorium, 1), new Pair<ISubTagContainer, Integer>(Materials.Oxygen, 2) ); + public static HashMap<OrePrefixes, BW_MetaGenerated_Items> items = new HashMap<>(); + public static Block BWOres; + public boolean registered = false; + public static ItemStack getCorresopndingItemStack(OrePrefixes orePrefixes, Werkstoff werkstoff) { + return getCorresopndingItemStack(orePrefixes, werkstoff, 1); + } + public static ItemStack getCorresopndingItemStack(OrePrefixes orePrefixes, Werkstoff werkstoff, int amount) { + if (orePrefixes == ore) + return new ItemStack(BWOres, amount, werkstoff.getmID()); + return new ItemStack(items.get(orePrefixes), amount, werkstoff.getmID()).copy(); + } + public void init() { + if (INSTANCE == null) + MainMod.LOGGER.error("INSTANCE IS NULL THIS SHOULD NEVER HAPPEN!"); + } public void runInit() { WerkstoffAdderRegistry.getINSTANCE().run(); addSubTags(); addItemsForGeneration(); } + @Override - public void run(){ + public void run() { if (!registered) { MainMod.LOGGER.info("Loading Processing Recipes for BW Materials"); long timepre = System.nanoTime(); @@ -357,28 +300,27 @@ public class WerkstoffLoader implements Runnable { } ProgressManager.pop(progressBar); long timepost = System.nanoTime(); - MainMod.LOGGER.info("Loading Processing Recipes for BW Materials took "+(timepost-timepre)+"ns/"+((timepost-timepre)/1000000)+"ms/"+((timepost-timepre)/1000000000)+"s!"); - registered=true; + MainMod.LOGGER.info("Loading Processing Recipes for BW Materials took " + (timepost - timepre) + "ns/" + ((timepost - timepre) / 1000000) + "ms/" + ((timepost - timepre) / 1000000000) + "s!"); + registered = true; } } - private void addSubTags(){ - for (Werkstoff W : Werkstoff.werkstoffHashMap.values()){ - for (Pair<ISubTagContainer,Integer> pair : W.getContents().getValue().toArray(new Pair[0])){ - if (pair.getKey() instanceof Materials && ((Materials)pair.getKey()) == Materials.Neodymium){ + private void addSubTags() { + for (Werkstoff W : Werkstoff.werkstoffHashMap.values()) { + for (Pair<ISubTagContainer, Integer> pair : W.getContents().getValue().toArray(new Pair[0])) { + + if (pair.getKey() instanceof Materials && ((Materials) pair.getKey()) == Materials.Neodymium) { W.add(SubTag.ELECTROMAGNETIC_SEPERATION_NEODYMIUM); break; - } - else if (pair.getKey() instanceof Materials && ((Materials)pair.getKey()) == Materials.Iron){ + } else if (pair.getKey() instanceof Materials && ((Materials) pair.getKey()) == Materials.Iron) { W.add(SubTag.ELECTROMAGNETIC_SEPERATION_IRON); break; - } - else if (pair.getKey() instanceof Materials && ((Materials)pair.getKey()) == Materials.Gold){ + } else if (pair.getKey() instanceof Materials && ((Materials) pair.getKey()) == Materials.Gold) { W.add(SubTag.ELECTROMAGNETIC_SEPERATION_GOLD); break; } } - if (W.getFeatures().hasGems()){ + if (W.getGenerationFeatures().hasGems()) { W.add(SubTag.CRYSTAL); W.add(SubTag.CRYSTALLISABLE); } @@ -387,11 +329,11 @@ public class WerkstoffLoader implements Runnable { } - private void addItemsForGeneration(){ + private void addItemsForGeneration() { int toGenerateGlobal = 0b0000000; for (Werkstoff werkstoff : Werkstoff.werkstoffHashSet) - toGenerateGlobal = (toGenerateGlobal | werkstoff.getFeatures().toGenerate); + toGenerateGlobal = (toGenerateGlobal | werkstoff.getGenerationFeatures().toGenerate); if ((toGenerateGlobal & 0b1) != 0) { items.put(dust, new BW_MetaGenerated_Items(dust)); @@ -412,9 +354,9 @@ public class WerkstoffLoader implements Runnable { if ((toGenerateGlobal & 0b1000) != 0) { if (FMLCommonHandler.instance().getSide().isClient()) RenderingRegistry.registerBlockHandler(BW_Renderer_Block_Ores.INSTANCE); - GameRegistry.registerTileEntity(BW_MetaGeneratedOreTE.class,"bw.blockoresTE"); - BWOres = new BW_MetaGenerated_Ores(Material.rock,BW_MetaGeneratedOreTE.class,"bw.blockores"); - GameRegistry.registerBlock(BWOres,BW_MetaGeneratedOre_Item.class,"bw.blockores.01"); + GameRegistry.registerTileEntity(BW_MetaGeneratedOreTE.class, "bw.blockoresTE"); + BWOres = new BW_MetaGenerated_Ores(Material.rock, BW_MetaGeneratedOreTE.class, "bw.blockores"); + GameRegistry.registerBlock(BWOres, BW_MetaGeneratedOre_Item.class, "bw.blockores.01"); items.put(crushed, new BW_MetaGenerated_Items(crushed)); items.put(crushedPurified, new BW_MetaGenerated_Items(crushedPurified)); @@ -424,13 +366,8 @@ public class WerkstoffLoader implements Runnable { } } - private void addGemRecipes(Werkstoff werkstoff){ - if (werkstoff.getFeatures().hasGems()) { - GT_Values.RA.addForgeHammerRecipe(getCorresopndingItemStack(crushedCentrifuged, werkstoff), getCorresopndingItemStack(dust, werkstoff), 10, 16); - GT_ModHandler.addPulverisationRecipe(getCorresopndingItemStack(crushedCentrifuged, werkstoff), - getCorresopndingItemStack(dust, werkstoff), - werkstoff.getOreByProduct(-1, gem), - 10, true); + private void addGemRecipes(Werkstoff werkstoff) { + if (werkstoff.getGenerationFeatures().hasGems()) { GT_Values.RA.addSifterRecipe( getCorresopndingItemStack(crushedPurified, werkstoff), @@ -448,102 +385,111 @@ public class WerkstoffLoader implements Runnable { 800, 16 ); - GT_ModHandler.addPulverisationRecipe(werkstoff.get(gemExquisite),werkstoff.get(dust,4)); - GT_ModHandler.addPulverisationRecipe(werkstoff.get(gemFlawless),werkstoff.get(dust,2)); - GT_ModHandler.addPulverisationRecipe(werkstoff.get(gem),werkstoff.get(dust)); - GT_ModHandler.addPulverisationRecipe(werkstoff.get(gemFlawed),werkstoff.get(dustSmall,1)); - GT_ModHandler.addPulverisationRecipe(werkstoff.get(gemChipped),werkstoff.get(dustTiny)); - - GT_Values.RA.addForgeHammerRecipe(werkstoff.get(gemExquisite),werkstoff.get(gemFlawless,2),64, 16); - GT_Values.RA.addForgeHammerRecipe(werkstoff.get(gemFlawless),werkstoff.get(gem,2),64, 16); - GT_Values.RA.addForgeHammerRecipe(werkstoff.get(gem),werkstoff.get(gemFlawed,2),64, 16); - GT_Values.RA.addForgeHammerRecipe(werkstoff.get(gemFlawed),werkstoff.get(gemChipped,2),64, 16); - GT_Values.RA.addForgeHammerRecipe(werkstoff.get(gemChipped),werkstoff.get(dustTiny),64, 16); + GT_ModHandler.addPulverisationRecipe(werkstoff.get(gemExquisite), werkstoff.get(dust, 4)); + GT_ModHandler.addPulverisationRecipe(werkstoff.get(gemFlawless), werkstoff.get(dust, 2)); + GT_ModHandler.addPulverisationRecipe(werkstoff.get(gem), werkstoff.get(dust)); + GT_ModHandler.addPulverisationRecipe(werkstoff.get(gemFlawed), werkstoff.get(dustSmall, 1)); + GT_ModHandler.addPulverisationRecipe(werkstoff.get(gemChipped), werkstoff.get(dustTiny)); + + GT_Values.RA.addForgeHammerRecipe(werkstoff.get(gemExquisite), werkstoff.get(gemFlawless, 2), 64, 16); + GT_Values.RA.addForgeHammerRecipe(werkstoff.get(gemFlawless), werkstoff.get(gem, 2), 64, 16); + GT_Values.RA.addForgeHammerRecipe(werkstoff.get(gem), werkstoff.get(gemFlawed, 2), 64, 16); + GT_Values.RA.addForgeHammerRecipe(werkstoff.get(gemFlawed), werkstoff.get(gemChipped, 2), 64, 16); + GT_Values.RA.addForgeHammerRecipe(werkstoff.get(gemChipped), werkstoff.get(dustTiny), 64, 16); + + GT_Values.RA.addImplosionRecipe(werkstoff.get(gemFlawless, 3), 8, werkstoff.get(gemExquisite), GT_OreDictUnificator.get(OrePrefixes.dustTiny, Materials.DarkAsh, 2)); + GT_Values.RA.addImplosionRecipe(werkstoff.get(gem, 3), 8, werkstoff.get(gemFlawless), GT_OreDictUnificator.get(OrePrefixes.dustTiny, Materials.DarkAsh, 2)); + GT_Values.RA.addImplosionRecipe(werkstoff.get(gemFlawed, 3), 8, werkstoff.get(gem), GT_OreDictUnificator.get(OrePrefixes.dustTiny, Materials.DarkAsh, 2)); + GT_Values.RA.addImplosionRecipe(werkstoff.get(gemChipped, 3), 8, werkstoff.get(gemFlawed), GT_OreDictUnificator.get(OrePrefixes.dustTiny, Materials.DarkAsh, 2)); + + GT_Values.RA.addImplosionRecipe(werkstoff.get(dust, 4), 24, werkstoff.get(gem, 3), GT_OreDictUnificator.get(OrePrefixes.dustTiny, Materials.DarkAsh, 8)); + } } - private void addDustRecipes(Werkstoff werkstoff){ - if ((werkstoff.getFeatures().toGenerate & 0b1) != 0){ + private void addDustRecipes(Werkstoff werkstoff) { + if ((werkstoff.getGenerationFeatures().toGenerate & 0b1) != 0) { List<FluidStack> flOutputs = new ArrayList<>(); List<ItemStack> stOutputs = new ArrayList<>(); - HashMap<ISubTagContainer,Pair<Integer,Integer>> tracker = new HashMap<>(); + HashMap<ISubTagContainer, Pair<Integer, Integer>> tracker = new HashMap<>(); int cells = 0; if (werkstoff.getStats().isElektrolysis() || werkstoff.getStats().isCentrifuge()) { - for (Pair<ISubTagContainer,Integer> container : werkstoff.getContents().getValue().toArray(new Pair[0])){ - if (container.getKey() instanceof Materials){ - if (((Materials)container.getKey()).hasCorrespondingGas() || ((Materials)container.getKey()).hasCorrespondingFluid() || ((Materials)container.getKey()).mIconSet == TextureSet.SET_FLUID) { - FluidStack tmpFl = ((Materials) container.getKey()).getGas(1000*container.getValue()); - if (tmpFl == null || tmpFl.getFluid() == null){ - tmpFl = ((Materials) container.getKey()).getFluid(1000*container.getValue()); + for (Pair<ISubTagContainer, Integer> container : werkstoff.getContents().getValue().toArray(new Pair[0])) { + if (container.getKey() instanceof Materials) { + if (((Materials) container.getKey()).hasCorrespondingGas() || ((Materials) container.getKey()).hasCorrespondingFluid() || ((Materials) container.getKey()).mIconSet == TextureSet.SET_FLUID) { + FluidStack tmpFl = ((Materials) container.getKey()).getGas(1000 * container.getValue()); + if (tmpFl == null || tmpFl.getFluid() == null) { + tmpFl = ((Materials) container.getKey()).getFluid(1000 * container.getValue()); } flOutputs.add(tmpFl); - if (flOutputs.size()>1) { + if (flOutputs.size() > 1) { if (!tracker.containsKey(container.getKey())) { stOutputs.add(((Materials) container.getKey()).getCells(container.getValue())); - tracker.put(container.getKey(), new Pair<>(container.getValue(),stOutputs.size() - 1)); + tracker.put(container.getKey(), new Pair<>(container.getValue(), stOutputs.size() - 1)); } else { - stOutputs.add(((Materials) container.getKey()).getCells(tracker.get(container.getKey()).getKey()+container.getValue())); - stOutputs.remove(tracker.get(container.getKey()).getValue()+1); + stOutputs.add(((Materials) container.getKey()).getCells(tracker.get(container.getKey()).getKey() + container.getValue())); + stOutputs.remove(tracker.get(container.getKey()).getValue() + 1); } - cells+=container.getValue(); + cells += container.getValue(); } } else { if (!tracker.containsKey(container.getKey())) { stOutputs.add(((Materials) container.getKey()).getDust(container.getValue())); - tracker.put(container.getKey(), new Pair<>(container.getValue(),stOutputs.size() - 1)); + tracker.put(container.getKey(), new Pair<>(container.getValue(), stOutputs.size() - 1)); } else { - stOutputs.add(((Materials) container.getKey()).getDust(tracker.get(container.getKey()).getKey()+container.getValue())); - stOutputs.remove(tracker.get(container.getKey()).getValue()+1); + stOutputs.add(((Materials) container.getKey()).getDust(tracker.get(container.getKey()).getKey() + container.getValue())); + stOutputs.remove(tracker.get(container.getKey()).getValue() + 1); } } - } else if (container.getKey() instanceof Werkstoff){ - if (((Werkstoff)container.getKey()).getTexSet() == TextureSet.SET_FLUID){ + } else if (container.getKey() instanceof Werkstoff) { + if (((Werkstoff) container.getKey()).getTexSet() == TextureSet.SET_FLUID) { //not yet implemented no fluids from me... } else { if (!tracker.containsKey(container.getKey())) { - stOutputs.add(((Werkstoff) container.getKey()).get(dust,container.getValue())); - tracker.put(container.getKey(), new Pair<>(container.getValue(),stOutputs.size() - 1)); + stOutputs.add(((Werkstoff) container.getKey()).get(dust, container.getValue())); + tracker.put(container.getKey(), new Pair<>(container.getValue(), stOutputs.size() - 1)); } else { - stOutputs.add(((Werkstoff) container.getKey()).get(dust,(tracker.get(container.getKey()).getKey()+container.getValue()))); - stOutputs.remove(tracker.get(container.getKey()).getValue()+1); + stOutputs.add(((Werkstoff) container.getKey()).get(dust, (tracker.get(container.getKey()).getKey() + container.getValue()))); + stOutputs.remove(tracker.get(container.getKey()).getValue() + 1); } } } } - ItemStack input = getCorresopndingItemStack(dust,werkstoff); - input.stackSize=werkstoff.getContents().getKey(); + ItemStack input = getCorresopndingItemStack(dust, werkstoff); + input.stackSize = werkstoff.getContents().getKey(); if (werkstoff.getStats().isElektrolysis()) - GT_Recipe.GT_Recipe_Map.sElectrolyzerRecipes.addRecipe(true, new ItemStack[]{input, cells > 0 ? Materials.Empty.getCells(cells) : null}, stOutputs.toArray(new ItemStack[0]), (Object)null, null, new FluidStack[]{null}, new FluidStack[]{flOutputs.size() > 0 ? flOutputs.get(0) : null}, (int)Math.max(1L,Math.abs(werkstoff.getStats().protons * werkstoff.getContents().getValue().size())), Math.min(4,werkstoff.getContents().getValue().size()) *30, 0); + GT_Recipe.GT_Recipe_Map.sElectrolyzerRecipes.addRecipe(true, new ItemStack[]{input, cells > 0 ? Materials.Empty.getCells(cells) : null}, stOutputs.toArray(new ItemStack[0]), (Object) null, null, new FluidStack[]{null}, new FluidStack[]{flOutputs.size() > 0 ? flOutputs.get(0) : null}, (int) Math.max(1L, Math.abs(werkstoff.getStats().protons * werkstoff.getContents().getValue().size())), Math.min(4, werkstoff.getContents().getValue().size()) * 30, 0); if (werkstoff.getStats().isCentrifuge()) - GT_Recipe.GT_Recipe_Map.sCentrifugeRecipes.addRecipe(true, new ItemStack[]{input, cells > 0 ? Materials.Empty.getCells(cells) : null}, stOutputs.toArray(new ItemStack[0]), (Object)null, null, new FluidStack[]{null}, new FluidStack[]{flOutputs.size() > 0 ? flOutputs.get(0) : null}, (int) Math.max(1L, Math.abs(werkstoff.getStats().mass * werkstoff.getContents().getValue().size())), Math.min(4, werkstoff.getContents().getValue().size()) * 5, 0); + GT_Recipe.GT_Recipe_Map.sCentrifugeRecipes.addRecipe(true, new ItemStack[]{input, cells > 0 ? Materials.Empty.getCells(cells) : null}, stOutputs.toArray(new ItemStack[0]), (Object) null, null, new FluidStack[]{null}, new FluidStack[]{flOutputs.size() > 0 ? flOutputs.get(0) : null}, (int) Math.max(1L, Math.abs(werkstoff.getStats().mass * werkstoff.getContents().getValue().size())), Math.min(4, werkstoff.getContents().getValue().size()) * 5, 0); } - GT_ModHandler.addShapelessCraftingRecipe(getCorresopndingItemStack(dust,werkstoff), 0,new Object[]{ - getCorresopndingItemStack(dustTiny,werkstoff), - getCorresopndingItemStack(dustTiny,werkstoff), - getCorresopndingItemStack(dustTiny,werkstoff), - getCorresopndingItemStack(dustTiny,werkstoff), - getCorresopndingItemStack(dustTiny,werkstoff), - getCorresopndingItemStack(dustTiny,werkstoff), - getCorresopndingItemStack(dustTiny,werkstoff), - getCorresopndingItemStack(dustTiny,werkstoff), - getCorresopndingItemStack(dustTiny,werkstoff) + GT_ModHandler.addShapelessCraftingRecipe(getCorresopndingItemStack(dust, werkstoff), 0, new Object[]{ + getCorresopndingItemStack(dustTiny, werkstoff), + getCorresopndingItemStack(dustTiny, werkstoff), + getCorresopndingItemStack(dustTiny, werkstoff), + getCorresopndingItemStack(dustTiny, werkstoff), + getCorresopndingItemStack(dustTiny, werkstoff), + getCorresopndingItemStack(dustTiny, werkstoff), + getCorresopndingItemStack(dustTiny, werkstoff), + getCorresopndingItemStack(dustTiny, werkstoff), + getCorresopndingItemStack(dustTiny, werkstoff) }); - GT_ModHandler.addShapelessCraftingRecipe(getCorresopndingItemStack(dust,werkstoff),0,new Object[]{ - getCorresopndingItemStack(dustSmall,werkstoff), - getCorresopndingItemStack(dustSmall,werkstoff), - getCorresopndingItemStack(dustSmall,werkstoff), - getCorresopndingItemStack(dustSmall,werkstoff) + GT_ModHandler.addShapelessCraftingRecipe(getCorresopndingItemStack(dust, werkstoff), 0, new Object[]{ + getCorresopndingItemStack(dustSmall, werkstoff), + getCorresopndingItemStack(dustSmall, werkstoff), + getCorresopndingItemStack(dustSmall, werkstoff), + getCorresopndingItemStack(dustSmall, werkstoff) }); - GT_ModHandler.addCraftingRecipe(getCorresopndingItemStack(dustSmall,werkstoff,4),new Object[]{ - " T ",'T',getCorresopndingItemStack(dust,werkstoff) + GT_ModHandler.addCraftingRecipe(getCorresopndingItemStack(dustSmall, werkstoff, 4), new Object[]{ + " T ", 'T', getCorresopndingItemStack(dust, werkstoff) }); - GT_ModHandler.addCraftingRecipe(getCorresopndingItemStack(dustTiny,werkstoff,9),new Object[]{ - "T ",'T',getCorresopndingItemStack(dust,werkstoff) + GT_ModHandler.addCraftingRecipe(getCorresopndingItemStack(dustTiny, werkstoff, 9), new Object[]{ + "T ", 'T', getCorresopndingItemStack(dust, werkstoff) }); - if ((werkstoff.getFeatures().toGenerate & 2) != 0 && !werkstoff.getStats().isBlastFurnace()) { + + if ((werkstoff.getGenerationFeatures().toGenerate & 2) != 0 && !werkstoff.getStats().isBlastFurnace()) { GT_ModHandler.addSmeltingRecipe(getCorresopndingItemStack(dust, werkstoff), getCorresopndingItemStack(ingot, werkstoff)); GT_ModHandler.addSmeltingRecipe(getCorresopndingItemStack(dustTiny, werkstoff), getCorresopndingItemStack(nugget, werkstoff)); } @@ -558,27 +504,31 @@ public class WerkstoffLoader implements Runnable { } } - private void addOreRecipes(Werkstoff werkstoff){ - if ((werkstoff.getFeatures().toGenerate & 2) != 0 && !werkstoff.getStats().isBlastFurnace()) - GT_ModHandler.addSmeltingRecipe(getCorresopndingItemStack(ore,werkstoff),getCorresopndingItemStack(ingot,werkstoff)); + private void addOreRecipes(Werkstoff werkstoff) { + if ((werkstoff.getGenerationFeatures().toGenerate & 2) != 0 && !werkstoff.getStats().isBlastFurnace()) + GT_ModHandler.addSmeltingRecipe(getCorresopndingItemStack(ore, werkstoff), getCorresopndingItemStack(ingot, werkstoff)); - if ((werkstoff.getFeatures().toGenerate & 0b1000) != 0) { - GT_Values.RA.addForgeHammerRecipe(werkstoff.get(ore), werkstoff.getFeatures().hasGems() ? werkstoff.get(gem) : werkstoff.get(crushed), 16, 10); + if ((werkstoff.getGenerationFeatures().toGenerate & 0b1000) != 0) { + GT_Values.RA.addForgeHammerRecipe(werkstoff.get(ore), werkstoff.getGenerationFeatures().hasGems() ? werkstoff.get(gem) : werkstoff.get(crushed), 16, 10); GT_ModHandler.addPulverisationRecipe( werkstoff.get(ore), - GT_Utility.mul(2L, werkstoff.get(crushed)), - werkstoff.getOreByProduct(0,dust), werkstoff.getNoOfByProducts() > 0 ? 10 : 0, Materials.Stone.getDust(1), 50, true); + werkstoff.get(crushed, 2), + werkstoff.getOreByProduct(0, gem) != null ? werkstoff.getOreByProduct(0, gem) : werkstoff.getOreByProduct(0, dust), + werkstoff.getNoOfByProducts() > 0 ? 10 : 0, + Materials.Stone.getDust(1), + 50, + true); } } private void addCrushedRecipes(Werkstoff werkstoff) { - if ((werkstoff.getFeatures().toGenerate & 0b1000) == 0 || (werkstoff.getFeatures().toGenerate & 0b1) == 0) + if ((werkstoff.getGenerationFeatures().toGenerate & 0b1000) == 0 || (werkstoff.getGenerationFeatures().toGenerate & 0b1) == 0) return; GT_Values.RA.addForgeHammerRecipe(werkstoff.get(crushed), werkstoff.get(dustImpure), 10, 16); GT_ModHandler.addPulverisationRecipe(werkstoff.get(crushed), werkstoff.get(dustImpure), werkstoff.getOreByProduct(0, dust), 10, false); GT_ModHandler.addOreWasherRecipe(werkstoff.get(crushed), 1000, werkstoff.get(crushedPurified), werkstoff.getOreByProduct(0, dustTiny), GT_OreDictUnificator.get(OrePrefixes.dust, Materials.Stone, 1L)); - GT_ModHandler.addThermalCentrifugeRecipe(werkstoff.get(crushed), (int) Math.min(5000L, Math.abs(werkstoff.getStats().protons * 20L)), new Object[]{werkstoff.get(crushedCentrifuged), werkstoff.getOreByProduct(1, dustTiny), GT_OreDictUnificator.get(OrePrefixes.dust, Materials.Stone, 1L)}); + GT_ModHandler.addThermalCentrifugeRecipe(werkstoff.get(crushed), (int) Math.min(5000L, Math.abs(werkstoff.getStats().protons * 20L)), werkstoff.get(crushedCentrifuged), werkstoff.getOreByProduct(1, dustTiny), GT_OreDictUnificator.get(OrePrefixes.dust, Materials.Stone, 1L)); GT_Values.RA.addForgeHammerRecipe(werkstoff.get(crushedPurified), werkstoff.get(dustPure), 10, 16); GT_ModHandler.addPulverisationRecipe(werkstoff.get(crushedPurified), werkstoff.get(dustPure), werkstoff.getOreByProduct(1, dust), 10, false); @@ -587,30 +537,20 @@ public class WerkstoffLoader implements Runnable { GT_Values.RA.addForgeHammerRecipe(werkstoff.get(crushedCentrifuged), werkstoff.get(dust), 10, 16); GT_ModHandler.addPulverisationRecipe(werkstoff.get(crushedCentrifuged), werkstoff.get(dust), werkstoff.getOreByProduct(2, dust), 10, false); + GT_Values.RA.addCentrifugeRecipe(werkstoff.get(dustImpure), 0, werkstoff.get(dust), werkstoff.getOreByProduct(0, dustTiny), null, null, null, null, (int) Math.max(1L, werkstoff.getStats().mass * 8L)); + GT_Values.RA.addCentrifugeRecipe(werkstoff.get(dustPure), 0, werkstoff.get(dust), werkstoff.getOreByProduct(1, dustTiny), null, null, null, null, (int) Math.max(1L, werkstoff.getStats().mass * 8L)); + + if (werkstoff.contains(SubTag.WASHING_MERCURY)) GT_Values.RA.addChemicalBathRecipe(werkstoff.get(crushed), Materials.Mercury.getFluid(1000L), werkstoff.get(crushedPurified), werkstoff.getOreByProduct(1, dust), GT_OreDictUnificator.get(OrePrefixes.dust, Materials.Stone, 1L), new int[]{10000, 7000, 4000}, 800, 8); if (werkstoff.contains(SubTag.WASHING_SODIUMPERSULFATE)) GT_Values.RA.addChemicalBathRecipe(werkstoff.get(crushed), Materials.SodiumPersulfate.getFluid(GT_Mod.gregtechproxy.mDisableOldChemicalRecipes ? 1000L : 100L), werkstoff.get(crushedPurified), werkstoff.getOreByProduct(1, dust), GT_OreDictUnificator.get(OrePrefixes.dust, Materials.Stone, 1L), new int[]{10000, 7000, 4000}, 800, 8); - GT_Values.RA.addCentrifugeRecipe(werkstoff.get(dustImpure), 0, werkstoff.get(dust), werkstoff.getOreByProduct(0, dustTiny), null, null, null, null, (int) Math.max(1L, werkstoff.getStats().mass * 8L)); - GT_Values.RA.addCentrifugeRecipe(werkstoff.get(dustPure), 0, werkstoff.get(dust), werkstoff.getOreByProduct(1, dustTiny), null, null, null, null, (int) Math.max(1L, werkstoff.getStats().mass * 8L)); - if (werkstoff.contains(SubTag.ELECTROMAGNETIC_SEPERATION_GOLD)) GT_Values.RA.addElectromagneticSeparatorRecipe(werkstoff.get(dustPure), werkstoff.get(dust), GT_OreDictUnificator.get(OrePrefixes.dustSmall, Materials.Gold, 1L), GT_OreDictUnificator.get(OrePrefixes.nugget, Materials.Gold, 1L), new int[]{10000, 4000, 2000}, 400, 24); - if (werkstoff.contains(SubTag.ELECTROMAGNETIC_SEPERATION_IRON)) + else if (werkstoff.contains(SubTag.ELECTROMAGNETIC_SEPERATION_IRON)) GT_Values.RA.addElectromagneticSeparatorRecipe(werkstoff.get(dustPure), werkstoff.get(dust), GT_OreDictUnificator.get(OrePrefixes.dustSmall, Materials.Iron, 1L), GT_OreDictUnificator.get(OrePrefixes.nugget, Materials.Iron, 1L), new int[]{10000, 4000, 2000}, 400, 24); - if (werkstoff.contains(SubTag.ELECTROMAGNETIC_SEPERATION_NEODYMIUM)) + else if (werkstoff.contains(SubTag.ELECTROMAGNETIC_SEPERATION_NEODYMIUM)) GT_Values.RA.addElectromagneticSeparatorRecipe(werkstoff.get(dustPure), werkstoff.get(dust), GT_OreDictUnificator.get(OrePrefixes.dustSmall, Materials.Neodymium, 1L), GT_OreDictUnificator.get(OrePrefixes.nugget, Materials.Neodymium, 1L), new int[]{10000, 4000, 2000}, 400, 24); - - } - - public static ItemStack getCorresopndingItemStack(OrePrefixes orePrefixes, Werkstoff werkstoff) { - return getCorresopndingItemStack(orePrefixes,werkstoff,1); - } - - public static ItemStack getCorresopndingItemStack(OrePrefixes orePrefixes, Werkstoff werkstoff, int amount) { - if (orePrefixes == ore) - return new ItemStack(BWOres,amount,werkstoff.getmID()); - return new ItemStack(items.get(orePrefixes), amount, werkstoff.getmID()).copy(); } }
\ No newline at end of file diff --git a/src/main/java/com/github/bartimaeusnek/bartworks/util/BWRecipes.java b/src/main/java/com/github/bartimaeusnek/bartworks/util/BWRecipes.java index 1ee1be96f3..b07c84d493 100644 --- a/src/main/java/com/github/bartimaeusnek/bartworks/util/BWRecipes.java +++ b/src/main/java/com/github/bartimaeusnek/bartworks/util/BWRecipes.java @@ -89,7 +89,6 @@ public class BWRecipes { ); - public BWRecipes() { if (ConfigHandler.BioLab) { @@ -484,7 +483,7 @@ public class BWRecipes { return false; } - public static class DynamicGTRecipe extends GT_Recipe{ + public static class DynamicGTRecipe extends GT_Recipe { public DynamicGTRecipe(boolean aOptimize, ItemStack[] aInputs, ItemStack[] aOutputs, Object aSpecialItems, int[] aChances, FluidStack[] aFluidInputs, FluidStack[] aFluidOutputs, int aDuration, int aEUt, int aSpecialValue) { super(aOptimize, aInputs, aOutputs, aSpecialItems, aChances, aFluidInputs, aFluidOutputs, aDuration, aEUt, aSpecialValue); } @@ -510,13 +509,6 @@ public class BWRecipes { } - class BioLabRecipe extends GT_Recipe { - protected BioLabRecipe(boolean aOptimize, ItemStack[] aInputs, ItemStack[] aOutputs, ItemStack aSpecialItems, int[] aChances, FluidStack[] aFluidInputs, FluidStack[] aFluidOutputs, int aDuration, int aEUt, int aSpecialValue) { - super(aOptimize, aInputs, aOutputs, aSpecialItems, aChances, aFluidInputs, aFluidOutputs, aDuration, aEUt, aSpecialValue); - } - - } - public static class BacteriaVatRecipe extends GT_Recipe { protected BacteriaVatRecipe(boolean aOptimize, ItemStack[] aInputs, ItemStack[] aOutputs, ItemStack aSpecialItems, int[] aChances, FluidStack[] aFluidInputs, FluidStack[] aFluidOutputs, int aDuration, int aEUt, int aSpecialValue) { super(aOptimize, aInputs, aOutputs, aSpecialItems, aChances, aFluidInputs, aFluidOutputs, aDuration, aEUt, aSpecialValue); @@ -645,4 +637,11 @@ public class BWRecipes { return this.addRecipe(aRecipe, false, false, false); } } + + class BioLabRecipe extends GT_Recipe { + protected BioLabRecipe(boolean aOptimize, ItemStack[] aInputs, ItemStack[] aOutputs, ItemStack aSpecialItems, int[] aChances, FluidStack[] aFluidInputs, FluidStack[] aFluidOutputs, int aDuration, int aEUt, int aSpecialValue) { + super(aOptimize, aInputs, aOutputs, aSpecialItems, aChances, aFluidInputs, aFluidOutputs, aDuration, aEUt, aSpecialValue); + } + + } } diff --git a/src/main/java/com/github/bartimaeusnek/bartworks/util/BW_Util.java b/src/main/java/com/github/bartimaeusnek/bartworks/util/BW_Util.java index 51572b0543..f839b8b503 100644 --- a/src/main/java/com/github/bartimaeusnek/bartworks/util/BW_Util.java +++ b/src/main/java/com/github/bartimaeusnek/bartworks/util/BW_Util.java @@ -233,15 +233,16 @@ public class BW_Util { } } - public static long getnominalVoltage(GT_MetaTileEntity_MultiBlockBase base){ + public static long getnominalVoltage(GT_MetaTileEntity_MultiBlockBase base) { long rVoltage = 0L; long rAmperage = 0L; Iterator var3 = base.mEnergyHatches.iterator(); - while(var3.hasNext()) { - GT_MetaTileEntity_Hatch_Energy tHatch = (GT_MetaTileEntity_Hatch_Energy)var3.next(); + while (var3.hasNext()) { + GT_MetaTileEntity_Hatch_Energy tHatch = (GT_MetaTileEntity_Hatch_Energy) var3.next(); if (base.isValidMetaTileEntity(tHatch)) { - rVoltage += tHatch.getBaseMetaTileEntity().getInputVoltage(); + if (rVoltage == 0 || rVoltage > tHatch.getBaseMetaTileEntity().getInputVoltage()) + rVoltage = tHatch.getBaseMetaTileEntity().getInputVoltage(); rAmperage += tHatch.getBaseMetaTileEntity().getInputAmperage(); } } diff --git a/src/main/java/com/github/bartimaeusnek/bartworks/util/BioCulture.java b/src/main/java/com/github/bartimaeusnek/bartworks/util/BioCulture.java index 08e4f3269c..a9f3293cbc 100644 --- a/src/main/java/com/github/bartimaeusnek/bartworks/util/BioCulture.java +++ b/src/main/java/com/github/bartimaeusnek/bartworks/util/BioCulture.java @@ -33,13 +33,12 @@ import net.minecraftforge.fluids.FluidRegistry; import java.awt.*; import java.nio.ByteBuffer; import java.util.ArrayList; -import java.util.Arrays; import java.util.Objects; public class BioCulture extends BioData implements IColorModulationContainer { public static final ArrayList<BioCulture> BIO_CULTURE_ARRAY_LIST = new ArrayList<BioCulture>(); - public static final BioCulture NULLCULTURE = BioCulture.createAndRegisterBioCulture(Color.BLUE, "", BioPlasmid.NULLPLASMID,BioDNA.NULLDNA, false); //fallback NULL culture, also Blue =) + public static final BioCulture NULLCULTURE = BioCulture.createAndRegisterBioCulture(Color.BLUE, "", BioPlasmid.NULLPLASMID, BioDNA.NULLDNA, false); //fallback NULL culture, also Blue =) Color color; BioPlasmid plasmid; @@ -96,14 +95,14 @@ public class BioCulture extends BioData implements IColorModulationContainer { BioCulture ret = getBioCulture(tag.getString("Name")); if (ret == null) - ret = createAndRegisterBioCulture( - new Color(tag.getIntArray("Color")[0], tag.getIntArray("Color")[1], tag.getIntArray("Color")[2]), - tag.getString("Name"), - BioPlasmid.convertDataToPlasmid(getBioDataFromNBTTag(tag.getCompoundTag("Plasmid"))), - BioDNA.convertDataToDNA(getBioDataFromNBTTag(tag.getCompoundTag("DNA"))), - BW_Util.getRarityFromByte(tag.getByte("Rarety")), - tag.getBoolean("Breedable") - ); + ret = createAndRegisterBioCulture( + new Color(tag.getIntArray("Color")[0], tag.getIntArray("Color")[1], tag.getIntArray("Color")[2]), + tag.getString("Name"), + BioPlasmid.convertDataToPlasmid(getBioDataFromNBTTag(tag.getCompoundTag("Plasmid"))), + BioDNA.convertDataToDNA(getBioDataFromNBTTag(tag.getCompoundTag("DNA"))), + BW_Util.getRarityFromByte(tag.getByte("Rarety")), + tag.getBoolean("Breedable") + ); if (ret.bBreedable) ret.setFluid(FluidRegistry.getFluid(tag.getString("Fluid"))); if (ret.getFluidNotSet()) //should never happen, but better safe than sorry @@ -131,14 +130,14 @@ public class BioCulture extends BioData implements IColorModulationContainer { return this.mFluid; } - public boolean getFluidNotSet(){ - return this.mFluid == null && this.isBreedable(); - } - public void setFluid(Fluid mFluid) { this.mFluid = mFluid; } + public boolean getFluidNotSet() { + return this.mFluid == null && this.isBreedable(); + } + public boolean isBreedable() { return this.bBreedable; } @@ -196,7 +195,7 @@ public class BioCulture extends BioData implements IColorModulationContainer { @Override public int hashCode() { - return MurmurHash3.murmurhash3_x86_32(ByteBuffer.allocate(17).putInt(MurmurHash3.murmurhash3_x86_32(this.getName(),0,this.getName().length(),31)).putInt(this.getColorRGB()).putInt(this.getPlasmid().ID).putInt(this.getdDNA().ID).put((byte) (isBreedable() ? 1 : 0)).array(),0,17,31); + return MurmurHash3.murmurhash3_x86_32(ByteBuffer.allocate(17).putInt(MurmurHash3.murmurhash3_x86_32(this.getName(), 0, this.getName().length(), 31)).putInt(this.getColorRGB()).putInt(this.getPlasmid().ID).putInt(this.getdDNA().ID).put((byte) (isBreedable() ? 1 : 0)).array(), 0, 17, 31); } @Override diff --git a/src/main/java/com/github/bartimaeusnek/bartworks/util/BioData.java b/src/main/java/com/github/bartimaeusnek/bartworks/util/BioData.java index f4e8917e67..1421f75c40 100644 --- a/src/main/java/com/github/bartimaeusnek/bartworks/util/BioData.java +++ b/src/main/java/com/github/bartimaeusnek/bartworks/util/BioData.java @@ -111,14 +111,14 @@ public class BioData { BioData bioData = (BioData) o; return this.getID() == bioData.getID() || ( this.getChance() == bioData.getChance() && - this.getTier() == bioData.getTier() && - Objects.equals(this.getName(), bioData.getName()) && - this.getRarity() == bioData.getRarity()); + this.getTier() == bioData.getTier() && + Objects.equals(this.getName(), bioData.getName()) && + this.getRarity() == bioData.getRarity()); } @Override public int hashCode() { - return MurmurHash3.murmurhash3_x86_32(ByteBuffer.allocate(13).putInt(MurmurHash3.murmurhash3_x86_32(this.getName(),0,this.getName().length(),31)).put(BW_Util.getByteFromRarity(this.getRarity())).putInt(this.getChance()).putInt(this.getTier()).array(),0,13,31); + return MurmurHash3.murmurhash3_x86_32(ByteBuffer.allocate(13).putInt(MurmurHash3.murmurhash3_x86_32(this.getName(), 0, this.getName().length(), 31)).put(BW_Util.getByteFromRarity(this.getRarity())).putInt(this.getChance()).putInt(this.getTier()).array(), 0, 13, 31); } public int getTier() { diff --git a/src/main/java/com/github/bartimaeusnek/bartworks/util/Pair.java b/src/main/java/com/github/bartimaeusnek/bartworks/util/Pair.java index f61eee3c3c..4196a9eadc 100644 --- a/src/main/java/com/github/bartimaeusnek/bartworks/util/Pair.java +++ b/src/main/java/com/github/bartimaeusnek/bartworks/util/Pair.java @@ -26,8 +26,8 @@ import java.nio.ByteBuffer; import java.util.Arrays; import java.util.Map; -public class Pair<A,B> implements Map.Entry { - Object[] pair= new Object[2]; +public class Pair<A, B> implements Map.Entry { + Object[] pair = new Object[2]; public Pair(Object[] pair) { @@ -53,7 +53,7 @@ public class Pair<A,B> implements Map.Entry { @Override public int hashCode() { - return MurmurHash3.murmurhash3_x86_32(ByteBuffer.allocate(8).putInt(pair[0].hashCode()).putInt(pair[1].hashCode()).array(),0,8,31); + return MurmurHash3.murmurhash3_x86_32(ByteBuffer.allocate(8).putInt(pair[0].hashCode()).putInt(pair[1].hashCode()).array(), 0, 8, 31); } @Override @@ -68,7 +68,7 @@ public class Pair<A,B> implements Map.Entry { @Override public B setValue(Object value) { - pair[1]=value; + pair[1] = value; return (B) pair[1]; } } diff --git a/src/main/java/com/github/bartimaeusnek/crossmod/BartWorksCrossmod.java b/src/main/java/com/github/bartimaeusnek/crossmod/BartWorksCrossmod.java index 58d9f52d66..9cefea1a7d 100644 --- a/src/main/java/com/github/bartimaeusnek/crossmod/BartWorksCrossmod.java +++ b/src/main/java/com/github/bartimaeusnek/crossmod/BartWorksCrossmod.java @@ -27,12 +27,11 @@ import cpw.mods.fml.common.Loader; import cpw.mods.fml.common.Mod; import cpw.mods.fml.common.event.FMLInitializationEvent; import cpw.mods.fml.common.event.FMLPreInitializationEvent; -import net.minecraftforge.common.config.Configuration; import org.apache.logging.log4j.LogManager; import org.apache.logging.log4j.Logger; @Mod( - modid =BartWorksCrossmod.MOD_ID, name = BartWorksCrossmod.NAME, version = BartWorksCrossmod.VERSION, + modid = BartWorksCrossmod.MOD_ID, name = BartWorksCrossmod.NAME, version = BartWorksCrossmod.VERSION, dependencies = "required-after:IC2; " + "required-after:gregtech; " + "required-after:bartworks;" @@ -48,7 +47,7 @@ public class BartWorksCrossmod { public static BartWorksCrossmod instance; @Mod.EventHandler - public void preInit(FMLPreInitializationEvent preinit){ + public void preInit(FMLPreInitializationEvent preinit) { if (Loader.isModLoaded("GalacticraftCore")) diff --git a/src/main/java/com/github/bartimaeusnek/crossmod/galacticraft/GalacticraftProxy.java b/src/main/java/com/github/bartimaeusnek/crossmod/galacticraft/GalacticraftProxy.java index ccc11bef56..c3c7f7d3e6 100644 --- a/src/main/java/com/github/bartimaeusnek/crossmod/galacticraft/GalacticraftProxy.java +++ b/src/main/java/com/github/bartimaeusnek/crossmod/galacticraft/GalacticraftProxy.java @@ -31,15 +31,17 @@ import net.minecraftforge.common.config.Configuration; import java.io.File; -import static com.github.bartimaeusnek.crossmod.galacticraft.planets.ross128.world.oregen.BW_WorldGenRoss128.*; +import static com.github.bartimaeusnek.crossmod.galacticraft.planets.ross128.world.oregen.BW_WorldGenRoss128.init_OresRoss128; +import static com.github.bartimaeusnek.crossmod.galacticraft.planets.ross128.world.oregen.BW_WorldGenRoss128.init_undergroundFluidsRoss128; public class GalacticraftProxy { - private GalacticraftProxy(){} - static Configuration gtConf; public static GT_UO_DimensionList uo_dimensionList = new GT_UO_DimensionList(); + static Configuration gtConf; + private GalacticraftProxy() { + } - public static void preInit(FMLPreInitializationEvent e){ - if (FMLCommonHandler.instance().getSide().isServer() || FMLCommonHandler.instance().getEffectiveSide().isServer()){ + public static void preInit(FMLPreInitializationEvent e) { + if (FMLCommonHandler.instance().getSide().isServer() || FMLCommonHandler.instance().getEffectiveSide().isServer()) { serverpreInit(e); } else { clientpreInit(e); @@ -47,38 +49,48 @@ public class GalacticraftProxy { commonpreInit(e); } - private static void serverpreInit(FMLPreInitializationEvent e){ + private static void serverpreInit(FMLPreInitializationEvent e) { } - private static void clientpreInit(FMLPreInitializationEvent e){ + + private static void clientpreInit(FMLPreInitializationEvent e) { } - private static void commonpreInit(FMLPreInitializationEvent e){ - Configuration c = new Configuration(e.getSuggestedConfigurationFile()); + + private static void commonpreInit(FMLPreInitializationEvent e) { gtConf = new Configuration(new File(new File(e.getModConfigurationDirectory(), "GregTech"), "GregTech.cfg")); uo_dimensionList.getConfig(gtConf, "undergroundfluid"); init_undergroundFluidsRoss128(); - gtConf.save(); - Ross128.ross128ID=c.get("System","DimID",-64,"The Dim ID for Ross128").getInt(-64); + if (gtConf.hasChanged()) + gtConf.save(); + + Configuration c = new Configuration(new File(e.getModConfigurationDirectory(), "bartworks.cfg")); + Ross128.ross128ID = c.get("CrossMod Interactions", "DimID - Ross128b", -64, "The Dim ID for Ross128b").getInt(-64); + Ross128.enabled = c.get("CrossMod Interactions", "Galacticraft - Activate Ross128 System", true, "If the Ross128 System should be activated").getBoolean(true); + if (c.hasChanged()) + c.save(); + init_OresRoss128(); } - public static void init(FMLInitializationEvent e){ - if (FMLCommonHandler.instance().getSide().isServer() || FMLCommonHandler.instance().getEffectiveSide().isServer()){ + public static void init(FMLInitializationEvent e) { + if (FMLCommonHandler.instance().getSide().isServer() || FMLCommonHandler.instance().getEffectiveSide().isServer()) { serverInit(e); } else { clientInit(e); } commonInit(e); } - - private static void serverInit(FMLInitializationEvent e){ - + + private static void serverInit(FMLInitializationEvent e) { + } - private static void clientInit(FMLInitializationEvent e){ - + + private static void clientInit(FMLInitializationEvent e) { + } - private static void commonInit(FMLInitializationEvent e){ - Ross128.init(); + private static void commonInit(FMLInitializationEvent e) { + if (Ross128.enabled) + Ross128.init(); } } diff --git a/src/main/java/com/github/bartimaeusnek/crossmod/galacticraft/UniversalTeleportType.java b/src/main/java/com/github/bartimaeusnek/crossmod/galacticraft/UniversalTeleportType.java index 91c66768ab..742cee9a10 100644 --- a/src/main/java/com/github/bartimaeusnek/crossmod/galacticraft/UniversalTeleportType.java +++ b/src/main/java/com/github/bartimaeusnek/crossmod/galacticraft/UniversalTeleportType.java @@ -42,13 +42,13 @@ public class UniversalTeleportType implements ITeleportType { @Override public Vector3 getPlayerSpawnLocation(WorldServer world, EntityPlayerMP player) { - return getEntitySpawnLocation(world,player); + return getEntitySpawnLocation(world, player); } @Override public Vector3 getEntitySpawnLocation(WorldServer world, Entity entity) { - if (entity instanceof EntityPlayerMP){ - GCPlayerStats stats = GCPlayerStats.get((EntityPlayerMP)entity); + if (entity instanceof EntityPlayerMP) { + GCPlayerStats stats = GCPlayerStats.get((EntityPlayerMP) entity); return new Vector3(stats.coordsTeleportedFromX, 500D, stats.coordsTeleportedFromZ); } return new Vector3(entity.posX, 500D, entity.posZ); @@ -61,8 +61,7 @@ public class UniversalTeleportType implements ITeleportType { @Override public void onSpaceDimensionChanged(World newWorld, EntityPlayerMP player, boolean ridingAutoRocket) { - if ((player != null) && (GCPlayerStats.get(player).teleportCooldown <= 0)) - { + if ((player != null) && (GCPlayerStats.get(player).teleportCooldown <= 0)) { if (player.capabilities.isFlying) { player.capabilities.isFlying = false; } @@ -74,6 +73,7 @@ public class UniversalTeleportType implements ITeleportType { GCPlayerStats.get(player).teleportCooldown = 10; } } + @Override public void setupAdventureSpawn(EntityPlayerMP player) { diff --git a/src/main/java/com/github/bartimaeusnek/crossmod/galacticraft/creativetabs/SpaceTab.java b/src/main/java/com/github/bartimaeusnek/crossmod/galacticraft/creativetabs/SpaceTab.java index 49a1bf9475..e3b8aaf3cf 100644 --- a/src/main/java/com/github/bartimaeusnek/crossmod/galacticraft/creativetabs/SpaceTab.java +++ b/src/main/java/com/github/bartimaeusnek/crossmod/galacticraft/creativetabs/SpaceTab.java @@ -30,14 +30,14 @@ public class SpaceTab extends CreativeTabs { private static final SpaceTab instance = new SpaceTab("SpaceTab"); - public static SpaceTab getInstance(){ - return instance; - } - private SpaceTab(String label) { super(label); } + public static SpaceTab getInstance() { + return instance; + } + @Override public Item getTabIconItem() { return ItemRegistry.DESTRUCTOPACK; diff --git a/src/main/java/com/github/bartimaeusnek/crossmod/galacticraft/planets/ross128/world/oregen/BW_WordGenerator.java b/src/main/java/com/github/bartimaeusnek/crossmod/galacticraft/planets/ross128/world/oregen/BW_WordGenerator.java index e222ab8c9c..5a80b62f75 100644 --- a/src/main/java/com/github/bartimaeusnek/crossmod/galacticraft/planets/ross128/world/oregen/BW_WordGenerator.java +++ b/src/main/java/com/github/bartimaeusnek/crossmod/galacticraft/planets/ross128/world/oregen/BW_WordGenerator.java @@ -50,13 +50,13 @@ public class BW_WordGenerator implements IWorldGenerator { } public static class WorldGenContainer implements Runnable { - public int mX; - public int mZ; + public static HashSet<ChunkCoordIntPair> mGenerated = new HashSet<>(2000); public final int mDimensionType; public final World mWorld; public final IChunkProvider mChunkGenerator; public final IChunkProvider mChunkProvider; - public static HashSet<ChunkCoordIntPair> mGenerated = new HashSet<>(2000); + public int mX; + public int mZ; public WorldGenContainer(int aX, int aZ, int aDimensionType, World aWorld, IChunkProvider aChunkGenerator, IChunkProvider aChunkProvider) { this.mX = aX; @@ -64,7 +64,8 @@ public class BW_WordGenerator implements IWorldGenerator { this.mDimensionType = aDimensionType; this.mWorld = aWorld; this.mChunkGenerator = aChunkGenerator; - this.mChunkProvider = aChunkProvider;; + this.mChunkProvider = aChunkProvider; + ; } //returns a coordinate of a center chunk of 3x3 square; the argument belongs to this square diff --git a/src/main/java/com/github/bartimaeusnek/crossmod/galacticraft/planets/ross128/world/oregen/BW_WorldGenRoss128.java b/src/main/java/com/github/bartimaeusnek/crossmod/galacticraft/planets/ross128/world/oregen/BW_WorldGenRoss128.java index 3a1c3c2c95..0f49e7ee95 100644 --- a/src/main/java/com/github/bartimaeusnek/crossmod/galacticraft/planets/ross128/world/oregen/BW_WorldGenRoss128.java +++ b/src/main/java/com/github/bartimaeusnek/crossmod/galacticraft/planets/ross128/world/oregen/BW_WorldGenRoss128.java @@ -27,10 +27,6 @@ import com.github.bartimaeusnek.bartworks.system.material.BW_MetaGenerated_Ores; import com.github.bartimaeusnek.bartworks.system.material.Werkstoff; import com.github.bartimaeusnek.bartworks.system.material.WerkstoffLoader; import com.github.bartimaeusnek.crossmod.galacticraft.planets.ross128.world.worldprovider.WorldProviderRoss128b; -import com.github.bartimaeusnek.crossmod.galacticraft.solarsystems.Ross128; -import cpw.mods.fml.common.event.FMLInitializationEvent; -import cpw.mods.fml.common.event.FMLPreInitializationEvent; -import gregtech.GT_Mod; import gregtech.api.enums.Materials; import gregtech.api.interfaces.ISubTagContainer; import gregtech.api.world.GT_Worldgen; @@ -39,10 +35,8 @@ import net.minecraft.util.MathHelper; import net.minecraft.util.StatCollector; import net.minecraft.world.World; import net.minecraft.world.chunk.IChunkProvider; -import net.minecraftforge.common.config.Configuration; import net.minecraftforge.fluids.FluidRegistry; -import java.io.File; import java.util.ArrayList; import java.util.List; import java.util.Random; @@ -54,39 +48,16 @@ import static com.github.bartimaeusnek.crossmod.galacticraft.GalacticraftProxy.u */ public class BW_WorldGenRoss128 extends GT_Worldgen { + public static final List<GT_Worldgen> sList = new ArrayList<>(); private static final boolean logOregenRoss128 = false; - - public static void init_OresRoss128() { - new BW_WorldGenRoss128("ore.mix.ross128.Thorianit", true, 30, 60, 17, 1, 16, WerkstoffLoader.Thorianit, Materials.Uraninite, Materials.Lepidolite, Materials.Spodumene); - new BW_WorldGenRoss128("ore.mix.ross128.carbon", true, 5, 25, 5, 4, 12, Materials.Graphite, Materials.Diamond, Materials.Coal, Materials.Graphene); - new BW_WorldGenRoss128("ore.mix.ross128.bismuth", true, 5, 80, 30, 1, 16, WerkstoffLoader.Bismuthinit, Materials.Stibnite, Materials.Bismuth, WerkstoffLoader.Bismutite); - new BW_WorldGenRoss128("ore.mix.ross128.TurmalinAlkali", true, 5, 200, 15, 4, 48, WerkstoffLoader.Olenit, WerkstoffLoader.FluorBuergerit, WerkstoffLoader.ChromoAluminoPovondrait, WerkstoffLoader.VanadioOxyDravit); - new BW_WorldGenRoss128("ore.mix.ross128.Roquesit", true, 5, 250, 3, 1, 12, WerkstoffLoader.Arsenopyrite, WerkstoffLoader.Ferberite, WerkstoffLoader.Loellingit, WerkstoffLoader.Roquesit); - new BW_WorldGenRoss128("ore.mix.ross128.Tungstate", true, 5, 250, 10, 4, 14, WerkstoffLoader.Ferberite, WerkstoffLoader.Huebnerit, WerkstoffLoader.Loellingit, Materials.Scheelite); - new BW_WorldGenRoss128("ore.mix.ross128.CopperSulfits", true, 40, 70, 80, 3, 24, WerkstoffLoader.Djurleit, WerkstoffLoader.Bornite, WerkstoffLoader.Wittichenit, Materials.Tetrahedrite); - new BW_WorldGenRoss128("ore.mix.ross128.magnetite", true, 60, 180, 50, 2, 32, Materials.Magnetite, Materials.Magnetite, Materials.Iron, Materials.VanadiumMagnetite); - new BW_WorldGenRoss128("ore.mix.ross128.gold", true, 30, 60, 50, 2, 32, Materials.Magnetite, Materials.Magnetite, Materials.VanadiumMagnetite, Materials.Gold); - new BW_WorldGenRoss128("ore.mix.ross128.iron", true, 10, 40, 40, 3, 24, Materials.BrownLimonite, Materials.YellowLimonite, Materials.BandedIron, Materials.Malachite); - } - - public static void init_undergroundFluidsRoss128(){ - String ross128b=StatCollector.translateToLocal("planet.Ross128b"); - uo_dimensionList.SetConfigValues(ross128b,ross128b,"veryheavyoil","liquid_extra_heavy_oil",0,625,40,5); - uo_dimensionList.SetConfigValues(ross128b,ross128b,"lava", FluidRegistry.getFluidName(FluidRegistry.LAVA),0,80000,5,5); - uo_dimensionList.SetConfigValues(ross128b,ross128b,"gas_natural_gas", "gas_natural_gas",0,625,65,5); - - } - - public byte bwOres = 0b0000; - public int mMinY,mWeight,mDensity,mSize,mMaxY,mPrimaryMeta,mSecondaryMeta,mBetweenMeta,mSporadicMeta; public static int sWeight; - public static final List<GT_Worldgen> sList = new ArrayList<>(); - + public byte bwOres = 0b0000; + public int mMinY, mWeight, mDensity, mSize, mMaxY, mPrimaryMeta, mSecondaryMeta, mBetweenMeta, mSporadicMeta; public BW_WorldGenRoss128(String aName, boolean aDefault, int aMinY, int aMaxY, int aWeight, int aDensity, int aSize, ISubTagContainer top, ISubTagContainer bottom, ISubTagContainer between, ISubTagContainer sprinkled) { super(aName, sList, aDefault); this.mMinY = (short) aMinY; this.mMaxY = (short) aMaxY; - this.mWeight = (short)aWeight; + this.mWeight = (short) aWeight; this.mDensity = (short) aDensity; this.mSize = (short) Math.max(1, aSize); @@ -103,29 +74,25 @@ public class BW_WorldGenRoss128 extends GT_Worldgen { bwOres = (byte) (bwOres | 0b0001); short aPrimary = top instanceof Materials ? - (short) ((Materials)top).mMetaItemSubID: + (short) ((Materials) top).mMetaItemSubID : top instanceof Werkstoff ? - (short) ((Werkstoff)top).getmID(): - 0 - ; + (short) ((Werkstoff) top).getmID() : + 0; short aSecondary = bottom instanceof Materials ? - (short) ((Materials)bottom).mMetaItemSubID: + (short) ((Materials) bottom).mMetaItemSubID : bottom instanceof Werkstoff ? - (short) ((Werkstoff)bottom).getmID(): - 0 - ; + (short) ((Werkstoff) bottom).getmID() : + 0; short aBetween = between instanceof Materials ? - (short) ((Materials)between).mMetaItemSubID: + (short) ((Materials) between).mMetaItemSubID : between instanceof Werkstoff ? - (short) ((Werkstoff)between).getmID(): - 0 - ; + (short) ((Werkstoff) between).getmID() : + 0; short aSporadic = sprinkled instanceof Materials ? - (short) ((Materials)sprinkled).mMetaItemSubID: + (short) ((Materials) sprinkled).mMetaItemSubID : sprinkled instanceof Werkstoff ? - (short) ((Werkstoff)sprinkled).getmID(): - 0 - ; + (short) ((Werkstoff) sprinkled).getmID() : + 0; this.mPrimaryMeta = (short) aPrimary; this.mSecondaryMeta = (short) aSecondary; this.mBetweenMeta = (short) aBetween; @@ -133,6 +100,27 @@ public class BW_WorldGenRoss128 extends GT_Worldgen { } + public static void init_OresRoss128() { + new BW_WorldGenRoss128("ore.mix.ross128.Thorianit", true, 30, 60, 17, 1, 16, WerkstoffLoader.Thorianit, Materials.Uraninite, Materials.Lepidolite, Materials.Spodumene); + new BW_WorldGenRoss128("ore.mix.ross128.carbon", true, 5, 25, 5, 4, 12, Materials.Graphite, Materials.Diamond, Materials.Coal, Materials.Graphene); + new BW_WorldGenRoss128("ore.mix.ross128.bismuth", true, 5, 80, 30, 1, 16, WerkstoffLoader.Bismuthinit, Materials.Stibnite, Materials.Bismuth, WerkstoffLoader.Bismutite); + new BW_WorldGenRoss128("ore.mix.ross128.TurmalinAlkali", true, 5, 200, 15, 4, 48, WerkstoffLoader.Olenit, WerkstoffLoader.FluorBuergerit, WerkstoffLoader.ChromoAluminoPovondrait, WerkstoffLoader.VanadioOxyDravit); + new BW_WorldGenRoss128("ore.mix.ross128.Roquesit", true, 5, 250, 3, 1, 12, WerkstoffLoader.Arsenopyrite, WerkstoffLoader.Ferberite, WerkstoffLoader.Loellingit, WerkstoffLoader.Roquesit); + new BW_WorldGenRoss128("ore.mix.ross128.Tungstate", true, 5, 250, 10, 4, 14, WerkstoffLoader.Ferberite, WerkstoffLoader.Huebnerit, WerkstoffLoader.Loellingit, Materials.Scheelite); + new BW_WorldGenRoss128("ore.mix.ross128.CopperSulfits", true, 40, 70, 80, 3, 24, WerkstoffLoader.Djurleit, WerkstoffLoader.Bornite, WerkstoffLoader.Wittichenit, Materials.Tetrahedrite); + new BW_WorldGenRoss128("ore.mix.ross128.magnetite", true, 60, 180, 50, 2, 32, Materials.Magnetite, Materials.Magnetite, Materials.Iron, Materials.VanadiumMagnetite); + new BW_WorldGenRoss128("ore.mix.ross128.gold", true, 30, 60, 50, 2, 32, Materials.Magnetite, Materials.Magnetite, Materials.VanadiumMagnetite, Materials.Gold); + new BW_WorldGenRoss128("ore.mix.ross128.iron", true, 10, 40, 40, 3, 24, Materials.BrownLimonite, Materials.YellowLimonite, Materials.BandedIron, Materials.Malachite); + } + + public static void init_undergroundFluidsRoss128() { + String ross128b = StatCollector.translateToLocal("planet.Ross128b"); + uo_dimensionList.SetConfigValues(ross128b, ross128b, "veryheavyoil", "liquid_extra_heavy_oil", 0, 625, 40, 5); + uo_dimensionList.SetConfigValues(ross128b, ross128b, "lava", FluidRegistry.getFluidName(FluidRegistry.LAVA), 0, 32767, 5, 5); + uo_dimensionList.SetConfigValues(ross128b, ross128b, "gas_natural_gas", "gas_natural_gas", 0, 625, 65, 5); + + } + @Override public boolean isGenerationAllowed(World aWorld, int aDimensionType, int aAllowedDimensionType) { return aWorld.provider instanceof WorldProviderRoss128b; @@ -140,19 +128,19 @@ public class BW_WorldGenRoss128 extends GT_Worldgen { @Override public boolean executeWorldgen(World aWorld, Random aRandom, String aBiome, int aDimensionType, int aChunkX, int aChunkZ, IChunkProvider aChunkGenerator, IChunkProvider aChunkProvider) { - { + { int tMinY = this.mMinY + aRandom.nextInt(this.mMaxY - this.mMinY - 5); int cX = aChunkX - aRandom.nextInt(this.mSize); int eX = aChunkX + 16 + aRandom.nextInt(this.mSize); - for(int tX = cX; tX <= eX; ++tX) { + for (int tX = cX; tX <= eX; ++tX) { int cZ = aChunkZ - aRandom.nextInt(this.mSize); int eZ = aChunkZ + 16 + aRandom.nextInt(this.mSize); - for(int tZ = cZ; tZ <= eZ; ++tZ) { + for (int tZ = cZ; tZ <= eZ; ++tZ) { int i; if (this.mSecondaryMeta > 0) { - for(i = tMinY - 1; i < tMinY + 2; ++i) { + for (i = tMinY - 1; i < tMinY + 2; ++i) { if (aRandom.nextInt(Math.max(1, Math.max(MathHelper.abs_int(cZ - tZ), MathHelper.abs_int(eZ - tZ)) / this.mDensity)) == 0 || aRandom.nextInt(Math.max(1, Math.max(MathHelper.abs_int(cX - tX), MathHelper.abs_int(eX - tX)) / this.mDensity)) == 0) { setOreBlock(aWorld, tX, i, tZ, this.mSecondaryMeta, false); } @@ -164,7 +152,7 @@ public class BW_WorldGenRoss128 extends GT_Worldgen { } if (this.mPrimaryMeta > 0) { - for(i = tMinY + 3; i < tMinY + 6; ++i) { + for (i = tMinY + 3; i < tMinY + 6; ++i) { if (aRandom.nextInt(Math.max(1, Math.max(MathHelper.abs_int(cZ - tZ), MathHelper.abs_int(eZ - tZ)) / this.mDensity)) == 0 || aRandom.nextInt(Math.max(1, Math.max(MathHelper.abs_int(cX - tX), MathHelper.abs_int(eX - tX)) / this.mDensity)) == 0) { setOreBlock(aWorld, tX, i, tZ, this.mPrimaryMeta, false); } @@ -186,10 +174,10 @@ public class BW_WorldGenRoss128 extends GT_Worldgen { } public boolean setOreBlock(World aWorld, int aX, int aY, int aZ, int aMetaData, boolean isSmallOre) { - if ((aMetaData == mSporadicMeta && (bwOres & 0b0001) != 0) || (aMetaData == mBetweenMeta && (bwOres & 0b0010) != 0) || (aMetaData == mPrimaryMeta && (bwOres & 0b1000) != 0) || (aMetaData == mSecondaryMeta && (bwOres & 0b0100) != 0)){ + if ((aMetaData == mSporadicMeta && (bwOres & 0b0001) != 0) || (aMetaData == mBetweenMeta && (bwOres & 0b0010) != 0) || (aMetaData == mPrimaryMeta && (bwOres & 0b1000) != 0) || (aMetaData == mSecondaryMeta && (bwOres & 0b0100) != 0)) { return BW_MetaGenerated_Ores.setOreBlock(aWorld, aX, aY, aZ, aMetaData, false); } return GT_TileEntity_Ores.setOreBlock(aWorld, aX, aY, aZ, aMetaData, isSmallOre, false); } - + } diff --git a/src/main/java/com/github/bartimaeusnek/crossmod/galacticraft/planets/ross128/world/worldprovider/ChunkProviderRoss128b.java b/src/main/java/com/github/bartimaeusnek/crossmod/galacticraft/planets/ross128/world/worldprovider/ChunkProviderRoss128b.java index 1f9ce77b26..0476e4356c 100644 --- a/src/main/java/com/github/bartimaeusnek/crossmod/galacticraft/planets/ross128/world/worldprovider/ChunkProviderRoss128b.java +++ b/src/main/java/com/github/bartimaeusnek/crossmod/galacticraft/planets/ross128/world/worldprovider/ChunkProviderRoss128b.java @@ -23,23 +23,19 @@ package com.github.bartimaeusnek.crossmod.galacticraft.planets.ross128.world.worldprovider; import com.github.bartimaeusnek.crossmod.galacticraft.planets.ross128.world.oregen.BW_WordGenerator; -import gregtech.api.GregTech_API; import gregtech.api.objects.XSTR; -import gregtech.api.world.GT_Worldgen_Ore; import net.minecraft.block.Block; import net.minecraft.block.BlockFalling; import net.minecraft.entity.EnumCreatureType; import net.minecraft.init.Blocks; import net.minecraft.world.World; import net.minecraft.world.biome.BiomeGenBase; -import net.minecraft.world.biome.BiomeGenForest; import net.minecraft.world.chunk.Chunk; import net.minecraft.world.chunk.IChunkProvider; import net.minecraft.world.gen.ChunkProviderGenerate; import net.minecraft.world.gen.MapGenBase; import net.minecraft.world.gen.MapGenCaves; import net.minecraft.world.gen.MapGenRavine; -import net.minecraft.world.gen.feature.WorldGenCanopyTree; import net.minecraft.world.gen.feature.WorldGenLakes; import net.minecraftforge.common.MinecraftForge; import net.minecraftforge.event.terraingen.PopulateChunkEvent; @@ -51,37 +47,35 @@ import static net.minecraftforge.event.terraingen.PopulateChunkEvent.Populate.Ev import static net.minecraftforge.event.terraingen.PopulateChunkEvent.Populate.EventType.LAKE; public class ChunkProviderRoss128b extends ChunkProviderGenerate { + XSTR rand = new XSTR(); private BiomeGenBase[] biomesForGeneration; - private BW_WordGenerator BWOreGen = new BW_WordGenerator(); - XSTR rand = new XSTR(); private World worldObj; private MapGenBase caveGenerator = new MapGenCaves(); private MapGenBase ravineGenerator = new MapGenRavine(); public ChunkProviderRoss128b(World par1World, long seed, boolean mapFeaturesEnabled) { super(par1World, seed, mapFeaturesEnabled); - worldObj=par1World; + worldObj = par1World; } @Override public List getPossibleCreatures(EnumCreatureType p_73155_1_, int p_73155_2_, int p_73155_3_, int p_73155_4_) { - return super.getPossibleCreatures(p_73155_1_, p_73155_2_, p_73155_3_, p_73155_4_); + return null; } - public Chunk provideChunk(int p_73154_1_, int p_73154_2_) - { - this.rand.setSeed((long)p_73154_1_ * 341873128712L + (long)p_73154_2_ * 132897987541L); + public Chunk provideChunk(int p_73154_1_, int p_73154_2_) { + this.rand.setSeed((long) p_73154_1_ * 341873128712L + (long) p_73154_2_ * 132897987541L); Block[] ablock = new Block[65536]; byte[] abyte = new byte[65536]; this.func_147424_a(p_73154_1_, p_73154_2_, ablock); this.biomesForGeneration = this.worldObj.getWorldChunkManager().loadBlockGeneratorData(this.biomesForGeneration, p_73154_1_ * 16, p_73154_2_ * 16, 16, 16); for (int i = 0; i < biomesForGeneration.length; i++) { BiomeGenBase biomeGenBase = biomesForGeneration[i]; - if (biomeGenBase.biomeID == BiomeGenBase.mushroomIsland.biomeID ){ - this.biomesForGeneration[i]=BiomeGenBase.taiga; - } else if (biomeGenBase.biomeID == BiomeGenBase.mushroomIslandShore.biomeID){ - this.biomesForGeneration[i]=BiomeGenBase.stoneBeach; + if (biomeGenBase.biomeID == BiomeGenBase.mushroomIsland.biomeID) { + this.biomesForGeneration[i] = BiomeGenBase.taiga; + } else if (biomeGenBase.biomeID == BiomeGenBase.mushroomIslandShore.biomeID) { + this.biomesForGeneration[i] = BiomeGenBase.stoneBeach; } } this.replaceBlocksForBiome(p_73154_1_, p_73154_2_, ablock, abyte, this.biomesForGeneration); @@ -91,9 +85,8 @@ public class ChunkProviderRoss128b extends ChunkProviderGenerate { Chunk chunk = new Chunk(this.worldObj, ablock, abyte, p_73154_1_, p_73154_2_); byte[] abyte1 = chunk.getBiomeArray(); - for (int k = 0; k < abyte1.length; ++k) - { - abyte1[k] = (byte)this.biomesForGeneration[k].biomeID; + for (int k = 0; k < abyte1.length; ++k) { + abyte1[k] = (byte) this.biomesForGeneration[k].biomeID; } chunk.generateSkylightMap(); @@ -101,14 +94,13 @@ public class ChunkProviderRoss128b extends ChunkProviderGenerate { } @Override - public void populate(IChunkProvider p_73153_1_, int p_73153_2_, int p_73153_3_) - { + public void populate(IChunkProvider p_73153_1_, int p_73153_2_, int p_73153_3_) { BlockFalling.fallInstantly = true; int k = p_73153_2_ * 16; int l = p_73153_3_ * 16; BiomeGenBase biomegenbase = this.worldObj.getBiomeGenForCoords(k + 16, l + 16); this.rand.setSeed(this.worldObj.getSeed()); - if (p_73153_2_%4==0 || p_73153_3_%4==0 ) { + if (p_73153_2_ % 4 == 0 || p_73153_3_ % 4 == 0) { long i1 = this.rand.nextLong() / 2L * 2L + 1L; long j1 = this.rand.nextLong() / 2L * 2L + 1L; this.rand.setSeed((long) p_73153_2_ * i1 + (long) p_73153_3_ * j1 ^ this.worldObj.getSeed()); @@ -122,8 +114,7 @@ public class ChunkProviderRoss128b extends ChunkProviderGenerate { int i2; if (biomegenbase != BiomeGenBase.desert && biomegenbase != BiomeGenBase.desertHills && !flag && this.rand.nextInt(4) == 0 - && TerrainGen.populate(p_73153_1_, worldObj, rand, p_73153_2_, p_73153_3_, flag, LAKE)) - { + && TerrainGen.populate(p_73153_1_, worldObj, rand, p_73153_2_, p_73153_3_, flag, LAKE)) { k1 = k + this.rand.nextInt(16) + 8; l1 = this.rand.nextInt(256); i2 = l + this.rand.nextInt(16) + 8; @@ -136,26 +127,22 @@ public class ChunkProviderRoss128b extends ChunkProviderGenerate { l += 8; boolean doGen = TerrainGen.populate(p_73153_1_, worldObj, rand, p_73153_2_, p_73153_3_, flag, ICE); - for (k1 = 0; doGen && k1 < 16; ++k1) - { - for (l1 = 0; l1 < 16; ++l1) - { + for (k1 = 0; doGen && k1 < 16; ++k1) { + for (l1 = 0; l1 < 16; ++l1) { i2 = this.worldObj.getPrecipitationHeight(k + k1, l + l1); - if (this.worldObj.isBlockFreezable(k1 + k, i2 - 1, l1 + l)) - { + if (this.worldObj.isBlockFreezable(k1 + k, i2 - 1, l1 + l)) { this.worldObj.setBlock(k1 + k, i2 - 1, l1 + l, Blocks.ice, 0, 2); } - if (this.worldObj.func_147478_e(k1 + k, i2, l1 + l, true)) - { + if (this.worldObj.func_147478_e(k1 + k, i2, l1 + l, true)) { this.worldObj.setBlock(k1 + k, i2, l1 + l, Blocks.snow_layer, 0, 2); } } } MinecraftForge.EVENT_BUS.post(new PopulateChunkEvent.Post(p_73153_1_, worldObj, rand, p_73153_2_, p_73153_3_, flag)); - BWOreGen.generate(rand,p_73153_2_,p_73153_3_,worldObj,this,this); + BWOreGen.generate(rand, p_73153_2_, p_73153_3_, worldObj, this, this); BlockFalling.fallInstantly = false; } @@ -165,9 +152,8 @@ public class ChunkProviderRoss128b extends ChunkProviderGenerate { } @Override - public void replaceBlocksForBiome(int p_147422_1_, int p_147422_2_, Block[] blocks, byte[] metas, BiomeGenBase[] p_147422_5_) - { - super.replaceBlocksForBiome(p_147422_1_, p_147422_2_, blocks, metas, p_147422_5_); + public void replaceBlocksForBiome(int p_147422_1_, int p_147422_2_, Block[] blocks, byte[] metas, BiomeGenBase[] p_147422_5_) { + super.replaceBlocksForBiome(p_147422_1_, p_147422_2_, blocks, metas, p_147422_5_); for (int i = 0; i < blocks.length; i++) { // if (blocks[i] == Blocks.stone) { // blocks[i] = Ross128.Ross128bStone.getBlock(); diff --git a/src/main/java/com/github/bartimaeusnek/crossmod/galacticraft/planets/ross128/world/worldprovider/SkyProviderRoss128b.java b/src/main/java/com/github/bartimaeusnek/crossmod/galacticraft/planets/ross128/world/worldprovider/SkyProviderRoss128b.java index a8039d0282..c6785ee78b 100644 --- a/src/main/java/com/github/bartimaeusnek/crossmod/galacticraft/planets/ross128/world/worldprovider/SkyProviderRoss128b.java +++ b/src/main/java/com/github/bartimaeusnek/crossmod/galacticraft/planets/ross128/world/worldprovider/SkyProviderRoss128b.java @@ -29,5 +29,5 @@ import net.minecraft.util.ResourceLocation; public class SkyProviderRoss128b extends SkyProviderOverworld { //ASM enables this texture - public static final ResourceLocation sunTex = new ResourceLocation(BartWorksCrossmod.MOD_ID+":galacticraft/Ross128b/World/SunRoss128.png"); + public static final ResourceLocation sunTex = new ResourceLocation(BartWorksCrossmod.MOD_ID + ":galacticraft/Ross128b/World/SunRoss128.png"); } diff --git a/src/main/java/com/github/bartimaeusnek/crossmod/galacticraft/planets/ross128/world/worldprovider/WorldProviderRoss128b.java b/src/main/java/com/github/bartimaeusnek/crossmod/galacticraft/planets/ross128/world/worldprovider/WorldProviderRoss128b.java index c2b1e9d68a..6ed4b1bc6c 100644 --- a/src/main/java/com/github/bartimaeusnek/crossmod/galacticraft/planets/ross128/world/worldprovider/WorldProviderRoss128b.java +++ b/src/main/java/com/github/bartimaeusnek/crossmod/galacticraft/planets/ross128/world/worldprovider/WorldProviderRoss128b.java @@ -43,26 +43,23 @@ public class WorldProviderRoss128b extends WorldProviderSpace implements IExitHe } @SideOnly(Side.CLIENT) - public Vec3 getFogColor(float cy, float noidea) - { - float angle = MathHelper.cos(cy * (float)Math.PI * 2.0F) * 2.0F + 0.5F; + public Vec3 getFogColor(float cy, float noidea) { + float angle = MathHelper.cos(cy * (float) Math.PI * 2.0F) * 2.0F + 0.5F; - if (angle < 0.0F) - { + if (angle < 0.0F) { angle = 0.0F; } - if (angle > 1.0F) - { + if (angle > 1.0F) { angle = 1.0F; } - float red = 200/255f; - float green = 80/255f; + float red = 200 / 255f; + float green = 80 / 255f; float blue = 0.0F; red *= angle * 0.94F + 0.06F; green *= angle * 0.94F + 0.06F; - return Vec3.createVectorHelper((double)red, (double)green, (double)blue); + return Vec3.createVectorHelper((double) red, (double) green, (double) blue); } @@ -74,7 +71,7 @@ public class WorldProviderRoss128b extends WorldProviderSpace implements IExitHe @Override public float getSunBrightness(float par1) { - return super.getSunBrightness(par1)*0.975f; + return super.getSunBrightness(par1) * 0.975f; } @Override @@ -84,10 +81,10 @@ public class WorldProviderRoss128b extends WorldProviderSpace implements IExitHe @Override public Vector3 getSkyColor() { - float red = 200/255f; - float green = 120/255f; + float red = 200 / 255f; + float green = 120 / 255f; float blue = 0.0F; - return new Vector3(red,green,blue); + return new Vector3(red, green, blue); } @Override @@ -102,7 +99,7 @@ public class WorldProviderRoss128b extends WorldProviderSpace implements IExitHe @Override public long getDayLength() { - return (long) (24000*9.9f); + return (long) (24000 * 9.9f); } @Override diff --git a/src/main/java/com/github/bartimaeusnek/crossmod/galacticraft/solarsystems/Ross128.java b/src/main/java/com/github/bartimaeusnek/crossmod/galacticraft/solarsystems/Ross128.java index 5ce0d75e27..4caa6e02df 100644 --- a/src/main/java/com/github/bartimaeusnek/crossmod/galacticraft/solarsystems/Ross128.java +++ b/src/main/java/com/github/bartimaeusnek/crossmod/galacticraft/solarsystems/Ross128.java @@ -24,33 +24,30 @@ package com.github.bartimaeusnek.crossmod.galacticraft.solarsystems; import com.github.bartimaeusnek.crossmod.BartWorksCrossmod; import com.github.bartimaeusnek.crossmod.galacticraft.UniversalTeleportType; -import com.github.bartimaeusnek.crossmod.galacticraft.blocks.UniversalSpaceBlocks; import com.github.bartimaeusnek.crossmod.galacticraft.planets.ross128.world.worldprovider.WorldProviderRoss128b; import cpw.mods.fml.common.Loader; -import cpw.mods.fml.common.registry.GameRegistry; import micdoodle8.mods.galacticraft.api.GalacticraftRegistry; import micdoodle8.mods.galacticraft.api.galaxies.*; -import micdoodle8.mods.galacticraft.api.prefab.core.BlockMetaPair; import micdoodle8.mods.galacticraft.api.vector.Vector3; import micdoodle8.mods.galacticraft.api.world.IAtmosphericGas; -import micdoodle8.mods.galacticraft.core.GalacticraftCore; -import net.minecraft.block.Block; -import net.minecraft.item.ItemStack; import net.minecraft.util.ResourceLocation; import java.util.Arrays; public class Ross128 { - private Ross128(){} + public static boolean enabled = true; public static SolarSystem Ross128System; public static Star Ross128; public static Planet Ross128b; public static Moon Ross128ba; -// public static Block Ross128bBlocks; + // public static Block Ross128bBlocks; // public static BlockMetaPair Ross128bStone,Ross128bDirt,Ross128bGrass; public static int ross128ID = -64; + private Ross128() { + } + public static void init() { // Ross128bBlocks = new UniversalSpaceBlocks("Ross128bBlocks",new String[]{BartWorksCrossmod.MOD_ID+":Ross128bStone",BartWorksCrossmod.MOD_ID+":Ross128bDirt",BartWorksCrossmod.MOD_ID+":Ross128bGrass"}); @@ -58,22 +55,22 @@ public class Ross128 { Ross128System = new SolarSystem("Ross128System", "milkyWay").setMapPosition(new Vector3(-1.0D, 1.3D, 0.0D)); Ross128 = (Star) new Star("Ross128").setParentSolarSystem(Ross128System).setTierRequired(-1); Ross128.setUnreachable(); - Ross128.setBodyIcon(new ResourceLocation(BartWorksCrossmod.MOD_ID+":galacticraft/Ross128b/MapObjs/Ross128.png")); + Ross128.setBodyIcon(new ResourceLocation(BartWorksCrossmod.MOD_ID + ":galacticraft/Ross128b/MapObjs/Ross128.png")); Ross128System.setMainStar(Ross128); Ross128b = new Planet("Ross128b").setParentSolarSystem(Ross128System); - Ross128b.setRingColorRGB((0x9F)/255f, (0x8A)/255f, (0x79)/255f); + Ross128b.setRingColorRGB((0x9F) / 255f, (0x8A) / 255f, (0x79) / 255f); Ross128b.setPhaseShift(1.25F); - Ross128b.setBodyIcon(new ResourceLocation(BartWorksCrossmod.MOD_ID+":galacticraft/Ross128b/MapObjs/Ross128b.png")); + Ross128b.setBodyIcon(new ResourceLocation(BartWorksCrossmod.MOD_ID + ":galacticraft/Ross128b/MapObjs/Ross128b.png")); Ross128b.setRelativeDistanceFromCenter(new CelestialBody.ScalableDistance(0.75F, 1.75F)); Ross128b.setRelativeOrbitTime(0.65F); - Ross128b.atmosphere.addAll(Arrays.asList(IAtmosphericGas.OXYGEN,IAtmosphericGas.NITROGEN,IAtmosphericGas.ARGON)); + Ross128b.atmosphere.addAll(Arrays.asList(IAtmosphericGas.OXYGEN, IAtmosphericGas.NITROGEN, IAtmosphericGas.ARGON)); Ross128b.setDimensionInfo(ross128ID, WorldProviderRoss128b.class); Ross128b.setTierRequired(Loader.isModLoaded("galaxyspace") ? 4 : Loader.isModLoaded("GalacticraftMars") ? 3 : -1); Ross128ba = new Moon("Ross128ba").setParentPlanet(Ross128b); - Ross128ba.setRelativeDistanceFromCenter(new CelestialBody.ScalableDistance(10f,15f)).setRelativeOrbitTime(1 / 0.01F); - Ross128ba.setBodyIcon(new ResourceLocation(BartWorksCrossmod.MOD_ID+":galacticraft/Ross128b/MapObjs/Ross128ba.png")); + Ross128ba.setRelativeDistanceFromCenter(new CelestialBody.ScalableDistance(10f, 15f)).setRelativeOrbitTime(1 / 0.01F); + Ross128ba.setBodyIcon(new ResourceLocation(BartWorksCrossmod.MOD_ID + ":galacticraft/Ross128b/MapObjs/Ross128ba.png")); Ross128ba.setUnreachable(); //for now // GameRegistry.registerBlock(Ross128bBlocks,Ross128bBlocks.getUnlocalizedName()); |