Search in sources :

Example 1 with PacketSyncAir

use of com.lying.variousoddities.network.PacketSyncAir in project VariousOddities by Lyinginbedmon.

the class VOBusServer method onChangeDimensionEvent.

@SubscribeEvent
public static void onChangeDimensionEvent(EntityTravelToDimensionEvent event) {
    Entity entity = event.getEntity();
    if (!entity.getEntityWorld().isRemote && entity.getType() == EntityType.PLAYER) {
        PlayerEntity player = (PlayerEntity) entity;
        LivingData data = LivingData.forEntity(player);
        if (data != null) {
            PacketHandler.sendTo((ServerPlayerEntity) player, new PacketSyncAir(data.getAir()));
            data.getAbilities().markDirty();
        }
    }
    if (entity instanceof LivingEntity && ((LivingEntity) entity).isPotionActive(VOPotions.ANCHORED))
        event.setCanceled(true);
}
Also used : LivingEntity(net.minecraft.entity.LivingEntity) PlayerEntity(net.minecraft.entity.player.PlayerEntity) LivingEntity(net.minecraft.entity.LivingEntity) ServerPlayerEntity(net.minecraft.entity.player.ServerPlayerEntity) FireballEntity(net.minecraft.entity.projectile.FireballEntity) CreatureEntity(net.minecraft.entity.CreatureEntity) MobEntity(net.minecraft.entity.MobEntity) Entity(net.minecraft.entity.Entity) PacketSyncLivingData(com.lying.variousoddities.network.PacketSyncLivingData) LivingData(com.lying.variousoddities.capabilities.LivingData) PlayerEntity(net.minecraft.entity.player.PlayerEntity) ServerPlayerEntity(net.minecraft.entity.player.ServerPlayerEntity) PacketSyncAir(com.lying.variousoddities.network.PacketSyncAir) SubscribeEvent(net.minecraftforge.eventbus.api.SubscribeEvent)

Aggregations

LivingData (com.lying.variousoddities.capabilities.LivingData)1 PacketSyncAir (com.lying.variousoddities.network.PacketSyncAir)1 PacketSyncLivingData (com.lying.variousoddities.network.PacketSyncLivingData)1 CreatureEntity (net.minecraft.entity.CreatureEntity)1 Entity (net.minecraft.entity.Entity)1 LivingEntity (net.minecraft.entity.LivingEntity)1 MobEntity (net.minecraft.entity.MobEntity)1 PlayerEntity (net.minecraft.entity.player.PlayerEntity)1 ServerPlayerEntity (net.minecraft.entity.player.ServerPlayerEntity)1 FireballEntity (net.minecraft.entity.projectile.FireballEntity)1 SubscribeEvent (net.minecraftforge.eventbus.api.SubscribeEvent)1