mirror of
https://github.com/PaperMC/Paper.git
synced 2024-12-30 16:19:03 +01:00
Actually add entities to chunks
Because, you know, vanishing entities is always nice to have
This commit is contained in:
parent
ef4443e1e0
commit
9e20d8d87b
6 changed files with 25 additions and 17 deletions
|
@ -1049,7 +1049,7 @@ index 000000000..37093419c
|
|||
+ }
|
||||
+}
|
||||
diff --git a/src/main/java/net/minecraft/server/Chunk.java b/src/main/java/net/minecraft/server/Chunk.java
|
||||
index 57e35564a..890715ff8 100644
|
||||
index 414c27516..c3a54576f 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 implements IChunkAccess {
|
||||
|
|
|
@ -458,7 +458,7 @@ index 000000000..8f18c2869
|
|||
+
|
||||
+}
|
||||
diff --git a/src/main/java/net/minecraft/server/Chunk.java b/src/main/java/net/minecraft/server/Chunk.java
|
||||
index 890715ff8..654cf763b 100644
|
||||
index c3a54576f..6255aa285 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 implements IChunkAccess {
|
||||
|
|
|
@ -16,7 +16,7 @@ be having data corruption issues anyways.
|
|||
This provides a small boost to all setType calls.
|
||||
|
||||
diff --git a/src/main/java/net/minecraft/server/Chunk.java b/src/main/java/net/minecraft/server/Chunk.java
|
||||
index 516656f8f..aa7f01f19 100644
|
||||
index 9695af028..ccdc171d4 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 implements IChunkAccess {
|
||||
|
|
|
@ -14,9 +14,18 @@ Fix this by differing entity add to world for all entities at the same time
|
|||
the original entity is dead, overwrite it as the logic does for unloaod queued entities.
|
||||
|
||||
diff --git a/src/main/java/net/minecraft/server/Chunk.java b/src/main/java/net/minecraft/server/Chunk.java
|
||||
index 37bb6f40c..ee4332eda 100644
|
||||
index 37bb6f40c..414c27516 100644
|
||||
--- a/src/main/java/net/minecraft/server/Chunk.java
|
||||
+++ b/src/main/java/net/minecraft/server/Chunk.java
|
||||
@@ -0,0 +0,0 @@ package net.minecraft.server;
|
||||
|
||||
// Paper start
|
||||
import com.destroystokyo.paper.PaperWorldConfig.DuplicateUUIDMode;
|
||||
+
|
||||
+import java.util.Arrays;
|
||||
import java.util.HashMap;
|
||||
import java.util.UUID;
|
||||
// Paper end
|
||||
@@ -0,0 +0,0 @@ public class Chunk implements IChunkAccess {
|
||||
this.world.a(this.tileEntities.values());
|
||||
List[] aentityslice = this.entitySlices; // Spigot
|
||||
|
@ -40,20 +49,19 @@ index 37bb6f40c..ee4332eda 100644
|
|||
- }));
|
||||
- entityslice.removeAll(toRemove);
|
||||
// CraftBukkit end
|
||||
+ this.world.addChunkEntities(entityslice.stream() // Paper - add all at same time to avoid entities adding to world modifying slice state, skip already added entities (not normal, but can happen)
|
||||
+ // Paper start - Inline event into stream
|
||||
+ .filter((entity) -> {
|
||||
+ if (!this.needsDecoration) {
|
||||
+ return true;
|
||||
+ }
|
||||
+ return CraftEventFactory.doEntityAddEventCalling(this.world, entity, CreatureSpawnEvent.SpawnReason.CHUNK_GEN);
|
||||
+ })
|
||||
+ // Paper end - Inline event into stream
|
||||
+ .filter((entity) -> !(entity instanceof EntityHuman || entity.valid))); // Paper - add all at same time to avoid entities adding to world modifying slice state, skip already added entities (not normal, but can happen)
|
||||
}
|
||||
+ this.world.addChunkEntities(toAdd.stream() // Paper - add all at same time to avoid entities adding to world modifying slice state, skip already added entities (not normal, but can happen)
|
||||
+ // Paper start - Inline event into stream
|
||||
+ .filter((entity) -> {
|
||||
+ if (!this.needsDecoration) {
|
||||
+ return true;
|
||||
+ }
|
||||
+ return CraftEventFactory.doEntityAddEventCalling(this.world, entity, CreatureSpawnEvent.SpawnReason.CHUNK_GEN);
|
||||
+ })
|
||||
+ // Paper end - Inline event into stream
|
||||
+ .filter((entity) -> !(entity instanceof EntityHuman || entity.valid))); // Paper - add all at same time to avoid entities adding to world modifying slice state, skip already added entities (not normal, but can happen)
|
||||
|
||||
// CraftBukkit start
|
||||
org.bukkit.Server server = this.world.getServer();
|
||||
diff --git a/src/main/java/net/minecraft/server/World.java b/src/main/java/net/minecraft/server/World.java
|
||||
index 5e61826f6..bd6f64e52 100644
|
||||
--- a/src/main/java/net/minecraft/server/World.java
|
||||
|
|
|
@ -14,7 +14,7 @@ This fix always sends chunks to the client, and simply updates
|
|||
the client anytime post processing is triggered with the new chunk data.
|
||||
|
||||
diff --git a/src/main/java/net/minecraft/server/Chunk.java b/src/main/java/net/minecraft/server/Chunk.java
|
||||
index 7972e6955..7851ede7a 100644
|
||||
index ccdc171d4..7751ae444 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 implements IChunkAccess {
|
||||
|
|
|
@ -14,7 +14,7 @@ Also optimizes to not repeatedly look up the same chunk for
|
|||
light lookups.
|
||||
|
||||
diff --git a/src/main/java/net/minecraft/server/Chunk.java b/src/main/java/net/minecraft/server/Chunk.java
|
||||
index 654cf763b..516656f8f 100644
|
||||
index 6255aa285..9695af028 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 implements IChunkAccess {
|
||||
|
|
Loading…
Reference in a new issue