93 lines
1.9 KiB
Markdown
93 lines
1.9 KiB
Markdown
# IScriptWorld.testForBlock
|
|
|
|
[← IScriptWorld](index.md) · [← Master](../../wiki.md)
|
|
|
|
Parça 2/16 · [önceki](testForBlock.md) · [sonraki](testForBlock-3.md)
|
|
|
|
|
|
void removeBlock(int x,
|
|
int y,
|
|
int z)
|
|
|
|
Remove a block at given XYZ.
|
|
|
|
c.getWorld().removeBlock(214, 3, 509);
|
|
|
|
|
|
getBlock
|
|
|
|
IScriptBlockState getBlock(int x,
|
|
int y,
|
|
int z)
|
|
|
|
Get block state at given XYZ.
|
|
|
|
var block = c.getWorld().getBlock(214, 3, 509);
|
|
|
|
c.send("Block at (214, 3, 509) is " + block.getBlockId());
|
|
|
|
|
|
Returns:
|
|
a block state at given XYZ, or null if the chunk isn't loaded
|
|
|
|
getBlock
|
|
|
|
IScriptBlockState getBlock(ScriptVector pos)
|
|
|
|
Get block state at given XYZ.
|
|
|
|
var block = c.getWorld().getBlock(mappet.vector3(214, 3, 509));
|
|
|
|
c.send("Block at (214, 3, 509) is " + block.getBlockId());
|
|
|
|
|
|
Returns:
|
|
a block state at given XYZ, or null if the chunk isn't loaded
|
|
|
|
hasTileEntity
|
|
|
|
boolean hasTileEntity(int x,
|
|
int y,
|
|
int z)
|
|
|
|
Whether a tile entity is present at given XYZ.
|
|
|
|
function main(c)
|
|
{
|
|
var hasTileEntity = c.getWorld().hasTileEntity(0, 80, 0)
|
|
|
|
c.send(hasTileEntity)
|
|
}
|
|
|
|
|
|
replaceBlocks
|
|
|
|
void replaceBlocks(IScriptBlockState blockToBeReplaced,
|
|
IScriptBlockState newBlock,
|
|
Vector3d pos1,
|
|
Vector3d pos2)
|
|
|
|
Replace all blocks in the given area with the given block state.
|
|
|
|
c.getWorld().replaceBlocks(
|
|
mappet.createBlockState("minecraft:dirt", 0),
|
|
mappet.createBlockState("minecraft:dirt", 1),
|
|
mappet.vector3(214, 3, 509),
|
|
mappet.vector3(214, 3, 509)
|
|
);
|
|
|
|
|
|
replaceBlocks
|
|
|
|
void replaceBlocks(IScriptBlockState blockToBeReplaced,
|
|
IScriptBlockState newBlock,
|
|
INBTCompound tileData,
|
|
Vector3d pos1,
|
|
Vector3d pos2)
|
|
|
|
Replace all blocks in the given area with the given block state and tile entity data.
|
|
|
|
c.getWorld().replaceBlocks(
|
|
mappet.createBlockState("minecraft:dirt", 0),
|
|
mappet.createBlockState("blockbuster:model", 0),
|