|
@@ -1,849 +0,0 @@
|
|
|
-package me.km.data;
|
|
|
-
|
|
|
-import java.util.HashMap;
|
|
|
-import me.km.api.Location;
|
|
|
-import me.km.networking.ModPacketHandler;
|
|
|
-import net.minecraft.entity.Entity;
|
|
|
-import net.minecraft.entity.EntityLivingBase;
|
|
|
-import net.minecraft.entity.player.EntityPlayerMP;
|
|
|
-
|
|
|
-public class EntityData
|
|
|
-{
|
|
|
- private Entity ent;
|
|
|
- private boolean isLiving;
|
|
|
- private boolean isPlayer;
|
|
|
-
|
|
|
- public EntityData(Entity ent)
|
|
|
- {
|
|
|
- this.ent = ent;
|
|
|
- this.isLiving = ent instanceof EntityLivingBase;
|
|
|
- this.isPlayer = ent instanceof EntityPlayerMP;
|
|
|
- }
|
|
|
-
|
|
|
- public boolean onEntityDeath()
|
|
|
- {
|
|
|
- return true;
|
|
|
- }
|
|
|
-
|
|
|
- public void tick()
|
|
|
- {
|
|
|
- tickLessHeal();
|
|
|
- tickAttackBoost();
|
|
|
- tickArmorBoost();
|
|
|
- tickMagicArmorBoost();
|
|
|
- tickReflection();
|
|
|
- tickArmorBypass();
|
|
|
- tickCallBack();
|
|
|
- tickDoomed();
|
|
|
- tickPoisonBlade();
|
|
|
- tickArrowImmunity();
|
|
|
- tickFallImmunity();
|
|
|
- tickSilence();
|
|
|
- tickShadow();
|
|
|
- tickCooldown();
|
|
|
- tickGravity();
|
|
|
- tickIgnorance();
|
|
|
- tickGoldBonus();
|
|
|
- tickAquaAffinity();
|
|
|
- }
|
|
|
-
|
|
|
- public boolean isPlayerData()
|
|
|
- {
|
|
|
- return isPlayer;
|
|
|
- }
|
|
|
-
|
|
|
- public boolean isLivingData()
|
|
|
- {
|
|
|
- return isLiving;
|
|
|
- }
|
|
|
-
|
|
|
- private void sendStatus(boolean add, byte id, String text)
|
|
|
- {
|
|
|
- if(isPlayer)
|
|
|
- {
|
|
|
- if(add)
|
|
|
- {
|
|
|
- ModPacketHandler.addStatus((EntityPlayerMP) ent, id, text);
|
|
|
- }
|
|
|
- else
|
|
|
- {
|
|
|
- ModPacketHandler.removeStatus((EntityPlayerMP) ent, id);
|
|
|
- }
|
|
|
- }
|
|
|
- }
|
|
|
-
|
|
|
- private void sendTimedStatus(boolean add, byte id, int time, String text)
|
|
|
- {
|
|
|
- if(isPlayer)
|
|
|
- {
|
|
|
- if(add)
|
|
|
- {
|
|
|
- ModPacketHandler.addTimedStatus((EntityPlayerMP) ent, id, text, time);
|
|
|
- }
|
|
|
- else
|
|
|
- {
|
|
|
- ModPacketHandler.removeStatus((EntityPlayerMP) ent, id);
|
|
|
- }
|
|
|
- }
|
|
|
- }
|
|
|
-
|
|
|
- // -------------------------------------------------------------------------
|
|
|
- // this is used for cooldown
|
|
|
- // -------------------------------------------------------------------------
|
|
|
-
|
|
|
- private HashMap<String, Integer> cooldowns = new HashMap<>();
|
|
|
-
|
|
|
- public void addCoolDown(String name, int time)
|
|
|
- {
|
|
|
- cooldowns.put(name, time);
|
|
|
- }
|
|
|
-
|
|
|
- public boolean hasCooldown(String name)
|
|
|
- {
|
|
|
- return cooldowns.get(name) != null;
|
|
|
- }
|
|
|
-
|
|
|
- public void tickCooldown()
|
|
|
- {
|
|
|
- cooldowns.entrySet().removeIf(e ->
|
|
|
- {
|
|
|
- int i = e.getValue() - 1;
|
|
|
- if(i <= 0)
|
|
|
- {
|
|
|
- return true;
|
|
|
- }
|
|
|
- e.setValue(i);
|
|
|
- return false;
|
|
|
- });
|
|
|
- }
|
|
|
-
|
|
|
- // -------------------------------------------------------------------------
|
|
|
- // this is used for teleportation on hit
|
|
|
- // -------------------------------------------------------------------------
|
|
|
-
|
|
|
- private Entity teleportEnt = null;
|
|
|
-
|
|
|
- public void setHitTeleport(Entity goal)
|
|
|
- {
|
|
|
- teleportEnt = goal;
|
|
|
- }
|
|
|
-
|
|
|
- public boolean hasTeleportEntity()
|
|
|
- {
|
|
|
- return teleportEnt != null;
|
|
|
- }
|
|
|
-
|
|
|
- public Entity getTeleportEntity()
|
|
|
- {
|
|
|
- return teleportEnt;
|
|
|
- }
|
|
|
-
|
|
|
- // -------------------------------------------------------------------------
|
|
|
- // rapid fire storage
|
|
|
- // -------------------------------------------------------------------------
|
|
|
-
|
|
|
- private EntityLivingBase healEntOnHit = null;
|
|
|
-
|
|
|
- public void setOnHitHealEntity(EntityLivingBase goal)
|
|
|
- {
|
|
|
- healEntOnHit = goal;
|
|
|
- }
|
|
|
-
|
|
|
- public boolean hasOnHitHealEntity()
|
|
|
- {
|
|
|
- return healEntOnHit != null;
|
|
|
- }
|
|
|
-
|
|
|
- public EntityLivingBase getOnHitHealEntity()
|
|
|
- {
|
|
|
- return healEntOnHit;
|
|
|
- }
|
|
|
-
|
|
|
- // -------------------------------------------------------------------------
|
|
|
- // heal by dealed damage
|
|
|
- // -------------------------------------------------------------------------
|
|
|
-
|
|
|
- private EntityLivingBase healByDamage = null;
|
|
|
-
|
|
|
- public void setHealByDamageEntity(EntityLivingBase goal)
|
|
|
- {
|
|
|
- healByDamage = goal;
|
|
|
- }
|
|
|
-
|
|
|
- public boolean hasHealByDamageEntity()
|
|
|
- {
|
|
|
- return healByDamage != null;
|
|
|
- }
|
|
|
-
|
|
|
- public EntityLivingBase getHealByDamageEntity()
|
|
|
- {
|
|
|
- return healByDamage;
|
|
|
- }
|
|
|
-
|
|
|
- // -------------------------------------------------------------------------
|
|
|
- // this is used for cluster bombs
|
|
|
- // -------------------------------------------------------------------------
|
|
|
-
|
|
|
- private int clusterPower = 0;
|
|
|
-
|
|
|
- public void setClusterBomb(int power)
|
|
|
- {
|
|
|
- clusterPower = power;
|
|
|
- }
|
|
|
-
|
|
|
- public int getClusterPower()
|
|
|
- {
|
|
|
- return clusterPower;
|
|
|
- }
|
|
|
-
|
|
|
- // -------------------------------------------------------------------------
|
|
|
- // grappling hook
|
|
|
- // -------------------------------------------------------------------------
|
|
|
-
|
|
|
- private boolean arrowHook = false;
|
|
|
-
|
|
|
- public void setArrowHook(boolean hook)
|
|
|
- {
|
|
|
- arrowHook = hook;
|
|
|
- sendStatus(hasArrowHook(), (byte) 1, "§a#entitydata.grapplingHook");
|
|
|
- }
|
|
|
-
|
|
|
- public boolean hasArrowHook()
|
|
|
- {
|
|
|
- return arrowHook;
|
|
|
- }
|
|
|
-
|
|
|
- // -------------------------------------------------------------------------
|
|
|
- // shadow hit
|
|
|
- // -------------------------------------------------------------------------
|
|
|
-
|
|
|
- private boolean shadowHit = false;
|
|
|
-
|
|
|
- public void setShadowHit(boolean hit)
|
|
|
- {
|
|
|
- shadowHit = hit;
|
|
|
- sendStatus(hasShadowHit(), (byte) 2, "§a#entitydata.shadowHit");
|
|
|
- }
|
|
|
-
|
|
|
- public boolean hasShadowHit()
|
|
|
- {
|
|
|
- return shadowHit;
|
|
|
- }
|
|
|
-
|
|
|
- // -------------------------------------------------------------------------
|
|
|
- // smoke bomb
|
|
|
- // -------------------------------------------------------------------------
|
|
|
-
|
|
|
- private boolean smokeBomb = false;
|
|
|
-
|
|
|
- public void setSmokeBomb(boolean bomb)
|
|
|
- {
|
|
|
- smokeBomb = bomb;
|
|
|
- }
|
|
|
-
|
|
|
- public boolean isSmokeBomb()
|
|
|
- {
|
|
|
- return smokeBomb;
|
|
|
- }
|
|
|
-
|
|
|
- // -------------------------------------------------------------------------
|
|
|
- // power attack
|
|
|
- // -------------------------------------------------------------------------
|
|
|
-
|
|
|
- private float powerAttack = 0;
|
|
|
-
|
|
|
- public void setPowerAttack(float power)
|
|
|
- {
|
|
|
- this.powerAttack = power;
|
|
|
- sendStatus(hasPowerAttack(), (byte) 3, "§a+" + Math.round(power * 100 - 100) + "% #entitydata.powerAttack");
|
|
|
- }
|
|
|
-
|
|
|
- public float getPowerAttack()
|
|
|
- {
|
|
|
- return powerAttack;
|
|
|
- }
|
|
|
-
|
|
|
- public boolean hasPowerAttack()
|
|
|
- {
|
|
|
- return powerAttack > 0;
|
|
|
- }
|
|
|
-
|
|
|
- // -------------------------------------------------------------------------
|
|
|
- // impact punch
|
|
|
- // -------------------------------------------------------------------------
|
|
|
-
|
|
|
- private float impactPunch = 0;
|
|
|
-
|
|
|
- public void setImpactPunch(float power)
|
|
|
- {
|
|
|
- this.impactPunch = power;
|
|
|
- sendStatus(hasImpactPunch(), (byte) 4, "§a+" + Math.round(power * 100 - 100) + "% #entitydata.impactPunch");
|
|
|
- }
|
|
|
-
|
|
|
- public float getImpactPunch()
|
|
|
- {
|
|
|
- return impactPunch;
|
|
|
- }
|
|
|
-
|
|
|
- public boolean hasImpactPunch()
|
|
|
- {
|
|
|
- return impactPunch > 0;
|
|
|
- }
|
|
|
-
|
|
|
- // -------------------------------------------------------------------------
|
|
|
- // less heal
|
|
|
- // -------------------------------------------------------------------------
|
|
|
-
|
|
|
- private int lessHealTime = 0;
|
|
|
- private float lessHeal = 0;
|
|
|
-
|
|
|
- public void setLessHeal(int time, float lessHeal)
|
|
|
- {
|
|
|
- this.lessHealTime = time;
|
|
|
- this.lessHeal = lessHeal;
|
|
|
- sendTimedStatus(hasImpactPunch(), (byte) 5, time, "§c-" + Math.round(100 - lessHeal * 100) + "% #entitydata.lessHeal");
|
|
|
- }
|
|
|
-
|
|
|
- public float getLessHeal()
|
|
|
- {
|
|
|
- return lessHeal;
|
|
|
- }
|
|
|
-
|
|
|
- public boolean hasLessHeal()
|
|
|
- {
|
|
|
- return lessHeal > 0;
|
|
|
- }
|
|
|
-
|
|
|
- private void tickLessHeal()
|
|
|
- {
|
|
|
- if(lessHealTime != Integer.MAX_VALUE && lessHealTime > 0)
|
|
|
- {
|
|
|
- lessHealTime--;
|
|
|
- if(lessHealTime <= 0)
|
|
|
- {
|
|
|
- setLessHeal(0, 0);
|
|
|
- }
|
|
|
- }
|
|
|
- }
|
|
|
-
|
|
|
- // -------------------------------------------------------------------------
|
|
|
- // attack boost
|
|
|
- // -------------------------------------------------------------------------
|
|
|
-
|
|
|
- private int attackBoostTime = 0;
|
|
|
- private float attackBoost = 0;
|
|
|
-
|
|
|
- public void setAttackBoost(int time, float attackBoost)
|
|
|
- {
|
|
|
- this.attackBoostTime = time;
|
|
|
- this.attackBoost = attackBoost;
|
|
|
- sendTimedStatus(hasAttackBoost(), (byte) 6, time, "§a+" + Math.round(attackBoost * 100 - 100) + "% #entitydata.attackBoost");
|
|
|
- }
|
|
|
-
|
|
|
- public float getAttackBoost()
|
|
|
- {
|
|
|
- return attackBoost;
|
|
|
- }
|
|
|
-
|
|
|
- public boolean hasAttackBoost()
|
|
|
- {
|
|
|
- return attackBoost > 0;
|
|
|
- }
|
|
|
-
|
|
|
- private void tickAttackBoost()
|
|
|
- {
|
|
|
- if(attackBoostTime != Integer.MAX_VALUE && attackBoostTime > 0)
|
|
|
- {
|
|
|
- attackBoostTime--;
|
|
|
- if(attackBoostTime <= 0)
|
|
|
- {
|
|
|
- setAttackBoost(0, 0);
|
|
|
- }
|
|
|
- }
|
|
|
- }
|
|
|
-
|
|
|
- // -------------------------------------------------------------------------
|
|
|
- // armor boost
|
|
|
- // -------------------------------------------------------------------------
|
|
|
-
|
|
|
- private int armorBoostTime = 0;
|
|
|
- private float armorBoost = 0;
|
|
|
-
|
|
|
- public void setArmorBoost(int time, float armorBoost)
|
|
|
- {
|
|
|
- this.armorBoostTime = time;
|
|
|
- this.armorBoost = armorBoost;
|
|
|
- sendTimedStatus(hasArmorBoost(), (byte) 7, time, "§a+" + Math.round(armorBoost * 100 - 100) + "% #entitydata.armorBoost");
|
|
|
- }
|
|
|
-
|
|
|
- public float getArmorBoost()
|
|
|
- {
|
|
|
- return armorBoost;
|
|
|
- }
|
|
|
-
|
|
|
- public boolean hasArmorBoost()
|
|
|
- {
|
|
|
- return armorBoost > 0;
|
|
|
- }
|
|
|
-
|
|
|
- private void tickArmorBoost()
|
|
|
- {
|
|
|
- if(armorBoostTime != Integer.MAX_VALUE && armorBoostTime > 0)
|
|
|
- {
|
|
|
- armorBoostTime--;
|
|
|
- if(armorBoostTime <= 0)
|
|
|
- {
|
|
|
- setArmorBoost(0, 0);
|
|
|
- }
|
|
|
- }
|
|
|
- }
|
|
|
-
|
|
|
- // -------------------------------------------------------------------------
|
|
|
- // magic armor boost
|
|
|
- // -------------------------------------------------------------------------
|
|
|
-
|
|
|
- private int magicArmorBoostTime = 0;
|
|
|
- private float magicArmorBoost = 0;
|
|
|
-
|
|
|
- public void setMagicArmorBoost(int time, float magicArmorBoost)
|
|
|
- {
|
|
|
- this.magicArmorBoostTime = time;
|
|
|
- this.magicArmorBoost = magicArmorBoost;
|
|
|
- sendTimedStatus(hasMagicArmorBoost(), (byte) 8, time, "§a+" + Math.round(magicArmorBoost * 100 - 100) + "% #entitydata.magicArmorBoost");
|
|
|
- }
|
|
|
-
|
|
|
- public float getMagicArmorBoost()
|
|
|
- {
|
|
|
- return magicArmorBoost;
|
|
|
- }
|
|
|
-
|
|
|
- public boolean hasMagicArmorBoost()
|
|
|
- {
|
|
|
- return magicArmorBoost > 0;
|
|
|
- }
|
|
|
-
|
|
|
- private void tickMagicArmorBoost()
|
|
|
- {
|
|
|
- if(magicArmorBoostTime != Integer.MAX_VALUE && magicArmorBoostTime > 0)
|
|
|
- {
|
|
|
- magicArmorBoostTime--;
|
|
|
- if(magicArmorBoostTime <= 0)
|
|
|
- {
|
|
|
- setMagicArmorBoost(0, 0);
|
|
|
- }
|
|
|
- }
|
|
|
- }
|
|
|
-
|
|
|
- // -------------------------------------------------------------------------
|
|
|
- // physical reflect
|
|
|
- // -------------------------------------------------------------------------
|
|
|
-
|
|
|
- private int reflectionTime = 0;
|
|
|
- private float reflection = 0;
|
|
|
-
|
|
|
- public void setReflection(int time, float reflection)
|
|
|
- {
|
|
|
- this.reflectionTime = time;
|
|
|
- this.reflection = reflection;
|
|
|
- sendTimedStatus(hasReflection(), (byte) 9, time, "§a+" + Math.round(reflection * 100) + "% #entitydata.reflection");
|
|
|
- }
|
|
|
-
|
|
|
- public float getReflection()
|
|
|
- {
|
|
|
- return reflection;
|
|
|
- }
|
|
|
-
|
|
|
- public boolean hasReflection()
|
|
|
- {
|
|
|
- return reflection > 0;
|
|
|
- }
|
|
|
-
|
|
|
- private void tickReflection()
|
|
|
- {
|
|
|
- if(reflectionTime != Integer.MAX_VALUE && reflectionTime > 0)
|
|
|
- {
|
|
|
- reflectionTime--;
|
|
|
- if(reflectionTime <= 0)
|
|
|
- {
|
|
|
- setReflection(0, 0);
|
|
|
- }
|
|
|
- }
|
|
|
- }
|
|
|
-
|
|
|
- // -------------------------------------------------------------------------
|
|
|
- // armor bypass on attacked entity
|
|
|
- // -------------------------------------------------------------------------
|
|
|
-
|
|
|
- private int armorBypassTime = 0;
|
|
|
- private float armorBypass = 0;
|
|
|
-
|
|
|
- public void setArmorBypass(int time, float armorBypass)
|
|
|
- {
|
|
|
- this.armorBypassTime = time;
|
|
|
- this.armorBypass = armorBypass;
|
|
|
- sendTimedStatus(hasArmorBypass(), (byte) 10, time, "§a+" + Math.round(armorBypass * 100) + "% #entitydata.armorBypass");
|
|
|
- }
|
|
|
-
|
|
|
- public float getArmorBypass()
|
|
|
- {
|
|
|
- return armorBypass;
|
|
|
- }
|
|
|
-
|
|
|
- public boolean hasArmorBypass()
|
|
|
- {
|
|
|
- return armorBypass > 0;
|
|
|
- }
|
|
|
-
|
|
|
- private void tickArmorBypass()
|
|
|
- {
|
|
|
- if(armorBypassTime != Integer.MAX_VALUE && armorBypassTime > 0)
|
|
|
- {
|
|
|
- armorBypassTime--;
|
|
|
- if(armorBypassTime <= 0)
|
|
|
- {
|
|
|
- setArmorBypass(0, 0);
|
|
|
- }
|
|
|
- }
|
|
|
- }
|
|
|
-
|
|
|
- // -------------------------------------------------------------------------
|
|
|
- // location call back
|
|
|
- // -------------------------------------------------------------------------
|
|
|
-
|
|
|
- private Location callBack = null;
|
|
|
- private int callBackTime = 0;
|
|
|
-
|
|
|
- public void setCallBack(int time, Location loc)
|
|
|
- {
|
|
|
- this.callBackTime = time;
|
|
|
- this.callBack = loc;
|
|
|
- sendTimedStatus(time > 0, (byte) 11, time, "§a#entitydata.callback");
|
|
|
- }
|
|
|
-
|
|
|
- public Location getCallBack()
|
|
|
- {
|
|
|
- return callBack;
|
|
|
- }
|
|
|
-
|
|
|
- private void tickCallBack()
|
|
|
- {
|
|
|
- if(callBackTime != Integer.MAX_VALUE && callBackTime > 0)
|
|
|
- {
|
|
|
- callBackTime--;
|
|
|
- if(callBackTime <= 0)
|
|
|
- {
|
|
|
- setCallBack(0, null);
|
|
|
- }
|
|
|
- }
|
|
|
- }
|
|
|
-
|
|
|
- // -------------------------------------------------------------------------
|
|
|
- // doomed
|
|
|
- // -------------------------------------------------------------------------
|
|
|
-
|
|
|
- private int doomedTime = 0;
|
|
|
-
|
|
|
- public void setDoomed(int time)
|
|
|
- {
|
|
|
- this.doomedTime = time;
|
|
|
- sendTimedStatus(isDoomed(), (byte) 12, time, "§c#entitydata.doomed");
|
|
|
- }
|
|
|
-
|
|
|
- public boolean isDoomed()
|
|
|
- {
|
|
|
- return doomedTime > 0;
|
|
|
- }
|
|
|
-
|
|
|
- private void tickDoomed()
|
|
|
- {
|
|
|
- if(doomedTime != Integer.MAX_VALUE && doomedTime > 0)
|
|
|
- {
|
|
|
- doomedTime--;
|
|
|
- if(doomedTime <= 0)
|
|
|
- {
|
|
|
- setDoomed(0);
|
|
|
- }
|
|
|
- }
|
|
|
- }
|
|
|
-
|
|
|
- // -------------------------------------------------------------------------
|
|
|
- // poison blade
|
|
|
- // -------------------------------------------------------------------------
|
|
|
-
|
|
|
- private int poisonBladeTime = 0;
|
|
|
-
|
|
|
- public void setPoisonBlade(int time)
|
|
|
- {
|
|
|
- this.poisonBladeTime = time;
|
|
|
- sendTimedStatus(hasPoisonBlade(), (byte) 13, time, "§a#entitydata.poisonBlade");
|
|
|
- }
|
|
|
-
|
|
|
- public boolean hasPoisonBlade()
|
|
|
- {
|
|
|
- return poisonBladeTime > 0;
|
|
|
- }
|
|
|
-
|
|
|
- private void tickPoisonBlade()
|
|
|
- {
|
|
|
- if(poisonBladeTime != Integer.MAX_VALUE && poisonBladeTime > 0)
|
|
|
- {
|
|
|
- poisonBladeTime--;
|
|
|
- if(poisonBladeTime <= 0)
|
|
|
- {
|
|
|
- setPoisonBlade(0);
|
|
|
- }
|
|
|
- }
|
|
|
- }
|
|
|
-
|
|
|
- // -------------------------------------------------------------------------
|
|
|
- // arrow immunity
|
|
|
- // -------------------------------------------------------------------------
|
|
|
-
|
|
|
- private int arrowImmunityTime = 0;
|
|
|
-
|
|
|
- public void setArrowImmunity(int time)
|
|
|
- {
|
|
|
- this.arrowImmunityTime = time;
|
|
|
- sendTimedStatus(hasArrowImmunity(), (byte) 14, time, "§a#entitydata.arrowImmunity");
|
|
|
- }
|
|
|
-
|
|
|
- public boolean hasArrowImmunity()
|
|
|
- {
|
|
|
- return arrowImmunityTime > 0;
|
|
|
- }
|
|
|
-
|
|
|
- private void tickArrowImmunity()
|
|
|
- {
|
|
|
- if(arrowImmunityTime != Integer.MAX_VALUE && arrowImmunityTime > 0)
|
|
|
- {
|
|
|
- arrowImmunityTime--;
|
|
|
- if(arrowImmunityTime <= 0)
|
|
|
- {
|
|
|
- setArrowImmunity(0);
|
|
|
- }
|
|
|
- }
|
|
|
- }
|
|
|
-
|
|
|
- // -------------------------------------------------------------------------
|
|
|
- // fall immunity
|
|
|
- // -------------------------------------------------------------------------
|
|
|
-
|
|
|
- private int fallImmunityTime = 0;
|
|
|
-
|
|
|
- public void setFallImmunity(int time)
|
|
|
- {
|
|
|
- this.fallImmunityTime = time;
|
|
|
- sendTimedStatus(hasFallImmunity(), (byte) 15, time, "§a#entitydata.fallImmunity");
|
|
|
- }
|
|
|
-
|
|
|
- public boolean hasFallImmunity()
|
|
|
- {
|
|
|
- return fallImmunityTime > 0;
|
|
|
- }
|
|
|
-
|
|
|
- private void tickFallImmunity()
|
|
|
- {
|
|
|
- if(fallImmunityTime != Integer.MAX_VALUE && fallImmunityTime > 0)
|
|
|
- {
|
|
|
- fallImmunityTime--;
|
|
|
- if(fallImmunityTime <= 0)
|
|
|
- {
|
|
|
- setFallImmunity(0);
|
|
|
- }
|
|
|
- }
|
|
|
- }
|
|
|
-
|
|
|
- // -------------------------------------------------------------------------
|
|
|
- // silence
|
|
|
- // -------------------------------------------------------------------------
|
|
|
-
|
|
|
- private int silenceTime = 0;
|
|
|
-
|
|
|
- public void setSilenceTime(int time)
|
|
|
- {
|
|
|
- if(hasIgnorance())
|
|
|
- {
|
|
|
- return;
|
|
|
- }
|
|
|
- this.silenceTime = time;
|
|
|
- sendTimedStatus(isSilenced(), (byte) 16, time, "§c#entitydata.silence");
|
|
|
- }
|
|
|
-
|
|
|
- public boolean isSilenced()
|
|
|
- {
|
|
|
- return silenceTime > 0;
|
|
|
- }
|
|
|
-
|
|
|
- private void tickSilence()
|
|
|
- {
|
|
|
- if(silenceTime != Integer.MAX_VALUE && silenceTime > 0)
|
|
|
- {
|
|
|
- silenceTime--;
|
|
|
- if(silenceTime <= 0)
|
|
|
- {
|
|
|
- setSilenceTime(0);
|
|
|
- }
|
|
|
- }
|
|
|
- }
|
|
|
-
|
|
|
- // -------------------------------------------------------------------------
|
|
|
- // shadow
|
|
|
- // -------------------------------------------------------------------------
|
|
|
-
|
|
|
- private int shadowTime = 0;
|
|
|
-
|
|
|
- public void setShadow(int time)
|
|
|
- {
|
|
|
- this.shadowTime = time;
|
|
|
- sendTimedStatus(isShadow(), (byte) 17, time, "§a#entitydata.shadow");
|
|
|
- }
|
|
|
-
|
|
|
- public boolean isShadow()
|
|
|
- {
|
|
|
- return shadowTime > 0;
|
|
|
- }
|
|
|
-
|
|
|
- private void tickShadow()
|
|
|
- {
|
|
|
- if(shadowTime != Integer.MAX_VALUE && shadowTime > 0)
|
|
|
- {
|
|
|
- shadowTime--;
|
|
|
- if(shadowTime <= 0)
|
|
|
- {
|
|
|
- setShadow(0);
|
|
|
- }
|
|
|
- }
|
|
|
- }
|
|
|
-
|
|
|
- // -------------------------------------------------------------------------
|
|
|
- // gravity
|
|
|
- // -------------------------------------------------------------------------
|
|
|
-
|
|
|
- private int gravityTime = 0;
|
|
|
-
|
|
|
- public void setGravity(int time)
|
|
|
- {
|
|
|
- this.gravityTime = time;
|
|
|
- if(time == 0)
|
|
|
- {
|
|
|
- ent.setNoGravity(false);
|
|
|
- }
|
|
|
- else
|
|
|
- {
|
|
|
- ent.setNoGravity(true);
|
|
|
- }
|
|
|
- sendTimedStatus(time > 0, (byte) 18, time, "§a#entitydata.gravity");
|
|
|
- }
|
|
|
-
|
|
|
- public boolean hasGravity()
|
|
|
- {
|
|
|
- return gravityTime > 0;
|
|
|
- }
|
|
|
-
|
|
|
- private void tickGravity()
|
|
|
- {
|
|
|
- if(gravityTime != Integer.MAX_VALUE && gravityTime > 0)
|
|
|
- {
|
|
|
- gravityTime--;
|
|
|
- if(gravityTime <= 0)
|
|
|
- {
|
|
|
- setGravity(0);
|
|
|
- }
|
|
|
- }
|
|
|
- }
|
|
|
-
|
|
|
- // -------------------------------------------------------------------------
|
|
|
- // ignorance
|
|
|
- // -------------------------------------------------------------------------
|
|
|
-
|
|
|
- private int ignoranceTime = 0;
|
|
|
-
|
|
|
- public void setIgnorance(int time)
|
|
|
- {
|
|
|
- this.ignoranceTime = time;
|
|
|
- sendTimedStatus(time > 0, (byte) 19, time, "§a#entitydata.ignorance");
|
|
|
- }
|
|
|
-
|
|
|
- public boolean hasIgnorance()
|
|
|
- {
|
|
|
- return ignoranceTime > 0;
|
|
|
- }
|
|
|
-
|
|
|
- private void tickIgnorance()
|
|
|
- {
|
|
|
- if(ignoranceTime != Integer.MAX_VALUE && ignoranceTime > 0)
|
|
|
- {
|
|
|
- ignoranceTime--;
|
|
|
- if(ignoranceTime <= 0)
|
|
|
- {
|
|
|
- setIgnorance(0);
|
|
|
- }
|
|
|
- }
|
|
|
- }
|
|
|
-
|
|
|
- // -------------------------------------------------------------------------
|
|
|
- // gold
|
|
|
- // -------------------------------------------------------------------------
|
|
|
-
|
|
|
- private int goldTime = 0;
|
|
|
- private float goldBonus = 0;
|
|
|
-
|
|
|
- public void setGoldBonus(int time, float bonus)
|
|
|
- {
|
|
|
- this.goldTime = time;
|
|
|
- this.goldBonus = bonus;
|
|
|
- sendTimedStatus(hasGoldBonus(), (byte) 20, time, "§a+" + Math.round(goldBonus * 100 - 100) + "% #entitydata.goldBonus");
|
|
|
- }
|
|
|
-
|
|
|
- public boolean hasGoldBonus()
|
|
|
- {
|
|
|
- return goldTime > 0;
|
|
|
- }
|
|
|
-
|
|
|
- public float getGoldBonus()
|
|
|
- {
|
|
|
- return goldBonus;
|
|
|
- }
|
|
|
-
|
|
|
- private void tickGoldBonus()
|
|
|
- {
|
|
|
- if(goldTime != Integer.MAX_VALUE && goldTime > 0)
|
|
|
- {
|
|
|
- goldTime--;
|
|
|
- if(goldTime <= 0)
|
|
|
- {
|
|
|
- setGoldBonus(0, 0);
|
|
|
- }
|
|
|
- }
|
|
|
- }
|
|
|
-
|
|
|
- // -------------------------------------------------------------------------
|
|
|
- // aqua affinity
|
|
|
- // -------------------------------------------------------------------------
|
|
|
-
|
|
|
- private int aquaAffinityTime = 0;
|
|
|
-
|
|
|
- public void setAquaAffinity(int time)
|
|
|
- {
|
|
|
- this.aquaAffinityTime = time;
|
|
|
- sendTimedStatus(time > 0, (byte) 21, time, "§a#entitydata.aquaAffinity");
|
|
|
- }
|
|
|
-
|
|
|
- public boolean hasAquaAffinity()
|
|
|
- {
|
|
|
- return aquaAffinityTime > 0;
|
|
|
- }
|
|
|
-
|
|
|
- private void tickAquaAffinity()
|
|
|
- {
|
|
|
- if(aquaAffinityTime != Integer.MAX_VALUE && aquaAffinityTime > 0)
|
|
|
- {
|
|
|
- aquaAffinityTime--;
|
|
|
- if(aquaAffinityTime <= 0)
|
|
|
- {
|
|
|
- setAquaAffinity(0);
|
|
|
- }
|
|
|
- }
|
|
|
- }
|
|
|
-}
|
|
|
-
|