mirror of
https://github.com/Minestom/Minestom.git
synced 2025-01-07 00:48:28 +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);
|
final int index = ChunkUtils.getBlockIndex(x, y, z);
|
||||||
// Handler
|
// Handler
|
||||||
final BlockHandler handler = block.handler();
|
final BlockHandler handler = block.handler();
|
||||||
final NBTCompound nbt = block.nbt();
|
if (handler != null || block.hasNbt()) {
|
||||||
if (handler != null || nbt != null) {
|
|
||||||
this.entries.put(index, block);
|
this.entries.put(index, block);
|
||||||
} else {
|
} else {
|
||||||
this.entries.remove(index);
|
this.entries.remove(index);
|
||||||
|
@ -97,6 +97,9 @@ public interface Block extends ProtocolObject, TagReadable, BlockConstants {
|
|||||||
return getTag(Tag.NBT);
|
return getTag(Tag.NBT);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Contract(pure = true)
|
||||||
|
boolean hasNbt();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns the block handler.
|
* Returns the block handler.
|
||||||
*
|
*
|
||||||
|
@ -65,6 +65,11 @@ class BlockImpl implements Block {
|
|||||||
return new BlockImpl(registry, properties, nbt, handler);
|
return new BlockImpl(registry, properties, nbt, handler);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean hasNbt() {
|
||||||
|
return nbt != null && nbt.getSize() > 0;
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public @Nullable BlockHandler handler() {
|
public @Nullable BlockHandler handler() {
|
||||||
return handler;
|
return handler;
|
||||||
|
Loading…
Reference in New Issue
Block a user