cn.nukkit.network.protocol.AddItemEntityPacket 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.network.protocol;
import cn.nukkit.entity.data.EntityMetadata;
import cn.nukkit.item.Item;
import cn.nukkit.utils.Binary;
import lombok.ToString;
/**
* @author MagicDroidX (Nukkit Project)
*/
@ToString
public class AddItemEntityPacket extends DataPacket {
public static final byte NETWORK_ID = ProtocolInfo.ADD_ITEM_ENTITY_PACKET;
@Override
public byte pid() {
return NETWORK_ID;
}
public long entityUniqueId;
public long entityRuntimeId;
public Item item;
public float x;
public float y;
public float z;
public float speedX;
public float speedY;
public float speedZ;
public EntityMetadata metadata = new EntityMetadata();
public boolean isFromFishing = false;
@Override
public void decode() {
}
@Override
public void encode() {
this.reset();
this.putEntityUniqueId(this.entityUniqueId);
this.putEntityRuntimeId(this.entityRuntimeId);
this.putSlot(this.item);
this.putVector3f(this.x, this.y, this.z);
this.putVector3f(this.speedX, this.speedY, this.speedZ);
this.put(Binary.writeMetadata(metadata));
this.putBoolean(this.isFromFishing);
}
}