no invuln temp fix

This commit is contained in:
Sen 2025-04-01 01:32:19 +02:00
parent cb3787349b
commit eea23233f4
19 changed files with 220 additions and 217 deletions

View file

@ -1316,15 +1316,15 @@ public abstract class Entity
*/
public boolean attackEntityFrom(DamageSource source, int amount)
{
if (this.isEntityInvulnerable(source))
{
return false;
}
else
{
this.setBeenAttacked();
return false;
}
// if (this.isEntityInvulnerable(source))
// {
// return false;
// }
// else
// {
this.setBeenAttacked();
return false;
// }
}
/**
@ -2333,10 +2333,10 @@ public abstract class Entity
// return String.format("%s[\'%s\'/%d, l=\'%s\', x=%.2f, y=%.2f, z=%.2f]", this.getClass().getSimpleName(), this.getName(), this.eid, this.worldObj == null ? "~NULL~" : this.worldObj.dimension.getDimensionId(), this.posX, this.posY, this.posZ);
// }
public final boolean isEntityInvulnerable(DamageSource source)
{
return false; // this.invulnerable && source != DamageSource.outOfWorld; // && !source.isCreativePlayer();
}
// public final boolean isEntityInvulnerable(DamageSource source)
// {
// return false; // this.invulnerable && source != DamageSource.outOfWorld; // && !source.isCreativePlayer();
// }
/**
* Sets this entity's location and angles to the location and angles of the passed in entity.

View file

@ -230,19 +230,19 @@ public class EntityBat extends EntityLiving
*/
public boolean attackEntityFrom(DamageSource source, int amount)
{
if (this.isEntityInvulnerable(source))
// if (this.isEntityInvulnerable(source))
// {
// return false;
// }
// else
// {
if (!this.worldObj.client && this.getIsBatHanging())
{
return false;
this.setIsBatHanging(false);
}
else
{
if (!this.worldObj.client && this.getIsBatHanging())
{
this.setIsBatHanging(false);
}
return super.attackEntityFrom(source, amount);
}
return super.attackEntityFrom(source, amount);
// }
}
/**

View file

@ -51,7 +51,7 @@ public class EntityDragonPart extends Entity
*/
public boolean attackEntityFrom(DamageSource source, int amount)
{
return this.isEntityInvulnerable(source) ? false : this.entityDragonObj.attackEntityFromPart(this, source, amount);
return /* this.isEntityInvulnerable(source) ? false : */ this.entityDragonObj.attackEntityFromPart(this, source, amount);
}
/**

View file

@ -187,15 +187,15 @@ public class EntityOcelot extends EntityTameable
*/
public boolean attackEntityFrom(DamageSource source, int amount)
{
if (this.isEntityInvulnerable(source))
{
return false;
}
else
{
this.aiSit.setSitting(false);
return super.attackEntityFrom(source, amount);
}
// if (this.isEntityInvulnerable(source))
// {
// return false;
// }
// else
// {
this.aiSit.setSitting(false);
return super.attackEntityFrom(source, amount);
// }
}
/**

View file

@ -242,9 +242,9 @@ public class EntityRabbit extends EntityAnimal {
return this.getRabbitType() == 99 ? 8 : super.getTotalArmorValue();
}
public boolean attackEntityFrom(DamageSource source, int amount) {
return this.isEntityInvulnerable(source) ? false : super.attackEntityFrom(source, amount);
}
// public boolean attackEntityFrom(DamageSource source, int amount) {
// return this.isEntityInvulnerable(source) ? false : super.attackEntityFrom(source, amount);
// }
// protected void addRandomDrop() {
// this.entityDropItem(new ItemStack(Items.rabbit_foot, 1), 0.0F);

View file

@ -332,22 +332,22 @@ public class EntityWolf extends EntityTameable
*/
public boolean attackEntityFrom(DamageSource source, int amount)
{
if (this.isEntityInvulnerable(source))
{
return false;
}
else
{
// if (this.isEntityInvulnerable(source))
// {
// return false;
// }
// else
// {
// Entity entity = source.getEntity();
this.aiSit.setSitting(false);
this.aiSit.setSitting(false);
// if (entity != null && !(entity.isPlayer()) && !(entity instanceof EntityArrow))
// {
// amount = (amount + 1) / 2;
// }
return super.attackEntityFrom(source, amount);
}
return super.attackEntityFrom(source, amount);
// }
}
public boolean attackEntityAsMob(Entity entityIn)

View file

