3
0
Mirror von https://github.com/PaperMC/Paper.git synchronisiert 2024-12-16 11:30:06 +01:00

Check entity count adds and mark entities removed as needed

Dieser Commit ist enthalten in:
Zach Brown 2016-04-22 20:35:24 -05:00
Ursprung e9ffa94994
Commit a1e3c0b12b
Es konnte kein GPG-Schlüssel zu dieser Signatur gefunden werden
GPG-Schlüssel-ID: CC9DA35FC5450B76

Datei anzeigen

@ -0,0 +1,34 @@
From cbda3b924454b5badd57f8dc2550d315ca8441bb Mon Sep 17 00:00:00 2001
From: Zach Brown <zach.brown@destroystokyo.com>
Date: Fri, 22 Apr 2016 20:34:21 -0500
Subject: [PATCH] Check entity count additions and mark entities removed
diff --git a/src/main/java/net/minecraft/server/Chunk.java b/src/main/java/net/minecraft/server/Chunk.java
index 5c1685d..88f8ab8 100644
--- a/src/main/java/net/minecraft/server/Chunk.java
+++ b/src/main/java/net/minecraft/server/Chunk.java
@@ -661,6 +661,12 @@ public class Chunk {
k = this.entitySlices.length - 1;
}
+ // Paper start - Try to catch plugins doing indecent things
+ if (entity.aa && entity.getChunkX() == this.locX && entity.getChunkY() == k && entity.getChunkZ() == this.locZ) {
+ throw new IllegalStateException("Hey Jackass don't do that.");
+ }
+ // Paper end
+
entity.aa = true;
entity.ab = this.locX;
entity.ac = k;
@@ -711,6 +717,7 @@ public class Chunk {
} else if (entity instanceof IInventory) {
inventoryEntityCounts[i]--;
}
+ entity.aa = false; // You aren't added to chunk anymore
// Paper end
// Spigot start - decrement creature type count
// Keep this synced up with World.a(Class)
--
2.8.0