mirror of
https://github.com/GTNewHorizons/ThaumicBases.git
synced 2026-11-28 07:35:37 +00:00
fix crash-causing negative and zero enchantment levels
This commit is contained in:
1 parent
fa85b073a6
commit
f9f623eee7
1 file changed
+1
-1
@@ -109,7 +109,7 @@ public class TileOverchanter extends TileEntity implements IInventory, IWandable
|
||||
for (int i = 0; i < nbttaglist.tagCount(); ++i) {
|
||||
NBTTagCompound tag = nbttaglist.getCompoundTagAt(i);
|
||||
if (tag != null && Integer.valueOf(tag.getShort("id")) == enchId) {
|
||||
tag.setShort("lvl", (short) (Integer.valueOf(tag.getShort("lvl")) + 1));
|
||||
tag.setShort("lvl", Math.max((short) 1, (short) (Integer.valueOf(tag.getShort("lvl")) + 1)));
|
||||
NBTTagCompound stackTag = MiscUtils.getStackTag(inventory);
|
||||
if (!stackTag.hasKey("overchants")) {
|
||||
stackTag.setIntArray("overchants", new int[] { enchId });
|
||||
|
||||
Reference in new issue
Block a user