ActiveEntityEffect.java
package com.hypixel.hytale.server.core.entity.effect;
import com.hypixel.hytale.codec.Codec;
import com.hypixel.hytale.codec.KeyedCodec;
import com.hypixel.hytale.codec.builder.BuilderCodec;
import com.hypixel.hytale.component.CommandBuffer;
import com.hypixel.hytale.component.ComponentAccessor;
import com.hypixel.hytale.component.Ref;
import com.hypixel.hytale.math.util.MathUtil;
import com.hypixel.hytale.protocol.ChangeStatBehaviour;
import com.hypixel.hytale.server.core.Message;
import com.hypixel.hytale.server.core.asset.type.entityeffect.config.EntityEffect;
import com.hypixel.hytale.server.core.inventory.ItemStack;
import com.hypixel.hytale.server.core.modules.entity.damage.Damage;
import com.hypixel.hytale.server.core.modules.entity.damage.DamageCalculatorSystems;
import com.hypixel.hytale.server.core.modules.entity.damage.DamageCause;
import com.hypixel.hytale.server.core.modules.entitystats.EntityStatMap;
import com.hypixel.hytale.server.core.modules.interaction.interaction.config.server.combat.DamageCalculator;
import com.hypixel.hytale.server.core.modules.interaction.interaction.config.server.combat.DamageEffects;
import com.hypixel.hytale.server.core.universe.world.World;
import com.hypixel.hytale.server.core.universe.world.storage.EntityStore;
import it.unimi.dsi.fastutil.ints.Int2FloatMap;
import it.unimi.dsi.fastutil.objects.Object2FloatMap;
import java.util.Locale;
import javax.annotation.Nonnull;
import javax.annotation.Nullable;
.Source {
BuilderCodec<ActiveEntityEffect> CODEC;
;
Message MESSAGE_GENERAL_DAMAGE_CAUSES_UNKNOWN;
String entityEffectId;
entityEffectIndex;
initialDuration;
remainingDuration;
infinite;
debuff;
String statusEffectIcon;
sinceLastDamage;
hasBeenDamaged;
invulnerable;
DamageCalculatorSystems.Sequence sequentialHits;
{
}
{
.entityEffectId = entityEffectId;
.entityEffectIndex = entityEffectIndex;
.initialDuration = initialDuration;
.remainingDuration = remainingDuration;
.infinite = infinite;
.debuff = debuff;
.statusEffectIcon = statusEffectIcon;
.sinceLastDamage = sinceLastDamage;
.hasBeenDamaged = hasBeenDamaged;
.sequentialHits = sequentialHits;
.invulnerable = invulnerable;
}
{
(entityEffectId, entityEffectIndex, duration, duration, , debuff, statusEffectIcon, , , .Sequence(), invulnerable);
}
{
(entityEffectId, entityEffectIndex, , , infinite, , , , , .Sequence(), invulnerable);
}
{
.calculateCyclesToRun(entityEffect, dt);
.tickDamage(commandBuffer, ref, entityEffect, cyclesToRun);
tickStatChanges(commandBuffer, ref, entityEffect, entityStatMapComponent, cyclesToRun);
(!.infinite) {
.remainingDuration -= dt;
}
}
{
;
entityEffect.getDamageCalculatorCooldown();
(damageCalculatorCooldown > ) {
.sinceLastDamage += dt;
cycles = MathUtil.fastFloor(.sinceLastDamage / damageCalculatorCooldown);
.sinceLastDamage %= damageCalculatorCooldown;
} (!.hasBeenDamaged) {
cycles = ;
.hasBeenDamaged = ;
}
cycles;
}
{
entityEffect.getEntityStats();
(entityStats != ) {
(cyclesToRun > ) {
entityEffect.getStatModifierEffects();
(statModifierEffects != ) {
statModifierEffects.spawnAtEntity(commandBuffer, ref);
}
entityStatMapComponent.processStatChanges(EntityStatMap.Predictable.ALL, entityStats, entityEffect.getValueType(), ChangeStatBehaviour.Add);
}
}
}
{
entityEffect.getDamageCalculator();
(damageCalculator != ) {
(cyclesToRun > ) {
Object2FloatMap<DamageCause> relativeDamage = damageCalculator.calculateDamage(().initialDuration);
(relativeDamage != && !relativeDamage.isEmpty()) {
((EntityStore)commandBuffer.getExternalData()).getWorld();
entityEffect.getDamageEffects();
Damage[] hits = DamageCalculatorSystems.queueDamageCalculator(world, relativeDamage, ref, commandBuffer, , (ItemStack));
(Damage damageEvent : hits) {
DamageCalculatorSystems. .DamageSequence(.sequentialHits, damageCalculator);
damageEvent.putMetaObject(DamageCalculatorSystems.DAMAGE_SEQUENCE, damageSequence);
(damageEffects != ) {
damageEffects.addToDamage(damageEvent);
}
commandBuffer.invoke(ref, damageEvent);
}
}
}
}
}
{
.entityEffectIndex;
}
{
.initialDuration;
}
{
.remainingDuration;
}
{
.infinite;
}
{
.debuff;
}
{
.invulnerable;
}
Message {
(EntityEffect)EntityEffect.getAssetMap().getAsset(.entityEffectIndex);
Message damageCauseMessage;
(entityEffect != ) {
entityEffect.getLocale();
locale != ? locale : entityEffect.getId().toLowerCase(Locale.ROOT);
damageCauseMessage = Message.translation( + reason);
} {
damageCauseMessage = MESSAGE_GENERAL_DAMAGE_CAUSES_UNKNOWN;
}
Message.translation().param(, damageCauseMessage);
}
String {
.entityEffectIndex;
+ var10000 + + .initialDuration + + .remainingDuration + + .sinceLastDamage + + .hasBeenDamaged + + String.valueOf(.sequentialHits) + + .infinite + + .debuff + + .statusEffectIcon + ;
}
{
CODEC = ((BuilderCodec.Builder)((BuilderCodec.Builder)((BuilderCodec.Builder)((BuilderCodec.Builder)((BuilderCodec.Builder)((BuilderCodec.Builder)((BuilderCodec.Builder)((BuilderCodec.Builder)((BuilderCodec.Builder)((BuilderCodec.Builder)BuilderCodec.builder(ActiveEntityEffect.class, ActiveEntityEffect::).append( (, Codec.STRING), (entityEffect, x) -> entityEffect.entityEffectId = x, (entityEffect) -> entityEffect.entityEffectId).add()).append( (, Codec.FLOAT), (entityEffect, x) -> entityEffect.initialDuration = x, (entityEffect) -> entityEffect.initialDuration).add()).append( (, Codec.FLOAT), (entityEffect, x) -> entityEffect.remainingDuration = x, (entityEffect) -> entityEffect.remainingDuration).add()).append( (, Codec.FLOAT), (entityEffect, x) -> entityEffect.sinceLastDamage = x, (entityEffect) -> entityEffect.sinceLastDamage).add()).append( (, Codec.BOOLEAN), (entityEffect, x) -> entityEffect.hasBeenDamaged = x, (entityEffect) -> entityEffect.hasBeenDamaged).add()).append( (, DamageCalculatorSystems.Sequence.CODEC), (entityEffect, x) -> entityEffect.sequentialHits = x, (entityEffect) -> entityEffect.sequentialHits).add()).append( (, Codec.BOOLEAN), (entityEffect, aBoolean) -> entityEffect.infinite = aBoolean, (entityEffect) -> entityEffect.infinite).add()).append( (, Codec.BOOLEAN), (entityEffect, aBoolean) -> entityEffect.debuff = aBoolean, (entityEffect) -> entityEffect.debuff).add()).append( (, Codec.STRING), (entityEffect, aString) -> entityEffect.statusEffectIcon = aString, (entityEffect) -> entityEffect.statusEffectIcon).add()).append( (, Codec.BOOLEAN), (entityEffect, aBoolean) -> entityEffect.invulnerable = aBoolean, (entityEffect) -> entityEffect.invulnerable).add()).build();
MESSAGE_GENERAL_DAMAGE_CAUSES_UNKNOWN = Message.translation();
}
}