mirror of
https://github.com/PaperMC/Paper.git
synced 2024-12-27 23:10:16 +01:00
"Downgrade" Vineflower to 1.10.1 release (#10423)
* "Downgrade" Vineflower to 1.10.1 release The main thing we lose from the 1.11 snapshots is a recent fix for redundant casts. * Thanks intellij * a
This commit is contained in:
parent
14b0751f02
commit
76be2651ca
25 changed files with 68 additions and 64 deletions
|
@ -69,7 +69,7 @@ repositories {
|
|||
dependencies {
|
||||
paramMappings("net.fabricmc:yarn:1.20.4+build.1:mergedv2")
|
||||
remapper("net.fabricmc:tiny-remapper:0.10.1:fat")
|
||||
decompiler("org.vineflower:vineflower:1.11.0-20240412.144930-14")
|
||||
decompiler("org.vineflower:vineflower:1.10.1")
|
||||
spigotDecompiler("io.papermc:patched-spigot-fernflower:0.1+build.6")
|
||||
paperclip("io.papermc:paperclip:3.0.3")
|
||||
}
|
||||
|
@ -80,7 +80,7 @@ paperweight {
|
|||
|
||||
paramMappingsRepo = paperMavenPublicUrl
|
||||
remapRepo = paperMavenPublicUrl
|
||||
decompileRepo = "https://s01.oss.sonatype.org/content/repositories/snapshots/"
|
||||
decompileRepo = paperMavenPublicUrl
|
||||
|
||||
craftBukkit {
|
||||
fernFlowerJar = layout.file(spigotDecompiler.elements.map { it.single().asFile })
|
||||
|
|
|
@ -513,9 +513,9 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
|||
+ // Paper end - actually optimise explosions
|
||||
float f = explosion.radius() * 2.0F;
|
||||
Vec3 vec3 = explosion.center();
|
||||
double d = Math.sqrt(entity.distanceToSqr(vec3)) / f;
|
||||
- double e = (1.0 - d) * Explosion.getSeenPercent(vec3, entity);
|
||||
double d = Math.sqrt(entity.distanceToSqr(vec3)) / (double)f;
|
||||
- double e = (1.0 - d) * (double)Explosion.getSeenPercent(vec3, entity);
|
||||
+ double e = (1.0 - d) * seenPercent; // Paper - actually optimise explosions
|
||||
return (float)((e * e + e) / 2.0 * 7.0 * f + 1.0);
|
||||
return (float)((e * e + e) / 2.0 * 7.0 * (double)f + 1.0);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -89,10 +89,10 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
|||
--- a/src/main/java/net/minecraft/world/entity/ai/behavior/RamTarget.java
|
||||
+++ b/src/main/java/net/minecraft/world/entity/ai/behavior/RamTarget.java
|
||||
@@ -0,0 +0,0 @@ public class RamTarget extends Behavior<Goat> {
|
||||
float f = 0.25F * (i - j);
|
||||
float f = 0.25F * (float)(i - j);
|
||||
float g = Mth.clamp(entity.getSpeed() * 1.65F, 0.2F, 3.0F) + f;
|
||||
float h = livingEntity.isDamageSourceBlocked(world.damageSources().mobAttack(entity)) ? 0.5F : 1.0F;
|
||||
- livingEntity.knockback(h * g * this.getKnockbackForce.applyAsDouble(entity), this.ramDirection.x(), this.ramDirection.z());
|
||||
- livingEntity.knockback((double)(h * g) * this.getKnockbackForce.applyAsDouble(entity), this.ramDirection.x(), this.ramDirection.z());
|
||||
+ livingEntity.knockback(h * g * this.getKnockbackForce.applyAsDouble(entity), this.ramDirection.x(), this.ramDirection.z(), entity, org.bukkit.event.entity.EntityKnockbackEvent.KnockbackCause.ENTITY_ATTACK); // Paper - Add EntityKnockbackByEntityEvent and EntityPushedByEntityAttackEvent
|
||||
this.finishRam(world, entity);
|
||||
world.playSound(null, entity, this.getImpactSound.apply(entity), SoundSource.NEUTRAL, 1.0F, 1.0F);
|
||||
|
@ -170,9 +170,9 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
|||
--- a/src/main/java/net/minecraft/world/entity/monster/hoglin/HoglinBase.java
|
||||
+++ b/src/main/java/net/minecraft/world/entity/monster/hoglin/HoglinBase.java
|
||||
@@ -0,0 +0,0 @@ public interface HoglinBase {
|
||||
double j = f * (attacker.level().random.nextFloat() * 0.5F + 0.2F);
|
||||
double j = f * (double)(attacker.level().random.nextFloat() * 0.5F + 0.2F);
|
||||
Vec3 vec3 = new Vec3(g, 0.0, h).normalize().scale(j).yRot(i);
|
||||
double k = f * attacker.level().random.nextFloat() * 0.5;
|
||||
double k = f * (double)attacker.level().random.nextFloat() * 0.5;
|
||||
- target.push(vec3.x, k, vec3.z);
|
||||
+ target.push(vec3.x, k, vec3.z, attacker); // Paper - Add EntityKnockbackByEntityEvent and EntityPushedByEntityAttackEvent
|
||||
target.hurtMarked = true;
|
||||
|
|
|
@ -60,14 +60,16 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
|||
+ for (org.bukkit.inventory.ItemStack item : event.getDrops()) { // Paper - Add PlayerShearBlockEvent
|
||||
ItemEntity itemEntity = new ItemEntity(
|
||||
world,
|
||||
pos.getX() + 0.5 + direction2.getStepX() * 0.65,
|
||||
pos.getY() + 0.1,
|
||||
pos.getZ() + 0.5 + direction2.getStepZ() * 0.65,
|
||||
(double)pos.getX() + 0.5 + (double)direction2.getStepX() * 0.65,
|
||||
(double)pos.getY() + 0.1,
|
||||
(double)pos.getZ() + 0.5 + (double)direction2.getStepZ() * 0.65,
|
||||
- new ItemStack(Items.PUMPKIN_SEEDS, 4)
|
||||
+ org.bukkit.craftbukkit.inventory.CraftItemStack.asNMSCopy(item) // Paper - Add PlayerShearBlockEvent
|
||||
);
|
||||
itemEntity.setDeltaMovement(
|
||||
0.05 * direction2.getStepX() + world.random.nextDouble() * 0.02, 0.05, 0.05 * direction2.getStepZ() + world.random.nextDouble() * 0.02
|
||||
0.05 * (double)direction2.getStepX() + world.random.nextDouble() * 0.02,
|
||||
@@ -0,0 +0,0 @@ public class PumpkinBlock extends Block {
|
||||
0.05 * (double)direction2.getStepZ() + world.random.nextDouble() * 0.02
|
||||
);
|
||||
world.addFreshEntity(itemEntity);
|
||||
+ } // Paper - Add PlayerShearBlockEvent
|
||||
|
|
|
@ -197,7 +197,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
|||
+ worldgenRandom.setLargeFeatureWithSalt(seed, chunkX, chunkZ, saltOverride);
|
||||
+ }
|
||||
+ // Paper end - Add missing structure set seed configs
|
||||
return worldgenRandom.nextDouble() < frequency;
|
||||
return worldgenRandom.nextDouble() < (double)frequency;
|
||||
}
|
||||
|
||||
- private static boolean legacyArbitrarySaltProbabilityReducer(long seed, int salt, int chunkX, int chunkZ, float frequency) {
|
||||
|
|
|
@ -93,9 +93,9 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
|||
.level()
|
||||
- .getHeightmapPos(Heightmap.Types.MOTION_BLOCKING_NO_LEAVES, EndPodiumFeature.getLocation(this.dragon.getFightOrigin()));
|
||||
+ .getHeightmapPos(Heightmap.Types.MOTION_BLOCKING_NO_LEAVES, this.dragon.getPodium()); // Paper - Allow changing the EnderDragon podium
|
||||
Player player = this.dragon.level().getNearestPlayer(NEAR_EGG_TARGETING, this.dragon, blockPos.getX(), blockPos.getY(), blockPos.getZ());
|
||||
int j;
|
||||
if (player != null) {
|
||||
Player player = this.dragon
|
||||
.level()
|
||||
.getNearestPlayer(NEAR_EGG_TARGETING, this.dragon, (double)blockPos.getX(), (double)blockPos.getY(), (double)blockPos.getZ());
|
||||
diff --git a/src/main/java/net/minecraft/world/entity/boss/enderdragon/phases/DragonLandingPhase.java b/src/main/java/net/minecraft/world/entity/boss/enderdragon/phases/DragonLandingPhase.java
|
||||
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
|
||||
--- a/src/main/java/net/minecraft/world/entity/boss/enderdragon/phases/DragonLandingPhase.java
|
||||
|
|
|
@ -2473,9 +2473,9 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
|||
// Paper end
|
||||
VoxelShape voxelShape = blockState.getCollisionShape(this.collisionGetter, this.pos, this.context);
|
||||
if (voxelShape == Shapes.block()) {
|
||||
- if (this.box.intersects(i, j, k, i + 1.0, j + 1.0, k + 1.0)) {
|
||||
- if (this.box.intersects((double)i, (double)j, (double)k, (double)i + 1.0, (double)j + 1.0, (double)k + 1.0)) {
|
||||
+ if (io.papermc.paper.util.CollisionUtil.voxelShapeIntersect(this.box, i, j, k, i + 1.0, j + 1.0, k + 1.0)) { // Paper - keep vanilla behavior for voxelshape intersection - See comment in CollisionUtil
|
||||
return this.resultProvider.apply(this.pos, voxelShape.move(i, j, k));
|
||||
return this.resultProvider.apply(this.pos, voxelShape.move((double)i, (double)j, (double)k));
|
||||
}
|
||||
} else {
|
||||
diff --git a/src/main/java/net/minecraft/world/level/ClipContext.java b/src/main/java/net/minecraft/world/level/ClipContext.java
|
||||
|
@ -3237,7 +3237,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
|||
+ // Paper end
|
||||
+
|
||||
public AABB(BlockPos pos) {
|
||||
this(pos.getX(), pos.getY(), pos.getZ(), pos.getX() + 1, pos.getY() + 1, pos.getZ() + 1);
|
||||
this((double)pos.getX(), (double)pos.getY(), (double)pos.getZ(), (double)(pos.getX() + 1), (double)(pos.getY() + 1), (double)(pos.getZ() + 1));
|
||||
}
|
||||
@@ -0,0 +0,0 @@ public class AABB {
|
||||
}
|
||||
|
@ -3638,12 +3638,12 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
|||
- l,
|
||||
- m,
|
||||
- n,
|
||||
- (int)Math.round(minX * l),
|
||||
- (int)Math.round(minY * m),
|
||||
- (int)Math.round(minZ * n),
|
||||
- (int)Math.round(maxX * l),
|
||||
- (int)Math.round(maxY * m),
|
||||
- (int)Math.round(maxZ * n)
|
||||
- (int)Math.round(minX * (double)l),
|
||||
- (int)Math.round(minY * (double)m),
|
||||
- (int)Math.round(minZ * (double)n),
|
||||
- (int)Math.round(maxX * (double)l),
|
||||
- (int)Math.round(maxY * (double)m),
|
||||
- (int)Math.round(maxZ * (double)n)
|
||||
+ return new ArrayVoxelShape(
|
||||
+ BLOCK.shape,
|
||||
+ minX == 0.0 && maxX == 1.0 ? io.papermc.paper.util.CollisionUtil.ZERO_ONE : DoubleArrayList.wrap(new double[] { minX, maxX }),
|
||||
|
@ -4620,9 +4620,9 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
|||
- Vec3 vec32 = start.add(vec3.scale(0.001));
|
||||
- return this.shape
|
||||
- .isFullWide(
|
||||
- this.findIndex(Direction.Axis.X, vec32.x - pos.getX()),
|
||||
- this.findIndex(Direction.Axis.Y, vec32.y - pos.getY()),
|
||||
- this.findIndex(Direction.Axis.Z, vec32.z - pos.getZ())
|
||||
- this.findIndex(Direction.Axis.X, vec32.x - (double)pos.getX()),
|
||||
- this.findIndex(Direction.Axis.Y, vec32.y - (double)pos.getY()),
|
||||
- this.findIndex(Direction.Axis.Z, vec32.z - (double)pos.getZ())
|
||||
- )
|
||||
- ? new BlockHitResult(vec32, Direction.getNearest(vec3.x, vec3.y, vec3.z).getOpposite(), pos, true)
|
||||
- : AABB.clip(this.toAabbs(), start, end, pos);
|
||||
|
|
|
@ -43,7 +43,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
|||
protected abstract class EntryBase implements LootPoolEntry {
|
||||
@Override
|
||||
public int getWeight(float luck) {
|
||||
- return Math.max(Mth.floor(LootPoolSingletonContainer.this.weight + LootPoolSingletonContainer.this.quality * luck), 0);
|
||||
- return Math.max(Mth.floor((float)LootPoolSingletonContainer.this.weight + (float)LootPoolSingletonContainer.this.quality * luck), 0);
|
||||
+ // Paper start - Configurable LootPool luck formula
|
||||
+ // SEE: https://luckformula.emc.gs for details and data
|
||||
+ if (LootPoolSingletonContainer.this.lastLuck != null && LootPoolSingletonContainer.this.lastLuck == luck) {
|
||||
|
|
|
@ -111,7 +111,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
|||
+ // Paper end - EntityPathfindEvent
|
||||
if (positions.isEmpty()) {
|
||||
return null;
|
||||
} else if (this.mob.getY() < this.level.getMinBuildHeight()) {
|
||||
} else if (this.mob.getY() < (double)this.level.getMinBuildHeight()) {
|
||||
@@ -0,0 +0,0 @@ public abstract class PathNavigation {
|
||||
} else if (this.path != null && !this.path.isDone() && positions.contains(this.targetPos)) {
|
||||
return this.path;
|
||||
|
@ -135,7 +135,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
|||
+ // Paper end - EntityPathfindEvent
|
||||
this.level.getProfiler().push("pathfind");
|
||||
BlockPos blockPos = useHeadPos ? this.mob.blockPosition().above() : this.mob.blockPosition();
|
||||
int i = (int)(followRange + range);
|
||||
int i = (int)(followRange + (float)range);
|
||||
diff --git a/src/main/java/net/minecraft/world/entity/ai/navigation/WallClimberNavigation.java b/src/main/java/net/minecraft/world/entity/ai/navigation/WallClimberNavigation.java
|
||||
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
|
||||
--- a/src/main/java/net/minecraft/world/entity/ai/navigation/WallClimberNavigation.java
|
||||
|
|
|
@ -60,7 +60,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
|||
--- a/src/main/java/net/minecraft/world/item/FireworkRocketItem.java
|
||||
+++ b/src/main/java/net/minecraft/world/item/FireworkRocketItem.java
|
||||
@@ -0,0 +0,0 @@ public class FireworkRocketItem extends Item {
|
||||
vec3.z + direction.getStepZ() * 0.15,
|
||||
vec3.z + (double)direction.getStepZ() * 0.15,
|
||||
itemStack
|
||||
);
|
||||
+ fireworkRocketEntity.spawningEntity = context.getPlayer() == null ? null : context.getPlayer().getUUID(); // Paper
|
||||
|
|
|
@ -56,9 +56,9 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
|||
--- a/src/main/java/net/minecraft/world/level/levelgen/feature/SpikeFeature.java
|
||||
+++ b/src/main/java/net/minecraft/world/level/levelgen/feature/SpikeFeature.java
|
||||
@@ -0,0 +0,0 @@ public class SpikeFeature extends Feature<SpikeConfiguration> {
|
||||
endCrystal.setBeamTarget(config.getCrystalBeamTarget());
|
||||
endCrystal.setInvulnerable(config.isCrystalInvulnerable());
|
||||
endCrystal.moveTo(spike.getCenterX() + 0.5, spike.getHeight() + 1, spike.getCenterZ() + 0.5, random.nextFloat() * 360.0F, 0.0F);
|
||||
endCrystal.moveTo(
|
||||
(double)spike.getCenterX() + 0.5, (double)(spike.getHeight() + 1), (double)spike.getCenterZ() + 0.5, random.nextFloat() * 360.0F, 0.0F
|
||||
);
|
||||
+ endCrystal.generatedByDragonFight = true; // Paper - Fix invulnerable end crystals
|
||||
world.addFreshEntity(endCrystal);
|
||||
BlockPos blockPos2 = endCrystal.blockPosition();
|
||||
|
|
|
@ -22,7 +22,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
|||
int j = z / 2;
|
||||
int k = x % 2;
|
||||
int l = z % 2;
|
||||
- float f = 100.0F - Mth.sqrt(x * x + z * z) * 8.0F;
|
||||
- float f = 100.0F - Mth.sqrt((float)(x * x + z * z)) * 8.0F;
|
||||
+ float f = 100.0F - Mth.sqrt((long) x * (long) x + (long) z * (long) z) * 8.0F; // Paper - cast ints to long to avoid integer overflow
|
||||
f = Mth.clamp(f, -100.0F, 80.0F);
|
||||
|
||||
|
|
|
@ -39,7 +39,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
|||
+++ b/src/main/java/net/minecraft/world/level/block/FrogspawnBlock.java
|
||||
@@ -0,0 +0,0 @@ public class FrogspawnBlock extends Block {
|
||||
int k = random.nextInt(1, 361);
|
||||
tadpole.moveTo(d, pos.getY() - 0.5, e, k, 0.0F);
|
||||
tadpole.moveTo(d, (double)pos.getY() - 0.5, e, (float)k, 0.0F);
|
||||
tadpole.setPersistenceRequired();
|
||||
- world.addFreshEntity(tadpole);
|
||||
+ world.addFreshEntity(tadpole, org.bukkit.event.entity.CreatureSpawnEvent.SpawnReason.EGG); // Paper - use correct spawn reason
|
||||
|
|
|
@ -73,7 +73,9 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
|||
+ tpsAvg[g] = format( tps[g] );
|
||||
+ }
|
||||
this.msgs[0] = "Memory use: " + l / 1024L / 1024L + " mb (" + Runtime.getRuntime().freeMemory() * 100L / Runtime.getRuntime().maxMemory() + "% free)";
|
||||
this.msgs[1] = "Avg tick: " + DECIMAL_FORMAT.format((double)this.server.getAverageTickTimeNanos() / TimeUtil.NANOSECONDS_PER_MILLISECOND) + " ms";
|
||||
this.msgs[1] = "Avg tick: "
|
||||
+ DECIMAL_FORMAT.format((double)this.server.getAverageTickTimeNanos() / (double)TimeUtil.NANOSECONDS_PER_MILLISECOND)
|
||||
+ " ms";
|
||||
+ this.msgs[2] = "TPS from last 1m, 5m, 15m: " + String.join(", ", tpsAvg);
|
||||
+ // Paper end - Improve ServerGUI
|
||||
this.values[this.vp++ & 0xFF] = (int)(l * 100L / Runtime.getRuntime().maxMemory());
|
||||
|
|
|
@ -22,7 +22,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
|||
|
||||
@VisibleForTesting
|
||||
static double decode(long value) {
|
||||
- return value / 4096.0;
|
||||
- return (double)value / 4096.0;
|
||||
+ return value / 4096.0; // Paper - Fix MC-4; diff on change
|
||||
}
|
||||
|
||||
|
|
|
@ -76,9 +76,9 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
|||
|
||||
public static long asLong(int x, int y, int z) {
|
||||
- long l = 0L;
|
||||
- l |= (x & PACKED_X_MASK) << X_OFFSET;
|
||||
- l |= (y & PACKED_Y_MASK) << 0;
|
||||
- return l | (z & PACKED_Z_MASK) << Z_OFFSET;
|
||||
- l |= ((long)x & PACKED_X_MASK) << X_OFFSET;
|
||||
- l |= ((long)y & PACKED_Y_MASK) << 0;
|
||||
- return l | ((long)z & PACKED_Z_MASK) << Z_OFFSET;
|
||||
+ return (((long) x & (long) 67108863) << 38) | (((long) y & (long) 4095)) | (((long) z & (long) 67108863) << 12); // Paper - inline constants and simplify
|
||||
}
|
||||
|
||||
|
@ -180,9 +180,9 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
|||
+
|
||||
public static long asLong(int x, int y, int z) {
|
||||
- long l = 0L;
|
||||
- l |= (x & 4194303L) << 42;
|
||||
- l |= (y & 1048575L) << 0;
|
||||
- return l | (z & 4194303L) << 20;
|
||||
- l |= ((long)x & 4194303L) << 42;
|
||||
- l |= ((long)y & 1048575L) << 0;
|
||||
- return l | ((long)z & 4194303L) << 20;
|
||||
+ return (((long) x & 4194303L) << 42) | (((long) y & 1048575L)) | (((long) z & 4194303L) << 20); // Paper - Simplify to reduce instruction count
|
||||
}
|
||||
|
||||
|
|
|
@ -88,7 +88,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
|||
+ // Paper end
|
||||
VoxelShape voxelShape = blockState.getCollisionShape(this.collisionGetter, this.pos, this.context);
|
||||
if (voxelShape == Shapes.block()) {
|
||||
if (this.box.intersects(i, j, k, i + 1.0, j + 1.0, k + 1.0)) {
|
||||
if (this.box.intersects((double)i, (double)j, (double)k, (double)i + 1.0, (double)j + 1.0, (double)k + 1.0)) {
|
||||
diff --git a/src/main/java/net/minecraft/world/level/CollisionGetter.java b/src/main/java/net/minecraft/world/level/CollisionGetter.java
|
||||
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
|
||||
--- a/src/main/java/net/minecraft/world/level/CollisionGetter.java
|
||||
|
|
|
@ -42,7 +42,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
|||
private int cellIndex(int index) {
|
||||
- long l = Integer.toUnsignedLong(this.divideMul);
|
||||
- long m = Integer.toUnsignedLong(this.divideAdd);
|
||||
- return (int)(index * l + m >> 32 >> this.divideShift);
|
||||
- return (int)((long)index * l + m >> 32 >> this.divideShift);
|
||||
+ //long l = Integer.toUnsignedLong(this.divideMul); // Paper - Perf: Optimize SimpleBitStorage
|
||||
+ //long m = Integer.toUnsignedLong(this.divideAdd); // Paper - Perf: Optimize SimpleBitStorage
|
||||
+ return (int) (index * this.divideMulUnsigned + this.divideAddUnsigned >> 32 >> this.divideShift); // Paper - Perf: Optimize SimpleBitStorage
|
||||
|
|
|
@ -24,7 +24,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
|||
return null;
|
||||
} else {
|
||||
- Map<Target, BlockPos> map = positions.stream()
|
||||
- .collect(Collectors.toMap(pos -> this.nodeEvaluator.getGoal(pos.getX(), pos.getY(), pos.getZ()), Function.identity()));
|
||||
- .collect(Collectors.toMap(pos -> this.nodeEvaluator.getGoal((double)pos.getX(), (double)pos.getY(), (double)pos.getZ()), Function.identity()));
|
||||
+ // Paper start - Perf: remove streams and optimize collection
|
||||
+ List<Map.Entry<Target, BlockPos>> map = Lists.newArrayList();
|
||||
+ for (BlockPos pos : positions) {
|
||||
|
@ -56,7 +56,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
|||
int i = 0;
|
||||
- Set<Target> set3 = Sets.newHashSetWithExpectedSize(set.size());
|
||||
+ List<Map.Entry<Target, BlockPos>> entryList = Lists.newArrayListWithExpectedSize(positions.size()); // Paper - optimize collection
|
||||
int j = (int)(this.maxVisitedNodes * rangeMultiplier);
|
||||
int j = (int)((float)this.maxVisitedNodes * rangeMultiplier);
|
||||
|
||||
while (!this.openSet.isEmpty()) {
|
||||
@@ -0,0 +0,0 @@ public class PathFinder {
|
||||
|
@ -68,7 +68,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
|||
+ for (int i1 = 0; i1 < positions.size(); i1++) {
|
||||
+ final Map.Entry<Target, BlockPos> entry = positions.get(i1);
|
||||
+ Target target = entry.getKey();
|
||||
if (node.distanceManhattan(target) <= distance) {
|
||||
if (node.distanceManhattan(target) <= (float)distance) {
|
||||
target.setReached();
|
||||
- set3.add(target);
|
||||
+ entryList.add(entry);
|
||||
|
|
|
@ -93,7 +93,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
|||
+ // Paper note - Rewrite below as optimized order if instead of nasty ternary
|
||||
if (first instanceof CubePointRange && second instanceof CubePointRange) {
|
||||
long l = lcm(i, j);
|
||||
if (size * l <= 256L) {
|
||||
if ((long)size * l <= 256L) {
|
||||
@@ -0,0 +0,0 @@ public final class Shapes {
|
||||
}
|
||||
}
|
||||
|
|
|
@ -71,7 +71,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
|||
if (this.hasRequiredMemories(entity) && this.checkExtraStartConditions(world, entity)) {
|
||||
this.status = Behavior.Status.RUNNING;
|
||||
int i = this.minDuration + world.getRandom().nextInt(this.maxDuration + 1 - this.minDuration);
|
||||
this.endTimestamp = time + i;
|
||||
this.endTimestamp = time + (long)i;
|
||||
+ this.timing.startTiming(); // Paper - behavior timings
|
||||
this.start(world, entity, time);
|
||||
+ this.timing.stopTiming(); // Paper - behavior timings
|
||||
|
@ -116,13 +116,13 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
|||
+ this.timing = co.aikar.timings.MinecraftTimings.getSensorTimings(configKey, senseInterval);
|
||||
+ // Paper end
|
||||
this.scanRate = senseInterval;
|
||||
this.timeToTick = RANDOM.nextInt(senseInterval);
|
||||
this.timeToTick = (long)RANDOM.nextInt(senseInterval);
|
||||
}
|
||||
@@ -0,0 +0,0 @@ public abstract class Sensor<E extends LivingEntity> {
|
||||
|
||||
public final void tick(ServerLevel world, E entity) {
|
||||
if (--this.timeToTick <= 0L) {
|
||||
- this.timeToTick = this.scanRate;
|
||||
- this.timeToTick = (long)this.scanRate;
|
||||
+ // Paper start - configurable sensor tick rate and timings
|
||||
+ this.timeToTick = java.util.Objects.requireNonNullElse(world.paperConfig().tickRates.sensor.get(entity.getType(), this.configKey), this.scanRate);
|
||||
+ this.timing.startTiming();
|
||||
|
|
|
@ -19217,7 +19217,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
|||
public void onChunkBatchReceivedByClient(float desiredBatchSize) {
|
||||
+ if (true) return; // Paper - rewrite player chunk loader
|
||||
this.unacknowledgedBatches--;
|
||||
this.desiredChunksPerTick = Double.isNaN(desiredBatchSize) ? 0.01F : Mth.clamp(desiredBatchSize, 0.01F, 64.0F);
|
||||
this.desiredChunksPerTick = Double.isNaN((double)desiredBatchSize) ? 0.01F : Mth.clamp(desiredBatchSize, 0.01F, 64.0F);
|
||||
if (this.unacknowledgedBatches == 0) {
|
||||
diff --git a/src/main/java/net/minecraft/server/players/PlayerList.java b/src/main/java/net/minecraft/server/players/PlayerList.java
|
||||
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
|
||||
|
|
|
@ -39,9 +39,9 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
|||
+ NoiseCache cache = noiseCache.get().computeIfAbsent(sampler, noiseKey -> new NoiseCache()); // Paper - Perf: Optimize end generation
|
||||
for (int m = -12; m <= 12; m++) {
|
||||
for (int n = -12; n <= 12; n++) {
|
||||
long o = i + m;
|
||||
long p = j + n;
|
||||
- if (o * o + p * p > 4096L && sampler.getValue(o, p) < -0.9F) {
|
||||
long o = (long)(i + m);
|
||||
long p = (long)(j + n);
|
||||
- if (o * o + p * p > 4096L && sampler.getValue((double)o, (double)p) < -0.9F) {
|
||||
- float g = (Mth.abs((float)o) * 3439.0F + Mth.abs((float)p) * 147.0F) % 13.0F + 9.0F;
|
||||
+ // Paper start - Perf: Optimize end generation by using a noise cache
|
||||
+ long key = net.minecraft.world.level.ChunkPos.asLong((int) o, (int) p);
|
||||
|
@ -58,6 +58,6 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
|||
+ }
|
||||
+ if (g != Float.MIN_VALUE) {
|
||||
+ // Paper end - Perf: Optimize end generation
|
||||
float h = k - m * 2;
|
||||
float q = l - n * 2;
|
||||
float h = (float)(k - m * 2);
|
||||
float q = (float)(l - n * 2);
|
||||
float r = 100.0F - Mth.sqrt(h * h + q * q) * g;
|
||||
|
|
|
@ -25,7 +25,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
|||
@@ -0,0 +0,0 @@ public class AcquirePoi {
|
||||
return false;
|
||||
} else {
|
||||
mutableLong.setValue(time + 20L + world.getRandom().nextInt(20));
|
||||
mutableLong.setValue(time + 20L + (long)world.getRandom().nextInt(20));
|
||||
+ if (entity.getNavigation().isStuck()) mutableLong.add(200); // Paper - Perf: Wait an additional 10s to check again if they're stuck
|
||||
PoiManager poiManager = world.getPoiManager();
|
||||
long2ObjectMap.long2ObjectEntrySet().removeIf(entry -> !entry.getValue().isStillValid(time));
|
||||
|
|
|
@ -106,8 +106,8 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
|||
|
||||
public Squid(EntityType<? extends Squid> type, Level world) {
|
||||
super(type, world);
|
||||
- this.random.setSeed(this.getId());
|
||||
+ //this.random.setSeed(this.getId()); // Paper - Share random for entities to make them more random
|
||||
- this.random.setSeed((long)this.getId());
|
||||
+ //this.random.setSeed((long)this.getId()); // Paper - Share random for entities to make them more random
|
||||
this.tentacleSpeed = 1.0F / (this.random.nextFloat() + 1.0F) * 0.2F;
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue