diff options
Diffstat (limited to 'src/main')
-rw-r--r-- | src/main/java/com/github/technus/tectech/loader/MainLoader.java | 84 |
1 files changed, 19 insertions, 65 deletions
diff --git a/src/main/java/com/github/technus/tectech/loader/MainLoader.java b/src/main/java/com/github/technus/tectech/loader/MainLoader.java index 042b184ea1..1cd0ee24cb 100644 --- a/src/main/java/com/github/technus/tectech/loader/MainLoader.java +++ b/src/main/java/com/github/technus/tectech/loader/MainLoader.java @@ -1,10 +1,14 @@ package com.github.technus.tectech.loader; -import static com.github.technus.tectech.TecTech.*; +import static com.github.technus.tectech.TecTech.LOGGER; +import static com.github.technus.tectech.TecTech.configTecTech; +import static com.github.technus.tectech.TecTech.creativeTabEM; +import static com.github.technus.tectech.TecTech.creativeTabTecTech; +import static com.github.technus.tectech.TecTech.instance; +import static com.github.technus.tectech.TecTech.proxy; import static com.github.technus.tectech.compatibility.thaumcraft.elementalMatter.transformations.AspectDefinitionCompat.aspectDefinitionCompat; import static com.github.technus.tectech.compatibility.thaumcraft.thing.metaTileEntity.multi.EssentiaCompat.essentiaContainerCompat; import static com.github.technus.tectech.loader.TecTechConfig.DEBUG_MODE; -import static com.github.technus.tectech.util.CommonValues.*; import static gregtech.api.enums.GT_Values.W; import com.github.technus.tectech.Reference; @@ -29,17 +33,14 @@ import com.github.technus.tectech.thing.metaTileEntity.multi.em_collider.GT_Meta import cpw.mods.fml.common.Loader; import cpw.mods.fml.common.ProgressManager; import cpw.mods.fml.common.network.NetworkRegistry; -import cpw.mods.fml.common.registry.GameData; import cpw.mods.fml.common.registry.GameRegistry; import gregtech.api.GregTech_API; import gregtech.api.enums.Materials; import gregtech.api.util.GT_ModHandler; import gregtech.api.util.GT_Recipe; import gregtech.api.util.GT_Utility; -import java.util.Arrays; import java.util.Collection; import java.util.HashMap; -import java.util.HashSet; import net.minecraft.block.Block; import net.minecraft.item.ItemStack; import net.minecraft.util.DamageSource; @@ -154,7 +155,7 @@ public final class MainLoader { if (!configTecTech.DISABLE_BLOCK_HARDNESS_NERF) { progressBarPostLoad.step("Nerf blocks blast resistance"); - fixBlocks(); + adjustTwilightBlockResistance(); TecTech.LOGGER.info("Blocks nerf done"); } else { progressBarPostLoad.step("Do not nerf blocks blast resistance"); @@ -309,65 +310,18 @@ public final class MainLoader { return 0; } - private static void fixBlocks() { - HashSet<String> modIDs = new HashSet<>(Arrays.asList( - "minecraft", - "IC2", - "gregtech", - Reference.DREAMCRAFT, - Reference.GTPLUSPLUS, - "GT++DarkWorld", - "GalacticraftCore", - "GalacticraftMars", - "GalaxySpace", - "extracells", - "Avaritia", - "avaritiaddons", - "EnderStorage", - "enhancedportals", - "DraconicEvolution", - "IC2NuclearControl", - "IronChest", - "irontank", - "opensecurity", - "openmodularturrets", - "Railcraft", - "RIO", - "SGCraft", - "appliedenergistics2", - "thaumicenergistics", - "witchery", - "lootgames", - "utilityworlds", - Reference.MODID)); - for (Block block : GameData.getBlockRegistry().typeSafeIterable()) { - GameRegistry.UniqueIdentifier uniqueIdentifier = GameRegistry.findUniqueIdentifierFor(block); - if (uniqueIdentifier != null) { - if (block.blockHardness < 0 || modIDs.contains(uniqueIdentifier.modId)) { - continue; - } else if ("OpenBlocks".equals(uniqueIdentifier.modId)) { - if ("grave".equals(uniqueIdentifier.name)) { - continue; - } - } else if ("TwilightForest".equals(uniqueIdentifier.modId)) { - if ("tile.TFShield".equals(uniqueIdentifier.name)) { - block.setResistance(30); - continue; - } else if ("tile.TFThorns".equals(uniqueIdentifier.name)) { - block.setResistance(10); - continue; - } else if ("tile.TFTowerTranslucent".equals(uniqueIdentifier.name)) { - block.setResistance(30); - continue; - } else if ("tile.TFDeadrock".equals(uniqueIdentifier.name)) { - block.setResistance(5); - continue; - } else { - continue; - } - } - } - block.setResistance(5); + private static void safeSetResistance(Block block, float resistance) { + if (block != null) { + block.setResistance(resistance); + } + } + + private static void adjustTwilightBlockResistance() { + if (Loader.isModLoaded("TwilightForest")) { + safeSetResistance(GameRegistry.findBlock("TwilightForest", "tile.TFShield"), 30); + safeSetResistance(GameRegistry.findBlock("TwilightForest", "tile.TFThorns"), 10); + safeSetResistance(GameRegistry.findBlock("TwilightForest", "tile.TFTowerTranslucent"), 30); + safeSetResistance(GameRegistry.findBlock("TwilightForest", "tile.TFDeadrock"), 5); } } } |