Files

96 lines
1.9 KiB
Markdown

# IScriptWorld.testForBlock
[← IScriptWorld](index.md) · [← Master](../../wiki.md)
Parça 3/16 · [önceki](testForBlock-2.md) · [sonraki](testForBlock-4.md)
mappet.createCompound('{Morph:{Settings:{Hands:1b},Name:"blockbuster.fred"},id:"minecraft:blockbuster_model_tile_entity"}'),
mappet.vector3(171, 61, 279),
mappet.vector3(176, 64, 276)
);
getTileEntity
IScriptTileEntity getTileEntity(int x,
int y,
int z)
Get tile entity at given XYZ.
var tile = c.getWorld().getTileEntity(214, 3, 509);
if (tile)
{
c.send("Tile entity at (214, 3, 509) is " + tile.getId());
}
else
{
c.send("There is no tile entity at (214, 3, 509)");
}
hasInventory
boolean hasInventory(int x,
int y,
int z)
Check whether there is an inventory tile entity at given XYZ.
var world = c.getWorld();
if (world.hasInventory(214, 4, 512))
{
var inventory = world.getInventory(214, 4, 512);
inventory.setStack(0, mappet.createItem("minecraft:diamond_hoe"));
c.send("There is a surprise for you in chest at (214, 4, 512) :)");
}
else
{
c.send("There is no chest at (214, 4, 512)...");
}
getInventory
IScriptInventory getInventory(int x,
int y,
int z)
Get inventory tile entity at given XYZ.
var world = c.getWorld();
var inventory = world.getInventory(214, 4, 512);
if (world.hasInventory(214, 4, 512))
{
var inventory = world.getInventory(214, 4, 512);
inventory.clear();
}
Returns:
an inventory at given XYZ, or null if an inventory tile entity isn't present.
isRaining
boolean isRaining()
Check whether it's raining in the world.
var world = c.getWorld();
var pos = c.getSubject().getPosition();
// If it's raining in the world, then drop a diamond
// If not, then drop a dirt block
if (world.isRaining())
{
world.dropItemStack(mappet.createItem("minecraft:diamond"), pos.x, pos.y + 3, pos.z);
}
else