[Fixed] Crash when placing an eternal Crystal with no portal blocks in range (#323)

This commit is contained in:
Frank 2023-12-20 16:36:07 +01:00
parent 964671317a
commit fe0f3dd210
2 changed files with 5 additions and 1 deletions

View file

@ -38,7 +38,10 @@ public class EternalPedestalEntity extends PedestalBlockEntity {
@Override
public void saveAdditional(CompoundTag tag) {
if (hasRitual()) {
tag.put("ritual", linkedRitual.toTag(new CompoundTag()));
final CompoundTag ritualTag = linkedRitual.toTag(new CompoundTag());
if (ritualTag != null) {
tag.put("ritual", ritualTag);
}
}
super.saveAdditional(tag);
}

View file

@ -488,6 +488,7 @@ public class EternalRitual {
}
public CompoundTag toTag(CompoundTag tag) {
if (this.center == null || this.axis == null || this.exit == null) return null;
tag.put("center", NbtUtils.writeBlockPos(center));
tag.putString("axis", axis.getName());
tag.putBoolean("active", active);