3
0
Mirror von https://github.com/PaperMC/Paper.git synchronisiert 2024-12-16 11:30:06 +01:00
Paper/Spigot-Server-Patches/0251-Improve-BlockPosition-inline-and-hashCode-equals.patch

286 Zeilen
12 KiB
Diff

From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
2016-12-01 03:57:02 +01:00
From: Techcable <Techcable@outlook.com>
Date: Wed, 30 Nov 2016 20:56:58 -0600
Subject: [PATCH] Improve BlockPosition inline and hashCode/equals
2016-12-01 03:57:02 +01:00
Normally the JVM can inline virtual getters by having two sets of code, one is the 'optimized' code and the other is the 'deoptimized' code.
If a single type is used 99% of the time, then its worth it to inline, and to revert to 'deoptimized' the 1% of the time we encounter other types.
But if two types are encountered commonly, then the JVM can't inline them both, and the call overhead remains.
This scenario also occurs with BlockPos and MutableBlockPos.
The variables in BlockPos are final, so MutableBlockPos can't modify them.
MutableBlockPos fixes this by adding custom mutable variables, and overriding the getters to access them.
This approach with utility methods that operate on MutableBlockPos and BlockPos.
Specific examples are BlockPosition.up(), and World.isValidLocation().
It makes these simple methods much slower than they need to be.
This should result in an across the board speedup in anything that accesses blocks or does logic with positions.
This is based upon conclusions drawn from inspecting the assenmbly generated bythe JIT compiler on my microbenchmarks.
2016-12-01 03:57:02 +01:00
They had 'callq' (invoke) instead of 'mov' (get from memory) instructions.
Co-Authored-By: Aikar <aikar@aikar.co>
for:
Also cache the hashCode and long values to use it for speeding up hashmap usage
2016-12-01 03:57:02 +01:00
diff --git a/src/main/java/net/minecraft/server/BaseBlockPosition.java b/src/main/java/net/minecraft/server/BaseBlockPosition.java
index 71089442c189336fc0061852a661581784a64013..334a6ab0df1978c42fdf8ad454e96f60e70c76dc 100644
2016-12-01 03:57:02 +01:00
--- a/src/main/java/net/minecraft/server/BaseBlockPosition.java
+++ b/src/main/java/net/minecraft/server/BaseBlockPosition.java
@@ -7,32 +7,32 @@ import javax.annotation.concurrent.Immutable;
2016-12-01 03:57:02 +01:00
public class BaseBlockPosition implements Comparable<BaseBlockPosition> {
Updated Upstream (Bukkit/CraftBukkit/Spigot) Upstream has released updates that appears to apply and compile correctly. This update has not been tested by PaperMC and as with ANY update, please do your own testing Warning: this commit contains more mapping changes from upstream, As always, ensure that you have working backups and test this build before deployment; Developers working on paper will, yet again, need to delete their work/Minecraft/1.13.2 folder Bukkit Changes: 7fca5fd4 SPIGOT-4558: Preserve user order in the face of copied defaults in configurations 15c9b1eb Ignore spurious slot IDs sent by client, e.g. in enchanting tables 5d2a10c5 SPIGOT-3747: Add API for force loaded chunks d6dd2bb3 SPIGOT-3538: Add getHitBlockFace for ProjectileHitEvent 771db4aa SPIGOT-794: Call EntityPlaceEvent for Minecart placement 55462509 Add InventoryView#getSlotType 2f3ce5b6 Remove EntityTransformEvent and CustomItemTagContainer from draft API f04ad7b6 Make ProjectileLaunchEvent extend EntitySpawnEvent ccb85808 Define EntitySpawnEvent b8cc3ebe Add PlayerItemDamageEvent 184a495d Ease ClassLoader Deadlocks Where Possible 11ac4728 Expand Boolean Prompt Values in Conversation API aae62d51 Added getAllSessionData() to the Conversation API. 9290ff91 Add InventoryView#getInventory API 995e530f Add API to get / set base arrow damage CraftBukkit Changes: c4a67eed SPIGOT-4556: Fix plugins closing inventory during drop events 5be2ddcb Replace version constants with methods to prevent compiler inlining a5b9c7b3 Use API method to create offset command completions 2bc7d1df SPIGOT-3747: Add API for force loaded chunks a408f375 SPIGOT-3538: Add getHitBlockFace for ProjectileHitEvent b54b9409 SPIGOT-2864: Make Arrow / Item setTicksLived behave like FallingBlock 79ded7a8 SPIGOT-1811: Death message not shown on respawn screen b4a4f15d SPIGOT-943: InventoryCloseEvent called on death regardless of open inventory 0afed592 SPIGOT-794: Call EntityPlaceEvent for Minecart placement 2b2d084a Add InventoryView#getSlotType 01a9959a Do not use deprecated ItemSpawnEvent constructor 9642498d SPIGOT-4547: Call EntitySpawnEvent as general spawn fallback event 963f4a5f Add PlayerItemDamageEvent 63db0445 Add API to get / set base arrow damage 531c25d7 Add CraftMagicNumbers.MAPPINGS_VERSION for use by NMS plugins d05c8b14 Mappings Update bd36e200 SPIGOT-4551: Ignore invalid attribute modifier slots Spigot Changes: 518206a1 Remove redundant trove depend 1959ad21 MC-11211,SPIGOT-4552: Fix placing double slabs at y = 255 29ab5e43 SPIGOT-3661: Allow arguments in restart-script 7cc46316 SPIGOT-852: Growth modifiers for beetroots, potatoes, carrots 82e117e1 Squelch "fatal: Resolve operation not in progress" message 0a1a68e7 Mappings Update & Patch Rebuild
2019-01-01 04:15:55 +01:00
2016-12-01 03:57:02 +01:00
public static final BaseBlockPosition ZERO = new BaseBlockPosition(0, 0, 0);
2019-12-12 00:43:22 +01:00
- @Deprecated
2016-12-01 03:57:02 +01:00
- private final int a;
2019-12-12 00:43:22 +01:00
- @Deprecated
2016-12-01 03:57:02 +01:00
- private final int b;
2019-12-12 00:43:22 +01:00
- @Deprecated
2016-12-01 03:57:02 +01:00
- private final int c;
// Paper start
- public boolean isValidLocation() {
- return a >= -30000000 && c >= -30000000 && a < 30000000 && c < 30000000 && b >= 0 && b < 256;
+ protected int x; // If these ever become non final, review this entire patch, look for places need to rehash on write
+ protected int y;
+ protected int z;
+ private int hashCodeCached = 0;
+ private long cachedLong = Long.MAX_VALUE;
+
+ public final boolean isValidLocation() {
+ return x >= -30000000 && z >= -30000000 && x < 30000000 && z < 30000000 && y >= 0 && y < 256;
2016-12-01 03:57:02 +01:00
}
- public boolean isInvalidYLocation() {
- return b < 0 || b >= 256;
+ public final boolean isInvalidYLocation() {
+ 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) {
this(MathHelper.floor(d0), MathHelper.floor(d1), MathHelper.floor(d2));
}
- public boolean equals(Object object) {
+ public final boolean equals(Object object) { // Paper
if (this == object) {
return true;
} else if (!(object instanceof BaseBlockPosition)) {
@@ -40,29 +40,49 @@ public class BaseBlockPosition implements Comparable<BaseBlockPosition> {
} else {
BaseBlockPosition baseblockposition = (BaseBlockPosition) object;
- return this.getX() != baseblockposition.getX() ? false : (this.getY() != baseblockposition.getY() ? false : this.getZ() == baseblockposition.getZ());
+ return this.asLong() == baseblockposition.asLong(); // Paper
}
}
- public int hashCode() {
- return (this.getY() + this.getZ() * 31) * 31 + this.getX();
+ public final int hashCode() {
+ // Paper start
+ if (this.cachedLong == Long.MAX_VALUE) {
+ rebuildCache();
+ }
+ return this.hashCodeCached;
+ }
+ private void rebuildCache() {
+ this.cachedLong = BlockPosition.asLong(getX(), getY(), getZ());
+ this.hashCodeCached = (this.getY() + this.getZ() * 1031) * 1031 + this.getX();
+ }
+ public final long asLong() {
+ if (this.cachedLong == Long.MAX_VALUE) {
+ rebuildCache();
+ }
+ return this.cachedLong;
+ }
+ public final void rehash() {
+ this.cachedLong = Long.MAX_VALUE;
+ // Paper end
}
public int compareTo(BaseBlockPosition baseblockposition) {
Updated Upstream (Bukkit/CraftBukkit/Spigot) Upstream has released updates that appears to apply and compile correctly. This update has not been tested by PaperMC and as with ANY update, please do your own testing Warning: this commit contains more mapping changes from upstream, As always, ensure that you have working backups and test this build before deployment; Developers working on paper will, yet again, need to delete their work/Minecraft/1.13.2 folder Bukkit Changes: 7fca5fd4 SPIGOT-4558: Preserve user order in the face of copied defaults in configurations 15c9b1eb Ignore spurious slot IDs sent by client, e.g. in enchanting tables 5d2a10c5 SPIGOT-3747: Add API for force loaded chunks d6dd2bb3 SPIGOT-3538: Add getHitBlockFace for ProjectileHitEvent 771db4aa SPIGOT-794: Call EntityPlaceEvent for Minecart placement 55462509 Add InventoryView#getSlotType 2f3ce5b6 Remove EntityTransformEvent and CustomItemTagContainer from draft API f04ad7b6 Make ProjectileLaunchEvent extend EntitySpawnEvent ccb85808 Define EntitySpawnEvent b8cc3ebe Add PlayerItemDamageEvent 184a495d Ease ClassLoader Deadlocks Where Possible 11ac4728 Expand Boolean Prompt Values in Conversation API aae62d51 Added getAllSessionData() to the Conversation API. 9290ff91 Add InventoryView#getInventory API 995e530f Add API to get / set base arrow damage CraftBukkit Changes: c4a67eed SPIGOT-4556: Fix plugins closing inventory during drop events 5be2ddcb Replace version constants with methods to prevent compiler inlining a5b9c7b3 Use API method to create offset command completions 2bc7d1df SPIGOT-3747: Add API for force loaded chunks a408f375 SPIGOT-3538: Add getHitBlockFace for ProjectileHitEvent b54b9409 SPIGOT-2864: Make Arrow / Item setTicksLived behave like FallingBlock 79ded7a8 SPIGOT-1811: Death message not shown on respawn screen b4a4f15d SPIGOT-943: InventoryCloseEvent called on death regardless of open inventory 0afed592 SPIGOT-794: Call EntityPlaceEvent for Minecart placement 2b2d084a Add InventoryView#getSlotType 01a9959a Do not use deprecated ItemSpawnEvent constructor 9642498d SPIGOT-4547: Call EntitySpawnEvent as general spawn fallback event 963f4a5f Add PlayerItemDamageEvent 63db0445 Add API to get / set base arrow damage 531c25d7 Add CraftMagicNumbers.MAPPINGS_VERSION for use by NMS plugins d05c8b14 Mappings Update bd36e200 SPIGOT-4551: Ignore invalid attribute modifier slots Spigot Changes: 518206a1 Remove redundant trove depend 1959ad21 MC-11211,SPIGOT-4552: Fix placing double slabs at y = 255 29ab5e43 SPIGOT-3661: Allow arguments in restart-script 7cc46316 SPIGOT-852: Growth modifiers for beetroots, potatoes, carrots 82e117e1 Squelch "fatal: Resolve operation not in progress" message 0a1a68e7 Mappings Update & Patch Rebuild
2019-01-01 04:15:55 +01:00
return this.getY() == baseblockposition.getY() ? (this.getZ() == baseblockposition.getZ() ? this.getX() - baseblockposition.getX() : this.getZ() - baseblockposition.getZ()) : this.getY() - baseblockposition.getY();
2016-12-01 03:57:02 +01:00
}
- public int getX() {
- return this.a;
+ // Paper start
2016-12-01 03:57:02 +01:00
+ public final int getX() {
+ return this.x;
2016-12-01 03:57:02 +01:00
}
- public int getY() {
- return this.b;
+ public final int getY() {
+ return this.y;
2016-12-01 03:57:02 +01:00
}
- public int getZ() {
- return this.c;
+ public final int getZ() {
+ return this.z;
2016-12-01 03:57:02 +01:00
}
+ // Paper end
2019-12-12 00:43:22 +01:00
public BaseBlockPosition down() {
return this.down(1);
@@ -75,13 +95,14 @@ public class BaseBlockPosition implements Comparable<BaseBlockPosition> {
2019-12-12 00:43:22 +01:00
public BaseBlockPosition shift(EnumDirection enumdirection, int i) {
return i == 0 ? this : new BaseBlockPosition(this.getX() + enumdirection.getAdjacentX() * i, this.getY() + enumdirection.getAdjacentY() * i, this.getZ() + enumdirection.getAdjacentZ() * i);
}
2016-12-01 03:57:02 +01:00
+ // Paper end
Updated Upstream (Bukkit/CraftBukkit/Spigot) Upstream has released updates that appears to apply and compile correctly. This update has not been tested by PaperMC and as with ANY update, please do your own testing Warning: this commit contains more mapping changes from upstream, As always, ensure that you have working backups and test this build before deployment; Developers working on paper will, yet again, need to delete their work/Minecraft/1.13.2 folder Bukkit Changes: 7fca5fd4 SPIGOT-4558: Preserve user order in the face of copied defaults in configurations 15c9b1eb Ignore spurious slot IDs sent by client, e.g. in enchanting tables 5d2a10c5 SPIGOT-3747: Add API for force loaded chunks d6dd2bb3 SPIGOT-3538: Add getHitBlockFace for ProjectileHitEvent 771db4aa SPIGOT-794: Call EntityPlaceEvent for Minecart placement 55462509 Add InventoryView#getSlotType 2f3ce5b6 Remove EntityTransformEvent and CustomItemTagContainer from draft API f04ad7b6 Make ProjectileLaunchEvent extend EntitySpawnEvent ccb85808 Define EntitySpawnEvent b8cc3ebe Add PlayerItemDamageEvent 184a495d Ease ClassLoader Deadlocks Where Possible 11ac4728 Expand Boolean Prompt Values in Conversation API aae62d51 Added getAllSessionData() to the Conversation API. 9290ff91 Add InventoryView#getInventory API 995e530f Add API to get / set base arrow damage CraftBukkit Changes: c4a67eed SPIGOT-4556: Fix plugins closing inventory during drop events 5be2ddcb Replace version constants with methods to prevent compiler inlining a5b9c7b3 Use API method to create offset command completions 2bc7d1df SPIGOT-3747: Add API for force loaded chunks a408f375 SPIGOT-3538: Add getHitBlockFace for ProjectileHitEvent b54b9409 SPIGOT-2864: Make Arrow / Item setTicksLived behave like FallingBlock 79ded7a8 SPIGOT-1811: Death message not shown on respawn screen b4a4f15d SPIGOT-943: InventoryCloseEvent called on death regardless of open inventory 0afed592 SPIGOT-794: Call EntityPlaceEvent for Minecart placement 2b2d084a Add InventoryView#getSlotType 01a9959a Do not use deprecated ItemSpawnEvent constructor 9642498d SPIGOT-4547: Call EntitySpawnEvent as general spawn fallback event 963f4a5f Add PlayerItemDamageEvent 63db0445 Add API to get / set base arrow damage 531c25d7 Add CraftMagicNumbers.MAPPINGS_VERSION for use by NMS plugins d05c8b14 Mappings Update bd36e200 SPIGOT-4551: Ignore invalid attribute modifier slots Spigot Changes: 518206a1 Remove redundant trove depend 1959ad21 MC-11211,SPIGOT-4552: Fix placing double slabs at y = 255 29ab5e43 SPIGOT-3661: Allow arguments in restart-script 7cc46316 SPIGOT-852: Growth modifiers for beetroots, potatoes, carrots 82e117e1 Squelch "fatal: Resolve operation not in progress" message 0a1a68e7 Mappings Update & Patch Rebuild
2019-01-01 04:15:55 +01:00
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());
2019-04-30 03:20:24 +02:00
}
public boolean a(BaseBlockPosition baseblockposition, double d0) {
2019-12-12 00:43:22 +01:00
- return this.distanceSquared((double) baseblockposition.getX(), (double) baseblockposition.getY(), (double) baseblockposition.getZ(), false) < d0 * d0;
2019-04-30 03:20:24 +02:00
+ return this.distanceSquared((double) baseblockposition.x, (double) baseblockposition.y, (double) baseblockposition.z, false) < d0 * d0; // Paper
}
public boolean a(IPosition iposition, double d0) {
@@ -106,9 +127,9 @@ public class BaseBlockPosition implements Comparable<BaseBlockPosition> {
2019-04-30 03:20:24 +02:00
}
public int n(BaseBlockPosition baseblockposition) {
2019-12-12 00:43:22 +01:00
- float f = (float) Math.abs(baseblockposition.getX() - this.getX());
- float f1 = (float) Math.abs(baseblockposition.getY() - this.getY());
- float f2 = (float) Math.abs(baseblockposition.getZ() - this.getZ());
2019-04-30 03:20:24 +02:00
+ float f = (float) Math.abs(baseblockposition.getX() - this.x); // Paper
+ float f1 = (float) Math.abs(baseblockposition.getY() - this.y); // Paper
+ float f2 = (float) Math.abs(baseblockposition.getZ() - this.z); // Paper
return (int) (f + f1 + f2);
}
2016-12-01 03:57:02 +01:00
diff --git a/src/main/java/net/minecraft/server/BlockPosition.java b/src/main/java/net/minecraft/server/BlockPosition.java
index f8ac39e1b019b0918996f745d99f6ed09db0fd11..0ce39e34c1d60ec0fc9d4a0e1b802d8c96177b4b 100644
2016-12-01 03:57:02 +01:00
--- a/src/main/java/net/minecraft/server/BlockPosition.java
+++ b/src/main/java/net/minecraft/server/BlockPosition.java
@@ -99,6 +99,7 @@ public class BlockPosition extends BaseBlockPosition implements MinecraftSeriali
return new BlockPosition(b(i), c(i), d(i));
}
+ public static long asLong(int x, int y, int z) { return a(x, y, z); } // Paper - OBFHELPER
public static long a(int i, int j, int k) {
long l = 0L;
@@ -112,7 +113,7 @@ public class BlockPosition extends BaseBlockPosition implements MinecraftSeriali
return i & -16L;
}
- public long asLong() {
+ public long asLong_unused() { // Paper - moved to parent
return a(this.getX(), this.getY(), this.getZ());
}
@@ -343,11 +344,13 @@ public class BlockPosition extends BaseBlockPosition implements MinecraftSeriali
Updated Upstream (Bukkit/CraftBukkit/Spigot) Upstream has released updates that appears to apply and compile correctly. This update has not been tested by PaperMC and as with ANY update, please do your own testing Warning: this commit contains more mapping changes from upstream, As always, ensure that you have working backups and test this build before deployment; Developers working on paper will, yet again, need to delete their work/Minecraft/1.13.2 folder Bukkit Changes: 7fca5fd4 SPIGOT-4558: Preserve user order in the face of copied defaults in configurations 15c9b1eb Ignore spurious slot IDs sent by client, e.g. in enchanting tables 5d2a10c5 SPIGOT-3747: Add API for force loaded chunks d6dd2bb3 SPIGOT-3538: Add getHitBlockFace for ProjectileHitEvent 771db4aa SPIGOT-794: Call EntityPlaceEvent for Minecart placement 55462509 Add InventoryView#getSlotType 2f3ce5b6 Remove EntityTransformEvent and CustomItemTagContainer from draft API f04ad7b6 Make ProjectileLaunchEvent extend EntitySpawnEvent ccb85808 Define EntitySpawnEvent b8cc3ebe Add PlayerItemDamageEvent 184a495d Ease ClassLoader Deadlocks Where Possible 11ac4728 Expand Boolean Prompt Values in Conversation API aae62d51 Added getAllSessionData() to the Conversation API. 9290ff91 Add InventoryView#getInventory API 995e530f Add API to get / set base arrow damage CraftBukkit Changes: c4a67eed SPIGOT-4556: Fix plugins closing inventory during drop events 5be2ddcb Replace version constants with methods to prevent compiler inlining a5b9c7b3 Use API method to create offset command completions 2bc7d1df SPIGOT-3747: Add API for force loaded chunks a408f375 SPIGOT-3538: Add getHitBlockFace for ProjectileHitEvent b54b9409 SPIGOT-2864: Make Arrow / Item setTicksLived behave like FallingBlock 79ded7a8 SPIGOT-1811: Death message not shown on respawn screen b4a4f15d SPIGOT-943: InventoryCloseEvent called on death regardless of open inventory 0afed592 SPIGOT-794: Call EntityPlaceEvent for Minecart placement 2b2d084a Add InventoryView#getSlotType 01a9959a Do not use deprecated ItemSpawnEvent constructor 9642498d SPIGOT-4547: Call EntitySpawnEvent as general spawn fallback event 963f4a5f Add PlayerItemDamageEvent 63db0445 Add API to get / set base arrow damage 531c25d7 Add CraftMagicNumbers.MAPPINGS_VERSION for use by NMS plugins d05c8b14 Mappings Update bd36e200 SPIGOT-4551: Ignore invalid attribute modifier slots Spigot Changes: 518206a1 Remove redundant trove depend 1959ad21 MC-11211,SPIGOT-4552: Fix placing double slabs at y = 255 29ab5e43 SPIGOT-3661: Allow arguments in restart-script 7cc46316 SPIGOT-852: Growth modifiers for beetroots, potatoes, carrots 82e117e1 Squelch "fatal: Resolve operation not in progress" message 0a1a68e7 Mappings Update & Patch Rebuild
2019-01-01 04:15:55 +01:00
}
2016-12-01 03:57:02 +01:00
public static class MutableBlockPosition extends BlockPosition {
Updated Upstream (Bukkit/CraftBukkit/Spigot) Upstream has released updates that appears to apply and compile correctly. This update has not been tested by PaperMC and as with ANY update, please do your own testing Warning: this commit contains more mapping changes from upstream, As always, ensure that you have working backups and test this build before deployment; Developers working on paper will, yet again, need to delete their work/Minecraft/1.13.2 folder Bukkit Changes: 7fca5fd4 SPIGOT-4558: Preserve user order in the face of copied defaults in configurations 15c9b1eb Ignore spurious slot IDs sent by client, e.g. in enchanting tables 5d2a10c5 SPIGOT-3747: Add API for force loaded chunks d6dd2bb3 SPIGOT-3538: Add getHitBlockFace for ProjectileHitEvent 771db4aa SPIGOT-794: Call EntityPlaceEvent for Minecart placement 55462509 Add InventoryView#getSlotType 2f3ce5b6 Remove EntityTransformEvent and CustomItemTagContainer from draft API f04ad7b6 Make ProjectileLaunchEvent extend EntitySpawnEvent ccb85808 Define EntitySpawnEvent b8cc3ebe Add PlayerItemDamageEvent 184a495d Ease ClassLoader Deadlocks Where Possible 11ac4728 Expand Boolean Prompt Values in Conversation API aae62d51 Added getAllSessionData() to the Conversation API. 9290ff91 Add InventoryView#getInventory API 995e530f Add API to get / set base arrow damage CraftBukkit Changes: c4a67eed SPIGOT-4556: Fix plugins closing inventory during drop events 5be2ddcb Replace version constants with methods to prevent compiler inlining a5b9c7b3 Use API method to create offset command completions 2bc7d1df SPIGOT-3747: Add API for force loaded chunks a408f375 SPIGOT-3538: Add getHitBlockFace for ProjectileHitEvent b54b9409 SPIGOT-2864: Make Arrow / Item setTicksLived behave like FallingBlock 79ded7a8 SPIGOT-1811: Death message not shown on respawn screen b4a4f15d SPIGOT-943: InventoryCloseEvent called on death regardless of open inventory 0afed592 SPIGOT-794: Call EntityPlaceEvent for Minecart placement 2b2d084a Add InventoryView#getSlotType 01a9959a Do not use deprecated ItemSpawnEvent constructor 9642498d SPIGOT-4547: Call EntitySpawnEvent as general spawn fallback event 963f4a5f Add PlayerItemDamageEvent 63db0445 Add API to get / set base arrow damage 531c25d7 Add CraftMagicNumbers.MAPPINGS_VERSION for use by NMS plugins d05c8b14 Mappings Update bd36e200 SPIGOT-4551: Ignore invalid attribute modifier slots Spigot Changes: 518206a1 Remove redundant trove depend 1959ad21 MC-11211,SPIGOT-4552: Fix placing double slabs at y = 255 29ab5e43 SPIGOT-3661: Allow arguments in restart-script 7cc46316 SPIGOT-852: Growth modifiers for beetroots, potatoes, carrots 82e117e1 Squelch "fatal: Resolve operation not in progress" message 0a1a68e7 Mappings Update & Patch Rebuild
2019-01-01 04:15:55 +01:00
-
+ // Paper start - comment out
2016-12-01 03:57:02 +01:00
+ /*
protected int b;
protected int c;
protected int d;
2019-12-12 00:43:22 +01:00
-
2016-12-01 03:57:02 +01:00
+ */
2019-12-12 00:43:22 +01:00
+ // Paper end
2016-12-01 03:57:02 +01:00
public MutableBlockPosition() {
2019-12-12 00:43:22 +01:00
this(0, 0, 0);
}
@@ -357,10 +360,13 @@ public class BlockPosition extends BaseBlockPosition implements MinecraftSeriali
}
2016-12-01 03:57:02 +01:00
public MutableBlockPosition(int i, int j, int k) {
- super(0, 0, 0);
+ // Paper start
+ super(i, j, k);
+ /*
this.b = i;
this.c = j;
2016-12-01 03:57:02 +01:00
- this.d = k;
+ this.d = k;*/
2016-12-01 03:57:02 +01:00
+ // Paper end
}
2019-04-30 03:20:24 +02:00
public MutableBlockPosition(double d0, double d1, double d2) {
@@ -391,6 +397,9 @@ public class BlockPosition extends BaseBlockPosition implements MinecraftSeriali
2019-04-30 03:20:24 +02:00
return super.a(enumblockrotation).immutableCopy();
2016-12-01 03:57:02 +01:00
}
2019-04-30 03:20:24 +02:00
+
2016-12-01 03:57:02 +01:00
+ /*
+ // Paper start - use parent getters
2019-04-30 03:20:24 +02:00
@Override
2016-12-01 03:57:02 +01:00
public int getX() {
return this.b;
@@ -404,13 +413,17 @@ public class BlockPosition extends BaseBlockPosition implements MinecraftSeriali
2019-04-30 03:20:24 +02:00
@Override
2016-12-01 03:57:02 +01:00
public int getZ() {
return this.d;
- }
+ }*/
2016-12-01 03:57:02 +01:00
+ // Paper end
2019-04-30 03:20:24 +02:00
public BlockPosition.MutableBlockPosition setValues(int i, int j, int k) { return d(i, j, k);} // Paper - OBFHELPER
public BlockPosition.MutableBlockPosition d(int i, int j, int k) {
2016-12-01 03:57:02 +01:00
- this.b = i;
- this.c = j;
- this.d = k;
+ // Paper start - use xyz
+ this.x = i;
+ this.y = j;
+ this.z = k;
+ rehash();
2016-12-01 03:57:02 +01:00
+ // Paper end
return this;
}
@@ -440,26 +453,29 @@ public class BlockPosition extends BaseBlockPosition implements MinecraftSeriali
2016-12-01 03:57:02 +01:00
}
public BlockPosition.MutableBlockPosition c(EnumDirection enumdirection, int i) {
2019-04-30 03:20:24 +02:00
- return this.d(this.b + enumdirection.getAdjacentX() * i, this.c + enumdirection.getAdjacentY() * i, this.d + enumdirection.getAdjacentZ() * i);
+ return this.d(this.x + enumdirection.getAdjacentX() * i, this.y + enumdirection.getAdjacentY() * i, this.z + enumdirection.getAdjacentZ() * i);
}
2019-04-30 03:20:24 +02:00
public BlockPosition.MutableBlockPosition e(int i, int j, int k) {
- return this.d(this.b + i, this.c + j, this.d + k);
+ return this.d(this.x + i, this.y + j, this.z + k);
2016-12-01 03:57:02 +01:00
}
public final void setX(final int x) { this.o(x); } // Paper - OBFHELPER
public void o(int i) {
- this.b = i;
+ this.x = i; // Paper change to x
+ rehash(); // Paper
}
public final void setY(final int y) { this.p(y); } // Paper - OBFHELPER
2016-12-01 03:57:02 +01:00
public void p(int i) {
- this.c = i;
+ this.y = i; // Paper change to y
+ rehash(); // Paper
2016-12-01 03:57:02 +01:00
}
public final void setZ(final int z) { this.q(z); } // Paper - OBFHELPER
public void q(int i) {
- this.d = i;
+ this.z = i; // Paper change to z
+ rehash(); // Paper
}
2019-04-30 03:20:24 +02:00
@Override