Files
Mekanism-Community-Edition/src/main/java/mekanism/api/util/ItemInfo.java
T
Ben Spiers 725b7463f0 Make the mod classes significantly less godlike.
Move Config variables into their own class, (in api because other stuff in API references config, may make sense to move it back to common later), and move Blocks and Items into final variables in their own classes. It looks a lot cleaner this way and my OCD can finally rest now.
2014-08-01 01:35:06 +01:00

39 lines
657 B
Java

package mekanism.api.util;
import net.minecraft.item.Item;
import net.minecraft.item.ItemStack;
public class ItemInfo
{
public Item item;
public int meta;
public ItemInfo(Item i, int j)
{
item = i;
meta = j;
}
public static ItemInfo get(ItemStack stack)
{
return new ItemInfo(stack.getItem(), stack.getItemDamage());
}
@Override
public boolean equals(Object obj)
{
return obj instanceof BlockInfo &&
((ItemInfo)obj).item == item &&
((ItemInfo)obj).meta == meta;
}
@Override
public int hashCode()
{
int code = 1;
code = 31 * code + item.getUnlocalizedName().hashCode();
code = 31 * code + meta;
return code;
}
}