use of com.lying.variousoddities.network.PacketSyncBludgeoning in project VariousOddities by Lyinginbedmon.
the class VOBusServer method onBludgeonedEvent.
/**
* Prevents bludgeoning damage from affecting the entity's health instead of their bludgeoning value.
* @param event
*/
@SubscribeEvent(priority = EventPriority.LOWEST)
public static void onBludgeonedEvent(LivingHurtEvent event) {
if (!event.isCanceled() && event.getSource() == VODamageSource.BLUDGEON) {
LivingEntity hurtEntity = event.getEntityLiving();
LivingData data = LivingData.forEntity(hurtEntity);
if (data != null) {
data.setBludgeoning(data.getBludgeoning() + event.getAmount());
if (hurtEntity.getType() == EntityType.PLAYER && !hurtEntity.getEntityWorld().isRemote)
PacketHandler.sendTo((ServerPlayerEntity) hurtEntity, new PacketSyncBludgeoning(data.getBludgeoning()));
}
event.setCanceled(true);
}
}
Aggregations