diff options
author | Aikar <[email protected]> | 2018-07-22 18:46:13 -0400 |
---|---|---|
committer | Aikar <[email protected]> | 2018-07-22 18:46:13 -0400 |
commit | 4dd6ddb86b9cc27e0cbd42d1f7baf6675914360a (patch) | |
tree | f343b25fcef686ac0d858dc91a9aa38536cc550f | |
parent | 4b66f1978dfe8c180ae560e75d17518d932beee3 (diff) | |
download | Paper-4dd6ddb86b9cc27e0cbd42d1f7baf6675914360a.tar.gz Paper-4dd6ddb86b9cc27e0cbd42d1f7baf6675914360a.zip |
Re-add block inlining - Closes #1229
Also reordered MC Utils to be higher up
-rw-r--r-- | Spigot-Server-Patches/0004-MC-Utils.patch (renamed from Spigot-Server-Patches/0008-MC-Utils.patch) | 23 | ||||
-rw-r--r-- | Spigot-Server-Patches/0005-Paper-Metrics.patch (renamed from Spigot-Server-Patches/0004-Paper-Metrics.patch) | 4 | ||||
-rw-r--r-- | Spigot-Server-Patches/0006-Add-MinecraftKey-Information-to-Objects.patch (renamed from Spigot-Server-Patches/0005-Add-MinecraftKey-Information-to-Objects.patch) | 10 | ||||
-rw-r--r-- | Spigot-Server-Patches/0007-Store-reference-to-current-Chunk-for-Entity-and-Bloc.patch (renamed from Spigot-Server-Patches/0006-Store-reference-to-current-Chunk-for-Entity-and-Bloc.patch) | 10 | ||||
-rw-r--r-- | Spigot-Server-Patches/0008-Store-counts-for-each-Entity-Block-Entity-Type.patch (renamed from Spigot-Server-Patches/0007-Store-counts-for-each-Entity-Block-Entity-Type.patch) | 4 | ||||
-rw-r--r-- | Spigot-Server-Patches/0082-Optimize-isValidLocation-getType-and-getBlockData-fo.patch | 8 | ||||
-rw-r--r-- | Spigot-Server-Patches/0305-Speedup-BlockPos-by-fixing-inlining.patch (renamed from removed/server/0174-Speedup-BlockPos-by-fixing-inlining.patch) | 171 |
7 files changed, 124 insertions, 106 deletions
diff --git a/Spigot-Server-Patches/0008-MC-Utils.patch b/Spigot-Server-Patches/0004-MC-Utils.patch index 93dd00f914..0b266a33af 100644 --- a/Spigot-Server-Patches/0008-MC-Utils.patch +++ b/Spigot-Server-Patches/0004-MC-Utils.patch @@ -1,4 +1,4 @@ -From 34e03f427dce5395f45f2fbfa8400f4c40b73194 Mon Sep 17 00:00:00 2001 +From cfbaba5f9368ad26dde9c81f8a41a73743a39239 Mon Sep 17 00:00:00 2001 From: Aikar <[email protected]> Date: Mon, 28 Mar 2016 20:55:47 -0400 Subject: [PATCH] MC Utils @@ -18,19 +18,18 @@ 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..35ec4981c 100644 +index 121a137f3..279045e49 100644 --- a/src/main/java/net/minecraft/server/BlockPosition.java +++ b/src/main/java/net/minecraft/server/BlockPosition.java -@@ -10,7 +10,7 @@ import org.apache.logging.log4j.Logger; +@@ -10,7 +10,6 @@ import org.apache.logging.log4j.Logger; @Immutable public class BlockPosition extends BaseBlockPosition { - private static final Logger b = LogManager.getLogger(); -+ private static final Logger LOGGER = LogManager.getLogger(); // Paper - b > LOGGER - attempts to avoid /some/ stupidity public static final BlockPosition ZERO = new BlockPosition(0, 0, 0); private static final int c = 1 + MathHelper.e(MathHelper.c(30000000)); private static final int d = BlockPosition.c; -@@ -45,6 +45,7 @@ public class BlockPosition extends BaseBlockPosition { +@@ -45,6 +44,7 @@ public class BlockPosition extends BaseBlockPosition { return d0 == 0.0D && d1 == 0.0D && d2 == 0.0D ? this : new BlockPosition((double) this.getX() + d0, (double) this.getY() + d1, (double) this.getZ() + d2); } @@ -38,7 +37,7 @@ index 121a137f3..35ec4981c 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 +383,7 @@ public class BlockPosition extends BaseBlockPosition { +@@ -382,6 +382,7 @@ public class BlockPosition extends BaseBlockPosition { return this.d; } @@ -46,7 +45,7 @@ index 121a137f3..35ec4981c 100644 public BlockPosition.MutableBlockPosition c(int i, int j, int k) { this.b = i; this.c = j; -@@ -389,6 +391,7 @@ public class BlockPosition extends BaseBlockPosition { +@@ -389,6 +390,7 @@ public class BlockPosition extends BaseBlockPosition { return this; } @@ -55,7 +54,7 @@ index 121a137f3..35ec4981c 100644 return this.c(MathHelper.floor(d0), MathHelper.floor(d1), MathHelper.floor(d2)); } diff --git a/src/main/java/net/minecraft/server/Chunk.java b/src/main/java/net/minecraft/server/Chunk.java -index 0ae780c8e..3b97981bc 100644 +index 411ab6061..cd4fbee0c 100644 --- a/src/main/java/net/minecraft/server/Chunk.java +++ b/src/main/java/net/minecraft/server/Chunk.java @@ -28,7 +28,7 @@ import com.google.common.collect.Lists; // CraftBukkit @@ -67,7 +66,7 @@ index 0ae780c8e..3b97981bc 100644 private final ChunkSection[] sections; private final BiomeBase[] g; private final boolean[] h; -@@ -730,6 +730,7 @@ public class Chunk implements IChunkAccess { +@@ -693,6 +693,7 @@ public class Chunk implements IChunkAccess { return this.a(blockposition, Chunk.EnumTileEntityState.CHECK); } @@ -89,7 +88,7 @@ index 00a530c51..2947d9ff6 100644 return (long) i & 4294967295L | ((long) j & 4294967295L) << 32; } diff --git a/src/main/java/net/minecraft/server/EntityTypes.java b/src/main/java/net/minecraft/server/EntityTypes.java -index 97cfd6695..81605b10f 100644 +index ca2a14d7a..9a513b4e3 100644 --- a/src/main/java/net/minecraft/server/EntityTypes.java +++ b/src/main/java/net/minecraft/server/EntityTypes.java @@ -3,6 +3,7 @@ package net.minecraft.server; @@ -122,7 +121,7 @@ index 97cfd6695..81605b10f 100644 @Nullable public static MinecraftKey getName(EntityTypes<?> entitytypes) { -@@ -278,7 +290,7 @@ public class EntityTypes<T extends Entity> { +@@ -277,7 +289,7 @@ public class EntityTypes<T extends Entity> { public static class a<T extends Entity> { @@ -601,7 +600,7 @@ index b3c944d70..a8280acf9 100644 - } } diff --git a/src/main/java/net/minecraft/server/PlayerConnection.java b/src/main/java/net/minecraft/server/PlayerConnection.java -index 2fb86aa19..6f21b01a8 100644 +index 2f2f4c6c6..556989f60 100644 --- a/src/main/java/net/minecraft/server/PlayerConnection.java +++ b/src/main/java/net/minecraft/server/PlayerConnection.java @@ -66,9 +66,9 @@ public class PlayerConnection implements PacketListenerPlayIn, ITickable { diff --git a/Spigot-Server-Patches/0004-Paper-Metrics.patch b/Spigot-Server-Patches/0005-Paper-Metrics.patch index dfed421da9..c3151bf58a 100644 --- a/Spigot-Server-Patches/0004-Paper-Metrics.patch +++ b/Spigot-Server-Patches/0005-Paper-Metrics.patch @@ -1,4 +1,4 @@ -From c6779cede78872af84c68078b5c44deff9b32089 Mon Sep 17 00:00:00 2001 +From 7c4375fab7a71d9ff634dd0c4a2d1aaba13cee49 Mon Sep 17 00:00:00 2001 From: Zach Brown <[email protected]> Date: Fri, 24 Mar 2017 23:56:01 -0500 Subject: [PATCH] Paper Metrics @@ -671,7 +671,7 @@ index 3d8ee9ed3..5ab2cf6ee 100644 static void readConfig(Class<?> clazz, Object instance) { diff --git a/src/main/java/org/spigotmc/SpigotConfig.java b/src/main/java/org/spigotmc/SpigotConfig.java -index ac36ea08e..09100408e 100644 +index 5175e9523..676780b61 100644 --- a/src/main/java/org/spigotmc/SpigotConfig.java +++ b/src/main/java/org/spigotmc/SpigotConfig.java @@ -84,6 +84,7 @@ public class SpigotConfig diff --git a/Spigot-Server-Patches/0005-Add-MinecraftKey-Information-to-Objects.patch b/Spigot-Server-Patches/0006-Add-MinecraftKey-Information-to-Objects.patch index ed6d118426..9b6e781f21 100644 --- a/Spigot-Server-Patches/0005-Add-MinecraftKey-Information-to-Objects.patch +++ b/Spigot-Server-Patches/0006-Add-MinecraftKey-Information-to-Objects.patch @@ -1,4 +1,4 @@ -From a0f2f840d13536973078d4e2700e65ceff320081 Mon Sep 17 00:00:00 2001 +From 6e81d6e82a4e7ba0d6c513918f3a3f597851df36 Mon Sep 17 00:00:00 2001 From: Aikar <[email protected]> Date: Wed, 4 Jul 2018 01:40:13 -0400 Subject: [PATCH] Add MinecraftKey Information to Objects @@ -26,7 +26,7 @@ index a0ebc1eaa..e4c771a39 100644 + } diff --git a/src/main/java/net/minecraft/server/Entity.java b/src/main/java/net/minecraft/server/Entity.java -index 515c9d875..53fc37088 100644 +index 3fa32228b..e65558f7a 100644 --- a/src/main/java/net/minecraft/server/Entity.java +++ b/src/main/java/net/minecraft/server/Entity.java @@ -45,7 +45,7 @@ import org.bukkit.event.entity.EntityPortalEvent; @@ -88,10 +88,10 @@ index 515c9d875..53fc37088 100644 protected abstract void a(NBTTagCompound nbttagcompound); diff --git a/src/main/java/net/minecraft/server/EntityTypes.java b/src/main/java/net/minecraft/server/EntityTypes.java -index 557a3f97f..97cfd6695 100644 +index 9a513b4e3..fa268f354 100644 --- a/src/main/java/net/minecraft/server/EntityTypes.java +++ b/src/main/java/net/minecraft/server/EntityTypes.java -@@ -226,6 +226,7 @@ public class EntityTypes<T extends Entity> { +@@ -238,6 +238,7 @@ public class EntityTypes<T extends Entity> { } } @@ -114,7 +114,7 @@ index 000000000..61c2b993c + } +} diff --git a/src/main/java/net/minecraft/server/TileEntity.java b/src/main/java/net/minecraft/server/TileEntity.java -index 093e7eb7f..b09325097 100644 +index 8a0453245..257dd1da9 100644 --- a/src/main/java/net/minecraft/server/TileEntity.java +++ b/src/main/java/net/minecraft/server/TileEntity.java @@ -7,11 +7,11 @@ import org.apache.logging.log4j.Logger; diff --git a/Spigot-Server-Patches/0006-Store-reference-to-current-Chunk-for-Entity-and-Bloc.patch b/Spigot-Server-Patches/0007-Store-reference-to-current-Chunk-for-Entity-and-Bloc.patch index 8f60c65ff8..c2b1b2e36c 100644 --- a/Spigot-Server-Patches/0006-Store-reference-to-current-Chunk-for-Entity-and-Bloc.patch +++ b/Spigot-Server-Patches/0007-Store-reference-to-current-Chunk-for-Entity-and-Bloc.patch @@ -1,4 +1,4 @@ -From 9f15dcf160d9412793b5069dfa9d92e692ac1abc Mon Sep 17 00:00:00 2001 +From 241415266671ef0d001deac110827cb2cd1e46bb Mon Sep 17 00:00:00 2001 From: Aikar <[email protected]> Date: Wed, 4 Jul 2018 02:10:36 -0400 Subject: [PATCH] Store reference to current Chunk for Entity and Block @@ -8,7 +8,7 @@ This enables us a fast reference to the entities current chunk instead of having to look it up by hashmap lookups. diff --git a/src/main/java/net/minecraft/server/Chunk.java b/src/main/java/net/minecraft/server/Chunk.java -index 9500c456d..120e66c78 100644 +index cd4fbee0c..7837f1024 100644 --- a/src/main/java/net/minecraft/server/Chunk.java +++ b/src/main/java/net/minecraft/server/Chunk.java @@ -33,7 +33,7 @@ public class Chunk implements IChunkAccess { @@ -86,7 +86,7 @@ index 9500c456d..120e66c78 100644 public boolean c(BlockPosition blockposition) { diff --git a/src/main/java/net/minecraft/server/Entity.java b/src/main/java/net/minecraft/server/Entity.java -index 53fc37088..1ef52cc6d 100644 +index e65558f7a..36cc0c18d 100644 --- a/src/main/java/net/minecraft/server/Entity.java +++ b/src/main/java/net/minecraft/server/Entity.java @@ -1786,6 +1786,40 @@ public abstract class Entity implements INamableTileEntity, ICommandListener, Ke @@ -131,7 +131,7 @@ index 53fc37088..1ef52cc6d 100644 public final String entityKeyString; diff --git a/src/main/java/net/minecraft/server/TileEntity.java b/src/main/java/net/minecraft/server/TileEntity.java -index b09325097..b992360ac 100644 +index 257dd1da9..cffbcb8f7 100644 --- a/src/main/java/net/minecraft/server/TileEntity.java +++ b/src/main/java/net/minecraft/server/TileEntity.java @@ -38,6 +38,15 @@ public abstract class TileEntity implements KeyedObject { @@ -151,7 +151,7 @@ index b09325097..b992360ac 100644 @Nullable diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftEntity.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftEntity.java -index 70143c4d3..1e3675e4f 100644 +index 72164e11a..f09251eec 100644 --- a/src/main/java/org/bukkit/craftbukkit/entity/CraftEntity.java +++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftEntity.java @@ -9,6 +9,7 @@ import java.util.UUID; diff --git a/Spigot-Server-Patches/0007-Store-counts-for-each-Entity-Block-Entity-Type.patch b/Spigot-Server-Patches/0008-Store-counts-for-each-Entity-Block-Entity-Type.patch index 807ae934d2..9dbbf1792d 100644 --- a/Spigot-Server-Patches/0007-Store-counts-for-each-Entity-Block-Entity-Type.patch +++ b/Spigot-Server-Patches/0008-Store-counts-for-each-Entity-Block-Entity-Type.patch @@ -1,4 +1,4 @@ -From fd0ed98b73db46e809681e54d3b823d7b710b507 Mon Sep 17 00:00:00 2001 +From 54bc9c613540e749baf2c4582f5000d0ea7f9ae9 Mon Sep 17 00:00:00 2001 From: Aikar <[email protected]> Date: Wed, 4 Jul 2018 02:13:59 -0400 Subject: [PATCH] Store counts for each Entity/Block Entity Type @@ -6,7 +6,7 @@ Subject: [PATCH] Store counts for each Entity/Block Entity Type Opens door for future patches to optimize performance diff --git a/src/main/java/net/minecraft/server/Chunk.java b/src/main/java/net/minecraft/server/Chunk.java -index 120e66c78..0ae780c8e 100644 +index 7837f1024..0a0d04cf6 100644 --- a/src/main/java/net/minecraft/server/Chunk.java +++ b/src/main/java/net/minecraft/server/Chunk.java @@ -64,15 +64,19 @@ public class Chunk implements IChunkAccess { 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 9635d0a07c..3488e657f9 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 2ad7998f791d185616cd9fe917db69a70eed172a Mon Sep 17 00:00:00 2001 +From 6ebe7f1a09ee9925c972a7800d3c654e3d86695e Mon Sep 17 00:00:00 2001 From: Aikar <[email protected]> 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 35ec4981c..ca73ac82f 100644 +index 279045e49..7122a9aa8 100644 --- a/src/main/java/net/minecraft/server/BlockPosition.java +++ b/src/main/java/net/minecraft/server/BlockPosition.java -@@ -339,6 +339,16 @@ public class BlockPosition extends BaseBlockPosition { +@@ -338,6 +338,16 @@ public class BlockPosition extends BaseBlockPosition { protected int b; protected int c; protected int d; @@ -52,7 +52,7 @@ index 35ec4981c..ca73ac82f 100644 public MutableBlockPosition() { this(0, 0, 0); diff --git a/src/main/java/net/minecraft/server/Chunk.java b/src/main/java/net/minecraft/server/Chunk.java -index 0dc05b644..94d036865 100644 +index 32c1dbd0b..5d1812ab0 100644 --- a/src/main/java/net/minecraft/server/Chunk.java +++ b/src/main/java/net/minecraft/server/Chunk.java @@ -430,12 +430,24 @@ public class Chunk implements IChunkAccess { diff --git a/removed/server/0174-Speedup-BlockPos-by-fixing-inlining.patch b/Spigot-Server-Patches/0305-Speedup-BlockPos-by-fixing-inlining.patch index 82925800bb..15d1b98326 100644 --- a/removed/server/0174-Speedup-BlockPos-by-fixing-inlining.patch +++ b/Spigot-Server-Patches/0305-Speedup-BlockPos-by-fixing-inlining.patch @@ -1,4 +1,4 @@ -From 3492554953e265e90b7507d8085b7ee78ab418fc Mon Sep 17 00:00:00 2001 +From 24b5fbaa4e37f418c3eefd5a6ab6678aa6e095ac Mon Sep 17 00:00:00 2001 From: Techcable <[email protected]> Date: Wed, 30 Nov 2016 20:56:58 -0600 Subject: [PATCH] Speedup BlockPos by fixing inlining @@ -21,96 +21,108 @@ 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 679d5504e..8e737718e 100644 +index 58f8b4b72..98992513d 100644 --- a/src/main/java/net/minecraft/server/BaseBlockPosition.java +++ b/src/main/java/net/minecraft/server/BaseBlockPosition.java -@@ -7,11 +7,12 @@ import javax.annotation.concurrent.Immutable; +@@ -7,22 +7,22 @@ import javax.annotation.concurrent.Immutable; public class BaseBlockPosition implements Comparable<BaseBlockPosition> { public static final BaseBlockPosition ZERO = new BaseBlockPosition(0, 0, 0); - private final int a; - private final int b; - private final int c; -- // Paper start -- public boolean isValidLocation() { -+ // Paper start - Make mutable and protected for MutableBlockPos and PooledBlockPos -+ protected int a; -+ protected int b; -+ protected int c; -+ -+ public final boolean isValidLocation() { - return a >= -30000000 && c >= -30000000 && a < 30000000 && c < 30000000 && b >= 0 && b < 256; + // Paper start ++ protected int x; ++ protected int y; ++ protected int z; + public boolean isValidLocation() { +- return a >= -30000000 && c >= -30000000 && a < 30000000 && c < 30000000 && b >= 0 && b < 256; ++ return x >= -30000000 && z >= -30000000 && x < 30000000 && z < 30000000 && y >= 0 && y < 256; } public boolean isInvalidYLocation() { -@@ -49,17 +50,19 @@ public class BaseBlockPosition implements Comparable<BaseBlockPosition> { +- return b < 0 || b >= 256; ++ return y < 0 || y >= 256; + } + // Paper end + + public BaseBlockPosition(int i, int j, int k) { +- this.a = i; +- this.b = j; +- this.c = k; ++ this.x = i; ++ this.y = j; ++ this.z = k; + } + + public BaseBlockPosition(double d0, double d1, double d2) { +@@ -49,17 +49,19 @@ public class BaseBlockPosition implements Comparable<BaseBlockPosition> { return this.getY() == baseblockposition.getY() ? (this.getZ() == baseblockposition.getZ() ? this.getX() - baseblockposition.getX() : this.getZ() - baseblockposition.getZ()) : this.getY() - baseblockposition.getY(); } - public int getX() { -+ // Paper start - Only allow a single implementation +- return this.a; ++ // Paper start + public final int getX() { - return this.a; ++ return this.x; } -- public int getY() { -+ public final int getY() { - return this.b; + public int getY() { +- return this.b; ++ return this.y; } -- public int getZ() { -+ public final int getZ() { - return this.c; + public int getZ() { +- return this.c; ++ return this.z; } + // Paper end 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 b3c1f550c..6a0b3a62d 100644 +index 7122a9aa8..2f6fc330b 100644 --- a/src/main/java/net/minecraft/server/BlockPosition.java +++ b/src/main/java/net/minecraft/server/BlockPosition.java -@@ -211,19 +211,21 @@ public class BlockPosition extends BaseBlockPosition { - if (this.b == null) { - this.b = new BlockPosition.MutableBlockPosition(i, j, k); - return this.b; -- } else if (this.b.b == l && this.b.c == i1 && this.b.d == j1) { -+ // Paper start - b, c, d, refer to x, y, z, and as such, a, b, c of BaseBlockPosition -+ } else if (((BaseBlockPosition)this.b).a == l && ((BaseBlockPosition)this.b).b == i1 && ((BaseBlockPosition)this.b).c == j1) { - return (BlockPosition.MutableBlockPosition) this.endOfData(); - } else { -- if (this.b.b < l) { -- ++this.b.b; -- } else if (this.b.c < i1) { -- this.b.b = i; -- ++this.b.c; -- } else if (this.b.d < j1) { -- this.b.b = i; -- this.b.c = j; -- ++this.b.d; -+ if (((BaseBlockPosition) this.b).a < l) { -+ ++((BaseBlockPosition) this.b).a; -+ } else if (((BaseBlockPosition) this.b).b < i1) { -+ ((BaseBlockPosition) this.b).a = i; -+ ++((BaseBlockPosition) this.b).b; -+ } else if (((BaseBlockPosition) this.b).c < j1) { -+ ((BaseBlockPosition) this.b).a = i; -+ ((BaseBlockPosition) this.b).b = j; -+ ++((BaseBlockPosition) this.b).c; - } +@@ -207,15 +207,17 @@ public class BlockPosition extends BaseBlockPosition { + if (this.g == null) { + this.g = new BlockPosition.MutableBlockPosition(i, j, k); + return this.g; +- } else if (this.g.b == l && this.g.c == i1 && this.g.d == j1) { ++ } else if (this.g.x == l && this.g.y == i1 && this.g.z == j1) { // Paper + return (BlockPosition.MutableBlockPosition) this.endOfData(); + } else { +- if (this.g.b < l) { +- ++this.g.b; +- } else if (this.g.c < i1) { +- ++this.g.c; +- } else if (this.g.d < j1) { +- ++this.g.d; ++ // Paper start - use xyz ++ if (this.g.x < l) { ++ ++this.g.x; ++ } else if (this.g.y < i1) { ++ ++this.g.y; ++ } else if (this.g.z < j1) { ++ ++this.g.z; + // Paper end - - return this.b; } -@@ -338,6 +340,8 @@ public class BlockPosition extends BaseBlockPosition { + + return this.g; +@@ -335,10 +337,12 @@ public class BlockPosition extends BaseBlockPosition { public static class MutableBlockPosition extends BlockPosition { -+ // Paper start - Remove variables ++ // Paper start - comment out + /* protected int b; protected int c; protected int d; -@@ -350,6 +354,7 @@ public class BlockPosition extends BaseBlockPosition { +- // Paper start ++ + @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 { public boolean isInvalidYLocation() { return c < 0 || c >= 256; } @@ -118,61 +130,68 @@ index b3c1f550c..6a0b3a62d 100644 // Paper end public MutableBlockPosition() { -@@ -362,9 +367,11 @@ public class BlockPosition extends BaseBlockPosition { +@@ -358,10 +363,13 @@ public class BlockPosition extends BaseBlockPosition { + } public MutableBlockPosition(int i, int j, int k) { - super(0, 0, 0); -- this.b = i; -- this.c = j; +- super(0, 0, 0); ++ // Paper start ++ super(i, j, k); ++ /* + this.b = i; + this.c = j; - this.d = k; -+ // Paper start - Modify base position variables -+ ((BaseBlockPosition) this).a = i; -+ ((BaseBlockPosition) this).b = j; -+ ((BaseBlockPosition) this).c = k; ++ this.d = k;*/ + // Paper end } public BlockPosition a(double d0, double d1, double d2) { -@@ -383,6 +390,8 @@ public class BlockPosition extends BaseBlockPosition { +@@ -380,6 +388,8 @@ public class BlockPosition extends BaseBlockPosition { return super.a(enumblockrotation).h(); } -+ // Paper start - Use superclass methods + /* ++ // Paper start - use parent getters public int getX() { return this.b; } -@@ -394,12 +403,16 @@ public class BlockPosition extends BaseBlockPosition { +@@ -390,13 +400,16 @@ public class BlockPosition extends BaseBlockPosition { + public int getZ() { return this.d; - } -+ */ +- } ++ }*/ + // Paper end - public void setValues(int x, int y, int z) { c(x, y, z); } // Paper - OBFHELPER + public BlockPosition.MutableBlockPosition setValues(int i, int j, int k) { return c(i, j, k);} // Paper - OBFHELPER public BlockPosition.MutableBlockPosition c(int i, int j, int k) { - this.b = i; - this.c = j; - this.d = k; -+ // Paper start - Modify base position variables -+ ((BaseBlockPosition) this).a = i; -+ ((BaseBlockPosition) this).b = j; -+ ((BaseBlockPosition) this).c = k; ++ // Paper start - use xyz ++ this.x = i; ++ this.y = j; ++ this.z = k; + // Paper end return this; } -@@ -416,11 +429,11 @@ public class BlockPosition extends BaseBlockPosition { +@@ -414,15 +427,15 @@ public class BlockPosition extends BaseBlockPosition { } public BlockPosition.MutableBlockPosition c(EnumDirection enumdirection, int i) { - return this.c(this.b + enumdirection.getAdjacentX() * i, this.c + enumdirection.getAdjacentY() * i, this.d + enumdirection.getAdjacentZ() * i); -+ return this.c(this.getX() + enumdirection.getAdjacentX() * i, this.getY() + enumdirection.getAdjacentY() * i, this.getZ() + enumdirection.getAdjacentZ() * i); // Paper - USE THE BLEEPING GETTERS ++ return this.c(x + enumdirection.getAdjacentX() * i, y + enumdirection.getAdjacentY() * i, z + enumdirection.getAdjacentZ() * i); // Paper - use xyz + } + + public BlockPosition.MutableBlockPosition d(int i, int j, int k) { +- return this.c(this.b + i, this.c + j, this.d + k); ++ return this.c(x + i, y + j, z + k); // Paper - use xyz } public void p(int i) { - this.c = i; -+ ((BaseBlockPosition) this).b = i; // Paper - Modify base variable ++ this.y = i; // Paper change to y } public BlockPosition h() { |