use of cn.nukkit.entity.item.EntityPrimedTNT in project Nukkit by Nukkit.
the class BlockTNT method prime.
public void prime(int fuse) {
this.getLevel().setBlock(this, new BlockAir(), true);
double mot = (new NukkitRandom()).nextSignedFloat() * Math.PI * 2;
CompoundTag nbt = new CompoundTag().putList(new ListTag<DoubleTag>("Pos").add(new DoubleTag("", this.x + 0.5)).add(new DoubleTag("", this.y)).add(new DoubleTag("", this.z + 0.5))).putList(new ListTag<DoubleTag>("Motion").add(new DoubleTag("", -Math.sin(mot) * 0.02)).add(new DoubleTag("", 0.2)).add(new DoubleTag("", -Math.cos(mot) * 0.02))).putList(new ListTag<FloatTag>("Rotation").add(new FloatTag("", 0)).add(new FloatTag("", 0))).putShort("Fuse", fuse);
Entity tnt = new EntityPrimedTNT(this.getLevel().getChunk(this.getFloorX() >> 4, this.getFloorZ() >> 4), nbt);
tnt.spawnToAll();
this.level.addSound(this, Sound.RANDOM_FUSE);
}
Aggregations