diff options
| author | bartimaeusnek <33183715+bartimaeusnek@users.noreply.github.com> | 2019-07-12 10:48:46 +0200 |
|---|---|---|
| committer | bartimaeusnek <33183715+bartimaeusnek@users.noreply.github.com> | 2019-07-12 10:48:46 +0200 |
| commit | f70471bab9f21d9073aa184c23a10b3d04d604dd (patch) | |
| tree | fc84b9d868edc63cb59116e7085925c0bd32ce63 /src/main/java/com | |
| parent | ea461ff484bab83c577f481ad21a5c3a2b949acc (diff) | |
| download | GT5-Unofficial-f70471bab9f21d9073aa184c23a10b3d04d604dd.tar.gz GT5-Unofficial-f70471bab9f21d9073aa184c23a10b3d04d604dd.tar.bz2 GT5-Unofficial-f70471bab9f21d9073aa184c23a10b3d04d604dd.zip | |
fixes
+added sub/supercript numbers to Werkstoff
+adjusted ElectricImplosionCompressor times
+added "Creative Debug Scanner" for BlackFlame
+added ingot/nuggets to Werkstoff
+improved Generation Randomness of Ruins
+fixed MegaEBF forming issues
+added an Interface for the Radiation Hatch
+minor API changes
+added Tellurium
Signed-off-by: bartimaeusnek <33183715+bartimaeusnek@users.noreply.github.com>
Former-commit-id: ea498532b67021650b60b739c10ae7bc120ba22a
Diffstat (limited to 'src/main/java/com')
24 files changed, 984 insertions, 94 deletions
diff --git a/src/main/java/com/github/bartimaeusnek/ASM/BWCoreTransformer.java b/src/main/java/com/github/bartimaeusnek/ASM/BWCoreTransformer.java index 1f2d6f942c..d3e3eb727b 100644 --- a/src/main/java/com/github/bartimaeusnek/ASM/BWCoreTransformer.java +++ b/src/main/java/com/github/bartimaeusnek/ASM/BWCoreTransformer.java @@ -24,11 +24,13 @@ package com.github.bartimaeusnek.ASM; import net.minecraft.launchwrapper.IClassTransformer; import net.minecraft.launchwrapper.Launch; +import net.minecraftforge.oredict.OreDictionary; import org.objectweb.asm.ClassReader; import org.objectweb.asm.ClassWriter; import org.objectweb.asm.tree.*; import java.io.File; +import java.io.IOException; import java.util.Arrays; import java.util.List; import java.util.jar.JarFile; @@ -41,12 +43,14 @@ public class BWCoreTransformer implements IClassTransformer { "REMVOING CREATURES FROM LAST MILLENIUM (EXU)", "PATCHING GLOBAL RENDERER FOR USE WITH MY GALACTIC DIMS", "PATCHING THAUMCRAFT WAND PEDESTAL TO PREVENT VIS DUPLICATION", + // "ADD EXECTION HANDLEING TO FIND OREIDS/OREDICT" }; public static final String[] CLASSESBEEINGTRANSFORMED = { "com.rwtema.extrautils.worldgen.endoftime.WorldProviderEndOfTime", "com.rwtema.extrautils.worldgen.endoftime.ChunkProviderEndOfTime", "net.minecraft.client.renderer.RenderGlobal", "thaumcraft.common.tiles.TileWandPedestal", + // "net.minecraftforge.oredict.OreDictionary" }; static boolean obfs; @@ -221,6 +225,148 @@ public class BWCoreTransformer implements IClassTransformer { } break; } + case 4 : { + +// String name_deObfs = "getOreIDs"; +// String dsc_deObfs = "(Lnet/minecraft/item/ItemStack;)[I"; +// String dsc_Obfs = "(Ladd;)[I"; +// +// for (int i = 0; i < methods.size(); i++) { +// if (ASMUtils.isCorrectMethod(methods.get(i), name_deObfs) && ASMUtils.isCorrectMethod(methods.get(i), dsc_deObfs, dsc_Obfs)) { +// MethodNode toPatch = methods.get(i); +// LabelNode[] LabelNodes = {new LabelNode(), new LabelNode(), new LabelNode(),new LabelNode(),new LabelNode(),new LabelNode(),new LabelNode()}; +// InsnList nu = new InsnList(); +// nu.add(new VarInsnNode(ALOAD, 0)); +// nu.add(new JumpInsnNode(IFNULL, LabelNodes[0])); //L1 +// nu.add(new VarInsnNode(ALOAD, 0)); +// nu.add(new MethodInsnNode(INVOKEVIRTUAL, "net/minecraft/item/ItemStack", "getItem", "()Lnet/minecraft/item/Item;", false)); +// nu.add(new JumpInsnNode(IFNONNULL, LabelNodes[1])); //L2 +// nu.add(LabelNodes[0]); //L1 +// nu.add(new TypeInsnNode(NEW, "java/lang/IllegalArgumentException")); +// nu.add(new InsnNode(DUP)); +// nu.add(new TypeInsnNode(LDC,"Stack can not be invalid!")); +// nu.add(new MethodInsnNode(INVOKEVIRTUAL,"java/lang/IllegalArgumentException","<init>","(Ljava/lang/String;)V",false)); +// nu.add(new InsnNode(ATHROW)); +// nu.add(LabelNodes[1]); //L2 +// nu.add(new TypeInsnNode(NEW, "java/util/HashSet")); +// nu.add(new InsnNode(DUP)); +// nu.add(new MethodInsnNode(INVOKEVIRTUAL,"java/util/HashSet","<init>","()V",false)); +// nu.add(new VarInsnNode(ASTORE, 1)); +// nu.add(new VarInsnNode(ALOAD, 0)); +// nu.add(new MethodInsnNode(INVOKEVIRTUAL, "net/minecraft/item/ItemStack", "getItem", "()Lnet/minecraft/item/Item;", false)); +// nu.add(new FieldInsnNode(GETFIELD,"net/minecraft/item/Item","delegate","Lcpw/mods/fml/common/registry/RegistryDelegate;")); +// nu.add(new MethodInsnNode(INVOKEINTERFACE, "cpw/mods/fml/common/registry/RegistryDelegate", "name", "()Ljava/lang/String;", true)); +// nu.add(new VarInsnNode(ASTORE, 2)); +// nu.add(new VarInsnNode(ALOAD, 2)); +// nu.add(new JumpInsnNode(IFNONNULL, LabelNodes[2])); //L5 +// nu.add(new FieldInsnNode(GETSTATIC,"org/apache/logging/log4j/Level","DEBUG","Lorg/apache/logging/log4j/Level;")); +// nu.add(new TypeInsnNode(LDC,"Attempted to find the oreIDs for an unregistered object (%s). This won't work very well.")); +// nu.add(new InsnNode(ICONST_1)); +// nu.add(new TypeInsnNode(ANEWARRAY,"java/lang/Object")); +// nu.add(new InsnNode(DUP)); +// nu.add(new InsnNode(ICONST_0)); +// nu.add(new VarInsnNode(ALOAD, 0)); +// nu.add(new InsnNode(AASTORE)); +// nu.add(new MethodInsnNode(INVOKESTATIC, "cpw/mods/fml/common/FMLLog", "log", "(Lorg/apache/logging/log4j/Level;Ljava/lang/String;[Ljava/lang/Object;)V", false)); +// nu.add(new TypeInsnNode(NEW, "java/io/StringWriter")); +// nu.add(new InsnNode(DUP)); +// nu.add(new MethodInsnNode(INVOKESPECIAL, "java/io/StringWriter", "<init>", "()V", false)); +// nu.add(new VarInsnNode(ASTORE, 4)); +// nu.add(new TypeInsnNode(NEW, "java/io/PrintWriter")); +// nu.add(new InsnNode(DUP)); +// nu.add(new VarInsnNode(ALOAD, 4)); +// nu.add(new MethodInsnNode(INVOKESPECIAL, "java/io/PrintWriter", "<init>", "(Ljava/io/Writer;)V", false)); +// nu.add(new VarInsnNode(ASTORE, 5)); +// nu.add(new TypeInsnNode(NEW, "java/lang/Exception")); +// nu.add(new InsnNode(DUP)); +// nu.add(new TypeInsnNode(LDC,"FINDME!")); +// nu.add(new MethodInsnNode(INVOKESPECIAL, "java/lang/Exception", "<init>", "(Ljava/lang/String;)V", false)); +// nu.add(new VarInsnNode(ALOAD, 5)); +// nu.add(new MethodInsnNode(INVOKEVIRTUAL, "java/lang/Exception", "printStackTrace", "(Ljava/io/PrintWriter;)V", false)); +// nu.add(new FieldInsnNode(GETSTATIC,"org/apache/logging/log4j/Level","DEBUG","Lorg/apache/logging/log4j/Level;")); +// nu.add(new VarInsnNode(ALOAD, 5)); +// nu.add(new MethodInsnNode(INVOKEVIRTUAL, "java/lang/Object", "toString", "()Ljava/lang/String;", false)); +// nu.add(new InsnNode(ICONST_0)); +// nu.add(new TypeInsnNode(ANEWARRAY,"java/lang/Object")); +// nu.add(new MethodInsnNode(INVOKESTATIC, "cpw/mods/fml/common/FMLLog", "log", "(Lorg/apache/logging/log4j/Level;Ljava/lang/String;[Ljava/lang/Object;)V", false)); +// nu.add(new InsnNode(ICONST_0)); +// nu.add(new IntInsnNode(NEWARRAY,T_INT)); +// nu.add(new InsnNode(ARETURN)); +// nu.add(LabelNodes[2]); //L5 +// nu.add(new MethodInsnNode(INVOKESTATIC, "cpw/mods/fml/common/registry/GameData", "getItemRegistry", "()Lcpw/mods/fml/common/registry/FMLControlledNamespacedRegistry;", false)); +// nu.add(new VarInsnNode(ALOAD, 2)); +// nu.add(new MethodInsnNode(INVOKEVIRTUAL, "cpw/mods/fml/common/registry/FMLControlledNamespacedRegistry", "getId", "(Ljava/lang/String;)I", false)); +// nu.add(new VarInsnNode(ISTORE, 3)); +// nu.add(new FieldInsnNode(GETSTATIC,"net/minecraftforge/oredict/OreDictionary","stackToId","Ljava/util/Map;")); +// nu.add(new VarInsnNode(ILOAD, 3)); +// nu.add(new MethodInsnNode(INVOKESTATIC, "java/lang/Integer", "valueOf", "(I)Ljava/lang/Integer;", false)); +// nu.add(new MethodInsnNode(INVOKEINTERFACE, "java/util/Map", "get", "(Ljava/lang/Object;)Ljava/lang/Object;", false)); +// nu.add(new TypeInsnNode(CHECKCAST,"java/util/List")); +// nu.add(new VarInsnNode(ASTORE, 4)); +// nu.add(new VarInsnNode(ALOAD, 4)); +// nu.add(new JumpInsnNode(IFNULL, LabelNodes[3])); //L14 +// nu.add(new VarInsnNode(ALOAD, 1)); +// nu.add(new VarInsnNode(ALOAD, 4)); +// nu.add(new MethodInsnNode(INVOKEINTERFACE, "java/util/Set", "addAll", "(Ljava/util/Collection;)Z", true)); +// nu.add(new InsnNode(POP)); +// nu.add(LabelNodes[3]); //L14 +// nu.add(new FieldInsnNode(GETSTATIC,"net/minecraftforge/oredict/OreDictionary","stackToId","Ljava/util/Map;")); +// nu.add(new VarInsnNode(ILOAD, 3)); +// nu.add(new VarInsnNode(ALOAD, 0)); +// nu.add(new MethodInsnNode(INVOKEVIRTUAL, "net/minecraft/item/ItemStack", "getItemDamage", "()I", false)); +// nu.add(new InsnNode(ICONST_1)); +// nu.add(new InsnNode(IADD)); +// nu.add(new VarInsnNode(BIPUSH, 16)); +// nu.add(new InsnNode(ISHL)); +// nu.add(new InsnNode(IOR)); +// nu.add(new MethodInsnNode(INVOKESTATIC, "java/lang/Integer", "valueOf", "(I)Ljava/lang/Integer;", false)); +// nu.add(new MethodInsnNode(INVOKEINTERFACE, "java/util/Map", "get", "(Ljava/lang/Object;)Ljava/lang/Object;", true)); +// nu.add(new TypeInsnNode(CHECKCAST,"java/util/List")); +// nu.add(new VarInsnNode(ASTORE, 4)); +// nu.add(new VarInsnNode(ALOAD, 4)); +// nu.add(new JumpInsnNode(IFNULL, LabelNodes[4])); //L16 +// nu.add(new VarInsnNode(ALOAD, 1)); +// nu.add(new VarInsnNode(ALOAD, 4)); +// nu.add(new MethodInsnNode(INVOKEINTERFACE, "java/util/Set", "addAll", "(Ljava/util/Collection;)Z", true)); +// nu.add(new InsnNode(POP)); +// nu.add(LabelNodes[4]); //L16 +// nu.add(new VarInsnNode(ALOAD, 1)); +// nu.add(new VarInsnNode(ALOAD, 1)); +// nu.add(new MethodInsnNode(INVOKEINTERFACE, "java/util/Set", "size", "()I", true)); +// nu.add(new TypeInsnNode(ANEWARRAY,"java/lang/Integer")); +// nu.add(new MethodInsnNode(INVOKEINTERFACE, "java/util/Set", "toArray", "([Ljava/lang/Object;)[Ljava/lang/Object;", true)); +// nu.add(new TypeInsnNode(CHECKCAST,"[java/util/Integer")); +// nu.add(new VarInsnNode(ASTORE, 5)); +// nu.add(new VarInsnNode(ALOAD, 5)); +// nu.add(new InsnNode(ARRAYLENGTH)); +// nu.add(new IntInsnNode(NEWARRAY,T_INT)); +// nu.add(new VarInsnNode(ASTORE, 6)); +// nu.add(new InsnNode(ICONST_0)); +// nu.add(new VarInsnNode(ISTORE, 7)); +// nu.add(LabelNodes[6]); //L19 +// nu.add(new VarInsnNode(ILOAD, 7)); +// nu.add(new VarInsnNode(ALOAD, 5)); +// nu.add(new InsnNode(ARRAYLENGTH)); +// nu.add(new JumpInsnNode(IF_ICMPGE, LabelNodes[5])); //L20 +// nu.add(new VarInsnNode(ALOAD, 6)); +// nu.add(new VarInsnNode(ILOAD, 7)); +// nu.add(new VarInsnNode(ALOAD, 5)); +// nu.add(new VarInsnNode(ILOAD, 7)); +// nu.add(new InsnNode(AALOAD)); +// nu.add(new MethodInsnNode(INVOKEVIRTUAL, "java/lang/Integer", "intValue", "()I", false)); +// nu.add(new InsnNode(IASTORE)); +// nu.add(new IincInsnNode(7,1)); +// nu.add(new JumpInsnNode(GOTO, LabelNodes[6])); //L19 +// nu.add(LabelNodes[5]); //L20 +// nu.add(new VarInsnNode(ALOAD, 6)); +// nu.add(new InsnNode(ARETURN)); +// toPatch.instructions = nu; +// toPatch.maxStack = 6; +// toPatch.maxLocals = 8; +// methods.set(i, toPatch); +// break; +// } + } default: { BWCore.BWCORE_LOG.info("Could not find: " + BWCoreTransformer.CLASSESBEEINGTRANSFORMED[id]); return basicClass; @@ -233,7 +379,6 @@ public class BWCoreTransformer implements IClassTransformer { byte[] ret = classWriter.toByteArray(); if (Arrays.hashCode(basicClass) == Arrays.hashCode(ret)) BWCore.BWCORE_LOG.warn("Could not patch: " + BWCoreTransformer.CLASSESBEEINGTRANSFORMED[id]); - return ret; } 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 3dcd7596fb..a3c33ceac9 100644 --- a/src/main/java/com/github/bartimaeusnek/bartworks/API/BioObjectAdder.java +++ b/src/main/java/com/github/bartimaeusnek/bartworks/API/BioObjectAdder.java @@ -26,9 +26,14 @@ import com.github.bartimaeusnek.bartworks.util.BioCulture; import com.github.bartimaeusnek.bartworks.util.BioDNA; import com.github.bartimaeusnek.bartworks.util.BioData; import com.github.bartimaeusnek.bartworks.util.BioPlasmid; +import cpw.mods.fml.common.Loader; +import gregtech.api.enums.GT_Values; +import gregtech.api.enums.Materials; import gregtech.api.objects.GT_Fluid; +import gregtech.api.util.GT_Utility; import net.minecraft.item.EnumRarity; import net.minecraftforge.fluids.FluidRegistry; +import net.minecraftforge.fluids.FluidStack; import java.awt.*; @@ -158,11 +163,13 @@ public final class BioObjectAdder { * 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() { + FluidStack dnaFluid = Loader.isModLoaded("gendustry") ? FluidRegistry.getFluidStack("liquiddna", 100) : Materials.Biomass.getFluid(100L); 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(); + GT_Values.RA.addCentrifugeRecipe(GT_Utility.getIntegratedCircuit(10),GT_Values.NI,new FluidStack(B.getFluid(),1000),dnaFluid,GT_Values.NI,GT_Values.NI,GT_Values.NI,GT_Values.NI,GT_Values.NI,GT_Values.NI,null,500,120); } } } diff --git a/src/main/java/com/github/bartimaeusnek/bartworks/API/BioObjectGetter.java b/src/main/java/com/github/bartimaeusnek/bartworks/API/BioObjectGetter.java index 86ec61c138..edee87f534 100644 --- a/src/main/java/com/github/bartimaeusnek/bartworks/API/BioObjectGetter.java +++ b/src/main/java/com/github/bartimaeusnek/bartworks/API/BioObjectGetter.java @@ -43,11 +43,11 @@ public final class BioObjectGetter { } public static NBTTagCompound getNBTTagFromBioPlasmid(BioPlasmid bioPlasmid) { - return getNBTTagFromBioData(convertBioPlasmidToData(bioPlasmid)); + return BioObjectGetter.getNBTTagFromBioData(BioObjectGetter.convertBioPlasmidToData(bioPlasmid)); } public static NBTTagCompound getNBTTagFromBioDNA(BioDNA bioDNA) { - return getNBTTagFromBioData(convertBioDNAtoData(bioDNA)); + return BioObjectGetter.getNBTTagFromBioData(BioObjectGetter.convertBioDNAtoData(bioDNA)); } public static NBTTagCompound getNBTTagFromBioData(BioData bioData) { @@ -75,11 +75,11 @@ public final class BioObjectGetter { } public static BioPlasmid convertBioDNAtoBioPlasmid(BioDNA bioDNA) { - return convertDataToPlasmid(convertBioDNAtoData(bioDNA)); + return BioObjectGetter.convertDataToPlasmid(BioObjectGetter.convertBioDNAtoData(bioDNA)); } public static BioDNA convertBioPlasmidtoBioDNA(BioPlasmid bioPlasmid) { - return convertDataToDNA(convertBioPlasmidToData(bioPlasmid)); + return BioObjectGetter.convertDataToDNA(BioObjectGetter.convertBioPlasmidToData(bioPlasmid)); } public static Collection<ItemStack> getAllPetriDishes() { diff --git a/src/main/java/com/github/bartimaeusnek/bartworks/API/BioVatLogicAdder.java b/src/main/java/com/github/bartimaeusnek/bartworks/API/BioVatLogicAdder.java index 81b0d894af..a8fc8dae91 100644 --- a/src/main/java/com/github/bartimaeusnek/bartworks/API/BioVatLogicAdder.java +++ b/src/main/java/com/github/bartimaeusnek/bartworks/API/BioVatLogicAdder.java @@ -60,8 +60,10 @@ public final class BioVatLogicAdder { IsSv.put(stack, sv); } + public static int MaxSV = 150; + public static int getMaxSv() { - int ret = 150; + int ret = MaxSV; Iterator it = BioVatLogicAdder.RadioHatch.getMaSv().iterator(); while (it.hasNext()) { BioVatLogicAdder.MaterialSvPair pair = (BioVatLogicAdder.MaterialSvPair) it.next(); diff --git a/src/main/java/com/github/bartimaeusnek/bartworks/API/IRadMaterial.java b/src/main/java/com/github/bartimaeusnek/bartworks/API/IRadMaterial.java new file mode 100644 index 0000000000..391593d217 --- /dev/null +++ b/src/main/java/com/github/bartimaeusnek/bartworks/API/IRadMaterial.java @@ -0,0 +1,48 @@ +/* + * 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.bartworks.API; + +import net.minecraft.item.ItemStack; + +public interface IRadMaterial { + + /** + * @return the amount of Radiation (0-150, commonly, higher values are possible but not recommended!) + */ + int getRadiationLevel(ItemStack aStack); + + /** + * @return 1 for stick, 2 for long rods, 3 for fuel rods + */ + byte getAmountOfMaterial(ItemStack aStack); + + /** + * @return the color of the material for display purposes + */ + short[] getColorForGUI(ItemStack aStack); + + /** + * @return the name of the material for display purposes + */ + String getNameForGUI(ItemStack aStack); +} diff --git a/src/main/java/com/github/bartimaeusnek/bartworks/API/WerkstoffAPI.java b/src/main/java/com/github/bartimaeusnek/bartworks/API/WerkstoffAPI.java new file mode 100644 index 0000000000..a441e38e35 --- /dev/null +++ b/src/main/java/com/github/bartimaeusnek/bartworks/API/WerkstoffAPI.java @@ -0,0 +1,34 @@ +/* + * 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.bartworks.API; + +import com.github.bartimaeusnek.bartworks.system.material.Werkstoff; + +public final class WerkstoffAPI { + + public Werkstoff getWerkstoff(String aName) throws NoSuchFieldException, IllegalAccessException, ClassNotFoundException { + Class w = Class.forName("com.github.bartimaeusnek.bartworks.system.material.WerkstoffLoader"); + return (Werkstoff) w.getField(aName).get(w); + } + +} diff --git a/src/main/java/com/github/bartimaeusnek/bartworks/MainMod.java b/src/main/java/com/github/bartimaeusnek/bartworks/MainMod.java index 8bc304e41d..297abb2ca2 100644 --- a/src/main/java/com/github/bartimaeusnek/bartworks/MainMod.java +++ b/src/main/java/com/github/bartimaeusnek/bartworks/MainMod.java @@ -30,10 +30,7 @@ import com.github.bartimaeusnek.bartworks.client.creativetabs.BioTab; import com.github.bartimaeusnek.bartworks.client.creativetabs.GT2Tab; import com.github.bartimaeusnek.bartworks.client.creativetabs.bartworksTab; import com.github.bartimaeusnek.bartworks.common.configs.ConfigHandler; -import com.github.bartimaeusnek.bartworks.common.loaders.BioCultureLoader; -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.loaders.*; import com.github.bartimaeusnek.bartworks.common.net.BW_Network; import com.github.bartimaeusnek.bartworks.server.EventHandler.ServerEventHandler; import com.github.bartimaeusnek.bartworks.system.log.DebugLog; @@ -160,8 +157,13 @@ public final class MainMod { public void onServerStarted(FMLServerStartedEvent event) { OreDictHandler.adaptCacheForWorld(); WerkstoffLoader.removeIC2Recipes(); + this.addElectricImplosionCompressorRecipes(); + new CircuitImprintLoader().run(); + } + + private void addElectricImplosionCompressorRecipes(){ if (eicMap == null) { - 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); + eicMap = new GT_Recipe.GT_Recipe_Map(new HashSet<GT_Recipe>(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); recipeLoop: for (GT_Recipe recipe : GT_Recipe.GT_Recipe_Map.sImplosionRecipes.mRecipeList) { if (recipe == null || recipe.mInputs == null) @@ -169,23 +171,20 @@ public final class MainMod { try { ItemStack input = recipe.mInputs[0]; int i = 0; - float durMod = 0; if (this.checkForExplosives(recipe.mInputs[1])) { - if (GT_Utility.areStacksEqual(recipe.mInputs[1], GT_ModHandler.getIC2Item("industrialTnt", 1L))) - durMod += ((float) input.stackSize * 2f); - else - continue; + continue; } while (this.checkForExplosives(input)) { - if (GT_Utility.areStacksEqual(input, GT_ModHandler.getIC2Item("industrialTnt", 1L))) - durMod += ((float) input.stackSize * 2f); + if (GT_Utility.areStacksEqual(input, GT_ModHandler.getIC2Item("industrialTnt", 1L))) { + i++; + input = recipe.mInputs[i]; + } else continue recipeLoop; - i++; - input = recipe.mInputs[i]; + } - eicMap.addRecipe(true, new ItemStack[]{input}, recipe.mOutputs, null, null, null, (int) Math.floor(Math.max((float) recipe.mDuration * durMod, 20f)), BW_Util.getMachineVoltageFromTier(10), 0); + eicMap.addRecipe(true, new ItemStack[]{input}, recipe.mOutputs, null, null, null, recipe.mDuration, BW_Util.getMachineVoltageFromTier(10), 0); } catch (ArrayIndexOutOfBoundsException e) { MainMod.LOGGER.error("CAUGHT DEFECTIVE IMPLOSION COMPRESSOR RECIPE!"); e.printStackTrace(); @@ -197,4 +196,5 @@ public final class MainMod { 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/common/configs/ConfigHandler.java b/src/main/java/com/github/bartimaeusnek/bartworks/common/configs/ConfigHandler.java index c52c56b8c8..3ecfd658b3 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 @@ -42,6 +42,7 @@ public class ConfigHandler { public static int ross128batier = 3; public static int landerType = 3; public static int ross128bRuinChance = 512; + public static int creativeScannerID = 0; public static long energyPerCell = 1000000L; @@ -63,7 +64,7 @@ public class ConfigHandler { public ConfigHandler(Configuration C) { ConfigHandler.c = C; - + ConfigHandler.creativeScannerID = ConfigHandler.c.get("System", "Creative Debug Scanner", 0, "ID for the Creative Debug Scanner Block").getInt(0); ConfigHandler.tooltips = ConfigHandler.c.get("System", "BartWorksToolTips", true, "If you wish to enable extra tooltips").getBoolean(true); ConfigHandler.IDOffset = ConfigHandler.c.get("System", "ID Offset", 12600, "ID Offset for this mod. This Mod uses " + ConfigHandler.IDU + " IDs. DO NOT CHANGE IF YOU DONT KNOW WHAT THIS IS").getInt(12600); ConfigHandler.energyPerCell = ConfigHandler.c.get("Multiblocks", "energyPerLESUCell", 1000000, "This will set Up the Energy per LESU Cell", 1000000, Integer.MAX_VALUE).getInt(1000000); diff --git a/src/main/java/com/github/bartimaeusnek/bartworks/common/loaders/CircuitImprintLoader.java b/src/main/java/com/github/bartimaeusnek/bartworks/common/loaders/CircuitImprintLoader.java new file mode 100644 index 0000000000..97cc8e3c85 --- /dev/null +++ b/src/main/java/com/github/bartimaeusnek/bartworks/common/loaders/CircuitImprintLoader.java @@ -0,0 +1,43 @@ +/* + * 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.bartworks.common.loaders; + +import net.minecraft.item.ItemStack; +import net.minecraft.nbt.NBTTagCompound; +import net.minecraftforge.oredict.OreDictionary; + +import java.util.HashSet; + +public class CircuitImprintLoader implements Runnable { + + private static HashSet<NBTTagCompound> circuitTypes = new HashSet<>(); + + @Override + public void run() { + for(String names : OreDictionary.getOreNames()){ + if (names.contains("circuit") || names.contains("Circuit")) + for (ItemStack itemStack : OreDictionary.getOres(names)) + CircuitImprintLoader.circuitTypes.add(itemStack.copy().splitStack(1).writeToNBT(new NBTTagCompound())); + } + } +} 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 1b56e588c5..8285eb9789 100644 --- a/src/main/java/com/github/bartimaeusnek/bartworks/common/loaders/FluidLoader.java +++ b/ |
