Search in sources :

Example 1 with PacketSyncSpecies

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

the class VOBusServer method onPlayerLogInEvent.

@SubscribeEvent
public static void onPlayerLogInEvent(PlayerLoggedInEvent event) {
    PlayerEntity player = event.getPlayer();
    PacketHandler.sendTo((ServerPlayerEntity) player, new PacketSyncSpecies(VORegistries.SPECIES));
    LivingData data = LivingData.forEntity(player);
    if (data != null) {
        PacketHandler.sendToAll((ServerWorld) player.getEntityWorld(), new PacketSyncLivingData(player.getUniqueID(), data));
        data.getAbilities().markDirty();
        if (!data.hasSelectedSpecies() && ConfigVO.MOBS.selectSpeciesOnLogin.get()) {
            if (!player.getEntityWorld().isRemote)
                PacketHandler.sendTo((ServerPlayerEntity) player, new PacketSpeciesOpenScreen());
            player.addPotionEffect(new EffectInstance(Effects.RESISTANCE, Reference.Values.TICKS_PER_MINUTE * 15, 15, true, false));
        }
    }
}
Also used : PacketSpeciesOpenScreen(com.lying.variousoddities.network.PacketSpeciesOpenScreen) PacketSyncLivingData(com.lying.variousoddities.network.PacketSyncLivingData) LivingData(com.lying.variousoddities.capabilities.LivingData) ServerPlayerEntity(net.minecraft.entity.player.ServerPlayerEntity) PacketSyncSpecies(com.lying.variousoddities.network.PacketSyncSpecies) PacketSyncLivingData(com.lying.variousoddities.network.PacketSyncLivingData) EffectInstance(net.minecraft.potion.EffectInstance) PlayerEntity(net.minecraft.entity.player.PlayerEntity) ServerPlayerEntity(net.minecraft.entity.player.ServerPlayerEntity) SubscribeEvent(net.minecraftforge.eventbus.api.SubscribeEvent)

Aggregations

LivingData (com.lying.variousoddities.capabilities.LivingData)1 PacketSpeciesOpenScreen (com.lying.variousoddities.network.PacketSpeciesOpenScreen)1 PacketSyncLivingData (com.lying.variousoddities.network.PacketSyncLivingData)1 PacketSyncSpecies (com.lying.variousoddities.network.PacketSyncSpecies)1 PlayerEntity (net.minecraft.entity.player.PlayerEntity)1 ServerPlayerEntity (net.minecraft.entity.player.ServerPlayerEntity)1 EffectInstance (net.minecraft.potion.EffectInstance)1 SubscribeEvent (net.minecraftforge.eventbus.api.SubscribeEvent)1