[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 b37f3a6ba5
commit 73fdfd31c2
2 changed files with 5 additions and 1 deletions

View file

@ -38,7 +38,10 @@ public class EternalPedestalEntity extends PedestalBlockEntity {
@Override @Override
public void saveAdditional(CompoundTag tag) { public void saveAdditional(CompoundTag tag) {
if (hasRitual()) { 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); super.saveAdditional(tag);
} }

View file

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