diff options
Diffstat (limited to 'src/Java/gtPlusPlus')
47 files changed, 1177 insertions, 541 deletions
diff --git a/src/Java/gtPlusPlus/api/helpers/GregtechPlusPlus_API.java b/src/Java/gtPlusPlus/api/helpers/GregtechPlusPlus_API.java index 3acca269d7..fb1258f6d2 100644 --- a/src/Java/gtPlusPlus/api/helpers/GregtechPlusPlus_API.java +++ b/src/Java/gtPlusPlus/api/helpers/GregtechPlusPlus_API.java @@ -14,11 +14,7 @@ public class GregtechPlusPlus_API { public static class Multiblock_API { - private static final HashMap<String, SpecialMultiBehaviour> mSpecialBehaviourItemMap; - - static { - mSpecialBehaviourItemMap = new HashMap<String, SpecialMultiBehaviour>(); - } + private static final HashMap<String, SpecialMultiBehaviour> mSpecialBehaviourItemMap = new HashMap<String, SpecialMultiBehaviour>(); /** * Register a special behaviour for GT++ Multis to listen use. diff --git a/src/Java/gtPlusPlus/core/block/general/antigrief/BlockWitherProof.java b/src/Java/gtPlusPlus/core/block/general/antigrief/BlockWitherProof.java index ed531cef2d..2210e68e8a 100644 --- a/src/Java/gtPlusPlus/core/block/general/antigrief/BlockWitherProof.java +++ b/src/Java/gtPlusPlus/core/block/general/antigrief/BlockWitherProof.java @@ -12,6 +12,8 @@ import net.minecraft.entity.EnumCreatureType; import net.minecraft.entity.boss.EntityDragon; import net.minecraft.entity.boss.EntityWither; import net.minecraft.entity.boss.IBossDisplayData; +import net.minecraft.entity.player.EntityPlayer; +import net.minecraft.entity.player.EntityPlayerMP; import net.minecraft.world.Explosion; import net.minecraft.world.IBlockAccess; import net.minecraft.world.World; @@ -105,6 +107,60 @@ public class BlockWitherProof extends Block{ return false; } + @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_) { + super.breakBlock(p_149749_1_, p_149749_2_, p_149749_3_, p_149749_4_, p_149749_5_, p_149749_6_); + } + + @Override + public float getPlayerRelativeBlockHardness(EntityPlayer aPlayer, World p_149737_2_, int p_149737_3_, int p_149737_4_, int p_149737_5_) { + if (aPlayer != null && aPlayer instanceof EntityPlayerMP) { + return 1f; + } + return -1f; + } + + @Override + public float getExplosionResistance(Entity p_149638_1_) { + return Float.MAX_VALUE; + } + + @Override + public void onBlockClicked(World p_149699_1_, int p_149699_2_, int p_149699_3_, int p_149699_4_, EntityPlayer p_149699_5_) { + super.onBlockClicked(p_149699_1_, p_149699_2_, p_149699_3_, p_149699_4_, p_149699_5_); + } + + @Override + public void onEntityCollidedWithBlock(World world, int x, int y, int z, Entity entity) { + if ((entity == null) || !entity.isEntityAlive()){ + return; + } + if ((entity instanceof EntityWither) || (entity instanceof EntityDragon) || (entity instanceof IBossDisplayData)){ + return; + } + else { + super.onEntityCollidedWithBlock(world, x, y, z, entity); + } + } + + @Override + public void harvestBlock(World p_149636_1_, EntityPlayer p_149636_2_, int p_149636_3_, int p_149636_4_, int p_149636_5_, int p_149636_6_) { + super.harvestBlock( p_149636_1_, p_149636_2_, p_149636_3_, p_149636_4_, p_149636_5_, p_149636_6_); + } + + @Override + public boolean canHarvestBlock(EntityPlayer player, int meta) { + if (player != null && player instanceof EntityPlayerMP) { + return true; + } + return super.canHarvestBlock(player, meta); + } + + @Override + public float getExplosionResistance(Entity par1Entity, World world, int x, int y, int z, double explosionX, double explosionY, double explosionZ) { + return Float.MAX_VALUE; + } + } diff --git a/src/Java/gtPlusPlus/core/commands/CommandEnableDebugWhileRunning.java b/src/Java/gtPlusPlus/core/commands/CommandEnableDebugWhileRunning.java index 5b9c17bacf..06b6f14822 100644 --- a/src/Java/gtPlusPlus/core/commands/CommandEnableDebugWhileRunning.java +++ b/src/Java/gtPlusPlus/core/commands/CommandEnableDebugWhileRunning.java @@ -20,92 +20,92 @@ public class CommandEnableDebugWhileRunning implements ICommand public CommandEnableDebugWhileRunning(){ this.aliases = new ArrayList<>(); + this.aliases.add("gtplusplus"); } @Override public int compareTo(final Object o){ - return 0; - + if (o instanceof Comparable<?>) { + @SuppressWarnings("unchecked") + Comparable<ICommand> a = (Comparable<ICommand>) o; + if (a.equals(this)) { + return 0; + } + else { + return -1; + } + } + return -1; } @Override public String getCommandName(){ - return "debugmodegtpp"; + return "gtpp"; } - - // Use '/debugmodegtpp' along with 'logging' or 'debug' to toggle Debug mode and Logging. + + // Use '/gtpp' along with 'logging' or 'debug' to toggle Debug mode and Logging. // Using nothing after the command toggles both to their opposite states respectively. @Override public String getCommandUsage(final ICommandSender var1){ - return "/debugmodegtpp"; - + return "/gtpp ?"; } @Override public List<String> getCommandAliases(){ return this.aliases; - } @Override public void processCommand(final ICommandSender S, final String[] argString){ - - if (argString == null || argString.length == 0 || argString.length > 1) { - Logger.INFO("Toggling Debug Mode & Logging."); + int aMaxArgumentsAllowed = 1; + + if ((argString == null || argString.length == 0 || argString.length > aMaxArgumentsAllowed) || argString[0].toLowerCase().equals("?")) { + Logger.INFO("Listing commands and their uses."); + final EntityPlayer P = CommandUtils.getPlayer(S); + AsmConfig.disableAllLogging = Utils.invertBoolean(AsmConfig.disableAllLogging); + PlayerUtils.messagePlayer(P, "The following are valid args for the '/gtpp' command:"); + PlayerUtils.messagePlayer(P, "? - This help command."); + PlayerUtils.messagePlayer(P, "logging - Toggles ALL GT++ logging for current session."); + PlayerUtils.messagePlayer(P, "debug - Toggles GT++ Debug Mode. Only use when advised, may break everything. (OP)"); + } + else if (argString[0].toLowerCase().equals("debug")) { + Logger.INFO("Toggling Debug Mode."); final EntityPlayer P = CommandUtils.getPlayer(S); if (PlayerUtils.isPlayerOP(P)) { - CORE.DEBUG = Utils.invertBoolean(CORE.DEBUG); - PlayerUtils.messagePlayer(P, "Toggled GT++ Debug Mode - Enabled: "+CORE.DEBUG); - AsmConfig.disableAllLogging = Utils.invertBoolean(AsmConfig.disableAllLogging); - PlayerUtils.messagePlayer(P, "Toggled GT++ Logging - Enabled: "+(!AsmConfig.disableAllLogging)); - } - } - else { - if (argString[0].toLowerCase().equals("debug")) { - Logger.INFO("Toggling Debug Mode."); - final EntityPlayer P = CommandUtils.getPlayer(S); - if (PlayerUtils.isPlayerOP(P)) { - CORE.DEBUG = Utils.invertBoolean(CORE.DEBUG); - PlayerUtils.messagePlayer(P, "Toggled GT++ Debug Mode - Enabled: "+CORE.DEBUG); - } - } - else if (argString[0].toLowerCase().equals("logging")) { - Logger.INFO("Toggling Logging."); - final EntityPlayer P = CommandUtils.getPlayer(S); - if (PlayerUtils.isPlayerOP(P)) { - AsmConfig.disableAllLogging = Utils.invertBoolean(AsmConfig.disableAllLogging); - PlayerUtils.messagePlayer(P, "Toggled GT++ Logging - Enabled: "+(!AsmConfig.disableAllLogging)); - } - } - else { - final EntityPlayer P = CommandUtils.getPlayer(S); - if (PlayerUtils.isPlayerOP(P)) { - PlayerUtils.messagePlayer(P, "Invalid command, use 'debug' or 'logging'"); - } + CORE.DEBUG = Utils.invertBoolean(CORE.DEBUG); + PlayerUtils.messagePlayer(P, "Toggled GT++ Debug Mode - Enabled: "+CORE.DEBUG); } } - - - + else if (argString[0].toLowerCase().equals("logging")) { + Logger.INFO("Toggling Logging."); + final EntityPlayer P = CommandUtils.getPlayer(S); + AsmConfig.disableAllLogging = Utils.invertBoolean(AsmConfig.disableAllLogging); + PlayerUtils.messagePlayer(P, "Toggled GT++ Logging - Enabled: "+(!AsmConfig.disableAllLogging)); + } + else { + final EntityPlayer P = CommandUtils.getPlayer(S); + PlayerUtils.messagePlayer(P, "Invalid command, use '?' as an argument for help.'"); + } + } @Override public boolean canCommandSenderUseCommand(final ICommandSender var1){ - if (var1 == null) { - return false; - } - final EntityPlayer P = CommandUtils.getPlayer(var1); - if (P != null && PlayerUtils.isPlayerOP(P)) { - return true; + if (var1 == null || CommandUtils.getPlayer(var1) == null) { + return false; } - return false; + return true; } @Override public List<?> addTabCompletionOptions(final ICommandSender var1, final String[] var2){ - return null; + ArrayList<String> aTabCompletes = new ArrayList<String>(); + aTabCompletes.add("?"); + aTabCompletes.add("logging"); + aTabCompletes.add("debug"); + return aTabCompletes; } @Override @@ -115,7 +115,7 @@ public class CommandEnableDebugWhileRunning implements ICommand } public boolean playerUsesCommand(final World W, final EntityPlayer P, final int cost){ - return true; + return true; } }
\ No newline at end of file diff --git a/src/Java/gtPlusPlus/core/item/ModItems.java b/src/Java/gtPlusPlus/core/item/ModItems.java index 8bfcfe2d70..114750d2d9 100644 --- a/src/Java/gtPlusPlus/core/item/ModItems.java +++ b/src/Java/gtPlusPlus/core/item/ModItems.java @@ -621,7 +621,7 @@ public final class ModItems { MaterialGenerator.generate(ALLOY.MARAGING350); MaterialGenerator.generate(ALLOY.AQUATIC_STEEL); - MaterialGenerator.generate(ALLOY.NITINOL_60); + MaterialGenerator.generate(ALLOY.NITINOL_60,true,false); //Composite Alloys MaterialGenerator.generate(ALLOY.STELLITE); diff --git a/src/Java/gtPlusPlus/core/item/chemistry/CoalTar.java b/src/Java/gtPlusPlus/core/item/chemistry/CoalTar.java index 8428328f37..981bfed479 100644 --- a/src/Java/gtPlusPlus/core/item/chemistry/CoalTar.java +++ b/src/Java/gtPlusPlus/core/item/chemistry/CoalTar.java @@ -272,6 +272,8 @@ public class CoalTar extends ItemPackage { recipePhthalicAcidToPhthalicAnhydride(); recipeEthylBenzineFuelsIntoHeavyFuel(); + + recipePhthalicAcidConversion(); //Burn the coal gas! GT_Values.RA.addFuel(ItemUtils.getItemStackOfAmountFromOreDict("cellCoalGas", 1), null, 96, 1); @@ -282,6 +284,14 @@ public class CoalTar extends ItemPackage { return true; } + private void recipePhthalicAcidConversion() { + FluidStack aMyAcid = FluidUtils.getFluidStack(Phthalic_Acid, 500); + FluidStack aGtAcid = FluidUtils.getFluidStack("phtalicacid", 500); + if (aMyAcid != null && aGtAcid != null) { + CORE.RA.addDistilleryRecipe(CI.getNumberedBioCircuit(8), aMyAcid, aGtAcid, null, 50, 16, false); + } + } + @Override public void items() { //Phthalic_Acid = FluidUtils.generateFluidNonMolten("PhthalicAcid", "Phthalic Acid", 207, new short[]{210, 220, 210, 100}, null, null); @@ -347,7 +357,7 @@ public class CoalTar extends ItemPackage { Naphthalene = FluidUtils.generateFluidNonMolten("Naphthalene", "Naphthalene", 115, new short[]{210, 185, 135, 100}, null, null); // v - Oxidize with mercury and nitric acid //Create Phthalic Acid - Phthalic_Acid = FluidUtils.generateFluidNonMolten("PhthalicAcid", "Phthalic Acid", 207, new short[]{210, 220, 210, 100}, null, null); + Phthalic_Acid = FluidUtils.generateFluidNonMolten("PhthalicAcid", "Phtalic Acid", 207, new short[]{210, 220, 210, 100}, null, null); // v - Dehydrate at 180C+ //Create Phthalic Anhydride //ItemUtils.generateSpecialUseDusts("PhthalicAnhydride", "Phthalic Anhydride", "C6H4(CO)2O", Utils.rgbtoHexValue(175, 175, 175)); diff --git a/src/Java/gtPlusPlus/core/lib/LoadedMods.java b/src/Java/gtPlusPlus/core/lib/LoadedMods.java index d96875b811..329cf634b6 100644 --- a/src/Java/gtPlusPlus/core/lib/LoadedMods.java +++ b/src/Java/gtPlusPlus/core/lib/LoadedMods.java @@ -2,6 +2,8 @@ package gtPlusPlus.core.lib; import static gtPlusPlus.core.lib.CORE.*; +import java.util.HashMap; + import cpw.mods.fml.common.Loader; import gtPlusPlus.api.objects.Logger; @@ -50,6 +52,7 @@ public class LoadedMods { public static boolean Mekanism = false; public static boolean RedTech = false; //RedMage's Mod public static boolean TecTech = false; //Technus' Mod + public static boolean KekzTech = false; //KekzDealers' Mod public static boolean TiCon = false; public static boolean StevesCarts = false; public static boolean Witchery = false; @@ -63,7 +66,7 @@ public class LoadedMods { @SuppressWarnings("deprecation") public static void checkLoaded(){ Logger.INFO("Looking for optional mod prereqs."); - if (Loader.isModLoaded("gregtech") ){ + if (isModLoaded("gregtech") ){ Gregtech = true; Logger.INFO("Components enabled for: Gregtech"); if (Gregtech){ @@ -80,140 +83,140 @@ public class LoadedMods { totalMods++; } - if (Loader.isModLoaded("dreamcraft")){ + if (isModLoaded("dreamcraft")){ DreamCraft = true; GTNH = true; Logger.INFO("Components enabled for: DreamCraft"); Logger.INFO("Components enabled for: GT: New Horizons"); totalMods++; } - if (Loader.isModLoaded("beyondrealitycore")){ + if (isModLoaded("beyondrealitycore")){ BeyondRealityCore = true; BRC = true; Logger.INFO("Components enabled for: Beyond Reality"); totalMods++; } - if (Loader.isModLoaded("PlayerAPI")){ + if (isModLoaded("PlayerAPI")){ PlayerAPI = true; Logger.INFO("Components enabled for: PlayerAPI"); totalMods++; } - if (Loader.isModLoaded("berriespp")) { + if (isModLoaded("berriespp")) { CropsPlusPlus = true; Logger.INFO("Components enabled for: Crops++"); totalMods++; } - if (Loader.isModLoaded("xreliquary")) { + if (isModLoaded("xreliquary")) { Reliquary = true; Logger.INFO("Components enabled for: Reliquary"); totalMods++; } - if (Loader.isModLoaded("TConstruct")){ + if (isModLoaded("TConstruct")){ TiCon = true; Logger.INFO("Components enabled for: Tinkers Construct"); totalMods++; } - if (Loader.isModLoaded("BuildCraft")){ + if (isModLoaded("BuildCraft")){ BuildCraft = true; Logger.INFO("Components enabled for: BuildCraft"); totalMods++; } - if ((Loader.isModLoaded("EnderIO")) && !ConfigSwitches.disableEnderIOIntegration){ + if ((isModLoaded("EnderIO")) && !ConfigSwitches.disableEnderIOIntegration){ EnderIO = true; Logger.INFO("Components enabled for: EnderIO"); totalMods++; } - if (Loader.isModLoaded("BigReactors")){ + if (isModLoaded("BigReactors")){ Big_Reactors = true; Logger.INFO("Components enabled for: Big Reactors"); totalMods++; } - if (Loader.isModLoaded("IC2")){ + if (isModLoaded("IC2")){ IndustrialCraft2 = true; Logger.INFO("Components enabled for: IndustrialCraft2"); totalMods++; } - if (Loader.isModLoaded("IC2-Classic-Spmod")){ + if (isModLoaded("IC2-Classic-Spmod")){ IndustrialCraft2Classic = true; Logger.INFO("Components enabled for: IndustrialCraft2-Classic"); totalMods++; } - if (Loader.isModLoaded("simplyjetpacks")){ + if (isModLoaded("simplyjetpacks")){ Simply_Jetpacks = true; Logger.INFO("Components enabled for: Simply Jetpacks"); totalMods++; } - if (Loader.isModLoaded("rftools")){ + if (isModLoaded("rftools")){ RFTools = true; Logger.INFO("Components enabled for: RFTools"); totalMods++; } - if (Loader.isModLoaded("StevesCarts")){ + if (isModLoaded("StevesCarts")){ StevesCarts = true; Logger.INFO("Components enabled for: StevesCarts"); totalMods++; } - if (Loader.isModLoaded("OpenBlocks")){ + if (isModLoaded("OpenBlocks")){ OpenBlocks = true; Logger.INFO("Components enabled for: OpenBlocks"); totalMods++; } - if (Loader.isModLoaded("Thaumcraft")){ + if (isModLoaded("Thaumcraft")){ Thaumcraft = true; Logger.INFO("Components enabled for: Thaumcraft"); totalMods++; } - if (Loader.isModLoaded("BiomesOPlenty")){ + if (isModLoaded("BiomesOPlenty")){ BiomesOPlenty = true; Logger.INFO("Components enabled for: BiomesOPlenty"); totalMods++; } - if (Loader.isModLoaded("ExtraUtilities")){ + if (isModLoaded("ExtraUtilities")){ Extra_Utils = true; Logger.INFO("Components enabled for: Extra_Utils"); totalMods++; } - if (Loader.isModLoaded("harvestcraft")){ + if (isModLoaded("harvestcraft")){ PamsHarvestcraft = true; Logger.INFO("Components enabled for: PamsHarvestcraft"); totalMods++; } - if (Loader.isModLoaded("PneumaticCraft")){ + if (isModLoaded("PneumaticCraft")){ PneumaticCraft = true; Logger.INFO("Components enabled for: PneumaticCraft"); totalMods++; } - if (Loader.isModLoaded("MorePlanet")){ + if (isModLoaded("MorePlanet")){ MorePlanets = true; Logger.INFO("Components enabled for: MorePlanets"); totalMods++; } - if (Loader.isModLoaded("ForbiddenMagic")){ + if (isModLoaded("ForbiddenMagic")){ ForbiddenMagic = true; Logger.INFO("Components enabled for: ForbiddenMagic"); totalMods++; } - if (Loader.isModLoaded("CompactWindmills")){ + if (isModLoaded("CompactWindmills")){ CompactWindmills = true; Logger.INFO("Components enabled for: CompactWindmills"); totalMods++; } - if (Loader.isModLoaded("Railcraft")){ + if (isModLoaded("Railcraft")){ Railcraft = true; Logger.INFO("Components enabled for: Railcraft"); totalMods++; } - if (Loader.isModLoaded("Waila")){ + if (isModLoaded("Waila")){ Waila = true; Logger.INFO("Components enabled for: WAILA"); totalMods++; } - if (Loader.isModLoaded("Mekanism")){ + if (isModLoaded("Mekanism")){ Mekanism = true; Logger.INFO("Components enabled for: Mekanism - This feature is not configurable and balances Mekanism to suit GT."); totalMods++; } - if (Loader.isModLoaded("Growthcraft")){ + if (isModLoaded("Growthcraft")){ Logger.INFO("Growthcraft Version: "+getModVersion("Growthcraft")); if (getModVersion("Growthcraft").equals("1.7.10-2.3.1")){ //Load Growthcraft Compat @@ -226,67 +229,67 @@ public class LoadedMods { Logger.INFO("Growthcraft found, but the version was too new. I will update GC support eventually."); } } - if (Loader.isModLoaded("CoFHCore")){ + if (isModLoaded("CoFHCore")){ CoFHCore = true; Logger.INFO("Components enabled for: CoFHCore"); totalMods++; } - if (Loader.isModLoaded("Forestry")){ + if (isModLoaded("Forestry")){ Forestry = true; Logger.INFO("Components enabled for: Forestry"); totalMods++; } - if (Loader.isModLoaded("MagicBees")){ + if (isModLoaded("MagicBees")){ MagicBees = true; Logger.INFO("Components enabled for: MagicBees"); totalMods++; } - if (Loader.isModLoaded("psychedelicraft")){ + if (isModLoaded("psychedelicraft")){ Psychedelicraft = true; Logger.INFO("Components enabled for: Psychedelicraft"); totalMods++; } - if (Loader.isModLoaded("ImmersiveEngineering")){ + if (isModLoaded("ImmersiveEngineering")){ ImmersiveEngineering = true; Logger.INFO("Components enabled for: ImmersiveEngineering"); totalMods++; } - if (Loader.isModLoaded("ExtraBees")){ + if (isModLoaded("ExtraBees")){ ExtraBees = true; Logger.INFO("Components enabled for: ExtraBees"); totalMods++; } - if (Loader.isModLoaded("ThermalFoundation") == false){ + if (isModLoaded("ThermalFoundation") == false){ ThermalFoundation = false; Logger.INFO("Components enabled for: ThermalFoundation - This feature will disable itself if you add TF."); totalMods++; } - else if (Loader.isModLoaded("ThermalFoundation")){ + else if (isModLoaded("ThermalFoundation")){ ThermalFoundation = true; Logger.INFO("Components disabled for: ThermalFoundation - This feature will enable itself if you remove TF."); //totalMods++; } - if (Loader.isModLoaded("ihl")){ + if (isModLoaded("ihl")){ IHL = true; Logger.INFO("Components enabled for: IHL"); totalMods++; } - if (Loader.isModLoaded("Baubles")){ + if (isModLoaded("Baubles")){ Baubles = true; Logger.INFO("Components enabled for: Baubles"); totalMods++; } - if (Loader.isModLoaded("GalacticraftCore")){ + if (isModLoaded("GalacticraftCore")){ GalacticraftCore = true; Logger.INFO("Components enabled for: Galacticraft Core"); totalMods++; } - if (Loader.isModLoaded("OpenComputers")){ + if (isModLoaded("OpenComputers")){ OpenComputers = true; Logger.INFO("Components enabled for: OpenComputers"); totalMods++; } - if (Loader.isModLoaded("computronics")){ + if (isModLoaded("computronics")){ Computronics = true; Logger.INFO("Components disabled for: Computronics - This feature will enable itself if you remove Computronics."); totalMods++; @@ -294,17 +297,22 @@ public class LoadedMods { else { Logger.INFO("Components enabled for: Computronics - This feature will disable itself if you add Computronics."); } - if (Loader.isModLoaded("GTRedtech")){ + if (isModLoaded("GTRedtech")){ RedTech = true; Logger.INFO("Components enabled for: GTRedtech"); totalMods++; } - if (Loader.isModLoaded("tectech")){ + if (isModLoaded("tectech")){ TecTech = true; Logger.INFO("Components enabled for: TecTech"); totalMods++; + } + if (isModLoaded("kekztech")){ + KekzTech = true; + Logger.INFO("Components enabled for: KekzTech"); + totalMods++; } - if (Loader.isModLoaded("witchery")){ + if (isModLoaded("witchery")){ Witchery = true; Logger.INFO("Components enabled for: Witchery"); totalMods++; @@ -318,5 +326,17 @@ public class LoadedMods { final String ver = cpw.mods.fml.common.FMLCommonHandler.instance().findContainerFor(modName).getVersion(); return ver; } + + private static final HashMap<String, Boolean> mLoadedModCache = new HashMap<String, Boolean>(); + + public static boolean isModLoaded(String aModName) { + Boolean aResult = mLoadedModCache.get(aModName); + if (aResult == null) { + boolean aTemp = Loader.isModLoaded(aModName); + mLoadedModCache.put(aModName, aTemp); + aResult = aTemp; + } + return aResult; + } } diff --git a/src/Java/gtPlusPlus/core/material/ALLOY.java b/src/Java/gtPlusPlus/core/material/ALLOY.java index 95e3631aaf..4e28b4a428 100644 --- a/src/Java/gtPlusPlus/core/material/ALLOY.java +++ b/src/Java/gtPlusPlus/core/material/ALLOY.java @@ -775,7 +775,7 @@ public final class ALLOY { "Pikyonium 64B", //Material Name MaterialState.SOLID, //State new short[]{52, 103, 186, 0}, //Material Colour - 7850, //Melting Point in C + 6850, //Melting Point in C 11765, //Boiling Point in C -1, -1, diff --git a/src/Java/gtPlusPlus/core/recipe/RECIPES_GREGTECH.java b/src/Java/gtPlusPlus/core/recipe/RECIPES_GREGTECH.java index cf2242067f..74c8ce4202 100644 --- a/src/Java/gtPlusPlus/core/recipe/RECIPES_GREGTECH.java +++ b/src/Java/gtPlusPlus/core/recipe/RECIPES_GREGTECH.java @@ -646,6 +646,18 @@ public class RECIPES_GREGTECH { new int[] {10000}, //Output Chance 20 * 120, 30720); + + //NITINOL_60 + CORE.RA.addBlastSmelterRecipe( + new ItemStack[] { + ELEMENT.getInstance().TITANIUM.getDust(3), + ELEMENT.getInstance().NICKEL.getDust(2) + }, + ALLOY.NITINOL_60.getFluid(20 * 144), + 0, + 20 * 75, + 7680); + @@ -1752,27 +1764,7 @@ public class RECIPES_GREGTECH { } - private static void centrifugeRecipes() { - - //Try use all woods found, fix/add methane extraction. - ArrayList<ItemStack> aLogData = OreDictionary.getOres("logWood"); - ArrayList<ItemStack> aRubberLogs = OreDictionary.getOres("logRubber"); - if (!aLogData.isEmpty() && !aRubberLogs.isEmpty()) { - Logger.INFO("Fixing Methane output of centrifuged logs."); - //First Check to see if it's a rubber log - for (ItemStack stack : aLogData) { - if (aRubberLogs.contains(stack)) { - if (GT_Values.RA.addCentrifugeRecipe(GT_Utility.copyAmount(1L, stack), null, null, Materials.Methane.getGas(60L), ItemList.IC2_Resin.get(1L, new Object[0]), GT_ModHandler.getIC2Item("plantBall", 1L), GT_OreDictUnificator.get(OrePrefixes.dust, Materials.Carbon, 1L), GT_OreDictUnificator.get(OrePrefixes.dust, Materials.Wood, 1L), null, null, new int[] { 5000, 3750, 2500, 2500 }, 200, 20)) { - Logger.INFO("Added rubber plant based methane extraction for "+ItemUtils.getItemName(stack)); - } - } - else { - if (GT_Values.RA.addCentrifugeRecipe(GT_Utility.copyAmount(1L, stack), null, null, Materials.Methane.getGas(60L), GT_Values.NI, GT_Values.NI, GT_Values.NI, GT_Values.NI, GT_Values.NI, GT_Values.NI, null, 200, 20)) { - Logger.INFO("Added methane extraction for "+ItemUtils.getItemName(stack)); - } - } - } - } + private static void centrifugeRecipes() { GT_Values.RA.addCentrifugeRecipe(ItemUtils.getItemStackOfAmountFromOreDict("dustThorium", 8), GT_Values.NI, GT_Values.NF, GT_Values.NF, ELEMENT.getInstance().THORIUM232.getDust(2), diff --git a/src/Java/gtPlusPlus/core/recipe/RECIPES_Machines.java b/src/Java/gtPlusPlus/core/recipe/RECIPES_Machines.java index 8225a40c29..d703bb9637 100644 --- a/src/Java/gtPlusPlus/core/recipe/RECIPES_Machines.java +++ b/src/Java/gtPlusPlus/core/recipe/RECIPES_Machines.java @@ -22,6 +22,7 @@ import gtPlusPlus.core.util.minecraft.gregtech.PollutionUtils; import gtPlusPlus.core.util.reflect.ReflectionUtils; import gtPlusPlus.everglades.dimension.Dimension_Everglades; import gtPlusPlus.xmod.gregtech.api.enums.GregtechItemList; +import gtPlusPlus.xmod.gregtech.common.Meta_GT_Proxy; import gtPlusPlus.xmod.gregtech.common.covers.CoverManager; import gtPlusPlus.xmod.gregtech.common.items.MetaCustomCoverItem; import net.minecraft.block.Block; @@ -540,13 +541,15 @@ public class RECIPES_Machines { 20 * 30, 30); + ItemStack aFluidRegulator1 = ItemUtils.getItemListObject("FluidRegulator_MV", "Pump_HV", GTNH ? 4 : 2); + ItemStack aFluidRegulator2 = ItemUtils.getItemListObject("FluidRegulator_IV", "Pump_LuV", GTNH ? 4 : 2); + //Poo Collector CORE.RA.addSixSlotAssemblingRecipe( new ItemStack[] { CI.machineHull_MV, - CI.getTieredComponent(OrePrefixes.circuit, 2, GTNH ? 4 : 2), + aFluidRegulator1, CI.getTieredComponent(OrePrefixes.pipeMedium, 2, GTNH ? 4 : 2), - CI.getElectricPump(2, GTNH ? 4 : 2), ALLOY.EGLIN_STEEL.getPlate(GTNH ? 8 : 4), ALLOY.POTIN.getScrew(GTNH ? 12 : 6) }, @@ -560,9 +563,8 @@ public class RECIPES_Machines { new ItemStack[] { CI.getTieredMachineHull(-1), ItemUtils.getSimpleStack(ModBlocks.blockPooCollector), - CI.getTieredComponent(OrePrefixes.circuit, 5, GTNH ? 8 : 4), + aFluidRegulator2, CI.getTieredComponent(OrePrefixes.pipeHuge, 6, GTNH ? 8 : 4), - CI.getElectricPump(5, GTNH ? 12 : 6), CI.getTieredComponent(OrePrefixes.screw, 6, GTNH ? 32 : 16) }, CI.getAlternativeTieredFluid(5, 144 * 9), @@ -886,6 +888,7 @@ public class RECIPES_Machines { "plateDoubleGrisium", "rotorGrisium", "plateDoubleGrisium", RECIPE_IndustrialMultiTankController); } + //TODO //Semi-Fluid Generators ItemStack mSemiFluidgen = ItemUtils.getItemStackFromFQRN("IC2:blockGenerator:7", 1); diff --git a/src/Java/gtPlusPlus/core/util/minecraft/HazmatUtils.java b/src/Java/gtPlusPlus/core/util/minecraft/HazmatUtils.java index d69dd5d66e..be57853dda 100644 --- a/src/Java/gtPlusPlus/core/util/minecraft/HazmatUtils.java +++ b/src/Java/gtPlusPlus/core/util/minecraft/HazmatUtils.java @@ -18,6 +18,7 @@ import gtPlusPlus.GTplusplus; import gtPlusPlus.GTplusplus.INIT_PHASE; import gtPlusPlus.api.objects.Logger; import gtPlusPlus.api.objects.data.AutoMap; +import gtPlusPlus.core.lib.LoadedMods; import gtPlusPlus.core.util.Utils; import ic2.core.item.armor.ItemArmorHazmat; import ic2.core.item.armor.ItemArmorNanoSuit; @@ -35,6 +36,38 @@ public class HazmatUtils { private static boolean mInit = false; private static HazmatUtils mInstance; + + private static final String[] mDefaultHazmat = new String[] { + "IC2:itemArmorNanoHelmet:27", + "IC2:itemArmorNanoChestplate:27", + "IC2:itemArmorNanoLegs:27", + "IC2:itemArmorNanoBoots:27", + + "IC2:itemArmorQuantumHelmet:27", + "IC2:itemArmorQuantumChestplate:27", + "IC2:itemArmorQuantumLegs:27", + "IC2:itemArmorQuantumBoots:27", + }; + + + private static final String[] mGravisuit = new String[] { + "GraviSuite:advNanoChestPlate:27", + "GraviSuite:graviChestPlate:27", + }; + private static final String[] mElectroMagicTools = new String[] { + "EMT:NanosuitGogglesRevealing:27", + "EMT:NanoBootsTraveller:27", + "EMT:NanosuitWing:27", + "EMT:itemArmorQuantumChestplate:27", + "EMT:QuantumGogglesRevealing:27", + "EMT:QuantumBootsTraveller:27", + "EMT:QuantumWing:27", + }; + private static final String[] mAdvancedSolarPanels = new String[] { + "AdvancedSolarPanel:advanced_solar_helmet:27", + "AdvancedSolarPanel:hybrid_solar_helmet:27", + "AdvancedSolarPanel:ultimate_solar_helmet:27", + }; public static void init() { if (mInit) { @@ -49,19 +82,36 @@ public class HazmatUtils { sHazmatList.add(GT_ModHandler.getIC2Item("hazmatBoots", 1L, 32767)); // Make Nano a hazmat suit - addProtection(ItemUtils.getItemStackFromFQRN("IC2:itemArmorNanoHelmet:27", 1)); - addProtection(ItemUtils.getItemStackFromFQRN("IC2:itemArmorNanoChestplate:27", 1)); - addProtection(ItemUtils.getItemStackFromFQRN("IC2:itemArmorNanoLegs:27", 1)); - addProtection(ItemUtils.getItemStackFromFQRN("IC2:itemArmorNanoBoots:27", 1)); - - Logger.INFO("[Hazmat] Registered Nano as hazmat gear."); - - // Make Quantum a hazmat suit - addProtection(ItemUtils.getItemStackFromFQRN("IC2:itemArmorQuantumHelmet:27", 1)); - addProtection(ItemUtils.getItemStackFromFQRN("IC2:itemArmorQuantumChestplate:27", 1)); - addProtection(ItemUtils.getItemStackFromFQRN("IC2:itemArmorQuantumLegs:27", 1)); - addProtection(ItemUtils.getItemStackFromFQRN("IC2:itemArmorQuantumBoots:27", 1)); - Logger.INFO("[Hazmat] Registered Quantum as hazmat gear."); + // Make Quantum a hazmat suit + + + if (LoadedMods.IndustrialCraft2 || LoadedMods.IndustrialCraft2Classic) { + for (String aItemName : mDefaultHazmat) { + addProtection(ItemUtils.getItemStackFromFQRN(aItemName, 1)); + } + Logger.INFO("[Hazmat] Registered IC2 Items as hazmat gear."); + } + + if (LoadedMods.isModLoaded("EMT")) { + for (String aItemName : mElectroMagicTools) { + addProtection(ItemUtils.getItemStackFromFQRN(aItemName, 1)); + } + Logger.INFO("[Hazmat] Registered EMT Items as hazmat gear."); + } + + if (LoadedMods.isModLoaded("GraviSuite")) { + for (String aItemName : mGravisuit) { + addProtection(ItemUtils.getItemStackFromFQRN(aItemName, 1)); + } + Logger.INFO("[Hazmat] Registered Gravisuit Items as hazmat gear."); + } + + if (LoadedMods.isModLoaded("AdvancedSolarPanel")) { + for (String aItemName : mAdvancedSolarPanels) { + addProtection(ItemUtils.getItemStackFromFQRN(aItemName, 1)); + } + Logger.INFO("[Hazmat] Registered Adv. Solar Items as hazmat gear."); + } Utils.registerEvent(mInstance); Logger.INFO("[Hazmat] Registered Tooltip handler for hazmat gear."); diff --git a/src/Java/gtPlusPlus/core/util/minecraft/ItemUtils.java b/src/Java/gtPlusPlus/core/util/minecraft/ItemUtils.java index cb490203df..485436011f 100644 --- a/src/Java/gtPlusPlus/core/util/minecraft/ItemUtils.java +++ b/src/Java/gtPlusPlus/core/util/minecraft/ItemUtils.java @@ -39,6 +39,7 @@ import gtPlusPlus.xmod.gregtech.loaders.RecipeGen_DustGeneration; import net.minecraft.block.Block; import net.minecraft.enchantment.Enchantment; import net.minecraft.enchantment.EnchantmentData; +import net.minecraft.init.Blocks; import net.minecraft.init.Items; import net.minecraft.inventory.IInventory; import net.minecraft.item.Item; @@ -100,6 +101,11 @@ public class ItemUtils { return y; } + public static ItemStack getWildcardStack(final ItemStack x) { + final ItemStack y = ItemUtils.simpleMetaStack(x, WILDCARD_VALUE, 1); + return y; + } + public static ItemStack getIC2Cell(final String S) { final ItemStack moreTemp = ItemUtils.getItemStackOfAmountFromOreDictNoBroken("cell" + S, 1); @@ -154,13 +160,20 @@ public class ItemUtils { } } - public static void addItemToOreDictionary(final ItemStack stack, final String oreDictName) { + public static void addItemToOreDictionary(ItemStack stack, final String oreDictName, boolean useWildcardMeta) { + if (useWildcardMeta) { + stack = ItemUtils.getWildcardStack(stack); + } try { - GT_OreDictUnificator.registerOre(oreDictName, stack); + OreDictionary.registerOre(oreDictName, stack); } catch (final NullPointerException e) { - Logger.ERROR(stack.getDisplayName() + " not registered. [NULL]"); + Logger.ERROR(ItemUtils.getItemName(stack) + " not registered. [NULL]"); } } + + public static void addItemToOreDictionary(final ItemStack stack, final String oreDictName) { + addItemToOreDictionary(stack, oreDictName, false); + } public static ItemStack getItemStackWithMeta(final boolean MOD, final String FQRN, final String itemName, final int meta, final int itemstackSize) { @@ -1255,5 +1268,40 @@ public class ItemUtils { } return getNullStack(); } + + public static ItemStack getItemListObject(String aObjectFromExperimentalName, String aReplacementName, int aAmount) { + ItemList aItemListObject = getItemListObject(aReplacementName, aReplacementName); + if (aItemListObject == ItemList.NULL || aItemListObject == null) { + return null; + } + else { + return aItemListObject.get(aAmount); + } + } + + public static ItemStack getItemListObject(ItemList aItemListObject, int aAmount) { + if (aItemListObject == ItemList.NULL || aItemListObject == null) { + return null; + } + else { + return aItemListObject.get(aAmount); + } + } + + public static ItemList getItemListObject(String aObjectFromExperimentalName, String aReplacementName) { + ItemList aVal = ItemList.valueOf(aObjectFromExperimentalName); + if (aVal != null) { + return aVal; + } + else { + aVal = ItemList.valueOf(aReplacementName); + if (aVal != null) { + return aVal; + } + else { + return ItemList.NULL; + } + } + } } diff --git a/src/Java/gtPlusPlus/core/util/minecraft/MaterialUtils.java b/src/Java/gtPlusPlus/core/util/minecraft/MaterialUtils.java index 9c623bb9be..2108087542 100644 --- a/src/Java/gtPlusPlus/core/util/minecraft/MaterialUtils.java +++ b/src/Java/gtPlusPlus/core/util/minecraft/MaterialUtils.java @@ -352,7 +352,8 @@ public class MaterialUtils { } if (g == null) { Logger.INFO("Failed finding material '"+aMaterialName+"' & fallback '"+aFallbackMaterialName+"', returning _NULL."); - g = Materials._NULL; + CORE.crash(); + //g = Materials._NULL; } return g; } diff --git a/src/Java/gtPlusPlus/core/util/minecraft/PlayerUtils.java b/src/Java/gtPlusPlus/core/util/minecraft/PlayerUtils.java index 2fb7344a28..9a8a8e691c 100644 --- a/src/Java/gtPlusPlus/core/util/minecraft/PlayerUtils.java +++ b/src/Java/gtPlusPlus/core/util/minecraft/PlayerUtils.java @@ -1,10 +1,13 @@ package gtPlusPlus.core.util.minecraft; -import java.util.*; +import java.util.ArrayList; +import java.util.Iterator; +import java.util.List; +import java.util.UUID; import cpw.mods.fml.relauncher.Side; import cpw.mods.fml.relauncher.SideOnly; - +import gtPlusPlus.core.util.Utils; import net.minecraft.client.Minecraft; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.entity.player.EntityPlayerMP; @@ -13,8 +16,6 @@ import net.minecraft.item.ItemStack; import net.minecraft.server.MinecraftServer; import net.minecraft.world.World; -import gtPlusPlus.core.util.Utils; - public class PlayerUtils { public static void messagePlayer(final EntityPlayer P, final String S){ @@ -100,18 +101,27 @@ public class PlayerUtils { return null; } - @SideOnly(Side.SERVER) public static ItemStack getItemStackInPlayersHand(final EntityPlayer player){ ItemStack heldItem = null; - try{heldItem = player.getHeldItem(); - }catch(final NullPointerException e){ + try{ + heldItem = player.getHeldItem(); + } + catch(final NullPointerException e){ e.printStackTrace(); return null; } if (heldItem != null){ return heldItem; } - return null; + else { + if (Utils.isClient()) { + heldItem = player.getItemInUse(); + } + else { + heldItem = player.getCurrentEquippedItem(); + } + } + return heldItem; } @SideOnly(Side.CLIENT) diff --git a/src/Java/gtPlusPlus/nei/GT_NEI_FluidReactor.java b/src/Java/gtPlusPlus/nei/GT_NEI_FluidReactor.java index ce1b11e7d4..b150d94c25 100644 --- a/src/Java/gtPlusPlus/nei/GT_NEI_FluidReactor.java +++ b/src/Java/gtPlusPlus/nei/GT_NEI_FluidReactor.java @@ -8,27 +8,29 @@ import java.util.List; import org.lwjgl.opengl.GL11; +import codechicken.lib.gui.GuiDraw; +import codechicken.nei.PositionedStack; +import codechicken.nei.guihook.GuiContainerManager; +import codechicken.nei.guihook.IContainerInputHandler; +import codechicken.nei.guihook.IContainerTooltipHandler; +import codechicken.nei.recipe.GuiCraftingRecipe; +import codechicken.nei.recipe.GuiRecipe; +import codechicken.nei.recipe.GuiUsageRecipe; +import codechicken.nei.recipe.TemplateRecipeHandler; import cpw.mods.fml.common.event.FMLInterModComms; - -import net.minecraft.client.Minecraft; -import net.minecraft.client.gui.inventory.GuiContainer; -import net.minecraft.init.Blocks; -import net.minecraft.item.ItemStack; - import gregtech.api.enums.GT_Values; import gregtech.api.enums.OrePrefixes; import gregtech.api.gui.GT_GUIContainer_BasicMachine; import gregtech.api.objects.ItemData; -import gregtech.api.util.*; +import gregtech.api.util.GT_OreDictUnificator; +import gregtech.api.util.GT_Recipe; import gregtech.api.util.GT_Recipe.GT_Recipe_Map; -import gregtech.api.util.Recipe_GT.Gregtech_Recipe_Map; +import gregtech.api.util.GT_Utility; import gtPlusPlus.core.lib.CORE; -import codechicken.lib.gui.GuiDraw; -import codechicken.nei.PositionedStack; -import codechicken.nei.guihook.GuiContainerManager; -import codechicken.nei.guihook.IContainerInputHandler; -import codechicken.nei.guihook.IContainerTooltipHandler; -import codechicken.nei.recipe.*; +import net.minecraft.client.Minecraft; +import net.minecraft.client.gui.inventory.GuiContainer; +import net.minecraft.init.Blocks; +import net.minecraft.item.ItemStack; import net.minecraftforge.fluids.FluidContainerRegistry; import net.minecraftforge.fluids.FluidStack; @@ -42,9 +44,9 @@ extends TemplateRecipeHandler { GuiContainerManager.addTooltipHandler(new GT_RectHandler()); } - protected final Gregtech_Recipe_Map mRecipeMap; + protected final GT_Recipe_Map mRecipeMap; - public GT_NEI_FluidReactor(final Gregtech_Recipe_Map sfluidchemicalreactorrecipes) { + public GT_NEI_FluidReactor(final GT_Recipe_Map sfluidchemicalreactorrecipes) { this.mRecipeMap = sfluidchemicalreactorrecipes; this.transferRects.add(new TemplateRecipeHandler.RecipeTransferRect(new Rectangle(65, 13, 36, 18), this.getOverlayIdentifier(), new Object[0])); if (!NEI_GT_Config.sIsAdded) { diff --git a/src/Java/gtPlusPlus/nei/NEI_GT_Config.java b/src/Java/gtPlusPlus/nei/NEI_GT_Config.java index ad03040059..348b95ecb3 100644 --- a/src/Java/gtPlusPlus/nei/NEI_GT_Config.java +++ b/src/Java/gtPlusPlus/nei/NEI_GT_Config.java @@ -4,6 +4,7 @@ import codechicken.nei.api.API; import codechicken.nei.api.IConfigureNEI; import gregtech.api.util.CustomRecipeMap; import gregtech.api.util.Recipe_GT.Gregtech_Recipe_Map; +import gtPlusPlus.xmod.gregtech.common.tileentities.machines.multi.production.chemplant.GregtechMTE_ChemicalPlant; public class NEI_GT_Config implements IConfigureNEI { @@ -24,7 +25,7 @@ implements IConfigureNEI { } } } - new GT_NEI_FluidReactor(Gregtech_Recipe_Map.sFluidChemicalReactorRecipes); + new GT_NEI_FluidReactor(GregtechMTE_ChemicalPlant.getGeneratedRecipeMap()); sIsAdded = true; API.registerRecipeHandler(new DecayableRecipeHandler()); API.registerUsageHandler(new DecayableRecipeHandler()); diff --git a/src/Java/gtPlusPlus/preloader/asm/AsmConfig.java b/src/Java/gtPlusPlus/preloader/asm/AsmConfig.java index b3fbcb2d61..88bcf6b28b 100644 --- a/src/Java/gtPlusPlus/preloader/asm/AsmConfig.java +++ b/src/Java/gtPlusPlus/preloader/asm/AsmConfig.java @@ -15,6 +15,7 @@ public class AsmConfig { public static boolean enableTiConFluidLighting; public static boolean enableGtTooltipFix; public static boolean enableGtNbtFix; + public static boolean enableGtCharcoalPitFix; public static boolean enableChunkDebugging; public static boolean enableCofhPatch; public static boolean enableGcFuelChanges; @@ -22,6 +23,7 @@ public class AsmConfig { public static boolean enableRcItemDupeFix; public static boolean enableTcAspectSafety; public static boolean enabledLwjglKeybindingFix; + public static boolean enabledFixEntitySetHealth; public static boolean disableAllLogging; @@ -51,6 +53,12 @@ public class AsmConfig { disableAllLogging = prop.getBoolean(false); propOrderDebug.add(prop.getName()); + prop = config.get("debug", "enabledFixEntitySetHealth", false); + prop.comment = "Enable/Disable entity setHealth() fix."; + prop.setLanguageKey("gtpp.enabledFixEntitySetHealth").setRequiresMcRestart(true); + enabledFixEntitySetHealth = prop.getBoolean(false); + propOrderDebug.add(prop.getName()); + prop = config.get("debug", "enableChunkDebugging", false); prop.comment = "Enable/Disable Chunk Debugging Features, Must Be enabled on Client and Server."; prop.setLanguageKey("gtpp.enableChunkDebugging").setRequiresMcRestart(true); @@ -91,6 +99,14 @@ public class AsmConfig { enableGtTooltipFix = prop.getBoolean(true); propOrder.add(prop.getName()); + + + prop = config.get("general", "enableGtCharcoalPitFix", true); + prop.comment = "Makes the Charcoal Pile Igniter work better."; + prop.setLanguageKey("gtpp.enableGtCharcoalPitFix").setRequiresMcRestart(true); + enableGtCharcoalPitFix = prop.getBoolean(true); + propOrder.add(prop.getName()); + prop = config.get("general", "enableGcFuelChanges", true); prop.comment = "Enable/Disable changes to Galacticraft Rocket Fuels."; prop.setLanguageKey("gtpp.enableGcFuelChanges").setRequiresMcRestart(true); @@ -137,6 +153,7 @@ public class AsmConfig { FMLLog.log(Level.INFO, "[GT++ ASM] Gc Fuel Changes Patch - Enabled: "+enableGcFuelChanges, new Object[0]); FMLLog.log(Level.INFO, "[GT++ ASM] Railcraft Fluid Flow Patch - Enabled: "+enableRcFlowFix, new Object[0]); FMLLog.log(Level.INFO, "[GT++ ASM] Thaumcraft Aspect Safety Patch - Enabled: "+enableTcAspectSafety, new Object[0]); + FMLLog.log(Level.INFO, "[GT++ ASM] Fix bad usage of EntityLivingBase.setHealth Patch - Enabled: "+enabledFixEntitySetHealth, new Object[0]); } catch (Exception var3) { FMLLog.log(Level.ERROR, var3, "GT++ ASM had a problem loading it's config", new Object[0]); diff --git a/src/Java/gtPlusPlus/preloader/asm/transformers/ClassTransformer_Forge_EntityLivingBase_SetHealth.java b/src/Java/gtPlusPlus/preloader/asm/transformers/ClassTransformer_Forge_EntityLivingBase_SetHealth.java new file mode 100644 index 0000000000..d56b9de059 --- /dev/null +++ b/src/Java/gtPlusPlus/preloader/asm/transformers/ClassTransformer_Forge_EntityLivingBase_SetHealth.java @@ -0,0 +1,130 @@ +package gtPlusPlus.preloader.asm.transformers; + +import org.objectweb.asm.ClassReader; +import org.objectweb.asm.ClassVisitor; +import org.objectweb.asm.ClassWriter; +import org.objectweb.asm.MethodVisitor; +import org.objectweb.asm.Opcodes; + +import cpw.mods.fml.relauncher.FMLRelaunchLog; +import net.minecraft.entity.EntityLivingBase; +import net.minecraft.util.DamageSource; + +public class ClassTransformer_Forge_EntityLivingBase_SetHealth { + + private boolean isValid = false; + private ClassReader mReader = null; + private ClassWriter mWriter = null; + private boolean didPatch = false; + + public ClassTransformer_Forge_EntityLivingBase_SetHealth(String aClassName, byte[] basicClass) { + if (basicClass == null) { + return; + } + + ClassReader reader = new ClassReader(basicClass); + ClassWriter writer = new ClassWriter(reader, ClassWriter.COMPUTE_MAXS); + ClassVisitor visitor = writer; + SetHealthVisitor aVisitor = new SetHealthVisitor(visitor); + visitor = aVisitor; + reader.accept(visitor, 0); + if (reader != null && writer != null) { + isValid = true; + } + else { + isValid = false; + } + mReader = reader; + mWriter = writer; + didPatch = aVisitor.didPatchInternal; + } + + public boolean isValidTransformer() { + return isValid; + } + + public ClassReader getReader() { + return mReader; + } + + public ClassWriter getWriter() { + return mWriter; + } + + + public static class SetHealthVisitor extends ClassVisitor { + private String clsName = null; + private boolean didPatchInternal = false; + private static final String callbackOwner = org.objectweb.asm.Type.getInternalName(SetHealthVisitor.class); + + private SetHealthVisitor(ClassVisitor cv) { + super(Opcodes.ASM5, cv); + } + + @Override + public void visit(int version, int access, String name, String signature, String superName, String[] interfaces) { + super.visit( + version, access, name, signature, superName, interfaces + ); + this.clsName = name; + } + + @Override + public MethodVisitor visitMethod( + int mAccess, final String mName, final String mDesc, String mSignature, String[] mExceptions) { + final boolean warn = !(clsName.equals( + "net/minecraft/entity/EntityLivingBase" + )); + + return new MethodVisitor(Opcodes.ASM5, super.visitMethod(mAccess, mName, mDesc, mSignature, mExceptions)) { + @Override + public void visitMethodInsn( + int opcode, String owner, String name, String desc, boolean isIntf + ) { + if (owner.equals( + "net/minecraft/entity/EntityLivingBase" + ) && name.equals("setHealth") && desc.equals("(F)V")) { + if (warn) { + FMLRelaunchLog.warning( + "=============================================================" + ); + FMLRelaunchLog.warning( + "MOD HAS DIRECT REFERENCE Entity.setHealth() THIS IS NOT ALLOWED!" + ); + FMLRelaunchLog.warning( + "Offendor: %s.%s%s", SetHealthVisitor.this.clsName, mName, mDesc + ); + FMLRelaunchLog.warning( + "Use EntityLiving.attackEntityFrom(DamageSource, damageDealt) instead" + ); + FMLRelaunchLog.warning( + "=============================================================" + ); + } + didPatchInternal = true; + //opcode = Opcodes.INVOKESTATIC; // Set it static + //owner = SetHealthVisitor.callbackOwner; + //name = "setHealthGeneric"; // Replace the method name + //desc = "(Lnet/minecraft/entity/EntityLivingBase;F)V"; // Replace the method desc + + } + super.visitMethodInsn(opcode, owner, name, desc, isIntf); + } + }; + } + + + private final static DamageSource mGenericDamageSource = new DamageSource("gtpp.generic"); + + public static void setHealthGeneric(EntityLivingBase aEntity, float aValue) { + aEntity.attackEntityFrom(mGenericDamageSource, aValue); + } + + } + + + public boolean didPatchClass() { + return didPatch; + } + +} diff --git a/src/Java/gtPlusPlus/preloader/asm/transformers/ClassTransformer_GT_CharcoalPit.java b/src/Java/gtPlusPlus/preloader/asm/transformers/ClassTransformer_GT_CharcoalPit.java index 9c79db265d..1e54bd3632 100644 --- a/src/Java/gtPlusPlus/preloader/asm/transformers/ClassTransformer_GT_CharcoalPit.java +++ b/src/Java/gtPlusPlus/preloader/asm/transformers/ClassTransformer_GT_CharcoalPit.java @@ -1,10 +1,6 @@ package gtPlusPlus.preloader.asm.transformers; -import static org.objectweb.asm.Opcodes.ACC_PUBLIC; -import static org.objectweb.asm.Opcodes.ALOAD; -import static org.objectweb.asm.Opcodes.ASM5; -import static org.objectweb.asm.Opcodes.INVOKESTATIC; -import static org.objectweb.asm.Opcodes.IRETURN; +import static org.objectweb.asm.Opcodes.*; import java.util.ArrayList; @@ -17,10 +13,10 @@ import org.objectweb.asm.MethodVisitor; import cpw.mods.fml.relauncher.FMLRelaunchLog; import gregtech.api.enums.OrePrefixes; -import gtPlusPlus.api.objects.Logger; +import gregtech.api.util.GT_Utility; import gtPlusPlus.core.util.minecraft.ItemUtils; +import gtPlusPlus.core.util.reflect.ReflectionUtils; import net.minecraft.block.Block; -import net.minecraft.block.material.Material; import net.minecraft.item.ItemStack; import net.minecraftforge.oredict.OreDictionary; @@ -31,35 +27,58 @@ public class ClassTransformer_GT_CharcoalPit { private final ClassWriter writer; public static boolean isWoodLog(Block log) { - //Logger.INFO("checking for log"); - boolean isLog1 = OrePrefixes.log.contains(new ItemStack(log, 1)); - if (isLog1) { - //Logger.INFO("Found 1"); - return true; + return isWoodLog(log, Short.MAX_VALUE); + } + + public static boolean isWoodLog(Block log, int meta) { + ItemStack aLogStack = ItemUtils.getSimpleStack(log, meta, 1); + ArrayList<ItemStack> aData = OrePrefixes.log.mPrefixedItems; + for (ItemStack aStack : aData) { + if (GT_Utility.areStacksEqual(aStack, aLogStack)) { + return true; + } + } + aData.clear(); + aData = OreDictionary.getOres("logWood"); + for (ItemStack aStack : aData) { + if (GT_Utility.areStacksEqual(aStack, aLogStack)) { + return true; + } } - ArrayList<ItemStack> oredict = OreDictionary.getOres("logWood"); - if (oredict.contains(ItemUtils.getSimpleStack(log))) { - //Logger.INFO("found 2"); - return true; - } - //Logger.INFO("Did not find. "+(log != null ? ""+log.getLocalizedName() : "Null or invalid block?")); return false; } - + public ClassTransformer_GT_CharcoalPit(byte[] basicClass, boolean obfuscated) { ClassReader aTempReader = null; ClassWriter aTempWriter = null; + boolean aBadTime = false; + if (ReflectionUtils.doesClassExist("aji")) { + obfuscated = true; + } + else { + if (ReflectionUtils.doesClassExist("net.minecraft.block.Block")) { + obfuscated = false; + } + else { + // Bad... Like.. very bad.. + FMLRelaunchLog.log("[GT++ ASM] GT Charcoal Pit Fix", Level.INFO, "Unable to find Block.class/aji.class, this is BAD. Not Patching."); + } + } aTempReader = new ClassReader(basicClass); aTempWriter = new ClassWriter(aTempReader, ClassWriter.COMPUTE_FRAMES); - aTempReader.accept(new AddFieldAdapter(aTempWriter), 0); - injectMethod("isWoodLog", obfuscated, aTempWriter); - if (aTempReader != null && aTempWriter != null) { - isValid = true; - } else { + if (!aBadTime) { + aTempReader.accept(new CustomClassVisitor(aTempWriter), 0); + injectMethod("isWoodLog", obfuscated, aTempWriter); + if (aTempReader != null && aTempWriter != null) { + isValid = true; + } else { + isValid = false; + } + } + else { isValid = false; } - FMLRelaunchLog.log("[GT++ ASM] GT Charcoal Pit Fix", Level.INFO, - "Valid? " + isValid + "."); + FMLRelaunchLog.log("[GT++ ASM] GT Charcoal Pit Fix", Level.INFO, "Valid? " + isValid + "."); reader = aTempReader; writer = aTempWriter; } @@ -80,17 +99,19 @@ public class ClassTransformer_GT_CharcoalPit { MethodVisitor mv; boolean didInject = false; FMLRelaunchLog.log("[GT++ ASM] GT Charcoal Pit Fix", Level.INFO, "Injecting " + aMethodName + "."); - + String aBlockClassName = "net/minecraft/block/Block"; if (obfuscated) { aBlockClassName = "aji"; } if (aMethodName.equals("isWoodLog")) { + + // Inject original Method with only block arg. mv = cw.visitMethod(ACC_PUBLIC, "isWoodLog", "(L"+aBlockClassName+";)Z", null, null); mv.visitCode(); Label l0 = new Label(); mv.visitLabel(l0); - mv.visitLineNumber(49, l0); + mv.visitLineNumber(197, l0); mv.visitVarInsn(ALOAD, 1); mv.visitMethodInsn(INVOKESTATIC, "gtPlusPlus/preloader/asm/transformers/ClassTransformer_GT_CharcoalPit", "isWoodLog", "(L"+aBlockClassName+";)Z", false); mv.visitInsn(IRETURN); @@ -100,15 +121,36 @@ public class ClassTransformer_GT_CharcoalPit { mv.visitLocalVariable("log", "L"+aBlockClassName+";", null, l0, l1, 1); mv.visitMaxs(1, 2); mv.visitEnd(); + + + // Inject better Method with block & meta arg. + mv = cw.visitMethod(ACC_PUBLIC, "isWoodLog", "(L"+aBlockClassName+";I)Z", null, null); + mv.visitCode(); + Label label0 = new Label(); + mv.visitLabel(label0); + mv.visitLineNumber(201, label0); + mv.visitVarInsn(ALOAD, 1); + mv.visitVarInsn(ILOAD, 2); + mv.visitMethodInsn(INVOKESTATIC, "gtPlusPlus/preloader/asm/transformers/ClassTransformer_GT_CharcoalPit", "isWoodLog", "(L"+aBlockClassName+";I)Z", false); + mv.visitInsn(IRETURN); + Label label1 = new Label(); + mv.visitLabel(label1); + mv.visitLocalVariable("this", "Lgregtech/common/tileentities/machines/multi/GT_MetaTileEntity_Charcoal_Pit;", null, label0, label1, 0); + mv.visitLocalVariable("log", "L"+aBlockClassName+";", null, label0, label1, 1); + mv.visitLocalVariable("meta", "I", null, label0, label1, 2); + mv.visitMaxs(2, 3); + mv.visitEnd(); + didInject = true; + } FMLRelaunchLog.log("[GT++ ASM] GT Charcoal Pit Fix", Level.INFO, "Method injection complete."); return didInject; } - public class AddFieldAdapter extends ClassVisitor { + public class CustomClassVisitor extends ClassVisitor { - public AddFieldAdapter(ClassVisitor cv) { + public CustomClassVisitor(ClassVisitor cv) { super(ASM5, cv); this.cv = cv; } 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 d81c96dcca..d8dc71dff0 100644 --- a/src/Java/gtPlusPlus/preloader/asm/transformers/Preloader_Transformer_Handler.java +++ b/src/Java/gtPlusPlus/preloader/asm/transformers/Preloader_Transformer_Handler.java @@ -30,9 +30,9 @@ public class Preloader_Transformer_Handler implements IClassTransformer { System.out.println("[GT++ ASM] Asm Config Location: "+mConfig.config.getConfigFile().getAbsolutePath()); System.out.println("[GT++ ASM] Is DevHelper Valid? "+gtPlusPlus.preloader.DevHelper.mIsValidHelper); } - + private static Boolean mObf = null; - + public boolean checkObfuscated() { if (mObf != null) { return mObf; @@ -60,6 +60,25 @@ public class Preloader_Transformer_Handler implements IClassTransformer { } public byte[] transform(String name, String transformedName, byte[] basicClass) { + /* + * Here we patch all instances of entity.setHealth and replace them with a static function. + * Only EntityLivingBase is left untouched, as nothing else truly needs to be calling this method and avoiding forge hooks. + * May exclude all vanilla/forge class if this causes issues though. + */ + PatchForge : if (mConfig.enabledFixEntitySetHealth && !transformedName.contains("gtPlusPlus.preloader")) { + + //Skip Vanilla/Forge Classes + if (transformedName.contains("net.minecraft.") || transformedName.contains("cpw.")) { + //break PatchForge; + } + + ClassTransformer_Forge_EntityLivingBase_SetHealth aForgeHealthFix = new ClassTransformer_Forge_EntityLivingBase_SetHealth(transformedName, basicClass); + if (aForgeHealthFix.isValidTransformer() && aForgeHealthFix.didPatchClass()) { + FMLRelaunchLog.log("[GT++ ASM] Fix EntityLivingBase.setHealth misuse", Level.INFO, "Transforming %s", transformedName); + basicClass = aForgeHealthFix.getWriter().toByteArray(); + } + } + // Is this environment obfuscated? (Extra checks just in case some weird shit happens during the check) boolean obfuscated = checkObfuscated(); boolean probablyShouldBeFalse = false; @@ -69,7 +88,7 @@ public class Preloader_Transformer_Handler implements IClassTransformer { FMLRelaunchLog.log("[GT++ ASM] LWJGL Keybinding index out of bounds fix", Level.INFO, "Transforming %s", transformedName); return new ClassTransformer_LWJGL_Keyboard(basicClass).getWriter().toByteArray(); } - + //Enable mapping of Tickets and loaded chunks. - Forge if (transformedName.equals("net.minecraftforge.common.ForgeChunkManager") && mConfig.enableChunkDebugging) { FMLRelaunchLog.log("[GT++ ASM] Chunkloading Patch", Level.INFO, "Transforming %s", transformedName); @@ -94,7 +113,7 @@ 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 RC stuff //Patching PROCESS_VOLUME to allow 4x more transfer limits if (transformedName.equals("mods.railcraft.common.fluids.FluidHelper") && mConfig.enableRcFlowFix) { @@ -123,15 +142,15 @@ public class Preloader_Transformer_Handler implements IClassTransformer { } } - - - - - + + + + + /** * Gregtech ASM Patches */ - + //Make GT_Utilities safer if (transformedName.equals("gtPlusPlus.preloader.asm.transformers.ClassTransformer_GT_Utility")) { FMLRelaunchLog.log("[GT++ ASM] Gregtech Utilities Patch", Level.INFO, "Transforming %s", transformedName); @@ -147,7 +166,7 @@ public class Preloader_Transformer_Handler implements IClassTransformer { FMLRelaunchLog.log("[GT++ ASM] Gregtech Achievements Patch", Level.INFO, "Transforming %s", transformedName); return new ClassTransformer_GT_Achievements_CrashFix(basicClass, obfuscated).getWriter().toByteArray(); } - + //Fix bad handling of a loop left from original decompilation //Also Fix Achievements, although currently disabled. if (transformedName.equals("gregtech.common.GT_Client")) { @@ -165,16 +184,16 @@ public class Preloader_Transformer_Handler implements IClassTransformer { FMLRelaunchLog.log("[GT++ ASM] Gregtech setMetaTileEntity Patch", Level.INFO, "Transforming %s", transformedName); return new ClassTransformer_GT_BaseMetaTileEntity(basicClass).getWriter().toByteArray(); } - + //Fix log handling on the charcoal pit - if (transformedName.equals("gregtech.common.tileentities.machines.multi.GT_MetaTileEntity_Charcoal_Pit")) { + if (transformedName.equals("gregtech.common.tileentities.machines.multi.GT_MetaTileEntity_Charcoal_Pit") && mConfig.enableGtCharcoalPitFix) { FMLRelaunchLog.log("[GT++ ASM] GT Charcoal Pit Fix", Level.INFO, "Transforming %s", transformedName); return new ClassTransformer_GT_CharcoalPit(basicClass, obfuscated).getWriter().toByteArray(); } - - - - + + + + //Patching Meta Tile Tooltips if (transformedName.equals("gregtech.common.blocks.GT_Item_Machines") && mConfig.enableGtTooltipFix) { FMLRelaunchLog.log("[GT++ ASM] Gregtech Tooltip Patch", Level.INFO, "Transforming %s", transformedName); @@ -203,7 +222,7 @@ public class Preloader_Transformer_Handler implements IClassTransformer { } return new ClassTransformer_GT_BlockMachines_MetaPipeEntity(basicClass, probablyShouldBeFalse, mode).getWriter().toByteArray(); } - + String[] aIC2ClassNames = new String[] { "ic2.core.block.BlockTileEntity", "ic2.core.block.machine.BlockMachine", @@ -230,24 +249,24 @@ public class Preloader_Transformer_Handler implements IClassTransformer { return new ClassTransformer_IC2_GetHarvestTool(basicClass, obfuscated, transformedName).getWriter().toByteArray(); } } - + //Fix IC2 Hazmat if (transformedName.equals("ic2.core.item.armor.ItemArmorHazmat")) { FMLRelaunchLog.log("[GT++ ASM] IC2 Hazmat Patch", Level.INFO, "Transforming %s", transformedName); return new ClassTransformer_IC2_Hazmat(basicClass, transformedName).getWriter().toByteArray(); } - + //Fix Thaumcraft Shit //Patching ItemWispEssence to allow invalid item handling if (transformedName.equals("thaumcraft.common.items.ItemWispEssence") && mConfig.enableTcAspectSafety) { FMLRelaunchLog.log("[GT++ ASM] Thaumcraft WispEssence_Patch", Level.INFO, "Transforming %s", transformedName); return new ClassTransformer_TC_ItemWispEssence(basicClass, obfuscated).getWriter().toByteArray(); } - - + + return basicClass; } - - + + } diff --git a/src/Java/gtPlusPlus/xmod/bop/blocks/BOP_Block_Registrator.java b/src/Java/gtPlusPlus/xmod/bop/blocks/BOP_Block_Registrator.java index f5e1d429f7..2ee1587809 100644 --- a/src/Java/gtPlusPlus/xmod/bop/blocks/BOP_Block_Registrator.java +++ b/src/Java/gtPlusPlus/xmod/bop/blocks/BOP_Block_Registrator.java @@ -41,9 +41,9 @@ public class BOP_Block_Registrator { log_Rainforest = new LogRainforestTree(); leaves_Rainforest = new LeavesRainforestTree(); sapling_Rainforest = new SaplingRainforestTree(); - ItemUtils.addItemToOreDictionary(ItemUtils.getSimpleStack(log_Rainforest), "logWood"); - ItemUtils.addItemToOreDictionary(ItemUtils.getSimpleStack(leaves_Rainforest), "treeLeaves"); - ItemUtils.addItemToOreDictionary(ItemUtils.getSimpleStack(sapling_Rainforest), "treeSapling"); + ItemUtils.addItemToOreDictionary(ItemUtils.getSimpleStack(log_Rainforest), "logWood", true); + ItemUtils.addItemToOreDictionary(ItemUtils.getSimpleStack(leaves_Rainforest), "treeLeaves", true); + ItemUtils.addItemToOreDictionary(ItemUtils.getSimpleStack(sapling_Rainforest), "treeSapling", true); return true; } diff --git a/src/Java/gtPlusPlus/xmod/bop/blocks/base/LeavesBase.java b/src/Java/gtPlusPlus/xmod/bop/blocks/base/LeavesBase.java index 7a40ab154d..264aaa2a20 100644 --- a/src/Java/gtPlusPlus/xmod/bop/blocks/base/LeavesBase.java +++ b/src/Java/gtPlusPlus/xmod/bop/blocks/base/LeavesBase.java @@ -37,7 +37,7 @@ public class LeavesBase extends BlockLeaves { String blockName = "block"+Utils.sanitizeString(blockNameLocalized)+"Leaves"; GameRegistry.registerBlock(this, ItemBlock.class, blockName); this.setBlockName(blockName); - ItemUtils.addItemToOreDictionary(ItemUtils.getSimpleStack(this), "treeLeaves"); + ItemUtils.addItemToOreDictionary(ItemUtils.getSimpleStack(this), "treeLeaves", true); this.setCreativeTab(AddToCreativeTab.tabBOP); LanguageRegistry.addName(this, blockNameLocalized+" Leaves"); Blocks.fire.setFireInfo(this, 80, 150); diff --git a/src/Java/gtPlusPlus/xmod/bop/blocks/base/LogBase.java b/src/Java/gtPlusPlus/xmod/bop/blocks/base/LogBase.java index 976361a01b..8e8ca0ed0a 100644 --- a/src/Java/gtPlusPlus/xmod/bop/blocks/base/LogBase.java +++ b/src/Java/gtPlusPlus/xmod/bop/blocks/base/LogBase.java @@ -33,8 +33,8 @@ public abstract class LogBase extends BlockLog String blockName = "block"+Utils.sanitizeString(blockNameLocalized)+"Log"; GameRegistry.registerBlock(this, ItemBlock.class, blockName); this.setBlockName(blockName); - ItemUtils.addItemToOreDictionary(ItemUtils.getSimpleStack(this), "log"+Utils.sanitizeString(blockNameLocalized)); - ItemUtils.addItemToOreDictionary(ItemUtils.getSimpleStack(this), "logWood"); + ItemUtils.addItemToOreDictionary(ItemUtils.getSimpleStack(this), "log"+Utils.sanitizeString(blockNameLocalized), true); + ItemUtils.addItemToOreDictionary(ItemUtils.getSimpleStack(this), "logWood", true); this.setCreativeTab(AddToCreativeTab.tabBOP); LanguageRegistry.addName(this, blockNameLocalized); Blocks.fire.setFireInfo(this, 20, 100); diff --git a/src/Java/gtPlusPlus/xmod/bop/blocks/base/SaplingBase.java b/src/Java/gtPlusPlus/xmod/bop/blocks/base/SaplingBase.java index 1aab5133dc..c039e1ebac 100644 --- a/src/Java/gtPlusPlus/xmod/bop/blocks/base/SaplingBase.java +++ b/src/Java/gtPlusPlus/xmod/bop/blocks/base/SaplingBase.java @@ -45,7 +45,7 @@ public class SaplingBase extends BlockSapling String blockName = "block"+Utils.sanitizeString(blockNameLocalized); GameRegistry.registerBlock(this, ItemBlock.class, blockName); this.setBlockName(blockName); - ItemUtils.addItemToOreDictionary(ItemUtils.getSimpleStack(this), "treeSapling"); + ItemUtils.addItemToOreDictionary(ItemUtils.getSimpleStack(this), "treeSapling", true); this.setCreativeTab(AddToCreativeTab.tabBOP); LanguageRegistry.addName(this, blockNameLocalized); } diff --git a/src/Java/gtPlusPlus/xmod/gregtech/HANDLER_GT.java b/src/Java/gtPlusPlus/xmod/gregtech/HANDLER_GT.java index 80839f0f64..663804bc81 100644 --- a/src/Java/gtPlusPlus/xmod/gregtech/HANDLER_GT.java +++ b/src/Java/gtPlusPlus/xmod/gregtech/HANDLER_GT.java @@ -50,6 +50,7 @@ import gtPlusPlus.xmod.gregtech.loaders.ProcessingElectricButcherKnife; import gtPlusPlus.xmod.gregtech.loaders.ProcessingElectricLighter; import gtPlusPlus.xmod.gregtech.loaders.ProcessingElectricSnips; import gtPlusPlus.xmod.gregtech.loaders.ProcessingToolHeadChoocher; +import gtPlusPlus.xmod.gregtech.loaders.misc.WoodCentrifuging; import gtPlusPlus.xmod.gregtech.loaders.recipe.RecipeLoader_AlgaeFarm; import gtPlusPlus.xmod.gregtech.recipes.RecipesToRemove; import gtPlusPlus.xmod.gregtech.registration.gregtech.GregtechConduits; @@ -145,6 +146,7 @@ public class HANDLER_GT { convertPyroToCokeOven(); Meta_GT_Proxy.fixIC2FluidNames(); RecipeLoader_AlgaeFarm.generateRecipes(); + WoodCentrifuging.processLogsForMethane(); } private static void convertPyroToCokeOven() { diff --git a/src/Java/gtPlusPlus/xmod/gregtech/api/metatileentity/implementations/base/GregtechMeta_MultiBlockBase.java b/src/Java/gtPlusPlus/xmod/gregtech/api/metatileentity/implementations/base/GregtechMeta_MultiBlockBase.java index f41efe602a..e1849985d0 100644 --- a/src/Java/gtPlusPlus/xmod/gregtech/api/metatileentity/implementations/base/GregtechMeta_MultiBlockBase.java +++ b/src/Java/gtPlusPlus/xmod/gregtech/api/metatileentity/implementations/base/GregtechMeta_MultiBlockBase.java @@ -99,9 +99,8 @@ public abstract class GregtechMeta_MultiBlockBase extends GT_MetaTileEntity_Mult try { calculatePollutionReduction = GT_MetaTileEntity_Hatch_Muffler.class.getDeclaredMethod("calculatePollutionReduction", int.class); - } catch (NoSuchMethodException | SecurityException e) {} - - mCustomBehviours = new HashMap<String, SpecialMultiBehaviour>(); + } + catch (NoSuchMethodException | SecurityException e) {} } @@ -121,7 +120,7 @@ public abstract class GregtechMeta_MultiBlockBase extends GT_MetaTileEntity_Mult public ArrayList<GT_MetaTileEntity_Hatch_OutputBattery> mDischargeHatches = new ArrayList<GT_MetaTileEntity_Hatch_OutputBattery>(); // Custom Behaviour Map - private static final HashMap<String, SpecialMultiBehaviour> mCustomBehviours; + private static final HashMap<String, SpecialMultiBehaviour> mCustomBehviours = new HashMap<String, SpecialMultiBehaviour>();; public GregtechMeta_MultiBlockBase(final int aID, final String aName, @@ -472,11 +471,11 @@ public abstract class GregtechMeta_MultiBlockBase extends GT_MetaTileEntity_Mult public String getSound() { return ""; } - public boolean canBufferOutputs(final GT_Recipe aRecipe, int aParallelRecipes) { + public int canBufferOutputs(final GT_Recipe aRecipe, int aParallelRecipes) { return canBufferOutputs(aRecipe, aParallelRecipes, true); } - public boolean canBufferOutputs(final GT_Recipe aRecipe, int aParallelRecipes, boolean aAllow16SlotWithoutCheck) { + public int canBufferOutputs(final GT_Recipe aRecipe, int aParallelRecipes, boolean aAllow16SlotWithoutCheck) { Logger.INFO("Determining if we have space to buffer outputs. Parallel: "+aParallelRecipes); @@ -485,11 +484,11 @@ public abstract class GregtechMeta_MultiBlockBase extends GT_MetaTileEntity_Mult // Do it anyway, provided the multi allows it. Default behaviour is aAllow16SlotWithoutCheck = true. if (aRecipe == null || aRecipe.mOutputs.length > 16) { if (aRecipe == null) { - return false; + return 0; } else if (aRecipe.mOutputs.length > 16) { if (aAllow16SlotWithoutCheck) { - return true; + return aParallelRecipes; } else { // Do nothing, we want to check this recipe properly. @@ -626,9 +625,14 @@ public abstract class GregtechMeta_MultiBlockBase extends GT_MetaTileEntity_Mult // We have stacks that did not merge, do we have space for them? if (aInputMap.size() > 0) { if (aInputMap.size() > aInputBusSlotsFree) { + aParallelRecipes = (int) Math.floor((double) aInputBusSlotsFree/aInputMap.size() * aParallelRecipes); // We do not have enough free slots in total to accommodate the remaining managed stacks. - Logger.INFO("Failed to find enough space for all item outputs. Free: "+aInputBusSlotsFree+", Required: "+aInputMap.size()); - return false; + Logger.INFO(" Free: "+aInputBusSlotsFree+", Required: "+aInputMap.size()); + if(aParallelRecipes == 0) { + Logger.INFO("Failed to find enough space for all item outputs."); + return 0; + } + } } @@ -656,7 +660,7 @@ public abstract class GregtechMeta_MultiBlockBase extends GT_MetaTileEntity_Mult int aEmptyFluidHatches = 0; int aFullFluidHatches = 0; // Create Map for Fluid Output - ConcurrentHashSet<Triplet<GT_MetaTileEntity_Hatch_Output, FluidStack, Integer>> aOutputHatches = new ConcurrentHashSet<Triplet<GT_MetaTileEntity_Hatch_Output, FluidStack, Integer>>(); + ArrayList<Triplet<GT_MetaTileEntity_Hatch_Output, FluidStack, Integer>> aOutputHatches = new ArrayList<Triplet<GT_MetaTileEntity_Hatch_Output, FluidStack, Integer>>(); for (final GT_MetaTileEntity_Hatch_Output tBus : this.mOutputHatches) { if (!isValidMetaTileEntity(tBus)) { continue; @@ -672,32 +676,36 @@ public abstract class GregtechMeta_MultiBlockBase extends GT_MetaTileEntity_Mult } } // Create a map of all the fluids we would like to output, we can iterate over this and see how many we can merge into existing hatch stacks. - ConcurrentHashSet<FluidStack> aOutputFluids = new ConcurrentHashSet<FluidStack>(); + ArrayList<FluidStack> aOutputFluids = new ArrayList<FluidStack>(); // Ugly ass boxing aOutputFluids.addAll(new AutoMap<FluidStack>(aRecipe.mFluidOutputs)); // Iterate the Hatches, updating their 'stored' data. - aHatchIterator: for (Triplet<GT_MetaTileEntity_Hatch_Output, FluidStack, Integer> aHatchData : aOutputHatches) { + //for (Triplet<GT_MetaTileEntity_Hatch_Output, FluidStack, Integer> aHatchData : aOutputHatches) { + for (int i = 0;i<aOutputHatches.size();i++) { // The Hatch Itself - GT_MetaTileEntity_Hatch_Output aHatch = aHatchData.getValue_1(); + GT_MetaTileEntity_Hatch_Output aHatch = aOutputHatches.get(i).getValue_1(); // Fluid in the Hatch - FluidStack aHatchStack = aHatchData.getValue_2(); + FluidStack aHatchStack = aOutputHatches.get(i).getValue_2(); // Space left in Hatch - int aSpaceLeftInHatch = aHatch.getCapacity() - aHatch.getFluidAmount(); + int aSpaceLeftInHatch = aHatch.getCapacity() - aHatch.getFluidAmount(); // Hatch is full, if (aSpaceLeftInHatch <= 0) { aFullFluidHatches++; - aOutputHatches.remove(aHatchData); - continue aHatchIterator; - } + aOutputHatches.remove(aOutputHatches.get(i)); + i--; + continue; + } // Hatch has space - else { + else { // Check if any fluids match - aFluidMatch: for (FluidStack aOutputStack : aOutputFluids) { - if (GT_Utility.areFluidsEqual(aHatchStack, aOutputStack)) { - int aFluidToPutIntoHatch = aOutputStack.amount; + //aFluidMatch: for (FluidStack aOutputStack : aOutputFluids) { + for(int j = 0;j<aOutputFluids.size();j++) { + //log(" aHatchStack "+aHatchStack.getLocalizedName()+" aOutput stack "+aOutputStack.getLocalizedName()); + if (GT_Utility.areFluidsEqual(aHatchStack, aOutputFluids.get(j))) { + int aFluidToPutIntoHatch = aOutputFluids.get(j).amount * aParallelRecipes; // Not Enough space to insert all of the fluid. // We fill this hatch and add a smaller Fluidstack back to the iterator. - if (aSpaceLeftInHatch < aFluidToPutIntoHatch) { + if (aSpaceLeftInHatch < aFluidToPutIntoHatch) { // Copy existing Hatch Stack FluidStack aNewHatchStack = aHatchStack.copy(); aNewHatchStack.amount = 0; @@ -710,51 +718,57 @@ public abstract class GregtechMeta_MultiBlockBase extends GT_MetaTileEntity_Mult aNewHatchStack.amount = aHatch.getCapacity(); aNewOutputStack.amount = aFluidLeftAfterInsert; // Remove fluid from output list, merge success - aOutputFluids.remove(aOutputStack); + aOutputFluids.remove(aOutputFluids.get(j)); + j--; // Remove hatch from hatch list, data is now invalid. - aOutputHatches.remove(aHatchData); + aOutputHatches.remove(aOutputHatches.get(i)); + i--; // Add remaining Fluid to Output list aOutputFluids.add(aNewOutputStack); // Re-add hatch to hatch list, with new data. - Triplet<GT_MetaTileEntity_Hatch_Output, FluidStack, Integer> aNewHatchData = new Triplet<GT_MetaTileEntity_Hatch_Output, FluidStack, Integer>(aHatch, aNewHatchStack, aNewHatchStack.amount); - aOutputHatches.add(aNewHatchData); - continue aHatchIterator; + //Triplet<GT_MetaTileEntity_Hatch_Output, FluidStack, Integer> aNewHatchData = new Triplet<GT_MetaTileEntity_Hatch_Output, FluidStack, Integer>(aHatch, aNewHatchStack, aNewHatchStack.amount); + //aOutputHatches.add(aNewHatchData); + break; } // We can fill this hatch perfectly (rare case), may as well add it directly to the full list. else if (aSpaceLeftInHatch == aFluidToPutIntoHatch) { // Copy Old Stack FluidStack aNewHatchStack = aHatchStack.copy(); // Add in amount from output stack - aNewHatchStack.amount += aOutputStack.amount; + aNewHatchStack.amount += aFluidToPutIntoHatch; // Remove fluid from output list, merge success - aOutputFluids.remove(aOutputStack); + aOutputFluids.remove(aOutputFluids.get(j)); + j--; // Remove hatch from hatch list, data is now invalid. - aOutputHatches.remove(aHatchData); + aOutputHatches.remove(aOutputHatches.get(i)); + i--; // Re-add hatch to hatch list, with new data. Triplet<GT_MetaTileEntity_Hatch_Output, FluidStack, Integer> aNewHatchData = new Triplet<GT_MetaTileEntity_Hatch_Output, FluidStack, Integer>(aHatch, aNewHatchStack, aNewHatchStack.amount); aOutputHatches.add(aNewHatchData); - continue aHatchIterator; + break; } // We have more space than we need to merge, so we remove the stack from the output list and update the hatch list. - else { + else { // Copy Old Stack FluidStack aNewHatchStack = aHatchStack.copy(); // Add in amount from output stack - aNewHatchStack.amount += aOutputStack.amount; + aNewHatchStack.amount += aFluidToPutIntoHatch; // Remove fluid from output list, merge success - aOutputFluids.remove(aOutputStack); + aOutputFluids.remove(aOutputFluids.get(j)); + j--; // Remove hatch from hatch list, data is now invalid. - aOutputHatches.remove(aHatchData); + aOutputHatches.remove(aOutputHatches.get(i)); + i--; // Re-add hatch to hatch list, with new data. Triplet<GT_MetaTileEntity_Hatch_Output, FluidStack, Integer> aNewHatchData = new Triplet<GT_MetaTileEntity_Hatch_Output, FluidStack, Integer>(aHatch, aNewHatchStack, aNewHatchStack.amount); aOutputHatches.add(aNewHatchData); // Check next fluid - continue aFluidMatch; + continue; } } else { - continue aFluidMatch; + continue; } } } @@ -768,11 +782,14 @@ public abstract class GregtechMeta_MultiBlockBase extends GT_MetaTileEntity_Mult } // We have Fluid Stacks we did not merge. Do we have space? + Logger.INFO("fluids to output "+aOutputFluids.size()+" empty hatches "+aEmptyFluidHatches); if (aOutputFluids.size() > 0) { // Not enough space to add fluids. if (aOutputFluids.size() > aEmptyFluidHatches) { - Logger.INFO("Failed to find enough space for all fluid outputs."); - return false; + aParallelRecipes = (int) Math.floor((double) aEmptyFluidHatches/aOutputFluids.size() * aParallelRecipes); + Logger.INFO("Failed to find enough space for all fluid outputs. Free: "+aEmptyFluidHatches+", Required: "+aOutputFluids.size()); + return 0; + } } @@ -781,7 +798,7 @@ public abstract class GregtechMeta_MultiBlockBase extends GT_MetaTileEntity_Mult */ } - return true; + return aParallelRecipes; } /** @@ -1034,7 +1051,7 @@ public abstract class GregtechMeta_MultiBlockBase extends GT_MetaTileEntity_Mult */ // First populate the map if we need to. - if (mCustomBehviours == null || mCustomBehviours.isEmpty()) { + if (mCustomBehviours.isEmpty()) { mCustomBehviours.putAll(Multiblock_API.getSpecialBehaviourItemMap()); } @@ -1071,8 +1088,9 @@ public abstract class GregtechMeta_MultiBlockBase extends GT_MetaTileEntity_Mult } } } - - if (!this.canBufferOutputs(tRecipe, aMaxParallelRecipes)) { + + aMaxParallelRecipes = this.canBufferOutputs(tRecipe, aMaxParallelRecipes); + if (aMaxParallelRecipes == 0) { log("BAD RETURN - 2"); return false; } @@ -1379,7 +1397,8 @@ public abstract class GregtechMeta_MultiBlockBase extends GT_MetaTileEntity_Mult return false; } - if (!this.canBufferOutputs(tRecipe, aMaxParallelRecipes)) { + aMaxParallelRecipes = this.canBufferOutputs(tRecipe, aMaxParallelRecipes); + if (aMaxParallelRecipes == 0) { log("BAD RETURN - 2"); return false; } @@ -1553,7 +1572,8 @@ public abstract class GregtechMeta_MultiBlockBase extends GT_MetaTileEntity_Mult this.mDischargeHatches.clear(); this.mControlCoreBus.clear(); this.mAirIntakes.clear(); - this.mMultiDynamoHatches.clear(); + this.mTecTechEnergyHatches.clear(); + this.mTecTechDynamoHatches.clear(); } } @@ -1578,7 +1598,14 @@ public abstract class GregtechMeta_MultiBlockBase extends GT_MetaTileEntity_Mult tTileEntity = localIterator.next(); } tTileEntity = null; - for (final Iterator<GT_MetaTileEntity_Hatch> localIterator = this.mMultiDynamoHatches + for (final Iterator<GT_MetaTileEntity_Hatch> localIterator = this.mTecTechDynamoHatches + .iterator(); localIterator.hasNext(); tTileEntity + .getBaseMetaTileEntity() + .doExplosion(gregtech.api.enums.GT_Values.V[8])) { + tTileEntity = localIterator.next(); + } + tTileEntity = null; + for (final Iterator<GT_MetaTileEntity_Hatch> localIterator = this.mTecTechEnergyHatches .iterator(); localIterator.hasNext(); tTileEntity .getBaseMetaTileEntity() .doExplosion(gregtech.api.enums.GT_Values.V[8])) { @@ -1870,10 +1897,16 @@ public abstract class GregtechMeta_MultiBlockBase extends GT_MetaTileEntity_Mult aDidAdd = addToMachineListInternal(mDischargeHatches, aMetaTileEntity, aBaseCasingIndex); } + //Handle TT Multi-A Energy Hatches + else if (LoadedMods.TecTech && isThisHatchMultiEnergy(aMetaTileEntity)) { + log("Found isThisHatchMultiEnergy"); + aDidAdd = addToMachineListInternal(mTecTechEnergyHatches, aMetaTileEntity, aBaseCasingIndex); + } + //Handle TT Multi-A Dynamos else if (LoadedMods.TecTech && isThisHatchMultiDynamo(aMetaTileEntity)) { log("Found isThisHatchMultiDynamo"); - aDidAdd = addToMachineListInternal(mMultiDynamoHatches, aMetaTileEntity, aBaseCasingIndex); + aDidAdd = addToMachineListInternal(mTecTechDynamoHatches, aMetaTileEntity, aBaseCasingIndex); } //Handle Fluid Hatches using seperate logic @@ -2126,10 +2159,16 @@ public abstract class GregtechMeta_MultiBlockBase extends GT_MetaTileEntity_Mult /** - * This is the array Used to Store the Tectech Multi-Amp hatches. + * This is the array Used to Store the Tectech Multi-Amp Dynamo hatches. + */ + + public ArrayList<GT_MetaTileEntity_Hatch> mTecTechDynamoHatches = new ArrayList<GT_MetaTileEntity_Hatch>(); + + /** + * This is the array Used to Store the Tectech Multi-Amp Energy hatches. */ - public ArrayList<GT_MetaTileEntity_Hatch> mMultiDynamoHatches = new ArrayList<GT_MetaTileEntity_Hatch>(); + public ArrayList<GT_MetaTileEntity_Hatch> mTecTechEnergyHatches = new ArrayList<GT_MetaTileEntity_Hatch>(); /** * TecTech Multi-Amp Dynamo Support @@ -2149,12 +2188,11 @@ public abstract class GregtechMeta_MultiBlockBase extends GT_MetaTileEntity_Mult } if (isThisHatchMultiDynamo(aTileEntity)) { updateTexture(aTileEntity, aBaseCasingIndex); - return this.mMultiDynamoHatches.add((GT_MetaTileEntity_Hatch) aMetaTileEntity); + return this.mTecTechDynamoHatches.add((GT_MetaTileEntity_Hatch) aMetaTileEntity); } return false; } - @SuppressWarnings("rawtypes") public boolean isThisHatchMultiDynamo(Object aMetaTileEntity){ Class<?> mDynamoClass; mDynamoClass = ReflectionUtils.getClass("com.github.technus.tectech.thing.metaTileEntity.hatch.GT_MetaTileEntity_Hatch_DynamoMulti"); @@ -2170,12 +2208,58 @@ public abstract class GregtechMeta_MultiBlockBase extends GT_MetaTileEntity_Mult public boolean addDynamoToMachineList(IGregTechTileEntity aTileEntity, int aBaseCasingIndex) { if (LoadedMods.TecTech){ if (isThisHatchMultiDynamo(aTileEntity)) { - addMultiAmpDynamoToMachineList(aTileEntity, aBaseCasingIndex); + return addMultiAmpDynamoToMachineList(aTileEntity, aBaseCasingIndex); } } return super.addDynamoToMachineList(aTileEntity, aBaseCasingIndex); } + + + /** + * TecTech Multi-Amp Energy Hatch Support + * @param aTileEntity - The Energy Hatch + * @param aBaseCasingIndex - Casing Texture + * @return + */ + + public boolean addMultiAmpEnergyToMachineList(final IGregTechTileEntity aTileEntity, final int aBaseCasingIndex){ + //GT_MetaTileEntity_Hatch_DynamoMulti + if (aTileEntity == null) { + return false; + } + final IMetaTileEntity aMetaTileEntity = aTileEntity.getMetaTileEntity(); + if (aMetaTileEntity == null) { + return false; + } + if (isThisHatchMultiEnergy(aTileEntity)) { + updateTexture(aTileEntity, aBaseCasingIndex); + return this.mTecTechEnergyHatches.add((GT_MetaTileEntity_Hatch) aMetaTileEntity); + } + return false; + } + + public boolean isThisHatchMultiEnergy(Object aMetaTileEntity){ + Class<?> mDynamoClass; + mDynamoClass = ReflectionUtils.getClass("com.github.technus.tectech.thing.metaTileEntity.hatch.GT_MetaTileEntity_Hatch_EnergyMulti"); + if (mDynamoClass != null){ + if (mDynamoClass.isInstance(aMetaTileEntity)){ + return true; + } + } + return false; + } + + @Override + public boolean addEnergyInputToMachineList(IGregTechTileEntity aTileEntity, int aBaseCasingIndex) { + if (LoadedMods.TecTech){ + if (isThisHatchMultiEnergy(aTileEntity)) { + return addMultiAmpEnergyToMachineList(aTileEntity, aBaseCasingIndex); + } + + } + return super.addEnergyInputToMachineList(aTileEntity, aBaseCasingIndex); + } /** 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 e72838fcad..6e33529b66 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 @@ -63,12 +63,12 @@ public abstract class GregtechRocketFuelGeneratorBase extends GT_MetaTileEntity_ String aPollution = "Causes between "+pollMin+" and "+pollMax+ " Pollution per second"; return new String[]{ this.mDescription, - "Fuel Efficiency: " + this.getEfficiency()*2 + "%", + "Fuel Efficiency: " + this.getEfficiency() + "%", aPollution}; } return new String[]{ this.mDescription, - "Fuel Efficiency: " + this.getEfficiency()*2 + "%"}; + "Fuel Efficiency: " + this.getEfficiency() + "%"}; } @@ -267,9 +267,8 @@ public abstract class GregtechRocketFuelGeneratorBase extends GT_MetaTileEntity_ final int tFuelValue = this.getFuelValue(this.mFluid), tConsumed = this.consumedFluidPerOperation(this.mFluid); if ((tFuelValue > 0) && (tConsumed > 0) && (this.mFluid.amount >= tConsumed)) { final long tFluidAmountToUse = Math.min(this.mFluid.amount / tConsumed, (((this.maxEUOutput() * 20) + this.getMinimumStoredEU()) - aBaseMetaTileEntity.getUniversalEnergyStored()) / tFuelValue); - if ((tFluidAmountToUse > 0) && aBaseMetaTileEntity.increaseStoredEnergyUnits(tFluidAmountToUse * tFuelValue, true)){ + if ((tFluidAmountToUse > 0) && aBaseMetaTileEntity.increaseStoredEnergyUnits(tFluidAmountToUse * tFuelValue, true)){ int aSafeFloor = (int) Math.max(((tFluidAmountToUse * tConsumed)/3), 1); - //Logger.INFO("True consumption: "+toConsumeTrue+" | Consuming this tick? "+useFuel); this.mFluid.amount -= (int) aSafeFloor; PollutionUtils.addPollution(getBaseMetaTileEntity(), 10 * getPollution()); } diff --git a/src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/generators/GregtechMetaTileEntityGeothermalGenerator.java b/src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/generators/GregtechMetaTileEntityGeothermalGenerator.java index 5ebdbf0ef8..cfbf7bd487 100644 --- a/src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/generators/GregtechMetaTileEntityGeothermalGenerator.java +++ b/src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/generators/GregtechMetaTileEntityGeothermalGenerator.java @@ -38,7 +38,8 @@ extends GT_MetaTileEntity_BasicGenerator @Override public String[] getDescription() { - return new String[]{this.mDescription, "Generates power at " + this.getEfficiency() + "% Efficiency per tick"}; + String aPollution = "Causes between "+this.getPollution()+ " Pollution per second"; + return new String[]{this.mDescription, "Generates power at " + this.getEfficiency() + "% Efficiency per tick", aPollution}; } @Override 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 6a42232e40..7d20f1eb59 100644 --- a/src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/generators/GregtechMetaTileEntityRocketFuelGenerator.java +++ b/src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/generators/GregtechMetaTileEntityRocketFuelGenerator.java @@ -54,12 +54,12 @@ extends GregtechRocketFuelGeneratorBase { } public void onConfigLoad() { - this.mEfficiency = GregTech_API.sMachineFile.get(ConfigCategories.machineconfig, "RocketEngine.efficiency.tier." + this.mTier, ((40+((this.mTier) * 16))/4)+(this.mTier)); + this.mEfficiency = GregTech_API.sMachineFile.get(ConfigCategories.machineconfig, "RocketEngine.efficiency.tier." + this.mTier, 80 - (10 * (this.mTier - 4))); } @Override public int getEfficiency() { - int eff = ((40+((this.mTier) * 16))/4)+(this.mTier); + int eff = 80 - (10 * (this.mTier - 4)); return eff; } diff --git a/src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/processing/GregtechMetaTileEntity_IndustrialDehydrator.java b/src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/processing/GregtechMetaTileEntity_IndustrialDehydrator.java index 78896dd650..b5cfff10e4 100644 --- a/src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/processing/GregtechMetaTileEntity_IndustrialDehydrator.java +++ b/src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/processing/GregtechMetaTileEntity_IndustrialDehydrator.java @@ -227,7 +227,8 @@ public class GregtechMetaTileEntity_IndustrialDehydrator extends GregtechMeta_Mu return false; } - if (!this.canBufferOutputs(tRecipe, aMaxParallelRecipes)) { + aMaxParallelRecipes = this.canBufferOutputs(tRecipe, aMaxParallelRecipes); + if (aMaxParallelRecipes == 0) { Logger.WARNING("BAD RETURN - 2"); return false; } diff --git a/src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/processing/GregtechMetaTileEntity_IndustrialMixer.java b/src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/processing/GregtechMetaTileEntity_IndustrialMixer.java index e721761d82..6e4c071ecb 100644 --- a/src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/processing/GregtechMetaTileEntity_IndustrialMixer.java +++ b/src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/processing/GregtechMetaTileEntity_IndustrialMixer.java @@ -112,7 +112,30 @@ extends GregtechMeta_MultiBlockBase { @Override public boolean checkRecipe(final ItemStack aStack) { - return checkRecipeGeneric(getMaxParallelRecipes(), getEuDiscountForParallelism(), 250); + for (GT_MetaTileEntity_Hatch_InputBus tBus : mInputBusses) { + ArrayList<ItemStack> tBusItems = new ArrayList<ItemStack>(); + tBus.mRecipeMap = getRecipeMap(); + if (isValidMetaTileEntity(tBus)) { + for (int i = tBus.getBaseMetaTileEntity().getSizeInventory() - 1; i >= 0; i--) { + if (tBus.getBaseMetaTileEntity().getStackInSlot(i) != null) + tBusItems.add(tBus.getBaseMetaTileEntity().getStackInSlot(i)); + } + } + ItemStack[] inputs = new ItemStack[tBusItems.size()]; + int slot = 0; + for (ItemStack g : tBusItems) { + inputs[slot++] = g; + } + if (inputs.length > 0) { + log("Recipe. ["+inputs.length+"]["+getMaxParallelRecipes()+"]"); + if (checkRecipeGeneric(inputs, new FluidStack[]{}, getMaxParallelRecipes(), getEuDiscountForParallelism(), 250, 10000)) { + log("Recipe 2."); + return true; + } + } + + } + return false; } @Override diff --git a/src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/processing/GregtechMetaTileEntity_IndustrialMultiMachine.java b/src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/processing/GregtechMetaTileEntity_IndustrialMultiMachine.java index 8b07117596..b071c77d15 100644 --- a/src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/processing/GregtechMetaTileEntity_IndustrialMultiMachine.java +++ b/src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/processing/GregtechMetaTileEntity_IndustrialMultiMachine.java @@ -351,7 +351,8 @@ extends GregtechMeta_MultiBlockBase { return false; } - if (!this.canBufferOutputs(tRecipe, aMaxParallelRecipes)) { + aMaxParallelRecipes = this.canBufferOutputs(tRecipe, aMaxParallelRecipes); + if (aMaxParallelRecipes == 0) { Logger.MACHINE_INFO("BAD RETURN - 2|"+tCircuitID); return false; } diff --git a/src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/processing/GregtechMetaTileEntity_IndustrialSifter.java b/src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/processing/GregtechMetaTileEntity_IndustrialSifter.java index 8c62937bae..c99a6e286b 100644 --- a/src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/processing/GregtechMetaTileEntity_IndustrialSifter.java +++ b/src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/processing/GregtechMetaTileEntity_IndustrialSifter.java @@ -53,8 +53,6 @@ extends GregtechMeta_MultiBlockBase { "Controller (Center Bottom)", "1x Input Bus (Any top or bottom edge casing)", "4x Output Bus (Any top or bottom edge casing)", - "1x Maintenance Hatch (Any top or bottom edge casing)", - "1x Muffler Hatch (Any top or bottom edge casing)", "1x Energy Hatch (Any top or bottom edge casing)", "18x Sieve Grate (Top and Middle 3x3)", "Sieve Casings for the rest (35 min)" diff --git a/src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/processing/advanced/GregtechMetaTileEntity_Adv_EBF.java b/src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/processing/advanced/GregtechMetaTileEntity_Adv_EBF.java index ab7fb79c4b..133e10d6f6 100644 --- a/src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/processing/advanced/GregtechMetaTileEntity_Adv_EBF.java +++ b/src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/processing/advanced/GregtechMetaTileEntity_Adv_EBF.java @@ -152,9 +152,14 @@ public class GregtechMetaTileEntity_Adv_EBF extends GregtechMeta_MultiBlockBase Block tUsedBlock = aBaseMetaTileEntity.getBlockOffset(xDir + 1, 2, zDir); byte tUsedMeta = aBaseMetaTileEntity.getMetaIDOffset(xDir + 1, 2, zDir); this.mHeatingCapacity = StaticFields59.getHeatingCapacityForCoil(tUsedBlock, tUsedMeta); + + int aCasingCount = 0; for (int i = -1; i < 2; i++) { for (int j = -1; j < 2; j++) { + + + if ((i != 0) || (j != 0)) { //Coils 1 if (!isValidBlockForStructure(null, CASING_TEXTURE_ID, false, aBaseMetaTileEntity.getBlockOffset(xDir + i, 1, zDir + j), (int) aBaseMetaTileEntity.getMetaIDOffset(xDir + i, 1, zDir + j), StaticFields59.getBlockCasings5(), tUsedMeta)) { @@ -170,8 +175,15 @@ public class GregtechMetaTileEntity_Adv_EBF extends GregtechMeta_MultiBlockBase } //Top Layer + + Block aCurrentBlock = aBaseMetaTileEntity.getBlockOffset(xDir + i, 3, zDir + j); + int aCurrentMeta = (int) aBaseMetaTileEntity.getMetaIDOffset(xDir + i, 3, zDir + j); + if (aCurrentBlock == ModBlocks.blockCasings3Misc && aCurrentMeta == 11) { + aCasingCount++; + } + final IGregTechTileEntity tTileEntity2 = aBaseMetaTileEntity.getIGregTechTileEntityOffset(xDir + i, 3, zDir + j); - if (!isValidBlockForStructure(tTileEntity2, CASING_TEXTURE_ID, true, aBaseMetaTileEntity.getBlockOffset(xDir + i, 3, zDir + j), (int) aBaseMetaTileEntity.getMetaIDOffset(xDir + i, 3, zDir + j), ModBlocks.blockCasings3Misc, 11)) { + if (!isValidBlockForStructure(tTileEntity2, CASING_TEXTURE_ID, true, aCurrentBlock, aCurrentMeta, ModBlocks.blockCasings3Misc, 11)) { Logger.INFO("Top Layer missing."); return false; } @@ -179,9 +191,16 @@ public class GregtechMetaTileEntity_Adv_EBF extends GregtechMeta_MultiBlockBase } for (int i = -1; i < 2; i++) { for (int j = -1; j < 2; j++) { + + + Block aCurrentBlock = aBaseMetaTileEntity.getBlockOffset(xDir + i, 0, zDir + j); + int aCurrentMeta = (int) aBaseMetaTileEntity.getMetaIDOffset(xDir + i, 0, zDir + j); + if (aCurrentBlock == ModBlocks.blockCasings3Misc && aCurrentMeta == 11) { + aCasingCount++; + } if ((xDir + i != 0) || (zDir + j != 0)) { IGregTechTileEntity tTileEntity = aBaseMetaTileEntity.getIGregTechTileEntityOffset(xDir + i, 0,zDir + j); - if (!isValidBlockForStructure(tTileEntity, CASING_TEXTURE_ID, true, aBaseMetaTileEntity.getBlockOffset(xDir + i, 0, zDir + j), (int) aBaseMetaTileEntity.getMetaIDOffset(xDir + i, 0, zDir + j), ModBlocks.blockCasings3Misc, 11)) { + if (!isValidBlockForStructure(tTileEntity, CASING_TEXTURE_ID, true, aCurrentBlock, aCurrentMeta, ModBlocks.blockCasings3Misc, 11)) { Logger.INFO("Bottom Layer missing."); return false; } @@ -189,8 +208,7 @@ public class GregtechMetaTileEntity_Adv_EBF extends GregtechMeta_MultiBlockBase } } - // TODO - Fix Casing Count - return true; + return aCasingCount >= 10; } public int getMaxEfficiency(ItemStack aStack) { @@ -282,7 +300,8 @@ public class GregtechMetaTileEntity_Adv_EBF extends GregtechMeta_MultiBlockBase return false; } - if (!this.canBufferOutputs(tRecipe, aMaxParallelRecipes)) { + aMaxParallelRecipes = this.canBufferOutputs(tRecipe, aMaxParallelRecipes); + if (aMaxParallelRecipes == 0) { Logger.WARNING("BAD RETURN - 2"); return false; } diff --git a/src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/production/GT4Entity_AutoCrafter.java b/src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/production/GT4Entity_AutoCrafter.java index c31a7c0758..f24825ba8a 100644 --- a/src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/production/GT4Entity_AutoCrafter.java +++ b/src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/production/GT4Entity_AutoCrafter.java @@ -223,7 +223,10 @@ public class GT4Entity_AutoCrafter extends GregtechMeta_MultiBlockBase { } } catch (IllegalArgumentException | IllegalAccessException e) { } - } + } + else if (this.mMachineMode == MODE.DISASSEMBLY) { + return null; + } return GT_Recipe.GT_Recipe_Map.sAssemblerRecipes; } diff --git a/src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/production/GregtechMetaTileEntity_AlloyBlastSmelter.java b/src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/production/GregtechMetaTileEntity_AlloyBlastSmelter.java index 4e5c95ad73..3592475a5c 100644 --- a/src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/production/GregtechMetaTileEntity_AlloyBlastSmelter.java +++ b/src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/production/GregtechMetaTileEntity_AlloyBlastSmelter.java @@ -2,6 +2,7 @@ package gtPlusPlus.xmod.gregtech.common.tileentities.machines.multi.production; import java.util.ArrayList; import java.util.Arrays; +import java.util.List; import gregtech.api.GregTech_API; import gregtech.api.enums.TAE; @@ -16,6 +17,7 @@ import gregtech.api.util.Recipe_GT; import gtPlusPlus.api.objects.Logger; import gtPlusPlus.core.block.ModBlocks; import gtPlusPlus.core.recipe.common.CI; +import gtPlusPlus.core.util.minecraft.ItemUtils; import gtPlusPlus.xmod.gregtech.api.metatileentity.implementations.base.GregtechMeta_MultiBlockBase; import gtPlusPlus.xmod.gregtech.common.blocks.textures.TexturesGtBlock; import net.minecraft.item.Item; @@ -29,7 +31,7 @@ extends GregtechMeta_MultiBlockBase { private int mHeatingCapacity = 0; private int mMode = 0; private boolean isUsingControllerCircuit = false; - private static final Item circuit = CI.getNumberedCircuit(0).getItem(); + private static Item circuit; public GregtechMetaTileEntity_AlloyBlastSmelter(final int aID, final String aName, final String aNameRegional) { super(aID, aName, aNameRegional); @@ -46,7 +48,7 @@ extends GregtechMeta_MultiBlockBase { @Override public String getMachineType() { - return "Alloy Smelter"; + return "Fluid Alloy Cooker"; } @Override @@ -104,6 +106,9 @@ extends GregtechMeta_MultiBlockBase { public boolean isCorrectMachinePart(final ItemStack aStack) { if (this.getBaseMetaTileEntity().isServerSide()) { //Get Controller Circuit + if (circuit == null) { + circuit = CI.getNumberedCircuit(0).getItem(); + } if (aStack != null && aStack.getItem() == circuit) { this.mMode = aStack.getItemDamage(); return this.isUsingControllerCircuit = true; @@ -197,6 +202,14 @@ extends GregtechMeta_MultiBlockBase { } this.mMaxProgresstime = Math.max(1, this.mMaxProgresstime); this.mOutputFluids = new FluidStack[]{tRecipe.getFluidOutput(0)}; + List<ItemStack> tOutPutItems = new ArrayList<ItemStack>(); + for (ItemStack tOut : tRecipe.mOutputs) { + if (ItemUtils.checkForInvalidItems(tOut)) { + tOutPutItems.add(tOut); + } + } + if (tOutPutItems.size() > 0) + this.mOutputItems = tOutPutItems.toArray(new ItemStack[tOutPutItems.size()]); this.updateSlots(); return true; } diff --git a/src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/production/GregtechMetaTileEntity_Cyclotron.java b/src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/production/GregtechMetaTileEntity_Cyclotron.java index ed6c913e6b..6070e3604a 100644 --- a/src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/production/GregtechMetaTileEntity_Cyclotron.java +++ b/src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/production/GregtechMetaTileEntity_Cyclotron.java @@ -2,7 +2,6 @@ package gtPlusPlus.xmod.gregtech.common.tileentities.machines.multi.production; import java.util.ArrayList; -import gregtech.GT_Mod; import gregtech.api.enums.Dyes; import gregtech.api.enums.TAE; import gregtech.api.enums.Textures; @@ -10,7 +9,6 @@ import gregtech.api.interfaces.IIconContainer; import gregtech.api.interfaces.ITexture; import gregtech.api.interfaces.tileentity.IGregTechTileEntity; import gregtech.api.metatileentity.MetaTileEntity; -import gregtech.api.metatileentity.implementations.GT_MetaTileEntity_Hatch_Energy; import gregtech.api.metatileentity.implementations.GT_MetaTileEntity_Hatch_Input; import gregtech.api.metatileentity.implementations.GT_MetaTileEntity_Hatch_Maintenance; import gregtech.api.metatileentity.implementations.GT_MetaTileEntity_Hatch_Muffler; @@ -25,7 +23,6 @@ import gtPlusPlus.api.objects.Logger; import gtPlusPlus.core.block.ModBlocks; import gtPlusPlus.core.item.chemistry.IonParticles; import gtPlusPlus.core.util.math.MathUtils; -import gtPlusPlus.core.util.minecraft.gregtech.PollutionUtils; import gtPlusPlus.xmod.gregtech.api.metatileentity.implementations.base.GregtechMeta_MultiBlockBase; import gtPlusPlus.xmod.gregtech.common.blocks.textures.TexturesGtBlock; import net.minecraft.block.Block; @@ -37,8 +34,6 @@ import net.minecraftforge.fluids.FluidStack; public class GregtechMetaTileEntity_Cyclotron extends GregtechMeta_MultiBlockBase { - public long mEUStore; - public GregtechMetaTileEntity_Cyclotron(int aID, String aName, String aNameRegional, int tier) { super(aID, aName, aNameRegional); } @@ -95,13 +90,11 @@ public class GregtechMetaTileEntity_Cyclotron extends GregtechMeta_MultiBlockBas @Override public void saveNBTData(NBTTagCompound aNBT) { - aNBT.setLong("mEUStore", mEUStore); super.saveNBTData(aNBT); } @Override public void loadNBTData(NBTTagCompound aNBT) { - mEUStore = aNBT.getLong("mEUStore"); super.loadNBTData(aNBT); } @@ -395,113 +388,6 @@ public class GregtechMetaTileEntity_Cyclotron extends GregtechMeta_MultiBlockBas } @Override - public void onPostTick(IGregTechTileEntity aBaseMetaTileEntity, long aTick) { - if (aBaseMetaTileEntity.isServerSide()) { - if (mEfficiency < 0) - mEfficiency = 0; - - //Time Counter - this.mTotalRunTime++; - this.fixAllMaintenanceIssue(); - - onRunningTick(null); - - boolean aFormCheck = (aTick % 100 == 0 ? checkMultiblock(aBaseMetaTileEntity, mInventory[1]) : true); - - - - if (mRunningOnLoad && aFormCheck) { - this.mEUStore = (int) aBaseMetaTileEntity.getStoredEU(); - checkRecipe(mInventory[1]); - } - if (--mUpdate == 0 || --mStartUpCheck == 0) { - mInputHatches.clear(); - mInputBusses.clear(); - mOutputHatches.clear(); - mOutputBusses.clear(); - mDynamoHatches.clear(); - mEnergyHatches.clear(); - mMufflerHatches.clear(); - mMaintenanceHatches.clear(); - mChargeHatches.clear(); - mDischargeHatches.clear(); - mControlCoreBus.clear(); - mAirIntakes.clear(); - mMultiDynamoHatches.clear(); - mMachine = aFormCheck; - } - if (mStartUpCheck < 0) { - if (mMachine) { - if (this.mEnergyHatches != null) { - for (GT_MetaTileEntity_Hatch_Energy tHatch : mEnergyHatches) - if (isValidMetaTileEntity(tHatch)) { - if (aBaseMetaTileEntity.getStoredEU() + (2048*4) < maxEUStore() - && tHatch.getBaseMetaTileEntity().decreaseStoredEnergyUnits((2048*4), false)) { - aBaseMetaTileEntity.increaseStoredEnergyUnits((2048*4), true); - } - } - } - if (this.mEUStore <= 0 && mMaxProgresstime > 0) { - stopMachine(); - } - if (getRepairStatus() > 0) { - if (mMaxProgresstime > 0) { - this.getBaseMetaTileEntity().decreaseStoredEnergyUnits(mEUt, true); - if (mMaxProgresstime > 0 && ++mProgresstime >= mMaxProgresstime) { - if (mOutputItems != null) - for (ItemStack tStack : mOutputItems) if (tStack != null) addOutput(tStack); - if (mOutputFluids != null) - for (FluidStack tStack : mOutputFluids) if (tStack != null) addOutput(tStack); - mEfficiency = Math.max(0, Math.min(mEfficiency + mEfficiencyIncrease, getMaxEfficiency(mInventory[1]) - ((getIdealStatus() - getRepairStatus()) * 1000))); - mOutputItems = null; - mProgresstime = 0; - mMaxProgresstime = 0; - mEfficiencyIncrease = 0; - if (mOutputFluids != null && mOutputFluids.length > 0) { - try { - GT_Mod.instance.achievements.issueAchivementHatchFluid(aBaseMetaTileEntity.getWorld().getPlayerEntityByName(aBaseMetaTileEntity.getOwnerName()), mOutputFluids[0]); - } catch (Exception e) { - } - } - this.mEUStore = (int) aBaseMetaTileEntity.getStoredEU(); - if (aBaseMetaTileEntity.isAllowedToWork()) - checkRecipe(mInventory[1]); - } - } else { - if (aTick % 100 == 0 || aBaseMetaTileEntity.hasWorkJustBeenEnabled() || aBaseMetaTileEntity.hasInventoryBeenModified()) { - turnCasingActive(mMaxProgresstime > 0); - if (aBaseMetaTileEntity.isAllowedToWork()) { - this.mEUStore = (int) aBaseMetaTileEntity.getStoredEU(); - if (checkRecipe(mInventory[1])) { - if (this.mEUStore < this.mLastRecipe.mSpecialValue) { - mMaxProgresstime = 0; - turnCasingActive(false); - } - aBaseMetaTileEntity.decreaseStoredEnergyUnits(this.mLastRecipe.mSpecialValue, true); - } - } - if (mMaxProgresstime <= 0) - mEfficiency = Math.max(0, mEfficiency - 1000); - } - } - } else { - this.mLastRecipe = null; - stopMachine(); - } - } else { - turnCasingActive(false); - this.mLastRecipe = null; - stopMachine(); - } - } - //doRandomMaintenanceDamage(); - aBaseMetaTileEntity.setErrorDisplayID((aBaseMetaTileEntity.getErrorDisplayID() & ~127) | (mWrench ? 0 : 1) | (mScrewdriver ? 0 : 2) | (mSoftHammer ? 0 : 4) | (mHardHammer ? 0 : 8) - | (mSolderingTool ? 0 : 16) | (mCrowbar ? 0 : 32) | (mMachine ? 0 : 64)); - aBaseMetaTileEntity.setActive(mMaxProgresstime > 0); - } - } - - @Override public boolean onRunningTick(ItemStack aStack) { if (this.mOutputBusses.size() > 0) { for (GT_MetaTileEntity_Hatch_OutputBus g : this.mOutputBusses) { @@ -529,10 +415,9 @@ public class GregtechMetaTileEntity_Cyclotron extends GregtechMeta_MultiBlockBas } } } - } - PollutionUtils.addPollution(getBaseMetaTileEntity(), this.getPollutionPerTick(aStack)); - - return true; + } + this.fixAllMaintenanceIssue(); + return super.onRunningTick(aStack); } @@ -570,7 +455,7 @@ public class GregtechMetaTileEntity_Cyclotron extends GregtechMeta_MultiBlockBas return new String[]{ "COMET - Compact Cyclotron MK "+tier, "EU Required: "+powerRequired+"EU/t", - "Stored EU: "+mEUStore+" / "+maxEUStore()}; + "Stored EU: "+this.getEUVar()+" / "+maxEUStore()}; } @Override diff --git a/src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/production/GregtechMetaTileEntity_IndustrialFishingPond.java b/src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/production/GregtechMetaTileEntity_IndustrialFishingPond.java index 031bf16b17..cb9c68b53c 100644 --- a/src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/production/GregtechMetaTileEntity_IndustrialFishingPond.java +++ b/src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/production/GregtechMetaTileEntity_IndustrialFishingPond.java @@ -549,7 +549,8 @@ public class GregtechMetaTileEntity_IndustrialFishingPond extends GregtechMeta_M ItemStack[] mFishOutput = generateLoot(this.mMode); mFishOutput = removeNulls(mFishOutput); GT_Recipe g = new Recipe_GT(true, new ItemStack[] {}, mFishOutput, null, new int[] {}, aFluidInputs, mOutputFluids, 200, 16, 0); - if (!this.canBufferOutputs(g, aMaxParallelRecipes)) { + aMaxParallelRecipes = this.canBufferOutputs(g, aMaxParallelRecipes); + if (aMaxParallelRecipes == 0) { log("No Space"); return false; } diff --git a/src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/production/GregtechMetaTileEntity_LargeRocketEngine.java b/src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/production/GregtechMetaTileEntity_LargeRocketEngine.java index 8e3e40b3ab..af4132f5ff 100644 --- a/src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/production/GregtechMetaTileEntity_LargeRocketEngine.java +++ b/src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/production/GregtechMetaTileEntity_LargeRocketEngine.java @@ -12,6 +12,7 @@ import gregtech.api.gui.GT_GUIContainer_MultiMachine; import gregtech.api.interfaces.ITexture; import gregtech.api.interfaces.metatileentity.IMetaTileEntity; import gregtech.api.interfaces.tileentity.IGregTechTileEntity; +import gregtech.api.metatileentity.implementations.GT_MetaTileEntity_Hatch; import gregtech.api.metatileentity.implementations.GT_MetaTileEntity_Hatch_Dynamo; import gregtech.api.metatileentity.implementations.GT_MetaTileEntity_Hatch_Input; import gregtech.api.metatileentity.implementations.GT_MetaTileEntity_Hatch_Muffler; @@ -22,6 +23,7 @@ import gregtech.api.util.Recipe_GT; import gtPlusPlus.api.objects.Logger; import gtPlusPlus.core.block.ModBlocks; import gtPlusPlus.core.item.chemistry.RocketFuels; +import gtPlusPlus.core.lib.LoadedMods; import gtPlusPlus.core.material.MISC_MATERIALS; import gtPlusPlus.core.util.minecraft.FluidUtils; import gtPlusPlus.core.util.minecraft.ItemUtils; @@ -52,6 +54,8 @@ public class GregtechMetaTileEntity_LargeRocketEngine extends GregtechMeta_Multi private final static int CASING_ID = TAE.getIndexFromPage(3, 11); + + public ArrayList<GT_MetaTileEntity_Hatch> mAllDynamoHatches = new ArrayList<GT_MetaTileEntity_Hatch>(); public GregtechMetaTileEntity_LargeRocketEngine(final int aID, final String aName, final String aNameRegional) { super(aID, aName, aNameRegional); @@ -91,13 +95,13 @@ public class GregtechMetaTileEntity_LargeRocketEngine extends GregtechMeta_Multi "Supply Rocket Fuels and 1000L(3000L boosted) of "+mLubricantName+" per hour to run", "Supply 4L of "+mCoolantName+" per second per 2100 eu/t to boost output (optional)", "Consumes upto 37500L of Air per second", - "Produces between 4K and 32K eu/t depending on how much fuel is fed", - "When producing more then 16K eu/t fuel wil be consume less efficiently (3x - 1.5x eff)", + "Produces as much energy as you put fuel in becomes less ", + "When producing more then 30K eu/t fuel wil be consume less efficiently (3x - 1.5x eff@55Keu/t)", "Boosting will produce 3x the amount of power but will consume 3x fuel", "Size(WxHxD): 3x3x10, Controller (front centered)", "3x3x10 of Stable "+mCasingName+" (hollow, Min 64!)", "8x "+mGearboxName+" inside the Hollow Casing", - "1x Dynamo Hatch (Top Middle, Max 8)", + "1x Dynamo Hatch (Top Middle, Max 8) suports tectech dynamos", "8x Air Intake Hatch (one of the Casings next to a Gear Box, top row allowed)", "2x Input Hatch (Rocket Fuel/Booster) (one of the Casings next to a Gear Box, top row not allowed)", "1x Maintenance Hatch (one of the Casings next to a Gear Box)", @@ -149,21 +153,20 @@ public class GregtechMetaTileEntity_LargeRocketEngine extends GregtechMeta_Multi @Override public boolean checkRecipe(final ItemStack aStack) { - if (this.mEfficiency < 0) log(" geting air"); final ArrayList<FluidStack> tFluids = this.getStoredFluids(); FluidStack air = FluidUtils.getFluidStack("air", 1); log(" geting air 2"); int aircount = getAir() ; - if (aircount < euProduction/32) { + if (aircount < euProduction/100) { log(" not enough air"); //log("Not Enough Air to Run "+aircount); return false; } else { log(" no boost"); - boolean hasIntakeAir = this.depleteInput(FluidUtils.getFluidStack(air, euProduction/32)); + boolean hasIntakeAir = this.depleteInput(FluidUtils.getFluidStack(air, euProduction/100)); if (!hasIntakeAir) { //log("Could not consume Air to run "+aircount); freeFuelTicks = 0; @@ -221,7 +224,7 @@ public class GregtechMetaTileEntity_LargeRocketEngine extends GregtechMeta_Multi this.mEUt = (int) ((this.mEfficiency < 2000) ? 0 : GT_Values.V[5]<<1); this.mProgresstime = 1; this.mMaxProgresstime = 1; - this.mEfficiencyIncrease = euProduction/4000; + this.mEfficiencyIncrease = euProduction/2000; return true; //log(""); } @@ -229,7 +232,7 @@ public class GregtechMetaTileEntity_LargeRocketEngine extends GregtechMeta_Multi } else { - this.mEfficiencyIncrease = euProduction/4000; + this.mEfficiencyIncrease = euProduction/2000; freeFuelTicks--; this.mEUt = (int) ((this.mEfficiency < 1000) ? 0 : GT_Values.V[5]<<1); this.mProgresstime = 1; @@ -259,17 +262,9 @@ public class GregtechMetaTileEntity_LargeRocketEngine extends GregtechMeta_Multi log("amount: "+amount); log("Value: "+value); int energy = value * amount; - //engine needs at leas 2A EV of fuel to waork - if (energy < 40000){ - log("not enough fuel to work"); - return false; - } - //limits engine to LuV fuel consumption - if (energy > 427500){ - amount = (int) ((double) 427500/value); - energy = 427500; - } log("amount2: "+amount); + if (amount < 5) + return false; FluidStack tLiquid = FluidUtils.getFluidStack(aFuel.mFluidInputs[0], (this.boostEu ? amount * 3 : amount)); if (!this.depleteInput(tLiquid)) { log("could not deplete fluid"); @@ -286,8 +281,16 @@ public class GregtechMetaTileEntity_LargeRocketEngine extends GregtechMeta_Multi public void setEUProduction(int energy){ energy /= 20; - // 3x eff unles it gose above 16K eu/t - double energyEfficiency = energy > 5500 ? ((double) Math.sqrt(5500)/Math.sqrt(energy) * energy) : energy; + double energyEfficiency; + if (energy > 10000) { + energyEfficiency = ((double) Math.cbrt(10000)/Math.cbrt(energy)); + if (energy >= 40000) + energyEfficiency *= ((double) Math.cbrt(40000)/Math.cbrt(energy)); + energyEfficiency *= energy; + } + else { + energyEfficiency = energy; + } euProduction = (int) ((double) energyEfficiency * 1.84); if (this.boostEu) euProduction *= 3; @@ -313,6 +316,10 @@ public class GregtechMetaTileEntity_LargeRocketEngine extends GregtechMeta_Multi int tX = getBaseMetaTileEntity().getXCoord(); int tY = getBaseMetaTileEntity().getYCoord(); int tZ = getBaseMetaTileEntity().getZCoord(); + + this.mTecTechDynamoHatches.clear(); + this.mAllDynamoHatches.clear(); + final int MAX_LENGTH = 8; for (int length=0;length<MAX_LENGTH;length++) { if(getBaseMetaTileEntity().getBlockAtSideAndDistance(tSide, length+1) != getGearboxBlock()) { @@ -425,8 +432,14 @@ public class GregtechMetaTileEntity_LargeRocketEngine extends GregtechMeta_Multi this.updateTexture(tTileEntity, getCasingTextureIndex()); } } + + mAllDynamoHatches.addAll(this.mDynamoHatches); + + if (LoadedMods.TecTech) { + mAllDynamoHatches.addAll(this.mTecTechDynamoHatches); + } - if (this.mDynamoHatches.size() <= 0 || this.mDynamoHatches.isEmpty()) { + if (this.mAllDynamoHatches.size() <= 0 || this.mAllDynamoHatches.isEmpty()) { log("Wrong count for Dynamos"); return false; } @@ -446,7 +459,85 @@ public class GregtechMetaTileEntity_LargeRocketEngine extends GregtechMeta_Multi log("Formed Rocket Engine."); return true; - } + } + + @Override + public boolean addEnergyOutput(long aEU) { + if (aEU <= 0) { + return true; + } + if (mAllDynamoHatches.size() > 0) { + return addEnergyOutputMultipleDynamos(aEU, true); + } + return false; + } + + + public boolean addEnergyOutputMultipleDynamos(long aEU, boolean aAllowMixedVoltageDynamos) { + int injected = 0; + long totalOutput = 0; + long aFirstVoltageFound = -1; + boolean aFoundMixedDynamos = false; + for (GT_MetaTileEntity_Hatch aDynamo : mAllDynamoHatches) { + if( aDynamo == null ) { + return false; + } + if (isValidMetaTileEntity(aDynamo)) { + long aVoltage = aDynamo.maxEUOutput(); + long aTotal = aDynamo.maxAmperesOut() * aVoltage; + // Check against voltage to check when hatch mixing + if (aFirstVoltageFound == -1) { + aFirstVoltageFound = aVoltage; + } + else { + /** + * Calcualtes overclocked ness using long integers + * @param aEUt - recipe EUt + * @param aDuration - recipe Duration + * @param mAmperage - should be 1 ? + */ + //Long time calculation + if (aFirstVoltageFound != aVoltage) { + aFoundMixedDynamos = true; + } + } + totalOutput += aTotal; + } + } + + if (totalOutput < aEU || (aFoundMixedDynamos && !aAllowMixedVoltageDynamos)) { + explodeMultiblock(); + return false; + } + + long leftToInject; + //Long EUt calculation + long aVoltage; + //Isnt too low EUt check? + int aAmpsToInject; + int aRemainder; + + //xEUt *= 4;//this is effect of everclocking + for (GT_MetaTileEntity_Hatch aDynamo : mAllDynamoHatches) { + if (isValidMetaTileEntity(aDynamo)) { + leftToInject = aEU - injected; + aVoltage = aDynamo.maxEUOutput(); + aAmpsToInject = (int) (leftToInject / aVoltage); + aRemainder = (int) (leftToInject - (aAmpsToInject * aVoltage)); + long powerGain; + for (int i = 0; i < Math.min(aDynamo.maxAmperesOut(), aAmpsToInject + 1); i++) { + if (i == Math.min(aDynamo.maxAmperesOut(), aAmpsToInject)){ + powerGain = aRemainder; + }else{ + powerGain = aVoltage; + } + aDynamo.getBaseMetaTileEntity().increaseStoredEnergyUnits(powerGain, false); + injected += powerGain; + } + } + } + return injected > 0; + } public Block getCasingBlock() { return ModBlocks.blockCasings4Misc; diff --git a/src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/production/algae/GregtechMTE_AlgaePondBase.java b/src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/production/algae/GregtechMTE_AlgaePondBase.java index a05ecca551..a7afaa6b56 100644 --- a/src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/production/algae/GregtechMTE_AlgaePondBase.java +++ b/src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/production/algae/GregtechMTE_AlgaePondBase.java @@ -232,7 +232,7 @@ public class GregtechMTE_AlgaePondBase extends GregtechMeta_MultiBlockBase { } public boolean checkForWater() { - + // Get Facing direction IGregTechTileEntity aBaseMetaTileEntity = this.getBaseMetaTileEntity(); int mDirectionX = ForgeDirection.getOrientation(aBaseMetaTileEntity.getBackFacing()).offsetX; @@ -340,7 +340,7 @@ public class GregtechMTE_AlgaePondBase extends GregtechMeta_MultiBlockBase { if (aBaseMetaTileEntity.isClientSide()) { this.mLevel = getCasingTierOnClientSide(); } - + } @Override @@ -379,9 +379,15 @@ public class GregtechMTE_AlgaePondBase extends GregtechMeta_MultiBlockBase { return false; } - if (!this.canBufferOutputs(tRecipe, aMaxParallelRecipes, false)) { + aMaxParallelRecipes = this.canBufferOutputs(tRecipe, aMaxParallelRecipes); + if (aMaxParallelRecipes == 0) { return false; } + if (tRecipe.mInputs.length > 0) { + for (ItemStack aInputToConsume : tRecipe.mInputs) { + this.depleteInput(aInputToConsume); + } + } // -- Try not to fail after this point - inputs have already been consumed! -- @@ -475,7 +481,7 @@ public class GregtechMTE_AlgaePondBase extends GregtechMeta_MultiBlockBase { } return false; } - + @SideOnly(Side.CLIENT) private final int getCasingTierOnClientSide() { if (this == null || this.getBaseMetaTileEntity().getWorld() == null) { @@ -497,7 +503,7 @@ public class GregtechMTE_AlgaePondBase extends GregtechMeta_MultiBlockBase { return 0; } } - + } diff --git a/src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/production/chemplant/GregtechMTE_ChemicalPlant.java b/src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/production/chemplant/GregtechMTE_ChemicalPlant.java index 87f8d81bb2..ebae66fe72 100644 --- a/src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/production/chemplant/GregtechMTE_ChemicalPlant.java +++ b/src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/production/chemplant/GregtechMTE_ChemicalPlant.java @@ -57,7 +57,10 @@ public class GregtechMTE_ChemicalPlant extends GregtechMeta_MultiBlockBase { private int mPipeCasingTier = 0; private int mCoilTier = 0; - + public static GT_Recipe_Map getGeneratedRecipeMap() { + return mFluidChemicalReactorRecipes; + } + /** * Internal Recipe Map which holds the actual recipes, backed by the real map, shown by NEI. */ @@ -832,7 +835,8 @@ public class GregtechMTE_ChemicalPlant extends GregtechMeta_MultiBlockBase { } - if (!this.canBufferOutputs(tRecipe, aMaxParallelRecipes)) { + aMaxParallelRecipes = this.canBufferOutputs(tRecipe, aMaxParallelRecipes); + if (aMaxParallelRecipes == 0) { log("BAD RETURN - 2"); return false; } diff --git a/src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/storage/GregtechMetaTileEntity_PowerSubStationController.java b/src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/storage/GregtechMetaTileEntity_PowerSubStationController.java index 7300b3507b..9b898e34af 100644 --- a/src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/storage/GregtechMetaTileEntity_PowerSubStationController.java +++ b/src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/storage/GregtechMetaTileEntity_PowerSubStationController.java @@ -10,7 +10,6 @@ import gregtech.api.interfaces.metatileentity.IMetaTileEntity; import gregtech.api.interfaces.tileentity.IGregTechTileEntity; import gregtech.api.metatileentity.MetaTileEntity; import gregtech.api.metatileentity.implementations.GT_MetaTileEntity_Hatch; -import gregtech.api.metatileentity.implementations.GT_MetaTileEntity_Hatch_Energy; import gregtech.api.objects.GT_RenderedTexture; import gregtech.api.util.GT_Utility; import gtPlusPlus.api.objects.Logger; @@ -47,6 +46,7 @@ public class GregtechMetaTileEntity_PowerSubStationController extends GregtechMe private final int ENERGY_TAX = 2; //TecTech Support + public ArrayList<GT_MetaTileEntity_Hatch> mAllEnergyHatches = new ArrayList<GT_MetaTileEntity_Hatch>(); public ArrayList<GT_MetaTileEntity_Hatch> mAllDynamoHatches = new ArrayList<GT_MetaTileEntity_Hatch>(); public GregtechMetaTileEntity_PowerSubStationController(final int aID, final String aName, final String aNameRegional) { @@ -138,12 +138,26 @@ public class GregtechMetaTileEntity_PowerSubStationController extends GregtechMe } else if (aBlock == ModBlocks.blockCasings3Misc && aMeta == 7) { return 8; } else if (aBlock == ModBlocks.blockCasings3Misc && aMeta == 8) { - return CORE.GTNH ? GT_Values.V.length : 9; + return 9; } else { return -1; } } + public static int getMaxHatchTier(int aCellTier) { + switch(aCellTier) { + case 9: + return CORE.GTNH ? 15 : 9; + default: + if (aCellTier < 4) { + return 0; + } + else { + return aCellTier; + } + } + } + public static final int CELL_HEIGHT_MAX = 16; public static final int CELL_HEIGHT_MIN = 2; @@ -153,8 +167,11 @@ public class GregtechMetaTileEntity_PowerSubStationController extends GregtechMe final int xDir = ForgeDirection.getOrientation(aBaseMetaTileEntity.getBackFacing()).offsetX * 2; final int zDir = ForgeDirection.getOrientation(aBaseMetaTileEntity.getBackFacing()).offsetZ * 2; - this.mMultiDynamoHatches.clear(); - this.mAllDynamoHatches.clear(); + this.mTecTechDynamoHatches.clear(); + this.mAllDynamoHatches.clear(); + + this.mTecTechEnergyHatches.clear(); + this.mAllEnergyHatches.clear(); boolean tFoundCeiling = false; int tCasingCount = 0; @@ -246,10 +263,12 @@ public class GregtechMetaTileEntity_PowerSubStationController extends GregtechMe /** * TecTech Support, this allows adding Multi-Amp dynamos. */ + mAllEnergyHatches.addAll(this.mEnergyHatches); mAllDynamoHatches.addAll(this.mDynamoHatches); if (LoadedMods.TecTech) { - mAllDynamoHatches.addAll(this.mMultiDynamoHatches); + mAllDynamoHatches.addAll(this.mTecTechEnergyHatches); + mAllDynamoHatches.addAll(this.mTecTechDynamoHatches); } @@ -257,7 +276,7 @@ public class GregtechMetaTileEntity_PowerSubStationController extends GregtechMe checkMachineProblem("Needed 1 maintenance hatch, found " + this.mMaintenanceHatches.size()); return false; } - if (this.mEnergyHatches.size() < 1) { + if (this.mAllEnergyHatches.size() < 1) { checkMachineProblem("Needed at least 1 energy hatch, found 0"); return false; } @@ -269,15 +288,17 @@ public class GregtechMetaTileEntity_PowerSubStationController extends GregtechMe // Find average EU throughput int totalEuThroughput = 0; int hatchCount = 0; + + int aMaxHatchTier = getMaxHatchTier(tOverallCellTier); - for (GT_MetaTileEntity_Hatch_Energy re : this.mEnergyHatches) { + for (GT_MetaTileEntity_Hatch re : this.mAllEnergyHatches) { long tier = re.getOutputTier(); - if(tier > tOverallCellTier) { - checkMachineProblem("Energy hatch (tier " + tier + ") is too strong for cells (tier " + tOverallCellTier + ")"); + if(tier > aMaxHatchTier) { + checkMachineProblem("Energy hatch (tier " + tier + ") is too strong for cells (tier " + aMaxHatchTier + ")"); return false; } if(tier < 3) { - checkMachineProblem("Energy hatch (tier " + tier + ") is too weak for cells (tier " + tOverallCellTier + ")"); + checkMachineProblem("Energy hatch (tier " + tier + ") is too weak for cells (tier " + aMaxHatchTier + ")"); return false; } totalEuThroughput += re.maxEUInput(); @@ -286,12 +307,12 @@ public class GregtechMetaTileEntity_PowerSubStationController extends GregtechMe for (GT_MetaTileEntity_Hatch re : this.mAllDynamoHatches) { long tier = re.getInputTier(); - if(tier > tOverallCellTier) { - checkMachineProblem("Dynamo hatch (tier " + tier + ") is too strong for cells (tier " + tOverallCellTier + ")"); + if(tier > aMaxHatchTier) { + checkMachineProblem("Dynamo hatch (tier " + tier + ") is too strong for cells (tier " + aMaxHatchTier + ")"); return false; } if(tier < 3) { - checkMachineProblem("Energy hatch (tier " + tier + ") is too weak for cells (tier " + tOverallCellTier + ")"); + checkMachineProblem("Energy hatch (tier " + tier + ") is too weak for cells (tier " + aMaxHatchTier + ")"); return false; } totalEuThroughput += re.maxEUOutput(); @@ -431,6 +452,12 @@ public class GregtechMetaTileEntity_PowerSubStationController extends GregtechMe return MathUtils.roundToClosestInt(mTax); } + + @Override + public void onPreTick(IGregTechTileEntity aBaseMetaTileEntity, long aTick) { + this.fixAllMaintenanceIssue(); + } + @Override public boolean onRunningTick(ItemStack aStack) { // First, decay overcharge (0.1% of stored energy plus 1000 EU per tick) @@ -448,7 +475,7 @@ public class GregtechMetaTileEntity_PowerSubStationController extends GregtechMe for (GT_MetaTileEntity_Hatch_OutputBattery tHatch : this.mDischargeHatches) { drawEnergyFromHatch(tHatch); } - for (GT_MetaTileEntity_Hatch_Energy tHatch : this.mEnergyHatches) { + for (GT_MetaTileEntity_Hatch tHatch : this.mAllEnergyHatches) { drawEnergyFromHatch(tHatch); } diff --git a/src/Java/gtPlusPlus/xmod/gregtech/loaders/RecipeGen_AlloySmelter.java b/src/Java/gtPlusPlus/xmod/gregtech/loaders/RecipeGen_AlloySmelter.java index e2a30851aa..7754d039cf 100644 --- a/src/Java/gtPlusPlus/xmod/gregtech/loaders/RecipeGen_AlloySmelter.java +++ b/src/Java/gtPlusPlus/xmod/gregtech/loaders/RecipeGen_AlloySmelter.java @@ -29,7 +29,7 @@ public class RecipeGen_AlloySmelter extends RecipeGen_Base { } private void generateRecipes(final Material material){ - final int tVoltageMultiplier = material.getMeltingPointK() >= 2800 ? 60 : 15; + final int tVoltageMultiplier = material.vVoltageMultiplier; @@ -40,7 +40,7 @@ public class RecipeGen_AlloySmelter extends RecipeGen_Base { ItemList.Shape_Mold_Nugget.get(0), material.getNugget(9), (int) Math.max(material.getMass() * 2L, 1L), - 2 * tVoltageMultiplier); + tVoltageMultiplier); //Gears if (ItemUtils.checkForInvalidItems(material.getIngot(1)) && ItemUtils.checkForInvalidItems(material.getGear(1))) @@ -49,7 +49,7 @@ public class RecipeGen_AlloySmelter extends RecipeGen_Base { ItemList.Shape_Mold_Gear.get(0), material.getGear(1), (int) Math.max(material.getMass() * 2L, 1L), - 2 * tVoltageMultiplier); + tVoltageMultiplier); //Ingot if (ItemUtils.checkForInvalidItems(material.getIngot(1)) && ItemUtils.checkForInvalidItems(material.getNugget(1))) @@ -58,7 +58,7 @@ public class RecipeGen_AlloySmelter extends RecipeGen_Base { ItemList.Shape_Mold_Ingot.get(0), material.getIngot(1), (int) Math.max(material.getMass() * 2L, 1L), - 2 * tVoltageMultiplier); + tVoltageMultiplier); } diff --git a/src/Java/gtPlusPlus/xmod/gregtech/loaders/RecipeGen_Extruder.java b/src/Java/gtPlusPlus/xmod/gregtech/loaders/RecipeGen_Extruder.java index 56f65670a8..cd43d6201c 100644 --- a/src/Java/gtPlusPlus/xmod/gregtech/loaders/RecipeGen_Extruder.java +++ b/src/Java/gtPlusPlus/xmod/gregtech/loaders/RecipeGen_Extruder.java @@ -34,7 +34,6 @@ public class RecipeGen_Extruder extends RecipeGen_Base { private void generateRecipes(final Material material){ - final int tVoltageMultiplier = material.getMeltingPointK() >= 2800 ? 60 : 15; final ItemStack itemIngot = material.getIngot(1); final ItemStack itemPlate = material.getPlate(1); final ItemStack itemGear = material.getGear(1); diff --git a/src/Java/gtPlusPlus/xmod/gregtech/loaders/misc/WoodCentrifuging.java b/src/Java/gtPlusPlus/xmod/gregtech/loaders/misc/WoodCentrifuging.java new file mode 100644 index 0000000000..2d7cd1b73b --- /dev/null +++ b/src/Java/gtPlusPlus/xmod/gregtech/loaders/misc/WoodCentrifuging.java @@ -0,0 +1,85 @@ +package gtPlusPlus.xmod.gregtech.loaders.misc; + +import java.util.ArrayList; + +import gregtech.api.enums.GT_Values; +import gregtech.api.enums.ItemList; +import gregtech.api.enums.Materials; +import gregtech.api.enums.OrePrefixes; +import gregtech.api.util.GT_ModHandler; +import gregtech.api.util.GT_OreDictUnificator; +import gregtech.api.util.GT_Recipe; +import gregtech.api.util.GT_Utility; +import gtPlusPlus.api.objects.Logger; +import gtPlusPlus.core.util.minecraft.ItemUtils; +import net.minecraft.item.ItemStack; +import net.minecraftforge.oredict.OreDictionary; + +public class WoodCentrifuging { + + private static final ArrayList<ItemStack> aLogData; + private static final ArrayList<ItemStack> aRubberLogs; + private static final ArrayList<ItemStack> aRubberLogs2; + + static { + aLogData = OreDictionary.getOres("logWood"); + aRubberLogs = OreDictionary.getOres("logRubber"); + aRubberLogs2 = OreDictionary.getOres("woodRubber"); + } + + private static boolean isNormalLog(ItemStack aStack) { + if (aLogData.contains(aStack) & !isRubberLog(aStack)) { + return true; + } + return false; + } + + private static boolean isRubberLog(ItemStack aStack) { + if (aRubberLogs.contains(aStack)) { + return true; + } + else if (aRubberLogs2.contains(aStack)) { + return true; + } + return false; + } + + + private static boolean addCentrifugeRecipe(ItemStack aStack) { + if (isNormalLog(aStack)) { + return addNormalLogCentrifugeRecipe(aStack); + } + else if (isRubberLog(aStack)) { + return addRubberLogCentrifugeRecipe(aStack); + } + return false; + } + + private static boolean addNormalLogCentrifugeRecipe(ItemStack aStack) { + GT_Recipe aFoundRecipe = GT_Recipe.GT_Recipe_Map.sCentrifugeRecipes.findRecipe(null, false, gregtech.api.enums.GT_Values.V[1], null, new ItemStack[]{aStack}); + if (aFoundRecipe == null && GT_Values.RA.addCentrifugeRecipe(GT_Utility.copyAmount(1L, aStack), null, null, Materials.Methane.getGas(60L), GT_Values.NI, GT_Values.NI, GT_Values.NI, GT_Values.NI, GT_Values.NI, GT_Values.NI, null, 200, 20)) { + Logger.INFO("Added methane extraction for "+ItemUtils.getItemName(aStack)); + return true; + } + return false; + } + private static boolean addRubberLogCentrifugeRecipe(ItemStack aStack) { + GT_Recipe aFoundRecipe = GT_Recipe.GT_Recipe_Map.sCentrifugeRecipes.findRecipe(null, false, gregtech.api.enums.GT_Values.V[1], null, new ItemStack[]{aStack}); + if (aFoundRecipe == null && GT_Values.RA.addCentrifugeRecipe(GT_Utility.copyAmount(1L, aStack), null, null, Materials.Methane.getGas(60L), ItemList.IC2_Resin.get(1L, new Object[0]), GT_ModHandler.getIC2Item("plantBall", 1L), GT_OreDictUnificator.get(OrePrefixes.dust, Materials.Carbon, 1L), GT_OreDictUnificator.get(OrePrefixes.dust, Materials.Wood, 1L), null, null, new int[] { 5000, 3750, 2500, 2500 }, 200, 20)) { + Logger.INFO("Added rubber plant based methane extraction for "+ItemUtils.getItemName(aStack)); + return true; + } + return false; + } + + public static void processLogsForMethane() { + //Try use all woods found, fix/add methane extraction. + if (!aLogData.isEmpty()) { + Logger.INFO("Fixing Methane output of centrifuged logs."); + for (ItemStack stack : aLogData) { + addCentrifugeRecipe(stack); + } + } + } + +} diff --git a/src/Java/gtPlusPlus/xmod/gregtech/loaders/recipe/RecipeLoader_AlgaeFarm.java b/src/Java/gtPlusPlus/xmod/gregtech/loaders/recipe/RecipeLoader_AlgaeFarm.java index 609d4e0649..1091533a52 100644 --- a/src/Java/gtPlusPlus/xmod/gregtech/loaders/recipe/RecipeLoader_AlgaeFarm.java +++ b/src/Java/gtPlusPlus/xmod/gregtech/loaders/recipe/RecipeLoader_AlgaeFarm.java @@ -125,70 +125,75 @@ public class RecipeLoader_AlgaeFarm { // Create an Automap to dump contents into AutoMap<ItemStack> aOutputMap = new AutoMap<ItemStack>(); - // Add loot relevant to tier and also add any from lower tiers. - if (aTier >= 0) { - aOutputMap.put(ItemUtils.getSimpleStack(AgriculturalChem.mAlgaeBiosmass, MathUtils.randInt(16, 32))); - aOutputMap.put(ItemUtils.getSimpleStack(AgriculturalChem.mAlgaeBiosmass, MathUtils.randInt(32, 64))); - if (MathUtils.randInt(0, 10) > 9) { - aOutputMap.put(ItemUtils.getSimpleStack(AgriculturalChem.mGreenAlgaeBiosmass, MathUtils.randInt(8, 16))); + // Buff output by yielding 6-8 times more. + for (int i=0;i<MathUtils.randInt(4, 8);i++) { + // Add loot relevant to tier and also add any from lower tiers. + if (aTier >= 0) { + aOutputMap.put(ItemUtils.getSimpleStack(AgriculturalChem.mAlgaeBiosmass, MathUtils.randInt(16, 32))); + aOutputMap.put(ItemUtils.getSimpleStack(AgriculturalChem.mAlgaeBiosmass, MathUtils.randInt(32, 64))); + if (MathUtils.randInt(0, 10) > 9) { + aOutputMap.put(ItemUtils.getSimpleStack(AgriculturalChem.mGreenAlgaeBiosmass, MathUtils.randInt(8, 16))); + } } - } - if (aTier >= 1) { - aOutputMap.put(ItemUtils.getSimpleStack(AgriculturalChem.mAlgaeBiosmass, MathUtils.randInt(16, 32))); - aOutputMap.put(ItemUtils.getSimpleStack(AgriculturalChem.mGreenAlgaeBiosmass, MathUtils.randInt(16, 32))); - if (MathUtils.randInt(0, 10) > 9) { - aOutputMap.put(ItemUtils.getSimpleStack(AgriculturalChem.mGreenAlgaeBiosmass, MathUtils.randInt(4, 8))); + if (aTier >= 1) { + aOutputMap.put(ItemUtils.getSimpleStack(AgriculturalChem.mAlgaeBiosmass, MathUtils.randInt(16, 32))); + aOutputMap.put(ItemUtils.getSimpleStack(AgriculturalChem.mGreenAlgaeBiosmass, MathUtils.randInt(16, 32))); + if (MathUtils.randInt(0, 10) > 9) { + aOutputMap.put(ItemUtils.getSimpleStack(AgriculturalChem.mGreenAlgaeBiosmass, MathUtils.randInt(4, 8))); + } } - } - if (aTier >= 2) { - aOutputMap.put(ItemUtils.getSimpleStack(AgriculturalChem.mGreenAlgaeBiosmass, MathUtils.randInt(8, 16))); - aOutputMap.put(ItemUtils.getSimpleStack(AgriculturalChem.mGreenAlgaeBiosmass, MathUtils.randInt(16, 32))); - if (MathUtils.randInt(0, 10) > 9) { - aOutputMap.put(ItemUtils.getSimpleStack(AgriculturalChem.mGreenAlgaeBiosmass, MathUtils.randInt(4, 8))); + if (aTier >= 2) { + aOutputMap.put(ItemUtils.getSimpleStack(AgriculturalChem.mGreenAlgaeBiosmass, MathUtils.randInt(8, 16))); + aOutputMap.put(ItemUtils.getSimpleStack(AgriculturalChem.mGreenAlgaeBiosmass, MathUtils.randInt(16, 32))); + if (MathUtils.randInt(0, 10) > 9) { + aOutputMap.put(ItemUtils.getSimpleStack(AgriculturalChem.mGreenAlgaeBiosmass, MathUtils.randInt(4, 8))); + } } - } - if (aTier >= 3) { - aOutputMap.put(ItemUtils.getSimpleStack(AgriculturalChem.mGreenAlgaeBiosmass, MathUtils.randInt(16, 32))); - aOutputMap.put(ItemUtils.getSimpleStack(AgriculturalChem.mBrownAlgaeBiosmass, MathUtils.randInt(2, 8))); - if (MathUtils.randInt(0, 10) > 9) { - aOutputMap.put(ItemUtils.getSimpleStack(AgriculturalChem.mBrownAlgaeBiosmass, MathUtils.randInt(8, 16))); + if (aTier >= 3) { + aOutputMap.put(ItemUtils.getSimpleStack(AgriculturalChem.mGreenAlgaeBiosmass, MathUtils.randInt(16, 32))); + aOutputMap.put(ItemUtils.getSimpleStack(AgriculturalChem.mBrownAlgaeBiosmass, MathUtils.randInt(2, 8))); + if (MathUtils.randInt(0, 10) > 9) { + aOutputMap.put(ItemUtils.getSimpleStack(AgriculturalChem.mBrownAlgaeBiosmass, MathUtils.randInt(8, 16))); + } } - } - if (aTier >= 4) { - aOutputMap.put(ItemUtils.getSimpleStack(AgriculturalChem.mBrownAlgaeBiosmass, MathUtils.randInt(16, 32))); - aOutputMap.put(ItemUtils.getSimpleStack(AgriculturalChem.mBrownAlgaeBiosmass, MathUtils.randInt(32, 64))); - if (MathUtils.randInt(0, 10) > 9) { - aOutputMap.put(ItemUtils.getSimpleStack(AgriculturalChem.mGoldenBrownAlgaeBiosmass, MathUtils.randInt(4, 8))); + if (aTier >= 4) { + aOutputMap.put(ItemUtils.getSimpleStack(AgriculturalChem.mBrownAlgaeBiosmass, MathUtils.randInt(16, 32))); + aOutputMap.put(ItemUtils.getSimpleStack(AgriculturalChem.mBrownAlgaeBiosmass, MathUtils.randInt(32, 64))); + if (MathUtils.randInt(0, 10) > 9) { + aOutputMap.put(ItemUtils.getSimpleStack(AgriculturalChem.mGoldenBrownAlgaeBiosmass, MathUtils.randInt(4, 8))); + } } - } - if (aTier >= 5) { - aOutputMap.put(ItemUtils.getSimpleStack(AgriculturalChem.mBrownAlgaeBiosmass, MathUtils.randInt(16, 32))); - aOutputMap.put(ItemUtils.getSimpleStack(AgriculturalChem.mGoldenBrownAlgaeBiosmass, MathUtils.randInt(16, 32))); - if (MathUtils.randInt(0, 10) > 9) { - aOutputMap.put(ItemUtils.getSimpleStack(AgriculturalChem.mRedAlgaeBiosmass, MathUtils.randInt(1, 2))); + if (aTier >= 5) { + aOutputMap.put(ItemUtils.getSimpleStack(AgriculturalChem.mBrownAlgaeBiosmass, MathUtils.randInt(16, 32))); + aOutputMap.put(ItemUtils.getSimpleStack(AgriculturalChem.mGoldenBrownAlgaeBiosmass, MathUtils.randInt(16, 32))); + if (MathUtils.randInt(0, 10) > 9) { + aOutputMap.put(ItemUtils.getSimpleStack(AgriculturalChem.mRedAlgaeBiosmass, MathUtils.randInt(1, 2))); + } } - } - // Tier 6 is Highest for outputs - if (aTier >= 6) { - aOutputMap.put(ItemUtils.getSimpleStack(AgriculturalChem.mGoldenBrownAlgaeBiosmass, MathUtils.randInt(16, 32))); - aOutputMap.put(ItemUtils.getSimpleStack(AgriculturalChem.mRedAlgaeBiosmass, MathUtils.randInt(8, 16))); - if (MathUtils.randInt(0, 10) > 9) { - aOutputMap.put(ItemUtils.getSimpleStack(AgriculturalChem.mRedAlgaeBiosmass, MathUtils.randInt(8, 16))); + // Tier 6 is Highest for outputs + if (aTier >= 6) { + aOutputMap.put(ItemUtils.getSimpleStack(AgriculturalChem.mGoldenBrownAlgaeBiosmass, MathUtils.randInt(16, 32))); + aOutputMap.put(ItemUtils.getSimpleStack(AgriculturalChem.mRedAlgaeBiosmass, MathUtils.randInt(8, 16))); + if (MathUtils.randInt(0, 10) > 9) { + aOutputMap.put(ItemUtils.getSimpleStack(AgriculturalChem.mRedAlgaeBiosmass, MathUtils.randInt(8, 16))); + } } - } - - // Iterate a special loop at higher tiers to provide more Red/Gold Algae. - for (int i=0;i<(9-aTier);i++) { - if (aTier >= (6+i)) { - int aMulti = i + 1; - aOutputMap.put(ItemUtils.getSimpleStack(AgriculturalChem.mGoldenBrownAlgaeBiosmass, MathUtils.randInt(4, 8*aMulti))); - aOutputMap.put(ItemUtils.getSimpleStack(AgriculturalChem.mRedAlgaeBiosmass, MathUtils.randInt(4, 8*aMulti))); - if (MathUtils.randInt(0, 10) > 8) { - aOutputMap.put(ItemUtils.getSimpleStack(AgriculturalChem.mRedAlgaeBiosmass, MathUtils.randInt(8, 16*aMulti))); + + // Iterate a special loop at higher tiers to provide more Red/Gold Algae. + for (int i2=0;i2<(9-aTier);i2++) { + if (aTier >= (6+i2)) { + int aMulti = i2 + 1; + aOutputMap.put(ItemUtils.getSimpleStack(AgriculturalChem.mGoldenBrownAlgaeBiosmass, MathUtils.randInt(4, 8*aMulti))); + aOutputMap.put(ItemUtils.getSimpleStack(AgriculturalChem.mRedAlgaeBiosmass, MathUtils.randInt(4, 8*aMulti))); + if (MathUtils.randInt(0, 10) > 8) { + aOutputMap.put(ItemUtils.getSimpleStack(AgriculturalChem.mRedAlgaeBiosmass, MathUtils.randInt(8, 16*aMulti))); + } } } } + + // Map the AutoMap contents to an Itemstack Array. ItemStack[] aOutputs = new ItemStack[aOutputMap.size()]; for (int i=0;i<aOutputMap.size();i++) { diff --git a/src/Java/gtPlusPlus/xmod/gregtech/registration/gregtech/GregtechDehydrator.java b/src/Java/gtPlusPlus/xmod/gregtech/registration/gregtech/GregtechDehydrator.java index a3aa7e5e78..eecbde9804 100644 --- a/src/Java/gtPlusPlus/xmod/gregtech/registration/gregtech/GregtechDehydrator.java +++ b/src/Java/gtPlusPlus/xmod/gregtech/registration/gregtech/GregtechDehydrator.java @@ -46,34 +46,34 @@ public class GregtechDehydrator { GregtechItemList.GT_Dehydrator_MV .set(new GT_MetaTileEntity_BasicMachine_GT_Recipe(911, "machine.dehydrator.tier.00", "Basic Dehydrator I", 2, "This dehydrates your Grapes into Raisins. ", - Recipe_GT.Gregtech_Recipe_Map.sChemicalDehydratorRecipes, 2, 9, 10000, 2, 5, "Dehydrator.png", + Recipe_GT.Gregtech_Recipe_Map.sChemicalDehydratorRecipes, 2, 9, 16000, 2, 5, "Dehydrator.png", "", false, false, 0, "UNBOXINATOR", null).getStackForm(1L)); GregtechItemList.GT_Dehydrator_HV .set(new GT_MetaTileEntity_BasicMachine_GT_Recipe(912, "machine.dehydrator.tier.01", "Basic Dehydrator II", 3, "This dehydrates your Grapes into Raisins. ", - Recipe_GT.Gregtech_Recipe_Map.sChemicalDehydratorRecipes, 2, 9, 10000, 2, 5, "Dehydrator.png", + Recipe_GT.Gregtech_Recipe_Map.sChemicalDehydratorRecipes, 2, 9, 32000, 2, 5, "Dehydrator.png", "", false, false, 0, "UNBOXINATOR", null).getStackForm(1L)); //Chemical GregtechItemList.GT_Dehydrator_EV .set(new GT_MetaTileEntity_BasicMachine_GT_Recipe(813, "advancedmachine.dehydrator.tier.01", "Chemical Dehydrator I", 4, "This dehydrates your Grapes into Raisins. ", - Recipe_GT.Gregtech_Recipe_Map.sChemicalDehydratorRecipes, 2, 9, 10000, 2, 5, "Dehydrator.png", + Recipe_GT.Gregtech_Recipe_Map.sChemicalDehydratorRecipes, 2, 9, 48000, 2, 5, "Dehydrator.png", "", false, false, 0, "UNBOXINATOR", null).getStackForm(1L)); GregtechItemList.GT_Dehydrator_IV.set(new GT_MetaTileEntity_BasicMachine_GT_Recipe(814, "advancedmachine.dehydrator.tier.02", "Chemical Dehydrator II", 5, "A hangover is the way your body reacts to dehydration. ", - Recipe_GT.Gregtech_Recipe_Map.sChemicalDehydratorRecipes, 2, 9, 10000, 2, 5, "Dehydrator.png", "", + Recipe_GT.Gregtech_Recipe_Map.sChemicalDehydratorRecipes, 2, 9, 64000, 2, 5, "Dehydrator.png", "", false, false, 0, "UNBOXINATOR", null).getStackForm(1L)); GregtechItemList.GT_Dehydrator_LuV.set(new GT_MetaTileEntity_BasicMachine_GT_Recipe(815, "advancedmachine.dehydrator.tier.03", "Chemical Dehydrator III", 6, "You could probably make space icecream with this.. ", - Recipe_GT.Gregtech_Recipe_Map.sChemicalDehydratorRecipes, 2, 9, 10000, 2, 5, "Dehydrator.png", "", + Recipe_GT.Gregtech_Recipe_Map.sChemicalDehydratorRecipes, 2, 9, 64000, 2, 5, "Dehydrator.png", "", false, false, 0, "UNBOXINATOR", null).getStackForm(1L)); GregtechItemList.GT_Dehydrator_ZPM.set(new GT_MetaTileEntity_BasicMachine_GT_Recipe(816, "advancedmachine.dehydrator.tier.04", "Chemical Dehydrator IV", 7, "You can definitely make space icecream with this.. ", - Recipe_GT.Gregtech_Recipe_Map.sChemicalDehydratorRecipes, 2, 9, 10000, 2, 5, "Dehydrator.png", "", + Recipe_GT.Gregtech_Recipe_Map.sChemicalDehydratorRecipes, 2, 9, 64000, 2, 5, "Dehydrator.png", "", false, false, 0, "UNBOXINATOR", null).getStackForm(1L)); //Advanced diff --git a/src/Java/gtPlusPlus/xmod/ob/GliderHandler.java b/src/Java/gtPlusPlus/xmod/ob/GliderHandler.java index 7a53572aae..a190511b02 100644 --- a/src/Java/gtPlusPlus/xmod/ob/GliderHandler.java +++ b/src/Java/gtPlusPlus/xmod/ob/GliderHandler.java @@ -35,15 +35,7 @@ public class GliderHandler { return; } - ItemStack aItem = event.entityPlayer.getItemInUse(); - if (!ItemUtils.checkForInvalidItems(aItem)) { - Logger.WARNING("[OpenBlocks] Item in use was invalid, trying currentlyEquipped."); - aItem = event.entityPlayer.getCurrentEquippedItem(); - } - if (!ItemUtils.checkForInvalidItems(aItem)) { - Logger.WARNING("[OpenBlocks] Item in use was invalid, trying heldItem."); - aItem = event.entityPlayer.getHeldItem(); - } + ItemStack aItem = PlayerUtils.getItemStackInPlayersHand(event.entityPlayer); if (ItemUtils.checkForInvalidItems(aItem)) { Class aItemGliderClass = ReflectionUtils.getClass("openblocks.common.item.ItemHangGlider"); if (aItemGliderClass.isInstance(aItem.getItem())) { |