use of org.dragonet.net.packet.minecraft.AddItemEntityPacket in project Dragonet-Legacy by DragonetMC.
the class EntityMetadataMessageTranslator method handleSpecific.
@Override
public PEPacket[] handleSpecific(EntityMetadataMessage packet) {
if (!this.getTranslator().cachedEntityIDs.contains(packet.id)) {
//Not spawned yet, let's create them
if (this.getTranslator().cachedSpawnObjects.containsKey(packet.id)) {
//Spawn it :)
SpawnObjectMessage msgObj = this.getTranslator().cachedSpawnObjects.get(packet.id);
switch(msgObj.type) {
case //Dropped Item
2:
AddItemEntityPacket pkAddItemEntity = new AddItemEntityPacket();
pkAddItemEntity.eid = msgObj.id;
pkAddItemEntity.item = new PEInventorySlot((short) (((ItemStack) packet.entries.get(0).value).getTypeId() & 0xFFFF), (byte) (((ItemStack) packet.entries.get(0).value).getAmount() & 0xFF), (short) (((ItemStack) packet.entries.get(0).value).getDurability() & 0xFFFF));
pkAddItemEntity.x = (float) msgObj.velX / 32;
pkAddItemEntity.y = (float) msgObj.velY / 32;
pkAddItemEntity.z = (float) msgObj.velZ / 32;
return new PEPacket[] { pkAddItemEntity };
}
//Remove it
this.getTranslator().cachedSpawnObjects.remove(packet.id);
} else {
return null;
}
}
return null;
}
Aggregations