Search in sources :

Example 1 with UpdateAfflictionPacket

use of jackiecrazy.wardance.networking.UpdateAfflictionPacket in project WarDance by Jackiecrazy.

the class Mark method update.

@Override
public void update() {
    final LivingEntity ticker = dude.get();
    if (ticker == null)
        return;
    final Collection<SkillData> active = new ArrayList<>(getActiveMarks().values());
    for (SkillData cd : active) {
        if (cd.getSkill().markTick(cd.getCaster(ticker.level), ticker, cd))
            sync = true;
    }
    if (sync && ticker instanceof ServerPlayerEntity) {
        CombatChannel.INSTANCE.send(PacketDistributor.PLAYER.with(() -> (ServerPlayerEntity) ticker), new UpdateAfflictionPacket(ticker.getId(), this.write()));
        sync = false;
    }
    if (sync && EntityHandler.mustUpdate.containsValue(ticker)) {
        CombatChannel.INSTANCE.send(PacketDistributor.TRACKING_ENTITY_AND_SELF.with(() -> ticker), new UpdateAfflictionPacket(ticker.getId(), this.write()));
        sync = false;
    }
}
Also used : LivingEntity(net.minecraft.entity.LivingEntity) SkillData(jackiecrazy.wardance.skill.SkillData) UpdateAfflictionPacket(jackiecrazy.wardance.networking.UpdateAfflictionPacket) ServerPlayerEntity(net.minecraft.entity.player.ServerPlayerEntity)

Aggregations

UpdateAfflictionPacket (jackiecrazy.wardance.networking.UpdateAfflictionPacket)1 SkillData (jackiecrazy.wardance.skill.SkillData)1 LivingEntity (net.minecraft.entity.LivingEntity)1 ServerPlayerEntity (net.minecraft.entity.player.ServerPlayerEntity)1