From f70471bab9f21d9073aa184c23a10b3d04d604dd Mon Sep 17 00:00:00 2001 From: bartimaeusnek <33183715+bartimaeusnek@users.noreply.github.com> Date: Fri, 12 Jul 2019 10:48:46 +0200 Subject: 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 --- .../bartimaeusnek/ASM/BWCoreTransformer.java | 147 ++++++++++++++++++++- .../bartworks/API/BioObjectAdder.java | 7 + .../bartworks/API/BioObjectGetter.java | 8 +- .../bartworks/API/BioVatLogicAdder.java | 4 +- .../bartimaeusnek/bartworks/API/IRadMaterial.java | 48 +++++++ .../bartimaeusnek/bartworks/API/WerkstoffAPI.java | 34 +++++ .../github/bartimaeusnek/bartworks/MainMod.java | 30 ++--- .../bartworks/common/configs/ConfigHandler.java | 3 +- .../common/loaders/CircuitImprintLoader.java | 43 ++++++ .../bartworks/common/loaders/FluidLoader.java | 7 +- .../bartworks/common/loaders/ItemRegistry.java | 3 + .../common/tileentities/debug/CreativeScanner.java | 50 +++++++ .../multis/GT_TileEntity_CircuitAssemblyLine.java | 142 ++++++++++++++++++++ .../mega/GT_TileEntity_MegaBlastFurnace.java | 19 ++- .../tiered/GT_MetaTileEntity_RadioHatch.java | 19 +++ .../system/material/BW_MetaGeneratedOreTE.java | 3 +- .../system/material/BW_MetaGeneratedOre_Item.java | 16 +++ .../system/material/BW_MetaGenerated_Items.java | 56 +++++++- .../bartworks/system/material/Werkstoff.java | 45 ++++++- .../bartworks/system/material/WerkstoffLoader.java | 146 ++++++++++++++------ .../processingLoaders/AdditionalRecipes.java | 7 +- .../bartworks/system/object/AbstractedStack.java | 88 ++++++++++++ .../bartworks/system/worldgen/MapGenRuins.java | 16 ++- .../bartimaeusnek/bartworks/util/BW_Util.java | 137 +++++++++++++++++-- 24 files changed, 984 insertions(+), 94 deletions(-) create mode 100644 src/main/java/com/github/bartimaeusnek/bartworks/API/IRadMaterial.java create mode 100644 src/main/java/com/github/bartimaeusnek/bartworks/API/WerkstoffAPI.java create mode 100644 src/main/java/com/github/bartimaeusnek/bartworks/common/loaders/CircuitImprintLoader.java create mode 100644 src/main/java/com/github/bartimaeusnek/bartworks/common/tileentities/debug/CreativeScanner.java create mode 100644 src/main/java/com/github/bartimaeusnek/bartworks/common/tileentities/multis/GT_TileEntity_CircuitAssemblyLine.java create mode 100644 src/main/java/com/github/bartimaeusnek/bartworks/system/object/AbstractedStack.java (limited to 'src/main/java') 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","","(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","","()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", "", "()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", "", "(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", "", "(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 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_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 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/src/main/java/com/github/bartimaeusnek/bartworks/common/loaders/FluidLoader.java @@ -29,8 +29,12 @@ import com.github.bartimaeusnek.bartworks.common.tileentities.classic.BWTileEnti import com.github.bartimaeusnek.bartworks.util.BioCulture; import cpw.mods.fml.client.registry.RenderingRegistry; import cpw.mods.fml.common.FMLCommonHandler; +import cpw.mods.fml.common.Loader; import cpw.mods.fml.common.registry.GameRegistry; +import gregtech.api.enums.GT_Values; +import gregtech.api.enums.Materials; import gregtech.api.objects.GT_Fluid; +import gregtech.api.util.GT_Utility; import ic2.core.item.ItemFluidCell; import net.minecraft.block.Block; import net.minecraft.item.ItemStack; @@ -70,11 +74,12 @@ public class FluidLoader implements Runnable { } // BioCulture.BIO_CULTURE_ARRAY_LIST.get(0).setFluid(new GT_Fluid("_NULL", "molten.autogenerated", BW_Util.splitColorToRBGArray(BioCulture.BIO_CULTURE_ARRAY_LIST.get(0).getColorRGB()))); - + FluidStack dnaFluid = Loader.isModLoaded("gendustry") ? FluidRegistry.getFluidStack("liquiddna", 100) : Materials.Biomass.getFluid(100L); for (BioCulture B : BioCulture.BIO_CULTURE_ARRAY_LIST) { if (B.isBreedable()) { 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()})); FluidRegistry.registerFluid(B.getFluid()); + 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/common/loaders/ItemRegistry.java b/src/main/java/com/github/bartimaeusnek/bartworks/common/loaders/ItemRegistry.java index 37e55107a7..faf503d33f 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 @@ -31,6 +31,7 @@ import com.github.bartimaeusnek.bartworks.common.items.*; import com.github.bartimaeusnek.bartworks.common.tileentities.classic.BW_RotorBlock; import com.github.bartimaeusnek.bartworks.common.tileentities.classic.BW_TileEntity_ExperimentalFloodGate; import com.github.bartimaeusnek.bartworks.common.tileentities.classic.BW_TileEntity_HeatedWaterPump; +import com.github.bartimaeusnek.bartworks.common.tileentities.debug.CreativeScanner; import com.github.bartimaeusnek.bartworks.common.tileentities.multis.GT_TileEntity_DEHP; import com.github.bartimaeusnek.bartworks.common.tileentities.multis.GT_TileEntity_ElectricImplosionCompressor; import com.github.bartimaeusnek.bartworks.common.tileentities.multis.GT_TileEntity_THTR; @@ -138,6 +139,8 @@ public class ItemRegistry { public static void run() { if (newStuff) { + if (ConfigHandler.creativeScannerID != 0) + new CreativeScanner(ConfigHandler.creativeScannerID,"ZPM Creative Debug Scanner","ZPM Creative Debug Scanner",7); ItemRegistry.eic = new GT_TileEntity_ElectricImplosionCompressor(ConfigHandler.IDOffset + GT_Values.VN.length * 8 + 6, "ElectricImplosionCompressor", "Electric Implosion Compressor").getStackForm(1L); ItemRegistry.thtr = new GT_TileEntity_THTR(ConfigHandler.IDOffset + GT_Values.VN.length * 8 + 5, "THTR", "Thorium High Temperature Reactor").getStackForm(1L); GT_TileEntity_THTR.THTRMaterials.registeraTHR_Materials(); diff --git a/src/main/java/com/github/bartimaeusnek/bartworks/common/tileentities/debug/CreativeScanner.java b/src/main/java/com/github/bartimaeusnek/bartworks/common/tileentities/debug/CreativeScanner.java new file mode 100644 index 0000000000..323a009d0a --- /dev/null +++ b/src/main/java/com/github/bartimaeusnek/bartworks/common/tileentities/debug/CreativeScanner.java @@ -0,0 +1,50 @@ +/* + * 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.tileentities.debug; + +import gregtech.api.interfaces.ITexture; +import gregtech.api.interfaces.tileentity.IGregTechTileEntity; +import gregtech.api.metatileentity.MetaTileEntity; +import gregtech.common.tileentities.machines.basic.GT_MetaTileEntity_Scanner; + +public class CreativeScanner extends GT_MetaTileEntity_Scanner { + public CreativeScanner(int aID, String aName, String aNameRegional, int aTier) { + super(aID, aName, aNameRegional, aTier); + } + + public CreativeScanner(String aName, int aTier, String[] aDescription, ITexture[][][] aTextures, String aGUIName, String aNEIName) { + super(aName, aTier, aDescription, aTextures, aGUIName, aNEIName); + } + + @Override + public MetaTileEntity newMetaEntity(IGregTechTileEntity aTileEntity) { + return new CreativeScanner(this.mName, this.mTier, this.mDescriptionArray, this.mTextures, this.mGUIName, this.mNEIName); + } + + @Override + public void onPostTick(IGregTechTileEntity aBaseMetaTileEntity, long aTick) { + this.setEUVar(this.maxEUStore()); + this.mProgresstime = this.mMaxProgresstime; + super.onPostTick(aBaseMetaTileEntity, aTick); + } +} diff --git a/src/main/java/com/github/bartimaeusnek/bartworks/common/tileentities/multis/GT_TileEntity_CircuitAssemblyLine.java b/src/main/java/com/github/bartimaeusnek/bartworks/common/tileentities/multis/GT_TileEntity_CircuitAssemblyLine.java new file mode 100644 index 0000000000..9b145f0123 --- /dev/null +++ b/src/main/java/com/github/bartimaeusnek/bartworks/common/tileentities/multis/GT_TileEntity_CircuitAssemblyLine.java @@ -0,0 +1,142 @@ +/* + * 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.tileentities.multis; + +import com.github.bartimaeusnek.bartworks.util.BW_Util; +import gregtech.api.interfaces.ITexture; +import gregtech.api.interfaces.metatileentity.IMetaTileEntity; +import gregtech.api.interfaces.tileentity.IGregTechTileEntity; +import gregtech.api.metatileentity.implementations.GT_MetaTileEntity_MultiBlockBase; +import gregtech.api.objects.GT_ItemStack; +import gregtech.api.util.GT_Recipe; +import net.minecraft.item.ItemStack; +import net.minecraft.nbt.NBTTagCompound; + +import java.util.Collection; + +public class GT_TileEntity_CircuitAssemblyLine extends GT_MetaTileEntity_MultiBlockBase { + + private NBTTagCompound type; + private GT_Recipe bufferedRecipe = null; + + public GT_TileEntity_CircuitAssemblyLine(int aID, String aName, String aNameRegional) { + super(aID, aName, aNameRegional); + } + + public GT_TileEntity_CircuitAssemblyLine(String aName) { + super(aName); + } + + @Override + public boolean isCorrectMachinePart(ItemStack itemStack) { + + return false; + } + + @Override + public void loadNBTData(NBTTagCompound aNBT) { + super.loadNBTData(aNBT); + type = aNBT.getCompoundTag("Type"); + } + + @Override + public void saveNBTData(NBTTagCompound aNBT) { + super.saveNBTData(aNBT); + aNBT.setTag("Type",type); + } + + @Override + public boolean checkRecipe(ItemStack itemStack) { + if (type == null) + return false; + + if (bufferedRecipe != null && bufferedRecipe.isRecipeInputEqual(false,true,BW_Util.getFluidsFromInputHatches(this),BW_Util.getItemsFromInputBusses(this))) + return true; + + ItemStack stack = ItemStack.loadItemStackFromNBT(type); + + if (stack == null) + return false; + + Collection recipes = null; + + for (GT_ItemStack GTitemstack : GT_Recipe.GT_Recipe_Map.sCircuitAssemblerRecipes.mRecipeItemMap.keySet()){ + if (GTitemstack.mItem.equals(stack.getItem()) && GTitemstack.mMetaData == (short) stack.getItemDamage()){ + recipes = GT_Recipe.GT_Recipe_Map.sCircuitAssemblerRecipes.mRecipeItemMap.get(GTitemstack); + break; + } + } + + if (recipes == null || recipes.isEmpty()) + return false; + + for (GT_Recipe recipe : recipes){ + if (recipe.isRecipeInputEqual(false,true,BW_Util.getFluidsFromInputHatches(this),BW_Util.getItemsFromInputBusses(this))) + bufferedRecipe = recipe; + } + + + + return true; + } + + @Override + public boolean checkMachine(IGregTechTileEntity iGregTechTileEntity, ItemStack itemStack) { + return false; + } + + @Override + public int getMaxEfficiency(ItemStack itemStack) { + return 0; + } + + @Override + public int getPollutionPerTick(ItemStack itemStack) { + return 0; + } + + @Override + public int getDamageToComponent(ItemStack itemStack) { + return 0; + } + + @Override + public boolean explodesOnComponentBreak(ItemStack itemStack) { + return false; + } + + @Override + public IMetaTileEntity newMetaEntity(IGregTechTileEntity iGregTechTileEntity) { + return new GT_TileEntity_CircuitAssemblyLine(this.mName); + } + + @Override + public String[] getDescription() { + return new String[0]; + } + + @Override + public ITexture[] getTexture(IGregTechTileEntity iGregTechTileEntity, byte b, byte b1, byte b2, boolean b3, boolean b4) { + return new ITexture[0]; + } +} 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 11588cc42f..13a94b30f0 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 @@ -24,6 +24,7 @@ package com.github.bartimaeusnek.bartworks.common.tileentities.multis.mega; import com.github.bartimaeusnek.bartworks.common.configs.ConfigHandler; import com.github.bartimaeusnek.bartworks.common.loaders.ItemRegistry; +import com.github.bartimaeusnek.bartworks.system.log.DebugLog; import com.github.bartimaeusnek.bartworks.util.BW_Util; import com.github.bartimaeusnek.bartworks.util.ChatColorHelper; import gregtech.api.GregTech_API; @@ -42,6 +43,7 @@ import net.minecraftforge.fluids.FluidStack; import java.util.ArrayList; import java.util.HashSet; +import java.util.Iterator; import java.util.List; import static gregtech.api.enums.GT_Values.V; @@ -94,6 +96,21 @@ public class GT_TileEntity_MegaBlastFurnace extends GT_MetaTileEntity_ElectricBl return returnset.size() > 0 && !returnset.contains(false); } +// @Override +// public long getMaxInputVoltage() { +// long rVoltage = 0L; +// Iterator var3 = this.mEnergyHatches.iterator(); +// +// while(var3.hasNext()) { +// GT_MetaTileEntity_Hatch_Energy tHatch = (GT_MetaTileEntity_Hatch_Energy)var3.next(); +// if (isValidMetaTileEntity(tHatch)) { +// rVoltage += tHatch.getBaseMetaTileEntity().getInputVoltage(); +// } +// } +// //glass tier needs NBT persistance if this is enabled +// return glasTier != 8 && rVoltage > BW_Util.getTierVoltage(glasTier) ? BW_Util.getTierVoltage(glasTier) : rVoltage ; +// } + @Override public boolean checkRecipe(ItemStack itemStack) { ItemStack[] tInputs = (ItemStack[]) this.getStoredInputs().toArray(new ItemStack[0]); @@ -223,7 +240,7 @@ public class GT_TileEntity_MegaBlastFurnace extends GT_MetaTileEntity_ElectricBl public boolean checkMachine(IGregTechTileEntity iGregTechTileEntity, ItemStack itemStack) { mHeatingCapacity = 0; HashSet ret = new HashSet(); - ret.add(BW_Util.check_layer(iGregTechTileEntity, 7, -2, -1, GregTech_API.sBlockCasings1, 11, 7, 11)); + ret.add(BW_Util.check_layer(iGregTechTileEntity, 7, -2, -1, GregTech_API.sBlockCasings1, 11, 7, false,false,true,GregTech_API.sBlockCasings1,11,true,11)); ret.add(BW_Util.check_layer(iGregTechTileEntity, 7, 17, 18, GregTech_API.sBlockCasings1, 11, 7, false, null, -1, 11)); ret.add(BW_Util.check_layer(iGregTechTileEntity, 6, -1, 17, GregTech_API.sBlockCasings5, -1, 7, false, false, true, Blocks.air, -1, false, 11)); for (int y = -1; y < 17; y++) { 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 63ba6660a1..1eab412c16 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 @@ -23,6 +23,7 @@ package com.github.bartimaeusnek.bartworks.common.tileentities.tiered; import com.github.bartimaeusnek.bartworks.API.BioVatLogicAdder; +import com.github.bartimaeusnek.bartworks.API.IRadMaterial; import com.github.bartimaeusnek.bartworks.MainMod; import com.github.bartimaeusnek.bartworks.client.gui.GT_GUIContainer_RadioHatch; import com.github.bartimaeusnek.bartworks.server.container.GT_Container_RadioHatch; @@ -169,6 +170,24 @@ public class GT_MetaTileEntity_RadioHatch extends GT_MetaTileEntity_Hatch { if (lStack == null) return; + if (lStack.getItem() instanceof IRadMaterial) { + IRadMaterial material = ((IRadMaterial) lStack.getItem()); + int sv = material.getRadiationLevel(lStack); + if (sv > BioVatLogicAdder.RadioHatch.getMaxSv()) + BioVatLogicAdder.RadioHatch.MaxSV = sv; + if (this.mass == 0 || this.sievert == sv) { + if (this.mass < this.cap) { + this.mass = material.getAmountOfMaterial(lStack); + this.sievert = sv; + this.mInventory[0].stackSize--; + this.updateSlots(); + this.colorForGUI = material.getColorForGUI(lStack); + this.material = material.getNameForGUI(lStack); + return; + } + } + } + if (GT_Utility.areStacksEqual(lStack, ItemList.NaquadahCell_1.get(1)) || GT_Utility.areStacksEqual(lStack, ItemList.NaquadahCell_2.get(1)) || GT_Utility.areStacksEqual(lStack, ItemList.NaquadahCell_4.get(1)) || GT_Utility.areStacksEqual(lStack, ItemList.ThoriumCell_1.get(1)) || GT_Utility.areStacksEqual(lStack, ItemList.ThoriumCell_2.get(1)) || GT_Utility.areStacksEqual(lStack, ItemList.ThoriumCell_4.get(1)) || GT_Utility.areStacksEqual(lStack, ItemList.Uraniumcell_1.get(1)) || GT_Utility.areStacksEqual(lStack, ItemList.Uraniumcell_2.get(1)) || GT_Utility.areStacksEqual(lStack, ItemList.Uraniumcell_4.get(1)) || GT_Utility.areStacksEqual(lStack, ItemList.Moxcell_1.get(1)) || GT_Utility.areStacksEqual(lStack, ItemList.Moxcell_2.get(1)) || GT_Utility.areStacksEqual(lStack, ItemList.Moxcell_4.get(1))) { Materials materials = Materials.Uranium; byte kg = 3; 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 81ab1e54b9..4418d72dbd 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,6 +29,7 @@ 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_Block_Ores_Abstract; import net.minecraft.block.Block; import net.minecraft.init.Blocks; import net.minecraft.item.ItemStack; @@ -70,7 +71,7 @@ public class BW_MetaGeneratedOreTE extends TileEntity implements ITexturedTileEn } public ArrayList getDrops(Block aDroppedOre) { - ArrayList rList = new ArrayList(); + ArrayList rList = new ArrayList(); if (this.mMetaData < 0) { rList.add(new ItemStack(Blocks.cobblestone, 1, 0)); return rList; 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 46a9894572..6aa0ab1671 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 @@ -23,12 +23,18 @@ package com.github.bartimaeusnek.bartworks.system.material; import com.github.bartimaeusnek.bartworks.common.items.BW_ItemBlocks; +import cpw.mods.fml.relauncher.Side; +import cpw.mods.fml.relauncher.SideOnly; import gregtech.api.util.GT_LanguageManager; +import gregtech.api.util.GT_Utility; import net.minecraft.block.Block; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.item.ItemStack; import net.minecraft.world.World; +import java.util.ArrayList; +import java.util.List; + public class BW_MetaGeneratedOre_Item extends BW_ItemBlocks { public BW_MetaGeneratedOre_Item(Block par1) { @@ -47,6 +53,16 @@ public class BW_MetaGeneratedOre_Item extends BW_ItemBlocks { return GT_LanguageManager.getTranslation("bw.blockores.01." + aStack.getItemDamage() + ".name"); } + @Override + @SideOnly(Side.CLIENT) + public void addInformation(ItemStack aStack, EntityPlayer aPlayer, List aList, boolean aF3_H) { + if (!GT_Utility.isStackValid(aStack) || aPlayer == null || aStack.getItemDamage() <= 0) + return; + if (aList == null) + aList = new ArrayList(); + aList.add(Werkstoff.werkstoffHashMap.get((short) aStack.getItemDamage()).getToolTip()); + } + 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) { short tDamage = (short) getDamage(aStack); if (tDamage > 0) { 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 552548c4d6..3cbd78ac89 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,6 +22,7 @@ package com.github.bartimaeusnek.bartworks.system.material; +import com.github.bartimaeusnek.bartworks.API.IRadMaterial; import com.github.bartimaeusnek.bartworks.common.configs.ConfigHandler; import com.github.bartimaeusnek.bartworks.system.oredict.OreDictAdder; import com.github.bartimaeusnek.bartworks.util.ChatColorHelper; @@ -34,22 +35,31 @@ import gregtech.api.interfaces.IIconContainer; import gregtech.api.items.GT_MetaGenerated_Item; import gregtech.api.util.GT_LanguageManager; import gregtech.api.util.GT_OreDictUnificator; +import gregtech.api.util.GT_Utility; +import ic2.core.IC2Potion; +import ic2.core.item.armor.ItemArmorHazmat; import net.minecraft.block.Block; import net.minecraft.creativetab.CreativeTabs; +import net.minecraft.entity.Entity; +import net.minecraft.entity.EntityLivingBase; import net.minecraft.entity.item.EntityItem; import net.minecraft.entity.player.EntityPlayer; +import net.minecraft.entity.player.EntityPlayerMP; import net.minecraft.init.Blocks; import net.minecraft.item.Item; import net.minecraft.item.ItemStack; +import net.minecraft.potion.Potion; +import net.minecraft.potion.PotionEffect; import net.minecraft.util.IIcon; import net.minecraft.util.MathHelper; import net.minecraft.util.StatCollector; +import net.minecraft.world.World; import java.util.List; import static com.github.bartimaeusnek.bartworks.system.material.Werkstoff.werkstoffHashMap; -public class BW_MetaGenerated_Items extends GT_MetaGenerated_Item { +public class BW_MetaGenerated_Items extends GT_MetaGenerated_Item implements IRadMaterial { public static final CreativeTabs metaTab = new CreativeTabs("bartworksMetaMaterials") { @@ -157,6 +167,27 @@ public class BW_MetaGenerated_Items extends GT_MetaGenerated_Item { return werkstoff == null ? Materials._NULL.mRGBa : werkstoff.getRGBA(); } + @Override + public void onUpdate(ItemStack aStack, World aWorld, Entity aPlayer, int aTimer, boolean aIsInHand) { + super.onUpdate(aStack, aWorld, aPlayer, aTimer, aIsInHand); + if (aStack == null || aStack.getItem() == null || !(aPlayer instanceof EntityLivingBase)) + return; + + EntityLivingBase bPlayer = (EntityPlayer) aPlayer; + Werkstoff w = werkstoffHashMap.get((short)aStack.getItemDamage()); + if (w == null || w.getStats() == null) + return; + + if (w.getStats().isToxic() && !GT_Utility.isWearingFullBioHazmat(bPlayer)){ + bPlayer.addPotionEffect(new PotionEffect(Potion.poison.getId(),80,4)); + } + + if (w.getStats().isRadioactive() && !GT_Utility.isWearingFullRadioHazmat(bPlayer)){ + bPlayer.addPotionEffect(new PotionEffect(IC2Potion.radiation.id,80,4)); + } + + } + @Override public final IIcon getIconFromDamage(int aMetaData) { if (aMetaData < 0) @@ -174,4 +205,27 @@ public class BW_MetaGenerated_Items extends GT_MetaGenerated_Item { public int getItemStackLimit(ItemStack aStack) { return 64; } + + @Override + public int getRadiationLevel(ItemStack aStack) { + Werkstoff w = Werkstoff.werkstoffHashMap.get((short)aStack.getItemDamage()); + return w.getStats().isRadioactive() ? (int) w.getStats().protons : 0; + } + + @Override + public byte getAmountOfMaterial(ItemStack aStack) { + return (byte) (this.orePrefixes == OrePrefixes.stick ? 1 : this.orePrefixes == OrePrefixes.stickLong ? 2 : 0); + } + + @Override + public short[] getColorForGUI(ItemStack aStack) { + Werkstoff w = Werkstoff.werkstoffHashMap.get((short)aStack.getItemDamage()); + return w.getRGBA(); + } + + @Override + public String getNameForGUI(ItemStack aStack) { + Werkstoff w = Werkstoff.werkstoffHashMap.get((short)aStack.getItemDamage()); + return w.getDefaultName(); + } } 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 a681a86270..754d07055f 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 @@ -23,6 +23,7 @@ package com.github.bartimaeusnek.bartworks.system.material; import com.github.bartimaeusnek.bartworks.util.BW_ColorUtil; +import com.github.bartimaeusnek.bartworks.util.BW_Util; import com.github.bartimaeusnek.bartworks.util.MurmurHash3; import com.github.bartimaeusnek.bartworks.util.Pair; import gregtech.api.enums.*; @@ -108,10 +109,10 @@ public class Werkstoff implements IColorModulationContainer, ISubTagContainer { if (toolTip.isEmpty()) { for (Pair p : contents) { if (p.getKey() instanceof Materials) { - this.toolTip += ((Materials) p.getKey()).mChemicalFormula + (p.getValue() > 1 ? p.getValue() : ""); + this.toolTip += ((Materials) p.getKey()).mChemicalFormula + (p.getValue() > 1 ? BW_Util.subscriptNumber(p.getValue()) : ""); } if (p.getKey() instanceof Werkstoff) - this.toolTip += ((Werkstoff) p.getKey()).toolTip + (p.getValue() > 1 ? p.getValue() : ""); + this.toolTip += ((Werkstoff) p.getKey()).toolTip + (p.getValue() > 1 ? BW_Util.subscriptNumber(p.getValue()) : ""); } } else this.toolTip = toolTip; @@ -172,7 +173,7 @@ public class Werkstoff implements IColorModulationContainer, ISubTagContainer { } public Pair[] getTCAspects(){ - return getTCAspects(1); + return this.getTCAspects(1); } public Werkstoff.Types getType() { @@ -317,7 +318,7 @@ public class Werkstoff implements IColorModulationContainer, ISubTagContainer { metal 10 gem 100 ore 1000 - cell 1000 + cell 10000 */ public byte toGenerate = 0b0001001; public byte blacklist; @@ -372,6 +373,15 @@ public class Werkstoff implements IColorModulationContainer, ISubTagContainer { return (this.extraRecipes & 1) != 0; } + public Werkstoff.GenerationFeatures addMixerRecipes(){ + this.extraRecipes = (byte) (this.extraRecipes | 10); + return this; + } + public boolean hasMixerRecipes() { + return (this.extraRecipes & 10) != 0; + } + + public Werkstoff.GenerationFeatures addSifterRecipes(){ this.extraRecipes = (byte) (this.extraRecipes | 100); return this; @@ -381,7 +391,12 @@ public class Werkstoff implements IColorModulationContainer, ISubTagContainer { } public Werkstoff.GenerationFeatures onlyDust() { - this.toGenerate = (byte) (1); + this.toGenerate = (byte) (0b1); + return this; + } + + public Werkstoff.GenerationFeatures addMetalItems() { + this.toGenerate = (byte) (this.toGenerate | 0b10); return this; } @@ -395,7 +410,6 @@ public class Werkstoff implements IColorModulationContainer, ISubTagContainer { return this; } - } public static class Stats { @@ -403,6 +417,25 @@ public class Werkstoff implements IColorModulationContainer, ISubTagContainer { public static final int NULL_KELVIN = 0; int boilingPoint; + + public int getBoilingPoint() { + return this.boilingPoint; + } + + public Stats setBoilingPoint(int boilingPoint) { + this.boilingPoint = boilingPoint; + return this; + } + + public int getMeltingPoint() { + return this.meltingPoint; + } + + public Stats setMeltingPoint(int meltingPoint) { + this.meltingPoint = meltingPoint; + return this; + } + int meltingPoint; long protons; long neutrons; 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 3f9113f07f..1f494dffab 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 @@ -59,6 +59,8 @@ import net.minecraftforge.oredict.OreDictionary; import java.util.*; +import static com.github.bartimaeusnek.bartworks.util.BW_Util.subscriptNumbers; +import static com.github.bartimaeusnek.bartworks.util.BW_Util.superscriptNumbers; import static gregtech.api.enums.OrePrefixes.*; public class WerkstoffLoader implements Runnable { @@ -117,7 +119,7 @@ public class WerkstoffLoader implements Runnable { public static final Werkstoff FluorBuergerit = new Werkstoff( new short[]{0x20, 0x20, 0x20, 0}, "Fluor-Buergerite", - "NaFe3Al6(Si6O18)(BO3)3O3F", + subscriptNumbers("NaFe3Al6(Si6O18)(BO3)3O3F"), Werkstoff.Types.COMPOUND, new We