diff options
Diffstat (limited to 'src/Java/gtPlusPlus')
6 files changed, 106 insertions, 150 deletions
diff --git a/src/Java/gtPlusPlus/core/recipe/RECIPES_GREGTECH.java b/src/Java/gtPlusPlus/core/recipe/RECIPES_GREGTECH.java index ac17f908a3..8084caff0e 100644 --- a/src/Java/gtPlusPlus/core/recipe/RECIPES_GREGTECH.java +++ b/src/Java/gtPlusPlus/core/recipe/RECIPES_GREGTECH.java @@ -13,6 +13,7 @@ import gtPlusPlus.core.util.fluid.FluidUtils; import gtPlusPlus.core.util.item.ItemUtils; import gtPlusPlus.core.util.reflect.AddGregtechRecipe; import gtPlusPlus.xmod.gregtech.api.enums.GregtechItemList; +import net.minecraft.init.Blocks; import net.minecraft.init.Items; import net.minecraft.item.Item; import net.minecraft.item.ItemStack; @@ -454,7 +455,21 @@ public class RECIPES_GREGTECH { GT_Values.RA.addFuel(ItemUtils.simpleMetaStack("EnderIO:bucketRocket_fuel", 0, 1), null, 112, 0); GT_Values.RA.addFuel(ItemUtils.simpleMetaStack("EnderIO:bucketHootch", 0, 1), null, 36, 0); - HotFuel.addNewHotFuel(GT_ModHandler.getLava(83), GT_ModHandler.getWater(6), GT_ModHandler.getSteam(800), 0); + HotFuel.addNewHotFuel( + GT_ModHandler.getLava(83), + GT_ModHandler.getWater(6), + GT_ModHandler.getSteam(800), + new ItemStack[]{ + ItemUtils.getItemStackOfAmountFromOreDict("nuggetCopper", 1), + ItemUtils.getItemStackOfAmountFromOreDict("nuggetTin", 1), + ItemUtils.getItemStackOfAmountFromOreDict("nuggetGold", 1), + ItemUtils.getItemStackOfAmountFromOreDict("nuggetSilver", 1), + ItemUtils.getItemStackOfAmountFromOreDict("nuggetTantalum", 1), + ItemUtils.getItemStackOfAmountFromOreDict("dustSmallTungstate", 1), + ItemUtils.getSimpleStack(Blocks.obsidian) + }, + new int[]{2000, 1000, 250, 250, 250, 250, 500}, + 0); //CORE.RA.addFuel(UtilsItems.simpleMetaStack("EnderIO:bucketRocket_fuel", 0, 1), null, 112, 0); GT_Values.RA.addFuel(ItemUtils.getSimpleStack(Items.lava_bucket), null, 32, 2); @@ -519,7 +534,7 @@ public class RECIPES_GREGTECH { GT_Values.RA.addMixerRecipe(ItemUtils.getItemStackOfAmountFromOreDict("dustSulfur", 1), null, null, null, FluidUtils.getFluidStack("oxygen", 288), FluidUtils.getFluidStack("sulfurdioxide", 432), null, 600, 60); GT_Values.RA.addMixerRecipe(ItemUtils.getItemStackOfAmountFromOreDict("dustUranium233", 4), ItemUtils.getItemStackOfAmountFromOreDict("dustUranium235", 1), null, null, FluidUtils.getFluidStack("hydrofluoricacid", 144*5), FluidUtils.getFluidStack("molten.uraniumtetrafluoride", 144*5), null, 3000, 500); //GT_Values.RA.addMixerRecipe(ItemUtils.getItemStackOfAmountFromOreDict("cellFluorine", 1), ItemUtils.getItemStackOfAmountFromOreDict("cellFluorine", 1), null, null, FluidUtils.getFluidStack("molten.uraniumtetrafluoride", 720), FluidUtils.getFluidStack("molten.uraniumhexafluoride", 288), null, 5000, 2000); - GT_Values.RA.addMixerRecipe(ItemUtils.getItemStackOfAmountFromOreDict("dustSteel", 20), ItemUtils.getItemStackOfAmountFromOreDict("dustSilicon", 1), ItemUtils.getItemStackOfAmountFromOreDict("dustNickel", 5), ItemUtils.getItemStackOfAmountFromOreDict("dustAluminium", 4), null, null, ItemUtils.getItemStackOfAmountFromOreDict("dustEglinSteel", 30), 1200, 60); + //GT_Values.RA.addMixerRecipe(ItemUtils.getItemStackOfAmountFromOreDict("dustSteel", 20), ItemUtils.getItemStackOfAmountFromOreDict("dustSilicon", 1), ItemUtils.getItemStackOfAmountFromOreDict("dustNickel", 5), ItemUtils.getItemStackOfAmountFromOreDict("dustAluminium", 4), null, null, ItemUtils.getItemStackOfAmountFromOreDict("dustEglinSteel", 30), 1200, 60); } private static void chemicalReactorRecipes(){ diff --git a/src/Java/gtPlusPlus/core/recipe/RECIPES_Machines.java b/src/Java/gtPlusPlus/core/recipe/RECIPES_Machines.java index e3604e2f7d..effff15171 100644 --- a/src/Java/gtPlusPlus/core/recipe/RECIPES_Machines.java +++ b/src/Java/gtPlusPlus/core/recipe/RECIPES_Machines.java @@ -801,9 +801,12 @@ public class RECIPES_Machines { RecipeUtils.addShapedGregtechRecipe( "plateStainlessSteel", "plateStainlessSteel", "plateStainlessSteel", - "circuitAdvanced", CI.machineHull_HV, "circuitAdvanced", + "circuitAdvanced", CI.machineCasing_HV, "circuitAdvanced", "plateStainlessSteel", "plateStainlessSteel", "plateStainlessSteel", RECIPE_ThermalBoilerCasing); + + //Lava Filter Recipe + GT_Values.RA.addAssemblerRecipe(ItemUtils.getItemStackWithMeta(LoadedMods.IndustrialCraft2, "IC2:itemPartCarbonMesh", "RawCarbonMesh", 0, 8), GT_Values.NI, ItemUtils.getSimpleStack(ModItems.itemLavaFilter), 80*20, 16); } diff --git a/src/Java/gtPlusPlus/preloader/Preloader_GT_OreDict.java b/src/Java/gtPlusPlus/preloader/Preloader_GT_OreDict.java index 7583493be4..f8bb372d66 100644 --- a/src/Java/gtPlusPlus/preloader/Preloader_GT_OreDict.java +++ b/src/Java/gtPlusPlus/preloader/Preloader_GT_OreDict.java @@ -1,70 +1,11 @@ package gtPlusPlus.preloader; -import cpw.mods.fml.common.eventhandler.SubscribeEvent; import gregtech.common.items.GT_MetaGenerated_Item_01; -import gtPlusPlus.core.item.ModItems; -import gtPlusPlus.core.util.Utils; -import gtPlusPlus.core.util.item.ItemUtils; -import gtPlusPlus.xmod.gregtech.common.Meta_GT_Proxy; import net.minecraft.item.ItemStack; -import net.minecraftforge.oredict.OreDictionary.OreRegisterEvent; public class Preloader_GT_OreDict { - @SubscribeEvent - public void onItemRegisteredToOreDictionary(final OreRegisterEvent event) throws Throwable { - String name = event.Name; - ItemStack ore = event.Ore; - // Check Item is Valid - if (ore != null && (name != null && !name.equals(""))) { - // Check Item has a Valid MODID - String MODID = ""; - - try { - MODID = ItemUtils.getModId(ore); - } - catch (NullPointerException n) { - Utils.LOG_INFO("[Bug] Found Item with Bad MODID - " + ore.getDisplayName() - + " | If you recognise this item, please inform the developer."); - } - - if (MODID != null) { - // Check Item has a Valid MODID - if (!MODID.equals("")) { - // Check Item is from Gregtech - if (MODID.equals("gregtech")) { - //Utils.LOG_INFO("Found GT ITEM - " + ore.getDisplayName()); - // Circuit Removal - if (Meta_GT_Proxy.areWeUsingGregtech5uExperimental() && CORE_Preloader.enableOldGTcircuits) { - if (removeCircuit(ore)) { - Utils.LOG_INFO("[Old Feature - Circuits] Preventing " + ore.getDisplayName() - + " from registering itself with oredict tag " + name + "."); - //Do Magic - if (event.isCancelable()){ - event.setCanceled(true); - } - else { - try { - ore = ItemUtils.getSimpleStack(ModItems.AAA_Broken); - name = "null"; - //event.setCanceled(true); - throw new OreDictCancelledException("[Old Feature - Circuits] Circuit OreDict event cancelled."); - } - catch(OreDictCancelledException | UnsupportedOperationException | IllegalArgumentException o){ - Utils.LOG_INFO("[Old Feature - Circuits] Circuit OreDict event cancelled."); - } - finally{ - - } - } - } - } - } - } - } - } - } - - public static boolean removeCircuit(ItemStack circuit) { + + public static boolean shouldPreventRegistration(String string, ItemStack circuit) { int damageValue = circuit.getItemDamage() - 32000; if (circuit.getItem() instanceof GT_MetaGenerated_Item_01) { // 700-720 if (damageValue >= 700 && damageValue <= 720) { @@ -74,7 +15,7 @@ public class Preloader_GT_OreDict { else { try { if (Class.forName("gregtech.common.items.GT_MetaGenerated_Item_03") != null) { // 6/11/12/14/16/20/30-57/69-73/79-96 - Class MetaItem03 = Class.forName("gregtech.common.items.GT_MetaGenerated_Item_03"); + Class<?> MetaItem03 = Class.forName("gregtech.common.items.GT_MetaGenerated_Item_03"); if (isInstanceOf(MetaItem03, circuit.getItem())) { if (damageValue == 6 || damageValue == 11 || damageValue == 12 || damageValue == 14 || damageValue == 16 || damageValue == 20) { @@ -99,13 +40,8 @@ public class Preloader_GT_OreDict { } // Simplification of Life. - private static boolean isInstanceOf(Class clazz, Object obj) { + private static boolean isInstanceOf(Class<?> clazz, Object obj) { return clazz.isInstance(obj); } - - class OreDictCancelledException extends Exception { - public OreDictCancelledException(String msg){ - super(msg); - } - } + } diff --git a/src/Java/gtPlusPlus/preloader/asm/Preloader_ClassTransformer.java b/src/Java/gtPlusPlus/preloader/asm/Preloader_ClassTransformer.java index 330aef318a..e3a022dd6a 100644 --- a/src/Java/gtPlusPlus/preloader/asm/Preloader_ClassTransformer.java +++ b/src/Java/gtPlusPlus/preloader/asm/Preloader_ClassTransformer.java @@ -1,88 +1,68 @@ package gtPlusPlus.preloader.asm; -import static org.objectweb.asm.Opcodes.ALOAD; -import static org.objectweb.asm.Opcodes.INVOKESTATIC; - -import java.util.Iterator; +import static org.objectweb.asm.Opcodes.*; +import org.apache.logging.log4j.Level; import org.objectweb.asm.*; -import org.objectweb.asm.tree.*; -import gtPlusPlus.core.util.Utils; +import cpw.mods.fml.relauncher.FMLRelaunchLog; import net.minecraft.launchwrapper.IClassTransformer; public class Preloader_ClassTransformer implements IClassTransformer { @Override - public byte[] transform(String name, String transformedName, byte[] basicClass) { - - /*if (name.equals("abq")) { - Utils.LOG_ASM("[ASM] INSIDE OBFUSCATED EXPLOSION TRANSFORMER ABOUT TO PATCH: " + name); - return patchClassASM(name, basicClass, true); - } - - else if (name.equals("net.minecraftforge.oredict.OreDictionary")) { - Utils.LOG_ASM("[ASM] INSIDE OREDICT TRANSFORMER ABOUT TO PATCH: " + name); - return patchClassASM(name, basicClass, false); - }*/ - return basicClass; - } - - public byte[] patchClassASM(String name, byte[] bytes, boolean obfuscated) { - - String targetMethodName = ""; - - if(obfuscated == true) - targetMethodName ="a"; - else - targetMethodName ="registerOreImpl"; - - - //set up ASM class manipulation stuff. Consult the ASM docs for details - ClassNode classNode = new ClassNode(); - ClassReader classReader = new ClassReader(bytes); - classReader.accept(classNode, 0); - - - - //Now we loop over all of the methods declared inside the Explosion class until we get to the targetMethodName "doExplosionB" - - // find method to inject into - Iterator<MethodNode> methods = classNode.methods.iterator(); - while(methods.hasNext()) - { - MethodNode m = methods.next(); - Utils.LOG_ASM("[ASM] Method Name: "+m.name + " Desc:" + m.desc); - - //Check if this is doExplosionB and it's method signature is (Z)V which means that it accepts a boolean (Z) and returns a void (V) - if ((m.name.equals(targetMethodName) && m.desc.equals("(Ljava/lang/String;Lnet/minecraft/item/ItemStack;)V"))) - { - Utils.LOG_ASM("[ASM] Inside target method!"); - // find interesting instructions in method, there is a single FDIV instruction we use as target - - // make new instruction list - InsnList toInject = new InsnList(); - - //toInject.add(new VarInsnNode(ALOAD, 0)); - - toInject.add(new VarInsnNode(ALOAD, 1)); - toInject.add(new MethodInsnNode(INVOKESTATIC, "gtPlusPlus/preloader/Preloader_GT_OreDict", "removeCircuit", "(Lnet/minecraft/item/ItemStack;)Z, false")); - toInject.add(new VarInsnNode(Opcodes.IFEQ, 1)); - toInject.add(new VarInsnNode(Opcodes.RETURN, 0)); - //toInject.add(new VarInsnNode(org.objectweb.asm.Opcodes.LABEL END, 0)); - - // inject new instruction list into method instruction list - m.instructions.insert(toInject); - - Utils.LOG_ASM("Patching Complete!"); - break; - } - } - - //ASM specific for cleaning up and returning the final bytes for JVM processing. - ClassWriter writer = new ClassWriter(ClassWriter.COMPUTE_MAXS | ClassWriter.COMPUTE_FRAMES); - classNode.accept(writer); - return writer.toByteArray(); - } + public byte[] transform(String name, String transformedName, byte[] basicClass) { + if(transformedName.equals("net.minecraftforge.oredict.OreDictionary")) { + FMLRelaunchLog.log("[GT++] OreDictTransformer", Level.INFO, "Transforming %s", transformedName); + ClassWriter classWriter = new ClassWriter(ClassWriter.COMPUTE_FRAMES); + new ClassReader(basicClass).accept(new OreDictionaryVisitor(classWriter), 0); + return classWriter.toByteArray(); + } + return basicClass; + } + +private static final class OreDictionaryVisitor extends ClassVisitor { + + public OreDictionaryVisitor(ClassVisitor cv) { + super(ASM5, cv); + } + + @Override + public MethodVisitor visitMethod(int access, String name, String desc, String signature, String[] exceptions) { + MethodVisitor methodVisitor = super.visitMethod(access, name, desc, signature, exceptions); + if(name.equals("registerOreImpl") && desc.equals("(Ljava/lang/String;Lnet/minecraft/item/ItemStack;)V")) { + FMLRelaunchLog.log("[GT++] OreDictTransformer", Level.INFO, "Found target method."); + return new RegisterOreImplVisitor(methodVisitor); + } + return methodVisitor; + } + + } + + private static final class RegisterOreImplVisitor extends MethodVisitor { + + public RegisterOreImplVisitor(MethodVisitor mv) { + super(ASM5, mv); + } + + @SuppressWarnings("deprecation") + @Override + public void visitCode() { + super.visitCode(); + super.visitVarInsn(ALOAD, 0); + super.visitVarInsn(ALOAD, 1); + super.visitMethodInsn(INVOKESTATIC, + //"gtPlusPlus/preloader/Preloader_GT_OreDict", "removeCircuit", "(Lnet/minecraft/item/ItemStack;)Z, false"); + "gtPlusPlus/preloader/Preloader_GT_OreDict", + "shouldPreventRegistration", + "(Ljava/lang/String;Lnet/minecraft/item/ItemStack;)Z", + false); + Label endLabel = new Label(); + super.visitJumpInsn(IFEQ, endLabel); + super.visitInsn(RETURN); + super.visitLabel(endLabel); + } + + } } diff --git a/src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/GT4Entity_ThermalBoiler.java b/src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/GT4Entity_ThermalBoiler.java index 67cf171e3f..76d9dd520e 100644 --- a/src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/GT4Entity_ThermalBoiler.java +++ b/src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/GT4Entity_ThermalBoiler.java @@ -12,6 +12,7 @@ import gregtech.api.util.*; import gtPlusPlus.core.block.ModBlocks; import gtPlusPlus.core.lib.CORE; import gtPlusPlus.core.util.Utils; +import gtPlusPlus.core.util.item.ItemUtils; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.item.ItemStack; @@ -59,10 +60,22 @@ extends GT_MetaTileEntity_MultiBlockBase @Override public boolean checkRecipe(ItemStack aStack) { - Collection<GT_Recipe> hotFuels = GT_Recipe.GT_Recipe_Map.sHotFuels.mRecipeList; + Collection<GT_Recipe> hotFuels = Recipe_GT.Gregtech_Recipe_Map.sThermalFuels.mRecipeList; for (GT_Recipe tRecipe : hotFuels) { + Utils.LOG_INFO("iterating hot fuels "); + Utils.LOG_INFO("aStack: "+aStack.getDisplayName()); + Utils.LOG_INFO("========================"); + Utils.LOG_INFO("Dumping Input: " + ItemUtils.getArrayStackNames(tRecipe.mInputs)); + Utils.LOG_INFO("Dumping Inputs " + ItemUtils.getFluidArrayStackNames(tRecipe.mFluidInputs)); + Utils.LOG_INFO("Dumping Duration: " + tRecipe.mDuration); + Utils.LOG_INFO("Dumping EU/t: " + tRecipe.mEUt); + Utils.LOG_INFO("Dumping Output: " + ItemUtils.getArrayStackNames(tRecipe.mOutputs)); + Utils.LOG_INFO("Dumping Output: " + ItemUtils.getFluidArrayStackNames(tRecipe.mFluidOutputs)); + Utils.LOG_INFO("========================"); + if (depleteInput(tRecipe.getRepresentativeInput(0))) { + Utils.LOG_INFO("found something"); this.mEUt = 400; this.mMaxProgresstime = (tRecipe.mEUt * 2 / 5); this.mEfficiencyIncrease = (this.mMaxProgresstime * 30); @@ -90,6 +103,7 @@ extends GT_MetaTileEntity_MultiBlockBase if (this.mEUt > 0) { int tGeneratedEU = (int)(this.mEUt * 2L * this.mEfficiency / 10000L); + Utils.LOG_INFO("tGeneratedEU: "+tGeneratedEU); if ((tGeneratedEU > 0) && (depleteInput(GT_ModHandler.getWater((tGeneratedEU + 160) / 160)))) { addOutput(GT_ModHandler.getSteam(tGeneratedEU)); } diff --git a/src/Java/gtPlusPlus/xmod/gregtech/registration/gregtech/Gregtech4Content.java b/src/Java/gtPlusPlus/xmod/gregtech/registration/gregtech/Gregtech4Content.java index 121de39221..d5cb8401c6 100644 --- a/src/Java/gtPlusPlus/xmod/gregtech/registration/gregtech/Gregtech4Content.java +++ b/src/Java/gtPlusPlus/xmod/gregtech/registration/gregtech/Gregtech4Content.java @@ -4,12 +4,16 @@ import gregtech.api.util.GT_Utility; import gtPlusPlus.core.lib.CORE; import gtPlusPlus.core.lib.LoadedMods; import gtPlusPlus.core.util.Utils; +import gtPlusPlus.core.util.item.ItemUtils; +import gtPlusPlus.core.util.recipe.RecipeUtils; import gtPlusPlus.xmod.gregtech.api.enums.GregtechItemList; import gtPlusPlus.xmod.gregtech.common.tileentities.automation.GT_MetaTileEntity_TesseractGenerator; import gtPlusPlus.xmod.gregtech.common.tileentities.automation.GT_MetaTileEntity_TesseractTerminal; import gtPlusPlus.xmod.gregtech.common.tileentities.machines.multi.GT4Entity_AutoCrafter; import gtPlusPlus.xmod.gregtech.common.tileentities.machines.multi.GT4Entity_ThermalBoiler; import gtPlusPlus.xmod.gregtech.common.tileentities.storage.shelving.*; +import net.minecraft.init.Items; +import net.minecraft.item.ItemStack; public class Gregtech4Content { @@ -72,8 +76,10 @@ public class Gregtech4Content { GregtechItemList.GT4_Thermal_Boiler .set(new GT4Entity_ThermalBoiler(875, "gtplusplus.thermal.boiler", "Thermal Boiler").getStackForm(1L)); + + //Thermal Boiler Manual - GT_Utility.getWrittenBook( + ItemStack manual_Boiler = GT_Utility.getWrittenBook( "Manual_Thermal_Boiler", "Thermal Boiler Manual", "Alkalus", new String[] { "This Book explains how to set up and run your Thermal Boiler. We are not responsible for any Damage done by this Book itself nor its content.", @@ -91,6 +97,8 @@ public class Gregtech4Content { "The Thermal Boiler will produce 800 Liters of Steam per tick for about 5 or 6 Liters of Water per tick at reaching 100% Efficiency. In case of Lava it consumes 1666 Liters every Second.", "A Thermal Boiler is worth about 33 small Thermal Generators, and as the Boilers get much less Efficient, when not having enough Fuel, you should consider making a large Nether Pump for Lava, or a good Nuclear Reactor for molten Salt.", "Input and Output Slots are fully optional, you can place multiple ones of them or even none on the Machine. A Machine without Input couldn't process any Recipes, while a Machine without Output just voids all outputted Items and Liquids.", "It might be useful to use the Screwdriver on the Output Hatches to determine what is outputted where." }); + + RecipeUtils.addShapelessGregtechRecipe(new ItemStack[]{ItemUtils.getSimpleStack(Items.writable_book), ItemUtils.getSimpleStack(Items.lava_bucket)}, manual_Boiler); } } |