First few files and initial rebuild
This commit is contained in:
@@ -1,6 +1,6 @@
|
||||
--- a/com/mojang/brigadier/exceptions/CommandSyntaxException.java
|
||||
+++ b/com/mojang/brigadier/exceptions/CommandSyntaxException.java
|
||||
@@ -5,7 +5,7 @@
|
||||
@@ -5,7 +_,7 @@
|
||||
|
||||
import com.mojang.brigadier.Message;
|
||||
|
||||
@@ -9,7 +9,7 @@
|
||||
public static final int CONTEXT_AMOUNT = 10;
|
||||
public static boolean ENABLE_COMMAND_STACK_TRACES = true;
|
||||
public static BuiltInExceptionProvider BUILT_IN_EXCEPTIONS = new BuiltInExceptions();
|
||||
@@ -73,4 +73,11 @@
|
||||
@@ -73,4 +_,11 @@
|
||||
public int getCursor() {
|
||||
return cursor;
|
||||
}
|
||||
|
||||
@@ -0,0 +1,21 @@
|
||||
--- a/com/mojang/datafixers/DataFixerBuilder.java
|
||||
+++ b/com/mojang/datafixers/DataFixerBuilder.java
|
||||
@@ -29,8 +_,10 @@
|
||||
private final Int2ObjectSortedMap<Schema> schemas = new Int2ObjectAVLTreeMap<>();
|
||||
private final List<DataFix> globalList = new ArrayList<>();
|
||||
private final IntSortedSet fixerVersions = new IntAVLTreeSet();
|
||||
+ private final int minDataFixPrecacheVersion; // Paper - Perf: Cache DataFixerUpper Rewrite Rules on demand
|
||||
|
||||
public DataFixerBuilder(final int dataVersion) {
|
||||
+ minDataFixPrecacheVersion = Integer.getInteger("Paper.minPrecachedDatafixVersion", dataVersion+1) * 10; // Paper - Perf: default to precache nothing - mojang stores versions * 10 to allow for 'sub versions'
|
||||
this.dataVersion = dataVersion;
|
||||
}
|
||||
|
||||
@@ -88,6 +_,7 @@
|
||||
final IntIterator iterator = fixerUpper.fixerVersions().iterator();
|
||||
while (iterator.hasNext()) {
|
||||
final int versionKey = iterator.nextInt();
|
||||
+ if (versionKey < minDataFixPrecacheVersion) continue; // Paper - Perf: Cache DataFixerUpper Rewrite Rules on demand
|
||||
final Schema schema = schemas.get(versionKey);
|
||||
for (final String typeName : schema.types()) {
|
||||
if (!requiredTypeNames.contains(typeName)) {
|
||||
@@ -0,0 +1,38 @@
|
||||
--- a/com/mojang/datafixers/util/Either.java
|
||||
+++ b/com/mojang/datafixers/util/Either.java
|
||||
@@ -22,7 +_,7 @@
|
||||
}
|
||||
|
||||
private static final class Left<L, R> extends Either<L, R> {
|
||||
- private final L value;
|
||||
+ private final L value; private Optional<L> valueOptional; // Paper - Perf: Reduce Either Optional allocation
|
||||
|
||||
public Left(final L value) {
|
||||
this.value = value;
|
||||
@@ -51,7 +_,7 @@
|
||||
|
||||
@Override
|
||||
public Optional<L> left() {
|
||||
- return Optional.of(value);
|
||||
+ return this.valueOptional == null ? this.valueOptional = Optional.of(this.value) : this.valueOptional; // Paper - Perf: Reduce Either Optional allocation
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -83,7 +_,7 @@
|
||||
}
|
||||
|
||||
private static final class Right<L, R> extends Either<L, R> {
|
||||
- private final R value;
|
||||
+ private final R value; private Optional<R> valueOptional; // Paper - Perf: Reduce Either Optional allocation
|
||||
|
||||
public Right(final R value) {
|
||||
this.value = value;
|
||||
@@ -117,7 +_,7 @@
|
||||
|
||||
@Override
|
||||
public Optional<R> right() {
|
||||
- return Optional.of(value);
|
||||
+ return this.valueOptional == null ? this.valueOptional = Optional.of(this.value) : this.valueOptional; // Paper - Perf: Reduce Either Optional allocation
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -0,0 +1,12 @@
|
||||
--- a/com/mojang/logging/LogUtils.java
|
||||
+++ b/com/mojang/logging/LogUtils.java
|
||||
@@ -61,4 +_,9 @@
|
||||
public static Logger getLogger() {
|
||||
return LoggerFactory.getLogger(STACK_WALKER.getCallerClass());
|
||||
}
|
||||
+ // Paper start
|
||||
+ public static Logger getClassLogger() {
|
||||
+ return LoggerFactory.getLogger(STACK_WALKER.getCallerClass().getSimpleName());
|
||||
+ }
|
||||
+ // Paper end
|
||||
}
|
||||
@@ -0,0 +1,30 @@
|
||||
--- a/com/mojang/math/OctahedralGroup.java
|
||||
+++ b/com/mojang/math/OctahedralGroup.java
|
||||
@@ -111,6 +_,7 @@
|
||||
this.permutation = permutation;
|
||||
this.transformation = new Matrix3f().scaling(invertX ? -1.0F : 1.0F, invertY ? -1.0F : 1.0F, invertZ ? -1.0F : 1.0F);
|
||||
this.transformation.mul(permutation.transformation());
|
||||
+ this.initializeRotationDirections(); // Paper - Avoid Lazy Initialization for Enum Fields
|
||||
}
|
||||
|
||||
private BooleanList packInversions() {
|
||||
@@ -139,7 +_,7 @@
|
||||
return this.name;
|
||||
}
|
||||
|
||||
- public Direction rotate(Direction direction) {
|
||||
+ public void initializeRotationDirections() { // Paper - Avoid Lazy Initialization for Enum Fields
|
||||
if (this.rotatedDirections == null) {
|
||||
this.rotatedDirections = Maps.newEnumMap(Direction.class);
|
||||
Direction.Axis[] axiss = Direction.Axis.values();
|
||||
@@ -154,6 +_,10 @@
|
||||
}
|
||||
}
|
||||
|
||||
+ // Paper start - Avoid Lazy Initialization for Enum Fields
|
||||
+ }
|
||||
+ public Direction rotate(Direction direction) {
|
||||
+ // Paper end - Avoid Lazy Initialization for Enum Fields
|
||||
return this.rotatedDirections.get(direction);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user