Port Fix missing chunks due to integer overflow to 1.19 (#7891)
This commit is contained in:
parent
4c1b338e0f
commit
44ccc15a30
470 changed files with 91 additions and 91 deletions
|
@ -1,29 +0,0 @@
|
||||||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
|
||||||
From: David Slovikosky <davidslovikosky@gmail.com>
|
|
||||||
Date: Tue, 9 Jun 2020 00:10:03 -0700
|
|
||||||
Subject: [PATCH] Fix missing chunks due to integer overflow
|
|
||||||
|
|
||||||
1.19: Either no longer needed or has to take a very different form -MM
|
|
||||||
|
|
||||||
This patch fixes a bug in the WorldChunkManagerTheEnd class where the distance
|
|
||||||
from 0,0 squared overflows the maximum size of an integer. The overflow leads
|
|
||||||
to hard chunk borders around 370,000 blocks from 0,0. After this cutoff there
|
|
||||||
is a few hundred thousand block gap before end land resuming to generate at
|
|
||||||
530,000 blocks from spawn. This is due to the integer flipping back and forth.
|
|
||||||
|
|
||||||
The fix for the issue is quite simple, casting chunk coordinates to longs
|
|
||||||
allows the distance calculation to avoid overflow and work as intended.
|
|
||||||
|
|
||||||
diff --git a/src/main/java/net/minecraft/world/level/biome/TheEndBiomeSource.java b/src/main/java/net/minecraft/world/level/biome/TheEndBiomeSource.java
|
|
||||||
index bbb43461ad899aae2212c32a9e839c766b3b8e37..3f9127f93c9720c89b578d36a1bcdb89fc01222a 100644
|
|
||||||
--- a/src/main/java/net/minecraft/world/level/biome/TheEndBiomeSource.java
|
|
||||||
+++ b/src/main/java/net/minecraft/world/level/biome/TheEndBiomeSource.java
|
|
||||||
@@ -84,7 +84,7 @@ public class TheEndBiomeSource extends BiomeSource {
|
|
||||||
int l = j / 2;
|
|
||||||
int m = i % 2;
|
|
||||||
int n = j % 2;
|
|
||||||
- float f = 100.0F - Mth.sqrt((float)(i * i + j * j)) * 8.0F;
|
|
||||||
+ float f = 100.0F - Mth.sqrt((long) i * (long) i + (long) j * (long) j) * 8.0F; // Paper - cast ints to long to avoid integer overflow
|
|
||||||
f = Mth.clamp(f, -100.0F, 80.0F);
|
|
||||||
|
|
||||||
for(int o = -12; o <= 12; ++o) {
|
|
|
@ -0,0 +1,29 @@
|
||||||
|
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||||
|
From: David Slovikosky <davidslovikosky@gmail.com>
|
||||||
|
Date: Tue, 9 Jun 2020 00:10:03 -0700
|
||||||
|
Subject: [PATCH] Fix missing chunks due to integer overflow
|
||||||
|
|
||||||
|
This patch fixes a bug in the WorldChunkManagerTheEnd class where the distance
|
||||||
|
from 0,0 squared overflows the maximum size of an integer. The overflow leads
|
||||||
|
to hard chunk borders around 370,000 blocks from 0,0. After this cutoff there
|
||||||
|
is a few hundred thousand block gap before end land resuming to generate at
|
||||||
|
530,000 blocks from spawn. This is due to the integer flipping back and forth.
|
||||||
|
|
||||||
|
The fix for the issue is quite simple, casting chunk coordinates to longs
|
||||||
|
allows the distance calculation to avoid overflow and work as intended.
|
||||||
|
|
||||||
|
This issue is being tracked in Mojira ticket MC-159283
|
||||||
|
|
||||||
|
diff --git a/src/main/java/net/minecraft/world/level/levelgen/DensityFunctions.java b/src/main/java/net/minecraft/world/level/levelgen/DensityFunctions.java
|
||||||
|
index 8a5826d80f9275de1a2a6a2e23369dd1920f560f..6825feea42667a0f14c4c730e5f1ac970c654c56 100644
|
||||||
|
--- a/src/main/java/net/minecraft/world/level/levelgen/DensityFunctions.java
|
||||||
|
+++ b/src/main/java/net/minecraft/world/level/levelgen/DensityFunctions.java
|
||||||
|
@@ -501,7 +501,7 @@ public final class DensityFunctions {
|
||||||
|
int l = j / 2;
|
||||||
|
int m = i % 2;
|
||||||
|
int n = j % 2;
|
||||||
|
- float f = 100.0F - Mth.sqrt((float)(i * i + j * j)) * 8.0F;
|
||||||
|
+ float f = 100.0F - Mth.sqrt((long) i * (long) i + (long) j * (long) j) * 8.0F; // Paper - cast ints to long to avoid integer overflow
|
||||||
|
f = Mth.clamp(f, -100.0F, 80.0F);
|
||||||
|
|
||||||
|
for(int o = -12; o <= 12; ++o) {
|
|
@ -24,7 +24,7 @@ index c639557108ad9c59ccdd0b543b5507fbab1e0fa4..5e531f9fc67bd3092b39f1d3b46b9490
|
||||||
+ }
|
+ }
|
||||||
}
|
}
|
||||||
diff --git a/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java b/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java
|
diff --git a/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java b/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java
|
||||||
index 7839ee18955725463fa420a19927019f9814ee24..536fc6bf1451ea84af6084b1976eee32bf328ab0 100644
|
index ac7f270f8726bf770f90d9242132ef1d90f3c390..72f622f79d8cc16c4abce1730811770cb793d9b2 100644
|
||||||
--- a/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java
|
--- a/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java
|
||||||
+++ b/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java
|
+++ b/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java
|
||||||
@@ -74,6 +74,21 @@ public class PaperWorldConfig {
|
@@ -74,6 +74,21 @@ public class PaperWorldConfig {
|
|
@ -9,7 +9,7 @@ growing to large sizes and preventing login.
|
||||||
This now automatically cleans up the extra properties.
|
This now automatically cleans up the extra properties.
|
||||||
|
|
||||||
diff --git a/src/main/java/net/minecraft/nbt/NbtUtils.java b/src/main/java/net/minecraft/nbt/NbtUtils.java
|
diff --git a/src/main/java/net/minecraft/nbt/NbtUtils.java b/src/main/java/net/minecraft/nbt/NbtUtils.java
|
||||||
index 07abc6f2edab5a5750199dd9c24b890becc4d073..2cb1c1475c6917a0fae498fdd2c3c9eb7927438c 100644
|
index 73ee50e05a1c8d432d9967d4e879b5bb373740ad..5dda064813a0eb00438a7df909d51a4b2d48942e 100644
|
||||||
--- a/src/main/java/net/minecraft/nbt/NbtUtils.java
|
--- a/src/main/java/net/minecraft/nbt/NbtUtils.java
|
||||||
+++ b/src/main/java/net/minecraft/nbt/NbtUtils.java
|
+++ b/src/main/java/net/minecraft/nbt/NbtUtils.java
|
||||||
@@ -92,7 +92,8 @@ public final class NbtUtils {
|
@@ -92,7 +92,8 @@ public final class NbtUtils {
|
|
@ -56,7 +56,7 @@ index fdf77097cff7c3af87e390b0bfd9e8aadf7c55ec..5c00238e29cfd6ed107e3bf988a9ac2e
|
||||||
return (!this.player.joining && !this.connection.isConnected()) || this.processedDisconnect; // Paper
|
return (!this.player.joining && !this.connection.isConnected()) || this.processedDisconnect; // Paper
|
||||||
}
|
}
|
||||||
diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java
|
diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java
|
||||||
index eb6834639a434fd7938b071243fb64ab2205593f..a201182e05004a08225ac4e9f5bdf75aa46d59c9 100644
|
index 55f7bf62671d55cf967b55ae7233b6caa735f3af..7d70233cf3e9b63f9d1a307aa690fadbaef80993 100644
|
||||||
--- a/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java
|
--- a/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java
|
||||||
+++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java
|
+++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java
|
||||||
@@ -2692,6 +2692,13 @@ public class CraftPlayer extends CraftHumanEntity implements Player {
|
@@ -2692,6 +2692,13 @@ public class CraftPlayer extends CraftHumanEntity implements Player {
|
|
@ -5,7 +5,7 @@ Subject: [PATCH] Add zombie targets turtle egg config
|
||||||
|
|
||||||
|
|
||||||
diff --git a/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java b/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java
|
diff --git a/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java b/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java
|
||||||
index 536fc6bf1451ea84af6084b1976eee32bf328ab0..12a77caa7899bc6d000d48d13a504476c3f125ab 100644
|
index 72f622f79d8cc16c4abce1730811770cb793d9b2..5c8891025c03ff5507a5f677ffe320689e3672fc 100644
|
||||||
--- a/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java
|
--- a/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java
|
||||||
+++ b/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java
|
+++ b/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java
|
||||||
@@ -68,6 +68,11 @@ public class PaperWorldConfig {
|
@@ -68,6 +68,11 @@ public class PaperWorldConfig {
|
|
@ -19,7 +19,7 @@ Aside from making the obvious class/function renames and obfhelpers I didn't nee
|
||||||
Just added Bukkit's event system and took a few liberties with dead code and comment misspellings.
|
Just added Bukkit's event system and took a few liberties with dead code and comment misspellings.
|
||||||
|
|
||||||
diff --git a/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java b/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java
|
diff --git a/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java b/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java
|
||||||
index 12a77caa7899bc6d000d48d13a504476c3f125ab..34754f8d3cc03a93d148d026780eacc7dc0a20e0 100644
|
index 5c8891025c03ff5507a5f677ffe320689e3672fc..fbc909e383a43df7cff4de657cab654d79c6648f 100644
|
||||||
--- a/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java
|
--- a/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java
|
||||||
+++ b/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java
|
+++ b/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java
|
||||||
@@ -73,6 +73,40 @@ public class PaperWorldConfig {
|
@@ -73,6 +73,40 @@ public class PaperWorldConfig {
|
|
@ -10,7 +10,7 @@ In general, look at making this logic more robust (i.e properly handling
|
||||||
cases where a captured entry is overriden) - but for now this will do.
|
cases where a captured entry is overriden) - but for now this will do.
|
||||||
|
|
||||||
diff --git a/src/main/java/net/minecraft/world/level/Level.java b/src/main/java/net/minecraft/world/level/Level.java
|
diff --git a/src/main/java/net/minecraft/world/level/Level.java b/src/main/java/net/minecraft/world/level/Level.java
|
||||||
index b1cd5781620514533cf0f4d3c518ad461f98f23b..23ae163fa08311d2b41dfeafd9df32bebcc04152 100644
|
index 98831768a820be4d341a9108c50636ed48816917..c2315b4eb3d62c01f117e4f00b2280114f0945f9 100644
|
||||||
--- a/src/main/java/net/minecraft/world/level/Level.java
|
--- a/src/main/java/net/minecraft/world/level/Level.java
|
||||||
+++ b/src/main/java/net/minecraft/world/level/Level.java
|
+++ b/src/main/java/net/minecraft/world/level/Level.java
|
||||||
@@ -155,7 +155,7 @@ public abstract class Level implements LevelAccessor, AutoCloseable {
|
@@ -155,7 +155,7 @@ public abstract class Level implements LevelAccessor, AutoCloseable {
|
|
@ -5,7 +5,7 @@ Subject: [PATCH] Player elytra boost API
|
||||||
|
|
||||||
|
|
||||||
diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java
|
diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java
|
||||||
index a201182e05004a08225ac4e9f5bdf75aa46d59c9..89e0bbba593ad0dad2332758ad8df43095955b07 100644
|
index 7d70233cf3e9b63f9d1a307aa690fadbaef80993..635b182bb6a4831c457558c629afd7a34db4160e 100644
|
||||||
--- a/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java
|
--- a/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java
|
||||||
+++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java
|
+++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java
|
||||||
@@ -592,6 +592,20 @@ public class CraftPlayer extends CraftHumanEntity implements Player {
|
@@ -592,6 +592,20 @@ public class CraftPlayer extends CraftHumanEntity implements Player {
|
|
@ -5,7 +5,7 @@ Subject: [PATCH] Toggle for removing existing dragon
|
||||||
|
|
||||||
|
|
||||||
diff --git a/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java b/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java
|
diff --git a/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java b/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java
|
||||||
index 34754f8d3cc03a93d148d026780eacc7dc0a20e0..6d89bc4804dc0b23ab86b93a6ad030e1e633d61c 100644
|
index fbc909e383a43df7cff4de657cab654d79c6648f..49c3041e1608ba91f8c39e475e32c3e712639af3 100644
|
||||||
--- a/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java
|
--- a/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java
|
||||||
+++ b/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java
|
+++ b/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java
|
||||||
@@ -107,6 +107,14 @@ public class PaperWorldConfig {
|
@@ -107,6 +107,14 @@ public class PaperWorldConfig {
|
|
@ -11,7 +11,7 @@ in IWorldServerData are removed as they were only used in certain places, with h
|
||||||
values used in other places.
|
values used in other places.
|
||||||
|
|
||||||
diff --git a/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java b/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java
|
diff --git a/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java b/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java
|
||||||
index 6d89bc4804dc0b23ab86b93a6ad030e1e633d61c..9147b408b35b7d15ced3749e34706087d2cdffd8 100644
|
index 49c3041e1608ba91f8c39e475e32c3e712639af3..c3523bb368fe9c64cc361e1e5f3c190d0f9f9b80 100644
|
||||||
--- a/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java
|
--- a/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java
|
||||||
+++ b/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java
|
+++ b/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java
|
||||||
@@ -115,6 +115,19 @@ public class PaperWorldConfig {
|
@@ -115,6 +115,19 @@ public class PaperWorldConfig {
|
|
@ -5,7 +5,7 @@ Subject: [PATCH] Fix Player spawnParticle x/y/z precision loss
|
||||||
|
|
||||||
|
|
||||||
diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java
|
diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java
|
||||||
index 89e0bbba593ad0dad2332758ad8df43095955b07..d4348385ee8330398bfe543311c9256e93334861 100644
|
index 635b182bb6a4831c457558c629afd7a34db4160e..551f82b78a9deca1b702d488743e079cca744f99 100644
|
||||||
--- a/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java
|
--- a/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java
|
||||||
+++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java
|
+++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java
|
||||||
@@ -2254,7 +2254,7 @@ public class CraftPlayer extends CraftHumanEntity implements Player {
|
@@ -2254,7 +2254,7 @@ public class CraftPlayer extends CraftHumanEntity implements Player {
|
|
@ -5,7 +5,7 @@ Subject: [PATCH] Climbing should not bypass cramming gamerule
|
||||||
|
|
||||||
|
|
||||||
diff --git a/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java b/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java
|
diff --git a/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java b/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java
|
||||||
index 9147b408b35b7d15ced3749e34706087d2cdffd8..340e610b6af2dab7d916c530d3cce9aac003aa4d 100644
|
index c3523bb368fe9c64cc361e1e5f3c190d0f9f9b80..4080c12fe98cba1d17da12648a8228de2720b838 100644
|
||||||
--- a/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java
|
--- a/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java
|
||||||
+++ b/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java
|
+++ b/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java
|
||||||
@@ -128,6 +128,11 @@ public class PaperWorldConfig {
|
@@ -128,6 +128,11 @@ public class PaperWorldConfig {
|
Some files were not shown because too many files have changed in this diff Show more
Loading…
Reference in a new issue