potion cleanup

This commit is contained in:
Sen 2025-03-26 21:07:23 +01:00
parent 460a58e062
commit e108650cd4
30 changed files with 644 additions and 968 deletions

View file

@ -798,15 +798,15 @@ public abstract class EntityNPC extends EntityLiving
double d3 = target.posZ + target.motionZ - this.posZ;
float f = ExtMath.sqrtd(d1 * d1 + d3 * d3);
if (f >= 8.0F && !target.hasEffect(Potion.moveSlowdown))
if (f >= 8.0F && !target.hasEffect(Potion.SLOWNESS))
{
entitypotion.setPotionDamage(32698);
}
else if (target.getHealth() >= 8 && !target.hasEffect(Potion.poison))
else if (target.getHealth() >= 8 && !target.hasEffect(Potion.POISON))
{
entitypotion.setPotionDamage(32660);
}
else if (f <= 3.0F && !target.hasEffect(Potion.weakness) && this.rand.floatv() < 0.25F)
else if (f <= 3.0F && !target.hasEffect(Potion.WEAKNESS) && this.rand.floatv() < 0.25F)
{
entitypotion.setPotionDamage(32696);
}
@ -2404,7 +2404,7 @@ public abstract class EntityNPC extends EntityLiving
this.pushOutOfBlocks(this.posX + (double)this.width * 0.35D, this.getEntityBoundingBox().minY + 0.5D, this.posZ + (double)this.width * 0.35D);
boolean canSprint = true; // (float)this.getFoodStats().getFoodLevel() > 6.0F || this.allowFlying;
if (this.onGround && !flag1 && !flag2 && this.gm.moveForward >= f && !this.isSprinting() && canSprint && !this.isUsingItem() && !this.hasEffect(Potion.blindness))
if (this.onGround && !flag1 && !flag2 && this.gm.moveForward >= f && !this.isSprinting() && canSprint && !this.isUsingItem() && !this.hasEffect(Potion.BLINDNESS))
{
if (this.sprintToggleTimer <= 0 && !this.gm.sprint)
{
@ -2416,7 +2416,7 @@ public abstract class EntityNPC extends EntityLiving
}
}
if (!this.isSprinting() && this.gm.moveForward >= f && canSprint && !this.isUsingItem() && !this.hasEffect(Potion.blindness) && this.gm.sprint)
if (!this.isSprinting() && this.gm.moveForward >= f && canSprint && !this.isUsingItem() && !this.hasEffect(Potion.BLINDNESS) && this.gm.sprint)
{
this.setSprinting(true);
}
@ -2426,7 +2426,7 @@ public abstract class EntityNPC extends EntityLiving
this.setSprinting(false);
}
if (this.hasEffect(Potion.flying) || this.noclip)
if (this.hasEffect(Potion.FLYING) || this.noclip)
{
if (this.noclip)
{
@ -3037,7 +3037,7 @@ public abstract class EntityNPC extends EntityLiving
protected void onFinishedEffect(PotionEffect effect) {
super.onFinishedEffect(effect);
if(this.isPlayer() && effect.getPotionID() == Potion.flying.id)
if(this.isPlayer() && effect.getPotion() == Potion.FLYING)
this.flying = false;
// super.onFinishedEffect(effect);
if(this.connection != null)
@ -3380,19 +3380,19 @@ public abstract class EntityNPC extends EntityLiving
}
}
if (this.hasEffect(Potion.digSpeed))
if (this.hasEffect(Potion.HASTE))
{
int speed = this.getEffect(Potion.digSpeed).getAmplifier();
int speed = this.getEffect(Potion.HASTE).getAmplifier();
if(speed >= 255)
return 1000000.0f;
f *= 1.0F + (float)(speed + 1) * 0.2F;
}
if (this.hasEffect(Potion.digSlowdown))
if (this.hasEffect(Potion.FATIGUE))
{
float f1 = 1.0F;
switch (this.getEffect(Potion.digSlowdown).getAmplifier())
switch (this.getEffect(Potion.FATIGUE).getAmplifier())
{
case 0:
f1 = 0.3F;
@ -3527,7 +3527,7 @@ public abstract class EntityNPC extends EntityLiving
// this.foodStats.readNBT(tagCompund);
// this.readCapabilitiesFromNBT(tagCompund);
this.flying = tagCompund.getBoolean("flying") && this.hasEffect(Potion.flying);
this.flying = tagCompund.getBoolean("flying") && this.hasEffect(Potion.FLYING);
// if(tagCompund.hasKey("speed", 99))
// this.speed = tagCompund.getFloat("speed");
// this.disableDamagePersist = tagCompund.getBoolean("alwaysInvulnerable");
@ -3803,7 +3803,7 @@ public abstract class EntityNPC extends EntityLiving
if (f > 0 || f1 > 0)
{
boolean flag = this.fallDistance > 0.0F && !this.onGround && !this.isOnLadder() && !this.isInLiquid() && !this.hasEffect(Potion.blindness) && this.vehicle == null && targetEntity instanceof EntityLiving;
boolean flag = this.fallDistance > 0.0F && !this.onGround && !this.isOnLadder() && !this.isInLiquid() && !this.hasEffect(Potion.BLINDNESS) && this.vehicle == null && targetEntity instanceof EntityLiving;
if (flag && f > 0)
{
@ -4118,7 +4118,7 @@ public abstract class EntityNPC extends EntityLiving
this.addStat((int)Math.round((double)distance * 100.0D));
}
if(!this.hasEffect(Potion.flying))
if(!this.hasEffect(Potion.FLYING))
super.fall(distance, damageMultiplier);
}
}