Actually add entities to chunks
Because, you know, vanishing entities is always nice to have
This commit is contained in:
parent
1f59f78c6f
commit
e293688578
6 changed files with 41 additions and 33 deletions
|
@ -1,4 +1,4 @@
|
||||||
From 9371f9dbc894ceb59d0a7fc7ac0df987c8c8b520 Mon Sep 17 00:00:00 2001
|
From 3ad5ebde68a9a0a224d8c458cbf491555ecb120e Mon Sep 17 00:00:00 2001
|
||||||
From: Aikar <aikar@aikar.co>
|
From: Aikar <aikar@aikar.co>
|
||||||
Date: Fri, 3 Aug 2018 22:47:46 -0400
|
Date: Fri, 3 Aug 2018 22:47:46 -0400
|
||||||
Subject: [PATCH] Entity add to world fixes
|
Subject: [PATCH] Entity add to world fixes
|
||||||
|
@ -14,10 +14,19 @@ 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.
|
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
|
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
|
--- a/src/main/java/net/minecraft/server/Chunk.java
|
||||||
+++ b/src/main/java/net/minecraft/server/Chunk.java
|
+++ b/src/main/java/net/minecraft/server/Chunk.java
|
||||||
@@ -916,6 +916,7 @@ public class Chunk implements IChunkAccess {
|
@@ -2,6 +2,8 @@ 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
|
||||||
|
@@ -916,6 +918,7 @@ public class Chunk implements IChunkAccess {
|
||||||
this.world.a(this.tileEntities.values());
|
this.world.a(this.tileEntities.values());
|
||||||
List[] aentityslice = this.entitySlices; // Spigot
|
List[] aentityslice = this.entitySlices; // Spigot
|
||||||
int i = aentityslice.length;
|
int i = aentityslice.length;
|
||||||
|
@ -25,7 +34,7 @@ index 37bb6f40c..ee4332eda 100644
|
||||||
|
|
||||||
for (int j = 0; j < i; ++j) {
|
for (int j = 0; j < i; ++j) {
|
||||||
// CraftBukkit start
|
// CraftBukkit start
|
||||||
@@ -964,18 +965,18 @@ public class Chunk implements IChunkAccess {
|
@@ -964,17 +967,17 @@ public class Chunk implements IChunkAccess {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
// Paper end
|
// Paper end
|
||||||
|
@ -40,20 +49,19 @@ index 37bb6f40c..ee4332eda 100644
|
||||||
- }));
|
- }));
|
||||||
- entityslice.removeAll(toRemove);
|
- entityslice.removeAll(toRemove);
|
||||||
// CraftBukkit end
|
// 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
|
// 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
|
diff --git a/src/main/java/net/minecraft/server/World.java b/src/main/java/net/minecraft/server/World.java
|
||||||
index 5e61826f6..bd6f64e52 100644
|
index 5e61826f6..bd6f64e52 100644
|
||||||
--- a/src/main/java/net/minecraft/server/World.java
|
--- a/src/main/java/net/minecraft/server/World.java
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
From 07ee56ca64a98224dc9b972ba71fd113a7964298 Mon Sep 17 00:00:00 2001
|
From 4c5c1c499d8e7425bae655ec362edda3ffdd960a Mon Sep 17 00:00:00 2001
|
||||||
From: stonar96 <minecraft.stonar96@gmail.com>
|
From: stonar96 <minecraft.stonar96@gmail.com>
|
||||||
Date: Mon, 20 Aug 2018 03:03:58 +0200
|
Date: Mon, 20 Aug 2018 03:03:58 +0200
|
||||||
Subject: [PATCH] Anti-Xray
|
Subject: [PATCH] Anti-Xray
|
||||||
|
@ -1049,10 +1049,10 @@ index 000000000..37093419c
|
||||||
+ }
|
+ }
|
||||||
+}
|
+}
|
||||||
diff --git a/src/main/java/net/minecraft/server/Chunk.java b/src/main/java/net/minecraft/server/Chunk.java
|
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
|
--- a/src/main/java/net/minecraft/server/Chunk.java
|
||||||
+++ b/src/main/java/net/minecraft/server/Chunk.java
|
+++ b/src/main/java/net/minecraft/server/Chunk.java
|
||||||
@@ -540,7 +540,7 @@ public class Chunk implements IChunkAccess {
|
@@ -542,7 +542,7 @@ public class Chunk implements IChunkAccess {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1061,7 +1061,7 @@ index 57e35564a..890715ff8 100644
|
||||||
this.sections[j >> 4] = chunksection;
|
this.sections[j >> 4] = chunksection;
|
||||||
flag1 = j >= l;
|
flag1 = j >= l;
|
||||||
}
|
}
|
||||||
@@ -640,7 +640,7 @@ public class Chunk implements IChunkAccess {
|
@@ -642,7 +642,7 @@ public class Chunk implements IChunkAccess {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
From 21be7e16c4e783411306ef1992f7b39a1f13e04d Mon Sep 17 00:00:00 2001
|
From e22e2ee24da923acb3e2ea7eb4389918c5bf8578 Mon Sep 17 00:00:00 2001
|
||||||
From: Aikar <aikar@aikar.co>
|
From: Aikar <aikar@aikar.co>
|
||||||
Date: Sat, 21 Jul 2018 16:55:04 -0400
|
Date: Sat, 21 Jul 2018 16:55:04 -0400
|
||||||
Subject: [PATCH] Async Chunk Loading and Generation
|
Subject: [PATCH] Async Chunk Loading and Generation
|
||||||
|
@ -458,10 +458,10 @@ index 000000000..8f18c2869
|
||||||
+
|
+
|
||||||
+}
|
+}
|
||||||
diff --git a/src/main/java/net/minecraft/server/Chunk.java b/src/main/java/net/minecraft/server/Chunk.java
|
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
|
--- a/src/main/java/net/minecraft/server/Chunk.java
|
||||||
+++ b/src/main/java/net/minecraft/server/Chunk.java
|
+++ b/src/main/java/net/minecraft/server/Chunk.java
|
||||||
@@ -189,6 +189,7 @@ public class Chunk implements IChunkAccess {
|
@@ -191,6 +191,7 @@ public class Chunk implements IChunkAccess {
|
||||||
|
|
||||||
for (k = 0; k < this.sections.length; ++k) {
|
for (k = 0; k < this.sections.length; ++k) {
|
||||||
this.sections[k] = protochunk.getSections()[k];
|
this.sections[k] = protochunk.getSections()[k];
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
From 80fa71f295b4996b15d8bdf2ca9e64a2a6b13419 Mon Sep 17 00:00:00 2001
|
From d428c31d895dc94bca5040bb3fba384f4cd3139f Mon Sep 17 00:00:00 2001
|
||||||
From: Aikar <aikar@aikar.co>
|
From: Aikar <aikar@aikar.co>
|
||||||
Date: Fri, 28 Sep 2018 20:46:29 -0400
|
Date: Fri, 28 Sep 2018 20:46:29 -0400
|
||||||
Subject: [PATCH] Optimize Light Recalculations
|
Subject: [PATCH] Optimize Light Recalculations
|
||||||
|
@ -14,10 +14,10 @@ Also optimizes to not repeatedly look up the same chunk for
|
||||||
light lookups.
|
light lookups.
|
||||||
|
|
||||||
diff --git a/src/main/java/net/minecraft/server/Chunk.java b/src/main/java/net/minecraft/server/Chunk.java
|
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
|
--- a/src/main/java/net/minecraft/server/Chunk.java
|
||||||
+++ b/src/main/java/net/minecraft/server/Chunk.java
|
+++ b/src/main/java/net/minecraft/server/Chunk.java
|
||||||
@@ -352,7 +352,7 @@ public class Chunk implements IChunkAccess {
|
@@ -354,7 +354,7 @@ public class Chunk implements IChunkAccess {
|
||||||
private void a(int i, int j, int k, int l) {
|
private void a(int i, int j, int k, int l) {
|
||||||
if (l > k && this.areNeighborsLoaded(1)) { // Paper
|
if (l > k && this.areNeighborsLoaded(1)) { // Paper
|
||||||
for (int i1 = k; i1 < l; ++i1) {
|
for (int i1 = k; i1 < l; ++i1) {
|
||||||
|
@ -26,7 +26,7 @@ index 654cf763b..516656f8f 100644
|
||||||
}
|
}
|
||||||
|
|
||||||
this.x = true;
|
this.x = true;
|
||||||
@@ -562,7 +562,7 @@ public class Chunk implements IChunkAccess {
|
@@ -564,7 +564,7 @@ public class Chunk implements IChunkAccess {
|
||||||
} else {
|
} else {
|
||||||
if (flag1) {
|
if (flag1) {
|
||||||
this.initLighting();
|
this.initLighting();
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
From c30b895c9c264420b5a9bb8aaa76a21436f66c27 Mon Sep 17 00:00:00 2001
|
From f88f14f5616b977e0de4424104e175bc90701c66 Mon Sep 17 00:00:00 2001
|
||||||
From: Aikar <aikar@aikar.co>
|
From: Aikar <aikar@aikar.co>
|
||||||
Date: Fri, 28 Sep 2018 22:27:33 -0400
|
Date: Fri, 28 Sep 2018 22:27:33 -0400
|
||||||
Subject: [PATCH] Don't recheck type after setting a block
|
Subject: [PATCH] Don't recheck type after setting a block
|
||||||
|
@ -16,10 +16,10 @@ be having data corruption issues anyways.
|
||||||
This provides a small boost to all setType calls.
|
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
|
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
|
--- a/src/main/java/net/minecraft/server/Chunk.java
|
||||||
+++ b/src/main/java/net/minecraft/server/Chunk.java
|
+++ b/src/main/java/net/minecraft/server/Chunk.java
|
||||||
@@ -557,7 +557,7 @@ public class Chunk implements IChunkAccess {
|
@@ -559,7 +559,7 @@ public class Chunk implements IChunkAccess {
|
||||||
this.world.n(blockposition);
|
this.world.n(blockposition);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
From 10a0113e0c7b2dfccbe5c385b2e9d76b7cf06786 Mon Sep 17 00:00:00 2001
|
From aa5ba3307b20dc28bb7487fac1fb9624ab18501e Mon Sep 17 00:00:00 2001
|
||||||
From: Aikar <aikar@aikar.co>
|
From: Aikar <aikar@aikar.co>
|
||||||
Date: Sat, 29 Sep 2018 01:18:16 -0400
|
Date: Sat, 29 Sep 2018 01:18:16 -0400
|
||||||
Subject: [PATCH] Fix Sending Chunks to Client
|
Subject: [PATCH] Fix Sending Chunks to Client
|
||||||
|
@ -14,10 +14,10 @@ This fix always sends chunks to the client, and simply updates
|
||||||
the client anytime post processing is triggered with the new chunk data.
|
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
|
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
|
--- a/src/main/java/net/minecraft/server/Chunk.java
|
||||||
+++ b/src/main/java/net/minecraft/server/Chunk.java
|
+++ b/src/main/java/net/minecraft/server/Chunk.java
|
||||||
@@ -1198,7 +1198,7 @@ public class Chunk implements IChunkAccess {
|
@@ -1200,7 +1200,7 @@ public class Chunk implements IChunkAccess {
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean isReady() {
|
public boolean isReady() {
|
||||||
|
@ -26,7 +26,7 @@ index 7972e6955..7851ede7a 100644
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean v() {
|
public boolean v() {
|
||||||
@@ -1436,6 +1436,13 @@ public class Chunk implements IChunkAccess {
|
@@ -1438,6 +1438,13 @@ public class Chunk implements IChunkAccess {
|
||||||
this.h.clear();
|
this.h.clear();
|
||||||
this.a(ChunkStatus.POSTPROCESSED);
|
this.a(ChunkStatus.POSTPROCESSED);
|
||||||
this.m.a(this);
|
this.m.a(this);
|
||||||
|
|
Loading…
Add table
Reference in a new issue