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 | |
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
26 files changed, 987 insertions, 96 deletions
diff --git a/build.gradle b/build.gradle index 42805998bb..e25c1e8bf7 100644 --- a/build.gradle +++ b/build.gradle @@ -37,6 +37,7 @@ targetCompatibility = JavaVersion.VERSION_1_8 sourceCompatibility = 1.8 targetCompatibility = 1.8 +compileJava.options.encoding = 'UTF-8' ext.configFile = file "build.properties" configFile.withReader { diff --git a/build.properties b/build.properties index 9998e7ace1..602e878c53 100644 --- a/build.properties +++ b/build.properties @@ -23,8 +23,8 @@ mc_version=1.7.10 majorUpdate=0 minorUpdate=4 -buildNumber=16 -APIVersion=6 +buildNumber=18_pre2 +APIVersion=7 ic2.version=2.2.828-experimental gregtech.version=5.09.32.36 gregtech.jenkinsbuild=143 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/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<GT_Recipe> 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<Boolean> ret = new HashSet<Boolean>(); - 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<ItemStack> getDrops(Block aDroppedOre) { - ArrayList<ItemStack> rList = new ArrayList(); + ArrayList<ItemStack> rList = new ArrayList<ItemStack>(); 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<String>(); + 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") { @@ -158,6 +168,27 @@ public class BW_MetaGenerated_Items extends GT_MetaGenerated_Item { } @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) return null; @@ -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<ISubTagContainer, Integer> 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<Object,Integer>[] 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 Werkstoff.GenerationFeatures().addGems(), 5, @@ -144,7 +146,7 @@ public class WerkstoffLoader implements Runnable { public static final Werkstoff ChromoAluminoPovondrait = new Werkstoff( new short[]{0, 0x79, 0x6A, 0}, "Chromo-Alumino-Povondraite", - "NaCr3(Al4Mg2)(Si6O18)(BO3)3(OH)3O", + subscriptNumbers("NaCr3(Al4Mg2)(Si6O18)(BO3)3(OH)3O"), Werkstoff.Types.getDefaultStatForType(Werkstoff.Types.COMPOUND), Werkstoff.Types.COMPOUND, new Werkstoff.GenerationFeatures().addGems(), @@ -162,7 +164,7 @@ public class WerkstoffLoader implements Runnable { public static final Werkstoff VanadioOxyDravit = new Werkstoff( new short[]{0x60, 0xA0, 0xA0, 0}, "Vanadio-Oxy-Dravite", - "NaV3(Al4Mg2)(Si6O18)(BO3)3(OH)3O", + subscriptNumbers("NaV3(Al4Mg2)(Si6O18)(BO3)3(OH)3O"), Werkstoff.Types.getDefaultStatForType(Werkstoff.Types.COMPOUND), Werkstoff.Types.COMPOUND, new Werkstoff.GenerationFeatures().addGems(), @@ -180,7 +182,7 @@ public class WerkstoffLoader implements Runnable { public static final Werkstoff Olenit = new Werkstoff( new short[]{210, 210, 210, 0}, "Olenite", - "NaAl3Al6(Si6O18)(BO3)3O3OH", + subscriptNumbers("NaAl3Al6(Si6O18)(BO3)3O3OH"), Werkstoff.Types.getDefaultStatForType(Werkstoff.Types.COMPOUND), Werkstoff.Types.COMPOUND, new Werkstoff.GenerationFeatures().addGems(), @@ -404,7 +406,7 @@ public class WerkstoffLoader implements Runnable { ); public static final Werkstoff DescloiziteCUVO4 = new Werkstoff( new short[]{0xf9,0x6d,0x18,0}, - "Orange Descolizite",//Pb(Zn,Cu)[OH|VO4 + "Orange Descloizite",//Pb(Zn,Cu)[OH|VO4 new Werkstoff.Stats().setElektrolysis(true), Werkstoff.Types.COMPOUND, new Werkstoff.GenerationFeatures(), @@ -419,7 +421,7 @@ public class WerkstoffLoader implements Runnable { public static final Werkstoff FuchsitAL = new Werkstoff( new short[]{0x4D,0x7F,0x64,0}, "Green Fuchsite", - "KAl3Si3O10(OH)2", + subscriptNumbers("KAl3Si3O10(OH)2"), new Werkstoff.Stats().setElektrolysis(true), Werkstoff.Types.COMPOUND, new Werkstoff.GenerationFeatures(), @@ -436,7 +438,7 @@ public class WerkstoffLoader implements Runnable { public static final Werkstoff FuchsitCR = new Werkstoff( new short[]{128,0,0,0}, "Red Fuchsite", - "KCr3Si3O10(OH)2", + subscriptNumbers("KCr3Si3O10(OH)2"), new Werkstoff.Stats().setElektrolysis(true), Werkstoff.Types.COMPOUND, new Werkstoff.GenerationFeatures(), @@ -453,22 +455,58 @@ public class WerkstoffLoader implements Runnable { public static final Werkstoff Thorium232 = new Werkstoff( new short[]{0,64,0,0}, "Thorium 232", - "Th232", + superscriptNumbers("Th232"), new Werkstoff.Stats().setRadioactive(true), Werkstoff.Types.ELEMENT, new Werkstoff.GenerationFeatures().disable().onlyDust(), 30, TextureSet.SET_METALLIC ); -// public static final Werkstoff BismuthTellurite = new Werkstoff( -// new short[]{0,64,0,0}, -// "Bismuth Tellurite", -// new Werkstoff.Stats().setElektrolysis(true).setToxic(true), -// Werkstoff.Types.COMPOUND, -// new Werkstoff.GenerationFeatures().disable().onlyDust().addChemicalRecipes(), -// 31, -// TextureSet.SET_METALLIC -// ); + public static final Werkstoff BismuthTellurite = new Werkstoff( + new short[]{32,72,32,0}, + "Bismuth Tellurite", + new Werkstoff.Stats().setElektrolysis(true), + Werkstoff.Types.COMPOUND, + new Werkstoff.GenerationFeatures().disable().onlyDust().addChemicalRecipes(), + 31, + TextureSet.SET_METALLIC, + new Pair<>(Materials.Bismuth, 2), + new Pair<>(Materials.Tellurium, 3) + ); + public static final Werkstoff Tellurium = new Werkstoff( + new short[]{0xff,0xff,0xff,0}, + "Tellurium", + new Werkstoff.Stats(), + Werkstoff.Types.ELEMENT, + new Werkstoff.GenerationFeatures().disable().addMetalItems(), + 32, + TextureSet.SET_METALLIC, + new Pair<>(Materials.Tellurium, 1) + ); + public static final Werkstoff BismuthHydroBorat = new Werkstoff( + new short[]{72,144,72,0}, + "Dibismuthhydroborat", + new Werkstoff.Stats().setElektrolysis(true), + Werkstoff.Types.COMPOUND, + new Werkstoff.GenerationFeatures().disable().onlyDust().addChemicalRecipes(), + 33, + TextureSet.SET_METALLIC, + new Pair<>(Materials.Bismuth, 2), + new Pair<>(Materials.Boron, 1), + new Pair<>(Materials.Hydrogen, 1) + ); + public static final Werkstoff ArInGaPhoBiBoTe = new Werkstoff( + new short[]{36,36,36,0}, + "Circuit Compound MK1", + new Werkstoff.Stats().setCentrifuge(true), + Werkstoff.Types.COMPOUND, + new Werkstoff.GenerationFeatures().disable().onlyDust().addMixerRecipes(), + 34, + TextureSet.SET_METALLIC, + new Pair<>(Materials.IndiumGalliumPhosphide, 1), + new Pair<>(WerkstoffLoader.BismuthHydroBorat, 3), + new Pair<>(WerkstoffLoader.BismuthTellurite, 2) + ); public static HashMap<OrePrefixes, BW_MetaGenerated_Items> items = new HashMap<>(); public static Block BWOres; @@ -575,6 +613,7 @@ public class WerkstoffLoader implements Runnable { werkstoff.getGenerationFeatures().setBlacklist(p); } toGenerateGlobal = (toGenerateGlobal | werkstoff.getGenerationFeatures().toGenerate); + //System.out.println(werkstoff.getDefaultName()+": "+werkstoff.getGenerationFeatures().toGenerate); } if ((toGenerateGlobal & 0b1) != 0) { @@ -584,7 +623,7 @@ public class WerkstoffLoader implements Runnable { } if ((toGenerateGlobal & 0b10) != 0) { WerkstoffLoader.items.put(ingot, new BW_MetaGenerated_Items(ingot)); - + WerkstoffLoader.items.put(nugget, new BW_MetaGenerated_Items(nugget)); } if ((toGenerateGlobal & 0b100) != 0) { WerkstoffLoader.items.put(gem, new BW_MetaGenerated_Items(gem)); @@ -621,8 +660,7 @@ public class WerkstoffLoader implements Runnable { public static void runGTItemDataRegistrator(){ for (Werkstoff werkstoff : Werkstoff.werkstoffHashSet) { - if (werkstoff.getGenerationFeatures().hasOres()) - GT_OreDictUnificator.setItemData(new ItemStack(WerkstoffLoader.BWOres,1,werkstoff.getmID()), new ItemData(ore,Materials._NULL)); + GT_OreDictUnificator.addAssociation(ore,Materials._NULL,new ItemStack(WerkstoffLoader.BWOres,1,werkstoff.getmID()),true); } } @@ -652,7 +690,7 @@ public class WerkstoffLoader implements Runnable { } OreDictAdder.addToMap(new Pair<>("craftingIndustrialDiamond", WerkstoffLoader.Zirconia.get(gemExquisite))); - }else { + } else { for (Werkstoff werkstoff : Werkstoff.werkstoffHashSet) { if (werkstoff.getGenerationFeatures().hasOres()) GT_OreDictUnificator.registerOre(ore + werkstoff.getDefaultName().replaceAll(" ", ""), werkstoff.get(ore)); @@ -667,6 +705,7 @@ public class WerkstoffLoader implements Runnable { private void addGemRecipes(Werkstoff werkstoff) { if (werkstoff.getGenerationFeatures().hasGems()) { if (werkstoff.getGenerationFeatures().hasSifterRecipes() || ((werkstoff.getGenerationFeatures().toGenerate & 0b1000) != 0 && (werkstoff.getGenerationFeatures().toGenerate & 0b1) != 0)) { + GT_Values.RA.addSifterRecipe( WerkstoffLoader.getCorresopndingItemStack(crushedPurified, werkstoff), new ItemStack[]{ @@ -684,16 +723,17 @@ public class WerkstoffLoader implements Runnable { 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_ModHandler.addCraftingRecipe(werkstoff.get(gemFlawless,2),0,new Object[]{"h ", "W ",'W',werkstoff.get(gemExquisite)}); - GT_ModHandler.addCraftingRecipe(werkstoff.get(gem, 2),0,new Object[]{"h ", "W ",'W',werkstoff.get(gemFlawless)}); - GT_ModHandler.addCraftingRecipe(werkstoff.get(gemFlawed, 2),0,new Object[]{"h ", "W ",'W',werkstoff.get(gem)}); - GT_ModHandler.addCraftingRecipe(werkstoff.get(gemChipped, 2),0,new Object[]{"h ", "W ",'W',werkstoff.get(gemFlawed)}); + GT_ModHandler.addCraftingRecipe(werkstoff.get(gemFlawless, 2), 0, new Object[]{"h ", "W ", 'W', werkstoff.get(gemExquisite)}); + GT_ModHandler.addCraftingRecipe(werkstoff.get(gem, 2), 0, new Object[]{"h ", "W ", 'W', werkstoff.get(gemFlawless)}); + GT_ModHandler.addCraftingRecipe(werkstoff.get(gemFlawed, 2), 0, new Object[]{"h ", "W ", 'W', werkstoff.get(gem)}); + GT_ModHandler.addCraftingRecipe(werkstoff.get(gemChipped, 2), 0, new Object[]{"h ", "W ", 'W', werkstoff.get(gemFlawed)}); 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); @@ -708,22 +748,21 @@ public class WerkstoffLoader implements Runnable { GT_Values.RA.addImplosionRecipe(werkstoff.get(dust, 4), 24, werkstoff.get(gem, 3), GT_OreDictUnificator.get(dustTiny, Materials.DarkAsh, 8)); - if ((werkstoff.getGenerationFeatures().toGenerate & 2) != 0){ - GT_Values.RA.addLatheRecipe(werkstoff.get(plate),werkstoff.get(lens),werkstoff.get(dustSmall), 1200, 120); + if ((werkstoff.getGenerationFeatures().toGenerate & 2) != 0) { + GT_Values.RA.addLatheRecipe(werkstoff.get(plate), werkstoff.get(lens), werkstoff.get(dustSmall), 1200, 120); } - GT_Values.RA.addLatheRecipe(werkstoff.get(gemExquisite),werkstoff.get(lens),werkstoff.get(dust,2), 2400, 30); + + GT_Values.RA.addLatheRecipe(werkstoff.get(gemExquisite), werkstoff.get(lens), werkstoff.get(dust, 2), 2400, 30); GregTech_API.registerCover(werkstoff.get(lens), new GT_MultiTexture(Textures.BlockIcons.MACHINE_CASINGS[2][0], new GT_RenderedTexture(Textures.BlockIcons.OVERLAY_LENS, werkstoff.getRGBA(), false)), new gregtech.common.covers.GT_Cover_Lens(BW_ColorUtil.getDyeFromColor(werkstoff.getRGBA()).mIndex)); - GT_ModHandler.addPulverisationRecipe(werkstoff.get(lens), werkstoff.get(dustSmall,3)); - // if (MainMod.GTNH) { - //Engraver Recipe adder - for (ItemStack is : OreDictionary.getOres("craftingLens" + BW_ColorUtil.getDyeFromColor(werkstoff.getRGBA()).mName.replace(" ", ""))) { - is.stackSize = 0; - GT_Values.RA.addLaserEngraverRecipe(werkstoff.get(gemChipped, 3), is, werkstoff.get(gemFlawed, 1), 600, 30); - GT_Values.RA.addLaserEngraverRecipe(werkstoff.get(gemFlawed, 3), is, werkstoff.get(gem, 1), 600, 120); - GT_Values.RA.addLaserEngraverRecipe(werkstoff.get(gem, 3), is, werkstoff.get(gemFlawless, 1), 1200, 480); - GT_Values.RA.addLaserEngraverRecipe(werkstoff.get(gemFlawless, 3), is, werkstoff.get(gemExquisite, 1), 2400, 2000); - } -// } + GT_ModHandler.addPulverisationRecipe(werkstoff.get(lens), werkstoff.get(dustSmall, 3)); + + for (ItemStack is : OreDictionary.getOres("craftingLens" + BW_ColorUtil.getDyeFromColor(werkstoff.getRGBA()).mName.replace(" ", ""))) { + is.stackSize = 0; + GT_Values.RA.addLaserEngraverRecipe(werkstoff.get(gemChipped, 3), is, werkstoff.get(gemFlawed, 1), 600, 30); + GT_Values.RA.addLaserEngraverRecipe(werkstoff.get(gemFlawed, 3), is, werkstoff.get(gem, 1), 600, 120); + GT_Values.RA.addLaserEngraverRecipe(werkstoff.get(gem, 3), is, werkstoff.get(gemFlawless, 1), 1200, 480); + GT_Values.RA.addLaserEngraverRecipe(werkstoff.get(gemFlawless, 3), is, werkstoff.get(gemExquisite, 1), 2400, 2000); + } } } @@ -788,6 +827,11 @@ public class WerkstoffLoader implements Runnable { stOutputs.add(Materials.Empty.getCells(cells)); GT_Recipe.GT_Recipe_Map.sChemicalRecipes.addRecipe(true, stOutputs.toArray(new ItemStack[0]),new ItemStack[]{input},null,null,new FluidStack[]{flOutputs.size() > 0 ? flOutputs.get(0) : null},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.getGenerationFeatures().hasMixerRecipes()) { + if (cells > 0) + stOutputs.add(Materials.Empty.getCells(cells)); + GT_Recipe.GT_Recipe_Map.sMixerRecipes.addRecipe(true, stOutputs.toArray(new ItemStack[0]),new ItemStack[]{input},null,null,new FluidStack[]{flOutputs.size() > 0 ? flOutputs.get(0) : null},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.addCraftingRecipe(WerkstoffLoader.getCorresopndingItemStack(dust, werkstoff), new Object[]{ @@ -805,15 +849,19 @@ public class WerkstoffLoader implements Runnable { "T ", 'T', WerkstoffLoader.getCorresopndingItemStack(dust, werkstoff) }); - if ((werkstoff.getGenerationFeatures().toGenerate & 2) != 0 && !werkstoff.getStats().isBlastFurnace()) { + if ((werkstoff.getGenerationFeatures().toGenerate & 0b10) != 0 && !werkstoff.getStats().isBlastFurnace()) { GT_ModHandler.addSmeltingRecipe(WerkstoffLoader.getCorresopndingItemStack(dust, werkstoff), WerkstoffLoader.getCorresopndingItemStack(ingot, werkstoff)); GT_ModHandler.addSmeltingRecipe(WerkstoffLoader.getCorresopndingItemStack(dustTiny, werkstoff), WerkstoffLoader.getCorresopndingItemStack(nugget, werkstoff)); } + if ((werkstoff.getGenerationFeatures().toGenerate & 0b10) != 0){ + GT_ModHandler.addPulverisationRecipe(werkstoff.get(ingot),werkstoff.get(dust)); + GT_ModHandler.addPulverisationRecipe(werkstoff.get(nugget),werkstoff.get(dustTiny)); + } } } private void addOreRecipes(Werkstoff werkstoff) { - if ((werkstoff.getGenerationFeatures().toGenerate & 2) != 0 && !werkstoff.getStats().isBlastFurnace()) + if ((werkstoff.getGenerationFeatures().toGenerate & 0b1000) != 0 && (werkstoff.getGenerationFeatures().toGenerate & 0b10) != 0 &&!werkstoff.getStats().isBlastFurnace()) GT_ModHandler.addSmeltingRecipe(WerkstoffLoader.getCorresopndingItemStack(ore, werkstoff), WerkstoffLoader.getCorresopndingItemStack(ingot, werkstoff)); if ((werkstoff.getGenerationFeatures().toGenerate & 0b1000) != 0) { @@ -833,6 +881,22 @@ public class WerkstoffLoader implements Runnable { if ((werkstoff.getGenerationFeatures().toGenerate & 0b1000) == 0 || (werkstoff.getGenerationFeatures().toGenerate & 0b1) == 0) return; + if ((werkstoff.getGenerationFeatures().toGenerate & 0b10) != 0 && !werkstoff.getStats().isBlastFurnace()) { + if (werkstoff.getType().equals(Werkstoff.Types.ELEMENT)) { + GT_ModHandler.addSmeltingRecipe(werkstoff.get(crushed), werkstoff.get(nugget, 10)); + GT_ModHandler.addSmeltingRecipe(werkstoff.get(crushedPurified), werkstoff.get(nugget, 10)); + GT_ModHandler.addSmeltingRecipe(werkstoff.get(crushedCentrifuged), werkstoff.get(nugget, 10)); + } + else { + GT_ModHandler.addSmeltingRecipe(werkstoff.get(crushed), werkstoff.get(ingot)); + GT_ModHandler.addSmeltingRecipe(werkstoff.get(crushedPurified), werkstoff.get(ingot)); + GT_ModHandler.addSmeltingRecipe(werkstoff.get(crushedCentrifuged), werkstoff.get(ingot)); + } + GT_ModHandler.addSmeltingRecipe(werkstoff.get(dustImpure), werkstoff.get(ingot)); + GT_ModHandler.addSmeltingRecipe(werkstoff.get(dustPure), werkstoff.get(ingot)); + GT_ModHandler.addSmeltingRecipe(werkstoff.get(dust), werkstoff.get(ingot)); + } + GT_ModHandler.addCraftingRecipe(werkstoff.get(dustImpure),new Object[]{"h ", "W ",'W',werkstoff.get(crushed)}); GT_ModHandler.addCraftingRecipe(werkstoff.get(dustPure),new Object[]{"h ", "W ",'W',werkstoff.get(crushedPurified)}); GT_ModHandler.addCraftingRecipe(werkstoff.get(dust),new Object[]{"h ", "W ",'W',werkstoff.get(crushedCentrifuged)}); diff --git a/src/main/java/com/github/bartimaeusnek/bartworks/system/material/processingLoaders/AdditionalRecipes.java b/src/main/java/com/github/bartimaeusnek/bartworks/system/material/processingLoaders/AdditionalRecipes.java index 799522d347..a6345c8736 100644 --- a/src/main/java/com/github/bartimaeusnek/bartworks/system/material/processingLoaders/AdditionalRecipes.java +++ b/src/main/java/com/github/bartimaeusnek/bartworks/system/material/processingLoaders/AdditionalRecipes.java @@ -28,6 +28,8 @@ import com.github.bartimaeusnek.bartworks.util.BW_Util; import gregtech.api.enums.GT_Values; import gregtech.api.enums.ItemList; import gregtech.api.enums.Materials; +import gregtech.api.enums.OrePrefixes; +import gregtech.api.util.GT_OreDictUnificator; import gregtech.api.util.GT_Recipe; import gregtech.api.util.GT_Utility; import net.minecraft.item.ItemStack; @@ -60,6 +62,7 @@ public class AdditionalRecipes implements Runnable { GT_Values.RA.addChemicalRecipe(WerkstoffLoader.Thorianit.get(dust),Materials.Aluminium.getDust(1),Materials.Thorium.getDust(1),1000); GT_Values.RA.addChemicalRecipe(WerkstoffLoader.Thorianit.get(dust),Materials.Magnesium.getDust(1),Materials.Thorium.getDust(1),1000); GT_Values.RA.addChemicalRecipe(WerkstoffLoader.Thorianit.get(crushed), ItemList.Crop_Drop_Thorium.get(9),Materials.Water.getFluid(1000),Materials.Thorium.getMolten(144),WerkstoffLoader.Thorianit.get(crushedPurified,4),96,24); + //Tellurium + GT_Values.RA.addBlastRecipe(GT_OreDictUnificator.get(crushed,Materials.Lead,10L),GT_Utility.getIntegratedCircuit(17),GT_Values.NF,GT_Values.NF,Materials.Lead.getIngots(10),Materials.Tellurium.getNuggets(20),800,BW_Util.getMachineVoltageFromTier(2),722); } - -} +}
\ No newline at end of file diff --git a/src/main/java/com/github/bartimaeusnek/bartworks/system/object/AbstractedStack.java b/src/main/java/com/github/bartimaeusnek/bartworks/system/object/AbstractedStack.java new file mode 100644 index 0000000000..a46b3b1067 --- /dev/null +++ b/src/main/java/com/github/bartimaeusnek/bartworks/system/object/AbstractedStack.java @@ -0,0 +1,88 @@ +/* + * 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.system.object; + +import com.github.bartimaeusnek.bartworks.util.Pair; +import net.minecraft.item.Item; +import net.minecraft.item.ItemStack; +import net.minecraft.nbt.NBTTagCompound; + +import java.io.*; + +public class AbstractedStack implements Serializable { + + final Pair<Integer,Short> idDamage; + final NBTTagCompound mTag; + + @Override + public boolean equals(Object o) { + if (this == o) return true; + if (!(o instanceof AbstractedStack)) return false; + + AbstractedStack that = (AbstractedStack) o; + + if (this.getIdDamage() != null ? !this.getIdDamage().equals(that.getIdDamage()) : that.getIdDamage() != null) + return false; + return this.getmTag() != null ? this.getmTag().equals(that.getmTag()) : that.getmTag() == null; + } + + @Override + public int hashCode() { + int result = this.getIdDamage() != null ? this.getIdDamage().hashCode() : 0; + result = 31 * result + (this.getmTag() != null ? this.getmTag().hashCode() : 0); + return result; + } + + public Pair<Integer, Short> getIdDamage() { + return this.idDamage; + } + + public NBTTagCompound getmTag() { + return this.mTag; + } + + public AbstractedStack(Pair<Integer, Short> idDamage, NBTTagCompound mTag) { + this.idDamage = idDamage; + this.mTag = mTag; + } + + public AbstractedStack(ItemStack itemStack) { + if (itemStack == null) + throw new UnsupportedOperationException(); + this.idDamage = new Pair<Integer,Short>(Item.getIdFromItem(itemStack.getItem()), (short) itemStack.getItemDamage()); + this.mTag = itemStack.getTagCompound(); + } + + public byte[] serialize() throws IOException { + ByteArrayOutputStream out = new ByteArrayOutputStream(); + ObjectOutputStream os = new ObjectOutputStream(out); + os.writeObject(this); + return out.toByteArray(); + } + + public AbstractedStack deserialize(byte[] data) throws IOException, ClassNotFoundException, ClassCastException { + ByteArrayInputStream in = new ByteArrayInputStream(data); + ObjectInputStream is = new ObjectInputStream(in); + return (AbstractedStack) is.readObject(); + } +} diff --git a/src/main/java/com/github/bartimaeusnek/bartworks/system/worldgen/MapGenRuins.java b/src/main/java/com/github/bartimaeusnek/bartworks/system/worldgen/MapGenRuins.java index acd948dd19..841fe49b12 100644 --- a/src/main/java/com/github/bartimaeusnek/bartworks/system/worldgen/MapGenRuins.java +++ b/src/main/java/com/github/bartimaeusnek/bartworks/system/worldgen/MapGenRuins.java @@ -39,6 +39,8 @@ import net.minecraft.world.gen.feature.WorldGenerator; import net.minecraftforge.common.ChestGenHooks; import net.minecraftforge.common.ForgeHooks; +import java.nio.ByteBuffer; +import java.security.SecureRandom; import java.util.Random; import static net.minecraftforge.common.ChestGenHooks.DUNGEON_CHEST; @@ -114,7 +116,7 @@ public abstract class MapGenRuins extends WorldGenerator { } Random rand = new XSTR(rand1.nextLong()); - + SecureRandom secureRandom = new SecureRandom(); x=x+5; z=z+5; @@ -140,7 +142,7 @@ public abstract class MapGenRuins extends WorldGenerator { boolean useColor = rand.nextBoolean(); byte set = 0; byte toSet = (byte) (rand.nextInt(6-tier)+1); - short cablemeta = GT_WorldgenUtil.getCable(rand,tier); + short cablemeta = GT_WorldgenUtil.getCable(secureRandom,tier); byte treeinaRow = 0; boolean lastset = rand.nextBoolean(); for (int dx = -6; dx <= 6; dx++) { @@ -184,12 +186,12 @@ public abstract class MapGenRuins extends WorldGenerator { setBlock(worldObj,x + dx, y + dy, z + dz,Blocks.chest,5); IInventory chest = (IInventory)worldObj.getTileEntity(x + dx, y + dy, z + dz); if (chest != null) { - WeightedRandomChestContent.generateChestContents(rand, ChestGenHooks.getItems(PYRAMID_JUNGLE_CHEST, rand), chest, ChestGenHooks.getCount(PYRAMID_JUNGLE_CHEST, rand)); + WeightedRandomChestContent.generateChestContents(secureRandom, ChestGenHooks.getItems(PYRAMID_JUNGLE_CHEST, rand), chest, ChestGenHooks.getCount(PYRAMID_JUNGLE_CHEST, rand)); } } if (dx == 4 && dz==4) { - short meta = GT_WorldgenUtil.getGenerator(rand,tier); + short meta = GT_WorldgenUtil.getGenerator(secureRandom,tier); setBlock(worldObj, x + dx, y + dy, z + dz, GT_WorldgenUtil.GT_TILES,GregTech_API.METATILEENTITIES[meta].getTileEntityBaseType()); BaseMetaTileEntity BTE = (BaseMetaTileEntity) worldObj.getTileEntity(x + dx, y + dy, z + dz); BTE.setInitialValuesAsNBT(null,meta); @@ -199,7 +201,7 @@ public abstract class MapGenRuins extends WorldGenerator { } else if (dx == 3 && dz==4) { if (tier>0) { - short meta = GT_WorldgenUtil.getBuffer(rand, tier); + short meta = GT_WorldgenUtil.getBuffer(secureRandom, tier); setBlock(worldObj, x + dx, y + dy, z + dz, GT_WorldgenUtil.GT_TILES, GregTech_API.METATILEENTITIES[meta].getTileEntityBaseType()); BaseMetaTileEntity BTE = (BaseMetaTileEntity) worldObj.getTileEntity(x + dx, y + dy, z + dz); BTE.setInitialValuesAsNBT(null, meta); @@ -241,7 +243,7 @@ public abstract class MapGenRuins extends WorldGenerator { } else if (dx < 3 && dx > -5 && dz == 3 && set < toSet){ if (!lastset || treeinaRow > 2) { - short meta = GT_WorldgenUtil.getMachine(rand, tier); + short meta = GT_WorldgenUtil.getMachine(secureRandom, tier); setBlock(worldObj, x + dx, y + dy, z + dz, GT_WorldgenUtil.GT_TILES, GregTech_API.METATILEENTITIES[meta].getTileEntityBaseType()); BaseMetaTileEntity BTE = (BaseMetaTileEntity) worldObj.getTileEntity(x + dx, y + dy, z + dz); BTE.setInitialValuesAsNBT(null, meta); @@ -298,7 +300,7 @@ public abstract class MapGenRuins extends WorldGenerator { for (int dx = 2; dx > -5; dx--) { if (set < toSet){ if (!lastset || treeinaRow > 2 && worldObj.getTileEntity(x + dx, y + dy, z + dz) == null) { - short meta = GT_WorldgenUtil.getMachine(rand, tier); + short meta = GT_WorldgenUtil.getMachine(secureRandom, tier); setBlock(worldObj, x + dx, y + dy, z + dz, GT_WorldgenUtil.GT_TILES, GregTech_API.METATILEENTITIES[meta].getTileEntityBaseType()); BaseMetaTileEntity BTE = (BaseMetaTileEntity) worldObj.getTileEntity(x + dx, y + dy, z + dz); BTE.setInitialValuesAsNBT(null, meta); 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 c775313f1a..64ea87132f 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 @@ -27,6 +27,8 @@ import gregtech.api.enums.Materials; import gregtech.api.interfaces.ISubTagContainer; import gregtech.api.interfaces.tileentity.IGregTechTileEntity; import gregtech.api.metatileentity.implementations.GT_MetaTileEntity_Hatch_Energy; +import gregtech.api.metatileentity.implementations.GT_MetaTileEntity_Hatch_Input; +import gregtech.api.metatileentity.implementations.GT_MetaTileEntity_Hatch_InputBus; import gregtech.api.metatileentity.implementations.GT_MetaTileEntity_MultiBlockBase; import gregtech.api.util.GT_OreDictUnificator; import gregtech.api.util.GT_Utility; @@ -34,12 +36,10 @@ import net.minecraft.block.Block; import net.minecraft.item.EnumRarity; import net.minecraft.item.ItemStack; import net.minecraftforge.common.util.ForgeDirection; +import net.minecraftforge.fluids.FluidStack; import javax.annotation.Nonnegative; -import java.util.ArrayList; -import java.util.Arrays; -import java.util.Iterator; -import java.util.List; +import java.util.*; import java.util.function.UnaryOperator; import static gregtech.api.enums.GT_Values.V; @@ -50,6 +50,89 @@ public class BW_Util { public static final int CLEANROOM = -100; public static final int LOWGRAVITY = -200; + + public static String subscriptNumbers(String b){ + char[] chars = b.toCharArray(); + char[] nu = new char[chars.length]; + for (int i = 0; i < chars.length; i++) { + switch (chars[i]){ + case '0': nu[i] = '₀'; continue; + case '1': nu[i] = '₁'; continue; + case '2': nu[i] = '₂'; continue; + case '3': nu[i] = '₃'; continue; + case '4': nu[i] = '₄'; continue; + case '5': nu[i] = '₅'; continue; + case '6': nu[i] = '₆'; continue; + case '7': nu[i] = '₇'; continue; + case '8': nu[i] = '₈'; continue; + case '9': nu[i] = '₉'; continue; + default: nu[i] = chars[i]; + } + } + return new String(nu); + } + + public static String subscriptNumber(Number b){ + char[] chars = Long.toString(b.longValue()).toCharArray(); + char[] nu = new char[chars.length]; + for (int i = 0; i < chars.length; i++) { + switch (chars[i]){ + case '0': nu[i] = '₀'; continue; + case '1': nu[i] = '₁'; continue; + case '2': nu[i] = '₂'; continue; + case '3': nu[i] = '₃'; continue; + case '4': nu[i] = '₄'; continue; + case '5': nu[i] = '₅'; continue; + case '6': nu[i] = '₆'; continue; + case '7': nu[i] = '₇'; continue; + case '8': nu[i] = '₈'; continue; + case '9': nu[i] = '₉'; + } + } + return new String(nu); + } + + public static String superscriptNumbers(String b){ + char[] chars = b.toCharArray(); + char[] nu = new char[chars.length]; + for (int i = 0; i < chars.length; i++) { + switch (chars[i]){ + case '0': nu[i] = '⁰'; continue; + case '1': nu[i] = '¹'; continue; + case '2': nu[i] = '²'; continue; + case '3': nu[i] = '³'; continue; + case '4': nu[i] = '⁴'; continue; + case '5': nu[i] = '⁵'; continue; + case '6': nu[i] = '⁶'; continue; + case '7': nu[i] = '⁷'; continue; + case '8': nu[i] = '⁸'; continue; + case '9': nu[i] = '⁹'; continue; + default: nu[i] = chars[i]; + } + } + return new String(nu); + } + + public static String superscriptNumber(Number b){ + char[] chars = Long.toString(b.longValue()).toCharArray(); + char[] nu = new char[chars.length]; + for (int i = 0; i < chars.length; i++) { + switch (chars[i]){ + case '0': nu[i] = '⁰'; continue; + case '1': nu[i] = '¹'; continue; + case '2': nu[i] = '²'; continue; + case '3': nu[i] = '³'; continue; + case '4': nu[i] = '⁴'; continue; + case '5': nu[i] = '⁵'; continue; + case '6': nu[i] = '⁶'; continue; + case '7': nu[i] = '⁷'; continue; + case '8': nu[i] = '⁸'; continue; + case '9': nu[i] = '⁹'; + } + } + return new String(nu); + } + public static byte specialToByte(int aSpecialValue) { byte special = 0; if (aSpecialValue == (CLEANROOM)) @@ -95,6 +178,10 @@ public class BW_Util { return (int) (30 * Math.pow(4, (tier - 1))); } + public static int getTierVoltage(int tier) { + return 8 << (2*tier); + } + public static boolean areStacksEqual(ItemStack aStack1, ItemStack aStack2) { return (aStack1 == null && aStack2 == null) || GT_Utility.areStacksEqual(aStack1, aStack2); } @@ -191,7 +278,7 @@ public class BW_Util { while (var3.hasNext()) { GT_MetaTileEntity_Hatch_Energy tHatch = (GT_MetaTileEntity_Hatch_Energy) var3.next(); - if (base.isValidMetaTileEntity(tHatch)) { + if (GT_MetaTileEntity_MultiBlockBase.isValidMetaTileEntity(tHatch)) { if (rVoltage == 0 || rVoltage > tHatch.getBaseMetaTileEntity().getInputVoltage()) rVoltage = tHatch.getBaseMetaTileEntity().getInputVoltage(); rAmperage += tHatch.getBaseMetaTileEntity().getInputAmperage(); @@ -201,6 +288,22 @@ public class BW_Util { return rVoltage * rAmperage; } + public static FluidStack[] getFluidsFromInputHatches(GT_MetaTileEntity_MultiBlockBase aBaseMetaTileEntity){ + ArrayList<FluidStack> tmp = new ArrayList<>(); + for (GT_MetaTileEntity_Hatch_Input fip : aBaseMetaTileEntity.mInputHatches){ + tmp.add(fip.getFluid()); + } + return (FluidStack[]) tmp.toArray(); + } + public static ItemStack[] getItemsFromInputBusses(GT_MetaTileEntity_MultiBlockBase aBaseMetaTileEntity){ + ArrayList<ItemStack> tmp = new ArrayList<>(); + for (GT_MetaTileEntity_Hatch_InputBus fip : aBaseMetaTileEntity.mInputBusses){ + tmp.addAll(Arrays.asList(fip.mInventory)); + } + return (ItemStack[]) tmp.toArray(); + } + + public static EnumRarity getRarityFromByte(byte b) { switch (b) { case 1: @@ -216,23 +319,23 @@ public class BW_Util { public static boolean check_layer(IGregTechTileEntity aBaseMetaTileEntity, int radius, int yLevel, int height, Block block, int dmg, int offset, boolean insideCheck, Block inside, int dmginside, int aBaseCasingIndex) { - return check_layer(aBaseMetaTileEntity, radius, yLevel, height, block, dmg, offset, false, insideCheck, inside, dmginside, aBaseCasingIndex); + return BW_Util.check_layer(aBaseMetaTileEntity, radius, yLevel, height, block, dmg, offset, false, insideCheck, inside, dmginside, aBaseCasingIndex); } public static boolean check_layer(IGregTechTileEntity aBaseMetaTileEntity, int radius, int yLevel, int height, Block block, int dmg, int offset, int aBaseCasingIndex) { - return check_layer(aBaseMetaTileEntity, radius, yLevel, height, block, dmg, offset, false, aBaseCasingIndex); + return BW_Util.check_layer(aBaseMetaTileEntity, radius, yLevel, height, block, dmg, offset, false, aBaseCasingIndex); } public static boolean check_layer(IGregTechTileEntity aBaseMetaTileEntity, int radius, int yLevel, int height, Block block, int dmg, int offset, boolean controllerLayer, int aBaseCasingIndex) { - return check_layer(aBaseMetaTileEntity, radius, yLevel, height, block, dmg, offset, controllerLayer, false, aBaseCasingIndex); + return BW_Util.check_layer(aBaseMetaTileEntity, radius, yLevel, height, block, dmg, offset, controllerLayer, false, aBaseCasingIndex); } public static boolean check_layer(IGregTechTileEntity aBaseMetaTileEntity, int radius, int yLevel, int height, Block block, int dmg, int offset, boolean controllerLayer, boolean freeCorners, int aBaseCasingIndex) { - return check_layer(aBaseMetaTileEntity, radius, yLevel, height, block, dmg, offset, controllerLayer, freeCorners, false, block, dmg, true, aBaseCasingIndex); + return BW_Util.check_layer(aBaseMetaTileEntity, radius, yLevel, height, block, dmg, offset, controllerLayer, freeCorners, false, block, dmg, true, aBaseCasingIndex); } public static boolean check_layer(IGregTechTileEntity aBaseMetaTileEntity, int radius, int yLevel, int height, Block block, int dmg, int offset, boolean controllerLayer, boolean insideCheck, Block inside, int dmginside, int aBaseCasingIndex) { - return check_layer(aBaseMetaTileEntity, radius, yLevel, height, block, dmg, offset, controllerLayer, false, insideCheck, inside, dmginside, true, aBaseCasingIndex); + return BW_Util.check_layer(aBaseMetaTileEntity, radius, yLevel, height, block, dmg, offset, controllerLayer, false, insideCheck, inside, dmginside, true, aBaseCasingIndex); } /** @@ -260,10 +363,20 @@ public class BW_Util { continue; if (controllerLayer && (xDir + x == 0 && zDir + z == 0)) continue; - if (insideCheck && (Math.abs(x) < radius && Math.abs(z) != radius)) + if (insideCheck && (Math.abs(x) < radius && Math.abs(z) != radius)) { if (!aBaseMetaTileEntity.getBlockOffset(xDir + x, y, zDir + z).equals(inside) || (aBaseMetaTileEntity.getMetaIDOffset(xDir + x, y, zDir + z) != dmginside && dmginside > (-1))) { - return false; + if (!(allowHatches && ( + ((GT_MetaTileEntity_MultiBlockBase) aBaseMetaTileEntity.getMetaTileEntity()).addDynamoToMachineList(aBaseMetaTileEntity.getIGregTechTileEntityOffset(xDir + x, y, zDir + z), aBaseCasingIndex) || + ((GT_MetaTileEntity_MultiBlockBase) aBaseMetaTileEntity.getMetaTileEntity()).addEnergyInputToMachineList(aBaseMetaTileEntity.getIGregTechTileEntityOffset(xDir + x, y, zDir + z), aBaseCasingIndex) || + ((GT_MetaTileEntity_MultiBlockBase) aBaseMetaTileEntity.getMetaTileEntity()).addMaintenanceToMachineList(aBaseMetaTileEntity.getIGregTechTileEntityOffset(xDir + x, y, zDir + z), aBaseCasingIndex) || + ((GT_MetaTileEntity_MultiBlockBase) aBaseMetaTileEntity.getMetaTileEntity()).addMufflerToMachineList(aBaseMetaTileEntity.getIGregTechTileEntityOffset(xDir + x, y, zDir + z), aBaseCasingIndex) || + ((GT_MetaTileEntity_MultiBlockBase) aBaseMetaTileEntity.getMetaTileEntity()).addInputToMachineList(aBaseMetaTileEntity.getIGregTechTileEntityOffset(xDir + x, y, zDir + z), aBaseCasingIndex) || + ((GT_MetaTileEntity_MultiBlockBase) aBaseMetaTileEntity.getMetaTileEntity()).addOutputToMachineList(aBaseMetaTileEntity.getIGregTechTileEntityOffset(xDir + x, y, zDir + z), aBaseCasingIndex) + ))) { + return false; + } } + } if (((!(Math.abs(x) < radius && Math.abs(z) != radius))) && (!aBaseMetaTileEntity.getBlockOffset(xDir + x, y, zDir + z).equals(block) || (aBaseMetaTileEntity.getMetaIDOffset(xDir + x, y, zDir + z) != dmg && dmg > (-1)))) { if (!(allowHatches && ( ((GT_MetaTileEntity_MultiBlockBase) aBaseMetaTileEntity.getMetaTileEntity()).addDynamoToMachineList(aBaseMetaTileEntity.getIGregTechTileEntityOffset(xDir + x, y, zDir + z), aBaseCasingIndex) || |