mirror of
https://github.com/PaperMC/Paper.git
synced 2025-01-16 06:30:46 +01:00
Fix weird bugs with entities - Fixes #1195
This commit is contained in:
parent
8ddd9ddefc
commit
93dc25ecec
14 changed files with 30 additions and 19 deletions
|
@ -13,7 +13,7 @@ also Avoid NPE during CraftBlockEntityState load if could not get TE
|
|||
If Tile Entity was null, correct Sign to return empty lines instead of null
|
||||
|
||||
diff --git a/src/main/java/net/minecraft/server/TileEntity.java b/src/main/java/net/minecraft/server/TileEntity.java
|
||||
index d3bc13726..cc7f2069d 100644
|
||||
index 358c99227..5b5f102e2 100644
|
||||
--- a/src/main/java/net/minecraft/server/TileEntity.java
|
||||
+++ b/src/main/java/net/minecraft/server/TileEntity.java
|
||||
@@ -0,0 +0,0 @@ public abstract class TileEntity implements KeyedObject {
|
||||
|
|
|
@ -40,11 +40,11 @@ index ce43e7bb7..e35e72e8b 100644
|
|||
+ }
|
||||
}
|
||||
diff --git a/src/main/java/net/minecraft/server/Chunk.java b/src/main/java/net/minecraft/server/Chunk.java
|
||||
index 857df2937..cc9c8b2e0 100644
|
||||
index 3904a1b8f..bcf68af4f 100644
|
||||
--- a/src/main/java/net/minecraft/server/Chunk.java
|
||||
+++ b/src/main/java/net/minecraft/server/Chunk.java
|
||||
@@ -0,0 +0,0 @@ public class Chunk {
|
||||
private boolean j;
|
||||
private boolean j; public boolean isLoaded() { return j; } // Paper - OBFHELPER
|
||||
public final World world;
|
||||
public final int[] heightMap;
|
||||
+ public Long scheduledForUnload; // Paper - delay chunk unloads
|
||||
|
|
|
@ -37,7 +37,7 @@ index ec9a87239..b08274d93 100644
|
|||
|
||||
if (scoreboard.addPlayerToTeam(s2, s)) {
|
||||
diff --git a/src/main/java/net/minecraft/server/Entity.java b/src/main/java/net/minecraft/server/Entity.java
|
||||
index 584501787..b4ad611fc 100644
|
||||
index 21118c031..921b442cd 100644
|
||||
--- a/src/main/java/net/minecraft/server/Entity.java
|
||||
+++ b/src/main/java/net/minecraft/server/Entity.java
|
||||
@@ -0,0 +0,0 @@ public abstract class Entity implements ICommandListener, KeyedObject { // Paper
|
||||
|
|
|
@ -5,7 +5,7 @@ Subject: [PATCH] Don't allow entities to ride themselves - #572
|
|||
|
||||
|
||||
diff --git a/src/main/java/net/minecraft/server/Entity.java b/src/main/java/net/minecraft/server/Entity.java
|
||||
index b13830e87..20324deeb 100644
|
||||
index 0ed9a8413..646a2d673 100644
|
||||
--- a/src/main/java/net/minecraft/server/Entity.java
|
||||
+++ b/src/main/java/net/minecraft/server/Entity.java
|
||||
@@ -0,0 +0,0 @@ public abstract class Entity implements ICommandListener, KeyedObject { // Paper
|
||||
|
|
|
@ -7,7 +7,7 @@ Had some issue with this in past, and this is the vanilla logic.
|
|||
Potentially an old CB change that's no longer needed.
|
||||
|
||||
diff --git a/src/main/java/net/minecraft/server/Entity.java b/src/main/java/net/minecraft/server/Entity.java
|
||||
index 4a08db5ba..d4ab5fba9 100644
|
||||
index e8775e66c..7e992aeaa 100644
|
||||
--- a/src/main/java/net/minecraft/server/Entity.java
|
||||
+++ b/src/main/java/net/minecraft/server/Entity.java
|
||||
@@ -0,0 +0,0 @@ public abstract class Entity implements ICommandListener, KeyedObject { // Paper
|
||||
|
|
|
@ -24,7 +24,7 @@ index 0094d1a87..4da846719 100644
|
|||
+ }
|
||||
}
|
||||
diff --git a/src/main/java/net/minecraft/server/Entity.java b/src/main/java/net/minecraft/server/Entity.java
|
||||
index 8dcff9bd4..041af8070 100644
|
||||
index 137da4255..655340c0b 100644
|
||||
--- a/src/main/java/net/minecraft/server/Entity.java
|
||||
+++ b/src/main/java/net/minecraft/server/Entity.java
|
||||
@@ -0,0 +0,0 @@ public abstract class Entity implements ICommandListener, KeyedObject { // Paper
|
||||
|
|
|
@ -5,7 +5,7 @@ Subject: [PATCH] Entity Origin API
|
|||
|
||||
|
||||
diff --git a/src/main/java/net/minecraft/server/Entity.java b/src/main/java/net/minecraft/server/Entity.java
|
||||
index 041af8070..43b802855 100644
|
||||
index 655340c0b..a96513e27 100644
|
||||
--- a/src/main/java/net/minecraft/server/Entity.java
|
||||
+++ b/src/main/java/net/minecraft/server/Entity.java
|
||||
@@ -0,0 +0,0 @@ public abstract class Entity implements ICommandListener, KeyedObject { // Paper
|
||||
|
|
|
@ -40,7 +40,7 @@ index fcf6bac08..3092913f5 100644
|
|||
this.methodProfiler.a(() -> {
|
||||
return worldserver.getWorldData().getName();
|
||||
diff --git a/src/main/java/net/minecraft/server/TileEntity.java b/src/main/java/net/minecraft/server/TileEntity.java
|
||||
index cc7f2069d..78ce2f8bb 100644
|
||||
index 5b5f102e2..3f6b34489 100644
|
||||
--- a/src/main/java/net/minecraft/server/TileEntity.java
|
||||
+++ b/src/main/java/net/minecraft/server/TileEntity.java
|
||||
@@ -0,0 +0,0 @@ public abstract class TileEntity implements KeyedObject {
|
||||
|
|
|
@ -19,7 +19,7 @@ index abc1aabdd..6ea608ba9 100644
|
|||
+ }
|
||||
}
|
||||
diff --git a/src/main/java/net/minecraft/server/Entity.java b/src/main/java/net/minecraft/server/Entity.java
|
||||
index d4ab5fba9..7314b4dc5 100644
|
||||
index 7e992aeaa..08d872318 100644
|
||||
--- a/src/main/java/net/minecraft/server/Entity.java
|
||||
+++ b/src/main/java/net/minecraft/server/Entity.java
|
||||
@@ -0,0 +0,0 @@ public abstract class Entity implements ICommandListener, KeyedObject { // Paper
|
||||
|
|
|
@ -32,7 +32,7 @@ index 067cb233e..06acdaaf0 100644
|
|||
+ }
|
||||
}
|
||||
diff --git a/src/main/java/net/minecraft/server/Entity.java b/src/main/java/net/minecraft/server/Entity.java
|
||||
index 945f06c93..cb9ef622c 100644
|
||||
index 0412e183a..9ce691061 100644
|
||||
--- a/src/main/java/net/minecraft/server/Entity.java
|
||||
+++ b/src/main/java/net/minecraft/server/Entity.java
|
||||
@@ -0,0 +0,0 @@ public abstract class Entity implements ICommandListener, KeyedObject { // Paper
|
||||
|
|
|
@ -5,7 +5,7 @@ Subject: [PATCH] Prevent tile entity and entity crashes
|
|||
|
||||
|
||||
diff --git a/src/main/java/net/minecraft/server/TileEntity.java b/src/main/java/net/minecraft/server/TileEntity.java
|
||||
index c1f657808..dfdc55583 100644
|
||||
index 15f18ba1d..33e245e4c 100644
|
||||
--- a/src/main/java/net/minecraft/server/TileEntity.java
|
||||
+++ b/src/main/java/net/minecraft/server/TileEntity.java
|
||||
@@ -0,0 +0,0 @@ public abstract class TileEntity implements KeyedObject {
|
||||
|
|
|
@ -22,7 +22,7 @@ requirement, but plugins (such as my own) use this method to
|
|||
trigger a "reload" of the entity on the client.
|
||||
|
||||
diff --git a/src/main/java/net/minecraft/server/Entity.java b/src/main/java/net/minecraft/server/Entity.java
|
||||
index 00791faf2..70641d479 100644
|
||||
index fccaebfbd..5d1ea0d55 100644
|
||||
--- a/src/main/java/net/minecraft/server/Entity.java
|
||||
+++ b/src/main/java/net/minecraft/server/Entity.java
|
||||
@@ -0,0 +0,0 @@ public abstract class Entity implements ICommandListener, KeyedObject { // Paper
|
||||
|
|
|
@ -8,9 +8,18 @@ This enables us a fast reference to the entities current chunk instead
|
|||
of having to look it up by hashmap lookups.
|
||||
|
||||
diff --git a/src/main/java/net/minecraft/server/Chunk.java b/src/main/java/net/minecraft/server/Chunk.java
|
||||
index 4bbebb25a..b40e60942 100644
|
||||
index 4bbebb25a..68008fe6a 100644
|
||||
--- a/src/main/java/net/minecraft/server/Chunk.java
|
||||
+++ b/src/main/java/net/minecraft/server/Chunk.java
|
||||
@@ -0,0 +0,0 @@ public class Chunk {
|
||||
private final byte[] g;
|
||||
private final int[] h;
|
||||
private final boolean[] i;
|
||||
- private boolean j;
|
||||
+ private boolean j; public boolean isLoaded() { return j; } // Paper - OBFHELPER
|
||||
public final World world;
|
||||
public final int[] heightMap;
|
||||
public final int locX;
|
||||
@@ -0,0 +0,0 @@ public class Chunk {
|
||||
private boolean m;
|
||||
public final Map<BlockPosition, TileEntity> tileEntities;
|
||||
|
@ -72,7 +81,7 @@ index 4bbebb25a..b40e60942 100644
|
|||
}
|
||||
|
||||
diff --git a/src/main/java/net/minecraft/server/Entity.java b/src/main/java/net/minecraft/server/Entity.java
|
||||
index 3a8902bf1..3829c8c40 100644
|
||||
index 3a8902bf1..ed090cc50 100644
|
||||
--- a/src/main/java/net/minecraft/server/Entity.java
|
||||
+++ b/src/main/java/net/minecraft/server/Entity.java
|
||||
@@ -0,0 +0,0 @@ public abstract class Entity implements ICommandListener, KeyedObject { // Paper
|
||||
|
@ -81,7 +90,8 @@ index 3a8902bf1..3829c8c40 100644
|
|||
// Paper start
|
||||
+ private java.lang.ref.WeakReference<Chunk> currentChunk = null;
|
||||
+ public Chunk getCurrentChunk() {
|
||||
+ return currentChunk != null ? currentChunk.get() : null;
|
||||
+ final Chunk chunk = currentChunk != null ? currentChunk.get() : world.getChunkIfLoaded(getChunkX(), getChunkZ());
|
||||
+ return chunk != null && chunk.isLoaded() ? chunk : null;
|
||||
+ }
|
||||
+ public void setCurrentChunk(Chunk chunk) {
|
||||
+ this.currentChunk = chunk != null ? new java.lang.ref.WeakReference<>(chunk) : null;
|
||||
|
@ -90,7 +100,7 @@ index 3a8902bf1..3829c8c40 100644
|
|||
public final String entityKeyString = entityKey != null ? entityKey.toString() : null;
|
||||
|
||||
diff --git a/src/main/java/net/minecraft/server/TileEntity.java b/src/main/java/net/minecraft/server/TileEntity.java
|
||||
index 672ba3134..88cd5734d 100644
|
||||
index 672ba3134..d7132c3c0 100644
|
||||
--- a/src/main/java/net/minecraft/server/TileEntity.java
|
||||
+++ b/src/main/java/net/minecraft/server/TileEntity.java
|
||||
@@ -0,0 +0,0 @@ public abstract class TileEntity implements KeyedObject {
|
||||
|
@ -99,7 +109,8 @@ index 672ba3134..88cd5734d 100644
|
|||
// Paper start
|
||||
+ private java.lang.ref.WeakReference<Chunk> currentChunk = null;
|
||||
+ public Chunk getCurrentChunk() {
|
||||
+ return currentChunk != null ? currentChunk.get() : null;
|
||||
+ final Chunk chunk = currentChunk != null ? currentChunk.get() : world.getChunkIfLoaded(position.getX() >> 4, position.getZ() >> 4);
|
||||
+ return chunk != null && chunk.isLoaded() ? chunk : null;
|
||||
+ }
|
||||
+ public void setCurrentChunk(Chunk chunk) {
|
||||
+ this.currentChunk = chunk != null ? new java.lang.ref.WeakReference<>(chunk) : null;
|
||||
|
|
|
@ -5,7 +5,7 @@ Subject: [PATCH] Vehicle Event Cancellation Changes
|
|||
|
||||
|
||||
diff --git a/src/main/java/net/minecraft/server/Entity.java b/src/main/java/net/minecraft/server/Entity.java
|
||||
index 7314b4dc5..d1f07bbbd 100644
|
||||
index 08d872318..e6a5bc53c 100644
|
||||
--- a/src/main/java/net/minecraft/server/Entity.java
|
||||
+++ b/src/main/java/net/minecraft/server/Entity.java
|
||||
@@ -0,0 +0,0 @@ public abstract class Entity implements ICommandListener, KeyedObject { // Paper
|
||||
|
|
Loading…
Reference in a new issue