geforkt von Mirrors/Paper
net/minecraft/core
Dieser Commit ist enthalten in:
Ursprung
0aa15ea868
Commit
12e0268dab
@ -1,6 +1,6 @@
|
||||
--- a/net/minecraft/core/BlockPos.java
|
||||
+++ b/net/minecraft/core/BlockPos.java
|
||||
@@ -158,67 +158,84 @@
|
||||
@@ -158,67 +_,84 @@
|
||||
|
||||
@Override
|
||||
public BlockPos above() {
|
||||
@ -21,9 +21,9 @@
|
||||
}
|
||||
|
||||
@Override
|
||||
public BlockPos below(int i) {
|
||||
- return this.relative(Direction.DOWN, i);
|
||||
+ return i == 0 ? this.immutable() : new BlockPos(this.getX(), this.getY() - i, this.getZ()); // Paper - Perf: Optimize BlockPosition
|
||||
public BlockPos below(int distance) {
|
||||
- return this.relative(Direction.DOWN, distance);
|
||||
+ return distance == 0 ? this.immutable() : new BlockPos(this.getX(), this.getY() - distance, this.getZ()); // Paper - Perf: Optimize BlockPosition
|
||||
}
|
||||
|
||||
@Override
|
||||
@ -76,6 +76,7 @@
|
||||
|
||||
@Override
|
||||
public BlockPos relative(Direction direction) {
|
||||
- return new BlockPos(this.getX() + direction.getStepX(), this.getY() + direction.getStepY(), this.getZ() + direction.getStepZ());
|
||||
+ // Paper start - Perf: Optimize BlockPosition
|
||||
+ switch(direction) {
|
||||
+ case UP:
|
||||
@ -91,64 +92,13 @@
|
||||
+ case EAST:
|
||||
+ return new BlockPos(this.getX() + 1, this.getY(), this.getZ());
|
||||
+ default:
|
||||
return new BlockPos(this.getX() + direction.getStepX(), this.getY() + direction.getStepY(), this.getZ() + direction.getStepZ());
|
||||
+ return new BlockPos(this.getX() + direction.getStepX(), this.getY() + direction.getStepY(), this.getZ() + direction.getStepZ());
|
||||
+ }
|
||||
+ // Paper end - Perf: Optimize BlockPosition
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -324,9 +341,11 @@
|
||||
|
||||
public static Iterable<BlockPos> withinManhattan(BlockPos center, int rangeX, int rangeY, int rangeZ) {
|
||||
int i = rangeX + rangeY + rangeZ;
|
||||
- int j = center.getX();
|
||||
- int k = center.getY();
|
||||
- int l = center.getZ();
|
||||
+ // Paper start - rename variables to fix conflict with anonymous class (remap fix)
|
||||
+ int centerX = center.getX();
|
||||
+ int centerY = center.getY();
|
||||
+ int centerZ = center.getZ();
|
||||
+ // Paper end
|
||||
return () -> new AbstractIterator<BlockPos>() {
|
||||
private final BlockPos.MutableBlockPos cursor = new BlockPos.MutableBlockPos();
|
||||
private int currentDepth;
|
||||
@@ -340,7 +359,7 @@
|
||||
protected BlockPos computeNext() {
|
||||
if (this.zMirror) {
|
||||
this.zMirror = false;
|
||||
- this.cursor.setZ(l - (this.cursor.getZ() - l));
|
||||
+ this.cursor.setZ(centerZ - (this.cursor.getZ() - centerZ)); // Paper - remap fix
|
||||
return this.cursor;
|
||||
} else {
|
||||
BlockPos blockPos;
|
||||
@@ -366,7 +385,7 @@
|
||||
int k = this.currentDepth - Math.abs(i) - Math.abs(j);
|
||||
if (k <= rangeZ) {
|
||||
this.zMirror = k != 0;
|
||||
- blockPos = this.cursor.set(j + i, k + j, l + k);
|
||||
+ blockPos = this.cursor.set(centerX + i, centerY + j, centerZ + k); // Paper - remap fix
|
||||
}
|
||||
}
|
||||
|
||||
@@ -444,12 +463,12 @@
|
||||
if (this.index == l) {
|
||||
return this.endOfData();
|
||||
} else {
|
||||
- int i = this.index % i;
|
||||
- int j = this.index / i;
|
||||
- int k = j % j;
|
||||
- int l = j / j;
|
||||
+ int offsetX = this.index % i; // Paper - decomp fix
|
||||
+ int u = this.index / i; // Paper - decomp fix
|
||||
+ int offsetY = u % j; // Paper - decomp fix
|
||||
+ int offsetZ = u / j; // Paper - decomp fix
|
||||
this.index++;
|
||||
- return this.cursor.set(startX + i, startY + k, startZ + l);
|
||||
+ return this.cursor.set(startX + offsetX, startY + offsetY, startZ + offsetZ); // Paper - decomp fix
|
||||
}
|
||||
}
|
||||
};
|
||||
@@ -569,9 +588,9 @@
|
||||
@@ -573,9 +_,9 @@
|
||||
}
|
||||
|
||||
public BlockPos.MutableBlockPos set(int x, int y, int z) {
|
||||
@ -161,26 +111,26 @@
|
||||
return this;
|
||||
}
|
||||
|
||||
@@ -636,19 +655,19 @@
|
||||
@@ -638,19 +_,19 @@
|
||||
|
||||
@Override
|
||||
public BlockPos.MutableBlockPos setX(int i) {
|
||||
- super.setX(i);
|
||||
+ this.x = i; // Paper - Perf: Manually inline methods in BlockPosition
|
||||
public BlockPos.MutableBlockPos setX(int x) {
|
||||
- super.setX(x);
|
||||
+ this.x = x; // Paper - Perf: Manually inline methods in BlockPosition
|
||||
return this;
|
||||
}
|
||||
|
||||
@Override
|
||||
public BlockPos.MutableBlockPos setY(int i) {
|
||||
- super.setY(i);
|
||||
+ this.y = i; // Paper - Perf: Manually inline methods in BlockPosition
|
||||
public BlockPos.MutableBlockPos setY(int y) {
|
||||
- super.setY(y);
|
||||
+ this.y = y; // Paper - Perf: Manually inline methods in BlockPosition
|
||||
return this;
|
||||
}
|
||||
|
||||
@Override
|
||||
public BlockPos.MutableBlockPos setZ(int i) {
|
||||
- super.setZ(i);
|
||||
+ this.z = i; // Paper - Perf: Manually inline methods in BlockPosition
|
||||
public BlockPos.MutableBlockPos setZ(int z) {
|
||||
- super.setZ(z);
|
||||
+ this.z = z; // Paper - Perf: Manually inline methods in BlockPosition
|
||||
return this;
|
||||
}
|
||||
|
@ -1,6 +1,6 @@
|
||||
--- a/net/minecraft/core/Direction.java
|
||||
+++ b/net/minecraft/core/Direction.java
|
||||
@@ -57,6 +57,12 @@
|
||||
@@ -57,6 +_,12 @@
|
||||
.sorted(Comparator.comparingInt(direction -> direction.data2d))
|
||||
.toArray(Direction[]::new);
|
||||
|
||||
@ -11,21 +11,21 @@
|
||||
+ // Paper end - Perf: Inline shift direction fields
|
||||
+
|
||||
private Direction(
|
||||
final int id,
|
||||
final int idOpposite,
|
||||
@@ -74,6 +80,11 @@
|
||||
this.axisDirection = direction;
|
||||
this.normal = vector;
|
||||
this.normalVec3 = Vec3.atLowerCornerOf(vector);
|
||||
final int data3d,
|
||||
final int oppositeIndex,
|
||||
@@ -74,6 +_,11 @@
|
||||
this.axisDirection = axisDirection;
|
||||
this.normal = normal;
|
||||
this.normalVec3 = Vec3.atLowerCornerOf(normal);
|
||||
+ // Paper start - Perf: Inline shift direction fields
|
||||
+ this.adjX = vector.getX();
|
||||
+ this.adjY = vector.getY();
|
||||
+ this.adjZ = vector.getZ();
|
||||
+ this.adjX = normal.getX();
|
||||
+ this.adjY = normal.getY();
|
||||
+ this.adjZ = normal.getZ();
|
||||
+ // Paper end - Perf: Inline shift direction fields
|
||||
}
|
||||
|
||||
public static Direction[] orderedByNearest(Entity entity) {
|
||||
@@ -247,15 +258,15 @@
|
||||
@@ -247,15 +_,15 @@
|
||||
}
|
||||
|
||||
public int getStepX() {
|
@ -1,6 +1,6 @@
|
||||
--- a/net/minecraft/core/Holder.java
|
||||
+++ b/net/minecraft/core/Holder.java
|
||||
@@ -230,7 +230,7 @@
|
||||
@@ -230,7 +_,7 @@
|
||||
}
|
||||
|
||||
void bindTags(Collection<TagKey<T>> tags) {
|
@ -1,6 +1,6 @@
|
||||
--- a/net/minecraft/core/MappedRegistry.java
|
||||
+++ b/net/minecraft/core/MappedRegistry.java
|
||||
@@ -33,11 +33,11 @@
|
||||
@@ -33,11 +_,11 @@
|
||||
public class MappedRegistry<T> implements WritableRegistry<T> {
|
||||
private final ResourceKey<? extends Registry<T>> key;
|
||||
private final ObjectList<Holder.Reference<T>> byId = new ObjectArrayList<>(256);
|
||||
@ -17,17 +17,17 @@
|
||||
private Lifecycle registryLifecycle;
|
||||
private final Map<TagKey<T>, HolderSet.Named<T>> frozenTags = new IdentityHashMap<>();
|
||||
MappedRegistry.TagSet<T> allTags = MappedRegistry.TagSet.unbound();
|
||||
@@ -508,5 +508,13 @@
|
||||
void forEach(BiConsumer<? super TagKey<T>, ? super HolderSet.Named<T>> consumer);
|
||||
@@ -509,4 +_,13 @@
|
||||
|
||||
Stream<HolderSet.Named<T>> getTags();
|
||||
+ }
|
||||
}
|
||||
+
|
||||
+ // Paper start
|
||||
+ // used to clear intrusive holders from GameEvent, Item, Block, EntityType, and Fluid from unused instances of those types
|
||||
+ public void clearIntrusiveHolder(final T instance) {
|
||||
+ if (this.unregisteredIntrusiveHolders != null) {
|
||||
+ this.unregisteredIntrusiveHolders.remove(instance);
|
||||
+ }
|
||||
}
|
||||
+ }
|
||||
+ // Paper end
|
||||
}
|
@ -1,7 +1,7 @@
|
||||
--- a/net/minecraft/core/Rotations.java
|
||||
+++ b/net/minecraft/core/Rotations.java
|
||||
@@ -34,6 +34,18 @@
|
||||
this(serialized.getFloat(0), serialized.getFloat(1), serialized.getFloat(2));
|
||||
@@ -34,6 +_,18 @@
|
||||
this(tag.getFloat(0), tag.getFloat(1), tag.getFloat(2));
|
||||
}
|
||||
|
||||
+ // Paper start - faster alternative constructor
|
@ -1,7 +1,7 @@
|
||||
--- a/net/minecraft/core/Vec3i.java
|
||||
+++ b/net/minecraft/core/Vec3i.java
|
||||
@@ -16,9 +16,9 @@
|
||||
vec -> IntStream.of(vec.getX(), vec.getY(), vec.getZ())
|
||||
@@ -16,9 +_,9 @@
|
||||
vec3i -> IntStream.of(vec3i.getX(), vec3i.getY(), vec3i.getZ())
|
||||
);
|
||||
public static final Vec3i ZERO = new Vec3i(0, 0, 0);
|
||||
- private int x;
|
||||
@ -11,15 +11,15 @@
|
||||
+ protected int y; // Paper - Perf: Manually inline methods in BlockPosition; protected
|
||||
+ protected int z; // Paper - Perf: Manually inline methods in BlockPosition; protected
|
||||
|
||||
public static Codec<Vec3i> offsetCodec(int maxAbsValue) {
|
||||
public static Codec<Vec3i> offsetCodec(int maxOffset) {
|
||||
return CODEC.validate(
|
||||
@@ -35,12 +35,12 @@
|
||||
@@ -35,12 +_,12 @@
|
||||
}
|
||||
|
||||
@Override
|
||||
- public boolean equals(Object object) {
|
||||
+ public final boolean equals(Object object) { // Paper - Perf: Final for inline
|
||||
return this == object || object instanceof Vec3i vec3i && this.getX() == vec3i.getX() && this.getY() == vec3i.getY() && this.getZ() == vec3i.getZ();
|
||||
- public boolean equals(Object other) {
|
||||
+ public final boolean equals(Object other) { // Paper - Perf: Final for inline
|
||||
return this == other || other instanceof Vec3i vec3i && this.getX() == vec3i.getX() && this.getY() == vec3i.getY() && this.getZ() == vec3i.getZ();
|
||||
}
|
||||
|
||||
@Override
|
||||
@ -28,7 +28,7 @@
|
||||
return (this.getY() + this.getZ() * 31) * 31 + this.getX();
|
||||
}
|
||||
|
||||
@@ -53,15 +53,15 @@
|
||||
@@ -53,15 +_,15 @@
|
||||
}
|
||||
}
|
||||
|
Laden…
In neuem Issue referenzieren
Einen Benutzer sperren