Files
Postea/src/main/java/com/myname/mymodid/API/ItemStackKey.java
T

39 lines
789 B
Java
Raw Normal View History

2023-10-21 21:25:10 +01:00
package com.myname.mymodid.API;
2023-10-21 19:28:34 +01:00
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 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) {
2023-10-21 21:35:48 +01:00
if (o == null) return false;
if (o instanceof ItemStackKey that) {
return (this.meta == that.meta) && (this.item == that.item);
} else return false;
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;
}
2023-10-21 21:25:10 +01:00
public Item getItem() {
return item;
2023-10-21 19:28:34 +01:00
}
}