Paper/Spigot-Server-Patches/0305-Avoid-dimension-id-collisions.patch
Shane Freeder e4602b6d48
Drop Ignore-Missing-Recipes-in-RecipeBook-to-avoid-data-e.patch
This patch appears to be no longer relevant, and is seemingly a leading
cause of datapack performance being horrific
2020-03-15 20:03:36 +00:00

26 lines
1.2 KiB
Diff

From bdd8538f1464d27e07f46d9c5e98c225b4eee934 Mon Sep 17 00:00:00 2001
From: Brokkonaut <hannos17@gmx.de>
Date: Tue, 25 Sep 2018 06:53:43 +0200
Subject: [PATCH] Avoid dimension id collisions
getDimensionId() returns the dimension id - 1. So without this patch
we would reuse an existing dimension id, if some other dimension was
unloaded before.
diff --git a/src/main/java/org/bukkit/craftbukkit/CraftServer.java b/src/main/java/org/bukkit/craftbukkit/CraftServer.java
index f36b64246..4289d029c 100644
--- a/src/main/java/org/bukkit/craftbukkit/CraftServer.java
+++ b/src/main/java/org/bukkit/craftbukkit/CraftServer.java
@@ -1001,7 +1001,7 @@ public final class CraftServer implements Server {
boolean used = false;
do {
for (WorldServer server : console.getWorlds()) {
- used = server.getWorldProvider().getDimensionManager().getDimensionID() == dimension;
+ used = server.getWorldProvider().getDimensionManager().getDimensionID() + 1 == dimension; // Paper - getDimensionID returns the dimension - 1, so we have to add 1
if (used) {
dimension++;
break;
--
2.25.1