From af561492ab5bf3470bb9529a895c2730f454b7e4 Mon Sep 17 00:00:00 2001 From: Brokkonaut Date: Wed, 25 Jul 2018 03:39:30 +0200 Subject: [PATCH] Fix broken block iteration (#1269) Fixes https://github.com/PaperMC/Paper/issues/1259 and generation of the end pillars --- Spigot-Server-Patches/0003-MC-Dev-fixes.patch | 24 ++++++++++++---- Spigot-Server-Patches/0004-MC-Utils.patch | 10 +++---- ...Location-getType-and-getBlockData-fo.patch | 8 +++--- ...-Speedup-BlockPos-by-fixing-inlining.patch | 28 +++++++++++-------- 4 files changed, 44 insertions(+), 26 deletions(-) diff --git a/Spigot-Server-Patches/0003-MC-Dev-fixes.patch b/Spigot-Server-Patches/0003-MC-Dev-fixes.patch index 2bc8423b7..137e20dd3 100644 --- a/Spigot-Server-Patches/0003-MC-Dev-fixes.patch +++ b/Spigot-Server-Patches/0003-MC-Dev-fixes.patch @@ -1,11 +1,11 @@ -From fa5eced3c89ff7fa1b290628a381d1211606e2bb Mon Sep 17 00:00:00 2001 +From 5e82fb8aede56d14967ad5e126ef1870ea6f10d8 Mon Sep 17 00:00:00 2001 From: Aikar Date: Wed, 30 Mar 2016 19:36:20 -0400 Subject: [PATCH] MC Dev fixes diff --git a/src/main/java/com/destroystokyo/paper/PaperCommand.java b/src/main/java/com/destroystokyo/paper/PaperCommand.java -index e8f7b729..a0ebc1ea 100644 +index e8f7b7292..a0ebc1eaa 100644 --- a/src/main/java/com/destroystokyo/paper/PaperCommand.java +++ b/src/main/java/com/destroystokyo/paper/PaperCommand.java @@ -234,4 +234,5 @@ public class PaperCommand extends Command { @@ -15,7 +15,7 @@ index e8f7b729..a0ebc1ea 100644 + } diff --git a/src/main/java/net/minecraft/server/BlockPosition.java b/src/main/java/net/minecraft/server/BlockPosition.java -index 002da2a1..121a137f 100644 +index 002da2a19..9f3aa2459 100644 --- a/src/main/java/net/minecraft/server/BlockPosition.java +++ b/src/main/java/net/minecraft/server/BlockPosition.java @@ -150,7 +150,7 @@ public class BlockPosition extends BaseBlockPosition { @@ -56,8 +56,20 @@ index 002da2a1..121a137f 100644 ++this.j; } +@@ -213,8 +213,11 @@ public class BlockPosition extends BaseBlockPosition { + if (this.g.b < l) { + ++this.g.b; + } else if (this.g.c < i1) { ++ this.g.b = i; // Paper - Readd line removed by the decompiler + ++this.g.c; + } else if (this.g.d < j1) { ++ this.g.b = i; // Paper - Readd line removed by the decompiler ++ this.g.c = j; // Paper - Readd line removed by the decompiler + ++this.g.d; + } + diff --git a/src/main/java/net/minecraft/server/DefinedStructure.java b/src/main/java/net/minecraft/server/DefinedStructure.java -index a661789c..785a1a21 100644 +index a661789c1..785a1a218 100644 --- a/src/main/java/net/minecraft/server/DefinedStructure.java +++ b/src/main/java/net/minecraft/server/DefinedStructure.java @@ -88,7 +88,7 @@ public class DefinedStructure { @@ -112,7 +124,7 @@ index a661789c..785a1a21 100644 public Iterator iterator() { diff --git a/src/main/java/net/minecraft/server/RegistryID.java b/src/main/java/net/minecraft/server/RegistryID.java -index 3b8f6ec1..bde5714d 100644 +index 3b8f6ec16..bde5714dd 100644 --- a/src/main/java/net/minecraft/server/RegistryID.java +++ b/src/main/java/net/minecraft/server/RegistryID.java @@ -6,7 +6,7 @@ import java.util.Arrays; @@ -153,5 +165,5 @@ index 3b8f6ec1..bde5714d 100644 this.f = 0; -- -2.17.0 (Apple Git-106) +2.16.1.windows.1 diff --git a/Spigot-Server-Patches/0004-MC-Utils.patch b/Spigot-Server-Patches/0004-MC-Utils.patch index a10b168e0..16a3fe2e8 100644 --- a/Spigot-Server-Patches/0004-MC-Utils.patch +++ b/Spigot-Server-Patches/0004-MC-Utils.patch @@ -1,4 +1,4 @@ -From fd30fe93ea2f20e2adb5e501d8646deabc046fcf Mon Sep 17 00:00:00 2001 +From ce4b2215cf8f7b774ee8066d8a8d0b07bd54d999 Mon Sep 17 00:00:00 2001 From: Aikar Date: Mon, 28 Mar 2016 20:55:47 -0400 Subject: [PATCH] MC Utils @@ -18,7 +18,7 @@ index c3e990bdf..e2a7b4be2 100644 } } diff --git a/src/main/java/net/minecraft/server/BlockPosition.java b/src/main/java/net/minecraft/server/BlockPosition.java -index 121a137f3..279045e49 100644 +index 9f3aa2459..7dbea9090 100644 --- a/src/main/java/net/minecraft/server/BlockPosition.java +++ b/src/main/java/net/minecraft/server/BlockPosition.java @@ -10,7 +10,6 @@ import org.apache.logging.log4j.Logger; @@ -37,7 +37,7 @@ index 121a137f3..279045e49 100644 public BlockPosition a(int i, int j, int k) { return i == 0 && j == 0 && k == 0 ? this : new BlockPosition(this.getX() + i, this.getY() + j, this.getZ() + k); } -@@ -382,6 +382,7 @@ public class BlockPosition extends BaseBlockPosition { +@@ -385,6 +385,7 @@ public class BlockPosition extends BaseBlockPosition { return this.d; } @@ -45,7 +45,7 @@ index 121a137f3..279045e49 100644 public BlockPosition.MutableBlockPosition c(int i, int j, int k) { this.b = i; this.c = j; -@@ -389,6 +390,7 @@ public class BlockPosition extends BaseBlockPosition { +@@ -392,6 +393,7 @@ public class BlockPosition extends BaseBlockPosition { return this; } @@ -711,5 +711,5 @@ index 2179664a0..d7e1ecc03 100644 } } -- -2.18.0 +2.16.1.windows.1 diff --git a/Spigot-Server-Patches/0082-Optimize-isValidLocation-getType-and-getBlockData-fo.patch b/Spigot-Server-Patches/0082-Optimize-isValidLocation-getType-and-getBlockData-fo.patch index 3488e657f..ffa41c1da 100644 --- a/Spigot-Server-Patches/0082-Optimize-isValidLocation-getType-and-getBlockData-fo.patch +++ b/Spigot-Server-Patches/0082-Optimize-isValidLocation-getType-and-getBlockData-fo.patch @@ -1,4 +1,4 @@ -From 6ebe7f1a09ee9925c972a7800d3c654e3d86695e Mon Sep 17 00:00:00 2001 +From 5372e9c03d78bdb92741561ef1c5d2f63c8621f7 Mon Sep 17 00:00:00 2001 From: Aikar Date: Thu, 3 Mar 2016 02:07:55 -0600 Subject: [PATCH] Optimize isValidLocation, getType and getBlockData for inling @@ -31,10 +31,10 @@ index e2a7b4be2..58f8b4b72 100644 public BaseBlockPosition(int i, int j, int k) { this.a = i; diff --git a/src/main/java/net/minecraft/server/BlockPosition.java b/src/main/java/net/minecraft/server/BlockPosition.java -index 279045e49..7122a9aa8 100644 +index 7dbea9090..252e00e16 100644 --- a/src/main/java/net/minecraft/server/BlockPosition.java +++ b/src/main/java/net/minecraft/server/BlockPosition.java -@@ -338,6 +338,16 @@ public class BlockPosition extends BaseBlockPosition { +@@ -341,6 +341,16 @@ public class BlockPosition extends BaseBlockPosition { protected int b; protected int c; protected int d; @@ -200,5 +200,5 @@ index 11cf087e7..489c152ee 100644 } else { Chunk chunk = this.chunkProvider.getLoadedChunkAt(blockposition.getX() >> 4, blockposition.getZ() >> 4); -- -2.18.0 +2.16.1.windows.1 diff --git a/Spigot-Server-Patches/0304-Speedup-BlockPos-by-fixing-inlining.patch b/Spigot-Server-Patches/0304-Speedup-BlockPos-by-fixing-inlining.patch index 4abc228aa..b7cc0fd14 100644 --- a/Spigot-Server-Patches/0304-Speedup-BlockPos-by-fixing-inlining.patch +++ b/Spigot-Server-Patches/0304-Speedup-BlockPos-by-fixing-inlining.patch @@ -1,4 +1,4 @@ -From d4e24e1b648305ae75c64ba245fcfb3d1712fdfb Mon Sep 17 00:00:00 2001 +From 6fe1ca8e8466247070481df3b515bba54cec603f Mon Sep 17 00:00:00 2001 From: Techcable Date: Wed, 30 Nov 2016 20:56:58 -0600 Subject: [PATCH] Speedup BlockPos by fixing inlining @@ -21,7 +21,7 @@ This is based upon conclusions drawn from inspecting the assenmbly generated byt They had 'callq' (invoke) instead of 'mov' (get from memory) instructions. diff --git a/src/main/java/net/minecraft/server/BaseBlockPosition.java b/src/main/java/net/minecraft/server/BaseBlockPosition.java -index 58f8b4b720..98992513da 100644 +index 58f8b4b72..98992513d 100644 --- a/src/main/java/net/minecraft/server/BaseBlockPosition.java +++ b/src/main/java/net/minecraft/server/BaseBlockPosition.java @@ -7,22 +7,22 @@ import javax.annotation.concurrent.Immutable; @@ -80,10 +80,10 @@ index 58f8b4b720..98992513da 100644 public BaseBlockPosition d(BaseBlockPosition baseblockposition) { return new BaseBlockPosition(this.getY() * baseblockposition.getZ() - this.getZ() * baseblockposition.getY(), this.getZ() * baseblockposition.getX() - this.getX() * baseblockposition.getZ(), this.getX() * baseblockposition.getY() - this.getY() * baseblockposition.getX()); diff --git a/src/main/java/net/minecraft/server/BlockPosition.java b/src/main/java/net/minecraft/server/BlockPosition.java -index 7122a9aa8a..2f6fc330b3 100644 +index 252e00e16..f769b178c 100644 --- a/src/main/java/net/minecraft/server/BlockPosition.java +++ b/src/main/java/net/minecraft/server/BlockPosition.java -@@ -207,15 +207,17 @@ public class BlockPosition extends BaseBlockPosition { +@@ -207,18 +207,20 @@ public class BlockPosition extends BaseBlockPosition { if (this.g == null) { this.g = new BlockPosition.MutableBlockPosition(i, j, k); return this.g; @@ -94,21 +94,27 @@ index 7122a9aa8a..2f6fc330b3 100644 - if (this.g.b < l) { - ++this.g.b; - } else if (this.g.c < i1) { +- this.g.b = i; // Paper - Readd line removed by the decompiler - ++this.g.c; - } else if (this.g.d < j1) { +- this.g.b = i; // Paper - Readd line removed by the decompiler +- this.g.c = j; // Paper - Readd line removed by the decompiler - ++this.g.d; + // Paper start - use xyz + if (this.g.x < l) { + ++this.g.x; + } else if (this.g.y < i1) { ++ this.g.x = i; // Paper - Readd line removed by the decompiler + ++this.g.y; + } else if (this.g.z < j1) { ++ this.g.x = i; // Paper - Readd line removed by the decompiler ++ this.g.y = j; // Paper - Readd line removed by the decompiler + ++this.g.z; + // Paper end } return this.g; -@@ -335,10 +337,12 @@ public class BlockPosition extends BaseBlockPosition { +@@ -338,10 +340,12 @@ public class BlockPosition extends BaseBlockPosition { public static class MutableBlockPosition extends BlockPosition { @@ -122,7 +128,7 @@ index 7122a9aa8a..2f6fc330b3 100644 @Override public boolean isValidLocation() { return b >= -30000000 && d >= -30000000 && b < 30000000 && d < 30000000 && c >= 0 && c < 256; -@@ -347,6 +351,7 @@ public class BlockPosition extends BaseBlockPosition { +@@ -350,6 +354,7 @@ public class BlockPosition extends BaseBlockPosition { public boolean isInvalidYLocation() { return c < 0 || c >= 256; } @@ -130,7 +136,7 @@ index 7122a9aa8a..2f6fc330b3 100644 // Paper end public MutableBlockPosition() { -@@ -358,10 +363,13 @@ public class BlockPosition extends BaseBlockPosition { +@@ -361,10 +366,13 @@ public class BlockPosition extends BaseBlockPosition { } public MutableBlockPosition(int i, int j, int k) { @@ -146,7 +152,7 @@ index 7122a9aa8a..2f6fc330b3 100644 } public BlockPosition a(double d0, double d1, double d2) { -@@ -380,6 +388,8 @@ public class BlockPosition extends BaseBlockPosition { +@@ -383,6 +391,8 @@ public class BlockPosition extends BaseBlockPosition { return super.a(enumblockrotation).h(); } @@ -155,7 +161,7 @@ index 7122a9aa8a..2f6fc330b3 100644 public int getX() { return this.b; } -@@ -390,13 +400,16 @@ public class BlockPosition extends BaseBlockPosition { +@@ -393,13 +403,16 @@ public class BlockPosition extends BaseBlockPosition { public int getZ() { return this.d; @@ -176,7 +182,7 @@ index 7122a9aa8a..2f6fc330b3 100644 return this; } -@@ -414,15 +427,15 @@ public class BlockPosition extends BaseBlockPosition { +@@ -417,15 +430,15 @@ public class BlockPosition extends BaseBlockPosition { } public BlockPosition.MutableBlockPosition c(EnumDirection enumdirection, int i) { @@ -196,5 +202,5 @@ index 7122a9aa8a..2f6fc330b3 100644 public BlockPosition h() { -- -2.18.0 +2.16.1.windows.1