Fix block entity without position

This commit is contained in:
shedaniel
2021-02-23 23:08:38 +08:00
parent 5613937011
commit c0c496007e

View File

@@ -42,7 +42,9 @@ public interface MixinBlockEntityExtension extends BlockEntityClientSerializable
default void fromClientTag(CompoundTag tag) {
BlockEntity entity = (BlockEntity) this;
if (entity.hasLevel()) {
entity.setLevelAndPosition(entity.getLevel(), new BlockPos(tag.getInt("x"), tag.getInt("y"), tag.getInt("z")));
if (tag.contains("x") && tag.contains("y") && tag.contains("z")) {
entity.setLevelAndPosition(entity.getLevel(), new BlockPos(tag.getInt("x"), tag.getInt("y"), tag.getInt("z")));
}
loadClientData(entity.getBlockState(), tag);
}
}