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) public boolean attackEntityFrom(DamageSource source, int amount)
{ {
if (this.isEntityInvulnerable(source)) // if (this.isEntityInvulnerable(source))
{ // {
return false; // return false;
} // }
else // else
{ // {
this.setBeenAttacked(); this.setBeenAttacked();
return false; 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); // 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) // public final boolean isEntityInvulnerable(DamageSource source)
{ // {
return false; // this.invulnerable && source != DamageSource.outOfWorld; // && !source.isCreativePlayer(); // 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. * 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) public boolean attackEntityFrom(DamageSource source, int amount)
{ {
if (this.isEntityInvulnerable(source)) // if (this.isEntityInvulnerable(source))
{ // {
return false; // return false;
} // }
else // else
{ // {
if (!this.worldObj.client && this.getIsBatHanging()) if (!this.worldObj.client && this.getIsBatHanging())
{ {
this.setIsBatHanging(false); 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) 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) public boolean attackEntityFrom(DamageSource source, int amount)
{ {
if (this.isEntityInvulnerable(source)) // if (this.isEntityInvulnerable(source))
{ // {
return false; // return false;
} // }
else // else
{ // {
this.aiSit.setSitting(false); this.aiSit.setSitting(false);
return super.attackEntityFrom(source, amount); return super.attackEntityFrom(source, amount);
} // }
} }
/** /**

View file

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

View file

@ -332,12 +332,12 @@ public class EntityWolf extends EntityTameable
*/ */
public boolean attackEntityFrom(DamageSource source, int amount) public boolean attackEntityFrom(DamageSource source, int amount)
{ {
if (this.isEntityInvulnerable(source)) // if (this.isEntityInvulnerable(source))
{ // {
return false; // return false;
} // }
else // else
{ // {
// Entity entity = source.getEntity(); // Entity entity = source.getEntity();
this.aiSit.setSitting(false); this.aiSit.setSitting(false);
@ -347,7 +347,7 @@ public class EntityWolf extends EntityTameable
// } // }
return super.attackEntityFrom(source, amount); return super.attackEntityFrom(source, amount);
} // }
} }
public boolean attackEntityAsMob(Entity entityIn) public boolean attackEntityAsMob(Entity entityIn)

View file

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

View file

@ -146,12 +146,12 @@ public abstract class EntityCart extends Entity implements IWorldNameable
{ {
if (!this.worldObj.client && !this.dead) if (!this.worldObj.client && !this.dead)
{ {
if (this.isEntityInvulnerable(source)) // if (this.isEntityInvulnerable(source))
{ // {
return false; // return false;
} // }
else // else
{ // {
this.setRollingDirection(-this.getRollingDirection()); this.setRollingDirection(-this.getRollingDirection());
this.setRollingAmplitude(10); this.setRollingAmplitude(10);
this.setBeenAttacked(); this.setBeenAttacked();
@ -176,7 +176,7 @@ public abstract class EntityCart extends Entity implements IWorldNameable
} }
return true; return true;
} // }
} }
else else
{ {

View file

@ -87,12 +87,12 @@ public class EntityCrystal extends Entity
*/ */
public boolean attackEntityFrom(DamageSource source, int amount) public boolean attackEntityFrom(DamageSource source, int amount)
{ {
if (this.isEntityInvulnerable(source)) // if (this.isEntityInvulnerable(source))
{ // {
return false; // return false;
} // }
else // else
{ // {
if (!this.dead && !this.worldObj.client) if (!this.dead && !this.worldObj.client)
{ {
// this.health = 0; // this.health = 0;
@ -109,7 +109,7 @@ public class EntityCrystal extends Entity
} }
return true; return true;
} // }
} }
public int getTrackingRange() { public int getTrackingRange() {

View file

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

View file

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

View file

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

View file

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

View file

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

View file

@ -1762,8 +1762,8 @@ public abstract class EntityNPC extends EntityLiving
{ {
if(this.gm != null) if(this.gm != null)
return this.sendQueue == null; return this.sendQueue == null;
if(this.isEntityInvulnerable(source)) // if(this.isEntityInvulnerable(source))
return false; // return false;
if(this.connection != null) { if(this.connection != null) {
if(this.getHealth() <= 0) if(this.getHealth() <= 0)
return false; return false;
@ -2030,7 +2030,7 @@ public abstract class EntityNPC extends EntityLiving
protected void damageEntity(DamageSource damageSrc, int damageAmount) protected void damageEntity(DamageSource damageSrc, int damageAmount)
{ {
if(this.sendQueue != null) { if(this.sendQueue != null) {
if(!this.isEntityInvulnerable(damageSrc)) // if(!this.isEntityInvulnerable(damageSrc))
this.setHealth(this.getHealth() - damageAmount); this.setHealth(this.getHealth() - damageAmount);
return; return;
} }
@ -2039,8 +2039,8 @@ public abstract class EntityNPC extends EntityLiving
return; 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;
@ -2064,7 +2064,7 @@ public abstract class EntityNPC extends EntityLiving
// this.addStat(StatRegistry.damageTakenStat, damageAmount); // 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) public boolean attackEntityFrom(DamageSource source, int amount)
{ {
if(this.isEntityInvulnerable(source)) // if(this.isEntityInvulnerable(source))
return false; // return false;
if(!this.worldObj.client && !this.dead) { if(!this.worldObj.client && !this.dead) {
if(!this.noPickup) if(!this.noPickup)
this.entityDropItem(this.getStack(), 0.0f); this.entityDropItem(this.getStack(), 0.0f);

View file

@ -318,12 +318,12 @@ public abstract class EntityProjectile extends Entity
*/ */
public boolean attackEntityFrom(DamageSource source, int amount) public boolean attackEntityFrom(DamageSource source, int amount)
{ {
if (this.isEntityInvulnerable(source)) // if (this.isEntityInvulnerable(source))
{ // {
return false; // return false;
} // }
else // else
{ // {
this.setBeenAttacked(); this.setBeenAttacked();
if (source.getEntity() != null) if (source.getEntity() != null)
@ -351,7 +351,7 @@ public abstract class EntityProjectile extends Entity
{ {
return false; return false;
} }
} // }
} }
/** /**

View file

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

View file

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