mirror of
https://github.com/Minestom/Minestom.git
synced 2025-01-14 12:11:27 +01:00
Fixed custom block removal when breaking it
This commit is contained in:
parent
d96bf48eb2
commit
9b465830e0
@ -84,6 +84,17 @@ public class Chunk implements Viewable {
|
|||||||
setBlock(x, y, z, visualBlockId, customBlock.getCustomBlockId(), data, updateConsumer);
|
setBlock(x, y, z, visualBlockId, customBlock.getCustomBlockId(), data, updateConsumer);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void UNSAFE_removeCustomBlock(int x, int y, int z) {
|
||||||
|
this.customBlocksId[getBlockIndex(x, y, z)] = 0; // Set to none
|
||||||
|
int index = SerializerUtils.coordToChunkIndex(x, y, z);
|
||||||
|
this.blocksData.remove(index);
|
||||||
|
|
||||||
|
this.updatableBlocks.remove(index);
|
||||||
|
this.updatableBlocksLastUpdate.remove(index);
|
||||||
|
|
||||||
|
this.blockEntities.remove(index);
|
||||||
|
}
|
||||||
|
|
||||||
private void setBlock(int x, int y, int z, short blockId, short customId, Data data, UpdateConsumer updateConsumer) {
|
private void setBlock(int x, int y, int z, short blockId, short customId, Data data, UpdateConsumer updateConsumer) {
|
||||||
int index = SerializerUtils.coordToChunkIndex(x, y, z);
|
int index = SerializerUtils.coordToChunkIndex(x, y, z);
|
||||||
if (blockId != 0
|
if (blockId != 0
|
||||||
|
@ -119,7 +119,7 @@ public class InstanceContainer extends Instance {
|
|||||||
if (previousBlock != null) {
|
if (previousBlock != null) {
|
||||||
Data previousData = chunk.getData(index);
|
Data previousData = chunk.getData(index);
|
||||||
previousBlock.onDestroy(this, blockPosition, previousData);
|
previousBlock.onDestroy(this, blockPosition, previousData);
|
||||||
chunk.UNSAFE_setCustomBlock(blockPosition.getX(), blockPosition.getY(), blockPosition.getZ(), Block.AIR.getBlockId(), (short) 0, null);
|
chunk.UNSAFE_removeCustomBlock(blockPosition.getX(), blockPosition.getY(), blockPosition.getZ());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user