From a7cedacda956ca10fbc4e363d848ad820b148b85 Mon Sep 17 00:00:00 2001 From: gamma-delta <29877714+gamma-delta@users.noreply.github.com> Date: Sat, 2 Apr 2022 12:21:15 -0500 Subject: [PATCH] syncing still dont work --- .../blocks/akashic/BlockEntityAkashicBookshelf.java | 9 ++++++--- .../common/blocks/akashic/BlockEntityAkashicRecord.java | 2 +- 2 files changed, 7 insertions(+), 4 deletions(-) diff --git a/src/main/java/at/petrak/hexcasting/common/blocks/akashic/BlockEntityAkashicBookshelf.java b/src/main/java/at/petrak/hexcasting/common/blocks/akashic/BlockEntityAkashicBookshelf.java index a793c6bb..7bcf3fbb 100644 --- a/src/main/java/at/petrak/hexcasting/common/blocks/akashic/BlockEntityAkashicBookshelf.java +++ b/src/main/java/at/petrak/hexcasting/common/blocks/akashic/BlockEntityAkashicBookshelf.java @@ -38,11 +38,10 @@ public class BlockEntityAkashicBookshelf extends PaucalBlockEntity { this.recordPos = recordPos; this.pattern = pattern; - this.setChanged(); var oldBs = this.getBlockState(); var newBs = oldBs.setValue(BlockAkashicBookshelf.DATUM_TYPE, type); - this.level.setBlockAndUpdate(this.getBlockPos(), newBs); - this.level.sendBlockUpdated(this.getBlockPos(), oldBs, newBs, 3); + this.level.setBlock(this.getBlockPos(), newBs, 3); + this.sync(); } @Override @@ -60,9 +59,13 @@ public class BlockEntityAkashicBookshelf extends PaucalBlockEntity { protected void loadModData(CompoundTag compoundTag) { if (compoundTag.contains(TAG_RECORD_POS)) { this.recordPos = NbtUtils.readBlockPos(compoundTag.getCompound(TAG_RECORD_POS)); + } else { + this.recordPos = null; } if (compoundTag.contains(TAG_PATTERN)) { this.pattern = HexPattern.DeserializeFromNBT(compoundTag.getCompound(TAG_PATTERN)); + } else { + this.pattern = null; } } diff --git a/src/main/java/at/petrak/hexcasting/common/blocks/akashic/BlockEntityAkashicRecord.java b/src/main/java/at/petrak/hexcasting/common/blocks/akashic/BlockEntityAkashicRecord.java index 98169e92..be14ae60 100644 --- a/src/main/java/at/petrak/hexcasting/common/blocks/akashic/BlockEntityAkashicRecord.java +++ b/src/main/java/at/petrak/hexcasting/common/blocks/akashic/BlockEntityAkashicRecord.java @@ -145,8 +145,8 @@ public class BlockEntityAkashicRecord extends PaucalBlockEntity { @Override protected void loadModData(CompoundTag compoundTag) { var lookupTag = compoundTag.getCompound(TAG_LOOKUP); - var sigs = lookupTag.getAllKeys(); + this.entries.clear(); for (var sig : sigs) { var entryTag = lookupTag.getCompound(sig); var pos = NbtUtils.readBlockPos(entryTag.getCompound(TAG_POS));