cn.nukkit.level.particle.DestroyBlockParticle Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of powernukkit Show documentation
Show all versions of powernukkit Show documentation
A Minecraft Bedrock Edition server software implementation made in Java from scratch which supports all new features.
package cn.nukkit.level.particle;
import cn.nukkit.block.Block;
import cn.nukkit.level.GlobalBlockPalette;
import cn.nukkit.math.Vector3;
import cn.nukkit.network.protocol.DataPacket;
import cn.nukkit.network.protocol.LevelEventPacket;
/**
* @author xtypr
* @since 2015/11/21
*/
public class DestroyBlockParticle extends Particle {
protected final int data;
public DestroyBlockParticle(Vector3 pos, Block block) {
super(pos.x, pos.y, pos.z);
this.data = GlobalBlockPalette.getOrCreateRuntimeId(block.getId(), block.getDamage());
}
@Override
public DataPacket[] encode() {
LevelEventPacket pk = new LevelEventPacket();
pk.evid = LevelEventPacket.EVENT_PARTICLE_DESTROY;
pk.x = (float) this.x;
pk.y = (float) this.y;
pk.z = (float) this.z;
pk.data = this.data;
return new DataPacket[]{pk};
}
}