Fix lead duplication

This commit is contained in:
Toshimichi0915 2020-12-25 01:31:13 -05:00 committed by Mariell
parent 0bdfb01589
commit 24388381ad
5 changed files with 30 additions and 16 deletions

View file

@ -16,7 +16,7 @@ So even if something NEW comes up, it would be impossible to drop the
same item twice because the source was destroyed.
diff --git a/src/main/java/net/minecraft/server/Entity.java b/src/main/java/net/minecraft/server/Entity.java
index 5bec3b9692f64a792e26f89b4147644eaaf4ab11..60dae06ff5c016aecba23afd7a4152fcd3234616 100644
index 5bec3b9692f64a792e26f89b4147644eaaf4ab11..0c0d2a1c120a4c091cb24ccaf3fa6756044fac79 100644
--- a/src/main/java/net/minecraft/server/Entity.java
+++ b/src/main/java/net/minecraft/server/Entity.java
@@ -1880,11 +1880,12 @@ public abstract class Entity implements INamableTileEntity, ICommandListener, Ke
@ -47,16 +47,30 @@ index 5bec3b9692f64a792e26f89b4147644eaaf4ab11..60dae06ff5c016aecba23afd7a4152fc
if (this.world instanceof WorldServer && !this.dead) {
this.world.getMethodProfiler().enter("changeDimension");
// CraftBukkit start
@@ -2567,7 +2574,7 @@ public abstract class Entity implements INamableTileEntity, ICommandListener, Ke
entity.bukkitEntity = this.getBukkitEntity();
@@ -2552,6 +2559,11 @@ public abstract class Entity implements INamableTileEntity, ICommandListener, Ke
// CraftBukkit end
if (this instanceof EntityInsentient) {
this.world.getMethodProfiler().exitEnter("reloading");
+ // Paper start - Change lead drop timing to prevent dupe
+ if (this instanceof EntityInsentient) {
+ ((EntityInsentient) this).unleash(true, true); // Paper drop lead
+ }
+ // Paper end
Entity entity = this.getEntityType().a((World) worldserver);
if (entity != null) {
@@ -2565,10 +2577,6 @@ public abstract class Entity implements INamableTileEntity, ICommandListener, Ke
// CraftBukkit start - Forward the CraftEntity to the new entity
this.getBukkitEntity().setHandle(entity);
entity.bukkitEntity = this.getBukkitEntity();
-
- if (this instanceof EntityInsentient) {
- ((EntityInsentient) this).unleash(true, false); // Unleash to prevent duping of leads.
+ ((EntityInsentient) this).unleash(true, true); // Paper drop lead
}
- }
// CraftBukkit end
}
@@ -2687,7 +2694,7 @@ public abstract class Entity implements INamableTileEntity, ICommandListener, Ke
@@ -2687,7 +2695,7 @@ public abstract class Entity implements INamableTileEntity, ICommandListener, Ke
}
public boolean canPortal() {

View file

@ -5,7 +5,7 @@ Subject: [PATCH] Ensure Entity AABB's are never invalid
diff --git a/src/main/java/net/minecraft/server/Entity.java b/src/main/java/net/minecraft/server/Entity.java
index d883da1e9101607209148a28aef8741407f13433..c9f5f341371e1ccc7c9a71bb357862424d801d8a 100644
index 50f53c764b9b4934093b08418b92be5b02162588..dce88b30fc5b401266ee6395c6540ac404528ba9 100644
--- a/src/main/java/net/minecraft/server/Entity.java
+++ b/src/main/java/net/minecraft/server/Entity.java
@@ -389,7 +389,7 @@ public abstract class Entity implements INamableTileEntity, ICommandListener, Ke
@ -17,7 +17,7 @@ index d883da1e9101607209148a28aef8741407f13433..c9f5f341371e1ccc7c9a71bb35786242
if (valid) ((WorldServer) world).chunkCheck(this); // CraftBukkit
}
@@ -2897,6 +2897,7 @@ public abstract class Entity implements INamableTileEntity, ICommandListener, Ke
@@ -2898,6 +2898,7 @@ public abstract class Entity implements INamableTileEntity, ICommandListener, Ke
return new AxisAlignedBB(vec3d, vec3d1);
}
@ -25,7 +25,7 @@ index d883da1e9101607209148a28aef8741407f13433..c9f5f341371e1ccc7c9a71bb35786242
public void a(AxisAlignedBB axisalignedbb) {
// CraftBukkit start - block invalid bounding boxes
double minX = axisalignedbb.minX,
@@ -3335,6 +3336,12 @@ public abstract class Entity implements INamableTileEntity, ICommandListener, Ke
@@ -3336,6 +3337,12 @@ public abstract class Entity implements INamableTileEntity, ICommandListener, Ke
}
public void setPositionRaw(double d0, double d1, double d2) {

View file

@ -6,10 +6,10 @@ Subject: [PATCH] Expose the Entity Counter to allow plugins to use valid and
diff --git a/src/main/java/net/minecraft/server/Entity.java b/src/main/java/net/minecraft/server/Entity.java
index fa0256a99c833e6035b8d3e873a93af2b674ef52..53fb4f04087c091f3354e74d6b94554601f2cbe0 100644
index d1f09f413937bb6fa132ae707d461bf0139c26a9..f045cdacf2e7cd0e3e8cdaf2761cbfe0fec636a0 100644
--- a/src/main/java/net/minecraft/server/Entity.java
+++ b/src/main/java/net/minecraft/server/Entity.java
@@ -3375,4 +3375,10 @@ public abstract class Entity implements INamableTileEntity, ICommandListener, Ke
@@ -3376,4 +3376,10 @@ public abstract class Entity implements INamableTileEntity, ICommandListener, Ke
void accept(Entity entity, double d0, double d1, double d2);
}

