/** * When player starts tracking an actor, server has to send actor's record * frames to the player */ @SubscribeEvent public void playerStartsTracking(StartTracking event) { Entity target = event.getTarget(); EntityPlayerMP player = (EntityPlayerMP) event.getEntityPlayer(); if (target instanceof EntityActor) { EntityActor actor = (EntityActor) target; if (actor.isPlaying()) { Utils.sendRequestedRecord(actor.getEntityId(), actor.playback.record.filename, player); } } }
@SubscribeEvent public void onEntityStartTracking(StartTracking event) { Entity entity = event.getTarget(); EntityPlayer player = event.getEntityPlayer(); if (!entity.world.isRemote && entity != player && entity instanceof EntityLivingBase && player instanceof EntityPlayerMP) { Optional<IBrewStorage> optional = BrewStorageHandler.getBrewStorage((EntityLivingBase) entity); if (optional.isPresent()) { IBrewStorage storage = optional.get(); storage.syncTo((EntityPlayerMP) event.getEntityPlayer()); } } }
/** * When player starts tracking another player, server has to send its * morphing values. */ @SubscribeEvent public void playerStartsTracking(StartTracking event) { if (event.getTarget() instanceof EntityPlayer) { Entity target = event.getTarget(); EntityPlayerMP player = (EntityPlayerMP) event.getEntityPlayer(); IMorphing cap = target.getCapability(MorphingProvider.MORPHING_CAP, null); Dispatcher.sendTo(new PacketMorphPlayer(target.getEntityId(), cap.getCurrentMorph()), player); } }