106 lines
1.9 KiB
Markdown
106 lines
1.9 KiB
Markdown
# IScriptWorld.testForBlock
|
|
|
|
[← IScriptWorld](index.md) · [← Master](../../wiki.md)
|
|
|
|
Parça 4/16 · [önceki](testForBlock-3.md) · [sonraki](testForBlock-5.md)
|
|
|
|
{
|
|
world.dropItemStack(mappet.createItem("minecraft:dirt"), pos.x, pos.y + 3, pos.z);
|
|
}
|
|
|
|
|
|
setRaining
|
|
|
|
void setRaining(boolean raining)
|
|
|
|
Set raining state.
|
|
|
|
c.getWorld().setRaining(true);
|
|
c.send("The ritual dance got successfully completed!");
|
|
|
|
|
|
getTime
|
|
|
|
long getTime()
|
|
|
|
Get current time of day (the one that is set by /time set command).
|
|
|
|
if (c.getWorld().getTime() % 24000 > 12000)
|
|
{
|
|
c.getSubject().send("Good night!");
|
|
}
|
|
else
|
|
{
|
|
c.getSubject().send("Good day!");
|
|
}
|
|
|
|
|
|
setTime
|
|
|
|
void setTime(long time)
|
|
|
|
Set current time of day.
|
|
|
|
c.getWorld().setTime(14000);
|
|
c.send("Another ritual dance got successfully completed!");
|
|
|
|
|
|
getTotalTime
|
|
|
|
long getTotalTime()
|
|
|
|
Get total time that this world existed for (in ticks).
|
|
|
|
if (c.getWorld().getTotalTime() > 20 * 600)
|
|
{
|
|
c.send("You had only 10 minutes to complete the map...");
|
|
c.send("Initiating SELF-DESTRUCT mode!");
|
|
|
|
// TODO: implement self-destruction
|
|
}
|
|
|
|
|
|
getDimensionId
|
|
|
|
int getDimensionId()
|
|
|
|
Get world's dimension ID.
|
|
|
|
if (c.getWorld().getDimensionId() == 0)
|
|
{
|
|
c.getSubject().send("You're in overworld!");
|
|
}
|
|
else
|
|
{
|
|
c.getSubject().send("*shrugs*");
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
spawnParticles
|
|
|
|
void spawnParticles(EnumParticleTypes type,
|
|
boolean longDistance,
|
|
double x,
|
|
double y,
|
|
double z,
|
|
int n,
|
|
double dx,
|
|
double dy,
|
|
double dz,
|
|
double speed,
|
|
int... args)
|
|
|
|
Spawn vanilla particles.
|
|
|
|
var explode = mappet.getParticleType("explode");
|
|
var pos = c.getSubject().getPosition();
|
|
|
|
c.getWorld().spawnParticles(explode, false, pos.x, pos.y, pos.z, 10, 0.1, 0.1, 0.1, 0.1);
|
|
|
|
|
|
Parameters:
|
|
type - Particle type, you can use IScriptFactory.getParticleType(String) to get the desired particle type.
|