Deprecation Sweep in DungeonHooks and fixed wildcard in ChestGenHooks remove function.

This commit is contained in:
LexManos 2013-03-13 10:55:08 -07:00
parent ff0340f5b4
commit c471a9a557
2 changed files with 2 additions and 64 deletions

View file

@ -8,6 +8,7 @@ import net.minecraft.util.WeightedRandom;
import net.minecraft.util.WeightedRandomChestContent; import net.minecraft.util.WeightedRandomChestContent;
import net.minecraft.world.WorldServer; import net.minecraft.world.WorldServer;
import net.minecraft.world.gen.structure.*; import net.minecraft.world.gen.structure.*;
import net.minecraftforge.oredict.OreDictionary;
public class ChestGenHooks public class ChestGenHooks
{ {
@ -192,7 +193,7 @@ public class ChestGenHooks
while(itr.hasNext()) while(itr.hasNext())
{ {
WeightedRandomChestContent cont = itr.next(); 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(); itr.remove();
} }

View file

@ -108,67 +108,4 @@ public class DungeonHooks
addDungeonMob("Zombie", 200); addDungeonMob("Zombie", 200);
addDungeonMob("Spider", 100); 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); }
}
} }