Merge branch 'master' into pre/1.13
* master: Fix Dupe UUID logic triggering when the duplicate is pending unload
This commit is contained in:
commit
1b53a468de
2 changed files with 27 additions and 28 deletions
|
@ -1,4 +1,4 @@
|
|||
From a034c787c361a89d9679e0936d3151ff3d84d06f Mon Sep 17 00:00:00 2001
|
||||
From 3b96328cbca2cc941e8a10dfdc47f5970379ef8e Mon Sep 17 00:00:00 2001
|
||||
From: Aikar <aikar@aikar.co>
|
||||
Date: Sat, 21 Jul 2018 14:27:34 -0400
|
||||
Subject: [PATCH] Duplicate UUID Resolve Option
|
||||
|
@ -33,7 +33,7 @@ But for those who are ok with leaving this inconsistent behavior, you may use WA
|
|||
It is recommended you regenerate the entities, as these were legit entities, and deserve your love.
|
||||
|
||||
diff --git a/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java b/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java
|
||||
index 7bd7aa0d94..ba6d5b7ff5 100644
|
||||
index 7bd7aa0d94..5d9bed3f19 100644
|
||||
--- a/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java
|
||||
+++ b/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java
|
||||
@@ -430,4 +430,40 @@ public class PaperWorldConfig {
|
||||
|
@ -45,7 +45,7 @@ index 7bd7aa0d94..ba6d5b7ff5 100644
|
|||
+ REGEN, DELETE, NOTHING, WARN
|
||||
+ }
|
||||
+ public DuplicateUUIDMode duplicateUUIDMode = DuplicateUUIDMode.REGEN;
|
||||
+ public void repairDuplicateUUID() {
|
||||
+ private void repairDuplicateUUID() {
|
||||
+ String desiredMode = getString("duplicate-uuid-resolver", "regenerate").toLowerCase().trim();
|
||||
+ switch (desiredMode.toLowerCase()) {
|
||||
+ case "regen":
|
||||
|
@ -78,7 +78,7 @@ index 7bd7aa0d94..ba6d5b7ff5 100644
|
|||
+ }
|
||||
}
|
||||
diff --git a/src/main/java/net/minecraft/server/Chunk.java b/src/main/java/net/minecraft/server/Chunk.java
|
||||
index 3ac115ff65..4728ded917 100644
|
||||
index 3ac115ff65..ba2aeb432d 100644
|
||||
--- a/src/main/java/net/minecraft/server/Chunk.java
|
||||
+++ b/src/main/java/net/minecraft/server/Chunk.java
|
||||
@@ -1,5 +1,10 @@
|
||||
|
@ -108,21 +108,22 @@ index 3ac115ff65..4728ded917 100644
|
|||
}
|
||||
|
||||
int k = MathHelper.floor(entity.locY / 16.0D);
|
||||
@@ -865,6 +872,35 @@ public class Chunk implements IChunkAccess {
|
||||
@@ -865,6 +872,39 @@ public class Chunk implements IChunkAccess {
|
||||
|
||||
for (int j = 0; j < i; ++j) {
|
||||
List entityslice = aentityslice[j]; // Spigot
|
||||
+ // Paper start
|
||||
+ DuplicateUUIDMode mode = world.paperConfig.duplicateUUIDMode;
|
||||
+ if (mode == DuplicateUUIDMode.DELETE || mode == DuplicateUUIDMode.REGEN) {
|
||||
+ if (mode == DuplicateUUIDMode.WARN | mode == DuplicateUUIDMode.DELETE || mode == DuplicateUUIDMode.REGEN) {
|
||||
+ Map<UUID, Entity> thisChunk = new HashMap<>();
|
||||
+ for (Iterator<Entity> iterator = ((List<Entity>) entityslice).iterator(); iterator.hasNext(); ) {
|
||||
+ Entity entity = iterator.next();
|
||||
+ if (entity.dead) continue;
|
||||
+ Entity other = ((WorldServer) world).entitiesByUUID.get(entity.uniqueID);
|
||||
+ if (other == null) {
|
||||
+ if (other == null || other.dead || world.getEntityUnloadQueue().contains(other)) {
|
||||
+ other = thisChunk.get(entity.uniqueID);
|
||||
+ }
|
||||
+ if (other != null) {
|
||||
+ if (other != null && !other.dead) {
|
||||
+ switch (mode) {
|
||||
+ case REGEN: {
|
||||
+ entity.setUUID(UUID.randomUUID());
|
||||
|
@ -135,6 +136,9 @@ index 3ac115ff65..4728ded917 100644
|
|||
+ iterator.remove();
|
||||
+ break;
|
||||
+ }
|
||||
+ default:
|
||||
+ logger.warn("[DUPE-UUID] Duplicate UUID found used by " + other + ", doing nothing to " + entity + ". See https://github.com/PaperMC/Paper/issues/1223 for discussion on what this is about.");
|
||||
+ break;
|
||||
+ }
|
||||
+ }
|
||||
+ thisChunk.put(entity.uniqueID, entity);
|
||||
|
@ -156,6 +160,19 @@ index 4ea52f9c59..2217ca9737 100644
|
|||
public void a(UUID uuid) {
|
||||
this.uniqueID = uuid;
|
||||
this.au = this.uniqueID.toString();
|
||||
diff --git a/src/main/java/net/minecraft/server/World.java b/src/main/java/net/minecraft/server/World.java
|
||||
index 127dcedc97..5ee7cdc79c 100644
|
||||
--- a/src/main/java/net/minecraft/server/World.java
|
||||
+++ b/src/main/java/net/minecraft/server/World.java
|
||||
@@ -72,7 +72,7 @@ public abstract class World implements GeneratorAccess, IIBlockAccess, AutoClose
|
||||
}
|
||||
};
|
||||
// Spigot end
|
||||
- protected final Set<Entity> g = Sets.newHashSet(); // Paper
|
||||
+ protected final Set<Entity> g = Sets.newHashSet(); public Set<Entity> getEntityUnloadQueue() { return g; };// Paper - OBFHELPER
|
||||
//public final List<TileEntity> tileEntityList = Lists.newArrayList(); // Paper - remove unused list
|
||||
public final List<TileEntity> tileEntityListTick = Lists.newArrayList();
|
||||
private final List<TileEntity> c = Lists.newArrayList();
|
||||
diff --git a/src/main/java/net/minecraft/server/WorldServer.java b/src/main/java/net/minecraft/server/WorldServer.java
|
||||
index 747d99dbe6..7a9f28421b 100644
|
||||
--- a/src/main/java/net/minecraft/server/WorldServer.java
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
From a03528da903b6a8261c06c40ad9fde7267b3434e Mon Sep 17 00:00:00 2001
|
||||
From 95116432cfa374f39797e4e998f50223478d15c5 Mon Sep 17 00:00:00 2001
|
||||
From: Aikar <aikar@aikar.co>
|
||||
Date: Thu, 26 Jul 2018 00:11:12 -0400
|
||||
Subject: [PATCH] Prevent Saving Bad entities to chunks
|
||||
|
@ -17,24 +17,6 @@ an invalid entity.
|
|||
|
||||
This should reduce log occurrences of dupe uuid messages.
|
||||
|
||||
diff --git a/src/main/java/net/minecraft/server/Chunk.java b/src/main/java/net/minecraft/server/Chunk.java
|
||||
index 56a74c6062..fd1e53febb 100644
|
||||
--- a/src/main/java/net/minecraft/server/Chunk.java
|
||||
+++ b/src/main/java/net/minecraft/server/Chunk.java
|
||||
@@ -911,11 +911,12 @@ public class Chunk implements IChunkAccess {
|
||||
Map<UUID, Entity> thisChunk = new HashMap<>();
|
||||
for (Iterator<Entity> iterator = ((List<Entity>) entityslice).iterator(); iterator.hasNext(); ) {
|
||||
Entity entity = iterator.next();
|
||||
+ if (entity.dead) continue;
|
||||
Entity other = ((WorldServer) world).entitiesByUUID.get(entity.uniqueID);
|
||||
if (other == null) {
|
||||
other = thisChunk.get(entity.uniqueID);
|
||||
}
|
||||
- if (other != null) {
|
||||
+ if (other != null && !other.dead) {
|
||||
switch (mode) {
|
||||
case REGEN: {
|
||||
entity.setUUID(UUID.randomUUID());
|
||||
diff --git a/src/main/java/net/minecraft/server/ChunkRegionLoader.java b/src/main/java/net/minecraft/server/ChunkRegionLoader.java
|
||||
index a97e024ec4..bd52bf6561 100644
|
||||
--- a/src/main/java/net/minecraft/server/ChunkRegionLoader.java
|
||||
|
@ -75,7 +57,7 @@ index a97e024ec4..bd52bf6561 100644
|
|||
nbttagcompound.set("Entities", nbttaglist1);
|
||||
NBTTagList nbttaglist2 = new NBTTagList();
|
||||
diff --git a/src/main/java/net/minecraft/server/World.java b/src/main/java/net/minecraft/server/World.java
|
||||
index 6d80e55c19..27398806d3 100644
|
||||
index a66770e241..1f58042125 100644
|
||||
--- a/src/main/java/net/minecraft/server/World.java
|
||||
+++ b/src/main/java/net/minecraft/server/World.java
|
||||
@@ -1053,7 +1053,7 @@ public abstract class World implements GeneratorAccess, IIBlockAccess, AutoClose
|
||||
|
|
Loading…
Reference in a new issue