2023-10-21 19:28:34 +01:00
|
|
|
package com.myname.mymodid;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
import cpw.mods.fml.common.registry.GameRegistry;
|
2023-10-21 20:49:33 +01:00
|
|
|
import cpw.mods.fml.common.registry.RegistryDelegate;
|
|
|
|
|
import net.minecraft.item.Item;
|
2023-10-21 19:28:34 +01:00
|
|
|
import net.minecraft.item.ItemStack;
|
|
|
|
|
|
|
|
|
|
import java.util.Objects;
|
|
|
|
|
|
|
|
|
|
public class ItemStackKey {
|
2023-10-21 20:49:33 +01:00
|
|
|
private final Item item;
|
2023-10-21 19:28:34 +01:00
|
|
|
private final int meta;
|
|
|
|
|
|
2023-10-21 20:49:33 +01:00
|
|
|
public ItemStackKey(Item item, int meta) {
|
|
|
|
|
this.item = item;
|
2023-10-21 19:28:34 +01:00
|
|
|
this.meta = meta;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@Override
|
|
|
|
|
public boolean equals(Object o) {
|
|
|
|
|
if (o == null || getClass() != o.getClass()) return false;
|
|
|
|
|
ItemStackKey that = (ItemStackKey) o;
|
2023-10-21 20:49:33 +01:00
|
|
|
return (this.meta == that.meta) && Objects.equals(this.item, that.item);
|
2023-10-21 19:28:34 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@Override
|
|
|
|
|
public int hashCode() {
|
2023-10-21 20:49:33 +01:00
|
|
|
return Objects.hash(item, meta);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public int getDamage() {
|
|
|
|
|
return meta;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public RegistryDelegate<Item> getItem() {
|
|
|
|
|
return item.delegate;
|
2023-10-21 19:28:34 +01:00
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|