use of com.minecraftabnormals.endergetic.common.entities.bolloom.BolloomBalloonEntity in project endergetic by team-abnormals.
the class S2CUpdateBalloonsMessage method handle.
public static void handle(S2CUpdateBalloonsMessage message, Supplier<NetworkEvent.Context> ctx) {
NetworkEvent.Context context = ctx.get();
if (context.getDirection().getReceptionSide() == LogicalSide.CLIENT) {
context.enqueueWork(() -> {
World world = ClientInfo.getClientPlayerWorld();
Entity entity = world.getEntity(message.entityId);
if (entity == null) {
EndergeticExpansion.LOGGER.warn("Received balloons for unknown entity!");
} else {
((BalloonHolder) entity).detachBalloons();
for (int id : message.balloonIds) {
Entity balloon = world.getEntity(id);
if (balloon instanceof BolloomBalloonEntity) {
((BolloomBalloonEntity) balloon).attachToEntity(entity);
}
}
}
});
}
context.setPacketHandled(true);
}
Aggregations