mirror of
https://github.com/Minestom/Minestom.git
synced 2024-11-08 03:40:27 +01:00
commit
ae7f804e6a
@ -611,6 +611,32 @@ public abstract class Instance implements BlockModifier, EventHandler, DataConta
|
|||||||
return getBlockData(blockPosition.getX(), blockPosition.getY(), blockPosition.getZ());
|
return getBlockData(blockPosition.getX(), blockPosition.getY(), blockPosition.getZ());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Set the block data at the given position
|
||||||
|
*
|
||||||
|
* @param x the X position
|
||||||
|
* @param y the Y position
|
||||||
|
* @param z the Z position
|
||||||
|
* @param data the data to be set
|
||||||
|
*/
|
||||||
|
public void setBlockData(int x, int y, int z, Data data) {
|
||||||
|
final Chunk chunk = getChunkAt(x, z);
|
||||||
|
Check.notNull(chunk, "The chunk at " + x + ":" + z + " is not loaded");
|
||||||
|
synchronized (chunk) {
|
||||||
|
chunk.setBlockData(x, (byte) y, z, data);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Set the block data at the given position
|
||||||
|
*
|
||||||
|
* @param blockPosition the block position
|
||||||
|
* @param data the data to be set
|
||||||
|
*/
|
||||||
|
public void setBlockData(BlockPosition blockPosition, Data data) {
|
||||||
|
setBlockData(blockPosition.getX(), (byte) blockPosition.getY(), blockPosition.getZ(), data);
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get the chunk at the given position, null if not loaded
|
* Get the chunk at the given position, null if not loaded
|
||||||
*
|
*
|
||||||
|
Loading…
Reference in New Issue
Block a user