cn.nukkit.level.particle.SpellParticle Java Examples

The following examples show how to use cn.nukkit.level.particle.SpellParticle. 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: EntityExpBottle.java    From Jupiter with GNU General Public License v3.0 5 votes vote down vote up
@Override
public boolean onUpdate(int currentTick) {
    if (this.closed) {
        return false;
    }

    this.timing.startTiming();

    int tickDiff = currentTick - this.lastUpdate;
    boolean hasUpdate = super.onUpdate(currentTick);

    if (this.age > 1200) {
        this.kill();
        hasUpdate = true;
    }

    if (this.isCollided) {
        this.kill();
        Particle particle1 = new EnchantParticle(this);
        this.getLevel().addParticle(particle1);
        Particle particle2 = new SpellParticle(this, 0x00385dc6);
        this.getLevel().addParticle(particle2);
        hasUpdate = true;

        NukkitRandom random = new NukkitRandom();
        int add = 1;
        for (int ii = 1; ii <= random.nextRange(3, 11); ii += add) {
            getLevel().dropExpOrb(this, add);
            add = random.nextRange(1, 3);
        }
    }

    this.timing.stopTiming();

    return hasUpdate;
}
 
Example #2
Source File: EntityExpBottle.java    From Nukkit with GNU General Public License v3.0 5 votes vote down vote up
public void dropXp() {
    Particle particle1 = new EnchantParticle(this);
    this.getLevel().addParticle(particle1);
    Particle particle2 = new SpellParticle(this, 0x00385dc6);
    this.getLevel().addParticle(particle2);

    this.getLevel().dropExpOrb(this, ThreadLocalRandom.current().nextInt(3, 12));
}
 
Example #3
Source File: EntityExpBottle.java    From Nukkit with GNU General Public License v3.0 5 votes vote down vote up
@Override
public boolean onUpdate(int currentTick) {
    if (this.closed) {
        return false;
    }

    this.timing.startTiming();

    int tickDiff = currentTick - this.lastUpdate;
    boolean hasUpdate = super.onUpdate(currentTick);

    if (this.age > 1200) {
        this.kill();
        hasUpdate = true;
    }

    if (this.isCollided) {
        this.kill();
        Particle particle1 = new EnchantParticle(this);
        this.getLevel().addParticle(particle1);
        Particle particle2 = new SpellParticle(this, 0x00385dc6);
        this.getLevel().addParticle(particle2);
        hasUpdate = true;

        NukkitRandom random = new NukkitRandom();
        int add = 1;
        for (int ii = 1; ii <= random.nextRange(3, 11); ii += add) {
            getLevel().dropExpOrb(this, add);
            add = random.nextRange(1, 3);
        }
    }

    this.timing.stopTiming();

    return hasUpdate;
}