diff options
author | Alkalus <3060479+draknyte1@users.noreply.github.com> | 2020-01-13 19:02:58 +0000 |
---|---|---|
committer | Alkalus <3060479+draknyte1@users.noreply.github.com> | 2020-01-13 19:02:58 +0000 |
commit | bc630f3a7738e4a495cdc1672949d934f76838e3 (patch) | |
tree | 263bc63824d8db4e0c2f6f333a1ce7c7adbe87ec /src/Java/gtPlusPlus | |
parent | 8a7e602c8cbd1a82cd967fab2989d06e59f99e7a (diff) | |
download | GT5-Unofficial-bc630f3a7738e4a495cdc1672949d934f76838e3.tar.gz GT5-Unofficial-bc630f3a7738e4a495cdc1672949d934f76838e3.tar.bz2 GT5-Unofficial-bc630f3a7738e4a495cdc1672949d934f76838e3.zip |
+ Added Hazmat protection to EMT, Gravisuit and Adv. Solar items. Closes #590.
+ Added a hard crash if materials are not found within GT.
+ Added a check for KekzTech and cached some mod checks.
+ Added pollution/s to Geothermal generators. Fixes #579.
$ Fixed Wither Cages being unbreakable. Fixes #587
$ Fixed centrifuging of logs to Methane. Fixes #595.
Diffstat (limited to 'src/Java/gtPlusPlus')
8 files changed, 275 insertions, 80 deletions
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/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/recipe/RECIPES_GREGTECH.java b/src/Java/gtPlusPlus/core/recipe/RECIPES_GREGTECH.java index cf2242067f..cd02a297a7 100644 --- a/src/Java/gtPlusPlus/core/recipe/RECIPES_GREGTECH.java +++ b/src/Java/gtPlusPlus/core/recipe/RECIPES_GREGTECH.java @@ -1752,27 +1752,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/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/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/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/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/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); + } + } + } + +} |