View file

@ -5,10 +5,10 @@ Subject: [PATCH] Entity#isTicking
diff --git a/src/main/java/net/minecraft/server/Entity.java b/src/main/java/net/minecraft/server/Entity.java
index 53fb4f04087c091f3354e74d6b94554601f2cbe0..d86b67a63b37569fc4ca69ec04305a330950b0f2 100644
index f045cdacf2e7cd0e3e8cdaf2761cbfe0fec636a0..ec3c6b20c87d253d07f70e8a8b9b909df3683b36 100644
--- a/src/main/java/net/minecraft/server/Entity.java
+++ b/src/main/java/net/minecraft/server/Entity.java
@@ -3380,5 +3380,9 @@ public abstract class Entity implements INamableTileEntity, ICommandListener, Ke
@@ -3381,5 +3381,9 @@ public abstract class Entity implements INamableTileEntity, ICommandListener, Ke
public static int nextEntityId() {
return entityCount.incrementAndGet();
}

View file

@ -5,10 +5,10 @@ Subject: [PATCH] Fix CME on adding a passenger in CreatureSpawnEvent
diff --git a/src/main/java/net/minecraft/server/Entity.java b/src/main/java/net/minecraft/server/Entity.java
index d86b67a63b37569fc4ca69ec04305a330950b0f2..0c952fea30aa6890809d728420e4710d95e10c19 100644
index ec3c6b20c87d253d07f70e8a8b9b909df3683b36..3309a3ea9dc895bc910238e10d993ff5f66d4240 100644
--- a/src/main/java/net/minecraft/server/Entity.java
+++ b/src/main/java/net/minecraft/server/Entity.java
@@ -3078,7 +3078,7 @@ public abstract class Entity implements INamableTileEntity, ICommandListener, Ke
@@ -3079,7 +3079,7 @@ public abstract class Entity implements INamableTileEntity, ICommandListener, Ke
}
public Stream<Entity> cp() {