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
|
--- a/net/minecraft/core/BlockPos.java
|
||||||
+++ b/net/minecraft/core/BlockPos.java
|
+++ b/net/minecraft/core/BlockPos.java
|
||||||
@@ -158,67 +158,84 @@
|
@@ -158,67 +_,84 @@
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public BlockPos above() {
|
public BlockPos above() {
|
||||||
@ -21,9 +21,9 @@
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public BlockPos below(int i) {
|
public BlockPos below(int distance) {
|
||||||
- return this.relative(Direction.DOWN, i);
|
- return this.relative(Direction.DOWN, distance);
|
||||||
+ return i == 0 ? this.immutable() : new BlockPos(this.getX(), this.getY() - i, this.getZ()); // Paper - Perf: Optimize BlockPosition
|
+ return distance == 0 ? this.immutable() : new BlockPos(this.getX(), this.getY() - distance, this.getZ()); // Paper - Perf: Optimize BlockPosition
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@ -76,6 +76,7 @@
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public BlockPos relative(Direction direction) {
|
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
|
+ // Paper start - Perf: Optimize BlockPosition
|
||||||
+ switch(direction) {
|
+ switch(direction) {
|
||||||
+ case UP:
|
+ case UP:
|
||||||
@ -91,64 +92,13 @@
|
|||||||
+ case EAST:
|
+ case EAST:
|
||||||
+ return new BlockPos(this.getX() + 1, this.getY(), this.getZ());
|
+ return new BlockPos(this.getX() + 1, this.getY(), this.getZ());
|
||||||
+ default:
|
+ 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
|
+ // Paper end - Perf: Optimize BlockPosition
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@@ -324,9 +341,11 @@
|
@@ -573,9 +_,9 @@
|
||||||
|
|
||||||
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 @@
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public BlockPos.MutableBlockPos set(int x, int y, int z) {
|
public BlockPos.MutableBlockPos set(int x, int y, int z) {
|
||||||
@ -161,26 +111,26 @@
|
|||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -636,19 +655,19 @@
|
@@ -638,19 +_,19 @@
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public BlockPos.MutableBlockPos setX(int i) {
|
public BlockPos.MutableBlockPos setX(int x) {
|
||||||
- super.setX(i);
|
- super.setX(x);
|
||||||
+ this.x = i; // Paper - Perf: Manually inline methods in BlockPosition
|
+ this.x = x; // Paper - Perf: Manually inline methods in BlockPosition
|
||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public BlockPos.MutableBlockPos setY(int i) {
|
public BlockPos.MutableBlockPos setY(int y) {
|
||||||
- super.setY(i);
|
- super.setY(y);
|
||||||
+ this.y = i; // Paper - Perf: Manually inline methods in BlockPosition
|
+ this.y = y; // Paper - Perf: Manually inline methods in BlockPosition
|
||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public BlockPos.MutableBlockPos setZ(int i) {
|
public BlockPos.MutableBlockPos setZ(int z) {
|
||||||
- super.setZ(i);
|
- super.setZ(z);
|
||||||
+ this.z = i; // Paper - Perf: Manually inline methods in BlockPosition
|
+ this.z = z; // Paper - Perf: Manually inline methods in BlockPosition
|
||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
|
|
@ -1,6 +1,6 @@
|
|||||||
--- a/net/minecraft/core/Direction.java
|
--- a/net/minecraft/core/Direction.java
|
||||||
+++ b/net/minecraft/core/Direction.java
|
+++ b/net/minecraft/core/Direction.java
|
||||||
@@ -57,6 +57,12 @@
|
@@ -57,6 +_,12 @@
|
||||||
.sorted(Comparator.comparingInt(direction -> direction.data2d))
|
.sorted(Comparator.comparingInt(direction -> direction.data2d))
|
||||||
.toArray(Direction[]::new);
|
.toArray(Direction[]::new);
|
||||||
|
|
||||||
@ -11,21 +11,21 @@
|
|||||||
+ // Paper end - Perf: Inline shift direction fields
|
+ // Paper end - Perf: Inline shift direction fields
|
||||||
+
|
+
|
||||||
private Direction(
|
private Direction(
|
||||||
final int id,
|
final int data3d,
|
||||||
final int idOpposite,
|
final int oppositeIndex,
|
||||||
@@ -74,6 +80,11 @@
|
@@ -74,6 +_,11 @@
|
||||||
this.axisDirection = direction;
|
this.axisDirection = axisDirection;
|
||||||
this.normal = vector;
|
this.normal = normal;
|
||||||
this.normalVec3 = Vec3.atLowerCornerOf(vector);
|
this.normalVec3 = Vec3.atLowerCornerOf(normal);
|
||||||
+ // Paper start - Perf: Inline shift direction fields
|
+ // Paper start - Perf: Inline shift direction fields
|
||||||
+ this.adjX = vector.getX();
|
+ this.adjX = normal.getX();
|
||||||
+ this.adjY = vector.getY();
|
+ this.adjY = normal.getY();
|
||||||
+ this.adjZ = vector.getZ();
|
+ this.adjZ = normal.getZ();
|
||||||
+ // Paper end - Perf: Inline shift direction fields
|
+ // Paper end - Perf: Inline shift direction fields
|
||||||
}
|
}
|
||||||
|
|
||||||
public static Direction[] orderedByNearest(Entity entity) {
|
public static Direction[] orderedByNearest(Entity entity) {
|
||||||
@@ -247,15 +258,15 @@
|
@@ -247,15 +_,15 @@
|
||||||
}
|
}
|
||||||
|
|
||||||
public int getStepX() {
|
public int getStepX() {
|
@ -1,6 +1,6 @@
|
|||||||
--- a/net/minecraft/core/Holder.java
|
--- a/net/minecraft/core/Holder.java
|
||||||
+++ b/net/minecraft/core/Holder.java
|
+++ b/net/minecraft/core/Holder.java
|
||||||
@@ -230,7 +230,7 @@
|
@@ -230,7 +_,7 @@
|
||||||
}
|
}
|
||||||
|
|
||||||
void bindTags(Collection<TagKey<T>> tags) {
|
void bindTags(Collection<TagKey<T>> tags) {
|
@ -1,6 +1,6 @@
|
|||||||
--- a/net/minecraft/core/MappedRegistry.java
|
--- a/net/minecraft/core/MappedRegistry.java
|
||||||
+++ b/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> {
|
public class MappedRegistry<T> implements WritableRegistry<T> {
|
||||||
private final ResourceKey<? extends Registry<T>> key;
|
private final ResourceKey<? extends Registry<T>> key;
|
||||||
private final ObjectList<Holder.Reference<T>> byId = new ObjectArrayList<>(256);
|
private final ObjectList<Holder.Reference<T>> byId = new ObjectArrayList<>(256);
|
||||||
@ -17,17 +17,17 @@
|
|||||||
private Lifecycle registryLifecycle;
|
private Lifecycle registryLifecycle;
|
||||||
private final Map<TagKey<T>, HolderSet.Named<T>> frozenTags = new IdentityHashMap<>();
|
private final Map<TagKey<T>, HolderSet.Named<T>> frozenTags = new IdentityHashMap<>();
|
||||||
MappedRegistry.TagSet<T> allTags = MappedRegistry.TagSet.unbound();
|
MappedRegistry.TagSet<T> allTags = MappedRegistry.TagSet.unbound();
|
||||||
@@ -508,5 +508,13 @@
|
@@ -509,4 +_,13 @@
|
||||||
void forEach(BiConsumer<? super TagKey<T>, ? super HolderSet.Named<T>> consumer);
|
|
||||||
|
|
||||||
Stream<HolderSet.Named<T>> getTags();
|
Stream<HolderSet.Named<T>> getTags();
|
||||||
+ }
|
}
|
||||||
|
+
|
||||||
+ // Paper start
|
+ // Paper start
|
||||||
+ // used to clear intrusive holders from GameEvent, Item, Block, EntityType, and Fluid from unused instances of those types
|
+ // used to clear intrusive holders from GameEvent, Item, Block, EntityType, and Fluid from unused instances of those types
|
||||||
+ public void clearIntrusiveHolder(final T instance) {
|
+ public void clearIntrusiveHolder(final T instance) {
|
||||||
+ if (this.unregisteredIntrusiveHolders != null) {
|
+ if (this.unregisteredIntrusiveHolders != null) {
|
||||||
+ this.unregisteredIntrusiveHolders.remove(instance);
|
+ this.unregisteredIntrusiveHolders.remove(instance);
|
||||||
+ }
|
+ }
|
||||||
}
|
+ }
|
||||||
+ // Paper end
|
+ // Paper end
|
||||||
}
|
}
|
@ -1,7 +1,7 @@
|
|||||||
--- a/net/minecraft/core/Rotations.java
|
--- a/net/minecraft/core/Rotations.java
|
||||||
+++ b/net/minecraft/core/Rotations.java
|
+++ b/net/minecraft/core/Rotations.java
|
||||||
@@ -34,6 +34,18 @@
|
@@ -34,6 +_,18 @@
|
||||||
this(serialized.getFloat(0), serialized.getFloat(1), serialized.getFloat(2));
|
this(tag.getFloat(0), tag.getFloat(1), tag.getFloat(2));
|
||||||
}
|
}
|
||||||
|
|
||||||
+ // Paper start - faster alternative constructor
|
+ // Paper start - faster alternative constructor
|
@ -1,7 +1,7 @@
|
|||||||
--- a/net/minecraft/core/Vec3i.java
|
--- a/net/minecraft/core/Vec3i.java
|
||||||
+++ b/net/minecraft/core/Vec3i.java
|
+++ b/net/minecraft/core/Vec3i.java
|
||||||
@@ -16,9 +16,9 @@
|
@@ -16,9 +_,9 @@
|
||||||
vec -> IntStream.of(vec.getX(), vec.getY(), vec.getZ())
|
vec3i -> IntStream.of(vec3i.getX(), vec3i.getY(), vec3i.getZ())
|
||||||
);
|
);
|
||||||
public static final Vec3i ZERO = new Vec3i(0, 0, 0);
|
public static final Vec3i ZERO = new Vec3i(0, 0, 0);
|
||||||
- private int x;
|
- private int x;
|
||||||
@ -11,15 +11,15 @@
|
|||||||
+ protected int y; // Paper - Perf: Manually inline methods in BlockPosition; protected
|
+ protected int y; // Paper - Perf: Manually inline methods in BlockPosition; protected
|
||||||
+ protected int z; // 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(
|
return CODEC.validate(
|
||||||
@@ -35,12 +35,12 @@
|
@@ -35,12 +_,12 @@
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
- public boolean equals(Object object) {
|
- public boolean equals(Object other) {
|
||||||
+ public final boolean equals(Object object) { // Paper - Perf: Final for inline
|
+ public final boolean equals(Object other) { // Paper - Perf: Final for inline
|
||||||
return this == object || object instanceof Vec3i vec3i && this.getX() == vec3i.getX() && this.getY() == vec3i.getY() && this.getZ() == vec3i.getZ();
|
return this == other || other instanceof Vec3i vec3i && this.getX() == vec3i.getX() && this.getY() == vec3i.getY() && this.getZ() == vec3i.getZ();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@ -28,7 +28,7 @@
|
|||||||
return (this.getY() + this.getZ() * 31) * 31 + this.getX();
|
return (this.getY() + this.getZ() * 31) * 31 + this.getX();
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -53,15 +53,15 @@
|
@@ -53,15 +_,15 @@
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Laden…
In neuem Issue referenzieren
Einen Benutzer sperren