77 lines
1.9 KiB
Markdown
77 lines
1.9 KiB
Markdown
# IScriptWorld.testForBlock
|
|
|
|
[← IScriptWorld](index.md) · [← Master](../../wiki.md)
|
|
|
|
Parça 7/16 · [önceki](testForBlock-6.md) · [sonraki](testForBlock-8.md)
|
|
|
|
java.lang.String state,
|
|
double x,
|
|
double y,
|
|
double z)
|
|
|
|
Spawn an NPC at given position with given state.
|
|
|
|
var pos = c.getSubject().getPosition();
|
|
|
|
c.getWorld().spawnNpc("herobrine", "dabbing", pos.x, pos.y, pos.z);
|
|
|
|
|
|
spawnNpc
|
|
|
|
IScriptNpc spawnNpc(java.lang.String id,
|
|
java.lang.String state,
|
|
double x,
|
|
double y,
|
|
double z,
|
|
float yaw,
|
|
float pitch,
|
|
float headYaw)
|
|
|
|
Spawn an NPC at given position with given state and rotation.
|
|
|
|
var pos = c.getSubject().getPosition();
|
|
|
|
c.getWorld().spawnNpc("herobrine", "dabbing", pos.x, pos.y, pos.z, 0, 0, 0);
|
|
|
|
|
|
getEntities
|
|
|
|
java.util.List<IScriptEntity> getEntities(double x1,
|
|
double y1,
|
|
double z1,
|
|
double x2,
|
|
double y2,
|
|
double z2)
|
|
|
|
Get entities within the box specified by given coordinates in this world. This method limits to scanning entities only within 100 blocks in any direction. If the box provided has
|
|
any of its sizes that is longer than 100 blocks, then it will simply return an empty list.
|
|
|
|
// Y position is at the feet, while X and Z is at center
|
|
var pos = c.getSubject().getPosition();
|
|
var entities = c.getWorld().getEntities(pos.x - 2, pos.y - 1, pos.z - 2, pos.x + 2, pos.y + 3, pos.z + 2);
|
|
|
|
for (var i in entities)
|
|
{
|
|
var entity = entities[i];
|
|
|
|
if (!entity.isSame(c.getSubject()))
|
|
{
|
|
entity.damage(2.0);
|
|
}
|
|
}
|
|
|
|
|
|
getEntities
|
|
|
|
java.util.List<IScriptEntity> getEntities(double x1,
|
|
double y1,
|
|
double z1,
|
|
double x2,
|
|
double y2,
|
|
double z2,
|
|
boolean ignoreVolumeLimit)
|
|
|
|
Get entities within the box specified by given coordinates in this world ignoring the volume limit. This method does not limit to scanning entities only within 100 blocks
|
|
|
|
// Y position is at the feet, while X and Z is at center
|