Remove isRemoved skip on .discard() (#9520)

This commit is contained in:
Owen 2023-07-24 05:04:40 -04:00 committed by GitHub
parent aa93dcfdce
commit b14979e352
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 5 additions and 13 deletions

View File

@ -1158,7 +1158,7 @@ index 8547e7ff2f1f5b7701fb0f3c3010c14601a5f83e..fff7ad7a45f310783ac96b44575ad3db
this.players.remove(entityplayer);
this.playersByName.remove(entityplayer.getScoreboardName().toLowerCase(java.util.Locale.ROOT)); // Spigot
diff --git a/src/main/java/net/minecraft/world/entity/Entity.java b/src/main/java/net/minecraft/world/entity/Entity.java
index 8218169014a7af183e6b0058fe08af18ca047448..3ffb92a82e17af467afb18c81accc482a93d6a6f 100644
index 8218169014a7af183e6b0058fe08af18ca047448..131d88eed13741a5438910b9acc7ffa53d56e86a 100644
--- a/src/main/java/net/minecraft/world/entity/Entity.java
+++ b/src/main/java/net/minecraft/world/entity/Entity.java
@@ -246,11 +246,23 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource {
@ -1186,15 +1186,7 @@ index 8218169014a7af183e6b0058fe08af18ca047448..3ffb92a82e17af467afb18c81accc482
@Override
public CommandSender getBukkitSender(CommandSourceStack wrapper) {
return this.getBukkitEntity();
@@ -665,6 +677,7 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource {
}
public final void discard() {
+ if (this.isRemoved()) return; // Paper
this.remove(Entity.RemovalReason.DISCARDED);
}
@@ -4651,6 +4664,7 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource {
@@ -4651,6 +4663,7 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource {
return;
}
// Paper end - rewrite chunk system
@ -1202,7 +1194,7 @@ index 8218169014a7af183e6b0058fe08af18ca047448..3ffb92a82e17af467afb18c81accc482
if (this.removalReason == null) {
this.removalReason = reason;
}
@@ -4661,12 +4675,28 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource {
@@ -4661,12 +4674,28 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource {
if (reason != RemovalReason.UNLOADED_TO_CHUNK) this.getPassengers().forEach(Entity::stopRiding); // Paper - chunk system - don't adjust passenger state when unloading, it's just not safe (and messes with our logic in entity chunk unload)
this.levelCallback.onRemove(reason);

View File

@ -5,10 +5,10 @@ Subject: [PATCH] Don't load chunks for supporting block checks
diff --git a/src/main/java/net/minecraft/world/entity/Entity.java b/src/main/java/net/minecraft/world/entity/Entity.java
index 3ffb92a82e17af467afb18c81accc482a93d6a6f..305b43071aa1cf8feee75fae757bb7734ae33771 100644
index 131d88eed13741a5438910b9acc7ffa53d56e86a..4b2d3b5a0a6f4ef168b1b1c2cf1b2e8510b82712 100644
--- a/src/main/java/net/minecraft/world/entity/Entity.java
+++ b/src/main/java/net/minecraft/world/entity/Entity.java
@@ -1369,7 +1369,7 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource {
@@ -1368,7 +1368,7 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource {
}
protected BlockPos getOnPos(float offset) {