Fix out of bounds on invalid enum items
This commit is contained in:
parent
58d9678c40
commit
8dce592787
|
@ -42,7 +42,7 @@ public class ItemEnum<T extends Enum<T> & ISubItem> extends Item {
|
||||||
}
|
}
|
||||||
|
|
||||||
public T getItemType(ItemStack stack) {
|
public T getItemType(ItemStack stack) {
|
||||||
return types[MathHelper.clamp(stack.getItemDamage(), 0, types.length)];
|
return types[MathHelper.clamp(stack.getItemDamage(), 0, types.length - 1)];
|
||||||
}
|
}
|
||||||
|
|
||||||
public static class Variant<T extends Enum<T> & ISubItem> extends ItemEnum<T> implements IVariantProvider {
|
public static class Variant<T extends Enum<T> & ISubItem> extends ItemEnum<T> implements IVariantProvider {
|
||||||
|
|
Loading…
Reference in a new issue