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;
}
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;
}
}
Aggregations