use of net.minecraft.network.play.client.CEntityActionPacket in project VariousOddities by Lyinginbedmon.
the class VOBusClient method onLivingJump.
@SubscribeEvent
public static void onLivingJump(LivingUpdateEvent event) {
if (event.getEntityLiving() == mc.player) {
ClientPlayerEntity player = (ClientPlayerEntity) event.getEntityLiving();
LivingData data = LivingData.forEntity(event.getEntityLiving());
Abilities abilities = data.getAbilities();
Map<ResourceLocation, Ability> abilityMap = AbilityRegistry.getCreatureAbilities(player);
if (player.movementInput.jump && abilities.canBonusJump) {
if (AbilitySwim.isEntitySwimming(player)) {
if (abilityMap.containsKey(AbilitySwim.REGISTRY_NAME)) {
abilities.doWaterJump();
PacketHandler.sendToServer(new PacketBonusJump(false));
}
} else if (!player.isOnGround()) {
if (abilityMap.containsKey(AbilityFlight.REGISTRY_NAME) && abilityMap.get(AbilityFlight.REGISTRY_NAME).isActive()) {
abilities.doAirJump();
player.connection.sendPacket(new CEntityActionPacket(player, CEntityActionPacket.Action.START_FALL_FLYING));
PacketHandler.sendToServer(new PacketBonusJump());
}
}
}
}
}
Aggregations