Archiviert
13
0

Re-add block inlining - Closes #1229

Also reordered MC Utils to be higher up
Dieser Commit ist enthalten in:
Aikar 2018-07-22 18:46:13 -04:00
Ursprung 4b66f1978d
Commit 4dd6ddb86b
Es konnte kein GPG-Schlüssel zu dieser Signatur gefunden werden
GPG-Schlüssel-ID: 401ADFC9891FAAFE
7 geänderte Dateien mit 124 neuen und 106 gelöschten Zeilen

Datei anzeigen

@ -1,4 +1,4 @@
From 34e03f427dce5395f45f2fbfa8400f4c40b73194 Mon Sep 17 00:00:00 2001 From cfbaba5f9368ad26dde9c81f8a41a73743a39239 Mon Sep 17 00:00:00 2001
From: Aikar <aikar@aikar.co> From: Aikar <aikar@aikar.co>
Date: Mon, 28 Mar 2016 20:55:47 -0400 Date: Mon, 28 Mar 2016 20:55:47 -0400
Subject: [PATCH] MC Utils 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 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 --- a/src/main/java/net/minecraft/server/BlockPosition.java
+++ b/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 @Immutable
public class BlockPosition extends BaseBlockPosition { public class BlockPosition extends BaseBlockPosition {
- private static final Logger b = LogManager.getLogger(); - 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); 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 c = 1 + MathHelper.e(MathHelper.c(30000000));
private static final int d = BlockPosition.c; 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); 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) { 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); 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; return this.d;
} }
@ -46,7 +45,7 @@ index 121a137f3..35ec4981c 100644
public BlockPosition.MutableBlockPosition c(int i, int j, int k) { public BlockPosition.MutableBlockPosition c(int i, int j, int k) {
this.b = i; this.b = i;
this.c = j; this.c = j;
@@ -389,6 +391,7 @@ public class BlockPosition extends BaseBlockPosition { @@ -389,6 +390,7 @@ public class BlockPosition extends BaseBlockPosition {
return this; return this;
} }
@ -55,7 +54,7 @@ index 121a137f3..35ec4981c 100644
return this.c(MathHelper.floor(d0), MathHelper.floor(d1), MathHelper.floor(d2)); 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 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 --- a/src/main/java/net/minecraft/server/Chunk.java
+++ b/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 @@ -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 ChunkSection[] sections;
private final BiomeBase[] g; private final BiomeBase[] g;
private final boolean[] h; 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); return this.a(blockposition, Chunk.EnumTileEntityState.CHECK);
} }
@ -89,7 +88,7 @@ index 00a530c51..2947d9ff6 100644
return (long) i & 4294967295L | ((long) j & 4294967295L) << 32; 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 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 --- a/src/main/java/net/minecraft/server/EntityTypes.java
+++ b/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; @@ -3,6 +3,7 @@ package net.minecraft.server;
@ -122,7 +121,7 @@ index 97cfd6695..81605b10f 100644
@Nullable @Nullable
public static MinecraftKey getName(EntityTypes<?> entitytypes) { 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> { 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 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 --- a/src/main/java/net/minecraft/server/PlayerConnection.java
+++ b/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 { @@ -66,9 +66,9 @@ public class PlayerConnection implements PacketListenerPlayIn, ITickable {

Datei anzeigen

@ -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 <zach.brown@destroystokyo.com> From: Zach Brown <zach.brown@destroystokyo.com>
Date: Fri, 24 Mar 2017 23:56:01 -0500 Date: Fri, 24 Mar 2017 23:56:01 -0500
Subject: [PATCH] Paper Metrics Subject: [PATCH] Paper Metrics
@ -671,7 +671,7 @@ index 3d8ee9ed3..5ab2cf6ee 100644
static void readConfig(Class<?> clazz, Object instance) { 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 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 --- a/src/main/java/org/spigotmc/SpigotConfig.java
+++ b/src/main/java/org/spigotmc/SpigotConfig.java +++ b/src/main/java/org/spigotmc/SpigotConfig.java
@@ -84,6 +84,7 @@ public class SpigotConfig @@ -84,6 +84,7 @@ public class SpigotConfig

Datei anzeigen

@ -1,4 +1,4 @@
From a0f2f840d13536973078d4e2700e65ceff320081 Mon Sep 17 00:00:00 2001 From 6e81d6e82a4e7ba0d6c513918f3a3f597851df36 Mon Sep 17 00:00:00 2001
From: Aikar <aikar@aikar.co> From: Aikar <aikar@aikar.co>
Date: Wed, 4 Jul 2018 01:40:13 -0400 Date: Wed, 4 Jul 2018 01:40:13 -0400
Subject: [PATCH] Add MinecraftKey Information to Objects 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 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 --- a/src/main/java/net/minecraft/server/Entity.java
+++ b/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; @@ -45,7 +45,7 @@ import org.bukkit.event.entity.EntityPortalEvent;
@ -88,10 +88,10 @@ index 515c9d875..53fc37088 100644
protected abstract void a(NBTTagCompound nbttagcompound); 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 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 --- a/src/main/java/net/minecraft/server/EntityTypes.java
+++ b/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 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 --- a/src/main/java/net/minecraft/server/TileEntity.java
+++ b/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; @@ -7,11 +7,11 @@ import org.apache.logging.log4j.Logger;

Datei anzeigen

@ -1,4 +1,4 @@
From 9f15dcf160d9412793b5069dfa9d92e692ac1abc Mon Sep 17 00:00:00 2001 From 241415266671ef0d001deac110827cb2cd1e46bb Mon Sep 17 00:00:00 2001
From: Aikar <aikar@aikar.co> From: Aikar <aikar@aikar.co>
Date: Wed, 4 Jul 2018 02:10:36 -0400 Date: Wed, 4 Jul 2018 02:10:36 -0400
Subject: [PATCH] Store reference to current Chunk for Entity and Block 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. 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 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 --- a/src/main/java/net/minecraft/server/Chunk.java
+++ b/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 { @@ -33,7 +33,7 @@ public class Chunk implements IChunkAccess {
@ -86,7 +86,7 @@ index 9500c456d..120e66c78 100644
public boolean c(BlockPosition blockposition) { 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 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 --- a/src/main/java/net/minecraft/server/Entity.java
+++ b/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 @@ -1786,6 +1786,40 @@ public abstract class Entity implements INamableTileEntity, ICommandListener, Ke
@ -131,7 +131,7 @@ index 53fc37088..1ef52cc6d 100644
public final String entityKeyString; public final String entityKeyString;
diff --git a/src/main/java/net/minecraft/server/TileEntity.java b/src/main/java/net/minecraft/server/TileEntity.java 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 --- a/src/main/java/net/minecraft/server/TileEntity.java
+++ b/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 { @@ -38,6 +38,15 @@ public abstract class TileEntity implements KeyedObject {
@ -151,7 +151,7 @@ index b09325097..b992360ac 100644
@Nullable @Nullable
diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftEntity.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftEntity.java 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 --- a/src/main/java/org/bukkit/craftbukkit/entity/CraftEntity.java
+++ b/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; @@ -9,6 +9,7 @@ import java.util.UUID;

Datei anzeigen

@ -1,4 +1,4 @@
From fd0ed98b73db46e809681e54d3b823d7b710b507 Mon Sep 17 00:00:00 2001 From 54bc9c613540e749baf2c4582f5000d0ea7f9ae9 Mon Sep 17 00:00:00 2001
From: Aikar <aikar@aikar.co> From: Aikar <aikar@aikar.co>
Date: Wed, 4 Jul 2018 02:13:59 -0400 Date: Wed, 4 Jul 2018 02:13:59 -0400
Subject: [PATCH] Store counts for each Entity/Block Entity Type 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 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 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 --- a/src/main/java/net/minecraft/server/Chunk.java
+++ b/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 { @@ -64,15 +64,19 @@ public class Chunk implements IChunkAccess {

Datei anzeigen

@ -1,4 +1,4 @@
From 2ad7998f791d185616cd9fe917db69a70eed172a Mon Sep 17 00:00:00 2001 From 6ebe7f1a09ee9925c972a7800d3c654e3d86695e Mon Sep 17 00:00:00 2001
From: Aikar <aikar@aikar.co> From: Aikar <aikar@aikar.co>
Date: Thu, 3 Mar 2016 02:07:55 -0600 Date: Thu, 3 Mar 2016 02:07:55 -0600
Subject: [PATCH] Optimize isValidLocation, getType and getBlockData for inling 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) { public BaseBlockPosition(int i, int j, int k) {
this.a = i; this.a = i;
diff --git a/src/main/java/net/minecraft/server/BlockPosition.java b/src/main/java/net/minecraft/server/BlockPosition.java 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 --- a/src/main/java/net/minecraft/server/BlockPosition.java
+++ b/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 b;
protected int c; protected int c;
protected int d; protected int d;
@ -52,7 +52,7 @@ index 35ec4981c..ca73ac82f 100644
public MutableBlockPosition() { public MutableBlockPosition() {
this(0, 0, 0); this(0, 0, 0);
diff --git a/src/main/java/net/minecraft/server/Chunk.java b/src/main/java/net/minecraft/server/Chunk.java 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 --- a/src/main/java/net/minecraft/server/Chunk.java
+++ b/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 { @@ -430,12 +430,24 @@ public class Chunk implements IChunkAccess {

Datei anzeigen

@ -1,4 +1,4 @@
From 3492554953e265e90b7507d8085b7ee78ab418fc Mon Sep 17 00:00:00 2001 From 24b5fbaa4e37f418c3eefd5a6ab6678aa6e095ac Mon Sep 17 00:00:00 2001
From: Techcable <Techcable@outlook.com> From: Techcable <Techcable@outlook.com>
Date: Wed, 30 Nov 2016 20:56:58 -0600 Date: Wed, 30 Nov 2016 20:56:58 -0600
Subject: [PATCH] Speedup BlockPos by fixing inlining 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. 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 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 --- a/src/main/java/net/minecraft/server/BaseBlockPosition.java
+++ b/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 class BaseBlockPosition implements Comparable<BaseBlockPosition> {
public static final BaseBlockPosition ZERO = new BaseBlockPosition(0, 0, 0); public static final BaseBlockPosition ZERO = new BaseBlockPosition(0, 0, 0);
- private final int a; - private final int a;
- private final int b; - private final int b;
- private final int c; - private final int c;
- // Paper start // Paper start
- public boolean isValidLocation() { + protected int x;
+ // Paper start - Make mutable and protected for MutableBlockPos and PooledBlockPos + protected int y;
+ protected int a; + protected int z;
+ protected int b; public boolean isValidLocation() {
+ protected int c; - 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 final boolean isValidLocation() {
return a >= -30000000 && c >= -30000000 && a < 30000000 && c < 30000000 && b >= 0 && b < 256;
} }
public boolean isInvalidYLocation() { 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(); return this.getY() == baseblockposition.getY() ? (this.getZ() == baseblockposition.getZ() ? this.getX() - baseblockposition.getX() : this.getZ() - baseblockposition.getZ()) : this.getY() - baseblockposition.getY();
} }
- public int getX() { - public int getX() {
+ // Paper start - Only allow a single implementation - return this.a;
+ // Paper start
+ public final int getX() { + public final int getX() {
return this.a; + return this.x;
} }
- public int getY() { public int getY() {
+ public final int getY() { - return this.b;
return this.b; + return this.y;
} }
- public int getZ() { public int getZ() {
+ public final int getZ() { - return this.c;
return this.c; + return this.z;
} }
+ // Paper end + // Paper end
public BaseBlockPosition d(BaseBlockPosition baseblockposition) { 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()); 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 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 --- a/src/main/java/net/minecraft/server/BlockPosition.java
+++ b/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 { @@ -207,15 +207,17 @@ public class BlockPosition extends BaseBlockPosition {
if (this.b == null) { if (this.g == null) {
this.b = new BlockPosition.MutableBlockPosition(i, j, k); this.g = new BlockPosition.MutableBlockPosition(i, j, k);
return this.b; return this.g;
- } else if (this.b.b == l && this.b.c == i1 && this.b.d == j1) { - } else if (this.g.b == l && this.g.c == i1 && this.g.d == j1) {
+ // Paper start - b, c, d, refer to x, y, z, and as such, a, b, c of BaseBlockPosition + } else if (this.g.x == l && this.g.y == i1 && this.g.z == j1) { // Paper
+ } else if (((BaseBlockPosition)this.b).a == l && ((BaseBlockPosition)this.b).b == i1 && ((BaseBlockPosition)this.b).c == j1) { return (BlockPosition.MutableBlockPosition) this.endOfData();
return (BlockPosition.MutableBlockPosition) this.endOfData(); } else {
} else { - if (this.g.b < l) {
- if (this.b.b < l) { - ++this.g.b;
- ++this.b.b; - } else if (this.g.c < i1) {
- } else if (this.b.c < i1) { - ++this.g.c;
- this.b.b = i; - } else if (this.g.d < j1) {
- ++this.b.c; - ++this.g.d;
- } else if (this.b.d < j1) { + // Paper start - use xyz
- this.b.b = i; + if (this.g.x < l) {
- this.b.c = j; + ++this.g.x;
- ++this.b.d; + } else if (this.g.y < i1) {
+ if (((BaseBlockPosition) this.b).a < l) { + ++this.g.y;
+ ++((BaseBlockPosition) this.b).a; + } else if (this.g.z < j1) {
+ } else if (((BaseBlockPosition) this.b).b < i1) { + ++this.g.z;
+ ((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;
}
+ // Paper end + // 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 { public static class MutableBlockPosition extends BlockPosition {
+ // Paper start - Remove variables + // Paper start - comment out
+ /* + /*
protected int b; protected int b;
protected int c; protected int c;
protected int d; 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() { public boolean isInvalidYLocation() {
return c < 0 || c >= 256; return c < 0 || c >= 256;
} }
@ -118,61 +130,68 @@ index b3c1f550c..6a0b3a62d 100644
// Paper end // Paper end
public MutableBlockPosition() { 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) { public MutableBlockPosition(int i, int j, int k) {
super(0, 0, 0); - super(0, 0, 0);
- this.b = i; + // Paper start
- this.c = j; + super(i, j, k);
+ /*
this.b = i;
this.c = j;
- this.d = k; - this.d = k;
+ // Paper start - Modify base position variables + this.d = k;*/
+ ((BaseBlockPosition) this).a = i;
+ ((BaseBlockPosition) this).b = j;
+ ((BaseBlockPosition) this).c = k;
+ // Paper end + // Paper end
} }
public BlockPosition a(double d0, double d1, double d2) { 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(); return super.a(enumblockrotation).h();
} }
+ // Paper start - Use superclass methods
+ /* + /*
+ // Paper start - use parent getters
public int getX() { public int getX() {
return this.b; return this.b;
} }
@@ -394,12 +403,16 @@ public class BlockPosition extends BaseBlockPosition { @@ -390,13 +400,16 @@ public class BlockPosition extends BaseBlockPosition {
public int getZ() { public int getZ() {
return this.d; return this.d;
} - }
+ */ + }*/
+ // Paper end + // 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) { public BlockPosition.MutableBlockPosition c(int i, int j, int k) {
- this.b = i; - this.b = i;
- this.c = j; - this.c = j;
- this.d = k; - this.d = k;
+ // Paper start - Modify base position variables + // Paper start - use xyz
+ ((BaseBlockPosition) this).a = i; + this.x = i;
+ ((BaseBlockPosition) this).b = j; + this.y = j;
+ ((BaseBlockPosition) this).c = k; + this.z = k;
+ // Paper end + // Paper end
return this; 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) { 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.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) { public void p(int i) {
- this.c = i; - this.c = i;
+ ((BaseBlockPosition) this).b = i; // Paper - Modify base variable + this.y = i; // Paper change to y
} }
public BlockPosition h() { public BlockPosition h() {