1
0
mirror of https://github.com/SquidDev-CC/CC-Tweaked synced 2025-02-09 23:50:04 +00:00

Fix crash when lectern has no item

This should never happen in practice, but might happen when using
/setblock or after world corruption, so let's be careful here.

Closes #2014
This commit is contained in:
Jonathan Coates 2024-11-19 21:35:00 +00:00
parent 1d7d8006d4
commit cddb8fec11
No known key found for this signature in database
GPG Key ID: B9E431FF07C98D06

View File

@ -119,7 +119,7 @@ public final class CustomLecternBlockEntity extends BlockEntity implements MenuP
@Override
public CompoundTag getUpdateTag() {
var tag = super.getUpdateTag();
tag.put(NBT_ITEM, item.save(new CompoundTag()));
if (!item.isEmpty()) tag.put(NBT_ITEM, item.save(new CompoundTag()));
return tag;
}