Switch to using ForgeFlower for Paper Only mc-dev imports

ForgeFlower is better than Spigots FernFlower at decompiling the source.

However, in order to maintain the CraftBukkit patches, we must keep
using spigots for the primary.

However, for any file that we import on top of Spigots imported files
there is nothing stopping us from using better decompiled files.

So these changes will use ForgeFlower to maintain a better set of
decomped files, so anything we add on top of Paper can start off
in a better spot.
This commit is contained in:
Aikar
2018-08-31 18:56:57 -04:00
parent 854add2246
commit d089acb3bd
74 changed files with 1211 additions and 1269 deletions

View File

@@ -1,4 +1,4 @@
From 76e318afd422c05c58c4ba5e761ce6d7c8cb38c8 Mon Sep 17 00:00:00 2001
From fa8038c2779fe4080fd5ad15be4128adee1ddcc1 Mon Sep 17 00:00:00 2001
From: Spottedleaf <Spottedleaf@users.noreply.github.com>
Date: Wed, 15 Aug 2018 12:05:12 -0700
Subject: [PATCH] Optimize BlockPosition helper methods
@@ -6,10 +6,10 @@ Subject: [PATCH] Optimize BlockPosition helper methods
Resolves #1338
diff --git a/src/main/java/net/minecraft/server/BlockPosition.java b/src/main/java/net/minecraft/server/BlockPosition.java
index 936a49a3e8..7215056bd1 100644
index 986b1e13a5..45f7794613 100644
--- a/src/main/java/net/minecraft/server/BlockPosition.java
+++ b/src/main/java/net/minecraft/server/BlockPosition.java
@@ -59,59 +59,96 @@ public class BlockPosition extends BaseBlockPosition {
@@ -58,59 +58,96 @@ public class BlockPosition extends BaseBlockPosition {
}
public BlockPosition up() {
@@ -17,9 +17,9 @@ index 936a49a3e8..7215056bd1 100644
+ return new BlockPosition(this.getX(), this.getY() + 1, this.getZ()); // Paper - Optimize BlockPosition
}
public BlockPosition up(int i) {
- return this.shift(EnumDirection.UP, i);
+ return i == 0 ? this : new BlockPosition(this.getX(), this.getY() + i, this.getZ()); // Paper - Optimize BlockPosition
public BlockPosition up(int ix) {
- return this.shift(EnumDirection.UP, ix);
+ return ix == 0 ? this : new BlockPosition(this.getX(), this.getY() + ix, this.getZ()); // Paper - Optimize BlockPosition
}
public BlockPosition down() {
@@ -27,9 +27,9 @@ index 936a49a3e8..7215056bd1 100644
+ return new BlockPosition(this.getX(), this.getY() - 1, this.getZ()); // Paper - Optimize BlockPosition
}
public BlockPosition down(int i) {
- return this.shift(EnumDirection.DOWN, i);
+ return i == 0 ? this : new BlockPosition(this.getX(), this.getY() - i, this.getZ()); // Paper - Optimize BlockPosition
public BlockPosition down(int ix) {
- return this.shift(EnumDirection.DOWN, ix);
+ return ix == 0 ? this : new BlockPosition(this.getX(), this.getY() - ix, this.getZ()); // Paper - Optimize BlockPosition
}
public BlockPosition north() {
@@ -37,9 +37,9 @@ index 936a49a3e8..7215056bd1 100644
+ return new BlockPosition(this.getX(), this.getY(), this.getZ() - 1); // Paper - Optimize BlockPosition
}
public BlockPosition north(int i) {
- return this.shift(EnumDirection.NORTH, i);
+ return i == 0 ? this : new BlockPosition(this.getX(), this.getY(), this.getZ() - i); // Paper - Optimize BlockPosition
public BlockPosition north(int ix) {
- return this.shift(EnumDirection.NORTH, ix);
+ return ix == 0 ? this : new BlockPosition(this.getX(), this.getY(), this.getZ() - ix); // Paper - Optimize BlockPosition
}
public BlockPosition south() {
@@ -47,9 +47,9 @@ index 936a49a3e8..7215056bd1 100644
+ return new BlockPosition(this.getX(), this.getY(), this.getZ() + 1); // Paper - Optimize BlockPosition
}
public BlockPosition south(int i) {
- return this.shift(EnumDirection.SOUTH, i);
+ return i == 0 ? this : new BlockPosition(this.getX(), this.getY(), this.getZ() + i); // Paper - Optimize BlockPosition
public BlockPosition south(int ix) {
- return this.shift(EnumDirection.SOUTH, ix);
+ return ix == 0 ? this : new BlockPosition(this.getX(), this.getY(), this.getZ() + ix); // Paper - Optimize BlockPosition
}
public BlockPosition west() {
@@ -57,9 +57,9 @@ index 936a49a3e8..7215056bd1 100644
+ return new BlockPosition(this.getX() - 1, this.getY(), this.getZ()); // Paper - Optimize BlockPosition
}
public BlockPosition west(int i) {
- return this.shift(EnumDirection.WEST, i);
+ return i == 0 ? this : new BlockPosition(this.getX() - i, this.getY(), this.getZ()); // Paper - Optimize BlockPosition
public BlockPosition west(int ix) {
- return this.shift(EnumDirection.WEST, ix);
+ return ix == 0 ? this : new BlockPosition(this.getX() - ix, this.getY(), this.getZ()); // Paper - Optimize BlockPosition
}
public BlockPosition east() {
@@ -67,9 +67,9 @@ index 936a49a3e8..7215056bd1 100644
+ return new BlockPosition(this.getX() + 1, this.getY(), this.getZ()); // Paper - Optimize BlockPosition
}
public BlockPosition east(int i) {
- return this.shift(EnumDirection.EAST, i);
+ return i == 0 ? this : new BlockPosition(this.getX() + i, this.getY(), this.getZ()); // Paper - Optimize BlockPosition
public BlockPosition east(int ix) {
- return this.shift(EnumDirection.EAST, ix);
+ return ix == 0 ? this : new BlockPosition(this.getX() + ix, this.getY(), this.getZ()); // Paper - Optimize BlockPosition
}
public BlockPosition shift(EnumDirection enumdirection) {
@@ -94,27 +94,27 @@ index 936a49a3e8..7215056bd1 100644
+ // Paper End
}
public BlockPosition shift(EnumDirection enumdirection, int i) {
- return i == 0 ? this : new BlockPosition(this.getX() + enumdirection.getAdjacentX() * i, this.getY() + enumdirection.getAdjacentY() * i, this.getZ() + enumdirection.getAdjacentZ() * i);
public BlockPosition shift(EnumDirection enumdirection, int ix) {
- return ix == 0 ? this : new BlockPosition(this.getX() + enumdirection.getAdjacentX() * ix, this.getY() + enumdirection.getAdjacentY() * ix, this.getZ() + enumdirection.getAdjacentZ() * ix);
+ // Paper Start - Optimize BlockPosition
+ if (i == 0) {
+ if (ix == 0) {
+ return this;
+ }
+ switch(enumdirection) {
+ case UP:
+ return new BlockPosition(this.getX(), this.getY() + i, this.getZ());
+ return new BlockPosition(this.getX(), this.getY() + ix, this.getZ());
+ case DOWN:
+ return new BlockPosition(this.getX(), this.getY() - i, this.getZ());
+ return new BlockPosition(this.getX(), this.getY() - ix, this.getZ());
+ case NORTH:
+ return new BlockPosition(this.getX(), this.getY(), this.getZ() - i);
+ return new BlockPosition(this.getX(), this.getY(), this.getZ() - ix);
+ case SOUTH:
+ return new BlockPosition(this.getX(), this.getY(), this.getZ() + i);
+ return new BlockPosition(this.getX(), this.getY(), this.getZ() + ix);
+ case WEST:
+ return new BlockPosition(this.getX() - i, this.getY(), this.getZ());
+ return new BlockPosition(this.getX() - ix, this.getY(), this.getZ());
+ case EAST:
+ return new BlockPosition(this.getX() + i, this.getY(), this.getZ());
+ return new BlockPosition(this.getX() + ix, this.getY(), this.getZ());
+ default:
+ return new BlockPosition(this.getX() + enumdirection.getAdjacentX() * i, this.getY() + enumdirection.getAdjacentY() * i, this.getZ() + enumdirection.getAdjacentZ() * i);
+ return new BlockPosition(this.getX() + enumdirection.getAdjacentX() * ix, this.getY() + enumdirection.getAdjacentY() * ix, this.getZ() + enumdirection.getAdjacentZ() * ix);
+ }
+ // Paper End
}