Skip to content

Commit

Permalink
TISCM creativeNoClip extra: make xp orb forget no clip players
Browse files Browse the repository at this point in the history
  • Loading branch information
Fallen-Breath committed Dec 9, 2024
1 parent 42907ef commit ced82e5
Showing 1 changed file with 12 additions and 6 deletions.
18 changes: 12 additions & 6 deletions patches/net/minecraft/entity/item/EntityXPOrb.java.patch
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@
public EntityXPOrb(World worldIn)
{
super(EntityType.EXPERIENCE_ORB, worldIn);
@@ -103,28 +128,40 @@
@@ -103,28 +128,46 @@
}

this.pushOutOfBlocks(this.posX, (this.getBoundingBox().minY + this.getBoundingBox().maxY) / 2.0D, this.posZ);
Expand Down Expand Up @@ -89,6 +89,12 @@
this.closestPlayer = null;
}

+ // TISCM creativeNoClip extra
+ if (this.closestPlayer != null && CreativeNoClipHelper.canEntityIgnoreClip(this.closestPlayer))
+ {
+ this.closestPlayer = null;
+ }
+
if (this.closestPlayer != null)
{
- double d1 = (this.closestPlayer.posX - this.posX) / 8.0D;
Expand All @@ -100,7 +106,7 @@
double d4 = Math.sqrt(d1 * d1 + d2 * d2 + d3 * d3);
double d5 = 1.0D - d4;

@@ -138,6 +175,21 @@
@@ -138,6 +181,21 @@
}

this.move(MoverType.SELF, this.motionX, this.motionY, this.motionZ);
Expand All @@ -122,23 +128,23 @@
float f = 0.98F;

if (this.onGround)
@@ -159,6 +211,7 @@
@@ -159,6 +217,7 @@

if (this.xpOrbAge >= 6000)
{
+ this.recordRemoval(LiteralRemovalReason.DESPAWN_TIMEOUT); // TISCM lifetime tracker
this.remove();
}
}
@@ -193,6 +246,7 @@
@@ -193,6 +252,7 @@

if (this.xpOrbHealth <= 0)
{
+ this.setDeathDamageSource(source); // TISCM lifetime tracker
this.remove();
}

@@ -218,8 +272,11 @@
@@ -218,8 +278,11 @@
{
if (!this.world.isRemote)
{
Expand All @@ -151,7 +157,7 @@
entityIn.xpCooldown = 2;
entityIn.onItemPickup(this, 1);
ItemStack itemstack = EnchantmentHelper.getEnchantedItem(Enchantments.MENDING, entityIn);
@@ -251,6 +308,10 @@
@@ -251,6 +314,10 @@
return xp * 2;
}

Expand Down

0 comments on commit ced82e5

Please sign in to comment.