use of cn.nukkit.level.particle.EnchantParticle in project Nukkit by Nukkit.
the class EntityExpBottle method onUpdate.
@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;
}
Aggregations