3
0
Mirror von https://github.com/PaperMC/Paper.git synchronisiert 2024-12-18 20:40:08 +01:00

Strip raytracing for EntityLiving#hasLineOfSight

Co-authored-by: Paul Sauve <paul@technove.co>
Dieser Commit ist enthalten in:
Nassim Jahnke 2023-09-10 12:28:03 +10:00
Ursprung 33bec7f20a
Commit 72e87abc2d
Es konnte kein GPG-Schlüssel zu dieser Signatur gefunden werden
GPG-Schlüssel-ID: EF6771C01F6EF02F
959 geänderte Dateien mit 476 neuen und 277 gelöschten Zeilen

Datei anzeigen

@ -0,0 +1,159 @@
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: Paul Sauve <paul@technove.co>
Date: Sat, 31 Oct 2020 18:43:02 -0500
Subject: [PATCH] Strip raytracing for EntityLiving#hasLineOfSight
The BlockGetter#clip method is very wasteful in both allocations,
and in logic. While EntityLiving#hasLineOfSight provides static
parameters for collisions with blocks and fluids, the method still does
a lot of dynamic checks for both of these, which result in extra work.
As well, since the fluid collision option is set to NONE, the entire
fluid collision system is completely unneeded, yet used anyways.
Copyright (C) 2020 Technove LLC
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
diff --git a/src/main/java/net/minecraft/world/entity/LivingEntity.java b/src/main/java/net/minecraft/world/entity/LivingEntity.java
index d8ecc90465dfc54319d7f2478979e9aaee42f5a2..53e666df97e74bbb8e96207ebc50e3e9acc455de 100644
--- a/src/main/java/net/minecraft/world/entity/LivingEntity.java
+++ b/src/main/java/net/minecraft/world/entity/LivingEntity.java
@@ -3407,7 +3407,7 @@ public abstract class LivingEntity extends Entity implements Attackable {
Vec3 vec3d = new Vec3(this.getX(), this.getEyeY(), this.getZ());
Vec3 vec3d1 = new Vec3(entity.getX(), entity.getEyeY(), entity.getZ());
- return vec3d1.distanceTo(vec3d) > 128.0D ? false : this.level().clip(new ClipContext(vec3d, vec3d1, ClipContext.Block.COLLIDER, ClipContext.Fluid.NONE, this)).getType() == HitResult.Type.MISS;
+ return vec3d1.distanceTo(vec3d) > 128.0D ? false : this.level().clipDirect(vec3d, vec3d1, net.minecraft.world.phys.shapes.CollisionContext.of(this)) == HitResult.Type.MISS; // Paper
}
}
diff --git a/src/main/java/net/minecraft/world/level/BlockGetter.java b/src/main/java/net/minecraft/world/level/BlockGetter.java
index d6d8bbc98fc71997cb52521d59ebb59d727d3c22..3b31a1927aaed7fffc1b4f4bcefc12120d66af3d 100644
--- a/src/main/java/net/minecraft/world/level/BlockGetter.java
+++ b/src/main/java/net/minecraft/world/level/BlockGetter.java
@@ -68,6 +68,19 @@ public interface BlockGetter extends LevelHeightAccessor {
});
}
+ // Paper start - Broken down variant of the method below, used by Level#clipDirect
+ @Nullable
+ default BlockHitResult.Type clipDirect(Vec3 start, Vec3 end, BlockPos pos, BlockState state, net.minecraft.world.phys.shapes.CollisionContext collisionContext) {
+ if (state.isAir()) {
+ return null;
+ }
+
+ final VoxelShape voxelshape = ClipContext.Block.COLLIDER.get(state, this, pos, collisionContext);
+ final BlockHitResult hitResult = this.clipWithInteractionOverride(start, end, pos, voxelshape, state);
+ return hitResult == null ? null : hitResult.getType();
+ }
+ // Paper end
+
// CraftBukkit start - moved block handling into separate method for use by Block#rayTrace
default BlockHitResult clip(ClipContext raytrace1, BlockPos blockposition) {
BlockState iblockdata = this.getBlockState(blockposition);
diff --git a/src/main/java/net/minecraft/world/level/Level.java b/src/main/java/net/minecraft/world/level/Level.java
index 809f7db469583ea90fbb165cf180dc87055c6105..37d5abf5a18b90695d1cea9e365c764e93b918bf 100644
--- a/src/main/java/net/minecraft/world/level/Level.java
+++ b/src/main/java/net/minecraft/world/level/Level.java
@@ -283,6 +283,90 @@ public abstract class Level implements LevelAccessor, AutoCloseable {
return null;
}
+ // Paper start - Broken down method of raytracing for EntityLiving#hasLineOfSight, replaces BlockGetter#clip(CollisionContext)
+ public net.minecraft.world.phys.BlockHitResult.Type clipDirect(Vec3 start, Vec3 end, net.minecraft.world.phys.shapes.CollisionContext collisionContext) {
+ // most of this code comes from BlockGetter#clip(CollisionContext, BiFunction, Function), but removes the needless functions
+ if (start.equals(end)) {
+ return net.minecraft.world.phys.BlockHitResult.Type.MISS;
+ }
+
+ final double endX = Mth.lerp(-1.0E-7D, end.x, start.x);
+ final double endY = Mth.lerp(-1.0E-7D, end.y, start.y);
+ final double endZ = Mth.lerp(-1.0E-7D, end.z, start.z);
+
+ final double startX = Mth.lerp(-1.0E-7D, start.x, end.x);
+ final double startY = Mth.lerp(-1.0E-7D, start.y, end.y);
+ final double startZ = Mth.lerp(-1.0E-7D, start.z, end.z);
+
+ int currentX = Mth.floor(startX);
+ int currentY = Mth.floor(startY);
+ int currentZ = Mth.floor(startZ);
+
+ final BlockPos.MutableBlockPos currentBlock = new BlockPos.MutableBlockPos(currentX, currentY, currentZ);
+
+ LevelChunk chunk = this.getChunkIfLoaded(currentBlock);
+ if (chunk == null) {
+ return net.minecraft.world.phys.BlockHitResult.Type.MISS;
+ }
+
+ final net.minecraft.world.phys.BlockHitResult.Type initialCheck = this.clipDirect(start, end, currentBlock, chunk.getBlockState(currentBlock), collisionContext);
+ if (initialCheck != null) {
+ return initialCheck;
+ }
+
+ final double diffX = endX - startX;
+ final double diffY = endY - startY;
+ final double diffZ = endZ - startZ;
+
+ final int xDirection = Mth.sign(diffX);
+ final int yDirection = Mth.sign(diffY);
+ final int zDirection = Mth.sign(diffZ);
+
+ final double normalizedX = xDirection == 0 ? Double.MAX_VALUE : (double) xDirection / diffX;
+ final double normalizedY = yDirection == 0 ? Double.MAX_VALUE : (double) yDirection / diffY;
+ final double normalizedZ = zDirection == 0 ? Double.MAX_VALUE : (double) zDirection / diffZ;
+
+ double normalizedXDirection = normalizedX * (xDirection > 0 ? 1.0D - Mth.frac(startX) : Mth.frac(startX));
+ double normalizedYDirection = normalizedY * (yDirection > 0 ? 1.0D - Mth.frac(startY) : Mth.frac(startY));
+ double normalizedZDirection = normalizedZ * (zDirection > 0 ? 1.0D - Mth.frac(startZ) : Mth.frac(startZ));
+
+ net.minecraft.world.phys.BlockHitResult.Type result;
+
+ do {
+ if (normalizedXDirection > 1.0D && normalizedYDirection > 1.0D && normalizedZDirection > 1.0D) {
+ return net.minecraft.world.phys.BlockHitResult.Type.MISS;
+ }
+
+ if (normalizedXDirection < normalizedYDirection) {
+ if (normalizedXDirection < normalizedZDirection) {
+ currentX += xDirection;
+ normalizedXDirection += normalizedX;
+ } else {
+ currentZ += zDirection;
+ normalizedZDirection += normalizedZ;
+ }
+ } else if (normalizedYDirection < normalizedZDirection) {
+ currentY += yDirection;
+ normalizedYDirection += normalizedY;
+ } else {
+ currentZ += zDirection;
+ normalizedZDirection += normalizedZ;
+ }
+
+ currentBlock.set(currentX, currentY, currentZ);
+ if (chunk.getPos().x != currentBlock.getX() >> 4 || chunk.getPos().z != currentBlock.getZ() >> 4) {
+ chunk = this.getChunkIfLoaded(currentBlock);
+ if (chunk == null) {
+ return net.minecraft.world.phys.BlockHitResult.Type.MISS;
+ }
+ }
+ result = this.clipDirect(start, end, currentBlock, chunk.getBlockState(currentBlock), collisionContext);
+ } while (result == null);
+
+ return result;
+ }
+ // Paper end
+
public boolean isInWorldBounds(BlockPos pos) {
return !this.isOutsideBuildHeight(pos) && Level.isInWorldBoundsHorizontal(pos);
}

Datei anzeigen

@ -5,7 +5,7 @@ Subject: [PATCH] handle NaN health/absorb values and repair bad data
diff --git a/src/main/java/net/minecraft/world/entity/LivingEntity.java b/src/main/java/net/minecraft/world/entity/LivingEntity.java
index d8ecc90465dfc54319d7f2478979e9aaee42f5a2..45a93601ff9ec79db0ceefb92eecfc974a775aef 100644
index 53e666df97e74bbb8e96207ebc50e3e9acc455de..8435d0c62c716d4cce5d8b512d8a42658f774876 100644
--- a/src/main/java/net/minecraft/world/entity/LivingEntity.java
+++ b/src/main/java/net/minecraft/world/entity/LivingEntity.java
@@ -794,7 +794,13 @@ public abstract class LivingEntity extends Entity implements Attackable {

Datei anzeigen

@ -6,7 +6,7 @@ Subject: [PATCH] Use a Shared Random for Entities
Reduces memory usage and provides ensures more randomness, Especially since a lot of garbage entity objects get created.
diff --git a/src/main/java/net/minecraft/world/entity/Entity.java b/src/main/java/net/minecraft/world/entity/Entity.java
index 52cb6a57f73749ebebba12a05be56ae923249e5a..c47f727695112010163d6635550f0c5dd5b853f6 100644
index 2d37f4da83282e3430353e01c756a0d952150360..2f15c9df59ebfbe7619e190b8d6ef1fe122809f8 100644
--- a/src/main/java/net/minecraft/world/entity/Entity.java
+++ b/src/main/java/net/minecraft/world/entity/Entity.java
@@ -162,6 +162,79 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource {

Datei anzeigen

@ -29,11 +29,11 @@ index 1b29c6872ebe54351f28c1f1f38b22561ba785ee..40950db0c242c65dfd4de247c8624935
this.x = x;
this.y = y;
diff --git a/src/main/java/net/minecraft/world/level/Level.java b/src/main/java/net/minecraft/world/level/Level.java
index 809f7db469583ea90fbb165cf180dc87055c6105..e5194f0650af2bce8aac24e34752b21015b92d4e 100644
index 37d5abf5a18b90695d1cea9e365c764e93b918bf..5502d037279ba876f5e4c6728cc678f128bce9d4 100644
--- a/src/main/java/net/minecraft/world/level/Level.java
+++ b/src/main/java/net/minecraft/world/level/Level.java
@@ -284,7 +284,7 @@ public abstract class Level implements LevelAccessor, AutoCloseable {
}
@@ -368,7 +368,7 @@ public abstract class Level implements LevelAccessor, AutoCloseable {
// Paper end
public boolean isInWorldBounds(BlockPos pos) {
- return !this.isOutsideBuildHeight(pos) && Level.isInWorldBoundsHorizontal(pos);

Datei anzeigen

@ -30,10 +30,10 @@ index 5cde98b0225799bccdb84ce6b6cf06b904d5986c..699fc5f11efa8240723854cd2e91877b
@Override public LevelChunk getChunkIfLoaded(int x, int z) { // Paper - this was added in world too but keeping here for NMS ABI
return this.chunkSource.getChunk(x, z, false);
diff --git a/src/main/java/net/minecraft/world/level/Level.java b/src/main/java/net/minecraft/world/level/Level.java
index e5194f0650af2bce8aac24e34752b21015b92d4e..127f4e98e11a57eb3dddbc8efdb0aa33fda37924 100644
index 5502d037279ba876f5e4c6728cc678f128bce9d4..ba7760b0b478c6f24dcbaa64919a4766e107a720 100644
--- a/src/main/java/net/minecraft/world/level/Level.java
+++ b/src/main/java/net/minecraft/world/level/Level.java
@@ -496,7 +496,7 @@ public abstract class Level implements LevelAccessor, AutoCloseable {
@@ -580,7 +580,7 @@ public abstract class Level implements LevelAccessor, AutoCloseable {
// CraftBukkit start
iblockdata1.updateIndirectNeighbourShapes(this, blockposition, k, j - 1); // Don't call an event for the old block to limit event spam
CraftWorld world = ((ServerLevel) this).getWorld();

Datei anzeigen

@ -6,7 +6,7 @@ Subject: [PATCH] EntityRegainHealthEvent isFastRegen API
Don't even get me started
diff --git a/src/main/java/net/minecraft/world/entity/LivingEntity.java b/src/main/java/net/minecraft/world/entity/LivingEntity.java
index 45a93601ff9ec79db0ceefb92eecfc974a775aef..c6a30c7558f444318eb4c913a0efdad48878653a 100644
index 8435d0c62c716d4cce5d8b512d8a42658f774876..d7c437dc575a06e1cdf7b393acaeee6007424687 100644
--- a/src/main/java/net/minecraft/world/entity/LivingEntity.java
+++ b/src/main/java/net/minecraft/world/entity/LivingEntity.java
@@ -1291,10 +1291,16 @@ public abstract class LivingEntity extends Entity implements Attackable {

Datei anzeigen

@ -18,7 +18,7 @@ index 0ee486f807d7c44e2252c4c744e29b506d916d9c..b5ededfb23980abca01ef25207cca95a
// Spigot end
io.papermc.paper.chunk.system.io.RegionFileIOThread.close(true); // Paper // Paper - rewrite chunk system
diff --git a/src/main/java/net/minecraft/server/dedicated/DedicatedServer.java b/src/main/java/net/minecraft/server/dedicated/DedicatedServer.java
index 2c2d492fdfafb1d2e4e962e6818bd9d7466347d5..131de2ca246cfbe4cb253e74cb05a73efbbcca73 100644
index 6f543665b5ed42eaec6a410fa11f5a38da707110..52c2333afdb3748ffdbcc58ae7629aa2c4b49b74 100644
--- a/src/main/java/net/minecraft/server/dedicated/DedicatedServer.java
+++ b/src/main/java/net/minecraft/server/dedicated/DedicatedServer.java
@@ -242,7 +242,7 @@ public class DedicatedServer extends MinecraftServer implements ServerInterface

Datei anzeigen

@ -5,7 +5,7 @@ Subject: [PATCH] Optional TNT doesn't move in water
diff --git a/src/main/java/net/minecraft/server/level/ServerEntity.java b/src/main/java/net/minecraft/server/level/ServerEntity.java
index 7bcf878cbb10f4d99e9693532d02b87350da3b06..71219297a175ff9549a258985043df3ce7545ae6 100644
index c6660cc77dfa3c3750b6b4dde5617f00c9de1e0a..ae3d1077b42fb288938a8a65471f00b3f52cb18f 100644
--- a/src/main/java/net/minecraft/server/level/ServerEntity.java
+++ b/src/main/java/net/minecraft/server/level/ServerEntity.java
@@ -70,7 +70,7 @@ public class ServerEntity {

Datei anzeigen

@ -6,7 +6,7 @@ Subject: [PATCH] Faster redstone torch rapid clock removal
Only resize the the redstone torch list once, since resizing arrays / lists is costly
diff --git a/src/main/java/net/minecraft/world/level/Level.java b/src/main/java/net/minecraft/world/level/Level.java
index 127f4e98e11a57eb3dddbc8efdb0aa33fda37924..df194067094dd89423251207e62f477db6546264 100644
index ba7760b0b478c6f24dcbaa64919a4766e107a720..0c6384c6332babf8e517503c2e9b21a9d6e2ed88 100644
--- a/src/main/java/net/minecraft/world/level/Level.java
+++ b/src/main/java/net/minecraft/world/level/Level.java
@@ -173,6 +173,7 @@ public abstract class Level implements LevelAccessor, AutoCloseable {

Datei anzeigen

@ -5,7 +5,7 @@ Subject: [PATCH] Add server-name parameter
diff --git a/src/main/java/org/bukkit/craftbukkit/Main.java b/src/main/java/org/bukkit/craftbukkit/Main.java
index a20eaa9b1d030ccd7e1fc49df47acee46f4e7e20..b96652b7bcad07c39a81858c1a2c285efbf67905 100644
index 268192b06592eaa56a454e0f02b2d848f766d9ac..4646911b65129d49b2398c7d86f2d6aa9213fe97 100644
--- a/src/main/java/org/bukkit/craftbukkit/Main.java
+++ b/src/main/java/org/bukkit/craftbukkit/Main.java
@@ -166,6 +166,14 @@ public class Main {

Datei anzeigen

@ -20,7 +20,7 @@ index 29798faa9cc9aead40e3329307dc63cb7bf838b6..27f99f9ce39aac0bae5e9a7b34fd6383
double deltaZ = this.getZ() - player.getZ();
double distanceSquared = deltaX * deltaX + deltaZ * deltaZ;
diff --git a/src/main/java/net/minecraft/world/entity/boss/wither/WitherBoss.java b/src/main/java/net/minecraft/world/entity/boss/wither/WitherBoss.java
index e23347faf763f22301136a013034367ac847c35b..4576c96f85fe5a614a78e53926dfbc2705618423 100644
index 8d3f3987f2a6816752bdb2e477338d6dbdd6b7b7..c23f05f0d951e0036fe2cf524989747fe236730b 100644
--- a/src/main/java/net/minecraft/world/entity/boss/wither/WitherBoss.java
+++ b/src/main/java/net/minecraft/world/entity/boss/wither/WitherBoss.java
@@ -271,7 +271,7 @@ public class WitherBoss extends Monster implements PowerableMob, RangedAttackMob

Datei anzeigen

@ -5,7 +5,7 @@ Subject: [PATCH] Configurable packet in spam threshold
diff --git a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java
index ae66a8a222bc27986bab0f7896e0eacfd6044b31..a73395c9c599f4f83738672a925e2852ca784cf7 100644
index 39f2db938edad3db6fa83d9f8431a28176d4011a..ed558935e53c3cc5c58e14786cbbd809401ddb81 100644
--- a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java
+++ b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java
@@ -1600,13 +1600,14 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Tic

Datei anzeigen

@ -5,7 +5,7 @@ Subject: [PATCH] Configurable flying kick messages
diff --git a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java
index a73395c9c599f4f83738672a925e2852ca784cf7..631eaf856daa09151e62e192296ba143213d6f29 100644
index ed558935e53c3cc5c58e14786cbbd809401ddb81..683c7fea13705ef78a4fd86f148428bb33956421 100644
--- a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java
+++ b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java
@@ -357,7 +357,7 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Tic

Datei anzeigen

@ -6,10 +6,10 @@ Subject: [PATCH] Optimize World.isLoaded(BlockPosition)Z
Reduce method invocations for World.isLoaded(BlockPosition)Z
diff --git a/src/main/java/net/minecraft/world/level/Level.java b/src/main/java/net/minecraft/world/level/Level.java
index df194067094dd89423251207e62f477db6546264..0a419c98db5f6bb6935e88b640f74c6ec0c5503c 100644
index 0c6384c6332babf8e517503c2e9b21a9d6e2ed88..7b681914b7f9e7fb6d2ea607e0d63ca7024a7ec3 100644
--- a/src/main/java/net/minecraft/world/level/Level.java
+++ b/src/main/java/net/minecraft/world/level/Level.java
@@ -343,6 +343,11 @@ public abstract class Level implements LevelAccessor, AutoCloseable {
@@ -427,6 +427,11 @@ public abstract class Level implements LevelAccessor, AutoCloseable {
return chunk == null ? null : chunk.getFluidState(blockposition);
}

Datei anzeigen

@ -26,7 +26,7 @@ index 32ef3edebe94a2014168b7e438752a80b2687e5f..ab6c58eed6707ab7b0aa3e7549a871ad
// Paper end
buf.writeComponent(this.text);
diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java
index 875784e3d1d89c8fd5e4e3f9cec2e37c93e17570..bef8c20e784244acf17128a68adfe5612812a612 100644
index a6d9dcf8487c63a0469f5fec27bef131b444942a..4cc5ddcf8cf141f023ac45812c0ce26aa2937716 100644
--- a/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java
+++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java
@@ -340,6 +340,29 @@ public class CraftPlayer extends CraftHumanEntity implements Player {

Datei anzeigen

@ -19,7 +19,7 @@ index 9e182c4cdf54c9ca7701660df72052d5c8936a55..5c855a15f7847ca37c263755f643eeb1
@Override
diff --git a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java
index 512129382123d0c06eb308a98a9ee1b268e3b486..c7870a1a81f9c2d84066a39d2606c96f4e4df0bf 100644
index 683c7fea13705ef78a4fd86f148428bb33956421..27ba015a10abea7e120f32565120c34a99b8d55b 100644
--- a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java
+++ b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java
@@ -3161,7 +3161,7 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Tic

Datei anzeigen

@ -7,7 +7,7 @@ Provides counts without the ineffeciency of using .getEntities().size()
which creates copy of the collections.
diff --git a/src/main/java/net/minecraft/world/level/Level.java b/src/main/java/net/minecraft/world/level/Level.java
index 0a419c98db5f6bb6935e88b640f74c6ec0c5503c..92aa1428e723b377c12bfd20cd1e6b4242ad1261 100644
index 7b681914b7f9e7fb6d2ea607e0d63ca7024a7ec3..7cfcbc1e38f5e9145c827dfe26299277a3f14cee 100644
--- a/src/main/java/net/minecraft/world/level/Level.java
+++ b/src/main/java/net/minecraft/world/level/Level.java
@@ -116,7 +116,7 @@ public abstract class Level implements LevelAccessor, AutoCloseable {
@ -20,7 +20,7 @@ index 0a419c98db5f6bb6935e88b640f74c6ec0c5503c..92aa1428e723b377c12bfd20cd1e6b42
private final List<TickingBlockEntity> pendingBlockEntityTickers = Lists.newArrayList();
private boolean tickingBlockEntities;
diff --git a/src/main/java/org/bukkit/craftbukkit/CraftWorld.java b/src/main/java/org/bukkit/craftbukkit/CraftWorld.java
index 4a3593f24fc844a6a8b1b6c28ad2dc9c609c29ad..04a12be27ea3f7b8c0dd2bb2c8f4f0a4b90de1b2 100644
index b3dfa35bc41191883814c78693a0d958ff3bf19b..d348ca56ae452dc80d5dabe874d9f8d72970fc4d 100644
--- a/src/main/java/org/bukkit/craftbukkit/CraftWorld.java
+++ b/src/main/java/org/bukkit/craftbukkit/CraftWorld.java
@@ -154,6 +154,56 @@ public class CraftWorld extends CraftRegionAccessor implements World {

Datei anzeigen

@ -7,7 +7,7 @@ Saving players async is extremely dangerous. This will force it to main
the same way we handle async chunk loads.
diff --git a/src/main/java/net/minecraft/server/players/PlayerList.java b/src/main/java/net/minecraft/server/players/PlayerList.java
index 66b1a4593f9c96dbf7e098411f89dbacd6baf4ba..0eceacb8b58339820a515c59d978239bc5be0731 100644
index 7901a8e3659be05d901fd5140e025392ffa0c27c..cf110171ba47051eab94c0195eb155b685a25dca 100644
--- a/src/main/java/net/minecraft/server/players/PlayerList.java
+++ b/src/main/java/net/minecraft/server/players/PlayerList.java
@@ -1069,11 +1069,13 @@ public abstract class PlayerList {

Datei anzeigen

@ -133,7 +133,7 @@ index 9dffdfe5bbd0517e9a2c6a6770eea07b43ef9b33..6de7fcccb6da757185a38b79b3a22821
@Override
diff --git a/src/main/java/net/minecraft/world/entity/LivingEntity.java b/src/main/java/net/minecraft/world/entity/LivingEntity.java
index c6a30c7558f444318eb4c913a0efdad48878653a..eac1baba1714a9cbfd27170b491788f254a73223 100644
index d7c437dc575a06e1cdf7b393acaeee6007424687..01b9635e71a55f29e565fc095cc53f102945423d 100644
--- a/src/main/java/net/minecraft/world/entity/LivingEntity.java
+++ b/src/main/java/net/minecraft/world/entity/LivingEntity.java
@@ -1759,7 +1759,8 @@ public abstract class LivingEntity extends Entity implements Attackable {

Datei anzeigen

@ -12,7 +12,7 @@ just as it does in Vanilla, but entity pushing logic will be capped.
You can set this to 0 to disable collisions.
diff --git a/src/main/java/net/minecraft/world/entity/Entity.java b/src/main/java/net/minecraft/world/entity/Entity.java
index 5436ec263b56d0601432b46708025b725898b894..019f02d4c0f44155ae248fa04403a174fde65e51 100644
index 069fe5df02806103c9bbef396c2e39ca3be90101..ca46bea3799e1bc962debe742ea75f4d7f4ab771 100644
--- a/src/main/java/net/minecraft/world/entity/Entity.java
+++ b/src/main/java/net/minecraft/world/entity/Entity.java
@@ -387,6 +387,7 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource {
@ -24,7 +24,7 @@ index 5436ec263b56d0601432b46708025b725898b894..019f02d4c0f44155ae248fa04403a174
private org.bukkit.util.Vector origin;
@javax.annotation.Nullable
diff --git a/src/main/java/net/minecraft/world/entity/LivingEntity.java b/src/main/java/net/minecraft/world/entity/LivingEntity.java
index eac1baba1714a9cbfd27170b491788f254a73223..39c69fa6d164b1bcad97a9410953c8998e415d3c 100644
index 01b9635e71a55f29e565fc095cc53f102945423d..0470329b43afd4e8c5e033666d1c5f8f0a03fe6a 100644
--- a/src/main/java/net/minecraft/world/entity/LivingEntity.java
+++ b/src/main/java/net/minecraft/world/entity/LivingEntity.java
@@ -3317,8 +3317,11 @@ public abstract class LivingEntity extends Entity implements Attackable {

Datei anzeigen

@ -14,7 +14,7 @@ To be converted into a Paper-API event at some point in the future?
public net.minecraft.world.entity.player.Player removeEntitiesOnShoulder()V
diff --git a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java
index 12ce6ef8163fa46c1f5bc1f88011cd862b8bad89..42994574854cae3ca288c8ab7698a95a44693314 100644
index 27ba015a10abea7e120f32565120c34a99b8d55b..79ec73cbd1c44ec0ec5c6fff3c70501051a9ba42 100644
--- a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java
+++ b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java
@@ -2331,6 +2331,13 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Tic

Datei anzeigen

@ -311,7 +311,7 @@ index 5abde8722e22e074d4ef44956f7bb5344441e174..bb1280569181e8e3acb78ef622b4d2f9
public KeyPair getKeyPair() {
diff --git a/src/main/java/net/minecraft/server/dedicated/DedicatedServer.java b/src/main/java/net/minecraft/server/dedicated/DedicatedServer.java
index 131de2ca246cfbe4cb253e74cb05a73efbbcca73..72639f33b6503faede1ec0df48d7c6a88b7eb82f 100644
index 52c2333afdb3748ffdbcc58ae7629aa2c4b49b74..97df17a1636ac1ba765a8e486cfbb46bfac9ee6c 100644
--- a/src/main/java/net/minecraft/server/dedicated/DedicatedServer.java
+++ b/src/main/java/net/minecraft/server/dedicated/DedicatedServer.java
@@ -98,6 +98,9 @@ public class DedicatedServer extends MinecraftServer implements ServerInterface

Datei anzeigen

@ -565,7 +565,7 @@ index 0000000000000000000000000000000000000000..7ac27392a8647ef7d0dc78efe78703e9
+ @NotNull GameProfile buildGameProfile();
+}
diff --git a/src/main/java/io/papermc/paper/util/MCUtil.java b/src/main/java/io/papermc/paper/util/MCUtil.java
index 5e17a83df2f3606aff375fe054266d03f9a0b3b6..5448dce87bb5934d4192ce2eb0b99a7b8e1f1ecc 100644
index dc2ab968ed010289125ac08f0a9ea85af6f6e8bb..82a1a87822e3fc323b92e1aa30ddb0cdb351d89c 100644
--- a/src/main/java/io/papermc/paper/util/MCUtil.java
+++ b/src/main/java/io/papermc/paper/util/MCUtil.java
@@ -1,5 +1,7 @@

Datei anzeigen

@ -7,7 +7,7 @@ Subject: [PATCH] LivingEntity#setKiller
public net.minecraft.world.entity.LivingEntity lastHurtByPlayerTime
diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftLivingEntity.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftLivingEntity.java
index 96095cc107d161cad7401725eb70f08203deac9a..303b066aa9dcdb82e7f67160e8ac901374138465 100644
index bba6bce470a11c792bb2edc2171021437e2c9704..24d13be4a5a6cd9d8d9f46c089fd23baa6da954d 100644
--- a/src/main/java/org/bukkit/craftbukkit/entity/CraftLivingEntity.java
+++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftLivingEntity.java
@@ -365,6 +365,16 @@ public class CraftLivingEntity extends CraftEntity implements LivingEntity {

Datei anzeigen

@ -15,7 +15,7 @@ This may cause additional prefixes to be disabled for plugins bypassing
the plugin logger.
diff --git a/build.gradle.kts b/build.gradle.kts
index 4e682e084a7f653ccb90756bab884499861f9060..9013a7218ddf3919e5cddd745d03c73d1b6480ae 100644
index df0c787a6e3cff522dc540aab3986692b4fc4cc3..6e7f341c6ad07152eeeb51b4cb9c237a94fac89b 100644
--- a/build.gradle.kts
+++ b/build.gradle.kts
@@ -25,7 +25,7 @@ dependencies {

Datei anzeigen

@ -5,7 +5,7 @@ Subject: [PATCH] Add PlayerJumpEvent
diff --git a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java
index 42994574854cae3ca288c8ab7698a95a44693314..79769e770e04f0852fabed7dc7367e87bd5be310 100644
index 79ec73cbd1c44ec0ec5c6fff3c70501051a9ba42..cf1d8913d74e2e1c1b8d6be53cdea4873cd2ee10 100644
--- a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java
+++ b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java
@@ -1294,7 +1294,34 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Tic

Datei anzeigen

@ -15,7 +15,7 @@ also adding some additional logging in order to help work out what is causing
random disconnections for clients.
diff --git a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java
index 1f52d3cdb63319b0fe7aa29c34f502f4368646c2..9fdde607ee51da69371cce114c15074beb2d611a 100644
index cf1d8913d74e2e1c1b8d6be53cdea4873cd2ee10..8a331d8a440455b0d49ba0b8bb65184fba13c43a 100644
--- a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java
+++ b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java
@@ -3120,14 +3120,18 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Tic

Datei anzeigen

@ -90,7 +90,7 @@ index 77d7f070cce1a47e41b5d4f5a1cc8c778352a126..a3b610cb1ed97a635677bc46ccdf0463
@Override
diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java
index bef8c20e784244acf17128a68adfe5612812a612..1adad65a3a9a547a4383cc0caa21a6445d072200 100644
index 4cc5ddcf8cf141f023ac45812c0ce26aa2937716..07049ca56e610755bfc41c6094be87f5f88bd671 100644
--- a/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java
+++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java
@@ -286,6 +286,20 @@ public class CraftPlayer extends CraftHumanEntity implements Player {

Datei anzeigen

@ -17,7 +17,7 @@ from networking or during connections flood of chunk packets on slower clients,
at the cost of dead connections being kept open for longer.
diff --git a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java
index 924f520702723b3f44ac990f6222102119d16e9c..31bbd7f9db45f73e34b3cddcf4e66ccd034a1d10 100644
index 8a331d8a440455b0d49ba0b8bb65184fba13c43a..bc5c661394d5c64f9d50a615583ff7eb646534db 100644
--- a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java
+++ b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java
@@ -261,7 +261,7 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Tic

Datei anzeigen

@ -5,7 +5,7 @@ Subject: [PATCH] Add PlayerArmorChangeEvent
diff --git a/src/main/java/net/minecraft/world/entity/LivingEntity.java b/src/main/java/net/minecraft/world/entity/LivingEntity.java
index 39c69fa6d164b1bcad97a9410953c8998e415d3c..b2dc7a83d475c0fcdaec8d1e11bf5bdaac39acdf 100644
index 0470329b43afd4e8c5e033666d1c5f8f0a03fe6a..021f3f81746a6e986c8899aa4b28ef87a67bed44 100644
--- a/src/main/java/net/minecraft/world/entity/LivingEntity.java
+++ b/src/main/java/net/minecraft/world/entity/LivingEntity.java
@@ -1,5 +1,6 @@

Datei anzeigen

@ -5,10 +5,10 @@ Subject: [PATCH] Fix MC-117075: TE Unload Lag Spike
diff --git a/src/main/java/net/minecraft/world/level/Level.java b/src/main/java/net/minecraft/world/level/Level.java
index 92aa1428e723b377c12bfd20cd1e6b4242ad1261..79e23503b7082633de654f04575b8323ea887e44 100644
index 7cfcbc1e38f5e9145c827dfe26299277a3f14cee..22dab285bbcea77d04a8625b025f054c625cadd4 100644
--- a/src/main/java/net/minecraft/world/level/Level.java
+++ b/src/main/java/net/minecraft/world/level/Level.java
@@ -721,6 +721,8 @@ public abstract class Level implements LevelAccessor, AutoCloseable {
@@ -805,6 +805,8 @@ public abstract class Level implements LevelAccessor, AutoCloseable {
// Spigot start
// Iterator iterator = this.blockEntityTickers.iterator();
int tilesThisCycle = 0;
@ -17,7 +17,7 @@ index 92aa1428e723b377c12bfd20cd1e6b4242ad1261..79e23503b7082633de654f04575b8323
for (tileTickPosition = 0; tileTickPosition < this.blockEntityTickers.size(); tileTickPosition++) { // Paper - Disable tick limiters
this.tileTickPosition = (this.tileTickPosition < this.blockEntityTickers.size()) ? this.tileTickPosition : 0;
TickingBlockEntity tickingblockentity = (TickingBlockEntity) this.blockEntityTickers.get(tileTickPosition);
@@ -728,7 +730,6 @@ public abstract class Level implements LevelAccessor, AutoCloseable {
@@ -812,7 +814,6 @@ public abstract class Level implements LevelAccessor, AutoCloseable {
if (tickingblockentity == null) {
this.getCraftServer().getLogger().severe("Spigot has detected a null entity and has removed it, preventing a crash");
tilesThisCycle--;
@ -25,7 +25,7 @@ index 92aa1428e723b377c12bfd20cd1e6b4242ad1261..79e23503b7082633de654f04575b8323
continue;
}
// Spigot end
@@ -736,12 +737,13 @@ public abstract class Level implements LevelAccessor, AutoCloseable {
@@ -820,12 +821,13 @@ public abstract class Level implements LevelAccessor, AutoCloseable {
if (tickingblockentity.isRemoved()) {
// Spigot start
tilesThisCycle--;

Datei anzeigen

@ -18,7 +18,7 @@ the blockstate that will be valid for restoration, as opposed to dropping
information on restoration when the event is cancelled.
diff --git a/src/main/java/net/minecraft/world/level/Level.java b/src/main/java/net/minecraft/world/level/Level.java
index 79e23503b7082633de654f04575b8323ea887e44..b282f32c95b23b69156970d76171772218b87bc7 100644
index 22dab285bbcea77d04a8625b025f054c625cadd4..ce24a52b2b9fb0ae7cfb085a204de8780bc8f5d6 100644
--- a/src/main/java/net/minecraft/world/level/Level.java
+++ b/src/main/java/net/minecraft/world/level/Level.java
@@ -154,7 +154,7 @@ public abstract class Level implements LevelAccessor, AutoCloseable {
@ -30,7 +30,7 @@ index 79e23503b7082633de654f04575b8323ea887e44..b282f32c95b23b69156970d761717722
public Map<BlockPos, BlockEntity> capturedTileEntities = new HashMap<>();
public List<ItemEntity> captureDrops;
public final it.unimi.dsi.fastutil.objects.Object2LongOpenHashMap<SpawnCategory> ticksPerSpawnCategory = new it.unimi.dsi.fastutil.objects.Object2LongOpenHashMap<>();
@@ -385,7 +385,7 @@ public abstract class Level implements LevelAccessor, AutoCloseable {
@@ -469,7 +469,7 @@ public abstract class Level implements LevelAccessor, AutoCloseable {
public boolean setBlock(BlockPos pos, BlockState state, int flags, int maxUpdateDepth) {
// CraftBukkit start - tree generation
if (this.captureTreeGeneration) {
@ -39,7 +39,7 @@ index 79e23503b7082633de654f04575b8323ea887e44..b282f32c95b23b69156970d761717722
if (blockstate == null) {
blockstate = CapturedBlockState.getTreeBlockState(this, pos, flags);
this.capturedBlockStates.put(pos.immutable(), blockstate);
@@ -405,7 +405,8 @@ public abstract class Level implements LevelAccessor, AutoCloseable {
@@ -489,7 +489,8 @@ public abstract class Level implements LevelAccessor, AutoCloseable {
// CraftBukkit start - capture blockstates
boolean captured = false;
if (this.captureBlockStates && !this.capturedBlockStates.containsKey(pos)) {
@ -49,7 +49,7 @@ index 79e23503b7082633de654f04575b8323ea887e44..b282f32c95b23b69156970d761717722
this.capturedBlockStates.put(pos.immutable(), blockstate);
captured = true;
}
@@ -611,7 +612,7 @@ public abstract class Level implements LevelAccessor, AutoCloseable {
@@ -695,7 +696,7 @@ public abstract class Level implements LevelAccessor, AutoCloseable {
public BlockState getBlockState(BlockPos pos) {
// CraftBukkit start - tree generation
if (this.captureTreeGeneration) {

Datei anzeigen

@ -16,7 +16,7 @@ Also adds isCommand and getLocation to the sync TabCompleteEvent
Co-authored-by: Aikar <aikar@aikar.co>
diff --git a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java
index 31bbd7f9db45f73e34b3cddcf4e66ccd034a1d10..e97e0ea9c44a959c17849eac3fcecf4eff04d275 100644
index bc5c661394d5c64f9d50a615583ff7eb646534db..74adfbde6e4635390a29f8e9155fa61a30631055 100644
--- a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java
+++ b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java
@@ -790,12 +790,16 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Tic

Datei anzeigen

@ -14,7 +14,7 @@ public net.minecraft.world.entity.ExperienceOrb durabilityToXp(I)I
public net.minecraft.world.entity.ExperienceOrb xpToDurability(I)I
diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java
index 1adad65a3a9a547a4383cc0caa21a6445d072200..063150563e35a3eeb6999f1b5b34de3f60318f66 100644
index 07049ca56e610755bfc41c6094be87f5f88bd671..d65866df71add5da89de3bfb3bd3d12ac59a0c87 100644
--- a/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java
+++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java
@@ -1538,7 +1538,37 @@ public class CraftPlayer extends CraftHumanEntity implements Player {

Datei anzeigen

@ -60,7 +60,7 @@ index b0687dcf8af84af627b67e7fbb68170a2fd28da0..5cb151a7d89c7281b03f24c5f79afb7e
while (iterator1.hasNext()) {
diff --git a/src/main/java/net/minecraft/server/level/ServerPlayer.java b/src/main/java/net/minecraft/server/level/ServerPlayer.java
index 6051ad00973c80ad3478e2ff9063c268489f358b..dda3b911fcaa294ec7b8e9d696880fcb8325f69c 100644
index 5c855a15f7847ca37c263755f643eeb1fd79668b..3842caf61e388aa65b3a18c587480a7dabb8341b 100644
--- a/src/main/java/net/minecraft/server/level/ServerPlayer.java
+++ b/src/main/java/net/minecraft/server/level/ServerPlayer.java
@@ -1,5 +1,6 @@

Einige Dateien werden nicht angezeigt, da zu viele Dateien in diesem Diff geändert wurden Mehr anzeigen