From eea23233f4b3aec65379060cd5c7c3a9e86f8678 Mon Sep 17 00:00:00 2001 From: Sen Date: Tue, 1 Apr 2025 01:32:19 +0200 Subject: [PATCH] no invuln temp fix --- java/src/game/entity/Entity.java | 26 ++++----- java/src/game/entity/animal/EntityBat.java | 20 +++---- .../game/entity/animal/EntityDragonPart.java | 2 +- java/src/game/entity/animal/EntityOcelot.java | 18 +++--- java/src/game/entity/animal/EntityRabbit.java | 6 +- java/src/game/entity/animal/EntityWolf.java | 18 +++--- java/src/game/entity/item/EntityBoat.java | 11 ++-- java/src/game/entity/item/EntityCart.java | 38 ++++++------ java/src/game/entity/item/EntityCrystal.java | 24 ++++---- java/src/game/entity/item/EntityItem.java | 30 +++++----- .../src/game/entity/item/EntityLeashKnot.java | 24 ++++---- java/src/game/entity/item/EntityXp.java | 28 ++++----- java/src/game/entity/npc/EntityGargoyle.java | 11 ++-- java/src/game/entity/npc/EntityMobNPC.java | 26 ++++----- java/src/game/entity/npc/EntityNPC.java | 38 ++++++------ .../src/game/entity/projectile/EntityDie.java | 4 +- .../entity/projectile/EntityProjectile.java | 58 +++++++++---------- java/src/game/entity/types/EntityAnimal.java | 18 +++--- java/src/game/entity/types/EntityLiving.java | 37 ++++++------ 19 files changed, 220 insertions(+), 217 deletions(-) diff --git a/java/src/game/entity/Entity.java b/java/src/game/entity/Entity.java index 2ea54cc..e972e30 100755 --- a/java/src/game/entity/Entity.java +++ b/java/src/game/entity/Entity.java @@ -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. diff --git a/java/src/game/entity/animal/EntityBat.java b/java/src/game/entity/animal/EntityBat.java index 741260e..7478685 100755 --- a/java/src/game/entity/animal/EntityBat.java +++ b/java/src/game/entity/animal/EntityBat.java @@ -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); +// } } /** diff --git a/java/src/game/entity/animal/EntityDragonPart.java b/java/src/game/entity/animal/EntityDragonPart.java index 6b49f46..3f9bf65 100755 --- a/java/src/game/entity/animal/EntityDragonPart.java +++ b/java/src/game/entity/animal/EntityDragonPart.java @@ -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); } /** diff --git a/java/src/game/entity/animal/EntityOcelot.java b/java/src/game/entity/animal/EntityOcelot.java index 3b237d7..85b685c 100755 --- a/java/src/game/entity/animal/EntityOcelot.java +++ b/java/src/game/entity/animal/EntityOcelot.java @@ -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); +// } } /** diff --git a/java/src/game/entity/animal/EntityRabbit.java b/java/src/game/entity/animal/EntityRabbit.java index 9c4da72..7878ba3 100755 --- a/java/src/game/entity/animal/EntityRabbit.java +++ b/java/src/game/entity/animal/EntityRabbit.java @@ -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); diff --git a/java/src/game/entity/animal/EntityWolf.java b/java/src/game/entity/animal/EntityWolf.java index 756d56a..33c7ee3 100755 --- a/java/src/game/entity/animal/EntityWolf.java +++ b/java/src/game/entity/animal/EntityWolf.java @@ -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) diff --git a/java/src/game/entity/item/EntityBoat.java b/java/src/game/entity/item/EntityBoat.java index 7457d83..77f22d2 100755 --- a/java/src/game/entity/item/EntityBoat.java +++ b/java/src/game/entity/item/EntityBoat.java @@ -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) { diff --git a/java/src/game/entity/item/EntityCart.java b/java/src/game/entity/item/EntityCart.java index a8655f7..d1f0058 100755 --- a/java/src/game/entity/item/EntityCart.java +++ b/java/src/game/entity/item/EntityCart.java @@ -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 { diff --git a/java/src/game/entity/item/EntityCrystal.java b/java/src/game/entity/item/EntityCrystal.java index f066b1d..b348d57 100755 --- a/java/src/game/entity/item/EntityCrystal.java +++ b/java/src/game/entity/item/EntityCrystal.java @@ -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() { diff --git a/java/src/game/entity/item/EntityItem.java b/java/src/game/entity/item/EntityItem.java index 3fed7ee..01c751b 100755 --- a/java/src/game/entity/item/EntityItem.java +++ b/java/src/game/entity/item/EntityItem.java @@ -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; +// } } /** diff --git a/java/src/game/entity/item/EntityLeashKnot.java b/java/src/game/entity/item/EntityLeashKnot.java index 22844dd..ff89910 100755 --- a/java/src/game/entity/item/EntityLeashKnot.java +++ b/java/src/game/entity/item/EntityLeashKnot.java @@ -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; +// } } /** diff --git a/java/src/game/entity/item/EntityXp.java b/java/src/game/entity/item/EntityXp.java index 67fb026..e8cae54 100755 --- a/java/src/game/entity/item/EntityXp.java +++ b/java/src/game/entity/item/EntityXp.java @@ -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; +// } } /** diff --git a/java/src/game/entity/npc/EntityGargoyle.java b/java/src/game/entity/npc/EntityGargoyle.java index 8bbcc26..14ce5b7 100755 --- a/java/src/game/entity/npc/EntityGargoyle.java +++ b/java/src/game/entity/npc/EntityGargoyle.java @@ -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; } diff --git a/java/src/game/entity/npc/EntityMobNPC.java b/java/src/game/entity/npc/EntityMobNPC.java index b7373ad..2a39783 100755 --- a/java/src/game/entity/npc/EntityMobNPC.java +++ b/java/src/game/entity/npc/EntityMobNPC.java @@ -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); +// } } /** diff --git a/java/src/game/entity/npc/EntityNPC.java b/java/src/game/entity/npc/EntityNPC.java index e04faf1..8e78048 100755 --- a/java/src/game/entity/npc/EntityNPC.java +++ b/java/src/game/entity/npc/EntityNPC.java @@ -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); // } - } } +// } } /** diff --git a/java/src/game/entity/projectile/EntityDie.java b/java/src/game/entity/projectile/EntityDie.java index a308abd..f242b73 100755 --- a/java/src/game/entity/projectile/EntityDie.java +++ b/java/src/game/entity/projectile/EntityDie.java @@ -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); diff --git a/java/src/game/entity/projectile/EntityProjectile.java b/java/src/game/entity/projectile/EntityProjectile.java index 3c7847f..cde6ff9 100755 --- a/java/src/game/entity/projectile/EntityProjectile.java +++ b/java/src/game/entity/projectile/EntityProjectile.java @@ -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; } +// } } /** diff --git a/java/src/game/entity/types/EntityAnimal.java b/java/src/game/entity/types/EntityAnimal.java index a4808c2..e9f995d 100755 --- a/java/src/game/entity/types/EntityAnimal.java +++ b/java/src/game/entity/types/EntityAnimal.java @@ -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) diff --git a/java/src/game/entity/types/EntityLiving.java b/java/src/game/entity/types/EntityLiving.java index 2ca2798..560d5b7 100755 --- a/java/src/game/entity/types/EntityLiving.java +++ b/java/src/game/entity/types/EntityLiving.java @@ -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()