Prevent a cover read crash.

This commit is contained in:
raoulvdberge
2018-07-11 21:20:20 +02:00
parent 4a2634586a
commit 7e0e317598

View File

@@ -92,6 +92,10 @@ public class CoverManager {
ItemStack item = new ItemStack(tag.getCompoundTag(NBT_ITEM));
int type = tag.hasKey(NBT_TYPE) ? tag.getInteger(NBT_TYPE) : 0;
if (type >= CoverType.values().length) {
type = 0;
}
if (isValidCover(item)) {
covers.put(direction, new Cover(item, CoverType.values()[type]));
}