From c471a9a5571879a32ddf3a7cad909315673495c1 Mon Sep 17 00:00:00 2001 From: LexManos Date: Wed, 13 Mar 2013 10:55:08 -0700 Subject: [PATCH] Deprecation Sweep in DungeonHooks and fixed wildcard in ChestGenHooks remove function. --- .../minecraftforge/common/ChestGenHooks.java | 3 +- .../minecraftforge/common/DungeonHooks.java | 63 ------------------- 2 files changed, 2 insertions(+), 64 deletions(-) diff --git a/common/net/minecraftforge/common/ChestGenHooks.java b/common/net/minecraftforge/common/ChestGenHooks.java index b48ca33d2..7ce6d6654 100644 --- a/common/net/minecraftforge/common/ChestGenHooks.java +++ b/common/net/minecraftforge/common/ChestGenHooks.java @@ -8,6 +8,7 @@ import net.minecraft.util.WeightedRandom; import net.minecraft.util.WeightedRandomChestContent; import net.minecraft.world.WorldServer; import net.minecraft.world.gen.structure.*; +import net.minecraftforge.oredict.OreDictionary; public class ChestGenHooks { @@ -192,7 +193,7 @@ public class ChestGenHooks while(itr.hasNext()) { WeightedRandomChestContent cont = itr.next(); - if (item.isItemEqual(cont.theItemId) || (item.getItemDamage() == -1 && item.itemID == cont.theItemId.itemID)) + if (item.isItemEqual(cont.theItemId) || (item.getItemDamage() == OreDictionary.WILDCARD_VALUE && item.itemID == cont.theItemId.itemID)) { itr.remove(); } diff --git a/common/net/minecraftforge/common/DungeonHooks.java b/common/net/minecraftforge/common/DungeonHooks.java index 09f6ff6db..b8da1955d 100644 --- a/common/net/minecraftforge/common/DungeonHooks.java +++ b/common/net/minecraftforge/common/DungeonHooks.java @@ -108,67 +108,4 @@ public class DungeonHooks addDungeonMob("Zombie", 200); addDungeonMob("Spider", 100); } - - - @Deprecated //Moved to ChestGenHooks - public static void setDungeonLootTries(int number) - { - ChestGenHooks.getInfo(DUNGEON_CHEST).setMax(number); - ChestGenHooks.getInfo(DUNGEON_CHEST).setMin(number); - } - @Deprecated //Moved to ChestGenHooks - public static int getDungeonLootTries() { return ChestGenHooks.getInfo(DUNGEON_CHEST).getMax(); } - @Deprecated //Moved to ChestGenHooks - public void addDungeonLoot(DungeonLoot loot){ ChestGenHooks.getInfo(DUNGEON_CHEST).addItem(loot); } - @Deprecated //Moved to ChestGenHooks - public boolean removeDungeonLoot(DungeonLoot loot){ return ChestGenHooks.getInfo(DUNGEON_CHEST).contents.remove(loot); } - @Deprecated //Moved to ChestGenHooks - public static void addDungeonLoot(ItemStack item, int rarity){ addDungeonLoot(item, rarity, 1, 1); } - @Deprecated //Moved to ChestGenHooks - public static float addDungeonLoot(ItemStack item, int rarity, int minCount, int maxCount) - { - ChestGenHooks.addDungeonLoot(ChestGenHooks.getInfo(DUNGEON_CHEST), item, rarity, minCount, maxCount); - return rarity; - } - @Deprecated //Moved to ChestGenHooks - public static void removeDungeonLoot(ItemStack item){ ChestGenHooks.removeItem(DUNGEON_CHEST, item); } - @Deprecated //Moved to ChestGenHooks - public static void removeDungeonLoot(ItemStack item, int minCount, int maxCount){ ChestGenHooks.removeItem(DUNGEON_CHEST, item); } - @Deprecated //Moved to ChestGenHooks - public static ItemStack getRandomDungeonLoot(Random rand){ return ChestGenHooks.getOneItem(DUNGEON_CHEST, rand); } - - @Deprecated //Moved to ChestGenHooks - public static class DungeonLoot extends WeightedRandomChestContent - { - @Deprecated - public DungeonLoot(int weight, ItemStack item, int min, int max) - { - super(item, weight, min, max); - } - - @Deprecated - public ItemStack generateStack(Random rand) - { - int min = theMinimumChanceToGenerateItem; - int max = theMaximumChanceToGenerateItem; - - ItemStack ret = this.theItemId.copy(); - ret.stackSize = min + (rand.nextInt(max - min + 1)); - return ret; - } - - @Override - protected final ItemStack[] generateChestContent(Random random, IInventory newInventory) - { - FMLLog.warning("Some mod is still using DungeonHooks.DungonLoot, tell them to stop! %s", this); - return new ItemStack[] { generateStack(random) }; - } - public boolean equals(ItemStack item, int min, int max) - { - int minCount = theMinimumChanceToGenerateItem; - int maxCount = theMaximumChanceToGenerateItem; - return (min == minCount && max == maxCount && item.isItemEqual(theItemId) && ItemStack.areItemStackTagsEqual(item, theItemId)); - } - public boolean equals(ItemStack item){ return item.isItemEqual(theItemId) && ItemStack.areItemStackTagsEqual(item, theItemId); } - } }