725b7463f0
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.
38 lines
No EOL
695 B
Java
38 lines
No EOL
695 B
Java
package mekanism.api.util;
|
|
|
|
import net.minecraft.block.Block;
|
|
import net.minecraft.item.ItemStack;
|
|
|
|
public class BlockInfo
|
|
{
|
|
public Block block;
|
|
public int meta;
|
|
|
|
public BlockInfo(Block b, int j)
|
|
{
|
|
block = b;
|
|
meta = j;
|
|
}
|
|
|
|
public static BlockInfo get(ItemStack stack)
|
|
{
|
|
return new BlockInfo(Block.getBlockFromItem(stack.getItem()), stack.getItemDamage());
|
|
}
|
|
|
|
@Override
|
|
public boolean equals(Object obj)
|
|
{
|
|
return obj instanceof BlockInfo &&
|
|
((BlockInfo)obj).block == block &&
|
|
((BlockInfo)obj).meta == meta;
|
|
}
|
|
|
|
@Override
|
|
public int hashCode()
|
|
{
|
|
int code = 1;
|
|
code = 31 * code + block.getUnlocalizedName().hashCode();
|
|
code = 31 * code + meta;
|
|
return code;
|
|
}
|
|
} |