@ -111,11 +111,12 @@ public class EntityBoat extends Entity
*/
public boolean attackEntityFrom(DamageSource source, int amount)
{
if (this.isEntityInvulnerable(source))
{
return false;
}
else if (!this.worldObj.client && !this.dead)
// if (this.isEntityInvulnerable(source))
// {
// return false;
// }
// else
if (!this.worldObj.client && !this.dead)
{
if (this.passenger != null && this.passenger == source.getEntity() && source instanceof EntityDamageSourceIndirect)
{

View file

@ -146,24 +146,24 @@ public abstract class EntityCart extends Entity implements IWorldNameable
{
if (!this.worldObj.client && !this.dead)
{
if (this.isEntityInvulnerable(source))
{
return false;
}
else
{
this.setRollingDirection(-this.getRollingDirection());
this.setRollingAmplitude(10);
this.setBeenAttacked();
this.setDamage(this.getDamage() + (int)amount * 10);
// if (this.isEntityInvulnerable(source))
// {
// return false;
// }
// else
// {
this.setRollingDirection(-this.getRollingDirection());
this.setRollingAmplitude(10);
this.setBeenAttacked();
this.setDamage(this.getDamage() + (int)amount * 10);
// boolean flag = source.getEntity().isPlayer() && ((EntityNPC)source.getEntity()).creative;
if (/* flag || */ this.getDamage() > 40)
if (/* flag || */ this.getDamage() > 40)
{
if (this.passenger != null)
{
if (this.passenger != null)
{
this.passenger.mountEntity((Entity)null);
}
this.passenger.mountEntity((Entity)null);
}
// if (flag && !this.hasCustomName())
// {
@ -171,12 +171,12 @@ public abstract class EntityCart extends Entity implements IWorldNameable
// }
// else
// {
this.killMinecart(source);
this.killMinecart(source);
// }
}
return true;
}
return true;
// }
}
else
{

View file

@ -87,29 +87,29 @@ public class EntityCrystal extends Entity
*/
public boolean attackEntityFrom(DamageSource source, int amount)
{
if (this.isEntityInvulnerable(source))
// if (this.isEntityInvulnerable(source))
// {
// return false;
// }
// else
// {
if (!this.dead && !this.worldObj.client)
{
return false;
}
else
{
if (!this.dead && !this.worldObj.client)
{
// this.health = 0;
//
// if (this.health <= 0)
// {
this.setDead();
this.setDead();
// if (!this.worldObj.client)
// {
this.worldObj.createExplosion(null, this.posX, this.posY, this.posZ, 6.0F, true);
this.worldObj.createExplosion(null, this.posX, this.posY, this.posZ, 6.0F, true);
// }
// }
}
return true;
}
return true;
// }
}
public int getTrackingRange() {

View file

@ -317,26 +317,26 @@ public class EntityItem extends Entity
*/
public boolean attackEntityFrom(DamageSource source, int amount)
{
if (this.isEntityInvulnerable(source))
{
return false;
}
// else if (this.getEntityItem() != null && this.getEntityItem().getItem() == Items.nether_star && source.isExplosion())
// if (this.isEntityInvulnerable(source))
// {
// return false;
// }
else
//// else if (this.getEntityItem() != null && this.getEntityItem().getItem() == Items.nether_star && source.isExplosion())
//// {
//// return false;
//// }
// else
// {
this.setBeenAttacked();
this.health = this.health - (int)amount;
if (this.health <= 0)
{
this.setBeenAttacked();
this.health = this.health - (int)amount;
if (this.health <= 0)
{
this.setDead();
}
return false;
this.setDead();
}
return false;
// }
}
/**

View file

@ -201,21 +201,21 @@ public class EntityLeashKnot extends Entity
*/
public boolean attackEntityFrom(DamageSource source, int amount)
{
if (this.isEntityInvulnerable(source))
// if (this.isEntityInvulnerable(source))
// {
// return false;
// }
// else
// {
if (!this.dead && !this.worldObj.client)
{
return false;
}
else
{
if (!this.dead && !this.worldObj.client)
{
this.setDead();
this.setBeenAttacked();
this.setDead();
this.setBeenAttacked();
// this.onBroken(source.getEntity());
}
return true;
}
return true;
// }
}
/**

View file

@ -272,22 +272,22 @@ public class EntityXp extends Entity implements IObjectData
*/
public boolean attackEntityFrom(DamageSource source, int amount)
{
if (this.isEntityInvulnerable(source))
{
return false;
}
else
{
this.setBeenAttacked();
this.xpOrbHealth = this.xpOrbHealth - (int)amount;
// if (this.isEntityInvulnerable(source))
// {
// return false;
// }
// else
// {
this.setBeenAttacked();
this.xpOrbHealth = this.xpOrbHealth - (int)amount;
if (this.xpOrbHealth <= 0)
{
this.setDead();
}
return false;
if (this.xpOrbHealth <= 0)
{
this.setDead();
}
return false;
// }
}
/**

View file

@ -147,11 +147,12 @@ public class EntityGargoyle extends EntityFlyingNPC
public boolean attackEntityFrom(DamageSource source, int amount)
{
if (this.isEntityInvulnerable(source))
{
return false;
}
else if (this.getInvulTime() > 0 && source != DamageSource.outOfWorld)
// if (this.isEntityInvulnerable(source))
// {
// return false;
// }
// else
if (this.getInvulTime() > 0 && source != DamageSource.outOfWorld)
{
return false;
}

View file

@ -150,21 +150,21 @@ public abstract class EntityMobNPC extends EntityNPC
*/
public boolean attackEntityFrom(DamageSource source, int amount)
{
if (this.isEntityInvulnerable(source))
{
return false;
}
else
{
Entity entity = source.getEntity();
// if (this.isEntityInvulnerable(source))
// {
// return false;
// }
// else
// {
Entity entity = source.getEntity();
if (entity != null && entity instanceof EntityNPC)
{
this.becomeAngryAt(entity);
}
return super.attackEntityFrom(source, amount);
if (entity != null && entity instanceof EntityNPC)
{
this.becomeAngryAt(entity);
}
return super.attackEntityFrom(source, amount);
// }
}
/**

View file

@ -1762,8 +1762,8 @@ public abstract class EntityNPC extends EntityLiving
{
if(this.gm != null)
return this.sendQueue == null;
if(this.isEntityInvulnerable(source))
return false;
// if(this.isEntityInvulnerable(source))
// return false;
if(this.connection != null) {
if(this.getHealth() <= 0)
return false;
@ -2030,8 +2030,8 @@ public abstract class EntityNPC extends EntityLiving
protected void damageEntity(DamageSource damageSrc, int damageAmount)
{
if(this.sendQueue != null) {
if(!this.isEntityInvulnerable(damageSrc))
this.setHealth(this.getHealth() - damageAmount);
// if(!this.isEntityInvulnerable(damageSrc))
this.setHealth(this.getHealth() - damageAmount);
return;
}
if(!this.isPlayer()) {
@ -2039,32 +2039,32 @@ public abstract class EntityNPC extends EntityLiving
return;
}
if (!this.isEntityInvulnerable(damageSrc))
// if (!this.isEntityInvulnerable(damageSrc))
// {
if (!damageSrc.isUnblockable() && this.isBlocking() && damageAmount > 0)
{
if (!damageSrc.isUnblockable() && this.isBlocking() && damageAmount > 0)
{
damageAmount = (1 + damageAmount) / 2;
}
damageAmount = (1 + damageAmount) / 2;
}
damageAmount = this.applyArmorCalculations(damageSrc, damageAmount);
damageAmount = this.applyPotionDamageCalculations(damageSrc, damageAmount);
int f = damageAmount;
damageAmount = Math.max(damageAmount - this.getAbsorptionAmount(), 0);
this.setAbsorptionAmount(this.getAbsorptionAmount() - (f - damageAmount));
damageAmount = this.applyArmorCalculations(damageSrc, damageAmount);
damageAmount = this.applyPotionDamageCalculations(damageSrc, damageAmount);
int f = damageAmount;
damageAmount = Math.max(damageAmount - this.getAbsorptionAmount(), 0);
this.setAbsorptionAmount(this.getAbsorptionAmount() - (f - damageAmount));
if (damageAmount != 0)
{
if (damageAmount != 0)
{
// float f1 = this.getHealth();
this.setHealth(this.getHealth() - damageAmount);
this.trackDamage(damageSrc, damageAmount);
this.setHealth(this.getHealth() - damageAmount);
this.trackDamage(damageSrc, damageAmount);
// if ((float)damageAmount < 3.4028235E37F)
// {
// if(damageAmount < Integer.MAX_VALUE)
// this.addStat(StatRegistry.damageTakenStat, damageAmount);
// }
}
}
// }
}
/**

View file

@ -146,8 +146,8 @@ public class EntityDie extends EntityThrowable implements IObjectData
public boolean attackEntityFrom(DamageSource source, int amount)
{
if(this.isEntityInvulnerable(source))
return false;
// if(this.isEntityInvulnerable(source))
// return false;
if(!this.worldObj.client && !this.dead) {
if(!this.noPickup)
this.entityDropItem(this.getStack(), 0.0f);

View file

@ -318,40 +318,40 @@ public abstract class EntityProjectile extends Entity
*/
public boolean attackEntityFrom(DamageSource source, int amount)
{
if (this.isEntityInvulnerable(source))
// if (this.isEntityInvulnerable(source))
// {
// return false;
// }
// else
// {
this.setBeenAttacked();
if (source.getEntity() != null)
{
return false;
Vec3 vec3 = source.getEntity().getLookVec();
if (vec3 != null)
{
this.motionX = vec3.xCoord;
this.motionY = vec3.yCoord;
this.motionZ = vec3.zCoord;
this.accelerationX = this.motionX * 0.1D;
this.accelerationY = this.motionY * 0.1D;
this.accelerationZ = this.motionZ * 0.1D;
}
if (source.getEntity() instanceof EntityLiving)
{
this.shootingEntity = (EntityLiving)source.getEntity();
}
return true;
}
else
{
this.setBeenAttacked();
if (source.getEntity() != null)
{
Vec3 vec3 = source.getEntity().getLookVec();
if (vec3 != null)
{
this.motionX = vec3.xCoord;
this.motionY = vec3.yCoord;
this.motionZ = vec3.zCoord;
this.accelerationX = this.motionX * 0.1D;
this.accelerationY = this.motionY * 0.1D;
this.accelerationZ = this.motionZ * 0.1D;
}
if (source.getEntity() instanceof EntityLiving)
{
this.shootingEntity = (EntityLiving)source.getEntity();
}
return true;
}
else
{
return false;
}
return false;
}
// }
}
/**

View file

@ -82,15 +82,15 @@ public abstract class EntityAnimal extends EntityLiving
*/
public boolean attackEntityFrom(DamageSource source, int amount)
{
if (this.isEntityInvulnerable(source))
{
return false;
}
else
{
this.resetInLove();
return super.attackEntityFrom(source, amount);
}
// if (this.isEntityInvulnerable(source))
// {
// return false;
// }
// else
// {
this.resetInLove();
return super.attackEntityFrom(source, amount);
// }
}
public float getBlockPathWeight(BlockPos pos)

View file

@ -940,11 +940,12 @@ public abstract class EntityLiving extends Entity
*/
public boolean attackEntityFrom(DamageSource source, int amount)
{
if (this.isEntityInvulnerable(source))
{
return false;
}
else if (this.worldObj.client)
// if (this.isEntityInvulnerable(source))
// {
// return false;
// }
// else
if (this.worldObj.client)
{
return false;
}
@ -1356,22 +1357,22 @@ public abstract class EntityLiving extends Entity
*/
protected void damageEntity(DamageSource damageSrc, int damageAmount)
{
if (!this.isEntityInvulnerable(damageSrc))
{
damageAmount = this.applyArmorCalculations(damageSrc, damageAmount);
damageAmount = this.applyPotionDamageCalculations(damageSrc, damageAmount);
int f = damageAmount;
damageAmount = Math.max(damageAmount - this.getAbsorptionAmount(), 0);
this.setAbsorptionAmount(this.getAbsorptionAmount() - (f - damageAmount));
// if (!this.isEntityInvulnerable(damageSrc))
// {
damageAmount = this.applyArmorCalculations(damageSrc, damageAmount);
damageAmount = this.applyPotionDamageCalculations(damageSrc, damageAmount);
int f = damageAmount;
damageAmount = Math.max(damageAmount - this.getAbsorptionAmount(), 0);
this.setAbsorptionAmount(this.getAbsorptionAmount() - (f - damageAmount));
if (damageAmount != 0)
{
if (damageAmount != 0)
{
// float f1 = this.getHealth();
this.setHealth(this.getHealth() - damageAmount);
this.trackDamage(damageSrc, damageAmount);
this.setAbsorptionAmount(this.getAbsorptionAmount() - damageAmount);
}
this.setHealth(this.getHealth() - damageAmount);
this.trackDamage(damageSrc, damageAmount);
this.setAbsorptionAmount(this.getAbsorptionAmount() - damageAmount);
}
// }
}
public EntityLiving getAttackingEntity()