Search in sources :

Example 11 with SkillData

use of jackiecrazy.wardance.skill.SkillData in project WarDance by Jackiecrazy.

the class Mark method mark.

@Override
public void mark(SkillData d) {
    if (dude.get() == null)
        return;
    if (statuus.containsKey(d.getSkill())) {
        if (GeneralConfig.debug)
            WarDance.LOGGER.warn("status " + d + " is already active, merging according to rules.");
    }
    SkillData sd = d.getSkill().onMarked(d.getCaster(dude.get().level), dude.get(), d, statuus.get(d.getSkill()));
    if (sd != null)
        statuus.put(d.getSkill(), sd);
    else
        statuus.remove(d.getSkill());
    sync = true;
}
Also used : SkillData(jackiecrazy.wardance.skill.SkillData)

Example 12 with SkillData

use of jackiecrazy.wardance.skill.SkillData 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

SkillData (jackiecrazy.wardance.skill.SkillData)12 CompoundNBT (net.minecraft.nbt.CompoundNBT)6 ListNBT (net.minecraft.nbt.ListNBT)5 LivingEntity (net.minecraft.entity.LivingEntity)4 Skill (jackiecrazy.wardance.skill.Skill)2 ServerPlayerEntity (net.minecraft.entity.player.ServerPlayerEntity)2 CombatDamageSource (jackiecrazy.wardance.api.CombatDamageSource)1 SyncSkillPacket (jackiecrazy.wardance.networking.SyncSkillPacket)1 UpdateAfflictionPacket (jackiecrazy.wardance.networking.UpdateAfflictionPacket)1 StringNBT (net.minecraft.nbt.StringNBT)1