From adca5141f903515c3107698953a27f6497893743 Mon Sep 17 00:00:00 2001 From: Muramasa Date: Wed, 31 Aug 2016 04:47:54 +0100 Subject: [PATCH] fix issue with chest loot on server start --- src/main/java/gregtech/GT_Mod.java | 6 ++++-- .../java/gregtech/api/enums/Materials.java | 2 -- .../loaders/postload/GT_BookAndLootLoader.java | 18 +++++++++--------- 3 files changed, 13 insertions(+), 13 deletions(-) diff --git a/src/main/java/gregtech/GT_Mod.java b/src/main/java/gregtech/GT_Mod.java index 86b144fd..da07060a 100644 --- a/src/main/java/gregtech/GT_Mod.java +++ b/src/main/java/gregtech/GT_Mod.java @@ -39,8 +39,10 @@ import net.minecraft.item.ItemStack; import net.minecraft.item.crafting.CraftingManager; import net.minecraft.item.crafting.FurnaceRecipes; import net.minecraft.item.crafting.IRecipe; +import net.minecraft.util.WeightedRandomChestContent; import net.minecraft.world.World; import net.minecraft.world.biome.BiomeGenBase; +import net.minecraftforge.common.ChestGenHooks; import net.minecraftforge.common.config.Configuration; import net.minecraftforge.fluids.FluidContainerRegistry; import net.minecraftforge.fluids.FluidRegistry; @@ -758,7 +760,7 @@ public class GT_Mod } } GT_Log.out.println("GT_Mod: Dungeon Loot"); - /*for (WeightedRandomChestContent tContent : ChestGenHooks.getInfo("dungeonChest").getItems(new Random())) { + for (WeightedRandomChestContent tContent : ChestGenHooks.getInfo("dungeonChest").getItems(new Random())) { tStacks.add(tContent.theItemId); } for (WeightedRandomChestContent tContent : ChestGenHooks.getInfo("bonusChest").getItems(new Random())) { @@ -787,7 +789,7 @@ public class GT_Mod } for (WeightedRandomChestContent tContent : ChestGenHooks.getInfo("mineshaftCorridor").getItems(new Random())) { tStacks.add(tContent.theItemId); - }*/ + } GT_Log.out.println("GT_Mod: Smelting"); Object tStack; for (Iterator i$ = FurnaceRecipes.smelting().getSmeltingList().values().iterator(); i$.hasNext(); tStacks.add((ItemStack) tStack)) { diff --git a/src/main/java/gregtech/api/enums/Materials.java b/src/main/java/gregtech/api/enums/Materials.java index 5c314ed3..f88baa6b 100644 --- a/src/main/java/gregtech/api/enums/Materials.java +++ b/src/main/java/gregtech/api/enums/Materials.java @@ -1379,7 +1379,6 @@ public class Materials implements IColorModulationContainer, ISubTagContainer { boolean enableAllFrameBoxes = GregTech_API.sMaterialComponents.get("globalcomponents", "enableAllFrameBoxes", false); for (Materials aMaterial : MATERIALS_MAP.values()) { if (aMaterial.mMetaItemSubID >= 0) { - //TODO lens recipes broken? if (aMaterial.mBlastFurnaceTemp <= 1750) aMaterial.mComponents.remove(OrePrefixes.ingotHot);//Moved HotIngot code from GT_MetaGenerated_Item_01 so all this is in once place if (!enableAllSprings && (aMaterial != Materials.Titanium)) aMaterial.mComponents.remove(OrePrefixes.spring); if (!enableAllSmallSprings) aMaterial.mComponents.remove(OrePrefixes.springSmall); @@ -1491,7 +1490,6 @@ public class Materials implements IColorModulationContainer, ISubTagContainer { } public static void initMaterialProperties() { - //TODO Fix multiple subtag entries for some materials? this is due to HashSet not being ordered GT_Mod.gregtechproxy.mChangeHarvestLevels = GregTech_API.sMaterialProperties.get("harvestlevel", "ActivateHarvestLevelChange", false); GT_Mod.gregtechproxy.mMaxHarvestLevel = Math.min(15, GregTech_API.sMaterialProperties.get("harvestlevel", "MaxHarvestLevel",7)); GT_Mod.gregtechproxy.mGraniteHavestLevel = GregTech_API.sMaterialProperties.get("harvestlevel", "GraniteHarvestLevel", 3); diff --git a/src/main/java/gregtech/loaders/postload/GT_BookAndLootLoader.java b/src/main/java/gregtech/loaders/postload/GT_BookAndLootLoader.java index 3e651b28..ee689d3b 100644 --- a/src/main/java/gregtech/loaders/postload/GT_BookAndLootLoader.java +++ b/src/main/java/gregtech/loaders/postload/GT_BookAndLootLoader.java @@ -89,7 +89,7 @@ public class GT_BookAndLootLoader ChestGenHooks.addItem("pyramidJungleChest", new WeightedRandomChestContent(GT_OreDictUnificator.get(OrePrefixes.gem, Materials.GarnetYellow, 1L), 2, 8, 4)); ChestGenHooks.addItem("pyramidJungleDispenser", new WeightedRandomChestContent(new ItemStack(Items.fire_charge, 1), 2, 8, 30)); - ChestGenHooks.addItem("pyramidJungleDispenser", new WeightedRandomChestContent(GT_OreDictUnificator.get(OrePrefixes.arrowGtWood, Materials.DamascusSteel, 1L), 8, 16, 20)); + if (Materials.DamascusSteel.mComponents.contains(OrePrefixes.arrowGtWood)) ChestGenHooks.addItem("pyramidJungleDispenser", new WeightedRandomChestContent(GT_OreDictUnificator.get(OrePrefixes.arrowGtWood, Materials.DamascusSteel, 1L), 8, 16, 20)); ChestGenHooks.addItem("mineshaftCorridor", new WeightedRandomChestContent(GT_OreDictUnificator.get(OrePrefixes.ingot, Materials.Silver, 1L), 1, 4, 12)); @@ -118,16 +118,16 @@ public class GT_BookAndLootLoader ChestGenHooks.addItem("strongholdCrossing", new WeightedRandomChestContent(ItemList.Bottle_Holy_Water.get(1L, new Object[0]), 4, 8, 6)); ChestGenHooks.addItem("strongholdCrossing", new WeightedRandomChestContent(ItemList.McGuffium_239.get(1L, new Object[0]), 1, 1, 10)); - ChestGenHooks.addItem("strongholdCrossing", new WeightedRandomChestContent(GT_OreDictUnificator.get(OrePrefixes.crateGtIngot, Materials.DamascusSteel, 1L), 4, 8, 6)); - ChestGenHooks.addItem("strongholdCrossing", new WeightedRandomChestContent(GT_OreDictUnificator.get(OrePrefixes.crateGtIngot, Materials.Steel, 1L), 8, 16, 12)); - ChestGenHooks.addItem("strongholdCrossing", new WeightedRandomChestContent(GT_OreDictUnificator.get(OrePrefixes.crateGtIngot, Materials.Bronze, 1L), 8, 16, 12)); - ChestGenHooks.addItem("strongholdCrossing", new WeightedRandomChestContent(GT_OreDictUnificator.get(OrePrefixes.crateGtIngot, Materials.Manganese, 1L), 4, 8, 12)); - ChestGenHooks.addItem("strongholdCrossing", new WeightedRandomChestContent(GT_OreDictUnificator.get(OrePrefixes.crateGtDust, Materials.Neodymium, 1L), 4, 8, 6)); - ChestGenHooks.addItem("strongholdCrossing", new WeightedRandomChestContent(GT_OreDictUnificator.get(OrePrefixes.crateGtDust, Materials.Chrome, 1L), 2, 4, 6)); + if (Materials.DamascusSteel.mComponents.contains(OrePrefixes.crateGtIngot)) ChestGenHooks.addItem("strongholdCrossing", new WeightedRandomChestContent(GT_OreDictUnificator.get(OrePrefixes.crateGtIngot, Materials.DamascusSteel, 1L), 4, 8, 6)); + if (Materials.Steel.mComponents.contains(OrePrefixes.crateGtIngot)) ChestGenHooks.addItem("strongholdCrossing", new WeightedRandomChestContent(GT_OreDictUnificator.get(OrePrefixes.crateGtIngot, Materials.Steel, 1L), 8, 16, 12)); + if (Materials.Bronze.mComponents.contains(OrePrefixes.crateGtIngot)) ChestGenHooks.addItem("strongholdCrossing", new WeightedRandomChestContent(GT_OreDictUnificator.get(OrePrefixes.crateGtIngot, Materials.Bronze, 1L), 8, 16, 12)); + if (Materials.Manganese.mComponents.contains(OrePrefixes.crateGtIngot)) ChestGenHooks.addItem("strongholdCrossing", new WeightedRandomChestContent(GT_OreDictUnificator.get(OrePrefixes.crateGtIngot, Materials.Manganese, 1L), 4, 8, 12)); + if (Materials.Neodymium.mComponents.contains(OrePrefixes.crateGtDust)) ChestGenHooks.addItem("strongholdCrossing", new WeightedRandomChestContent(GT_OreDictUnificator.get(OrePrefixes.crateGtDust, Materials.Neodymium, 1L), 4, 8, 6)); + if (Materials.Chrome.mComponents.contains(OrePrefixes.crateGtDust)) ChestGenHooks.addItem("strongholdCrossing", new WeightedRandomChestContent(GT_OreDictUnificator.get(OrePrefixes.crateGtDust, Materials.Chrome, 1L), 2, 4, 6)); ChestGenHooks.addItem("strongholdCorridor", new WeightedRandomChestContent(GT_OreDictUnificator.get(OrePrefixes.toolHeadSword, Materials.DamascusSteel, 1L), 1, 4, 6)); ChestGenHooks.addItem("strongholdCorridor", new WeightedRandomChestContent(GT_OreDictUnificator.get(OrePrefixes.toolHeadAxe, Materials.DamascusSteel, 1L), 1, 4, 6)); - ChestGenHooks.addItem("strongholdCorridor", new WeightedRandomChestContent(GT_OreDictUnificator.get(OrePrefixes.arrowGtWood, Materials.DamascusSteel, 1L), 16, 48, 6)); - ChestGenHooks.addItem("strongholdCorridor", new WeightedRandomChestContent(GT_OreDictUnificator.get(OrePrefixes.arrowGtWood, Materials.SterlingSilver, 1L), 8, 24, 6)); + if (Materials.DamascusSteel.mComponents.contains(OrePrefixes.arrowGtWood)) ChestGenHooks.addItem("strongholdCorridor", new WeightedRandomChestContent(GT_OreDictUnificator.get(OrePrefixes.arrowGtWood, Materials.DamascusSteel, 1L), 16, 48, 6)); + if (Materials.SterlingSilver.mComponents.contains(OrePrefixes.arrowGtWood)) ChestGenHooks.addItem("strongholdCorridor", new WeightedRandomChestContent(GT_OreDictUnificator.get(OrePrefixes.arrowGtWood, Materials.SterlingSilver, 1L), 8, 24, 6)); } }