cn.nukkit.level.particle.SmokeParticle Java Examples

The following examples show how to use cn.nukkit.level.particle.SmokeParticle. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: EntityMinecartAbstract.java    From Jupiter with GNU General Public License v3.0 5 votes vote down vote up
@Override
public void close() {
    super.close();

    if (linkedEntity instanceof Player) {
        linkedEntity.riding = null;
        linkedEntity = null;
    }

    SmokeParticle particle = new SmokeParticle(this);
    level.addParticle(particle);
}
 
Example #2
Source File: EntityBoat.java    From Jupiter with GNU General Public License v3.0 5 votes vote down vote up
@Override
public void close() {
    super.close();

    if (this.linkedEntity instanceof Player) {
        this.linkedEntity.riding = null;
    }

    SmokeParticle particle = new SmokeParticle(this);
    this.level.addParticle(particle);
}
 
Example #3
Source File: BlockLiquid.java    From Jupiter with GNU General Public License v3.0 5 votes vote down vote up
/**
 * Creates fizzing sound and smoke. Used when lava flows over block or mixes with water.
 */
protected void triggerLavaMixEffects(Vector3 pos) {
    this.getLevel().addSound(new FizzSound(pos.add(0.5, 0.5, 0.5), 2.6F + (ThreadLocalRandom.current().nextFloat() - ThreadLocalRandom.current().nextFloat()) * 0.8F));

    for (int i = 0; i < 8; ++i) {
        this.getLevel().addParticle(new SmokeParticle(pos.add(Math.random(), 1.2, Math.random())));
    }
}
 
Example #4
Source File: EntityMinecartAbstract.java    From Nukkit with GNU General Public License v3.0 5 votes vote down vote up
@Override
public void close() {
    super.close();

    for (cn.nukkit.entity.Entity entity : passengers) {
        if (entity instanceof Player) {
            entity.riding = null;
        }
    }

    SmokeParticle particle = new SmokeParticle(this);
    level.addParticle(particle);
}
 
Example #5
Source File: EntityBoat.java    From Nukkit with GNU General Public License v3.0 5 votes vote down vote up
@Override
public void close() {
    super.close();

    for (Entity linkedEntity : this.passengers) {
        linkedEntity.riding = null;
    }

    SmokeParticle particle = new SmokeParticle(this);
    this.level.addParticle(particle);
}
 
Example #6
Source File: BlockSponge.java    From Nukkit with GNU General Public License v3.0 5 votes vote down vote up
@Override
public boolean place(Item item, Block block, Block target, BlockFace face, double fx, double fy, double fz, Player player) {
    Level level = block.getLevel();
    boolean blockSet = level.setBlock(block, this);

    if (blockSet) {
        if (this.getDamage() == WET && level.getDimension() == Level.DIMENSION_NETHER) {
            level.setBlock(block, Block.get(BlockID.SPONGE, DRY));
            this.getLevel().addSound(block.getLocation(), Sound.RANDOM_FIZZ);

            for (int i = 0; i < 8; ++i) {
                this.getLevel().addParticle(
                    //TODO: Use correct smoke particle
                    new SmokeParticle(block.getLocation().add(Math.random(), 1, Math.random())));
            }
        } else if (this.getDamage() == DRY && performWaterAbsorb(block)) {
            level.setBlock(block, Block.get(BlockID.SPONGE, WET));

            for (int i = 0; i < 4; i++) {
                LevelEventPacket packet = new LevelEventPacket();
                packet.evid = 2001;
                packet.x = (float) block.getX();
                packet.y = (float) block.getY();
                packet.z = (float) block.getZ();
                packet.data = GlobalBlockPalette.getOrCreateRuntimeId(BlockID.WATER, 0);
                level.addChunkPacket(getChunkX(), getChunkZ(), packet);
            }
        }
    }
    return blockSet;
}
 
Example #7
Source File: BlockLiquid.java    From Nukkit with GNU General Public License v3.0 5 votes vote down vote up
protected void triggerLavaMixEffects(Vector3 pos) {
    this.getLevel().addSound(pos.add(0.5, 0.5, 0.5), Sound.RANDOM_FIZZ, 1, 2.6F + (ThreadLocalRandom.current().nextFloat() - ThreadLocalRandom.current().nextFloat()) * 0.8F);

    for (int i = 0; i < 8; ++i) {
        this.getLevel().addParticle(new SmokeParticle(pos.add(Math.random(), 1.2, Math.random())));
    }
}
 
Example #8
Source File: EntityMinecartAbstract.java    From Nukkit with GNU General Public License v3.0 5 votes vote down vote up
@Override
public void close() {
    super.close();

    if (linkedEntity instanceof Player) {
        linkedEntity.riding = null;
        linkedEntity = null;
    }

    SmokeParticle particle = new SmokeParticle(this);
    level.addParticle(particle);
}
 
Example #9
Source File: EntityBoat.java    From Nukkit with GNU General Public License v3.0 5 votes vote down vote up
@Override
public void close() {
    super.close();

    if (this.linkedEntity instanceof Player) {
        this.linkedEntity.riding = null;
    }

    SmokeParticle particle = new SmokeParticle(this);
    this.level.addParticle(particle);
}
 
Example #10
Source File: BlockLiquid.java    From Nukkit with GNU General Public License v3.0 5 votes vote down vote up
/**
 * Creates fizzing sound and smoke. Used when lava flows over block or mixes with water.
 */
protected void triggerLavaMixEffects(Vector3 pos) {
    this.getLevel().addSound(pos.add(0.5, 0.5, 0.5), Sound.RANDOM_FIZZ, 1, 2.6F + (ThreadLocalRandom.current().nextFloat() - ThreadLocalRandom.current().nextFloat()) * 0.8F);

    for (int i = 0; i < 8; ++i) {
        this.getLevel().addParticle(new SmokeParticle(pos.add(Math.random(), 1.2, Math.random())));
    }
}