mirror of
https://github.com/Minestom/Minestom.git
synced 2025-01-02 14:38:26 +01:00
Prevent nbt copy when placing a block
This commit is contained in:
parent
4abc6dd9eb
commit
99d4682655
@ -55,8 +55,7 @@ public class DynamicChunk extends Chunk {
|
||||
final int index = ChunkUtils.getBlockIndex(x, y, z);
|
||||
// Handler
|
||||
final BlockHandler handler = block.handler();
|
||||
final NBTCompound nbt = block.nbt();
|
||||
if (handler != null || nbt != null) {
|
||||
if (handler != null || block.hasNbt()) {
|
||||
this.entries.put(index, block);
|
||||
} else {
|
||||
this.entries.remove(index);
|
||||
|
@ -97,6 +97,9 @@ public interface Block extends ProtocolObject, TagReadable, BlockConstants {
|
||||
return getTag(Tag.NBT);
|
||||
}
|
||||
|
||||
@Contract(pure = true)
|
||||
boolean hasNbt();
|
||||
|
||||
/**
|
||||
* Returns the block handler.
|
||||
*
|
||||
|
@ -65,6 +65,11 @@ class BlockImpl implements Block {
|
||||
return new BlockImpl(registry, properties, nbt, handler);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean hasNbt() {
|
||||
return nbt != null && nbt.getSize() > 0;
|
||||
}
|
||||
|
||||
@Override
|
||||
public @Nullable BlockHandler handler() {
|
||||
return handler;
|
||||
|
Loading…
Reference in New Issue
Block a user