diff options
Diffstat (limited to 'src/Java/gtPlusPlus')
15 files changed, 1646 insertions, 47 deletions
diff --git a/src/Java/gtPlusPlus/core/block/ModBlocks.java b/src/Java/gtPlusPlus/core/block/ModBlocks.java index f958dc27d7..35dd65a8f1 100644 --- a/src/Java/gtPlusPlus/core/block/ModBlocks.java +++ b/src/Java/gtPlusPlus/core/block/ModBlocks.java @@ -64,6 +64,12 @@ public final class ModBlocks { public static Block blockXpConverter; public static Block blockCompressedObsidian; public static Block blockNet; + + public static Block blockPlayerDoorWooden; + public static Block blockPlayerDoorIron; + public static Block blockPlayerDoorCustom_Glass; + public static Block blockPlayerDoorCustom_Ice; + public static Block blockPlayerDoorCustom_Cactus; public static Block blockCustomMobSpawner; @@ -102,6 +108,12 @@ public final class ModBlocks { blockFakeMiningPipe = new Mining_Pipe_Fake(); blockFakeMiningHead = new Mining_Head_Fake(); + + blockPlayerDoorWooden = new PlayerDoors(Material.wood, "door_wood", true); + blockPlayerDoorIron = new PlayerDoors(Material.iron, "door_iron", true); + blockPlayerDoorCustom_Glass = new PlayerDoors(Material.glass, "door_glass", false); + blockPlayerDoorCustom_Ice = new PlayerDoors(Material.ice, "door_ice", false); + blockPlayerDoorCustom_Cactus = new PlayerDoors(Material.cactus, "door_cactus", false); } diff --git a/src/Java/gtPlusPlus/core/block/general/PlayerDoors.java b/src/Java/gtPlusPlus/core/block/general/PlayerDoors.java new file mode 100644 index 0000000000..ce28520862 --- /dev/null +++ b/src/Java/gtPlusPlus/core/block/general/PlayerDoors.java @@ -0,0 +1,116 @@ +package gtPlusPlus.core.block.general; + +import java.util.ArrayList; +import java.util.Random; + +import cpw.mods.fml.common.registry.GameRegistry; +import gtPlusPlus.core.lib.CORE; +import gtPlusPlus.core.tileentities.general.TileEntityPlayerDoorBase; +import gtPlusPlus.core.util.Utils; +import net.minecraft.block.Block; +import net.minecraft.block.BlockDoor; +import net.minecraft.block.material.Material; +import net.minecraft.entity.player.EntityPlayer; +import net.minecraft.item.Item; +import net.minecraft.item.ItemStack; +import net.minecraft.tileentity.TileEntity; +import net.minecraft.world.World; + +public class PlayerDoors extends BlockDoor { + + private boolean mHasDrops = true; + + public PlayerDoors(Material aMaterial, String aTextureName, boolean vanillaType) { + this (aMaterial, aTextureName, vanillaType, 0f, null, null); + } + + public PlayerDoors(Material aMaterial, String aTextureName, boolean vanillaType, float aHardness, SoundType aStepSound, String aBlockExtensionName) { + super(aMaterial); + this.disableStats(); + this.setBlockName("playerDoor_"+aTextureName); + if (aMaterial == Material.wood) { + setHardness(3.0F); + setStepSound(soundTypeWood); + setBlockName("playerDoor"+"Wood"); + this.setHarvestLevel("axe", 1); + } + else if (aMaterial == Material.iron) { + setHardness(5.0F); + setStepSound(Block.soundTypeMetal); + setBlockName("playerDoor"+"Iron"); + this.setHarvestLevel("pickaxe", 1); + + } + else if (aMaterial == Material.glass) { + setHardness(0.1F); + setStepSound(Block.soundTypeGlass); + setBlockName("playerDoor"+"Glass"); + this.setHarvestLevel("pickaxe", 1); + mHasDrops = false; + + } + else if (aMaterial == Material.ice) { + setHardness(0.5F); + setStepSound(Block.soundTypeSnow); + setBlockName("playerDoor"+"Ice"); + this.setHarvestLevel("pickaxe", 1); + mHasDrops = false; + + } + else { + setHardness(aHardness); + setStepSound(aStepSound); + setBlockName("playerDoor"+aBlockExtensionName); + this.setHarvestLevel("axe", 1); + + } + this.setBlockTextureName(vanillaType ? aTextureName : CORE.MODID+":"+aTextureName); + GameRegistry.registerBlock(this, Utils.sanitizeString(this.getUnlocalizedName())); + } + + @Override + public TileEntity createTileEntity(World world, int metadata) { + return new TileEntityPlayerDoorBase(this, metadata); + } + + @Override + public Item getItemDropped(int p_149650_1_, Random p_149650_2_, int p_149650_3_) { + // TODO Auto-generated method stub + return super.getItemDropped(p_149650_1_, p_149650_2_, p_149650_3_); + } + + @Override + public Item getItem(World p_149694_1_, int p_149694_2_, int p_149694_3_, int p_149694_4_) { + // TODO Auto-generated method stub + return super.getItem(p_149694_1_, p_149694_2_, p_149694_3_, p_149694_4_); + } + + @Override + public void onBlockHarvested(World p_149681_1_, int p_149681_2_, int p_149681_3_, int p_149681_4_, int p_149681_5_, + EntityPlayer p_149681_6_) { + // TODO Auto-generated method stub + super.onBlockHarvested(p_149681_1_, p_149681_2_, p_149681_3_, p_149681_4_, p_149681_5_, p_149681_6_); + } + + @Override + public void breakBlock(World p_149749_1_, int p_149749_2_, int p_149749_3_, int p_149749_4_, Block p_149749_5_, + int p_149749_6_) { + // TODO Auto-generated method stub + super.breakBlock(p_149749_1_, p_149749_2_, p_149749_3_, p_149749_4_, p_149749_5_, p_149749_6_); + } + + @Override + protected void dropBlockAsItem(World p_149642_1_, int p_149642_2_, int p_149642_3_, int p_149642_4_, + ItemStack p_149642_5_) { + // TODO Auto-generated method stub + super.dropBlockAsItem(p_149642_1_, p_149642_2_, p_149642_3_, p_149642_4_, p_149642_5_); + } + + @Override + public ArrayList<ItemStack> getDrops(World world, int x, int y, int z, int metadata, int fortune) { + return mHasDrops ? super.getDrops(world, x, y, z, metadata, fortune) : new ArrayList<ItemStack>(); + } + + + +} diff --git a/src/Java/gtPlusPlus/core/item/ModItems.java b/src/Java/gtPlusPlus/core/item/ModItems.java index 78cea37735..02ddf9280b 100644 --- a/src/Java/gtPlusPlus/core/item/ModItems.java +++ b/src/Java/gtPlusPlus/core/item/ModItems.java @@ -33,6 +33,7 @@ import gtPlusPlus.core.item.bauble.HealthBoostBauble; import gtPlusPlus.core.item.bauble.ModularBauble; import gtPlusPlus.core.item.chemistry.CoalTar; import gtPlusPlus.core.item.chemistry.NuclearChem; +import gtPlusPlus.core.item.chemistry.RocketFuels; import gtPlusPlus.core.item.effects.RarityUncommon; import gtPlusPlus.core.item.general.*; import gtPlusPlus.core.item.general.books.ItemBaseBook; @@ -603,7 +604,7 @@ public final class ModItems { //Zirconium Tetrafluoride GT_OreDictUnificator.registerOre("cellZrF4", ItemUtils.getItemStackOfAmountFromOreDict("cellZirconiumTetrafluoride", 1)); GT_OreDictUnificator.registerOre("dustZrF4", ItemUtils.getItemStackOfAmountFromOreDict("dustZirconiumTetrafluoride", 1)); - FluidUtils.generateFluid("ZirconiumTetrafluoride", "Zirconium Tetrafluoride [ZrF4]", 500, new short[]{170, 170, 140, 100}); //https://en.wikipedia.org/wiki/Zirconium_tetrafluoride + FluidUtils.generateFluidNoPrefix("ZirconiumTetrafluoride", "Zirconium Tetrafluoride", 500, new short[]{170, 170, 140, 100}); //https://en.wikipedia.org/wiki/Zirconium_tetrafluoride //Coolant Salt //NaBF4 - NaF - 621C @@ -749,6 +750,7 @@ public final class ModItems { //Chemistry CoalTar.run(); + RocketFuels.run(); //Nuclear Processing NuclearChem.run(); diff --git a/src/Java/gtPlusPlus/core/item/base/ingots/BaseItemIngotHot.java b/src/Java/gtPlusPlus/core/item/base/ingots/BaseItemIngotHot.java index a6206e7e08..555164229b 100644 --- a/src/Java/gtPlusPlus/core/item/base/ingots/BaseItemIngotHot.java +++ b/src/Java/gtPlusPlus/core/item/base/ingots/BaseItemIngotHot.java @@ -39,7 +39,8 @@ public class BaseItemIngotHot extends BaseItemIngot{ @Override public String getItemStackDisplayName(final ItemStack p_77653_1_) { - return ("Hot "+this.materialName+ " Ingot"); + return super.getItemStackDisplayName(p_77653_1_); + //return ("Hot "+this.materialName+ " Ingot"); } @Override diff --git a/src/Java/gtPlusPlus/core/item/chemistry/RocketFuels.java b/src/Java/gtPlusPlus/core/item/chemistry/RocketFuels.java new file mode 100644 index 0000000000..82c546d699 --- /dev/null +++ b/src/Java/gtPlusPlus/core/item/chemistry/RocketFuels.java @@ -0,0 +1,477 @@ +package gtPlusPlus.core.item.chemistry; + +import net.minecraft.item.Item; +import net.minecraft.item.ItemStack; + +import java.util.HashMap; +import java.util.HashSet; + +import gregtech.api.enums.GT_Values; +import gregtech.api.util.Recipe_GT; +import gtPlusPlus.api.objects.data.AutoMap; +import gtPlusPlus.core.item.ModItems; +import gtPlusPlus.core.lib.CORE; +import gtPlusPlus.core.recipe.common.CI; +import gtPlusPlus.core.util.Utils; +import gtPlusPlus.core.util.minecraft.FluidUtils; +import gtPlusPlus.core.util.minecraft.ItemUtils; +import net.minecraftforge.fluids.Fluid; +import net.minecraftforge.fluids.FluidStack; + +public class RocketFuels { + + public static HashSet<String> mValidRocketFuelNames = new HashSet<String>(); + public static HashMap<Integer, Fluid> mValidRocketFuels = new HashMap<Integer, Fluid>(); + + public static Fluid Kerosene; + public static Fluid RP1; + public static Fluid Nitrogen_Tetroxide; + public static Fluid Hydrazine; + public static Fluid Monomethylhydrazine; + public static Fluid Unsymmetrical_Dimethylhydrazine; + public static Fluid Nitrous_Oxide; + public static Fluid Hydrated_Ammonium_Nitrate_Slurry; + public static Fluid Liquid_Oxygen; + public static Fluid Formaldehyde; + + + //Rocket Fuel Mixs + public static Fluid Unsymmetrical_Dimethylhydrazine_Plus_Nitrogen_Tetroxide; + public static Fluid RP1_Plus_Liquid_Oxygen; + public static Fluid Dense_Hydrazine_Mix; + public static Fluid Monomethylhydrazine_Plus_Nitric_Acid; + + public static Item Ammonium_Nitrate_Dust; + public static Item Formaldehyde_Catalyst; + + public static void run(){ + + //Create Kerosene + Kerosene = FluidUtils.generateFluidNonMolten("Kerosene", "Kerosene", 500, new short[]{150, 40, 150, 100}, null, null); + + //RP! Focket Fuel + RP1 = FluidUtils.generateFluidNonMolten("RP1Fuel", "RP-1 Rocket Fuel", 500, new short[]{210, 50, 50, 100}, null, null); + + //Create Nitrogen Tetroxide + Nitrogen_Tetroxide = FluidUtils.generateFluidNonMolten("NitrogenTetroxide", "Nitrogen Tetroxide", -11, new short[]{170, 170, 0, 100}, null, null); + + //Create Hydrazine + Hydrazine = FluidUtils.generateFluidNonMolten("Hydrazine", "Hydrazine", 2, new short[]{250, 250, 250, 100}, null, null); + + //Create Monomethylhydrazine + Monomethylhydrazine = FluidUtils.generateFluidNonMolten("Monomethylhydrazine", "Monomethylhydrazine", -52, new short[]{125, 125, 125, 100}, null, null); + + //Create Anthracene + Nitrous_Oxide = FluidUtils.generateFluidNonMolten("NitrousOxide", "Nitrous Oxide", -91, new short[]{255, 255, 255, 100}, null, null); + + //Unsymmetrical_Dimethylhydrazine + if (FluidUtils.getFluidStack("1,1dimethylhydrazine", 1) == null){ + Unsymmetrical_Dimethylhydrazine = FluidUtils.generateFluidNonMolten("UnsymmetricalDimethylhydrazine", "Unsymmetrical Dimethylhydrazine", -57, new short[]{70, 210, 20, 100}, null, null); + } + else { + Unsymmetrical_Dimethylhydrazine = FluidUtils.getFluidStack("1,1dimethylhydrazine", 1000).getFluid(); + } + + //Create Hydrated_Ammonium_Nitrate_Slurry + Hydrated_Ammonium_Nitrate_Slurry = FluidUtils.generateFluidNonMolten("AmmoniumNitrateSlurry", "Hydrated Ammonium Nitrate Slurry", 450, new short[]{150, 75, 150, 100}, null, null); + + //Lithium Hydroperoxide - LiOH + H2O2 → LiOOH + 2 H2O + Ammonium_Nitrate_Dust = ItemUtils.generateSpecialUseDusts("AmmoniumNitrate", "Ammonium Nitrate", "N2H4O3", Utils.rgbtoHexValue(150, 75, 150))[0]; + + //Create Liquid_Oxygen + if (FluidUtils.getFluidStack("LiquidOxygen", 1) == null){ + Liquid_Oxygen = FluidUtils.generateFluidNonMolten("LiquidOxygen", "Liquid Oxygen", -240, new short[]{75, 75, 220, 100}, null, null); + } + else { + Liquid_Oxygen = FluidUtils.getFluidStack("LiquidOxygen", 1000).getFluid(); + } + + Formaldehyde = FluidUtils.generateFluidNonMolten("Formaldehyde", "Formaldehyde", -92, new short[]{150, 75, 150, 100}, null, null); + + Formaldehyde_Catalyst = ItemUtils.generateSpecialUseDusts("FormaldehydeCatalyst", "Formaldehyde Catalyst", "Fe16V1", Utils.rgbtoHexValue(25, 5, 25))[0]; + + + Unsymmetrical_Dimethylhydrazine_Plus_Nitrogen_Tetroxide = FluidUtils.generateFluidNonMolten("RocketFuelMixA", "H2NN(CH3)2N2O4 Rocket Fuel", -185, new short[]{50, 220, 50, 100}, null, null); + RP1_Plus_Liquid_Oxygen = FluidUtils.generateFluidNonMolten("RocketFuelMixB", "Rp-1 Fuel Mixture", -250, new short[]{250, 50, 50, 100}, null, null); + Monomethylhydrazine_Plus_Nitric_Acid = FluidUtils.generateFluidNonMolten("RocketFuelMixC", "CN3H7O3 Rocket Fuel", -300, new short[]{125, 75, 180, 100}, null, null); + Dense_Hydrazine_Mix = FluidUtils.generateFluidNonMolten("RocketFuelMixD", "Dense Hydrazine Fuel Mixture", -250, new short[]{175, 80, 120, 100}, null, null); + + + + createRecipes(); + + + } + + private static void createRecipes() { + createKorosene(); + createRP1(); + createNitrogenTetroxide(); + createHydrazine(); + createMonomethylhydrazine(); + + if (!CORE.GTNH) { + createLOX(); + } + + + createHydratedAmmoniumNitrateSlurry(); + createAmmoniumNitrateDust(); + createFormaldehyde(); + createFormaldehydeCatalyst(); + createUnsymmetricalDimethylhydrazine(); + + createRocketFuels(); + addRocketFuelsToMap(); + + } + + public static void createKorosene(){ + FluidStack fuelA = FluidUtils.getFluidStack("diesel", 400); + FluidStack fuelB = FluidUtils.getFluidStack("fuel", 400); + if (fuelA != null){ + GT_Values.RA.addDistilleryRecipe(23, fuelA, FluidUtils.getFluidStack(Kerosene, 50), 200, 64, false); + } + if (fuelA == null && fuelB != null){ + GT_Values.RA.addDistilleryRecipe(23, fuelB, FluidUtils.getFluidStack(Kerosene, 50), 200, 64, false); + } + } + + public static void createRP1(){ + FluidStack fuelA = FluidUtils.getFluidStack(Kerosene, 100); + if (fuelA != null){ + GT_Values.RA.addDistilleryRecipe(23, fuelA, FluidUtils.getFluidStack(RP1, 25), 400, 120, false); + } + } + + public static void createNitrogenTetroxide(){ + CORE.RA.addDehydratorRecipe( + new ItemStack[]{ + ItemUtils.getItemStackOfAmountFromOreDict("dustCopper", 4) + }, + FluidUtils.getFluidStack("nitricacid", 2000), + FluidUtils.getFluidStack(Nitrogen_Tetroxide, 450), + new ItemStack[]{ + ItemUtils.getItemStackOfAmountFromOreDict("dustTinyAsh", 1), + ItemUtils.getItemStackOfAmountFromOreDict("dustTinyDarkAsh", 1) + }, + new int[]{100, 50}, + 20*16, + 500); + } + + public static void createHydrazine(){ + GT_Values.RA.addChemicalRecipe( + ItemUtils.getItemStackOfAmountFromOreDict("cellAmmonia", 2), + CI.getNumberedCircuit(23), + FluidUtils.getFluidStack("fluid.hydrogenperoxide", 2000), + FluidUtils.getFluidStack(Hydrazine, 2000), + ItemUtils.getItemStackOfAmountFromOreDict("cellWater", 2), + 20*32); + + GT_Values.RA.addChemicalRecipe( + ItemUtils.getItemStackOfAmountFromOreDict("cellHydrogenPeroxide", 2), + CI.getNumberedCircuit(23), + FluidUtils.getFluidStack("ammonia", 2000), + FluidUtils.getFluidStack(Hydrazine, 2000), + ItemUtils.getItemStackOfAmountFromOreDict("cellWater", 2), + 20*32); + } + + + public static void createMonomethylhydrazine(){ + CORE.RA.addDehydratorRecipe( + new ItemStack[] { + ItemUtils.getItemStackOfAmountFromOreDict("cellHydrazine", 2), + ItemUtils.getItemStackOfAmountFromOreDict("dustCarbon", 2) + }, + FluidUtils.getFluidStack("hydrogen", 2000), + FluidUtils.getFluidStack(Monomethylhydrazine, 3000), + new ItemStack[] { + CI.emptyCells(4) + }, + new int[] {10000}, + 20*48, + 240); + + } + + private static void createLOX() { + GT_Values.RA.addVacuumFreezerRecipe(ItemUtils.getItemStackOfAmountFromOreDict("cellOxygen", 1), ItemUtils.getItemStackOfAmountFromOreDict("cellLiquidOxygen", 1), 20*16); + CORE.RA.addAdvancedFreezerRecipe(new ItemStack[] {}, new FluidStack[] {FluidUtils.getFluidStack("oxygen", 3000)}, new FluidStack[] {FluidUtils.getFluidStack(Liquid_Oxygen, 3000)}, new ItemStack[] {}, new int[] {}, 20*16, 240, 0); + + } + + private static void createHydratedAmmoniumNitrateSlurry() { + GT_Values.RA.addChemicalRecipe( + ItemUtils.getItemStackOfAmountFromOreDict("cellAmmonia", 8), + ItemUtils.getItemStackOfAmountFromOreDict("cellNitricAcid", 8), + null, + FluidUtils.getFluidStack(Hydrated_Ammonium_Nitrate_Slurry, 22*144), + null, + 48*16); + + } + + private static void createAmmoniumNitrateDust() { + CORE.RA.addDehydratorRecipe( + new ItemStack[] {CI.getNumberedCircuit(8)}, + FluidUtils.getFluidStack(Hydrated_Ammonium_Nitrate_Slurry, 8*144), + FluidUtils.getWater(2000), + new ItemStack[] {ItemUtils.getSimpleStack(Ammonium_Nitrate_Dust, 8)}, + new int[] {10000}, + 90*20, + 500); + + } + + private static void createFormaldehyde() { + CORE.RA.addDehydratorRecipe( + new ItemStack[] { + ItemUtils.getSimpleStack(Formaldehyde_Catalyst, 1), + ItemUtils.getItemStackOfAmountFromOreDict("cellOxygen", 16) + }, + FluidUtils.getFluidStack("methanol", 32000), + FluidUtils.getFluidStack(Formaldehyde, 8000), + new ItemStack[] {ItemUtils.getItemStackOfAmountFromOreDict("cellWater", 16)}, + new int[] {10000}, + 90*20, + 120); + } + + private static void createFormaldehydeCatalyst() { + GT_Values.RA.addMixerRecipe( + ItemUtils.getItemStackOfAmountFromOreDict("dustIron", 16), + ItemUtils.getItemStackOfAmountFromOreDict("dustVanadium", 1), + CI.getNumberedCircuit(18), + null, + null, + null, + ItemUtils.getSimpleStack(Formaldehyde_Catalyst, 4), + 160, + 30); + + } + + private static void createUnsymmetricalDimethylhydrazine() { + GT_Values.RA.addChemicalRecipe( + ItemUtils.getItemStackOfAmountFromOreDict("cellHydrazine", 2), + ItemUtils.getItemStackOfAmountFromOreDict("cellFormaldehyde", 2), + FluidUtils.getFluidStack("hydrogen", 4000), + FluidUtils.getFluidStack(Unsymmetrical_Dimethylhydrazine, 1000), + ItemUtils.getItemStackOfAmountFromOreDict("cellEmpty", 2), + ItemUtils.getItemStackOfAmountFromOreDict("cellWater", 2), + 20*60); + + } + + private static void addRocketFuelsToMap() { + AutoMap<Recipe_GT> mRocketFuels = new AutoMap<Recipe_GT>(); + mRocketFuels.put(new Recipe_GT( + true, + new ItemStack[] {}, + new ItemStack[] {}, + null, + new int[] {}, + new FluidStack[] {FluidUtils.getFluidStack(RP1_Plus_Liquid_Oxygen, 1000)}, + new FluidStack[] {}, + 0, + 0, + 256)); //Fuel Value + + mRocketFuels.put(new Recipe_GT( + true, + new ItemStack[] {}, + new ItemStack[] {}, + null, + new int[] {}, + new FluidStack[] {FluidUtils.getFluidStack(Unsymmetrical_Dimethylhydrazine_Plus_Nitrogen_Tetroxide, 1000)}, + new FluidStack[] {}, + 0, + 0, + 1024)); //Fuel Value + + mRocketFuels.put(new Recipe_GT( + true, + new ItemStack[] {}, + new ItemStack[] {}, + null, + new int[] {}, + new FluidStack[] {FluidUtils.getFluidStack(Dense_Hydrazine_Mix, 1000)}, + new FluidStack[] {}, + 0, + 0, + 512)); //Fuel Value + + mRocketFuels.put(new Recipe_GT( + true, + new ItemStack[] {}, + new ItemStack[] {}, + null, + new int[] {}, + new FluidStack[] {FluidUtils.getFluidStack(Monomethylhydrazine_Plus_Nitric_Acid, 1000)}, + new FluidStack[] {}, + 0, + 0, + 768)); //Fuel Value + + int mID = 0; + for (Recipe_GT r : mRocketFuels) { + if (r != null) { + mValidRocketFuelNames.add(r.mFluidInputs[0].getFluid().getName()); + mValidRocketFuels.put(mID++, r.mFluidInputs[0].getFluid()); + Recipe_GT.Gregtech_Recipe_Map.sRocketFuels.add(r); + } + } + + } + + + private static void createRocketFuels() { + + //Done + GT_Values.RA.addCentrifugeRecipe( + CI.getNumberedCircuit(23), + ItemUtils.getItemStackOfAmountFromOreDict("cellLiquidOxygen", 2), + FluidUtils.getFluidStack(RP1, 500), + FluidUtils.getFluidStack(RP1_Plus_Liquid_Oxygen, 100), + CI.emptyCells(2), + null, + null, + null, + null, + null, + new int[] {10000}, + 20*32, + 480); + + GT_Values.RA.addCentrifugeRecipe( + CI.getNumberedCircuit(23), + ItemUtils.getItemStackOfAmountFromOreDict("cellRP1Fuel", 1), + FluidUtils.getFluidStack(Liquid_Oxygen, 4000), + FluidUtils.getFluidStack(RP1_Plus_Liquid_Oxygen, 200), + CI.emptyCells(1), + null, + null, + null, + null, + null, + new int[] {10000}, + 20*64, + 480); + + GT_Values.RA.addCentrifugeRecipe( + CI.getNumberedCircuit(23), + ItemUtils.getItemStackOfAmountFromOreDict("cellNitrogenTetroxide", 2), + FluidUtils.getFluidStack(Unsymmetrical_Dimethylhydrazine, 2000), + FluidUtils.getFluidStack(Unsymmetrical_Dimethylhydrazine_Plus_Nitrogen_Tetroxide, 1750), + CI.emptyCells(2), + null, + null, + null, + null, + null, + new int[] {10000}, + 20*48, + 480); + + ItemStack aCell11dimethylhydrazine = ItemUtils.getItemStackOfAmountFromOreDict("cell1,1Dimethylhydrazine", 2); + if (aCell11dimethylhydrazine != null && aCell11dimethylhydrazine.getItem() != ModItems.AAA_Broken) { + GT_Values.RA.addCentrifugeRecipe( + CI.getNumberedCircuit(23), + aCell11dimethylhydrazine, + FluidUtils.getFluidStack(Nitrogen_Tetroxide, 2000), + FluidUtils.getFluidStack(Unsymmetrical_Dimethylhydrazine_Plus_Nitrogen_Tetroxide, 1750), + CI.emptyCells(2), + null, + null, + null, + null, + null, + new int[] {10000}, + 20*48, + 480); + } + else { + GT_Values.RA.addCentrifugeRecipe( + CI.getNumberedCircuit(23), + ItemUtils.getItemStackOfAmountFromOreDict("cellUnsymmetricalDimethylhydrazine", 2), + FluidUtils.getFluidStack(Nitrogen_Tetroxide, 2000), + FluidUtils.getFluidStack(Unsymmetrical_Dimethylhydrazine_Plus_Nitrogen_Tetroxide, 1750), + CI.emptyCells(2), + null, + null, + null, + null, + null, + new int[] {10000}, + 20*48, + 480); + } + + + GT_Values.RA.addCentrifugeRecipe( + CI.getNumberedCircuit(23), + ItemUtils.getItemStackOfAmountFromOreDict("cellHydrazine", 4), + FluidUtils.getFluidStack("methanol", 6000), + FluidUtils.getFluidStack(Dense_Hydrazine_Mix, 10000), + CI.emptyCells(4), + null, + null, + null, + null, + null, + new int[] {10000}, + 20*100, + 240); + + GT_Values.RA.addCentrifugeRecipe( + CI.getNumberedCircuit(23), + ItemUtils.getItemStackOfAmountFromOreDict("cellMethanol", 6), + FluidUtils.getFluidStack(Hydrazine, 4000), + FluidUtils.getFluidStack(Dense_Hydrazine_Mix, 10000), + CI.emptyCells(6), + null, + null, + null, + null, + null, + new int[] {10000}, + 20*100, + 240); + + GT_Values.RA.addCentrifugeRecipe( + CI.getNumberedCircuit(23), + ItemUtils.getItemStackOfAmountFromOreDict("cellNitricAcid", 1), + FluidUtils.getFluidStack(Monomethylhydrazine, 1000), + FluidUtils.getFluidStack(Monomethylhydrazine_Plus_Nitric_Acid, 2000), + CI.emptyCells(1), + null, + null, + null, + null, + null, + new int[] {10000}, + 20*32, + 240); + + GT_Values.RA.addCentrifugeRecipe( + CI.getNumberedCircuit(23), + ItemUtils.getItemStackOfAmountFromOreDict("cellMonomethylhydrazine", 1), + FluidUtils.getFluidStack("nitricacid", 1000), + FluidUtils.getFluidStack(Monomethylhydrazine_Plus_Nitric_Acid, 2000), + CI.emptyCells(1), + null, + null, + null, + null, + null, + new int[] {10000}, + 20*32, + 240); + + } + + + +} diff --git a/src/Java/gtPlusPlus/core/recipe/RECIPES_GREGTECH.java b/src/Java/gtPlusPlus/core/recipe/RECIPES_GREGTECH.java index 05c7e662e5..68fb856417 100644 --- a/src/Java/gtPlusPlus/core/recipe/RECIPES_GREGTECH.java +++ b/src/Java/gtPlusPlus/core/recipe/RECIPES_GREGTECH.java @@ -542,7 +542,7 @@ public class RECIPES_GREGTECH { // FluidStacks final FluidStack ThoriumFluoride = FluidUtils.getFluidStack("molten.thoriumtetrafluoride", 100); // Re-usable // FluidStacks - final FluidStack ZirconiumFluoride = FluidUtils.getFluidStack("molten.zirconiumtetrafluoride", 100); // Re-usable + final FluidStack ZirconiumFluoride = FluidUtils.getFluidStack("zirconiumtetrafluoride", 100); // Re-usable // FluidStacks final FluidStack UraniumTetraFluoride = FluidUtils.getFluidStack("molten.uraniumtetrafluoride", 100); // Re-usable // FluidStacks diff --git a/src/Java/gtPlusPlus/core/tileentities/general/TileEntityPlayerDoorBase.java b/src/Java/gtPlusPlus/core/tileentities/general/TileEntityPlayerDoorBase.java new file mode 100644 index 0000000000..513435212d --- /dev/null +++ b/src/Java/gtPlusPlus/core/tileentities/general/TileEntityPlayerDoorBase.java @@ -0,0 +1,87 @@ +package gtPlusPlus.core.tileentities.general; + +import gtPlusPlus.core.block.ModBlocks; +import net.minecraft.block.Block; +import net.minecraft.entity.player.EntityPlayer; +import net.minecraft.nbt.NBTTagCompound; +import net.minecraft.tileentity.TileEntity; +import net.minecraft.world.World; + +public class TileEntityPlayerDoorBase extends TileEntity { + + private boolean mIsOpen = false; + private short mMeta = 0; + private long mTickCounter = 0; + private final Block mBlockType; + + public TileEntityPlayerDoorBase(Block aBlock, int meta){ + mMeta = (short) meta; + mBlockType = aBlock; + } + + @Override + public void readFromNBT(NBTTagCompound aNBT) { + super.readFromNBT(aNBT); + this.mIsOpen = aNBT.getBoolean("mIsOpen"); + } + + @Override + public void writeToNBT(NBTTagCompound aNBT) { + super.writeToNBT(aNBT); + aNBT.setBoolean("mIsOpen", mIsOpen); + } + + @Override + public void updateEntity() { + super.updateEntity(); + mTickCounter++; + if (mTickCounter % 10 == 0) { + if (checkForPlayers(this.getWorldObj())) { + if (this.mIsOpen) { + this.getWorldObj().setBlock(this.xCoord, this.yCoord, this.zCoord, this.getBlockType(), this.getClosedMeta(), 3); + this.mIsOpen = false; + } + else { + this.getWorldObj().setBlock(this.xCoord, this.yCoord, this.zCoord, this.getBlockType(), this.getOpenMeta(), 3); + this.mIsOpen = true; + } + } + } + } + + @Override + public int getBlockMetadata() { + return this.mMeta; + } + + @Override + public Block getBlockType() { + return mBlockType; + } + + @Override + public boolean canUpdate() { + return true; + } + + private boolean checkForPlayers(World aWorld) { + int x = 0, y = 0, z = 0; + x = this.xCoord; + y = this.yCoord; + z = this.zCoord; + EntityPlayer aPlayer = aWorld.getClosestPlayer(x, y, z, 8D); + if (aPlayer != null) { + return true; + } + return false; + } + + private short getClosedMeta() { + return 0; + } + + private short getOpenMeta() { + return 1; + } + +} diff --git a/src/Java/gtPlusPlus/core/util/minecraft/FluidUtils.java b/src/Java/gtPlusPlus/core/util/minecraft/FluidUtils.java index 08b37645eb..225d453694 100644 --- a/src/Java/gtPlusPlus/core/util/minecraft/FluidUtils.java +++ b/src/Java/gtPlusPlus/core/util/minecraft/FluidUtils.java @@ -420,43 +420,36 @@ public class FluidUtils { } public final static Fluid generateFluid(final String unlocalizedName, final String localizedName, final int MeltingPoint, final short[] RGBA){ - if ((FluidUtils.getFluidStack("molten"+"."+unlocalizedName.toLowerCase(), 1) == null) && (ItemUtils.getItemStackOfAmountFromOreDictNoBroken("dust"+Utils.sanitizeString(localizedName), 1) != null)){ + FluidStack aFStack = (FluidUtils.getFluidStack("molten"+"."+unlocalizedName.toLowerCase(), 1)); + if (aFStack == null){ Logger.WARNING("Generating our own fluid."); - - //Generate a Cell if we need to - if (ItemUtils.getItemStackOfAmountFromOreDictNoBroken("cell"+unlocalizedName, 1) == null){ - @SuppressWarnings("unused") - final - Item temp = new BaseItemComponent(unlocalizedName, localizedName, RGBA); + ItemStack cell = ItemUtils.getItemStackOfAmountFromOreDictNoBroken("cell"+unlocalizedName, 1); + if (cell == null){ + final Item temp = new BaseItemComponent(unlocalizedName, localizedName, RGBA); + cell = ItemUtils.getSimpleStack(temp); } - final Fluid gtFluid = FluidUtils.addGTFluid( unlocalizedName, "Molten "+localizedName, RGBA, 4, MeltingPoint, - ItemUtils.getItemStackOfAmountFromOreDictNoBroken("cell"+unlocalizedName, 1), + cell, ItemUtils.getEmptyCell(), 1000); - - //Disable this, not sure why it exists //TODO - /*MaterialGenerator.addFluidExtractionRecipe( - ItemUtils.getItemStackOfAmountFromOreDictNoBroken("dust"+Utils.sanitizeString(localizedName), 1), //Input - null, //Input 2 - FluidUtils.getFluidStack(gtFluid, 144), //Fluid Output - 0, //Chance - 1*20, //Duration - 16 //Eu Tick - );*/ - return gtFluid; } - Logger.INFO("FLUID GENERATION FAILED FOR "+localizedName); - return null; + else { + Logger.INFO("FLUID GENERATION FAILED FOR "+localizedName+", ALREADY EXISTS"); + return aFStack.getFluid(); + } } + public final static Fluid generateFluidNonMolten(final String unlocalizedName, final String localizedName, final int MeltingPoint, final short[] RGBA){ + return generateFluidNonMolten(unlocalizedName, localizedName, MeltingPoint, RGBA, null, null, 0); + } + public final static Fluid generateFluidNonMolten(final String unlocalizedName, final String localizedName, final int MeltingPoint, final short[] RGBA, final ItemStack dustStack, final ItemStack dustStack2){ return generateFluidNonMolten(unlocalizedName, localizedName, MeltingPoint, RGBA, dustStack, dustStack2, 144); } @@ -465,7 +458,8 @@ public class FluidUtils { if (dustStack == null){ dustStack = ItemUtils.getItemStackOfAmountFromOreDictNoBroken("dust"+Utils.sanitizeString(localizedName), 1); } - if ((FluidUtils.getFluidStack(unlocalizedName.toLowerCase(), 1) == null)/* && ((dustStack != null) || (dustStack2 != null))*/){ + FluidStack aFStack = (FluidUtils.getFluidStack(unlocalizedName.toLowerCase(), 1)); + if (aFStack == null){ Logger.WARNING("Generating our own fluid."); //Generate a Cell if we need to @@ -508,8 +502,10 @@ public class FluidUtils { return gtFluid; } - Logger.INFO("FLUID GENERATION FAILED FOR "+localizedName); - return null; + else { + Logger.INFO("FLUID GENERATION FAILED FOR "+localizedName+", ALREADY EXISTS"); + return aFStack.getFluid(); + } } public final static Fluid generateFluidNoPrefix(final String unlocalizedName, final String localizedName, final int MeltingPoint, final short[] RGBA){ diff --git a/src/Java/gtPlusPlus/preloader/asm/transformers/ClassTransformer_GC_FluidUtil.java b/src/Java/gtPlusPlus/preloader/asm/transformers/ClassTransformer_GC_FluidUtil.java new file mode 100644 index 0000000000..a2dd5c7925 --- /dev/null +++ b/src/Java/gtPlusPlus/preloader/asm/transformers/ClassTransformer_GC_FluidUtil.java @@ -0,0 +1,254 @@ +package gtPlusPlus.preloader.asm.transformers; + +import static org.objectweb.asm.Opcodes.*; + +import java.io.IOException; +import java.lang.reflect.Method; + +import org.apache.logging.log4j.Level; +import org.objectweb.asm.ClassReader; +import org.objectweb.asm.ClassVisitor; +import org.objectweb.asm.ClassWriter; +import org.objectweb.asm.Label; +import org.objectweb.asm.MethodVisitor; + +import cpw.mods.fml.relauncher.FMLRelaunchLog; +import gtPlusPlus.api.objects.data.AutoMap; +import gtPlusPlus.core.util.reflect.ReflectionUtils; +import micdoodle8.mods.galacticraft.core.tile.TileEntityFuelLoader; +import micdoodle8.mods.galacticraft.core.util.FluidUtil; +import net.minecraftforge.fluids.FluidStack; +import net.minecraftforge.fluids.FluidTank; +import net.sf.cglib.asm.Type; + + +public class ClassTransformer_GC_FluidUtil { + + //The qualified name of the class we plan to transform. + private static final String className = "micdoodle8.mods.galacticraft.core.util.FluidUtil"; + //"micdoodle8/mods/galacticraft/core/util/FluidUtil + + private final boolean isValid; + private final ClassReader reader; + private final ClassWriter writer; + + public ClassTransformer_GC_FluidUtil(byte[] basicClass) { + ClassReader aTempReader = null; + ClassWriter aTempWriter = null; + try { + aTempReader = new ClassReader(className); + aTempWriter = new ClassWriter(aTempReader, ClassWriter.COMPUTE_FRAMES); + new ClassReader(basicClass).accept(new localClassVisitor(aTempWriter), 0); + } catch (IOException e) {} + if (aTempReader != null && aTempWriter != null) { + isValid = true; + } + else { + isValid = false; + } + reader = aTempReader; + writer = aTempWriter; + + if (reader != null && writer != null) { + injectMethod("testFuel"); + injectMethod("fillWithGCFuel"); + } + + } + + public boolean isValidTransformer() { + return isValid; + } + + public ClassReader getReader() { + return reader; + } + + public ClassWriter getWriter() { + return writer; + } + + public void injectMethod(String aMethodName) { + /*String aConstructorTypes = (aMethodName.equals("testFuel") ? "(Ljava/lang/String;)Z" : (aMethodName.equals("fillWithGCFuel") ? "(Lnet/minecraftforge/fluids/FluidTank;Lnet/minecraftforge/fluids/FluidStack;Z)I\"" : "error")); + if (aConstructorTypes.equals("error")) { + return; + } */ + MethodVisitor mv; + if (aMethodName.equals("testFuel")) { + FMLRelaunchLog.log("[GT++ ASM] Galacticraft FluidUtils Patch", Level.INFO, "Injecting "+aMethodName+" into "+className+"."); + mv = getWriter().visitMethod(ACC_PUBLIC + ACC_STATIC, "testFuel", "(Ljava/lang/String;)Z", null, null); + mv.visitCode(); + Label l0 = new Label(); + mv.visitLabel(l0); + mv.visitLineNumber(37, l0); + mv.visitFieldInsn(GETSTATIC, "gtPlusPlus/core/item/chemistry/RocketFuels", "mValidRocketFuelNames", "Ljava/util/HashSet;"); + mv.visitMethodInsn(INVOKEVIRTUAL, "java/util/HashSet", "iterator", "()Ljava/util/Iterator;", false); + mv.visitVarInsn(ASTORE, 2); + Label l1 = new Label(); + mv.visitJumpInsn(GOTO, l1); + Label l2 = new Label(); + mv.visitLabel(l2); + mv.visitFrame(F_FULL, 3, new Object[] {"java/lang/String", TOP, "java/util/Iterator"}, 0, new Object[] {}); + mv.visitVarInsn(ALOAD, 2); + mv.visitMethodInsn(INVOKEINTERFACE, "java/util/Iterator", "next", "()Ljava/lang/Object;", true); + mv.visitTypeInsn(CHECKCAST, "java/lang/String"); + mv.visitVarInsn(ASTORE, 1); + Label l3 = new Label(); + mv.visitLabel(l3); + mv.visitLineNumber(38, l3); + mv.visitVarInsn(ALOAD, 0); + mv.visitVarInsn(ALOAD, 1); + mv.visitMethodInsn(INVOKEVIRTUAL, "java/lang/String", "equals", "(Ljava/lang/Object;)Z", false); + mv.visitJumpInsn(IFEQ, l1); + Label l4 = new Label(); + mv.visitLabel(l4); + mv.visitLineNumber(39, l4); + mv.visitInsn(ICONST_1); + mv.visitInsn(IRETURN); + mv.visitLabel(l1); + mv.visitLineNumber(37, l1); + mv.visitFrame(F_SAME, 0, null, 0, null); + mv.visitVarInsn(ALOAD, 2); + mv.visitMethodInsn(INVOKEINTERFACE, "java/util/Iterator", "hasNext", "()Z", true); + mv.visitJumpInsn(IFNE, l2); + Label l5 = new Label(); + mv.visitLabel(l5); + mv.visitLineNumber(42, l5); + mv.visitInsn(ICONST_0); + mv.visitInsn(IRETURN); + Label l6 = new Label(); + mv.visitLabel(l6); + mv.visitLocalVariable("name", "Ljava/lang/String;", null, l0, l6, 0); + mv.visitLocalVariable("aFuelname", "Ljava/lang/String;", null, l3, l1, 1); + mv.visitMaxs(2, 3); + mv.visitEnd(); + } + else if (aMethodName.equals("fillWithGCFuel")) { + mv = getWriter().visitMethod(ACC_PUBLIC + ACC_STATIC, "fillWithGCFuel", "(Lnet/minecraftforge/fluids/FluidTank;Lnet/minecraftforge/fluids/FluidStack;Z)I", null, null); + mv.visitCode(); + Label l0 = new Label(); + mv.visitLabel(l0); + mv.visitLineNumber(46, l0); + mv.visitVarInsn(ALOAD, 1); + Label l1 = new Label(); + mv.visitJumpInsn(IFNULL, l1); + mv.visitVarInsn(ALOAD, 1); + mv.visitMethodInsn(INVOKESTATIC, "net/minecraftforge/fluids/FluidRegistry", "getFluidName", "(Lnet/minecraftforge/fluids/FluidStack;)Ljava/lang/String;", false); + mv.visitMethodInsn(INVOKESTATIC, "micdoodle8/mods/galacticraft/core/util/FluidUtil", "testFuel", "(Ljava/lang/String;)Z", false); + mv.visitJumpInsn(IFEQ, l1); + Label l2 = new Label(); + mv.visitLabel(l2); + mv.visitLineNumber(47, l2); + mv.visitVarInsn(ALOAD, 0); + mv.visitMethodInsn(INVOKEVIRTUAL, "net/minecraftforge/fluids/FluidTank", "getFluid", "()Lnet/minecraftforge/fluids/FluidStack;", false); + mv.visitVarInsn(ASTORE, 3); + Label l3 = new Label(); + mv.visitLabel(l3); + mv.visitLineNumber(48, l3); + mv.visitVarInsn(ALOAD, 3); + Label l4 = new Label(); + mv.visitJumpInsn(IFNONNULL, l4); + Label l5 = new Label(); + mv.visitLabel(l5); + mv.visitLineNumber(49, l5); + mv.visitFieldInsn(GETSTATIC, "gtPlusPlus/core/item/chemistry/RocketFuels", "mValidRocketFuels", "Ljava/util/HashMap;"); + mv.visitMethodInsn(INVOKEVIRTUAL, "java/util/HashMap", "values", "()Ljava/util/Collection;", false); + mv.visitMethodInsn(INVOKEINTERFACE, "java/util/Collection", "iterator", "()Ljava/util/Iterator;", true); + mv.visitVarInsn(ASTORE, 5); + Label l6 = new Label(); + mv.visitJumpInsn(GOTO, l6); + Label l7 = new Label(); + mv.visitLabel(l7); + mv.visitFrame(F_FULL, 6, new Object[] {"net/minecraftforge/fluids/FluidTank", "net/minecraftforge/fluids/FluidStack", INTEGER, "net/minecraftforge/fluids/FluidStack", TOP, "java/util/Iterator"}, 0, new Object[] {}); + mv.visitVarInsn(ALOAD, 5); + mv.visitMethodInsn(INVOKEINTERFACE, "java/util/Iterator", "next", "()Ljava/lang/Object;", true); + mv.visitTypeInsn(CHECKCAST, "net/minecraftforge/fluids/Fluid"); + mv.visitVarInsn(ASTORE, 4); + Label l8 = new Label(); + mv.visitLabel(l8); + mv.visitLineNumber(50, l8); + mv.visitVarInsn(ALOAD, 1); + mv.visitMethodInsn(INVOKEVIRTUAL, "net/minecraftforge/fluids/FluidStack", "getFluid", "()Lnet/minecraftforge/fluids/Fluid;", false); + mv.visitVarInsn(ALOAD, 4); + mv.visitJumpInsn(IF_ACMPNE, l6); + Label l9 = new Label(); + mv.visitLabel(l9); + mv.visitLineNumber(51, l9); + mv.visitVarInsn(ALOAD, 0); + mv.visitTypeInsn(NEW, "net/minecraftforge/fluids/FluidStack"); + mv.visitInsn(DUP); + mv.visitVarInsn(ALOAD, 4); + mv.visitVarInsn(ALOAD, 1); + mv.visitFieldInsn(GETFIELD, "net/minecraftforge/fluids/FluidStack", "amount", "I"); + mv.visitMethodInsn(INVOKESPECIAL, "net/minecraftforge/fluids/FluidStack", "<init>", "(Lnet/minecraftforge/fluids/Fluid;I)V", false); + mv.visitVarInsn(ILOAD, 2); + mv.visitMethodInsn(INVOKEVIRTUAL, "net/minecraftforge/fluids/FluidTank", "fill", "(Lnet/minecraftforge/fluids/FluidStack;Z)I", false); + mv.visitInsn(IRETURN); + mv.visitLabel(l6); + mv.visitLineNumber(49, l6); + mv.visitFrame(F_SAME, 0, null, 0, null); + mv.visitVarInsn(ALOAD, 5); + mv.visitMethodInsn(INVOKEINTERFACE, "java/util/Iterator", "hasNext", "()Z", true); + mv.visitJumpInsn(IFNE, l7); + mv.visitLabel(l4); + mv.visitLineNumber(55, l4); + mv.visitFrame(F_FULL, 4, new Object[] {"net/minecraftforge/fluids/FluidTank", "net/minecraftforge/fluids/FluidStack", INTEGER, "net/minecraftforge/fluids/FluidStack"}, 0, new Object[] {}); + mv.visitVarInsn(ALOAD, 3); + mv.visitFieldInsn(GETFIELD, "net/minecraftforge/fluids/FluidStack", "amount", "I"); + mv.visitVarInsn(ALOAD, 0); + mv.visitMethodInsn(INVOKEVIRTUAL, "net/minecraftforge/fluids/FluidTank", "getCapacity", "()I", false); + mv.visitJumpInsn(IF_ICMPGE, l1); + Label l10 = new Label(); + mv.visitLabel(l10); + mv.visitLineNumber(56, l10); + mv.visitVarInsn(ALOAD, 0); + mv.visitTypeInsn(NEW, "net/minecraftforge/fluids/FluidStack"); + mv.visitInsn(DUP); + mv.visitVarInsn(ALOAD, 3); + mv.visitVarInsn(ALOAD, 1); + mv.visitFieldInsn(GETFIELD, "net/minecraftforge/fluids/FluidStack", "amount", "I"); + mv.visitMethodInsn(INVOKESPECIAL, "net/minecraftforge/fluids/FluidStack", "<init>", "(Lnet/minecraftforge/fluids/FluidStack;I)V", false); + mv.visitVarInsn(ILOAD, 2); + mv.visitMethodInsn(INVOKEVIRTUAL, "net/minecraftforge/fluids/FluidTank", "fill", "(Lnet/minecraftforge/fluids/FluidStack;Z)I", false); + mv.visitInsn(IRETURN); + mv.visitLabel(l1); + mv.visitLineNumber(59, l1); + mv.visitFrame(F_CHOP,1, null, 0, null); + mv.visitInsn(ICONST_0); + mv.visitInsn(IRETURN); + Label l11 = new Label(); + mv.visitLabel(l11); + mv.visitLocalVariable("tank", "Lnet/minecraftforge/fluids/FluidTank;", null, l0, l11, 0); + mv.visitLocalVariable("liquid", "Lnet/minecraftforge/fluids/FluidStack;", null, l0, l11, 1); + mv.visitLocalVariable("doFill", "Z", null, l0, l11, 2); + mv.visitLocalVariable("liquidInTank", "Lnet/minecraftforge/fluids/FluidStack;", null, l3, l1, 3); + mv.visitLocalVariable("aFuelType", "Lnet/minecraftforge/fluids/Fluid;", null, l8, l6, 4); + mv.visitMaxs(5, 6); + mv.visitEnd(); + } + FMLRelaunchLog.log("[GT++ ASM] Galacticraft FluidUtils Patch", Level.INFO, "Method injection complete."); + + } + + public static final class localClassVisitor extends ClassVisitor { + + public localClassVisitor(ClassVisitor cv) { + super(ASM5, cv); + } + + @Override + public MethodVisitor visitMethod(int access, String name, String desc, String signature, String[] exceptions) { + if (name.equals("testFuel")) { + FMLRelaunchLog.log("[GT++ ASM] Galacticraft FluidUtils Patch", Level.INFO, "Removing method "+name); + return null; + } + if (name.equals("fillWithGCFuel")) { + FMLRelaunchLog.log("[GT++ ASM] Galacticraft FluidUtils Patch", Level.INFO, "Removing method "+name); + return null; + } + MethodVisitor methodVisitor = super.visitMethod(access, name, desc, signature, exceptions); + return methodVisitor; + } + } + +} diff --git a/src/Java/gtPlusPlus/preloader/asm/transformers/ClassTransformer_GC_FuelLoader.java b/src/Java/gtPlusPlus/preloader/asm/transformers/ClassTransformer_GC_FuelLoader.java new file mode 100644 index 0000000000..7e58cecce3 --- /dev/null +++ b/src/Java/gtPlusPlus/preloader/asm/transformers/ClassTransformer_GC_FuelLoader.java @@ -0,0 +1,601 @@ +package gtPlusPlus.preloader.asm.transformers; + +import static org.objectweb.asm.Opcodes.*; + +import java.io.IOException; +import org.apache.logging.log4j.Level; +import org.objectweb.asm.ClassReader; +import org.objectweb.asm.ClassVisitor; +import org.objectweb.asm.ClassWriter; +import org.objectweb.asm.Label; +import org.objectweb.asm.MethodVisitor; + +import cpw.mods.fml.relauncher.FMLRelaunchLog; + + +public class ClassTransformer_GC_FuelLoader { + + //The qualified name of the class we plan to transform. + private static final String className = "micdoodle8.mods.galacticraft.core.tile.TileEntityFuelLoader"; + //micdoodle8/mods/galacticraft/core/tile/TileEntityFuelLoader + + private final boolean isValid; + private final ClassReader reader; + private final ClassWriter writer; + + public ClassTransformer_GC_FuelLoader(byte[] basicClass) { + ClassReader aTempReader = null; + ClassWriter aTempWriter = null; + try { + aTempReader = new ClassReader(className); + aTempWriter = new ClassWriter(aTempReader, ClassWriter.COMPUTE_FRAMES); + new ClassReader(basicClass).accept(new localClassVisitor(aTempWriter), 0); + } catch (IOException e) { + e.printStackTrace(); + } + if (aTempReader != null && aTempWriter != null) { + isValid = true; + } + else { + isValid = false; + } + reader = aTempReader; + writer = aTempWriter; + + if (reader != null && writer != null) { + injectMethod(); + } + else { + FMLRelaunchLog.log("[GT++ ASM] Galacticraft Fuel_Loader Patch", Level.INFO, "Failed to Inject new code."); + } + + } + + public boolean isValidTransformer() { + return isValid; + } + + public ClassReader getReader() { + return reader; + } + + public ClassWriter getWriter() { + return writer; + } + + public void injectMethod() { + if (isValidTransformer()) { + FMLRelaunchLog.log("[GT++ ASM] Galacticraft Fuel_Loader Patch", Level.INFO, "Injecting updateEntity into "+className+"."); + MethodVisitor mv = getWriter().visitMethod(ACC_PUBLIC, "updateEntity", "()V", null, null); + + if (true) { + mv.visitCode(); + Label l0 = new Label(); + mv.visitLabel(l0); + mv.visitLineNumber(59, l0); + mv.visitVarInsn(ALOAD, 0); + mv.visitMethodInsn(INVOKESPECIAL, "micdoodle8/mods/galacticraft/core/energy/tile/TileBaseElectricBlockWithInventory", "updateEntity", "()V", false); + Label l1 = new Label(); + mv.visitLabel(l1); + mv.visitLineNumber(60, l1); + mv.visitVarInsn(ALOAD, 0); + mv.visitFieldInsn(GETFIELD, "micdoodle8/mods/galacticraft/core/tile/TileEntityFuelLoader", "worldObj", "Lnet/minecraft/world/World;"); + mv.visitFieldInsn(GETFIELD, "net/minecraft/world/World", "isRemote", "Z"); + Label l2 = new Label(); + mv.visitJumpInsn(IFNE, l2); + Label l3 = new Label(); + mv.visitLabel(l3); + mv.visitLineNumber(61, l3); + mv.visitVarInsn(ALOAD, 0); + mv.visitInsn(ICONST_0); + mv.visitFieldInsn(PUTFIELD, "micdoodle8/mods/galacticraft/core/tile/TileEntityFuelLoader", "loadedFuelLastTick", "Z"); + Label l4 = new Label(); + mv.visitLabel(l4); + mv.visitLineNumber(62, l4); + mv.visitInsn(ACONST_NULL); + mv.visitVarInsn(ASTORE, 1); + Label l5 = new Label(); + mv.visitLabel(l5); + mv.visitLineNumber(65, l5); + mv.visitVarInsn(ALOAD, 0); + mv.visitFieldInsn(GETFIELD, "micdoodle8/mods/galacticraft/core/tile/TileEntityFuelLoader", "containingItems", "[Lnet/minecraft/item/ItemStack;"); + mv.visitInsn(ICONST_1); + mv.visitInsn(AALOAD); + Label l6 = new Label(); + mv.visitJumpInsn(IFNULL, l6); + Label l7 = new Label(); + mv.visitLabel(l7); + mv.visitLineNumber(66, l7); + mv.visitVarInsn(ALOAD, 0); + mv.visitFieldInsn(GETFIELD, "micdoodle8/mods/galacticraft/core/tile/TileEntityFuelLoader", "containingItems", "[Lnet/minecraft/item/ItemStack;"); + mv.visitInsn(ICONST_1); + mv.visitInsn(AALOAD); + mv.visitMethodInsn(INVOKESTATIC, "net/minecraftforge/fluids/FluidContainerRegistry", "getFluidForFilledItem", "(Lnet/minecraft/item/ItemStack;)Lnet/minecraftforge/fluids/FluidStack;", false); + mv.visitVarInsn(ASTORE, 1); + Label l8 = new Label(); + mv.visitLabel(l8); + mv.visitLineNumber(67, l8); + mv.visitVarInsn(ALOAD, 1); + mv.visitJumpInsn(IFNULL, l6); + Label l9 = new Label(); + mv.visitLabel(l9); + mv.visitLineNumber(68, l9); + mv.visitVarInsn(ALOAD, 1); + mv.visitMethodInsn(INVOKESTATIC, "net/minecraftforge/fluids/FluidRegistry", "getFluidName", "(Lnet/minecraftforge/fluids/FluidStack;)Ljava/lang/String;", false); + mv.visitMethodInsn(INVOKESTATIC, "micdoodle8/mods/galacticraft/core/util/FluidUtil", "testFuel", "(Ljava/lang/String;)Z", false); + mv.visitVarInsn(ISTORE, 4); + Label l10 = new Label(); + mv.visitLabel(l10); + mv.visitLineNumber(69, l10); + mv.visitVarInsn(ILOAD, 4); + mv.visitJumpInsn(IFEQ, l6); + mv.visitVarInsn(ALOAD, 0); + mv.visitFieldInsn(GETFIELD, "micdoodle8/mods/galacticraft/core/tile/TileEntityFuelLoader", "fuelTank", "Lnet/minecraftforge/fluids/FluidTank;"); + mv.visitMethodInsn(INVOKEVIRTUAL, "net/minecraftforge/fluids/FluidTank", "getFluid", "()Lnet/minecraftforge/fluids/FluidStack;", false); + Label l11 = new Label(); + mv.visitJumpInsn(IFNULL, l11); + Label l12 = new Label(); + mv.visitLabel(l12); + mv.visitLineNumber(70, l12); + mv.visitVarInsn(ALOAD, 0); + mv.visitFieldInsn(GETFIELD, "micdoodle8/mods/galacticraft/core/tile/TileEntityFuelLoader", "fuelTank", "Lnet/minecraftforge/fluids/FluidTank;"); + mv.visitMethodInsn(INVOKEVIRTUAL, "net/minecraftforge/fluids/FluidTank", "getFluid", "()Lnet/minecraftforge/fluids/FluidStack;", false); + mv.visitFieldInsn(GETFIELD, "net/minecraftforge/fluids/FluidStack", "amount", "I"); + mv.visitVarInsn(ALOAD, 1); + mv.visitFieldInsn(GETFIELD, "net/minecraftforge/fluids/FluidStack", "amount", "I"); + mv.visitInsn(IADD); + mv.visitVarInsn(ALOAD, 0); + mv.visitFieldInsn(GETFIELD, "micdoodle8/mods/galacticraft/core/tile/TileEntityFuelLoader", "fuelTank", "Lnet/minecraftforge/fluids/FluidTank;"); + mv.visitMethodInsn(INVOKEVIRTUAL, "net/minecraftforge/fluids/FluidTank", "getCapacity", "()I", false); + mv.visitJumpInsn(IF_ICMPGT, l6); + mv.visitLabel(l11); + mv.visitLineNumber(72, l11); + mv.visitFrame(F_FULL, 5, new Object[] {"micdoodle8/mods/galacticraft/core/tile/TileEntityFuelLoader", "net/minecraftforge/fluids/FluidStack", TOP, TOP, INTEGER}, 0, new Object[] {}); + mv.visitVarInsn(ALOAD, 0); + mv.visitFieldInsn(GETFIELD, "micdoodle8/mods/galacticraft/core/tile/TileEntityFuelLoader", "fuelTank", "Lnet/minecraftforge/fluids/FluidTank;"); + mv.visitMethodInsn(INVOKEVIRTUAL, "net/minecraftforge/fluids/FluidTank", "getFluid", "()Lnet/minecraftforge/fluids/FluidStack;", false); + mv.visitVarInsn(ASTORE, 5); + Label l13 = new Label(); + mv.visitLabel(l13); + mv.visitLineNumber(73, l13); + mv.visitInsn(ICONST_0); + mv.visitVarInsn(ISTORE, 6); + Label l14 = new Label(); + mv.visitLabel(l14); + mv.visitLineNumber(74, l14); + mv.visitVarInsn(ALOAD, 5); + Label l15 = new Label(); + mv.visitJumpInsn(IFNONNULL, l15); + Label l16 = new Label(); + mv.visitLabel(l16); + mv.visitLineNumber(75, l16); + mv.visitFieldInsn(GETSTATIC, "gtPlusPlus/core/item/chemistry/RocketFuels", "mValidRocketFuels", "Ljava/util/HashMap;"); + Label l17 = new Label(); + mv.visitLabel(l17); + mv.visitLineNumber(76, l17); + mv.visitMethodInsn(INVOKEVIRTUAL, "java/util/HashMap", "values", "()Ljava/util/Collection;", false); + mv.visitMethodInsn(INVOKEINTERFACE, "java/util/Collection", "iterator", "()Ljava/util/Iterator;", true); + mv.visitVarInsn(ASTORE, 8); + Label l18 = new Label(); + mv.visitJumpInsn(GOTO, l18); + Label l19 = new Label(); + mv.visitLabel(l19); + mv.visitFrame(F_FULL, 9, new Object[] {"micdoodle8/mods/galacticraft/core/tile/TileEntityFuelLoader", "net/minecraftforge/fluids/FluidStack", TOP, TOP, INTEGER, "net/minecraftforge/fluids/FluidStack", INTEGER, TOP, "java/util/Iterator"}, 0, new Object[] {}); + mv.visitVarInsn(ALOAD, 8); + mv.visitMethodInsn(INVOKEINTERFACE, "java/util/Iterator", "next", "()Ljava/lang/Object;", true); + mv.visitTypeInsn(CHECKCAST, "net/minecraftforge/fluids/Fluid"); + mv.visitVarInsn(ASTORE, 7); + Label l20 = new Label(); + mv.visitLabel(l20); + mv.visitLineNumber(77, l20); + mv.visitVarInsn(ALOAD, 1); + mv.visitMethodInsn(INVOKEVIRTUAL, "net/minecraftforge/fluids/FluidStack", "getFluid", "()Lnet/minecraftforge/fluids/Fluid;", false); + mv.visitVarInsn(ALOAD, 7); + mv.visitJumpInsn(IF_ACMPNE, l18); + Label l21 = new Label(); + mv.visitLabel(l21); + mv.visitLineNumber(78, l21); + mv.visitVarInsn(ALOAD, 0); + mv.visitFieldInsn(GETFIELD, "micdoodle8/mods/galacticraft/core/tile/TileEntityFuelLoader", "fuelTank", "Lnet/minecraftforge/fluids/FluidTank;"); + mv.visitTypeInsn(NEW, "net/minecraftforge/fluids/FluidStack"); + mv.visitInsn(DUP); + mv.visitVarInsn(ALOAD, 7); + mv.visitVarInsn(ALOAD, 1); + mv.visitFieldInsn(GETFIELD, "net/minecraftforge/fluids/FluidStack", "amount", "I"); + mv.visitMethodInsn(INVOKESPECIAL, "net/minecraftforge/fluids/FluidStack", "<init>", "(Lnet/minecraftforge/fluids/Fluid;I)V", false); + mv.visitInsn(ICONST_1); + mv.visitMethodInsn(INVOKEVIRTUAL, "net/minecraftforge/fluids/FluidTank", "fill", "(Lnet/minecraftforge/fluids/FluidStack;Z)I", false); + Label l22 = new Label(); + mv.visitJumpInsn(IFLE, l22); + mv.visitInsn(ICONST_1); + Label l23 = new Label(); + mv.visitJumpInsn(GOTO, l23); + mv.visitLabel(l22); + mv.visitFrame(F_FULL, 9, new Object[] {"micdoodle8/mods/galacticraft/core/tile/TileEntityFuelLoader", "net/minecraftforge/fluids/FluidStack", TOP, TOP, INTEGER, "net/minecraftforge/fluids/FluidStack", INTEGER, "net/minecraftforge/fluids/Fluid", "java/util/Iterator"}, 0, new Object[] {}); + mv.visitInsn(ICONST_0); + mv.visitLabel(l23); + mv.visitFrame(F_SAME1, 0, null, 1, new Object[] {INTEGER}); + mv.visitVarInsn(ISTORE, 6); + mv.visitLabel(l18); + mv.visitLineNumber(75, l18); + mv.visitFrame(F_FULL, 9, new Object[] {"micdoodle8/mods/galacticraft/core/tile/TileEntityFuelLoader", "net/minecraftforge/fluids/FluidStack", TOP, TOP, INTEGER, "net/minecraftforge/fluids/FluidStack", INTEGER, TOP, "java/util/Iterator"}, 0, new Object[] {}); + mv.visitVarInsn(ALOAD, 8); + mv.visitMethodInsn(INVOKEINTERFACE, "java/util/Iterator", "hasNext", "()Z", true); + mv.visitJumpInsn(IFNE, l19); + Label l24 = new Label(); + mv.visitLabel(l24); + mv.visitLineNumber(81, l24); + Label l25 = new Label(); + mv.visitJumpInsn(GOTO, l25); + mv.visitLabel(l15); + mv.visitLineNumber(83, l15); + mv.visitFrame(F_FULL, 7, new Object[] {"micdoodle8/mods/galacticraft/core/tile/TileEntityFuelLoader", "net/minecraftforge/fluids/FluidStack", TOP, TOP, INTEGER, "net/minecraftforge/fluids/FluidStack", INTEGER}, 0, new Object[] {}); + mv.visitVarInsn(ALOAD, 5); + mv.visitFieldInsn(GETFIELD, "net/minecraftforge/fluids/FluidStack", "amount", "I"); + mv.visitVarInsn(ALOAD, 0); + mv.visitFieldInsn(GETFIELD, "micdoodle8/mods/galacticraft/core/tile/TileEntityFuelLoader", "fuelTank", "Lnet/minecraftforge/fluids/FluidTank;"); + mv.visitMethodInsn(INVOKEVIRTUAL, "net/minecraftforge/fluids/FluidTank", "getCapacity", "()I", false); + mv.visitJumpInsn(IF_ICMPGE, l25); + mv.visitVarInsn(ALOAD, 5); + mv.visitVarInsn(ALOAD, 1); + mv.visitMethodInsn(INVOKEVIRTUAL, "net/minecraftforge/fluids/FluidStack", "isFluidEqual", "(Lnet/minecraftforge/fluids/FluidStack;)Z", false); + mv.visitJumpInsn(IFEQ, l25); + Label l26 = new Label(); + mv.visitLabel(l26); + mv.visitLineNumber(84, l26); + mv.visitVarInsn(ALOAD, 0); + mv.visitFieldInsn(GETFIELD, "micdoodle8/mods/galacticraft/core/tile/TileEntityFuelLoader", "fuelTank", "Lnet/minecraftforge/fluids/FluidTank;"); + mv.visitTypeInsn(NEW, "net/minecraftforge/fluids/FluidStack"); + mv.visitInsn(DUP); + mv.visitVarInsn(ALOAD, 5); + mv.visitVarInsn(ALOAD, 1); + mv.visitFieldInsn(GETFIELD, "net/minecraftforge/fluids/FluidStack", "amount", "I"); + mv.visitMethodInsn(INVOKESPECIAL, "net/minecraftforge/fluids/FluidStack", "<init>", "(Lnet/minecraftforge/fluids/FluidStack;I)V", false); + mv.visitInsn(ICONST_1); + mv.visitMethodInsn(INVOKEVIRTUAL, "net/minecraftforge/fluids/FluidTank", "fill", "(Lnet/minecraftforge/fluids/FluidStack;Z)I", false); + Label l27 = new Label(); + mv.visitJumpInsn(IFLE, l27); + mv.visitInsn(ICONST_1); + Label l28 = new Label(); + mv.visitJumpInsn(GOTO, l28); + mv.visitLabel(l27); + mv.visitFrame(F_SAME, 0, null, 0, null); + mv.visitInsn(ICONST_0); + mv.visitLabel(l28); + mv.visitFrame(F_SAME1, 0, null, 1, new Object[] {INTEGER}); + mv.visitVarInsn(ISTORE, 6); + mv.visitLabel(l25); + mv.visitLineNumber(87, l25); + mv.visitFrame(F_SAME, 0, null, 0, null); + mv.visitVarInsn(ILOAD, 6); + mv.visitJumpInsn(IFEQ, l6); + Label l29 = new Label(); + mv.visitLabel(l29); + mv.visitLineNumber(88, l29); + mv.visitVarInsn(ALOAD, 0); + mv.visitFieldInsn(GETFIELD, "micdoodle8/mods/galacticraft/core/tile/TileEntityFuelLoader", "containingItems", "[Lnet/minecraft/item/ItemStack;"); + mv.visitInsn(ICONST_1); + mv.visitInsn(AALOAD); + mv.visitInsn(DUP); + mv.visitFieldInsn(GETFIELD, "net/minecraft/item/ItemStack", "stackSize", "I"); + mv.visitInsn(ICONST_1); + mv.visitInsn(ISUB); + mv.visitFieldInsn(PUTFIELD, "net/minecraft/item/ItemStack", "stackSize", "I"); + Label l30 = new Label(); + mv.visitLabel(l30); + mv.visitLineNumber(89, l30); + mv.visitVarInsn(ALOAD, 0); + mv.visitFieldInsn(GETFIELD, "micdoodle8/mods/galacticraft/core/tile/TileEntityFuelLoader", "containingItems", "[Lnet/minecraft/item/ItemStack;"); + mv.visitInsn(ICONST_1); + mv.visitInsn(AALOAD); + mv.visitFieldInsn(GETFIELD, "net/minecraft/item/ItemStack", "stackSize", "I"); + mv.visitJumpInsn(IFNE, l6); + Label l31 = new Label(); + mv.visitLabel(l31); + mv.visitLineNumber(90, l31); + mv.visitVarInsn(ALOAD, 0); + mv.visitFieldInsn(GETFIELD, "micdoodle8/mods/galacticraft/core/tile/TileEntityFuelLoader", "containingItems", "[Lnet/minecraft/item/ItemStack;"); + mv.visitInsn(ICONST_1); + mv.visitInsn(ACONST_NULL); + mv.visitInsn(AASTORE); + mv.visitLabel(l6); + mv.visitLineNumber(96, l6); + mv.visitFrame(F_FULL, 2, new Object[] {"micdoodle8/mods/galacticraft/core/tile/TileEntityFuelLoader", "net/minecraftforge/fluids/FluidStack"}, 0, new Object[] {}); + mv.visitVarInsn(ALOAD, 0); + mv.visitFieldInsn(GETFIELD, "micdoodle8/mods/galacticraft/core/tile/TileEntityFuelLoader", "ticks", "I"); + mv.visitIntInsn(BIPUSH, 100); + mv.visitInsn(IREM); + Label l32 = new Label(); + mv.visitJumpInsn(IFNE, l32); + Label l33 = new Label(); + mv.visitLabel(l33); + mv.visitLineNumber(97, l33); + mv.visitVarInsn(ALOAD, 0); + mv.visitInsn(ACONST_NULL); + mv.visitFieldInsn(PUTFIELD, "micdoodle8/mods/galacticraft/core/tile/TileEntityFuelLoader", "attachedFuelable", "Lmicdoodle8/mods/galacticraft/api/entity/IFuelable;"); + Label l34 = new Label(); + mv.visitLabel(l34); + mv.visitLineNumber(98, l34); + mv.visitFieldInsn(GETSTATIC, "net/minecraftforge/common/util/ForgeDirection", "VALID_DIRECTIONS", "[Lnet/minecraftforge/common/util/ForgeDirection;"); + mv.visitVarInsn(ASTORE, 4); + Label l35 = new Label(); + mv.visitLabel(l35); + mv.visitLineNumber(99, l35); + mv.visitVarInsn(ALOAD, 4); + mv.visitInsn(ARRAYLENGTH); + mv.visitVarInsn(ISTORE, 3); + Label l36 = new Label(); + mv.visitLabel(l36); + mv.visitLineNumber(101, l36); + mv.visitInsn(ICONST_0); + mv.visitVarInsn(ISTORE, 2); + Label l37 = new Label(); + mv.visitLabel(l37); + Label l38 = new Label(); + mv.visitJumpInsn(GOTO, l38); + Label l39 = new Label(); + mv.visitLabel(l39); + mv.visitLineNumber(102, l39); + mv.visitFrame(F_APPEND,3, new Object[] {INTEGER, INTEGER, "[Lnet/minecraftforge/common/util/ForgeDirection;"}, 0, null); + mv.visitVarInsn(ALOAD, 4); + mv.visitVarInsn(ILOAD, 2); + mv.visitInsn(AALOAD); + mv.visitVarInsn(ASTORE, 5); + Label l40 = new Label(); + mv.visitLabel(l40); + mv.visitLineNumber(103, l40); + mv.visitTypeInsn(NEW, "micdoodle8/mods/galacticraft/api/vector/BlockVec3"); + mv.visitInsn(DUP); + mv.visitVarInsn(ALOAD, 0); + mv.visitMethodInsn(INVOKESPECIAL, "micdoodle8/mods/galacticraft/api/vector/BlockVec3", "<init>", "(Lnet/minecraft/tileentity/TileEntity;)V", false); + mv.visitVarInsn(ALOAD, 0); + mv.visitFieldInsn(GETFIELD, "micdoodle8/mods/galacticraft/core/tile/TileEntityFuelLoader", "worldObj", "Lnet/minecraft/world/World;"); + mv.visitVarInsn(ALOAD, 5); + mv.visitMethodInsn(INVOKEVIRTUAL, "micdoodle8/mods/galacticraft/api/vector/BlockVec3", "getTileEntityOnSide", "(Lnet/minecraft/world/World;Lnet/minecraftforge/common/util/ForgeDirection;)Lnet/minecraft/tileentity/TileEntity;", false); + mv.visitVarInsn(ASTORE, 6); + Label l41 = new Label(); + mv.visitLabel(l41); + mv.visitLineNumber(104, l41); + mv.visitVarInsn(ALOAD, 6); + mv.visitTypeInsn(INSTANCEOF, "micdoodle8/mods/galacticraft/core/tile/TileEntityMulti"); + Label l42 = new Label(); + mv.visitJumpInsn(IFEQ, l42); + Label l43 = new Label(); + mv.visitLabel(l43); + mv.visitLineNumber(105, l43); + mv.visitVarInsn(ALOAD, 6); + mv.visitTypeInsn(CHECKCAST, "micdoodle8/mods/galacticraft/core/tile/TileEntityMulti"); + mv.visitMethodInsn(INVOKEVIRTUAL, "micdoodle8/mods/galacticraft/core/tile/TileEntityMulti", "getMainBlockTile", "()Lnet/minecraft/tileentity/TileEntity;", false); + mv.visitVarInsn(ASTORE, 7); + Label l44 = new Label(); + mv.visitLabel(l44); + mv.visitLineNumber(106, l44); + mv.visitVarInsn(ALOAD, 7); + mv.visitTypeInsn(INSTANCEOF, "micdoodle8/mods/galacticraft/api/entity/IFuelable"); + Label l45 = new Label(); + mv.visitJumpInsn(IFEQ, l45); + Label l46 = new Label(); + mv.visitLabel(l46); + mv.visitLineNumber(107, l46); + mv.visitVarInsn(ALOAD, 0); + mv.visitVarInsn(ALOAD, 7); + mv.visitTypeInsn(CHECKCAST, "micdoodle8/mods/galacticraft/api/entity/IFuelable"); + mv.visitFieldInsn(PUTFIELD, "micdoodle8/mods/galacticraft/core/tile/TileEntityFuelLoader", "attachedFuelable", "Lmicdoodle8/mods/galacticraft/api/entity/IFuelable;"); + Label l47 = new Label(); + mv.visitLabel(l47); + mv.visitLineNumber(108, l47); + mv.visitJumpInsn(GOTO, l32); + mv.visitLabel(l42); + mv.visitLineNumber(110, l42); + mv.visitFrame(F_APPEND,2, new Object[] {"net/minecraftforge/common/util/ForgeDirection", "net/minecraft/tileentity/TileEntity"}, 0, null); + mv.visitVarInsn(ALOAD, 6); + mv.visitTypeInsn(INSTANCEOF, "micdoodle8/mods/galacticraft/api/entity/IFuelable"); + mv.visitJumpInsn(IFEQ, l45); + Label l48 = new Label(); + mv.visitLabel(l48); + mv.visitLineNumber(111, l48); + mv.visitVarInsn(ALOAD, 0); + mv.visitVarInsn(ALOAD, 6); + mv.visitTypeInsn(CHECKCAST, "micdoodle8/mods/galacticraft/api/entity/IFuelable"); + mv.visitFieldInsn(PUTFIELD, "micdoodle8/mods/galacticraft/core/tile/TileEntityFuelLoader", "attachedFuelable", "Lmicdoodle8/mods/galacticraft/api/entity/IFuelable;"); + Label l49 = new Label(); + mv.visitLabel(l49); + mv.visitLineNumber(112, l49); + mv.visitJumpInsn(GOTO, l32); + mv.visitLabel(l45); + mv.visitLineNumber(101, l45); + mv.visitFrame(F_CHOP,2, null, 0, null); + mv.visitIincInsn(2, 1); + mv.visitLabel(l38); + mv.visitFrame(F_SAME, 0, null, 0, null); + mv.visitVarInsn(ILOAD, 2); + mv.visitVarInsn(ILOAD, 3); + mv.visitJumpInsn(IF_ICMPLT, l39); + mv.visitLabel(l32); + mv.visitLineNumber(116, l32); + mv.visitFrame(F_CHOP,3, null, 0, null); + mv.visitVarInsn(ALOAD, 0); + mv.visitFieldInsn(GETFIELD, "micdoodle8/mods/galacticraft/core/tile/TileEntityFuelLoader", "fuelTank", "Lnet/minecraftforge/fluids/FluidTank;"); + mv.visitJumpInsn(IFNULL, l2); + mv.visitVarInsn(ALOAD, 0); + mv.visitFieldInsn(GETFIELD, "micdoodle8/mods/galacticraft/core/tile/TileEntityFuelLoader", "fuelTank", "Lnet/minecraftforge/fluids/FluidTank;"); + mv.visitMethodInsn(INVOKEVIRTUAL, "net/minecraftforge/fluids/FluidTank", "getFluid", "()Lnet/minecraftforge/fluids/FluidStack;", false); + mv.visitJumpInsn(IFNULL, l2); + mv.visitVarInsn(ALOAD, 0); + mv.visitFieldInsn(GETFIELD, "micdoodle8/mods/galacticraft/core/tile/TileEntityFuelLoader", "fuelTank", "Lnet/minecraftforge/fluids/FluidTank;"); + mv.visitMethodInsn(INVOKEVIRTUAL, "net/minecraftforge/fluids/FluidTank", "getFluid", "()Lnet/minecraftforge/fluids/FluidStack;", false); + mv.visitFieldInsn(GETFIELD, "net/minecraftforge/fluids/FluidStack", "amount", "I"); + mv.visitJumpInsn(IFLE, l2); + Label l50 = new Label(); + mv.visitLabel(l50); + mv.visitLineNumber(117, l50); + mv.visitVarInsn(ALOAD, 0); + mv.visitFieldInsn(GETFIELD, "micdoodle8/mods/galacticraft/core/tile/TileEntityFuelLoader", "fuelTank", "Lnet/minecraftforge/fluids/FluidTank;"); + mv.visitMethodInsn(INVOKEVIRTUAL, "net/minecraftforge/fluids/FluidTank", "getFluid", "()Lnet/minecraftforge/fluids/FluidStack;", false); + mv.visitVarInsn(ASTORE, 4); + Label l51 = new Label(); + mv.visitLabel(l51); + mv.visitLineNumber(118, l51); + mv.visitVarInsn(ALOAD, 4); + Label l52 = new Label(); + mv.visitJumpInsn(IFNONNULL, l52); + Label l53 = new Label(); + mv.visitLabel(l53); + mv.visitLineNumber(119, l53); + mv.visitFieldInsn(GETSTATIC, "gtPlusPlus/core/item/chemistry/RocketFuels", "mValidRocketFuels", "Ljava/util/HashMap;"); + mv.visitMethodInsn(INVOKEVIRTUAL, "java/util/HashMap", "values", "()Ljava/util/Collection;", false); + mv.visitMethodInsn(INVOKEINTERFACE, "java/util/Collection", "iterator", "()Ljava/util/Iterator;", true); + mv.visitVarInsn(ASTORE, 6); + Label l54 = new Label(); + mv.visitJumpInsn(GOTO, l54); + Label l55 = new Label(); + mv.visitLabel(l55); + mv.visitFrame(F_FULL, 7, new Object[] {"micdoodle8/mods/galacticraft/core/tile/TileEntityFuelLoader", "net/minecraftforge/fluids/FluidStack", TOP, TOP, "net/minecraftforge/fluids/FluidStack", TOP, "java/util/Iterator"}, 0, new Object[] {}); + mv.visitVarInsn(ALOAD, 6); + mv.visitMethodInsn(INVOKEINTERFACE, "java/util/Iterator", "next", "()Ljava/lang/Object;", true); + mv.visitTypeInsn(CHECKCAST, "net/minecraftforge/fluids/Fluid"); + mv.visitVarInsn(ASTORE, 5); + Label l56 = new Label(); + mv.visitLabel(l56); + mv.visitLineNumber(120, l56); + mv.visitVarInsn(ALOAD, 0); + mv.visitFieldInsn(GETFIELD, "micdoodle8/mods/galacticraft/core/tile/TileEntityFuelLoader", "fuelTank", "Lnet/minecraftforge/fluids/FluidTank;"); + mv.visitMethodInsn(INVOKEVIRTUAL, "net/minecraftforge/fluids/FluidTank", "getFluid", "()Lnet/minecraftforge/fluids/FluidStack;", false); + mv.visitMethodInsn(INVOKEVIRTUAL, "net/minecraftforge/fluids/FluidStack", "getFluid", "()Lnet/minecraftforge/fluids/Fluid;", false); + mv.visitVarInsn(ALOAD, 5); + mv.visitJumpInsn(IF_ACMPNE, l54); + Label l57 = new Label(); + mv.visitLabel(l57); + mv.visitLineNumber(121, l57); + mv.visitTypeInsn(NEW, "net/minecraftforge/fluids/FluidStack"); + mv.visitInsn(DUP); + mv.visitVarInsn(ALOAD, 5); + mv.visitInsn(ICONST_2); + mv.visitMethodInsn(INVOKESPECIAL, "net/minecraftforge/fluids/FluidStack", "<init>", "(Lnet/minecraftforge/fluids/Fluid;I)V", false); + mv.visitVarInsn(ASTORE, 1); + mv.visitLabel(l54); + mv.visitLineNumber(119, l54); + mv.visitFrame(F_SAME, 0, null, 0, null); + mv.visitVarInsn(ALOAD, 6); + mv.visitMethodInsn(INVOKEINTERFACE, "java/util/Iterator", "hasNext", "()Z", true); + mv.visitJumpInsn(IFNE, l55); + mv.visitLabel(l52); + mv.visitLineNumber(125, l52); + mv.visitFrame(F_FULL, 5, new Object[] {"micdoodle8/mods/galacticraft/core/tile/TileEntityFuelLoader", "net/minecraftforge/fluids/FluidStack", TOP, TOP, "net/minecraftforge/fluids/FluidStack"}, 0, new Object[] {}); + mv.visitVarInsn(ALOAD, 4); + mv.visitFieldInsn(GETFIELD, "net/minecraftforge/fluids/FluidStack", "amount", "I"); + mv.visitVarInsn(ALOAD, 0); + mv.visitFieldInsn(GETFIELD, "micdoodle8/mods/galacticraft/core/tile/TileEntityFuelLoader", "fuelTank", "Lnet/minecraftforge/fluids/FluidTank;"); + mv.visitMethodInsn(INVOKEVIRTUAL, "net/minecraftforge/fluids/FluidTank", "getCapacity", "()I", false); + Label l58 = new Label(); + mv.visitJumpInsn(IF_ICMPGE, l58); + Label l59 = new Label(); + mv.visitLabel(l59); + mv.visitLineNumber(126, l59); + mv.visitTypeInsn(NEW, "net/minecraftforge/fluids/FluidStack"); + mv.visitInsn(DUP); + mv.visitVarInsn(ALOAD, 4); + mv.visitInsn(ICONST_2); + mv.visitMethodInsn(INVOKESPECIAL, "net/minecraftforge/fluids/FluidStack", "<init>", "(Lnet/minecraftforge/fluids/FluidStack;I)V", false); + mv.visitVarInsn(ASTORE, 1); + mv.visitLabel(l58); + mv.visitLineNumber(129, l58); + mv.visitFrame(F_SAME, 0, null, 0, null); + mv.visitVarInsn(ALOAD, 1); + mv.visitJumpInsn(IFNULL, l2); + Label l60 = new Label(); + mv.visitLabel(l60); + mv.visitLineNumber(130, l60); + mv.visitVarInsn(ALOAD, 0); + mv.visitFieldInsn(GETFIELD, "micdoodle8/mods/galacticraft/core/tile/TileEntityFuelLoader", "attachedFuelable", "Lmicdoodle8/mods/galacticraft/api/entity/IFuelable;"); + mv.visitJumpInsn(IFNULL, l2); + mv.visitVarInsn(ALOAD, 0); + mv.visitFieldInsn(GETFIELD, "micdoodle8/mods/galacticraft/core/tile/TileEntityFuelLoader", "hasEnoughEnergyToRun", "Z"); + mv.visitJumpInsn(IFEQ, l2); + mv.visitVarInsn(ALOAD, 0); + mv.visitFieldInsn(GETFIELD, "micdoodle8/mods/galacticraft/core/tile/TileEntityFuelLoader", "disabled", "Z"); + mv.visitJumpInsn(IFNE, l2); + Label l61 = new Label(); + mv.visitLabel(l61); + mv.visitLineNumber(131, l61); + mv.visitVarInsn(ALOAD, 0); + mv.visitFieldInsn(GETFIELD, "micdoodle8/mods/galacticraft/core/tile/TileEntityFuelLoader", "attachedFuelable", "Lmicdoodle8/mods/galacticraft/api/entity/IFuelable;"); + mv.visitVarInsn(ALOAD, 1); + mv.visitInsn(ICONST_1); + mv.visitMethodInsn(INVOKEINTERFACE, "micdoodle8/mods/galacticraft/api/entity/IFuelable", "addFuel", "(Lnet/minecraftforge/fluids/FluidStack;Z)I", true); + mv.visitVarInsn(ISTORE, 3); + Label l62 = new Label(); + mv.visitLabel(l62); + mv.visitLineNumber(132, l62); + mv.visitVarInsn(ALOAD, 0); + mv.visitVarInsn(ILOAD, 3); + Label l63 = new Label(); + mv.visitJumpInsn(IFLE, l63); + mv.visitInsn(ICONST_1); + Label l64 = new Label(); + mv.visitJumpInsn(GOTO, l64); + mv.visitLabel(l63); + mv.visitFrame(F_FULL, 5, new Object[] {"micdoodle8/mods/galacticraft/core/tile/TileEntityFuelLoader", "net/minecraftforge/fluids/FluidStack", TOP, INTEGER, "net/minecraftforge/fluids/FluidStack"}, 1, new Object[] {"micdoodle8/mods/galacticraft/core/tile/TileEntityFuelLoader"}); + mv.visitInsn(ICONST_0); + mv.visitLabel(l64); + mv.visitFrame(F_FULL, 5, new Object[] {"micdoodle8/mods/galacticraft/core/tile/TileEntityFuelLoader", "net/minecraftforge/fluids/FluidStack", TOP, INTEGER, "net/minecraftforge/fluids/FluidStack"}, 2, new Object[] {"micdoodle8/mods/galacticraft/core/tile/TileEntityFuelLoader", INTEGER}); + mv.visitFieldInsn(PUTFIELD, "micdoodle8/mods/galacticraft/core/tile/TileEntityFuelLoader", "loadedFuelLastTick", "Z"); + Label l65 = new Label(); + mv.visitLabel(l65); + mv.visitLineNumber(133, l65); + mv.visitVarInsn(ALOAD, 0); + mv.visitFieldInsn(GETFIELD, "micdoodle8/mods/galacticraft/core/tile/TileEntityFuelLoader", "fuelTank", "Lnet/minecraftforge/fluids/FluidTank;"); + mv.visitVarInsn(ILOAD, 3); + mv.visitInsn(ICONST_1); + mv.visitMethodInsn(INVOKEVIRTUAL, "net/minecraftforge/fluids/FluidTank", "drain", "(IZ)Lnet/minecraftforge/fluids/FluidStack;", false); + mv.visitInsn(POP); + mv.visitLabel(l2); + mv.visitLineNumber(138, l2); + mv.visitFrame(F_FULL, 1, new Object[] {"micdoodle8/mods/galacticraft/core/tile/TileEntityFuelLoader"}, 0, new Object[] {}); + mv.visitInsn(RETURN); + Label l66 = new Label(); + mv.visitLabel(l66); + mv.visitLocalVariable("this", "Lmicdoodle8/mods/galacticraft/core/tile/TileEntityFuelLoader;", null, l0, l66, 0); + mv.visitLocalVariable("liquid", "Lnet/minecraftforge/fluids/FluidStack;", null, l5, l2, 1); + mv.visitLocalVariable("amount", "I", null, l37, l32, 2); + mv.visitLocalVariable("filled", "I", null, l36, l32, 3); + mv.visitLocalVariable("filled", "I", null, l62, l2, 3); + mv.visitLocalVariable("isFuel", "Z", null, l10, l6, 4); + mv.visitLocalVariable("liquidInTank", "Lnet/minecraftforge/fluids/FluidStack;", null, l13, l6, 5); + mv.visitLocalVariable("didFill", "Z", null, l14, l6, 6); + mv.visitLocalVariable("aFuelType", "Lnet/minecraftforge/fluids/Fluid;", null, l20, l18, 7); + mv.visitLocalVariable("var8", "[Lnet/minecraftforge/common/util/ForgeDirection;", null, l35, l32, 4); + mv.visitLocalVariable("dir", "Lnet/minecraftforge/common/util/ForgeDirection;", null, l40, l45, 5); + mv.visitLocalVariable("pad", "Lnet/minecraft/tileentity/TileEntity;", null, l41, l45, 6); + mv.visitLocalVariable("mainTile", "Lnet/minecraft/tileentity/TileEntity;", null, l44, l42, 7); + mv.visitLocalVariable("liquidInTank", "Lnet/minecraftforge/fluids/FluidStack;", null, l51, l2, 4); + mv.visitLocalVariable("aFuelType", "Lnet/minecraftforge/fluids/Fluid;", null, l56, l54, 5); + mv.visitMaxs(5, 9); + mv.visitEnd(); + } + + + FMLRelaunchLog.log("[GT++ ASM] Galacticraft Fuel_Loader Patch", Level.INFO, "Method injection complete."); + } + } + + public static final class localClassVisitor extends ClassVisitor { + + public localClassVisitor(ClassVisitor cv) { + super(ASM5, cv); + FMLRelaunchLog.log("[GT++ ASM] Galacticraft Fuel_Loader Patch", Level.INFO, "Inspecting Class "+className); + } + + @Override + public MethodVisitor visitMethod(int access, String name, String desc, String signature, String[] exceptions) { + if (name.equals("updateEntity")) { + FMLRelaunchLog.log("[GT++ ASM] Galacticraft Fuel_Loader Patch", Level.INFO, "Removing method "+name); + return null; + } + + MethodVisitor methodVisitor = super.visitMethod(access, name, desc, signature, exceptions); + return methodVisitor; + } + } + +} diff --git a/src/Java/gtPlusPlus/preloader/asm/transformers/ClassTransformer_TiConFluids.java b/src/Java/gtPlusPlus/preloader/asm/transformers/ClassTransformer_TiConFluids.java index 673df98c82..81e7c8f9a2 100644 --- a/src/Java/gtPlusPlus/preloader/asm/transformers/ClassTransformer_TiConFluids.java +++ b/src/Java/gtPlusPlus/preloader/asm/transformers/ClassTransformer_TiConFluids.java @@ -6,13 +6,13 @@ import java.io.IOException; import org.apache.logging.log4j.Level; import org.objectweb.asm.ClassReader; +import org.objectweb.asm.ClassVisitor; import org.objectweb.asm.ClassWriter; import org.objectweb.asm.Label; import org.objectweb.asm.MethodVisitor; import cpw.mods.fml.relauncher.FMLRelaunchLog; import gtPlusPlus.preloader.DevHelper; -import gtPlusPlus.preloader.asm.transformers.Preloader_ClassTransformer.OreDictionaryVisitor; public class ClassTransformer_TiConFluids { @@ -38,7 +38,7 @@ public class ClassTransformer_TiConFluids { try { aTempReader = new ClassReader(className); aTempWriter = new ClassWriter(aTempReader, ClassWriter.COMPUTE_FRAMES); - new ClassReader(basicClass).accept(new OreDictionaryVisitor(aTempWriter), 0); + new ClassReader(basicClass).accept(new localClassVisitir(aTempWriter, isObfuscated), 0); } catch (IOException e) {} if (aTempReader != null && aTempWriter != null) { isValid = true; @@ -118,6 +118,45 @@ public class ClassTransformer_TiConFluids { } } + + public final class localClassVisitir extends ClassVisitor { + + private final boolean mIsObfuscated; + + public localClassVisitir(ClassVisitor cv, boolean obfuscated) { + super(ASM5, cv); + mIsObfuscated = obfuscated; + } + + @Override + public MethodVisitor visitMethod(int access, String name, String desc, String signature, String[] exceptions) { + String IBlockAccessName = isObfuscated ? "ahl" : "net/minecraft/world/IBlockAccess"; + String aConstructorTypes = "(L"+IBlockAccessName+";III)I"; + MethodVisitor methodVisitor = super.visitMethod(access, name, desc, signature, exceptions); + if(name.equals(methodName) && desc.equals(aConstructorTypes)) { + FMLRelaunchLog.log("[GT++ ASM] OreDictTransformer", Level.INFO, "Found target method. ["+mIsObfuscated+"]"); + return new localMethodVisitor(methodVisitor, mIsObfuscated); + } + return methodVisitor; + } + + } + + private final class localMethodVisitor extends MethodVisitor { + + private final boolean mObfuscated; + + public localMethodVisitor(MethodVisitor mv, boolean obfuscated) { + super(ASM5, mv); + this.mObfuscated = obfuscated; + } + + @Override + public void visitCode() { + + } + + } } diff --git a/src/Java/gtPlusPlus/preloader/asm/transformers/Preloader_Transformer_Handler.java b/src/Java/gtPlusPlus/preloader/asm/transformers/Preloader_Transformer_Handler.java index 7d7e7b80ca..0dbd36de2a 100644 --- a/src/Java/gtPlusPlus/preloader/asm/transformers/Preloader_Transformer_Handler.java +++ b/src/Java/gtPlusPlus/preloader/asm/transformers/Preloader_Transformer_Handler.java @@ -54,6 +54,16 @@ public class Preloader_Transformer_Handler implements IClassTransformer { FMLRelaunchLog.log("[GT++ ASM] Bright Fluids", Level.INFO, "Transforming %s", transformedName); return new ClassTransformer_TiConFluids("getLightValue", obfuscated, basicClass).getWriter().toByteArray(); } + + //Fix GC stuff + if (transformedName.equals("micdoodle8.mods.galacticraft.core.util.FluidUtil")) { + FMLRelaunchLog.log("[GT++ ASM] Galacticraft FluidUtils Patch", Level.INFO, "Transforming %s", transformedName); + return new ClassTransformer_GC_FluidUtil(basicClass).getWriter().toByteArray(); + } + if (transformedName.equals("micdoodle8.mods.galacticraft.core.tile.TileEntityFuelLoader")) { + FMLRelaunchLog.log("[GT++ ASM] Galacticraft Fuel_Loader Patch", Level.INFO, "Transforming %s", transformedName); + return new ClassTransformer_GC_FuelLoader(basicClass).getWriter().toByteArray(); + } if (mEnabled) { if (transformedName.equals("gregtech.api.metatileentity.BaseMetaTileEntity")) { diff --git a/src/Java/gtPlusPlus/xmod/gregtech/api/metatileentity/implementations/base/generators/GregtechRocketFuelGeneratorBase.java b/src/Java/gtPlusPlus/xmod/gregtech/api/metatileentity/implementations/base/generators/GregtechRocketFuelGeneratorBase.java index db787c5e80..bef16c0bf7 100644 --- a/src/Java/gtPlusPlus/xmod/gregtech/api/metatileentity/implementations/base/generators/GregtechRocketFuelGeneratorBase.java +++ b/src/Java/gtPlusPlus/xmod/gregtech/api/metatileentity/implementations/base/generators/GregtechRocketFuelGeneratorBase.java @@ -60,16 +60,18 @@ public abstract class GregtechRocketFuelGeneratorBase extends GT_MetaTileEntity_ @Override public String[] getDescription() { if (CORE.MAIN_GREGTECH_5U_EXPERIMENTAL_FORK) { - String aPollution = "Causes " + getPollution() + " Pollution per second"; + int pollMin = mTier == 4 ? 250 : (mTier == 5 ? 500 : 750); + int pollMax = mTier == 4 ? 2000 : (mTier == 5 ? 4000 : 6000); + String aPollution = "Causes between "+pollMin+" and "+pollMax+ " Pollution per second"; return new String[]{ this.mDescription, - "Fuel Efficiency: " + this.getEfficiency() + "%", + "Fuel Efficiency: " + this.getEfficiency()*2 + "%", aPollution, CORE.GT_Tooltip}; } return new String[]{ this.mDescription, - "Fuel Efficiency: " + this.getEfficiency() + "%", + "Fuel Efficiency: " + this.getEfficiency()*2 + "%", CORE.GT_Tooltip}; } @@ -160,7 +162,7 @@ public abstract class GregtechRocketFuelGeneratorBase extends GT_MetaTileEntity_ @Override public long maxEUStore() { - return Math.max(this.getEUVar(), (V[this.mTier] * 80) + this.getMinimumStoredEU()); + return Math.max(this.getEUVar(), (V[this.mTier] * 500) + this.getMinimumStoredEU()); } @Override diff --git a/src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/generators/GregtechMetaTileEntityDoubleFuelGeneratorBase.java b/src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/generators/GregtechMetaTileEntityDoubleFuelGeneratorBase.java index 2ddb2f90f0..facba4fb57 100644 --- a/src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/generators/GregtechMetaTileEntityDoubleFuelGeneratorBase.java +++ b/src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/generators/GregtechMetaTileEntityDoubleFuelGeneratorBase.java @@ -136,4 +136,9 @@ extends GregtechRocketFuelGeneratorBase { public ITexture[] getSidesActive(final byte aColor) { return new ITexture[]{super.getSidesActive(aColor)[0], this.getCasingTexture(), new GT_RenderedTexture(TexturesGtBlock.Overlay_Machine_Diesel_Horizontal_Active)}; } + + @Override + public int getPollution() { + return 250; + } } diff --git a/src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/generators/GregtechMetaTileEntityRocketFuelGenerator.java b/src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/generators/GregtechMetaTileEntityRocketFuelGenerator.java index b3a1fb4cee..288501086b 100644 --- a/src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/generators/GregtechMetaTileEntityRocketFuelGenerator.java +++ b/src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/generators/GregtechMetaTileEntityRocketFuelGenerator.java @@ -14,8 +14,8 @@ import gregtech.api.metatileentity.MetaTileEntity; import gregtech.api.objects.GT_RenderedTexture; import gregtech.api.util.GT_ModHandler; import gregtech.api.util.GT_Recipe; -import gregtech.common.tileentities.generators.GT_MetaTileEntity_DieselGenerator; -import gtPlusPlus.core.lib.CORE; +import gregtech.api.util.Recipe_GT; +import gtPlusPlus.core.util.math.MathUtils; import gtPlusPlus.xmod.gregtech.api.metatileentity.implementations.base.generators.GregtechRocketFuelGeneratorBase; import gtPlusPlus.xmod.gregtech.common.blocks.textures.TexturesGtBlock; @@ -25,7 +25,7 @@ extends GregtechRocketFuelGeneratorBase { public int mEfficiency; public GregtechMetaTileEntityRocketFuelGenerator(final int aID, final String aName, final String aNameRegional, final int aTier) { - super(aID, aName, aNameRegional, aTier, "Requires Diesel-type liquid Fuels.", new ITexture[0]); + super(aID, aName, aNameRegional, aTier, "Requires Rocket Fuels.", new ITexture[0]); this.onConfigLoad(); } @@ -33,11 +33,6 @@ extends GregtechRocketFuelGeneratorBase { super(aName, aTier, aDescription, aTextures); this.onConfigLoad(); } - - @Override - public String[] getDescription() { - return new String[]{this.mDescription, "Generates power at " + (this.getEfficiency() * 2) + "% Efficiency per tick", CORE.GT_Tooltip}; - } @Override public boolean isOutputFacing(final byte aSide) { @@ -51,7 +46,7 @@ extends GregtechRocketFuelGeneratorBase { @Override public GT_Recipe.GT_Recipe_Map getRecipes() { - return GT_Recipe.GT_Recipe_Map.sDieselFuels; + return Recipe_GT.Gregtech_Recipe_Map.sRocketFuels; } @Override @@ -60,12 +55,12 @@ extends GregtechRocketFuelGeneratorBase { } public void onConfigLoad() { - this.mEfficiency = GregTech_API.sMachineFile.get(ConfigCategories.machineconfig, "RocketEngine.efficiency.tier." + this.mTier, (100 - (this.mTier * 8))); + this.mEfficiency = GregTech_API.sMachineFile.get(ConfigCategories.machineconfig, "RocketEngine.efficiency.tier." + this.mTier, ((40+((this.mTier) * 16))/4)+(this.mTier)); } @Override public int getEfficiency() { - return this.mEfficiency; + return ((40+((this.mTier) * 16))/4)+(this.mTier); } @Override @@ -143,7 +138,9 @@ extends GregtechRocketFuelGeneratorBase { return new ITexture[]{super.getSidesActive(aColor)[0], this.getCasingTexture(), new GT_RenderedTexture(TexturesGtBlock.Overlay_Machine_Diesel_Horizontal_Active)}; } - public int getPollution() { - return (int) (GT_MetaTileEntity_DieselGenerator.BASE_POLLUTION * Math.pow(8, mTier + 1)); + public int getPollution() { + int pollMin = mTier == 4 ? 250 : (mTier == 5 ? 500 : 750); + int pollMax = mTier == 4 ? 2000 : (mTier == 5 ? 4000 : 6000); + return (int) (MathUtils.randInt(pollMin, pollMax)/20); } } |