use of org.lanternpowered.server.network.vanilla.message.type.play.MessagePlayOutEntityCollectItem in project LanternServer by LanternPowered.
the class EntityProtocol method handleEvent.
@Override
protected void handleEvent(EntityProtocolUpdateContext context, EntityEvent event) {
if (event instanceof CollectEntityEvent) {
final LanternLiving collector = (LanternLiving) ((CollectEntityEvent) event).getCollector();
context.getId(collector).ifPresent(id -> {
final int count = ((CollectEntityEvent) event).getCollectedItemsCount();
context.sendToAll(() -> new MessagePlayOutEntityCollectItem(id, getRootEntityId(), count));
});
} else {
super.handleEvent(context, event);
}
}
Aggregations