aboutsummaryrefslogtreecommitdiffhomepage
path: root/paper-server
diff options
context:
space:
mode:
authorLulu13022002 <[email protected]>2024-12-18 19:09:46 +0100
committerLulu13022002 <[email protected]>2024-12-18 19:29:39 +0100
commit6126012369a8a1d59a2bd091f7a270e90585b181 (patch)
tree6590a79db4a441fd8c12b4b0c62c0f746baad8d1 /paper-server
parentdedc6b339453647f1e8e22bb61f378cfffb6510d (diff)
downloadPaper-6126012369a8a1d59a2bd091f7a270e90585b181.tar.gz
Paper-6126012369a8a1d59a2bd091f7a270e90585b181.zip
readd beacon effect cause
Diffstat (limited to 'paper-server')
-rw-r--r--paper-server/patches/features/0004-Optimize-Network-Manager-and-add-advanced-packet-sup.patch28
-rw-r--r--paper-server/patches/features/0006-Entity-Activation-Range-2.0.patch16
-rw-r--r--paper-server/patches/features/0007-Anti-Xray.patch16
-rw-r--r--paper-server/patches/features/0008-Use-Velocity-compression-and-cipher-natives.patch22
-rw-r--r--paper-server/patches/features/0022-Lag-compensation-ticks.patch12
-rw-r--r--paper-server/patches/features/0024-Add-Alternate-Current-redstone-implementation.patch6
-rw-r--r--paper-server/patches/features/0025-Improve-exact-choice-recipe-ingredients.patch4
-rw-r--r--paper-server/patches/sources/com/mojang/brigadier/CommandDispatcher.java.patch8
-rw-r--r--paper-server/patches/sources/net/minecraft/commands/Commands.java.patch4
-rw-r--r--paper-server/patches/sources/net/minecraft/nbt/ByteArrayTag.java.patch2
-rw-r--r--paper-server/patches/sources/net/minecraft/nbt/IntArrayTag.java.patch2
-rw-r--r--paper-server/patches/sources/net/minecraft/nbt/NbtIo.java.patch7
-rw-r--r--paper-server/patches/sources/net/minecraft/network/Connection.java.patch16
-rw-r--r--paper-server/patches/sources/net/minecraft/network/protocol/game/ClientboundSetEquipmentPacket.java.patch2
-rw-r--r--paper-server/patches/sources/net/minecraft/network/protocol/game/ClientboundSetPlayerTeamPacket.java.patch2
-rw-r--r--paper-server/patches/sources/net/minecraft/server/Main.java.patch31
-rw-r--r--paper-server/patches/sources/net/minecraft/server/MinecraftServer.java.patch21
-rw-r--r--paper-server/patches/sources/net/minecraft/server/ServerTickRateManager.java.patch4
-rw-r--r--paper-server/patches/sources/net/minecraft/server/commands/LootCommand.java.patch10
-rw-r--r--paper-server/patches/sources/net/minecraft/server/dedicated/DedicatedServer.java.patch24
-rw-r--r--paper-server/patches/sources/net/minecraft/server/dedicated/Settings.java.patch2
-rw-r--r--paper-server/patches/sources/net/minecraft/server/level/ChunkMap.java.patch16
-rw-r--r--paper-server/patches/sources/net/minecraft/server/level/ServerChunkCache.java.patch4
-rw-r--r--paper-server/patches/sources/net/minecraft/server/level/ServerLevel.java.patch52
-rw-r--r--paper-server/patches/sources/net/minecraft/server/level/ServerPlayer.java.patch10
-rw-r--r--paper-server/patches/sources/net/minecraft/server/level/ServerPlayerGameMode.java.patch20
-rw-r--r--paper-server/patches/sources/net/minecraft/server/network/ServerGamePacketListenerImpl.java.patch15
-rw-r--r--paper-server/patches/sources/net/minecraft/server/network/ServerHandshakePacketListenerImpl.java.patch22
-rw-r--r--paper-server/patches/sources/net/minecraft/server/players/GameProfileCache.java.patch8
-rw-r--r--paper-server/patches/sources/net/minecraft/server/players/PlayerList.java.patch4
-rw-r--r--paper-server/patches/sources/net/minecraft/server/players/StoredUserList.java.patch6
-rw-r--r--paper-server/patches/sources/net/minecraft/server/players/UserBanListEntry.java.patch12
-rw-r--r--paper-server/patches/sources/net/minecraft/stats/ServerRecipeBook.java.patch2
-rw-r--r--paper-server/patches/sources/net/minecraft/stats/ServerStatsCounter.java.patch11
-rw-r--r--paper-server/patches/sources/net/minecraft/world/CompoundContainer.java.patch2
-rw-r--r--paper-server/patches/sources/net/minecraft/world/entity/Entity.java.patch21
-rw-r--r--paper-server/patches/sources/net/minecraft/world/entity/LightningBolt.java.patch2
-rw-r--r--paper-server/patches/sources/net/minecraft/world/entity/LivingEntity.java.patch2
-rw-r--r--paper-server/patches/sources/net/minecraft/world/entity/ai/goal/FloatGoal.java.patch2
-rw-r--r--paper-server/patches/sources/net/minecraft/world/entity/ai/navigation/PathNavigation.java.patch2
-rw-r--r--paper-server/patches/sources/net/minecraft/world/entity/animal/AbstractSchoolingFish.java.patch2
-rw-r--r--paper-server/patches/sources/net/minecraft/world/entity/animal/Animal.java.patch4
-rw-r--r--paper-server/patches/sources/net/minecraft/world/entity/animal/Bee.java.patch18
-rw-r--r--paper-server/patches/sources/net/minecraft/world/entity/animal/Dolphin.java.patch13
-rw-r--r--paper-server/patches/sources/net/minecraft/world/entity/animal/axolotl/Axolotl.java.patch10
-rw-r--r--paper-server/patches/sources/net/minecraft/world/entity/animal/goat/Goat.java.patch3
-rw-r--r--paper-server/patches/sources/net/minecraft/world/entity/animal/horse/AbstractChestedHorse.java.patch3
-rw-r--r--paper-server/patches/sources/net/minecraft/world/entity/animal/horse/AbstractHorse.java.patch8
-rw-r--r--paper-server/patches/sources/net/minecraft/world/entity/animal/sniffer/Sniffer.java.patch6
-rw-r--r--paper-server/patches/sources/net/minecraft/world/entity/boss/enderdragon/EnderDragon.java.patch34
-rw-r--r--paper-server/patches/sources/net/minecraft/world/entity/boss/enderdragon/phases/DragonStrafePlayerPhase.java.patch2
-rw-r--r--paper-server/patches/sources/net/minecraft/world/entity/boss/enderdragon/phases/EnderDragonPhaseManager.java.patch5
-rw-r--r--paper-server/patches/sources/net/minecraft/world/entity/boss/wither/WitherBoss.java.patch32
-rw-r--r--paper-server/patches/sources/net/minecraft/world/entity/decoration/ArmorStand.java.patch13
-rw-r--r--paper-server/patches/sources/net/minecraft/world/entity/item/FallingBlockEntity.java.patch24
-rw-r--r--paper-server/patches/sources/net/minecraft/world/entity/item/ItemEntity.java.patch16
-rw-r--r--paper-server/patches/sources/net/minecraft/world/entity/item/PrimedTnt.java.patch6
-rw-r--r--paper-server/patches/sources/net/minecraft/world/entity/monster/Bogged.java.patch12
-rw-r--r--paper-server/patches/sources/net/minecraft/world/entity/monster/Creeper.java.patch9
-rw-r--r--paper-server/patches/sources/net/minecraft/world/entity/monster/EnderMan.java.patch11
-rw-r--r--paper-server/patches/sources/net/minecraft/world/entity/monster/Ghast.java.patch2
-rw-r--r--paper-server/patches/sources/net/minecraft/world/entity/monster/Phantom.java.patch37
-rw-r--r--paper-server/patches/sources/net/minecraft/world/entity/monster/Slime.java.patch3
-rw-r--r--paper-server/patches/sources/net/minecraft/world/entity/npc/WanderingTrader.java.patch2
-rw-r--r--paper-server/patches/sources/net/minecraft/world/inventory/AbstractContainerMenu.java.patch13
-rw-r--r--paper-server/patches/sources/net/minecraft/world/inventory/BrewingStandMenu.java.patch5
-rw-r--r--paper-server/patches/sources/net/minecraft/world/inventory/CartographyTableMenu.java.patch6
-rw-r--r--paper-server/patches/sources/net/minecraft/world/inventory/EnchantmentMenu.java.patch11
-rw-r--r--paper-server/patches/sources/net/minecraft/world/inventory/LecternMenu.java.patch4
-rw-r--r--paper-server/patches/sources/net/minecraft/world/inventory/MerchantContainer.java.patch8
-rw-r--r--paper-server/patches/sources/net/minecraft/world/inventory/StonecutterMenu.java.patch2
-rw-r--r--paper-server/patches/sources/net/minecraft/world/item/FireworkRocketItem.java.patch2
-rw-r--r--paper-server/patches/sources/net/minecraft/world/item/ItemStack.java.patch17
-rw-r--r--paper-server/patches/sources/net/minecraft/world/level/BaseSpawner.java.patch4
-rw-r--r--paper-server/patches/sources/net/minecraft/world/level/GameRules.java.patch6
-rw-r--r--paper-server/patches/sources/net/minecraft/world/level/Level.java.patch11
-rw-r--r--paper-server/patches/sources/net/minecraft/world/level/NaturalSpawner.java.patch2
-rw-r--r--paper-server/patches/sources/net/minecraft/world/level/ServerExplosion.java.patch19
-rw-r--r--paper-server/patches/sources/net/minecraft/world/level/block/Block.java.patch2
-rw-r--r--paper-server/patches/sources/net/minecraft/world/level/block/CeilingHangingSignBlock.java.patch2
-rw-r--r--paper-server/patches/sources/net/minecraft/world/level/block/CropBlock.java.patch4
-rw-r--r--paper-server/patches/sources/net/minecraft/world/level/block/EnderChestBlock.java.patch2
-rw-r--r--paper-server/patches/sources/net/minecraft/world/level/block/GrowingPlantHeadBlock.java.patch14
-rw-r--r--paper-server/patches/sources/net/minecraft/world/level/block/NetherPortalBlock.java.patch2
-rw-r--r--paper-server/patches/sources/net/minecraft/world/level/block/ShulkerBoxBlock.java.patch2
-rw-r--r--paper-server/patches/sources/net/minecraft/world/level/block/SignBlock.java.patch2
-rw-r--r--paper-server/patches/sources/net/minecraft/world/level/block/WallHangingSignBlock.java.patch2
-rw-r--r--paper-server/patches/sources/net/minecraft/world/level/block/entity/BeaconBlockEntity.java.patch7
-rw-r--r--paper-server/patches/sources/net/minecraft/world/level/block/entity/HopperBlockEntity.java.patch2
-rw-r--r--paper-server/patches/sources/net/minecraft/world/level/chunk/ChunkAccess.java.patch2
-rw-r--r--paper-server/patches/sources/net/minecraft/world/level/chunk/LevelChunk.java.patch2
-rw-r--r--paper-server/patches/sources/net/minecraft/world/level/levelgen/PatrolSpawner.java.patch2
-rw-r--r--paper-server/patches/sources/net/minecraft/world/level/levelgen/PhantomSpawner.java.patch2
-rw-r--r--paper-server/patches/sources/net/minecraft/world/level/material/FlowingFluid.java.patch2
-rw-r--r--paper-server/patches/sources/net/minecraft/world/level/redstone/NeighborUpdater.java.patch4
-rw-r--r--paper-server/patches/sources/net/minecraft/world/level/storage/PlayerDataStorage.java.patch10
-rw-r--r--paper-server/src/main/java/org/bukkit/craftbukkit/CraftServer.java13
-rw-r--r--paper-server/src/main/java/org/bukkit/craftbukkit/Main.java4
-rw-r--r--paper-server/src/main/java/org/bukkit/craftbukkit/entity/CraftEnderDragon.java2
-rw-r--r--paper-server/src/main/java/org/bukkit/craftbukkit/entity/CraftPhantom.java6
-rw-r--r--paper-server/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java2
-rw-r--r--paper-server/src/main/java/org/bukkit/craftbukkit/inventory/CraftMetaItem.java2
102 files changed, 443 insertions, 488 deletions
diff --git a/paper-server/patches/features/0004-Optimize-Network-Manager-and-add-advanced-packet-sup.patch b/paper-server/patches/features/0004-Optimize-Network-Manager-and-add-advanced-packet-sup.patch
index b3be838455..df7d1df9fc 100644
--- a/paper-server/patches/features/0004-Optimize-Network-Manager-and-add-advanced-packet-sup.patch
+++ b/paper-server/patches/features/0004-Optimize-Network-Manager-and-add-advanced-packet-sup.patch
@@ -28,7 +28,7 @@ and then catch exceptions and close if they fire.
Part of this commit was authored by: Spottedleaf, sandtechnology
diff --git a/net/minecraft/network/Connection.java b/net/minecraft/network/Connection.java
-index b624f001ba9d98c4dc68fcd66c0bc2de0a12308c..c4bb28857ee11dccc9924666634488044c666fd1 100644
+index 18f25bc6ada79fd51eb7522a917236299616a371..1672bd0eeea8db44016bbbccf9a332c7f45fdb54 100644
--- a/net/minecraft/network/Connection.java
+++ b/net/minecraft/network/Connection.java
@@ -85,7 +85,7 @@ public class Connection extends SimpleChannelInboundHandler<Packet<?>> {
@@ -39,7 +39,7 @@ index b624f001ba9d98c4dc68fcd66c0bc2de0a12308c..c4bb28857ee11dccc992466663448804
+ private final Queue<WrappedConsumer> pendingActions = Queues.newConcurrentLinkedQueue(); // Paper - Optimize network
public Channel channel;
public SocketAddress address;
- // Spigot Start
+ // Spigot start
@@ -145,6 +145,10 @@ public class Connection extends SimpleChannelInboundHandler<Packet<?>> {
}
// Paper end - packet limiter
@@ -51,7 +51,7 @@ index b624f001ba9d98c4dc68fcd66c0bc2de0a12308c..c4bb28857ee11dccc992466663448804
public Connection(PacketFlow receiving) {
this.receiving = receiving;
-@@ -425,11 +429,38 @@ public class Connection extends SimpleChannelInboundHandler<Packet<?>> {
+@@ -423,11 +427,38 @@ public class Connection extends SimpleChannelInboundHandler<Packet<?>> {
}
public void send(Packet<?> packet, @Nullable PacketSendListener listener, boolean flush) {
@@ -93,7 +93,7 @@ index b624f001ba9d98c4dc68fcd66c0bc2de0a12308c..c4bb28857ee11dccc992466663448804
}
}
-@@ -438,7 +469,7 @@ public class Connection extends SimpleChannelInboundHandler<Packet<?>> {
+@@ -436,7 +467,7 @@ public class Connection extends SimpleChannelInboundHandler<Packet<?>> {
this.flushQueue();
action.accept(this);
} else {
@@ -102,7 +102,7 @@ index b624f001ba9d98c4dc68fcd66c0bc2de0a12308c..c4bb28857ee11dccc992466663448804
}
}
-@@ -452,6 +483,14 @@ public class Connection extends SimpleChannelInboundHandler<Packet<?>> {
+@@ -450,6 +481,14 @@ public class Connection extends SimpleChannelInboundHandler<Packet<?>> {
}
private void doSendPacket(Packet<?> packet, @Nullable PacketSendListener sendListener, boolean flush) {
@@ -117,7 +117,7 @@ index b624f001ba9d98c4dc68fcd66c0bc2de0a12308c..c4bb28857ee11dccc992466663448804
ChannelFuture channelFuture = flush ? this.channel.writeAndFlush(packet) : this.channel.write(packet);
if (sendListener != null) {
channelFuture.addListener(future -> {
-@@ -467,14 +506,24 @@ public class Connection extends SimpleChannelInboundHandler<Packet<?>> {
+@@ -465,14 +504,24 @@ public class Connection extends SimpleChannelInboundHandler<Packet<?>> {
});
}
@@ -143,7 +143,7 @@ index b624f001ba9d98c4dc68fcd66c0bc2de0a12308c..c4bb28857ee11dccc992466663448804
}
}
-@@ -486,16 +535,57 @@ public class Connection extends SimpleChannelInboundHandler<Packet<?>> {
+@@ -484,16 +533,57 @@ public class Connection extends SimpleChannelInboundHandler<Packet<?>> {
}
}
@@ -206,15 +206,15 @@ index b624f001ba9d98c4dc68fcd66c0bc2de0a12308c..c4bb28857ee11dccc992466663448804
private static final int MAX_PER_TICK = io.papermc.paper.configuration.GlobalConfiguration.get().misc.maxJoinsPerTick; // Paper - Buffer joins to world
private static int joinAttemptsThisTick; // Paper - Buffer joins to world
-@@ -561,6 +651,7 @@ public class Connection extends SimpleChannelInboundHandler<Packet<?>> {
- // Spigot Start
- this.preparing = false;
- // Spigot End
+@@ -557,6 +647,7 @@ public class Connection extends SimpleChannelInboundHandler<Packet<?>> {
+
+ public void disconnect(DisconnectionDetails disconnectionDetails) {
+ this.preparing = false; // Spigot
+ this.clearPacketQueue(); // Paper - Optimize network
if (this.channel == null) {
this.delayedDisconnect = disconnectionDetails;
}
-@@ -749,7 +840,7 @@ public class Connection extends SimpleChannelInboundHandler<Packet<?>> {
+@@ -745,7 +836,7 @@ public class Connection extends SimpleChannelInboundHandler<Packet<?>> {
public void handleDisconnection() {
if (this.channel != null && !this.channel.isOpen()) {
if (this.disconnectionHandled) {
@@ -223,7 +223,7 @@ index b624f001ba9d98c4dc68fcd66c0bc2de0a12308c..c4bb28857ee11dccc992466663448804
} else {
this.disconnectionHandled = true;
PacketListener packetListener = this.getPacketListener();
-@@ -760,7 +851,7 @@ public class Connection extends SimpleChannelInboundHandler<Packet<?>> {
+@@ -756,7 +847,7 @@ public class Connection extends SimpleChannelInboundHandler<Packet<?>> {
);
packetListener1.onDisconnect(disconnectionDetails);
}
@@ -232,7 +232,7 @@ index b624f001ba9d98c4dc68fcd66c0bc2de0a12308c..c4bb28857ee11dccc992466663448804
// Paper start - Add PlayerConnectionCloseEvent
if (packetListener instanceof net.minecraft.server.network.ServerCommonPacketListenerImpl commonPacketListener) {
/* Player was logged in, either game listener or configuration listener */
-@@ -795,4 +886,93 @@ public class Connection extends SimpleChannelInboundHandler<Packet<?>> {
+@@ -791,4 +882,93 @@ public class Connection extends SimpleChannelInboundHandler<Packet<?>> {
public void setBandwidthLogger(LocalSampleLogger bandwithLogger) {
this.bandwidthDebugMonitor = new BandwidthDebugMonitor(bandwithLogger);
}
diff --git a/paper-server/patches/features/0006-Entity-Activation-Range-2.0.patch b/paper-server/patches/features/0006-Entity-Activation-Range-2.0.patch
index 322c566db9..811fc15914 100644
--- a/paper-server/patches/features/0006-Entity-Activation-Range-2.0.patch
+++ b/paper-server/patches/features/0006-Entity-Activation-Range-2.0.patch
@@ -338,7 +338,7 @@ index 0000000000000000000000000000000000000000..bd888ef719b9bfc93bace0b1d0fb771a
+ }
+}
diff --git a/net/minecraft/server/level/ChunkMap.java b/net/minecraft/server/level/ChunkMap.java
-index 9bbcafa8e70f95d5ab6318211a0265acbfc76b1c..f8f145cd9614f7e38d6aa72501fe31837340a8bb 100644
+index 8569f0670c13e3f635ef529f00e636bf7bca38b5..76e59a8b07ac58a38f368386e03aaa3d8586e21d 100644
--- a/net/minecraft/server/level/ChunkMap.java
+++ b/net/minecraft/server/level/ChunkMap.java
@@ -4,7 +4,6 @@ import com.google.common.collect.ImmutableList;
@@ -366,7 +366,7 @@ index 9bbcafa8e70f95d5ab6318211a0265acbfc76b1c..f8f145cd9614f7e38d6aa72501fe3183
import org.slf4j.Logger;
diff --git a/net/minecraft/server/level/ServerLevel.java b/net/minecraft/server/level/ServerLevel.java
-index cce78d73e8adafd66d0f3ffb3fabb5e6c025c7df..a4b523ac1926895ccc87464892fa81753ae8f73c 100644
+index 2e479c02794de1eb9753b6f1e59afc2d9d6981ba..7702004b68b7735043914f93b54b4413cd21ba41 100644
--- a/net/minecraft/server/level/ServerLevel.java
+++ b/net/minecraft/server/level/ServerLevel.java
@@ -551,6 +551,7 @@ public class ServerLevel extends Level implements ServerEntityGetter, WorldGenLe
@@ -472,10 +472,10 @@ index b4a1202a9f43525caf215d2f5c86ad92ea4f6de7..47db6ac3ef23fd0da127cfb5a4d3ba9e
public void tick() {
super.tick();
diff --git a/net/minecraft/world/entity/Entity.java b/net/minecraft/world/entity/Entity.java
-index 020d05bb60abec10fa37e651c17f600c883af61d..2e5f1dc15ea6a20f8cbdef97ecbf00e5d56603cf 100644
+index 61b779fc48d88a2ba0cb7c289e7c031877bac61b..32ca912230a5999ea244cdf1c5c54855844f571b 100644
--- a/net/minecraft/world/entity/Entity.java
+++ b/net/minecraft/world/entity/Entity.java
-@@ -386,6 +386,15 @@ public abstract class Entity implements SyncedDataHolder, Nameable, EntityAccess
+@@ -380,6 +380,15 @@ public abstract class Entity implements SyncedDataHolder, Nameable, EntityAccess
public boolean fixedPose = false; // Paper - Expand Pose API
private final int despawnTime; // Paper - entity despawn time limit
public final io.papermc.paper.entity.activation.ActivationType activationType = io.papermc.paper.entity.activation.ActivationType.activationTypeFor(this); // Paper - EAR 2/tracking ranges
@@ -491,7 +491,7 @@ index 020d05bb60abec10fa37e651c17f600c883af61d..2e5f1dc15ea6a20f8cbdef97ecbf00e5
public void setOrigin(@javax.annotation.Nonnull org.bukkit.Location location) {
this.origin = location.toVector();
-@@ -423,6 +432,13 @@ public abstract class Entity implements SyncedDataHolder, Nameable, EntityAccess
+@@ -417,6 +426,13 @@ public abstract class Entity implements SyncedDataHolder, Nameable, EntityAccess
this.position = Vec3.ZERO;
this.blockPosition = BlockPos.ZERO;
this.chunkPosition = ChunkPos.ZERO;
@@ -529,7 +529,7 @@ index 020d05bb60abec10fa37e651c17f600c883af61d..2e5f1dc15ea6a20f8cbdef97ecbf00e5
movement = this.maybeBackOffFromEdge(movement, type);
Vec3 vec3 = this.collide(movement);
diff --git a/net/minecraft/world/entity/LivingEntity.java b/net/minecraft/world/entity/LivingEntity.java
-index 41ef8c24903e5efceead43796e647824a54193df..9de400977ec33e485e87cdf1cf145588527e1e10 100644
+index fa67721bc0aa2d5b920d691f34d81d0a1feec202..c853c5ff5a9422b9a17be34102f80348ca89cad6 100644
--- a/net/minecraft/world/entity/LivingEntity.java
+++ b/net/minecraft/world/entity/LivingEntity.java
@@ -3089,6 +3089,14 @@ public abstract class LivingEntity extends Entity implements Attackable {
@@ -647,7 +647,7 @@ index 789fea258d70e60d38271ebb31270562dc7eb3ab..d0ab3db7bbd2942db19f473474371b20
}
}
diff --git a/net/minecraft/world/entity/item/ItemEntity.java b/net/minecraft/world/entity/item/ItemEntity.java
-index 1c82a41acb8717b2c56498602fd1ecbe6aa58fe5..dcbd35d6bf81d7a0621020710114887b68a7dcc6 100644
+index a9c7cf74174a2c998c182da149bdfeb87cca7b8d..e346edacf7705faf867430c9c44b8322a2bd9d72 100644
--- a/net/minecraft/world/entity/item/ItemEntity.java
+++ b/net/minecraft/world/entity/item/ItemEntity.java
@@ -124,6 +124,29 @@ public class ItemEntity extends Entity implements TraceableEntity {
@@ -824,7 +824,7 @@ index c553cf0592dfa606dbbb1e6854d3377b9feb5efb..dec705ec57e4f63ef2ccaa87c5400c11
+
}
diff --git a/net/minecraft/world/level/Level.java b/net/minecraft/world/level/Level.java
-index 691fee2e2097244126f4fac0f5d00bf6916b9766..25fb8a91bd3012da383711d58cc25cbada510f56 100644
+index b6342c7161c2539b316be53e72640d44ce576b79..13dbd0da80b2199519370ac6e993ace53f42c1ea 100644
--- a/net/minecraft/world/level/Level.java
+++ b/net/minecraft/world/level/Level.java
@@ -153,6 +153,12 @@ public abstract class Level implements LevelAccessor, AutoCloseable {
diff --git a/paper-server/patches/features/0007-Anti-Xray.patch b/paper-server/patches/features/0007-Anti-Xray.patch
index 8e51f5c6ae..801b9fcda9 100644
--- a/paper-server/patches/features/0007-Anti-Xray.patch
+++ b/paper-server/patches/features/0007-Anti-Xray.patch
@@ -5,7 +5,7 @@ Subject: [PATCH] Anti-Xray
diff --git a/io/papermc/paper/FeatureHooks.java b/io/papermc/paper/FeatureHooks.java
-index 0eba4fce940b90e67f3746480c040178ba9f5525..3bdbd3d566dee767204d898e0bb4f82f0060d9ca 100644
+index 1e5d94cdcdffb4d2940f17bacdf0e6a488e84318..d3aebc7f833764351c8e5fe1fad1aa2f8718ca37 100644
--- a/io/papermc/paper/FeatureHooks.java
+++ b/io/papermc/paper/FeatureHooks.java
@@ -7,6 +7,7 @@ import it.unimi.dsi.fastutil.longs.LongSets;
@@ -153,7 +153,7 @@ index 3a384175f8e7f204234bbaf3081bdc20c47a0d4b..5699bc15eba92e22433a20cb8326b59f
private ClientboundLevelChunkWithLightPacket(RegistryFriendlyByteBuf buffer) {
diff --git a/net/minecraft/server/level/ServerLevel.java b/net/minecraft/server/level/ServerLevel.java
-index a4b523ac1926895ccc87464892fa81753ae8f73c..ca9427a7eae9a66f4f1ccedda7b1def7ac2a88da 100644
+index 7702004b68b7735043914f93b54b4413cd21ba41..4d20bda4cba578c47216d450c99389b744a59008 100644
--- a/net/minecraft/server/level/ServerLevel.java
+++ b/net/minecraft/server/level/ServerLevel.java
@@ -348,7 +348,7 @@ public class ServerLevel extends Level implements ServerEntityGetter, WorldGenLe
@@ -166,7 +166,7 @@ index a4b523ac1926895ccc87464892fa81753ae8f73c..ca9427a7eae9a66f4f1ccedda7b1def7
this.levelStorageAccess = levelStorageAccess;
this.uuid = org.bukkit.craftbukkit.util.WorldUUID.getUUID(levelStorageAccess.levelDirectory.path().toFile());
diff --git a/net/minecraft/server/level/ServerPlayerGameMode.java b/net/minecraft/server/level/ServerPlayerGameMode.java
-index 732a4f20bade67c57a4f85142849752b72e349ee..6176f0738aa1a18df5d7d4d49fd6961e3f2eb736 100644
+index d7028ed8ebdecd647467b67f62f7431a6df59f76..9fdb825be2b04a5806bbb3d39948bad0863e7ae5 100644
--- a/net/minecraft/server/level/ServerPlayerGameMode.java
+++ b/net/minecraft/server/level/ServerPlayerGameMode.java
@@ -312,6 +312,7 @@ public class ServerPlayerGameMode {
@@ -196,7 +196,7 @@ index 342bc843c384761e883de861044f4f8930ae8763..14878690a88fd4de3e2c127086607e6c
if (io.papermc.paper.event.packet.PlayerChunkLoadEvent.getHandlerList().getRegisteredListeners().length > 0) {
new io.papermc.paper.event.packet.PlayerChunkLoadEvent(new org.bukkit.craftbukkit.CraftChunk(chunk), packetListener.getPlayer().getBukkitEntity()).callEvent();
diff --git a/net/minecraft/server/players/PlayerList.java b/net/minecraft/server/players/PlayerList.java
-index 2580b249d9a024400e295ca5beab551b3571ceb3..d227714de0fe13544779fae6cf0e9ff6af5469c7 100644
+index 8a93d1034eb0dab4b4010d52ddbb0caa5697416d..bafeeab3edbc73f6f86474e18ab4a3d96ce17157 100644
--- a/net/minecraft/server/players/PlayerList.java
+++ b/net/minecraft/server/players/PlayerList.java
@@ -404,7 +404,7 @@ public abstract class PlayerList {
@@ -209,7 +209,7 @@ index 2580b249d9a024400e295ca5beab551b3571ceb3..d227714de0fe13544779fae6cf0e9ff6
}
// Paper end - Send empty chunk
diff --git a/net/minecraft/world/level/Level.java b/net/minecraft/world/level/Level.java
-index 25fb8a91bd3012da383711d58cc25cbada510f56..872c3b8826f436b15f6ab0a3619692c5202eadc3 100644
+index 13dbd0da80b2199519370ac6e993ace53f42c1ea..0e4ab448755632696c4326f1df9f3855cd38a64d 100644
--- a/net/minecraft/world/level/Level.java
+++ b/net/minecraft/world/level/Level.java
@@ -168,6 +168,7 @@ public abstract class Level implements LevelAccessor, AutoCloseable {
@@ -247,7 +247,7 @@ index 25fb8a91bd3012da383711d58cc25cbada510f56..872c3b8826f436b15f6ab0a3619692c5
if (blockState == null) {
// CraftBukkit start - remove blockstate if failed (or the same)
diff --git a/net/minecraft/world/level/chunk/ChunkAccess.java b/net/minecraft/world/level/chunk/ChunkAccess.java
-index 12d9b532e466ec4e46920d409b5f1b3ae60b80f8..bc688ad1097ef4159dfc5f96d963a9fa63262e20 100644
+index 809b3c37d3749c76c3c243cd91c593d03693e9b3..860d1c9729c4ee97ec6f40f7aa969829070b27c0 100644
--- a/net/minecraft/world/level/chunk/ChunkAccess.java
+++ b/net/minecraft/world/level/chunk/ChunkAccess.java
@@ -114,14 +114,14 @@ public abstract class ChunkAccess implements BiomeManager.NoiseBiomeSource, Ligh
@@ -256,7 +256,7 @@ index 12d9b532e466ec4e46920d409b5f1b3ae60b80f8..bc688ad1097ef4159dfc5f96d963a9fa
- replaceMissingSections(biomeRegistry, this.sections);
+ this.replaceMissingSections(biomeRegistry, this.sections); // Paper - Anti-Xray - make it a non-static method
- this.biomeRegistry = biomeRegistry; // Craftbukkit
+ this.biomeRegistry = biomeRegistry; // CraftBukkit
}
- private static void replaceMissingSections(Registry<Biome> biomeRegistry, LevelChunkSection[] sections) {
@@ -269,7 +269,7 @@ index 12d9b532e466ec4e46920d409b5f1b3ae60b80f8..bc688ad1097ef4159dfc5f96d963a9fa
}
}
diff --git a/net/minecraft/world/level/chunk/LevelChunk.java b/net/minecraft/world/level/chunk/LevelChunk.java
-index b3cc671f33b2c8c5f3131afffc6ee9d7b83dd3bc..d1d0dc13eecb0e0eb3a7839b570a5fe7f62f3fba 100644
+index 2b5d99eb6860578cc1af8fbe2571c314846984dd..bc4260623dfb1d804f41593293a5c176c86df5a1 100644
--- a/net/minecraft/world/level/chunk/LevelChunk.java
+++ b/net/minecraft/world/level/chunk/LevelChunk.java
@@ -109,7 +109,7 @@ public class LevelChunk extends ChunkAccess {
diff --git a/paper-server/patches/features/0008-Use-Velocity-compression-and-cipher-natives.patch b/paper-server/patches/features/0008-Use-Velocity-compression-and-cipher-natives.patch
index 8ec9093e28..cf7d0a06be 100644
--- a/paper-server/patches/features/0008-Use-Velocity-compression-and-cipher-natives.patch
+++ b/paper-server/patches/features/0008-Use-Velocity-compression-and-cipher-natives.patch
@@ -5,7 +5,7 @@ Subject: [PATCH] Use Velocity compression and cipher natives
diff --git a/net/minecraft/network/CipherDecoder.java b/net/minecraft/network/CipherDecoder.java
-index 429325ffb7db2b85ed271ddf3da64c6fdc593673..4a445cb0ab19c6eca94fdc2172e1b286d1947c63 100644
+index 429325ffb7db2b85ed271ddf3da64c6fdc593673..d764552aea825af7bbf0f47c9d88af527d9dbe62 100644
--- a/net/minecraft/network/CipherDecoder.java
+++ b/net/minecraft/network/CipherDecoder.java
@@ -7,14 +7,30 @@ import java.util.List;
@@ -17,8 +17,8 @@ index 429325ffb7db2b85ed271ddf3da64c6fdc593673..4a445cb0ab19c6eca94fdc2172e1b286
- public CipherDecoder(Cipher cipher) {
- this.cipher = new CipherBase(cipher);
-+ public CipherDecoder(com.velocitypowered.natives.encryption.VelocityCipher cipher) { // Paper - Use Velocity cipher
-+ this.cipher = cipher; // Paper - Use Velocity cipher
++ public CipherDecoder(com.velocitypowered.natives.encryption.VelocityCipher cipher) { // Paper - Use Velocity cipher
++ this.cipher = cipher; // Paper - Use Velocity cipher
}
@Override
@@ -38,13 +38,13 @@ index 429325ffb7db2b85ed271ddf3da64c6fdc593673..4a445cb0ab19c6eca94fdc2172e1b286
+
+ // Paper start - Use Velocity cipher
+ @Override
-+ public void handlerRemoved(ChannelHandlerContext ctx) throws Exception {
++ public void handlerRemoved(ChannelHandlerContext ctx) {
+ this.cipher.close();
+ }
+ // Paper end - Use Velocity cipher
}
diff --git a/net/minecraft/network/CipherEncoder.java b/net/minecraft/network/CipherEncoder.java
-index 992b9c7aed57ce29cdd2b4f66737d39db214f0cf..e087a35bcaf326c37a3e58f4d06165a61747c5a9 100644
+index 992b9c7aed57ce29cdd2b4f66737d39db214f0cf..b927c85923147d2b346e892a3e4deee48b3d073e 100644
--- a/net/minecraft/network/CipherEncoder.java
+++ b/net/minecraft/network/CipherEncoder.java
@@ -5,15 +5,31 @@ import io.netty.channel.ChannelHandlerContext;
@@ -58,8 +58,8 @@ index 992b9c7aed57ce29cdd2b4f66737d39db214f0cf..e087a35bcaf326c37a3e58f4d06165a6
- public CipherEncoder(Cipher cipher) {
- this.cipher = new CipherBase(cipher);
-+ public CipherEncoder(com.velocitypowered.natives.encryption.VelocityCipher cipher) { // Paper - Use Velocity cipher
-+ this.cipher = cipher; // Paper - Use Velocity cipher
++ public CipherEncoder(com.velocitypowered.natives.encryption.VelocityCipher cipher) { // Paper - Use Velocity cipher
++ this.cipher = cipher; // Paper - Use Velocity cipher
}
+ // Paper start - Use Velocity cipher
@@ -80,7 +80,7 @@ index 992b9c7aed57ce29cdd2b4f66737d39db214f0cf..e087a35bcaf326c37a3e58f4d06165a6
+
+ // Paper start - Use Velocity cipher
+ @Override
-+ public void handlerRemoved(ChannelHandlerContext ctx) throws Exception {
++ public void handlerRemoved(ChannelHandlerContext ctx) {
+ this.cipher.close();
+ }
+ // Paper end - Use Velocity cipher
@@ -269,10 +269,10 @@ index bc674b08a41d5529fe06c6d3f077051cf4138f73..ea8a894158c44c2e7943dea43ecd8e1f
+ // Paper end - Use Velocity cipher
}
diff --git a/net/minecraft/network/Connection.java b/net/minecraft/network/Connection.java
-index c4bb28857ee11dccc9924666634488044c666fd1..8fe485c5bf79804bb4d1f774f95a92b14a576e80 100644
+index 1672bd0eeea8db44016bbbccf9a332c7f45fdb54..bfdc637a750602c00919422ca0e3943ba34db832 100644
--- a/net/minecraft/network/Connection.java
+++ b/net/minecraft/network/Connection.java
-@@ -770,11 +770,22 @@ public class Connection extends SimpleChannelInboundHandler<Packet<?>> {
+@@ -766,11 +766,22 @@ public class Connection extends SimpleChannelInboundHandler<Packet<?>> {
return connection;
}
@@ -299,7 +299,7 @@ index c4bb28857ee11dccc9924666634488044c666fd1..8fe485c5bf79804bb4d1f774f95a92b1
public boolean isEncrypted() {
return this.encrypted;
-@@ -813,16 +824,17 @@ public class Connection extends SimpleChannelInboundHandler<Packet<?>> {
+@@ -809,16 +820,17 @@ public class Connection extends SimpleChannelInboundHandler<Packet<?>> {
// Paper end - add proper async disconnect
public void setupCompression(int threshold, boolean validateDecompressed) {
if (threshold >= 0) {
diff --git a/paper-server/patches/features/0022-Lag-compensation-ticks.patch b/paper-server/patches/features/0022-Lag-compensation-ticks.patch
index 50c0323115..1d23e4ff9d 100644
--- a/paper-server/patches/features/0022-Lag-compensation-ticks.patch
+++ b/paper-server/patches/features/0022-Lag-compensation-ticks.patch
@@ -8,7 +8,7 @@ Areas affected by lag comepnsation:
- Eating food items
diff --git a/net/minecraft/server/MinecraftServer.java b/net/minecraft/server/MinecraftServer.java
-index fd6fdb6d7e15633bd01d4f930ee3b15c0dd2ca06..22dc6bec58702762e4a31415f9aed2df2b3ad0d6 100644
+index 5649482a8b85056bc009b868e19ca11f21d59fbf..f4fba4e2d12c7ab4b4eb9858cd738a9678a2d203 100644
--- a/net/minecraft/server/MinecraftServer.java
+++ b/net/minecraft/server/MinecraftServer.java
@@ -301,6 +301,7 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
@@ -19,7 +19,7 @@ index fd6fdb6d7e15633bd01d4f930ee3b15c0dd2ca06..22dc6bec58702762e4a31415f9aed2df
public static <S extends MinecraftServer> S spin(Function<Thread, S> threadFunction) {
ca.spottedleaf.dataconverter.minecraft.datatypes.MCTypeRegistry.init(); // Paper - rewrite data converter system
-@@ -1566,6 +1567,7 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
+@@ -1561,6 +1562,7 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
for (ServerLevel serverLevel : this.getAllLevels()) {
serverLevel.hasPhysicsEvent = org.bukkit.event.block.BlockPhysicsEvent.getHandlerList().getRegisteredListeners().length > 0; // Paper - BlockPhysicsEvent
serverLevel.hasEntityMoveEvent = io.papermc.paper.event.entity.EntityMoveEvent.getHandlerList().getRegisteredListeners().length > 0; // Paper - Add EntityMoveEvent
@@ -28,7 +28,7 @@ index fd6fdb6d7e15633bd01d4f930ee3b15c0dd2ca06..22dc6bec58702762e4a31415f9aed2df
/* Drop global time updates
if (this.tickCount % 20 == 0) {
diff --git a/net/minecraft/server/level/ServerLevel.java b/net/minecraft/server/level/ServerLevel.java
-index ca9427a7eae9a66f4f1ccedda7b1def7ac2a88da..efc18884358907661d1226409f11d19a394073b3 100644
+index 4d20bda4cba578c47216d450c99389b744a59008..47b7d487467225505e3f20cea92e114331d660fd 100644
--- a/net/minecraft/server/level/ServerLevel.java
+++ b/net/minecraft/server/level/ServerLevel.java
@@ -2362,4 +2362,16 @@ public class ServerLevel extends Level implements ServerEntityGetter, WorldGenLe
@@ -49,20 +49,20 @@ index ca9427a7eae9a66f4f1ccedda7b1def7ac2a88da..efc18884358907661d1226409f11d19a
+ // Paper end - lag compensation
}
diff --git a/net/minecraft/server/level/ServerPlayerGameMode.java b/net/minecraft/server/level/ServerPlayerGameMode.java
-index 6176f0738aa1a18df5d7d4d49fd6961e3f2eb736..d6da40d7188a55a9b2eeedb540c8e275359342e4 100644
+index 9fdb825be2b04a5806bbb3d39948bad0863e7ae5..261445152f741b68f91cd8fc1eac17275ee52427 100644
--- a/net/minecraft/server/level/ServerPlayerGameMode.java
+++ b/net/minecraft/server/level/ServerPlayerGameMode.java
@@ -111,7 +111,7 @@ public class ServerPlayerGameMode {
}
public void tick() {
-- this.gameTicks = net.minecraft.server.MinecraftServer.currentTick; // CraftBukkit;
+- this.gameTicks = net.minecraft.server.MinecraftServer.currentTick; // CraftBukkit
+ this.gameTicks = (int) this.level.getLagCompensationTick(); // Paper - lag compensation
if (this.hasDelayedDestroy) {
BlockState blockState = this.level.getBlockStateIfLoaded(this.delayedDestroyPos); // Paper - Don't allow digging into unloaded chunks
if (blockState == null || blockState.isAir()) { // Paper - Don't allow digging into unloaded chunks
diff --git a/net/minecraft/world/entity/LivingEntity.java b/net/minecraft/world/entity/LivingEntity.java
-index c83aeaf4e50dd7290c608dfe260a3bd2404b6004..8439e1593c9973243383dc7091c587f7e72eb9e0 100644
+index 228ceecd5ab9040dcc6710d1cdd0feda2f901016..884e1f8f72cc31520ba0c54af17be3879918a5d3 100644
--- a/net/minecraft/world/entity/LivingEntity.java
+++ b/net/minecraft/world/entity/LivingEntity.java
@@ -3831,6 +3831,10 @@ public abstract class LivingEntity extends Entity implements Attackable {
diff --git a/paper-server/patches/features/0024-Add-Alternate-Current-redstone-implementation.patch b/paper-server/patches/features/0024-Add-Alternate-Current-redstone-implementation.patch
index 789e1ac2c4..1e6a539a98 100644
--- a/paper-server/patches/features/0024-Add-Alternate-Current-redstone-implementation.patch
+++ b/paper-server/patches/features/0024-Add-Alternate-Current-redstone-implementation.patch
@@ -2326,7 +2326,7 @@ index 0000000000000000000000000000000000000000..298076a0db4e6ee6e4775ac43bf749d9
+ }
+}
diff --git a/net/minecraft/server/level/ServerLevel.java b/net/minecraft/server/level/ServerLevel.java
-index efc18884358907661d1226409f11d19a394073b3..9cc47bda7197ca3f63b0ede9905c9a13931f84ed 100644
+index 47b7d487467225505e3f20cea92e114331d660fd..c38eda42b33cfa4792625f40ebde6f30e591119b 100644
--- a/net/minecraft/server/level/ServerLevel.java
+++ b/net/minecraft/server/level/ServerLevel.java
@@ -214,6 +214,7 @@ public class ServerLevel extends Level implements ServerEntityGetter, WorldGenLe
@@ -2352,10 +2352,10 @@ index efc18884358907661d1226409f11d19a394073b3..9cc47bda7197ca3f63b0ede9905c9a13
@Override
public void onCreated(Entity entity) {
diff --git a/net/minecraft/world/level/Level.java b/net/minecraft/world/level/Level.java
-index 872c3b8826f436b15f6ab0a3619692c5202eadc3..cb6ca60af3d3f90501e4693a78466b9f7462362d 100644
+index 0e4ab448755632696c4326f1df9f3855cd38a64d..8abb17d30373fab80b466891abd16b31ab536f64 100644
--- a/net/minecraft/world/level/Level.java
+++ b/net/minecraft/world/level/Level.java
-@@ -1401,6 +1401,17 @@ public abstract class Level implements LevelAccessor, AutoCloseable {
+@@ -1396,6 +1396,17 @@ public abstract class Level implements LevelAccessor, AutoCloseable {
public abstract FuelValues fuelValues();
diff --git a/paper-server/patches/features/0025-Improve-exact-choice-recipe-ingredients.patch b/paper-server/patches/features/0025-Improve-exact-choice-recipe-ingredients.patch
index 91119626f1..8ff6dc6c20 100644
--- a/paper-server/patches/features/0025-Improve-exact-choice-recipe-ingredients.patch
+++ b/paper-server/patches/features/0025-Improve-exact-choice-recipe-ingredients.patch
@@ -204,7 +204,7 @@ index 6475509689439636275b06b9eac33f0922d8fcfd..6c398c91909f42e352e80d0781549df9
int i = this.inventory.findSlotMatchingCraftingIngredient(item, item1);
if (i == -1) {
diff --git a/net/minecraft/world/entity/player/Inventory.java b/net/minecraft/world/entity/player/Inventory.java
-index e8522f5ccd69ff5513782a31a3b53219bc17b0e5..9a72651c5efefc6290ae14aa50ca79572d274562 100644
+index e8522f5ccd69ff5513782a31a3b53219bc17b0e5..80fa9153bdce9b0728cc1ee8908fe5481e84a1f8 100644
--- a/net/minecraft/world/entity/player/Inventory.java
+++ b/net/minecraft/world/entity/player/Inventory.java
@@ -178,12 +178,12 @@ public class Inventory implements Container, Nameable {
@@ -219,7 +219,7 @@ index e8522f5ccd69ff5513782a31a3b53219bc17b0e5..9a72651c5efefc6290ae14aa50ca7957
- && itemStack.is(item)
- && isUsableForCrafting(itemStack)
+ && item.matches(itemStack) // Paper - Improve exact choice recipe ingredients
-+ && (!(item instanceof io.papermc.paper.inventory.recipe.ItemOrExact.Item) || Inventory.isUsableForCrafting(itemStack)) // Paper - Improve exact choice recipe ingredients
++ && (!(item instanceof io.papermc.paper.inventory.recipe.ItemOrExact.Item) || Inventory.isUsableForCrafting(itemStack)) // Paper - Improve exact choice recipe ingredients
&& (stack.isEmpty() || ItemStack.isSameItemSameComponents(stack, itemStack))) {
return i;
}
diff --git a/paper-server/patches/sources/com/mojang/brigadier/CommandDispatcher.java.patch b/paper-server/patches/sources/com/mojang/brigadier/CommandDispatcher.java.patch
index d5b323d68e..ffd3df5ae9 100644
--- a/paper-server/patches/sources/com/mojang/brigadier/CommandDispatcher.java.patch
+++ b/paper-server/patches/sources/com/mojang/brigadier/CommandDispatcher.java.patch
@@ -1,13 +1,5 @@
--- a/com/mojang/brigadier/CommandDispatcher.java
+++ b/com/mojang/brigadier/CommandDispatcher.java
-@@ -3,6 +_,7 @@
-
- package com.mojang.brigadier;
-
-+// CHECKSTYLE:OFF
- import com.mojang.brigadier.builder.LiteralArgumentBuilder;
- import com.mojang.brigadier.context.CommandContext;
- import com.mojang.brigadier.context.CommandContextBuilder;
@@ -297,15 +_,21 @@
List<ParseResults<S>> potentials = null;
final int cursor = originalReader.getCursor();
diff --git a/paper-server/patches/sources/net/minecraft/commands/Commands.java.patch b/paper-server/patches/sources/net/minecraft/commands/Commands.java.patch
index 954cc79823..f16c785fbd 100644
--- a/paper-server/patches/sources/net/minecraft/commands/Commands.java.patch
+++ b/paper-server/patches/sources/net/minecraft/commands/Commands.java.patch
@@ -100,8 +100,8 @@
MutableComponent mutableComponent = Component.literal(var12.getMessage() == null ? var12.getClass().getName() : var12.getMessage());
- if (LOGGER.isDebugEnabled()) {
- LOGGER.error("Command exception: /{}", command, var12);
-+ Commands.LOGGER.error("Command exception: /{}", command, var12); // Paper - always show execution exception in console log
-+ if (commandSourceStack.getServer().isDebugging() || Commands.LOGGER.isDebugEnabled()) { // Paper - Debugging
++ LOGGER.error("Command exception: /{}", command, var12); // Paper - always show execution exception in console log
++ if (commandSourceStack.getServer().isDebugging() || LOGGER.isDebugEnabled()) { // Paper - Debugging
StackTraceElement[] stackTrace = var12.getStackTrace();
for (int i = 0; i < Math.min(stackTrace.length, 3); i++) {
diff --git a/paper-server/patches/sources/net/minecraft/nbt/ByteArrayTag.java.patch b/paper-server/patches/sources/net/minecraft/nbt/ByteArrayTag.java.patch
index 3268ad447a..2d195ba0b8 100644
--- a/paper-server/patches/sources/net/minecraft/nbt/ByteArrayTag.java.patch
+++ b/paper-server/patches/sources/net/minecraft/nbt/ByteArrayTag.java.patch
@@ -4,7 +4,7 @@
private static byte[] readAccounted(DataInput input, NbtAccounter accounter) throws IOException {
accounter.accountBytes(24L);
int _int = input.readInt();
-+ com.google.common.base.Preconditions.checkArgument( _int < 1 << 24); // Spigot
++ com.google.common.base.Preconditions.checkArgument(_int < 1 << 24); // Spigot
accounter.accountBytes(1L, _int);
byte[] bytes = new byte[_int];
input.readFully(bytes);
diff --git a/paper-server/patches/sources/net/minecraft/nbt/IntArrayTag.java.patch b/paper-server/patches/sources/net/minecraft/nbt/IntArrayTag.java.patch
index 4f18628a8b..de1fb28f75 100644
--- a/paper-server/patches/sources/net/minecraft/nbt/IntArrayTag.java.patch
+++ b/paper-server/patches/sources/net/minecraft/nbt/IntArrayTag.java.patch
@@ -4,7 +4,7 @@
private static int[] readAccounted(DataInput input, NbtAccounter accounter) throws IOException {
accounter.accountBytes(24L);
int _int = input.readInt();
-+ com.google.common.base.Preconditions.checkArgument( _int < 1 << 24); // Spigot
++ com.google.common.base.Preconditions.checkArgument(_int < 1 << 24); // Spigot
accounter.accountBytes(4L, _int);
int[] ints = new int[_int];
diff --git a/paper-server/patches/sources/net/minecraft/nbt/NbtIo.java.patch b/paper-server/patches/sources/net/minecraft/nbt/NbtIo.java.patch
index 3fc90b348f..5cd314e969 100644
--- a/paper-server/patches/sources/net/minecraft/nbt/NbtIo.java.patch
+++ b/paper-server/patches/sources/net/minecraft/nbt/NbtIo.java.patch
@@ -1,13 +1,12 @@
--- a/net/minecraft/nbt/NbtIo.java
+++ b/net/minecraft/nbt/NbtIo.java
-@@ -118,6 +_,12 @@
+@@ -118,6 +_,11 @@
}
public static CompoundTag read(DataInput input, NbtAccounter accounter) throws IOException {
+ // Spigot start
-+ if ( input instanceof io.netty.buffer.ByteBufInputStream )
-+ {
-+ input = new DataInputStream(new org.spigotmc.LimitStream((InputStream) input, accounter));
++ if (input instanceof io.netty.buffer.ByteBufInputStream byteBufInputStream) {
++ input = new DataInputStream(new org.spigotmc.LimitStream(byteBufInputStream, accounter));
+ }
+ // Spigot end
Tag unnamedTag = readUnnamedTag(input, accounter);
diff --git a/paper-server/patches/sources/net/minecraft/network/Connection.java.patch b/paper-server/patches/sources/net/minecraft/network/Connection.java.patch
index f36ea815c5..e0c2fff5dd 100644
--- a/paper-server/patches/sources/net/minecraft/network/Connection.java.patch
+++ b/paper-server/patches/sources/net/minecraft/network/Connection.java.patch
@@ -21,11 +21,11 @@
private final Queue<Consumer<Connection>> pendingActions = Queues.newConcurrentLinkedQueue();
public Channel channel;
public SocketAddress address;
-+ // Spigot Start
++ // Spigot start
+ public java.util.UUID spoofedUUID;
+ public com.mojang.authlib.properties.Property[] spoofedProfile;
+ public boolean preparing = true;
-+ // Spigot End
++ // Spigot end
@Nullable
private volatile PacketListener disconnectListener;
@Nullable
@@ -70,13 +70,11 @@
public Connection(PacketFlow receiving) {
this.receiving = receiving;
-@@ -116,6 +_,9 @@
+@@ -116,6 +_,7 @@
super.channelActive(context);
this.channel = context.channel();
this.address = this.channel.remoteAddress();
-+ // Spigot Start
-+ this.preparing = false;
-+ // Spigot End
++ this.preparing = false; // Spigot
if (this.delayedDisconnect != null) {
this.disconnect(this.delayedDisconnect);
}
@@ -228,13 +226,11 @@
}
if (this.tickCount++ % 20 == 0) {
-@@ -432,12 +_,15 @@
+@@ -432,12 +_,13 @@
}
public void disconnect(DisconnectionDetails disconnectionDetails) {
-+ // Spigot Start
-+ this.preparing = false;
-+ // Spigot End
++ this.preparing = false; // Spigot
if (this.channel == null) {
this.delayedDisconnect = disconnectionDetails;
}
diff --git a/paper-server/patches/sources/net/minecraft/network/protocol/game/ClientboundSetEquipmentPacket.java.patch b/paper-server/patches/sources/net/minecraft/network/protocol/game/ClientboundSetEquipmentPacket.java.patch
index f02259d4dc..d5959b2866 100644
--- a/paper-server/patches/sources/net/minecraft/network/protocol/game/ClientboundSetEquipmentPacket.java.patch
+++ b/paper-server/patches/sources/net/minecraft/network/protocol/game/ClientboundSetEquipmentPacket.java.patch
@@ -18,7 +18,7 @@
buffer.writeVarInt(this.entity);
int size = this.slots.size();
-+ try (io.papermc.paper.util.DataSanitizationUtil.DataSanitizer ignored = io.papermc.paper.util.DataSanitizationUtil.start(this.sanitize)) { // Paper - data sanitization
++ try (io.papermc.paper.util.DataSanitizationUtil.DataSanitizer ignored = io.papermc.paper.util.DataSanitizationUtil.start(this.sanitize)) { // Paper - data sanitization
for (int i = 0; i < size; i++) {
Pair<EquipmentSlot, ItemStack> pair = this.slots.get(i);
EquipmentSlot equipmentSlot = pair.getFirst();
diff --git a/paper-server/patches/sources/net/minecraft/network/protocol/game/ClientboundSetPlayerTeamPacket.java.patch b/paper-server/patches/sources/net/minecraft/network/protocol/game/ClientboundSetPlayerTeamPacket.java.patch
index 8e6ebe5e67..3f4c2e05a8 100644
--- a/paper-server/patches/sources/net/minecraft/network/protocol/game/ClientboundSetPlayerTeamPacket.java.patch
+++ b/paper-server/patches/sources/net/minecraft/network/protocol/game/ClientboundSetPlayerTeamPacket.java.patch
@@ -17,7 +17,7 @@
buffer.writeByte(this.options);
buffer.writeUtf(this.nametagVisibility);
- buffer.writeUtf(this.collisionRule);
-+ buffer.writeUtf(!io.papermc.paper.configuration.GlobalConfiguration.get().collisions.enablePlayerCollisions ? "never" : this.collisionRule); // Paper - Configurable player collision
++ buffer.writeUtf(!io.papermc.paper.configuration.GlobalConfiguration.get().collisions.enablePlayerCollisions ? PlayerTeam.CollisionRule.NEVER.name : this.collisionRule); // Paper - Configurable player collision
buffer.writeEnum(this.color);
ComponentSerialization.TRUSTED_STREAM_CODEC.encode(buffer, this.playerPrefix);
ComponentSerialization.TRUSTED_STREAM_CODEC.encode(buffer, this.playerSuffix);
diff --git a/paper-server/patches/sources/net/minecraft/server/Main.java.patch b/paper-server/patches/sources/net/minecraft/server/Main.java.patch
index f166107df6..886690bbbd 100644
--- a/paper-server/patches/sources/net/minecraft/server/Main.java.patch
+++ b/paper-server/patches/sources/net/minecraft/server/Main.java.patch
@@ -65,15 +65,15 @@
}
- if (!eula.hasAgreedToEULA()) {
-+ // Spigot Start
++ // Spigot start
+ boolean eulaAgreed = Boolean.getBoolean("com.mojang.eula.agree");
+ if (eulaAgreed) {
-+ System.err.println("You have used the Spigot command line EULA agreement flag.");
-+ System.err.println("By using this setting you are indicating your agreement to Mojang's EULA (https://account.mojang.com/documents/minecraft_eula).");
-+ System.err.println("If you do not agree to the above EULA please stop your server and remove this flag immediately.");
++ LOGGER.error("You have used the Spigot command line EULA agreement flag.");
++ LOGGER.error("By using this setting you are indicating your agreement to Mojang's EULA (https://aka.ms/MinecraftEULA).");
++ LOGGER.error("If you do not agree to the above EULA please stop your server and remove this flag immediately.");
+ }
-+ // Spigot End
-+ if (!eula.hasAgreedToEULA() && !eulaAgreed) { // Spigot
++ if (!eula.hasAgreedToEULA() && !eulaAgreed) {
++ // Spigot end
LOGGER.info("You need to agree to the EULA in order to run the server. Go to eula.txt for more info.");
return;
}
@@ -84,11 +84,11 @@
+ // Paper start - Detect headless JRE
+ String awtException = io.papermc.paper.util.ServerEnvironment.awtDependencyCheck();
+ if (awtException != null) {
-+ Main.LOGGER.error("You are using a headless JRE distribution.");
-+ Main.LOGGER.error("This distribution is missing certain graphic libraries that the Minecraft server needs to function.");
-+ Main.LOGGER.error("For instructions on how to install the non-headless JRE, see https://docs.papermc.io/misc/java-install");
-+ Main.LOGGER.error("");
-+ Main.LOGGER.error(awtException);
++ LOGGER.error("You are using a headless JRE distribution.");
++ LOGGER.error("This distribution is missing certain graphic libraries that the Minecraft server needs to function.");
++ LOGGER.error("For instructions on how to install the non-headless JRE, see https://docs.papermc.io/misc/java-install");
++ LOGGER.error("");
++ LOGGER.error(awtException);
+ return;
+ }
+ // Paper end - Detect headless JRE
@@ -195,7 +195,7 @@
thread1,
levelStorageAccess,
packRepository,
-@@ -257,17 +_,29 @@
+@@ -257,17 +_,34 @@
services,
LoggerChunkProgressListener::createFromGameruleRadius
);
@@ -203,7 +203,12 @@
dedicatedServer1.setPort(optionSet.valueOf(optionSpec11));
- dedicatedServer1.setDemo(optionSet.has(optionSpec2));
+ */
-+ dedicatedServer1.setDemo(optionSet.has("demo")); // Paper
++ // Paper start
++ if (optionSet.has("serverId")) {
++ dedicatedServer1.setId((String) optionSet.valueOf("serverId"));
++ }
++ dedicatedServer1.setDemo(optionSet.has("demo"));
++ // Paper end
+ /*
dedicatedServer1.setId(optionSet.valueOf(optionSpec12));
- boolean flag = !optionSet.has(optionSpec) && !optionSet.valuesOf(optionSpec15).contains("nogui");
diff --git a/paper-server/patches/sources/net/minecraft/server/MinecraftServer.java.patch b/paper-server/patches/sources/net/minecraft/server/MinecraftServer.java.patch
index 3aa38008fc..ca5ee37782 100644
--- a/paper-server/patches/sources/net/minecraft/server/MinecraftServer.java.patch
+++ b/paper-server/patches/sources/net/minecraft/server/MinecraftServer.java.patch
@@ -61,7 +61,7 @@
+ public static final int TICK_TIME = 1000000000 / MinecraftServer.TPS;
+ private static final int SAMPLE_INTERVAL = 20; // Paper - improve server tick loop
+ @Deprecated(forRemoval = true) // Paper
-+ public final double[] recentTps = new double[ 3 ];
++ public final double[] recentTps = new double[3];
+ // Spigot end
+ public volatile boolean hasFullyShutdown; // Paper - Improved watchdog support
+ public volatile boolean abnormalExit; // Paper - Improved watchdog support
@@ -623,16 +623,17 @@
}
LOGGER.info("Saving worlds");
-@@ -646,6 +_,15 @@
+@@ -646,6 +_,16 @@
} catch (IOException var4) {
LOGGER.error("Failed to unlock level {}", this.storageSource.getLevelId(), var4);
}
+ // Spigot start
+ io.papermc.paper.util.MCUtil.ASYNC_EXECUTOR.shutdown(); // Paper
-+ try { io.papermc.paper.util.MCUtil.ASYNC_EXECUTOR.awaitTermination(30, java.util.concurrent.TimeUnit.SECONDS); // Paper
++ try {
++ io.papermc.paper.util.MCUtil.ASYNC_EXECUTOR.awaitTermination(30, java.util.concurrent.TimeUnit.SECONDS); // Paper
+ } catch (java.lang.InterruptedException ignored) {} // Paper
+ if (org.spigotmc.SpigotConfig.saveUserCacheOnStopOnly) {
-+ MinecraftServer.LOGGER.info("Saving usercache.json");
++ LOGGER.info("Saving usercache.json");
+ this.getProfileCache().save(false); // Paper - Perf: Async GameProfileCache saving
+ }
+ // Spigot end
@@ -654,15 +655,10 @@
this.running = false;
if (waitForServer) {
try {
-@@ -671,6 +_,63 @@
+@@ -671,6 +_,57 @@
}
}
-+ // Spigot Start
-+ private static double calcTps(double avg, double exp, double tps) {
-+ return (avg * exp) + (tps * (1 - exp));
-+ }
-+
+ // Paper start - Further improve server tick loop
+ private static final long SEC_IN_NANO = 1000000000;
+ private static final long MAX_CATCHUP_BUFFER = TICK_TIME * TPS * 60L;
@@ -713,7 +709,6 @@
+ }
+ private static final java.math.BigDecimal TPS_BASE = new java.math.BigDecimal(1E9).multiply(new java.math.BigDecimal(SAMPLE_INTERVAL));
+ // Paper end
-+ // Spigot End
+
protected void runServer() {
try {
@@ -725,7 +720,7 @@
+ this.server.spark.enableBeforePlugins(); // Paper - spark
+ // Spigot start
+ org.spigotmc.WatchdogThread.hasStarted = true; // Paper
-+ Arrays.fill( this.recentTps, 20 );
++ Arrays.fill(this.recentTps, 20);
+ // Paper start - further improve server tick loop
+ long tickSection = Util.getNanos();
+ long currentTime;
@@ -1181,7 +1176,7 @@
if (this.isEnforceWhitelist()) {
PlayerList playerList = commandSource.getServer().getPlayerList();
UserWhiteList whiteList = playerList.getWhiteList();
-+ if (!((net.minecraft.server.dedicated.DedicatedServer) getServer()).getProperties().whiteList.get()) return; // Paper - whitelist not enabled
++ if (!((net.minecraft.server.dedicated.DedicatedServer) this).getProperties().whiteList.get()) return; // Paper - whitelist not enabled
for (ServerPlayer serverPlayer : Lists.newArrayList(playerList.getPlayers())) {
- if (!whiteList.isWhiteListed(serverPlayer.getGameProfile())) {
diff --git a/paper-server/patches/sources/net/minecraft/server/ServerTickRateManager.java.patch b/paper-server/patches/sources/net/minecraft/server/ServerTickRateManager.java.patch
index d5767c2dab..2c1e737818 100644
--- a/paper-server/patches/sources/net/minecraft/server/ServerTickRateManager.java.patch
+++ b/paper-server/patches/sources/net/minecraft/server/ServerTickRateManager.java.patch
@@ -4,12 +4,12 @@
}
public boolean stopSprinting() {
-+ // CraftBukkit start, add sendLog parameter
++ // CraftBukkit start - add sendLog parameter
+ return this.stopSprinting(true);
+ }
+
+ public boolean stopSprinting(boolean sendLog) {
-+ // CraftBukkit end
++ // CraftBukkit end - add sendLog parameter
if (this.remainingSprintTicks > 0L) {
- this.finishTickSprint();
+ this.finishTickSprint(sendLog); // CraftBukkit - add sendLog parameter
diff --git a/paper-server/patches/sources/net/minecraft/server/commands/LootCommand.java.patch b/paper-server/patches/sources/net/minecraft/server/commands/LootCommand.java.patch
deleted file mode 100644
index f83d4e298c..0000000000
--- a/paper-server/patches/sources/net/minecraft/server/commands/LootCommand.java.patch
+++ /dev/null
@@ -1,10 +0,0 @@
---- a/net/minecraft/server/commands/LootCommand.java
-+++ b/net/minecraft/server/commands/LootCommand.java
-@@ -395,6 +_,7 @@
-
- private static int dropInWorld(CommandSourceStack source, Vec3 pos, List<ItemStack> items, LootCommand.Callback callback) throws CommandSyntaxException {
- ServerLevel level = source.getLevel();
-+ items.removeIf(ItemStack::isEmpty); // CraftBukkit - SPIGOT-6959 Remove empty items for avoid throw an error in new EntityItem
- items.forEach(itemStack -> {
- ItemEntity itemEntity = new ItemEntity(level, pos.x, pos.y, pos.z, itemStack.copy());
- itemEntity.setDefaultPickUpDelay();
diff --git a/paper-server/patches/sources/net/minecraft/server/dedicated/DedicatedServer.java.patch b/paper-server/patches/sources/net/minecraft/server/dedicated/DedicatedServer.java.patch
index 243d71c069..2f25d642a3 100644
--- a/paper-server/patches/sources/net/minecraft/server/dedicated/DedicatedServer.java.patch
+++ b/paper-server/patches/sources/net/minecraft/server/dedicated/DedicatedServer.java.patch
@@ -123,11 +123,11 @@
+ // Paper start - detect running as root
+ if (io.papermc.paper.util.ServerEnvironment.userIsRootOrAdmin()) {
-+ DedicatedServer.LOGGER.warn("****************************");
-+ DedicatedServer.LOGGER.warn("YOU ARE RUNNING THIS SERVER AS AN ADMINISTRATIVE OR ROOT USER. THIS IS NOT ADVISED.");
-+ DedicatedServer.LOGGER.warn("YOU ARE OPENING YOURSELF UP TO POTENTIAL RISKS WHEN DOING THIS.");
-+ DedicatedServer.LOGGER.warn("FOR MORE INFORMATION, SEE https://madelinemiller.dev/blog/root-minecraft-server/");
-+ DedicatedServer.LOGGER.warn("****************************");
++ LOGGER.warn("****************************");
++ LOGGER.warn("YOU ARE RUNNING THIS SERVER AS AN ADMINISTRATIVE OR ROOT USER. THIS IS NOT ADVISED.");
++ LOGGER.warn("YOU ARE OPENING YOURSELF UP TO POTENTIAL RISKS WHEN DOING THIS.");
++ LOGGER.warn("FOR MORE INFORMATION, SEE https://madelinemiller.dev/blog/root-minecraft-server/");
++ LOGGER.warn("****************************");
+ }
+ // Paper end - detect running as root
+
@@ -174,12 +174,12 @@
+ java.net.SocketAddress bindAddress;
+ if (this.getLocalIp().startsWith("unix:")) {
+ if (!io.netty.channel.epoll.Epoll.isAvailable()) {
-+ DedicatedServer.LOGGER.error("**** INVALID CONFIGURATION!");
-+ DedicatedServer.LOGGER.error("You are trying to use a Unix domain socket but you're not on a supported OS.");
++ LOGGER.error("**** INVALID CONFIGURATION!");
++ LOGGER.error("You are trying to use a Unix domain socket but you're not on a supported OS.");
+ return false;
+ } else if (!io.papermc.paper.configuration.GlobalConfiguration.get().proxies.velocity.enabled && !org.spigotmc.SpigotConfig.bungee) {
-+ DedicatedServer.LOGGER.error("**** INVALID CONFIGURATION!");
-+ DedicatedServer.LOGGER.error("Unix domain sockets require IPs to be forwarded from a proxy.");
++ LOGGER.error("**** INVALID CONFIGURATION!");
++ LOGGER.error("Unix domain sockets require IPs to be forwarded from a proxy.");
+ return false;
+ }
+ bindAddress = new io.netty.channel.unix.DomainSocketAddress(this.getLocalIp().substring("unix:".length()));
@@ -229,11 +229,11 @@
+ // Spigot start
+ // Paper start - Add Velocity IP Forwarding Support
+ if (usingProxy) {
-+ DedicatedServer.LOGGER.warn("Whilst this makes it possible to use " + proxyFlavor + ", unless access to your server is properly restricted, it also opens up the ability for hackers to connect with any username they choose.");
-+ DedicatedServer.LOGGER.warn("Please see " + proxyLink + " for further information.");
++ LOGGER.warn("Whilst this makes it possible to use {}, unless access to your server is properly restricted, it also opens up the ability for hackers to connect with any username they choose.", proxyFlavor);
++ LOGGER.warn("Please see {} for further information.", proxyLink);
+ // Paper end - Add Velocity IP Forwarding Support
+ } else {
-+ DedicatedServer.LOGGER.warn("While this makes the game possible to play without internet access, it also opens up the ability for hackers to connect with any username they choose.");
++ LOGGER.warn("While this makes the game possible to play without internet access, it also opens up the ability for hackers to connect with any username they choose.");
+ }
+ // Spigot end
LOGGER.warn("To change this, set \"online-mode\" to \"true\" in the server.properties file.");
diff --git a/paper-server/patches/sources/net/minecraft/server/dedicated/Settings.java.patch b/paper-server/patches/sources/net/minecraft/server/dedicated/Settings.java.patch
index 33fd250afb..b690197c4c 100644
--- a/paper-server/patches/sources/net/minecraft/server/dedicated/Settings.java.patch
+++ b/paper-server/patches/sources/net/minecraft/server/dedicated/Settings.java.patch
@@ -24,7 +24,7 @@
}
public static Properties loadFromFile(Path path) {
-+ if (!path.toFile().exists()) return new Properties(); // CraftBukkit - SPIGOT-7465, MC-264979: Don't load if file doesn't exist
++ if (!Files.exists(path)) return new Properties(); // CraftBukkit - SPIGOT-7465, MC-264979: Don't load if file doesn't exist
try {
try {
Properties var13;
diff --git a/paper-server/patches/sources/net/minecraft/server/level/ChunkMap.java.patch b/paper-server/patches/sources/net/minecraft/server/level/ChunkMap.java.patch
index 6ce77e18f7..26c38d11c8 100644
--- a/paper-server/patches/sources/net/minecraft/server/level/ChunkMap.java.patch
+++ b/paper-server/patches/sources/net/minecraft/server/level/ChunkMap.java.patch
@@ -148,7 +148,7 @@
}
- protected void setServerViewDistance(int viewDistance) {
-+ public void setServerViewDistance(int viewDistance) { // Paper - publi
++ public void setServerViewDistance(int viewDistance) { // Paper - public
int i = Mth.clamp(viewDistance, 2, 32);
if (i != this.serverViewDistance) {
this.serverViewDistance = i;
@@ -274,7 +274,7 @@
+ return;
+ }
+ // Paper end - ignore and warn about illegal addEntity calls instead of crashing server
-+ if (entity instanceof ServerPlayer && ((ServerPlayer) entity).supressTrackerForLogin) return; // Paper - Fire PlayerJoinEvent when Player is actually ready; Delayadding to tracker until after list packets
++ if (entity instanceof ServerPlayer && ((ServerPlayer) entity).supressTrackerForLogin) return; // Paper - Fire PlayerJoinEvent when Player is actually ready; Delay adding to tracker until after list packets
if (!(entity instanceof EnderDragonPart)) {
EntityType<?> type = entity.getType();
int i = type.clientTrackingRange() * 16;
@@ -327,14 +327,14 @@
if (player != this.entity) {
- Vec3 vec3 = player.position().subtract(this.entity.position());
+ // Paper start - remove allocation of Vec3D here
-+ // Vec3 vec3d = player.position().subtract(this.entity.position());
-+ double vec3d_dx = player.getX() - this.entity.getX();
-+ double vec3d_dz = player.getZ() - this.entity.getZ();
++ // Vec3 vec3 = player.position().subtract(this.entity.position());
++ double vec3_dx = player.getX() - this.entity.getX();
++ double vec3_dz = player.getZ() - this.entity.getZ();
+ // Paper end - remove allocation of Vec3D here
int playerViewDistance = ChunkMap.this.getPlayerViewDistance(player);
double d = Math.min(this.getEffectiveRange(), playerViewDistance * 16);
- double d1 = vec3.x * vec3.x + vec3.z * vec3.z;
-+ double d1 = vec3d_dx * vec3d_dx + vec3d_dz * vec3d_dz; // Paper
++ double d1 = vec3_dx * vec3_dx + vec3_dz * vec3_dz; // Paper
double d2 = d * d;
- boolean flag = d1 <= d2
- && this.entity.broadcastToPlayer(player)
@@ -344,8 +344,8 @@
+ if (flag && level.paperConfig().entities.trackingRangeY.enabled) {
+ double rangeY = level.paperConfig().entities.trackingRangeY.get(this.entity, -1);
+ if (rangeY != -1) {
-+ double vec3d_dy = player.getY() - this.entity.getY();
-+ flag = vec3d_dy * vec3d_dy <= rangeY * rangeY;
++ double vec3_dy = player.getY() - this.entity.getY();
++ flag = vec3_dy * vec3_dy <= rangeY * rangeY;
+ }
+ }
+ flag = flag && this.entity.broadcastToPlayer(player) && ChunkMap.this.isChunkTracked(player, this.entity.chunkPosition().x, this.entity.chunkPosition().z);
diff --git a/paper-server/patches/sources/net/minecraft/server/level/ServerChunkCache.java.patch b/paper-server/patches/sources/net/minecraft/server/level/ServerChunkCache.java.patch
index 725c75ec09..ec01e0da0f 100644
--- a/paper-server/patches/sources/net/minecraft/server/level/ServerChunkCache.java.patch
+++ b/paper-server/patches/sources/net/minecraft/server/level/ServerChunkCache.java.patch
@@ -84,7 +84,7 @@
if (packedChunkPos == this.lastChunkPos[i] && chunkStatus == this.lastChunkStatus[i]) {
ChunkAccess chunkAccess = this.lastChunk[i];
- if (chunkAccess != null || !requireChunk) {
-+ if (chunkAccess != null) { // CraftBukkit - the chunk can become accessible in the meantime TODO for non-null chunks it might also make sense to check that the chunk's state hasn't changed in the meantime
++ if (chunkAccess != null) { // CraftBukkit - the chunk can become accessible in the meantime TODO for non-null chunks it might also make sense to check that the chunk's state hasn't changed in the meantime
return chunkAccess;
}
}
@@ -178,7 +178,7 @@
this.lastSpawnState = spawnState;
profiler.popPush("spawnAndTick");
- boolean _boolean = this.level.getGameRules().getBoolean(GameRules.RULE_DOMOBSPAWNING);
-+ boolean _boolean = this.level.getGameRules().getBoolean(GameRules.RULE_DOMOBSPAWNING) && !this.level.players().isEmpty(); // CraftBukkit;
++ boolean _boolean = this.level.getGameRules().getBoolean(GameRules.RULE_DOMOBSPAWNING) && !this.level.players().isEmpty(); // CraftBukkit
int _int = this.level.getGameRules().getInt(GameRules.RULE_RANDOMTICKING);
List<MobCategory> filteredSpawningCategories;
if (_boolean && (this.spawnEnemies || this.spawnFriendlies)) {
diff --git a/paper-server/patches/sources/net/minecraft/server/level/ServerLevel.java.patch b/paper-server/patches/sources/net/minecraft/server/level/ServerLevel.java.patch
index 0eaf3ea736..99d27344d3 100644
--- a/paper-server/patches/sources/net/minecraft/server/level/ServerLevel.java.patch
+++ b/paper-server/patches/sources/net/minecraft/server/level/ServerLevel.java.patch
@@ -200,7 +200,7 @@
this.registryAccess(),
server.getStructureManager(),
- dimension,
-+ getTypeKey(), // Paper - Fix missing CB diff
++ getTypeKey(), // Paper - Fix missing CB diff
chunkGenerator,
this.chunkSource.randomState(),
this,
@@ -302,7 +302,7 @@
DifficultyInstance currentDifficultyAt = this.getCurrentDifficultyAt(blockPos);
boolean flag = this.getGameRules().getBoolean(GameRules.RULE_DOMOBSPAWNING)
- && this.random.nextDouble() < currentDifficultyAt.getEffectiveDifficulty() * 0.01
-+ && this.random.nextDouble() < currentDifficultyAt.getEffectiveDifficulty() * this.paperConfig().entities.spawning.skeletonHorseThunderSpawnChance.or(0.01D) // Paper - Configurable spawn chances for skeleton horses
++ && this.random.nextDouble() < currentDifficultyAt.getEffectiveDifficulty() * this.paperConfig().entities.spawning.skeletonHorseThunderSpawnChance.or(0.01) // Paper - Configurable spawn chances for skeleton horses
&& !this.getBlockState(blockPos.below()).is(Blocks.LIGHTNING_ROD);
if (flag) {
SkeletonHorse skeletonHorse = EntityType.SKELETON_HORSE.create(this, EntitySpawnReason.EVENT);
@@ -409,23 +409,23 @@
this.server.getPlayerList().broadcastAll(new ClientboundGameEventPacket(ClientboundGameEventPacket.THUNDER_LEVEL_CHANGE, this.thunderLevel));
}
+ */
-+ for (int idx = 0; idx < this.players.size(); ++idx) {
-+ if (((ServerPlayer) this.players.get(idx)).level() == this) {
-+ ((ServerPlayer) this.players.get(idx)).tickWeather();
++ for (ServerPlayer player : this.players) {
++ if (player.level() == this) {
++ player.tickWeather();
+ }
+ }
+
+ if (isRaining != this.isRaining()) {
+ // Only send weather packets to those affected
-+ for (int idx = 0; idx < this.players.size(); ++idx) {
-+ if (((ServerPlayer) this.players.get(idx)).level() == this) {
-+ ((ServerPlayer) this.players.get(idx)).setPlayerWeather((!isRaining ? org.bukkit.WeatherType.DOWNFALL : org.bukkit.WeatherType.CLEAR), false);
++ for (ServerPlayer player : this.players) {
++ if (player.level() == this) {
++ player.setPlayerWeather((!isRaining ? org.bukkit.WeatherType.DOWNFALL : org.bukkit.WeatherType.CLEAR), false);
+ }
+ }
+ }
-+ for (int idx = 0; idx < this.players.size(); ++idx) {
-+ if (((ServerPlayer) this.players.get(idx)).level() == this) {
-+ ((ServerPlayer) this.players.get(idx)).updateWeather(this.oRainLevel, this.rainLevel, this.oThunderLevel, this.thunderLevel);
++ for (ServerPlayer player : this.players) {
++ if (player.level() == this) {
++ player.updateWeather(this.oRainLevel, this.rainLevel, this.oThunderLevel, this.thunderLevel);
+ }
+ }
+ // CraftBukkit end
@@ -600,19 +600,19 @@
}
public void unload(LevelChunk chunk) {
-+ // Spigot Start
-+ for (net.minecraft.world.level.block.entity.BlockEntity tileentity : chunk.getBlockEntities().values()) {
-+ if (tileentity instanceof net.minecraft.world.Container) {
++ // Spigot start
++ for (net.minecraft.world.level.block.entity.BlockEntity blockEntity : chunk.getBlockEntities().values()) {
++ if (blockEntity instanceof net.minecraft.world.Container) {
+ // Paper start - this area looks like it can load chunks, change the behavior
+ // chests for example can apply physics to the world
+ // so instead we just change the active container and call the event
-+ for (org.bukkit.entity.HumanEntity h : Lists.newArrayList(((net.minecraft.world.Container) tileentity).getViewers())) {
-+ ((org.bukkit.craftbukkit.entity.CraftHumanEntity) h).getHandle().closeUnloadedInventory(org.bukkit.event.inventory.InventoryCloseEvent.Reason.UNLOADED); // Paper - Inventory close reason
++ for (org.bukkit.entity.HumanEntity human : Lists.newArrayList(((net.minecraft.world.Container) blockEntity).getViewers())) {
++ ((org.bukkit.craftbukkit.entity.CraftHumanEntity) human).getHandle().closeUnloadedInventory(org.bukkit.event.inventory.InventoryCloseEvent.Reason.UNLOADED); // Paper - Inventory close reason
+ }
+ // Paper end - this area looks like it can load chunks, change the behavior
+ }
+ }
-+ // Spigot End
++ // Spigot end
chunk.clearAllBlockEntities();
chunk.unregisterTickContainerFromLevel(this);
}
@@ -776,7 +776,7 @@
+ ParticleOptions smallExplosionParticles,
+ ParticleOptions largeExplosionParticles,
+ Holder<SoundEvent> explosionSound,
-+ java.util.function.Consumer<ServerExplosion> configurator
++ @Nullable java.util.function.Consumer<ServerExplosion> configurator
+ ) {
+ // CraftBukkit end
Explosion.BlockInteraction blockInteraction = switch (explosionInteraction) {
@@ -865,7 +865,7 @@
- for (int i1 = 0; i1 < this.players.size(); i1++) {
- ServerPlayer serverPlayer = this.players.get(i1);
+ for (int i1 = 0; i1 < receivers.size(); i1++) { // Paper - particle API
-+ ServerPlayer serverPlayer = receivers.get(i1); // Paper - particle API
++ ServerPlayer serverPlayer = receivers.get(i1); // Paper - particle API
+ if (sender != null && !serverPlayer.getBukkitEntity().canSee(sender.getBukkitEntity())) continue; // CraftBukkit
if (this.sendParticles(serverPlayer, overrideLimiter, posX, posY, posZ, clientboundLevelParticlesPacket)) {
i++;
@@ -889,11 +889,11 @@
+
+ final Optional<net.minecraft.world.level.saveddata.SavedData> cacheEntry = storage.cache.get(mapId.key());
+ if (cacheEntry == null) { // Cache did not contain, try to load and may init
-+ final MapItemSavedData worldmap = storage.get(MapItemSavedData.factory(), mapId.key()); // get populates the cache
-+ if (worldmap != null) { // map was read, init it and return
-+ worldmap.id = mapId;
-+ new org.bukkit.event.server.MapInitializeEvent(worldmap.mapView).callEvent();
-+ return worldmap;
++ final MapItemSavedData mapData = storage.get(MapItemSavedData.factory(), mapId.key()); // get populates the cache
++ if (mapData != null) { // map was read, init it and return
++ mapData.id = mapId;
++ new org.bukkit.event.server.MapInitializeEvent(mapData.mapView).callEvent();
++ return mapData;
+ }
+
+ return null; // Map does not exist, reading failed.
@@ -1096,7 +1096,7 @@
+ }
+ }
+ // Spigot end
-+ // Spigot Start
++ // Spigot start
+ if (entity.getBukkitEntity() instanceof org.bukkit.inventory.InventoryHolder && (!(entity instanceof ServerPlayer) || entity.getRemovalReason() != Entity.RemovalReason.KILLED)) { // SPIGOT-6876: closeInventory clears death message
+ // Paper start - Fix merchant inventory not closing on entity removal
+ if (entity.getBukkitEntity() instanceof org.bukkit.inventory.Merchant merchant && merchant.getTrader() != null) {
@@ -1107,7 +1107,7 @@
+ h.closeInventory(org.bukkit.event.inventory.InventoryCloseEvent.Reason.UNLOADED); // Paper - Inventory close reason
+ }
+ }
-+ // Spigot End
++ // Spigot end
ServerLevel.this.getChunkSource().removeEntity(entity);
if (entity instanceof ServerPlayer serverPlayer) {
ServerLevel.this.players.remove(serverPlayer);
diff --git a/paper-server/patches/sources/net/minecraft/server/level/ServerPlayer.java.patch b/paper-server/patches/sources/net/minecraft/server/level/ServerPlayer.java.patch
index d506c224e1..b6c60e488c 100644
--- a/paper-server/patches/sources/net/minecraft/server/level/ServerPlayer.java.patch
+++ b/paper-server/patches/sources/net/minecraft/server/level/ServerPlayer.java.patch
@@ -334,7 +334,7 @@
private void updateScoreForCriteria(ObjectiveCriteria criteria, int points) {
- this.getScoreboard().forAllObjectives(criteria, this, scoreAccess -> scoreAccess.set(points));
- }
-+ this.level().getCraftServer().getScoreboardManager().forAllObjectives(criteria, this, scoreAccess -> scoreAccess.set(points));
++ this.level().getCraftServer().getScoreboardManager().forAllObjectives(criteria, this, scoreAccess -> scoreAccess.set(points)); // CraftBukkit - Use our scores instead
+ }
+
+ // Paper start - PlayerDeathEvent#getItemsToKeep
@@ -571,11 +571,11 @@
+ );
+ // Paper end - respawn flags
+ this.level().getCraftServer().getPluginManager().callEvent(respawnEvent);
-+ // Spigot Start
++ // Spigot start
+ if (this.connection.isDisconnected()) {
+ return null;
+ }
-+ // Spigot End
++ // Spigot end
+
+ location = respawnEvent.getRespawnLocation();
+
@@ -613,7 +613,7 @@
boolean isPossibleToRespawnInThis1 = blockState1.getBlock().isPossibleToRespawnInThis(blockState1);
return isPossibleToRespawnInThis && isPossibleToRespawnInThis1
- ? Optional.of(new ServerPlayer.RespawnPosAngle(new Vec3(pos.getX() + 0.5, pos.getY() + 0.1, pos.getZ() + 0.5), angle))
-+ ? Optional.of(new ServerPlayer.RespawnPosAngle(new Vec3(pos.getX() + 0.5, pos.getY() + 0.1, pos.getZ() + 0.5), angle, false, false)) // CraftBukkit
++ ? Optional.of(new ServerPlayer.RespawnPosAngle(new Vec3(pos.getX() + 0.5, pos.getY() + 0.1, pos.getZ() + 0.5), angle, false, false)) // CraftBukkit
: Optional.empty();
}
}
@@ -1159,7 +1159,7 @@
}
- boolean flag = super.teleportTo(level, x, y, z, relativeMovements, yaw, pitch, setCamera);
-+ boolean flag = super.teleportTo(level, x, y, z, relativeMovements, yaw, pitch, setCamera, cause); // CraftBukkit
++ boolean flag = super.teleportTo(level, x, y, z, relativeMovements, yaw, pitch, setCamera, cause); // CraftBukkit
if (flag) {
this.setYHeadRot(relativeMovements.contains(Relative.Y_ROT) ? this.getYHeadRot() + yaw : yaw);
}
diff --git a/paper-server/patches/sources/net/minecraft/server/level/ServerPlayerGameMode.java.patch b/paper-server/patches/sources/net/minecraft/server/level/ServerPlayerGameMode.java.patch
index d0b244566b..fd053c54f5 100644
--- a/paper-server/patches/sources/net/minecraft/server/level/ServerPlayerGameMode.java.patch
+++ b/paper-server/patches/sources/net/minecraft/server/level/ServerPlayerGameMode.java.patch
@@ -59,7 +59,7 @@
public void tick() {
- this.gameTicks++;
-+ this.gameTicks = net.minecraft.server.MinecraftServer.currentTick; // CraftBukkit;
++ this.gameTicks = net.minecraft.server.MinecraftServer.currentTick; // CraftBukkit
if (this.hasDelayedDestroy) {
- BlockState blockState = this.level.getBlockState(this.delayedDestroyPos);
- if (blockState.isAir()) {
@@ -102,7 +102,7 @@
- return;
- }
+ // Update any tile entity data for this block
-+ capturedBlockEntity = true; // Paper - Send block entities after destroy prediction
++ this.capturedBlockEntity = true; // Paper - Send block entities after destroy prediction
+ // CraftBukkit end
+ return;
+ }
@@ -113,7 +113,7 @@
+ // Let the client know the block still exists
+ // this.player.connection.send(new ClientboundBlockUpdatePacket(this.level, pos)); // Paper - Don't resync blocks
+ // Update any tile entity data for this block
-+ capturedBlockEntity = true; // Paper - Send block entities after destroy prediction
++ this.capturedBlockEntity = true; // Paper - Send block entities after destroy prediction
+ return;
+ }
+ // CraftBukkit end
@@ -207,7 +207,7 @@
}
}
}
-@@ -235,36 +_,125 @@
+@@ -235,36 +_,127 @@
public boolean destroyBlock(BlockPos pos) {
BlockState blockState = this.level.getBlockState(pos);
@@ -258,12 +258,14 @@
+ // Paper end - Don't resync blocks
+
+ // Update any tile entity data for this block
-+ if (!captureSentBlockEntities) { // Paper - Send block entities after destroy prediction
-+ BlockEntity tileentity = this.level.getBlockEntity(pos);
-+ if (tileentity != null) {
-+ this.player.connection.send(tileentity.getUpdatePacket());
++ if (!this.captureSentBlockEntities) { // Paper - Send block entities after destroy prediction
++ BlockEntity blockEntity = this.level.getBlockEntity(pos);
++ if (blockEntity != null) {
++ this.player.connection.send(blockEntity.getUpdatePacket());
+ }
-+ } else {capturedBlockEntity = true;} // Paper - Send block entities after destroy prediction
++ } else {
++ this.capturedBlockEntity = true; // Paper - Send block entities after destroy prediction
++ }
+ return false;
+ }
+ }
diff --git a/paper-server/patches/sources/net/minecraft/server/network/ServerGamePacketListenerImpl.java.patch b/paper-server/patches/sources/net/minecraft/server/network/ServerGamePacketListenerImpl.java.patch
index 7058df616f..39098db25c 100644
--- a/paper-server/patches/sources/net/minecraft/server/network/ServerGamePacketListenerImpl.java.patch
+++ b/paper-server/patches/sources/net/minecraft/server/network/ServerGamePacketListenerImpl.java.patch
@@ -1785,21 +1785,20 @@
}
public void sendDisguisedChatMessage(Component message, ChatType.Bound boundType) {
-@@ -1579,6 +_,18 @@
+@@ -1579,6 +_,17 @@
return this.connection.getRemoteAddress();
}
-+ // Spigot Start
-+ public SocketAddress getRawAddress()
-+ {
++ // Spigot start
++ public SocketAddress getRawAddress() {
+ // Paper start - Unix domain socket support; this can be nullable in the case of a Unix domain socket, so if it is, fake something
-+ if (connection.channel.remoteAddress() == null) {
++ if (this.connection.channel.remoteAddress() == null) {
+ return new java.net.InetSocketAddress(java.net.InetAddress.getLoopbackAddress(), 0);
+ }
+ // Paper end - Unix domain socket support
+ return this.connection.channel.remoteAddress();
+ }
-+ // Spigot End
++ // Spigot end
+
public void switchToConfig() {
this.waitingForSwitchToConfig = true;
@@ -1812,12 +1811,12 @@
if (this.player.hasClientLoaded()) {
final ServerLevel serverLevel = this.player.serverLevel();
final Entity target = packet.getTarget(serverLevel);
-+ // Spigot Start
++ // Spigot start
+ if (target == this.player && !this.player.isSpectator()) {
+ this.disconnect(Component.literal("Cannot interact with self!"), org.bukkit.event.player.PlayerKickEvent.Cause.SELF_INTERACTION); // Paper - kick event cause
+ return;
+ }
-+ // Spigot End
++ // Spigot end
this.player.resetLastActionTime();
this.player.setShiftKeyDown(packet.isUsingSecondaryAction());
if (target != null) {
diff --git a/paper-server/patches/sources/net/minecraft/server/network/ServerHandshakePacketListenerImpl.java.patch b/paper-server/patches/sources/net/minecraft/server/network/ServerHandshakePacketListenerImpl.java.patch
index 64f87203f2..218905a0aa 100644
--- a/paper-server/patches/sources/net/minecraft/server/network/ServerHandshakePacketListenerImpl.java.patch
+++ b/paper-server/patches/sources/net/minecraft/server/network/ServerHandshakePacketListenerImpl.java.patch
@@ -107,9 +107,9 @@
+ if (event.callEvent()) {
+ // If we've failed somehow, let the client know so and go no further.
+ if (event.isFailed()) {
-+ Component component = io.papermc.paper.adventure.PaperAdventure.asVanilla(event.failMessage());
-+ this.connection.send(new ClientboundLoginDisconnectPacket(component));
-+ this.connection.disconnect(component);
++ Component message = io.papermc.paper.adventure.PaperAdventure.asVanilla(event.failMessage());
++ this.connection.send(new ClientboundLoginDisconnectPacket(message));
++ this.connection.disconnect(message);
+ return;
+ }
+
@@ -129,7 +129,7 @@
+ }
+ }
+ // Paper end
-+ // Spigot Start
++ // Spigot start
+ String[] split = packet.hostName().split("\00");
+ if (!handledByEvent && proxyLogicEnabled) { // Paper
+ // if (org.spigotmc.SpigotConfig.bungee) { // Paper - comment out, we check above!
@@ -141,20 +141,20 @@
+ // Paper end - Unix domain socket support
+ this.connection.spoofedUUID = com.mojang.util.UndashedUuid.fromStringLenient( split[2] );
+ } else {
-+ Component chatmessage = Component.literal("If you wish to use IP forwarding, please enable it in your BungeeCord config as well!");
-+ this.connection.send(new ClientboundLoginDisconnectPacket(chatmessage));
-+ this.connection.disconnect(chatmessage);
++ Component message = Component.literal("If you wish to use IP forwarding, please enable it in your BungeeCord config as well!");
++ this.connection.send(new ClientboundLoginDisconnectPacket(message));
++ this.connection.disconnect(message);
+ return;
+ }
+ if (split.length == 4) {
+ this.connection.spoofedProfile = ServerHandshakePacketListenerImpl.gson.fromJson(split[3], com.mojang.authlib.properties.Property[].class);
+ }
+ } else if ((split.length == 3 || split.length == 4) && (ServerHandshakePacketListenerImpl.HOST_PATTERN.matcher(split[1]).matches())) {
-+ Component chatmessage = Component.literal("Unknown data in login hostname, did you forget to enable BungeeCord in spigot.yml?");
-+ this.connection.send(new ClientboundLoginDisconnectPacket(chatmessage));
-+ this.connection.disconnect(chatmessage);
++ Component message = Component.literal("Unknown data in login hostname, did you forget to enable BungeeCord in spigot.yml?");
++ this.connection.send(new ClientboundLoginDisconnectPacket(message));
++ this.connection.disconnect(message);
+ }
-+ // Spigot End
++ // Spigot end
}
}
diff --git a/paper-server/patches/sources/net/minecraft/server/players/GameProfileCache.java.patch b/paper-server/patches/sources/net/minecraft/server/players/GameProfileCache.java.patch
index 37842106ce..2336810f52 100644
--- a/paper-server/patches/sources/net/minecraft/server/players/GameProfileCache.java.patch
+++ b/paper-server/patches/sources/net/minecraft/server/players/GameProfileCache.java.patch
@@ -47,7 +47,7 @@
GameProfileCache.GameProfileInfo gameProfileInfo = new GameProfileCache.GameProfileInfo(gameProfile, time);
this.safeAdd(gameProfileInfo);
- this.save();
-+ if(!org.spigotmc.SpigotConfig.saveUserCacheOnStopOnly) this.save(true); // Spigot - skip saving if disabled // Paper - Perf: Async GameProfileCache saving
++ if (!org.spigotmc.SpigotConfig.saveUserCacheOnStopOnly) this.save(true); // Spigot - skip saving if disabled // Paper - Perf: Async GameProfileCache saving
}
private long getNextOperation() {
@@ -130,11 +130,11 @@
return (List<GameProfileCache.GameProfileInfo>)var9;
} catch (FileNotFoundException var7) {
-+ // Spigot Start
++ // Spigot start
+ } catch (com.google.gson.JsonSyntaxException | NullPointerException ex) {
-+ GameProfileCache.LOGGER.warn( "Usercache.json is corrupted or has bad formatting. Deleting it to prevent further issues." );
++ LOGGER.warn( "Usercache.json is corrupted or has bad formatting. Deleting it to prevent further issues." );
+ this.file.delete();
-+ // Spigot End
++ // Spigot end
} catch (JsonParseException | IOException var8) {
LOGGER.warn("Failed to load profile cache {}", this.file, var8);
}
diff --git a/paper-server/patches/sources/net/minecraft/server/players/PlayerList.java.patch b/paper-server/patches/sources/net/minecraft/server/players/PlayerList.java.patch
index 80fad33f9d..8239aa71e1 100644
--- a/paper-server/patches/sources/net/minecraft/server/players/PlayerList.java.patch
+++ b/paper-server/patches/sources/net/minecraft/server/players/PlayerList.java.patch
@@ -671,11 +671,11 @@
+ } else {
+ teleportTransition = new TeleportTransition(((org.bukkit.craftbukkit.CraftWorld) location.getWorld()).getHandle(), org.bukkit.craftbukkit.util.CraftLocation.toVec3D(location), Vec3.ZERO, location.getYaw(), location.getPitch(), TeleportTransition.DO_NOTHING);
+ }
-+ // Spigot Start
++ // Spigot start
+ if (teleportTransition == null) { // Paper - Add PlayerPostRespawnEvent - diff on change - spigot early returns if respawn pos is null, that is how they handle disconnected player in respawn event
+ return player;
+ }
-+ // Spigot End
++ // Spigot end
+ ServerLevel level = teleportTransition.newLevel();
+ serverPlayer.spawnIn(level);
+ serverPlayer.unsetRemoved();
diff --git a/paper-server/patches/sources/net/minecraft/server/players/StoredUserList.java.patch b/paper-server/patches/sources/net/minecraft/server/players/StoredUserList.java.patch
index 88ab6f0915..1e359d0ca2 100644
--- a/paper-server/patches/sources/net/minecraft/server/players/StoredUserList.java.patch
+++ b/paper-server/patches/sources/net/minecraft/server/players/StoredUserList.java.patch
@@ -68,14 +68,14 @@
this.map.put(this.getKeyForUser(storedUserEntry.getUser()), (V)storedUserEntry);
}
}
-+ // Spigot Start
++ // Spigot start
+ } catch (com.google.gson.JsonParseException | NullPointerException ex) {
-+ org.bukkit.Bukkit.getLogger().log(java.util.logging.Level.WARNING, "Unable to read file " + this.file + ", backing it up to {0}.backup and creating new copy.", ex);
++ LOGGER.warn("Unable to read file {}, backing it up to {0}.backup and creating new copy.", this.file, ex);
+ File backup = new File(this.file + ".backup");
+ this.file.renameTo(backup);
+ this.file.delete();
}
-+ // Spigot End
++ // Spigot end
}
}
}
diff --git a/paper-server/patches/sources/net/minecraft/server/players/UserBanListEntry.java.patch b/paper-server/patches/sources/net/minecraft/server/players/UserBanListEntry.java.patch
index 6e3ece9070..7d07f44004 100644
--- a/paper-server/patches/sources/net/minecraft/server/players/UserBanListEntry.java.patch
+++ b/paper-server/patches/sources/net/minecraft/server/players/UserBanListEntry.java.patch
@@ -1,6 +1,6 @@
--- a/net/minecraft/server/players/UserBanListEntry.java
+++ b/net/minecraft/server/players/UserBanListEntry.java
-@@ -37,19 +_,29 @@
+@@ -37,19 +_,27 @@
@Nullable
private static GameProfile createGameProfile(JsonObject json) {
@@ -21,16 +21,14 @@
- return new GameProfile(uuid, json.get("name").getAsString());
+ }
-+ if ( json.has("name"))
-+ {
++ if (json.has("name")) {
+ name = json.get("name").getAsString();
+ }
-+ if ( uuid != null || name != null )
-+ {
-+ return new GameProfile( uuid, name );
++ if (uuid != null || name != null) {
++ return new GameProfile(uuid, name);
} else {
return null;
}
-+ // Spigot End
++ // Spigot end
}
}
diff --git a/paper-server/patches/sources/net/minecraft/stats/ServerRecipeBook.java.patch b/paper-server/patches/sources/net/minecraft/stats/ServerRecipeBook.java.patch
index c4644730ac..d289aee489 100644
--- a/paper-server/patches/sources/net/minecraft/stats/ServerRecipeBook.java.patch
+++ b/paper-server/patches/sources/net/minecraft/stats/ServerRecipeBook.java.patch
@@ -5,7 +5,7 @@
for (RecipeHolder<?> recipeHolder : recipes) {
ResourceKey<Recipe<?>> resourceKey = recipeHolder.id();
- if (!this.known.contains(resourceKey) && !recipeHolder.value().isSpecial()) {
-+ if (!this.known.contains(resourceKey) && !recipeHolder.value().isSpecial() && org.bukkit.craftbukkit.event.CraftEventFactory.handlePlayerRecipeListUpdateEvent(player, resourceKey.location())) { // CraftBukkit{
++ if (!this.known.contains(resourceKey) && !recipeHolder.value().isSpecial() && org.bukkit.craftbukkit.event.CraftEventFactory.handlePlayerRecipeListUpdateEvent(player, resourceKey.location())) { // CraftBukkit
this.add(resourceKey);
this.addHighlight(resourceKey);
this.displayResolver
diff --git a/paper-server/patches/sources/net/minecraft/stats/ServerStatsCounter.java.patch b/paper-server/patches/sources/net/minecraft/stats/ServerStatsCounter.java.patch
index 5e1b12c3cb..4d4c9288fb 100644
--- a/paper-server/patches/sources/net/minecraft/stats/ServerStatsCounter.java.patch
+++ b/paper-server/patches/sources/net/minecraft/stats/ServerStatsCounter.java.patch
@@ -1,6 +1,6 @@
--- a/net/minecraft/stats/ServerStatsCounter.java
+++ b/net/minecraft/stats/ServerStatsCounter.java
-@@ -51,9 +_,22 @@
+@@ -51,9 +_,21 @@
LOGGER.error("Couldn't parse statistics file {}", file, var5);
}
}
@@ -9,17 +9,16 @@
+ // Disables saving any forced stats, so it stays at the same value (without enabling disableStatSaving)
+ // Fixes stat initialization to not cause a NullPointerException
+ // Spigot start
-+ for ( Map.Entry<ResourceLocation, Integer> entry : org.spigotmc.SpigotConfig.forcedStats.entrySet() )
-+ {
++ for (Map.Entry<ResourceLocation, Integer> entry : org.spigotmc.SpigotConfig.forcedStats.entrySet()) {
+ Stat<ResourceLocation> wrapper = Stats.CUSTOM.get(java.util.Objects.requireNonNull(BuiltInRegistries.CUSTOM_STAT.getValue(entry.getKey()))); // Paper - ensured by SpigotConfig#stats
-+ this.stats.put( wrapper, entry.getValue().intValue() );
++ this.stats.put(wrapper, entry.getValue().intValue());
+ }
+ // Spigot end
+ // Paper end - Moved after stat fetching for player state file
}
public void save() {
-+ if ( org.spigotmc.SpigotConfig.disableStatSaving ) return; // Spigot
++ if (org.spigotmc.SpigotConfig.disableStatSaving) return; // Spigot
try {
FileUtils.writeStringToFile(this.file, this.toJson());
} catch (IOException var2) {
@@ -27,7 +26,7 @@
@Override
public void setValue(Player player, Stat<?> stat, int i) {
-+ if ( org.spigotmc.SpigotConfig.disableStatSaving ) return; // Spigot
++ if (org.spigotmc.SpigotConfig.disableStatSaving) return; // Spigot
+ if (stat.getType() == Stats.CUSTOM && stat.getValue() instanceof final ResourceLocation resourceLocation && org.spigotmc.SpigotConfig.forcedStats.get(resourceLocation) != null) return; // Paper - disable saving forced stats
super.setValue(player, stat, i);
this.dirty.add(stat);
diff --git a/paper-server/patches/sources/net/minecraft/world/CompoundContainer.java.patch b/paper-server/patches/sources/net/minecraft/world/CompoundContainer.java.patch
index adc2c80c8e..f5611a0039 100644
--- a/paper-server/patches/sources/net/minecraft/world/CompoundContainer.java.patch
+++ b/paper-server/patches/sources/net/minecraft/world/CompoundContainer.java.patch
@@ -5,7 +5,7 @@
public final Container container2;
+ // Paper start - add fields and methods
-+ public java.util.List<org.bukkit.entity.HumanEntity> transaction = new java.util.ArrayList<org.bukkit.entity.HumanEntity>();
++ public java.util.List<org.bukkit.entity.HumanEntity> transaction = new java.util.ArrayList<>();
+
+ public java.util.List<ItemStack> getContents() {
+ java.util.List<ItemStack> result = new java.util.ArrayList<>(this.getContainerSize());
diff --git a/paper-server/patches/sources/net/minecraft/world/entity/Entity.java.patch b/paper-server/patches/sources/net/minecraft/world/entity/Entity.java.patch
index da4d2fc24d..a6132cf6b8 100644
--- a/paper-server/patches/sources/net/minecraft/world/entity/Entity.java.patch
+++ b/paper-server/patches/sources/net/minecraft/world/entity/Entity.java.patch
@@ -1,6 +1,6 @@
--- a/net/minecraft/world/entity/Entity.java
+++ b/net/minecraft/world/entity/Entity.java
-@@ -136,6 +_,114 @@
+@@ -136,6 +_,108 @@
import org.slf4j.Logger;
public abstract class Entity implements SyncedDataHolder, Nameable, EntityAccess, ScoreHolder {
@@ -106,12 +106,6 @@
+ }
+ // Paper end
+
-+ // CraftBukkit - SPIGOT-6907: re-implement LivingEntity#setMaximumAir()
-+ public int getDefaultMaxAirSupply() {
-+ return Entity.TOTAL_AIR_SUPPLY;
-+ }
-+ // CraftBukkit end
-+
private static final Logger LOGGER = LogUtils.getLogger();
public static final String ID_TAG = "id";
public static final String PASSENGERS_TAG = "Passengers";
@@ -205,6 +199,19 @@
}
public boolean isColliding(BlockPos pos, BlockState state) {
+@@ -284,6 +_,12 @@
+ return team != null && team.getColor().getColor() != null ? team.getColor().getColor() : 16777215;
+ }
+
++ // CraftBukkit start - SPIGOT-6907: re-implement LivingEntity#setMaximumAir()
++ public int getDefaultMaxAirSupply() {
++ return Entity.TOTAL_AIR_SUPPLY;
++ }
++ // CraftBukkit end
++
+ public boolean isSpectator() {
+ return false;
+ }
@@ -324,7 +_,7 @@
}
diff --git a/paper-server/patches/sources/net/minecraft/world/entity/LightningBolt.java.patch b/paper-server/patches/sources/net/minecraft/world/entity/LightningBolt.java.patch
index 632c00d653..ffaffc46db 100644
--- a/paper-server/patches/sources/net/minecraft/world/entity/LightningBolt.java.patch
+++ b/paper-server/patches/sources/net/minecraft/world/entity/LightningBolt.java.patch
@@ -44,7 +44,7 @@
if (!(this.level() instanceof ServerLevel)) {
this.level().setSkyFlashTime(2);
- } else if (!this.visualOnly) {
-+ } else if (!this.visualOnly && !this.isEffect) { // Paper - Properly handle lightning effects api
++ } else if (!this.visualOnly && !this.isEffect) { // Paper - Properly handle lightning effects api
List<Entity> entities = this.level()
.getEntities(
this,
diff --git a/paper-server/patches/sources/net/minecraft/world/entity/LivingEntity.java.patch b/paper-server/patches/sources/net/minecraft/world/entity/LivingEntity.java.patch
index 6a08fbc658..ea57a78e0b 100644
--- a/paper-server/patches/sources/net/minecraft/world/entity/LivingEntity.java.patch
+++ b/paper-server/patches/sources/net/minecraft/world/entity/LivingEntity.java.patch
@@ -66,7 +66,7 @@
- this.setHealth(this.getMaxHealth());
+ this.craftAttributes = new CraftAttributeMap(this.attributes); // CraftBukkit
+ // CraftBukkit - this.setHealth(this.getMaxHealth()) inlined and simplified to skip the instanceof check for Player, as getBukkitEntity() is not initialized in constructor
-+ this.entityData.set(LivingEntity.DATA_HEALTH_ID, (float) this.getAttribute(Attributes.MAX_HEALTH).getValue());
++ this.entityData.set(LivingEntity.DATA_HEALTH_ID, this.getMaxHealth());
this.blocksBuilding = true;
this.rotA = (float)((Math.random() + 1.0) * 0.01F);
this.reapplyPosition();
diff --git a/paper-server/patches/sources/net/minecraft/world/entity/ai/goal/FloatGoal.java.patch b/paper-server/patches/sources/net/minecraft/world/entity/ai/goal/FloatGoal.java.patch
index 0fab13edb2..f73e97c903 100644
--- a/paper-server/patches/sources/net/minecraft/world/entity/ai/goal/FloatGoal.java.patch
+++ b/paper-server/patches/sources/net/minecraft/world/entity/ai/goal/FloatGoal.java.patch
@@ -4,7 +4,7 @@
public FloatGoal(Mob mob) {
this.mob = mob;
-+ if (mob.getCommandSenderWorld().paperConfig().entities.behavior.spawnerNerfedMobsShouldJump) mob.goalFloat = this; // Paper - Allow nerfed mobs to jump and float
++ if (mob.level().paperConfig().entities.behavior.spawnerNerfedMobsShouldJump) mob.goalFloat = this; // Paper - Allow nerfed mobs to jump and float
this.setFlags(EnumSet.of(Goal.Flag.JUMP));
mob.getNavigation().setCanFloat(true);
}
diff --git a/paper-server/patches/sources/net/minecraft/world/entity/ai/navigation/PathNavigation.java.patch b/paper-server/patches/sources/net/minecraft/world/entity/ai/navigation/PathNavigation.java.patch
index bd9b6ee1ee..5cc08f5dc8 100644
--- a/paper-server/patches/sources/net/minecraft/world/entity/ai/navigation/PathNavigation.java.patch
+++ b/paper-server/patches/sources/net/minecraft/world/entity/ai/navigation/PathNavigation.java.patch
@@ -50,7 +50,7 @@
+ // Paper start - EntityPathfindEvent
+ boolean copiedSet = false;
+ for (BlockPos possibleTarget : targets) {
-+ if (!this.mob.getCommandSenderWorld().getWorldBorder().isWithinBounds(possibleTarget) || !new com.destroystokyo.paper.event.entity.EntityPathfindEvent(this.mob.getBukkitEntity(), // Paper - don't path out of world border
++ if (!this.mob.level().getWorldBorder().isWithinBounds(possibleTarget) || !new com.destroystokyo.paper.event.entity.EntityPathfindEvent(this.mob.getBukkitEntity(), // Paper - don't path out of world border
+ io.papermc.paper.util.MCUtil.toLocation(this.mob.level(), possibleTarget), target == null ? null : target.getBukkitEntity()).callEvent()) {
+ if (!copiedSet) {
+ copiedSet = true;
diff --git a/paper-server/patches/sources/net/minecraft/world/entity/animal/AbstractSchoolingFish.java.patch b/paper-server/patches/sources/net/minecraft/world/entity/animal/AbstractSchoolingFish.java.patch
index 450e26f925..94cfc94803 100644
--- a/paper-server/patches/sources/net/minecraft/world/entity/animal/AbstractSchoolingFish.java.patch
+++ b/paper-server/patches/sources/net/minecraft/world/entity/animal/AbstractSchoolingFish.java.patch
@@ -4,7 +4,7 @@
}
public void stopFollowing() {
-+ if (this.leader == null) return; // Avoid NPE, plugins can now set the leader and certain fish goals might cause this method to be called
++ if (this.leader == null) return; // Paper - Avoid NPE, plugins can now set the leader and certain fish goals might cause this method to be called
this.leader.removeFollower();
this.leader = null;
}
diff --git a/paper-server/patches/sources/net/minecraft/world/entity/animal/Animal.java.patch b/paper-server/patches/sources/net/minecraft/world/entity/animal/Animal.java.patch
index a8935bd393..4f63402c67 100644
--- a/paper-server/patches/sources/net/minecraft/world/entity/animal/Animal.java.patch
+++ b/paper-server/patches/sources/net/minecraft/world/entity/animal/Animal.java.patch
@@ -14,8 +14,8 @@
@Override
- protected void actuallyHurt(ServerLevel level, DamageSource damageSource, float amount) {
+ // CraftBukkit start - void -> boolean
-+ public boolean actuallyHurt(ServerLevel worldserver, DamageSource damagesource, float f, org.bukkit.event.entity.EntityDamageEvent event) {
-+ boolean damageResult = super.actuallyHurt(worldserver, damagesource, f, event);
++ public boolean actuallyHurt(ServerLevel level, DamageSource damageSource, float amount, org.bukkit.event.entity.EntityDamageEvent event) {
++ boolean damageResult = super.actuallyHurt(level, damageSource, amount, event);
+ if (!damageResult) return false;
this.resetLove();
- super.actuallyHurt(level, damageSource, amount);
diff --git a/paper-server/patches/sources/net/minecraft/world/entity/animal/Bee.java.patch b/paper-server/patches/sources/net/minecraft/world/entity/animal/Bee.java.patch
index d8e007e816..5e9da74414 100644
--- a/paper-server/patches/sources/net/minecraft/world/entity/animal/Bee.java.patch
+++ b/paper-server/patches/sources/net/minecraft/world/entity/animal/Bee.java.patch
@@ -1,6 +1,10 @@
--- a/net/minecraft/world/entity/animal/Bee.java
+++ b/net/minecraft/world/entity/animal/Bee.java
-@@ -144,7 +_,22 @@
+@@ -141,10 +_,26 @@
+ Bee.BeeGoToHiveGoal goToHiveGoal;
+ private Bee.BeeGoToKnownFlowerGoal goToKnownFlowerGoal;
+ private int underWaterTicks;
++ public net.kyori.adventure.util.TriState rollingOverride = net.kyori.adventure.util.TriState.NOT_SET; // Paper - Rolling override
public Bee(EntityType<? extends Bee> entityType, Level level) {
super(entityType, level);
@@ -65,24 +69,18 @@
- return this.isTooFarAway(this.hivePos) ? null : this.level().getBlockEntity(this.hivePos, BlockEntityType.BEEHIVE).orElse(null);
+ // Paper start - move over logic to accommodate isTooFarAway with chunk load check
+ if (this.hivePos != null && !this.isTooFarAway(this.hivePos) && this.level().getChunkIfLoadedImmediately(this.hivePos.getX() >> 4, this.hivePos.getZ() >> 4) != null) {
-+ return (BeehiveBlockEntity) this.level().getBlockEntity(this.hivePos, BlockEntityType.BEEHIVE).orElse(null);
++ return this.level().getBlockEntity(this.hivePos, BlockEntityType.BEEHIVE).orElse(null);
}
+ return null;
+ // Paper end
}
boolean isHiveValid() {
-@@ -520,11 +_,13 @@
- this.setFlag(4, hasStung);
- }
-
-+ public net.kyori.adventure.util.TriState rollingOverride = net.kyori.adventure.util.TriState.NOT_SET; // Paper - Rolling override
- public boolean isRolling() {
- return this.getFlag(2);
+@@ -525,6 +_,7 @@
}
public void setRolling(boolean isRolling) {
-+ isRolling = rollingOverride.toBooleanOrElse(isRolling); // Paper - Rolling override
++ isRolling = this.rollingOverride.toBooleanOrElse(isRolling); // Paper - Rolling override
this.setFlag(2, isRolling);
}
diff --git a/paper-server/patches/sources/net/minecraft/world/entity/animal/Dolphin.java.patch b/paper-server/patches/sources/net/minecraft/world/entity/animal/Dolphin.java.patch
index a9f720be0d..f0e77a24be 100644
--- a/paper-server/patches/sources/net/minecraft/world/entity/animal/Dolphin.java.patch
+++ b/paper-server/patches/sources/net/minecraft/world/entity/animal/Dolphin.java.patch
@@ -1,18 +1,19 @@
--- a/net/minecraft/world/entity/animal/Dolphin.java
+++ b/net/minecraft/world/entity/animal/Dolphin.java
-@@ -63,6 +_,12 @@
- import net.minecraft.world.phys.Vec3;
+@@ -96,6 +_,13 @@
+ return EntityType.DOLPHIN.create(level, EntitySpawnReason.BREEDING);
+ }
- public class Dolphin extends AgeableWaterCreature {
+ // CraftBukkit start - SPIGOT-6907: re-implement LivingEntity#setMaximumAir()
+ @Override
+ public int getDefaultMaxAirSupply() {
+ return TOTAL_AIR_SUPPLY;
+ }
+ // CraftBukkit end
- private static final EntityDataAccessor<BlockPos> TREASURE_POS = SynchedEntityData.defineId(Dolphin.class, EntityDataSerializers.BLOCK_POS);
- private static final EntityDataAccessor<Boolean> GOT_FISH = SynchedEntityData.defineId(Dolphin.class, EntityDataSerializers.BOOLEAN);
- private static final EntityDataAccessor<Integer> MOISTNESS_LEVEL = SynchedEntityData.defineId(Dolphin.class, EntityDataSerializers.INT);
++
+ @Override
+ public float getAgeScale() {
+ return this.isBaby() ? 0.65F : 1.0F;
@@ -196,7 +_,7 @@
@Override
diff --git a/paper-server/patches/sources/net/minecraft/world/entity/animal/axolotl/Axolotl.java.patch b/paper-server/patches/sources/net/minecraft/world/entity/animal/axolotl/Axolotl.java.patch
index 302c9dd462..b39c81cfbc 100644
--- a/paper-server/patches/sources/net/minecraft/world/entity/animal/axolotl/Axolotl.java.patch
+++ b/paper-server/patches/sources/net/minecraft/world/entity/animal/axolotl/Axolotl.java.patch
@@ -22,9 +22,9 @@
}
@Override
-@@ -620,4 +_,11 @@
- return Util.getRandom(variants, random);
- }
+@@ -521,6 +_,13 @@
+ ) {
+ return level.getBlockState(pos.below()).is(BlockTags.AXOLOTLS_SPAWNABLE_ON);
}
+
+ // CraftBukkit start - SPIGOT-6907: re-implement LivingEntity#setMaximumAir()
@@ -33,4 +33,6 @@
+ return Axolotl.AXOLOTL_TOTAL_AIR_SUPPLY;
+ }
+ // CraftBukkit end
- }
+
+ public static enum AnimationState {
+ PLAYING_DEAD,
diff --git a/paper-server/patches/sources/net/minecraft/world/entity/animal/goat/Goat.java.patch b/paper-server/patches/sources/net/minecraft/world/entity/animal/goat/Goat.java.patch
index 0c41c3aea7..af11b98e94 100644
--- a/paper-server/patches/sources/net/minecraft/world/entity/animal/goat/Goat.java.patch
+++ b/paper-server/patches/sources/net/minecraft/world/entity/animal/goat/Goat.java.patch
@@ -34,10 +34,11 @@
}
}
-@@ -381,4 +_,14 @@
+@@ -381,4 +_,15 @@
) {
return level.getBlockState(pos.below()).is(BlockTags.GOATS_SPAWNABLE_ON) && isBrightEnoughToSpawn(level, pos);
}
++
+ // Paper start - Goat ram API
+ public void ram(net.minecraft.world.entity.LivingEntity entity) {
+ Brain<Goat> brain = this.getBrain();
diff --git a/paper-server/patches/sources/net/minecraft/world/entity/animal/horse/AbstractChestedHorse.java.patch b/paper-server/patches/sources/net/minecraft/world/entity/animal/horse/AbstractChestedHorse.java.patch
index 4eadfd7df1..bc6f934031 100644
--- a/paper-server/patches/sources/net/minecraft/world/entity/animal/horse/AbstractChestedHorse.java.patch
+++ b/paper-server/patches/sources/net/minecraft/world/entity/animal/horse/AbstractChestedHorse.java.patch
@@ -1,12 +1,13 @@
--- a/net/minecraft/world/entity/animal/horse/AbstractChestedHorse.java
+++ b/net/minecraft/world/entity/animal/horse/AbstractChestedHorse.java
-@@ -69,9 +_,16 @@
+@@ -69,9 +_,17 @@
super.dropEquipment(level);
if (this.hasChest()) {
this.spawnAtLocation(level, Blocks.CHEST);
+ //this.setChest(false); // Paper - moved to post death logic
+ }
+ }
++
+ // Paper start
+ protected void postDeathDropItems(org.bukkit.event.entity.EntityDeathEvent event) {
+ if (this.hasChest() && (event == null || !event.isCancelled())) {
diff --git a/paper-server/patches/sources/net/minecraft/world/entity/animal/horse/AbstractHorse.java.patch b/paper-server/patches/sources/net/minecraft/world/entity/animal/horse/AbstractHorse.java.patch
index 19135714d8..2679d44397 100644
--- a/paper-server/patches/sources/net/minecraft/world/entity/animal/horse/AbstractHorse.java.patch
+++ b/paper-server/patches/sources/net/minecraft/world/entity/animal/horse/AbstractHorse.java.patch
@@ -24,7 +24,7 @@
}
+
+ // CraftBukkit start - add fields and methods
-+ public List<HumanEntity> transaction = new java.util.ArrayList<HumanEntity>();
++ public final List<HumanEntity> transaction = new java.util.ArrayList<>();
+ private int maxStack = MAX_STACK;
+
+ @Override
@@ -132,7 +132,7 @@
}
if (this.canEatGrass()) {
-@@ -690,6 +_,15 @@
+@@ -690,6 +_,16 @@
}
}
@@ -140,6 +140,7 @@
+ public void setMouthOpen(boolean open) {
+ this.setFlag(FLAG_OPEN_MOUTH, open);
+ }
++
+ public boolean isMouthOpen() {
+ return this.getFlag(FLAG_OPEN_MOUTH);
+ }
@@ -148,7 +149,7 @@
@Override
public InteractionResult mobInteract(Player player, InteractionHand hand) {
if (this.isVehicle() || this.isBaby()) {
-@@ -727,6 +_,11 @@
+@@ -727,6 +_,12 @@
this.setFlag(16, eating);
}
@@ -157,6 +158,7 @@
+ this.setFlag(FLAG_STANDING, standing);
+ }
+ // Paper end - Horse API
++
public void setStanding(boolean standing) {
if (standing) {
this.setEating(false);
diff --git a/paper-server/patches/sources/net/minecraft/world/entity/animal/sniffer/Sniffer.java.patch b/paper-server/patches/sources/net/minecraft/world/entity/animal/sniffer/Sniffer.java.patch
index 0e059e7e5c..14f23439db 100644
--- a/paper-server/patches/sources/net/minecraft/world/entity/animal/sniffer/Sniffer.java.patch
+++ b/paper-server/patches/sources/net/minecraft/world/entity/animal/sniffer/Sniffer.java.patch
@@ -1,9 +1,9 @@
--- a/net/minecraft/world/entity/animal/sniffer/Sniffer.java
+++ b/net/minecraft/world/entity/animal/sniffer/Sniffer.java
-@@ -266,6 +_,13 @@
- BlockPos headBlock = this.getHeadBlock();
+@@ -267,6 +_,13 @@
this.dropFromGiftLootTable(serverLevel, BuiltInLootTables.SNIFFER_DIGGING, (serverLevel1, itemStack) -> {
ItemEntity itemEntity = new ItemEntity(this.level(), headBlock.getX(), headBlock.getY(), headBlock.getZ(), itemStack);
+ itemEntity.setDefaultPickUpDelay();
+ // CraftBukkit start - handle EntityDropItemEvent
+ org.bukkit.event.entity.EntityDropItemEvent event = new org.bukkit.event.entity.EntityDropItemEvent(this.getBukkitEntity(), (org.bukkit.entity.Item) itemEntity.getBukkitEntity());
+ org.bukkit.Bukkit.getPluginManager().callEvent(event);
@@ -11,9 +11,9 @@
+ return;
+ }
+ // CraftBukkit end
- itemEntity.setDefaultPickUpDelay();
serverLevel1.addFreshEntity(itemEntity);
});
+ this.playSound(SoundEvents.SNIFFER_DROP_SEED, 1.0F, 1.0F);
@@ -325,12 +_,17 @@
@Override
diff --git a/paper-server/patches/sources/net/minecraft/world/entity/boss/enderdragon/EnderDragon.java.patch b/paper-server/patches/sources/net/minecraft/world/entity/boss/enderdragon/EnderDragon.java.patch
index 48b66a876e..bb629ff9a6 100644
--- a/paper-server/patches/sources/net/minecraft/world/entity/boss/enderdragon/EnderDragon.java.patch
+++ b/paper-server/patches/sources/net/minecraft/world/entity/boss/enderdragon/EnderDragon.java.patch
@@ -48,16 +48,14 @@
double d = flyTargetLocation.x - this.getX();
double d1 = flyTargetLocation.y - this.getY();
double d2 = flyTargetLocation.z - this.getZ();
-@@ -369,7 +_,14 @@
+@@ -369,7 +_,12 @@
if (this.nearestCrystal.isRemoved()) {
this.nearestCrystal = null;
} else if (this.tickCount % 10 == 0 && this.getHealth() < this.getMaxHealth()) {
- this.setHealth(this.getHealth() + 1.0F);
+ // CraftBukkit start
+ org.bukkit.event.entity.EntityRegainHealthEvent event = new org.bukkit.event.entity.EntityRegainHealthEvent(this.getBukkitEntity(), 1.0F, org.bukkit.event.entity.EntityRegainHealthEvent.RegainReason.ENDER_CRYSTAL);
-+ this.level().getCraftServer().getPluginManager().callEvent(event);
-+
-+ if (!event.isCancelled()) {
++ if (event.callEvent()) {
+ this.setHealth((float) (this.getHealth() + event.getAmount()));
+ }
+ // CraftBukkit end
@@ -94,7 +92,7 @@
} else {
flag = true;
}
-@@ -450,6 +_,54 @@
+@@ -450,6 +_,58 @@
}
}
@@ -116,32 +114,36 @@
+ }
+ } else {
+ for (org.bukkit.block.Block block : event.blockList()) {
-+ org.bukkit.Material blockId = block.getType();
-+ if (blockId.isAir()) {
++ org.bukkit.Material blockType = block.getType();
++ if (blockType.isAir()) {
+ continue;
+ }
+
+ org.bukkit.craftbukkit.block.CraftBlock craftBlock = ((org.bukkit.craftbukkit.block.CraftBlock) block);
-+ BlockPos blockposition = craftBlock.getPosition();
++ BlockPos pos = craftBlock.getPosition();
+
+ net.minecraft.world.level.block.Block nmsBlock = craftBlock.getNMS().getBlock();
+ if (nmsBlock.dropFromExplosion(this.explosionSource)) {
-+ net.minecraft.world.level.block.entity.BlockEntity tileentity = craftBlock.getNMS().hasBlockEntity() ? this.level().getBlockEntity(blockposition) : null;
-+ net.minecraft.world.level.storage.loot.LootParams.Builder loottableinfo_builder = (new net.minecraft.world.level.storage.loot.LootParams.Builder((ServerLevel) this.level())).withParameter(net.minecraft.world.level.storage.loot.parameters.LootContextParams.ORIGIN, Vec3.atCenterOf(blockposition)).withParameter(net.minecraft.world.level.storage.loot.parameters.LootContextParams.TOOL, net.minecraft.world.item.ItemStack.EMPTY).withParameter(net.minecraft.world.level.storage.loot.parameters.LootContextParams.EXPLOSION_RADIUS, 1.0F / event.getYield()).withOptionalParameter(net.minecraft.world.level.storage.loot.parameters.LootContextParams.BLOCK_ENTITY, tileentity);
++ net.minecraft.world.level.block.entity.BlockEntity blockEntity = craftBlock.getNMS().hasBlockEntity() ? this.level().getBlockEntity(pos) : null;
++ net.minecraft.world.level.storage.loot.LootParams.Builder builder = new net.minecraft.world.level.storage.loot.LootParams.Builder((ServerLevel) this.level())
++ .withParameter(net.minecraft.world.level.storage.loot.parameters.LootContextParams.ORIGIN, Vec3.atCenterOf(pos))
++ .withParameter(net.minecraft.world.level.storage.loot.parameters.LootContextParams.TOOL, net.minecraft.world.item.ItemStack.EMPTY)
++ .withParameter(net.minecraft.world.level.storage.loot.parameters.LootContextParams.EXPLOSION_RADIUS, 1.0F / event.getYield())
++ .withOptionalParameter(net.minecraft.world.level.storage.loot.parameters.LootContextParams.BLOCK_ENTITY, blockEntity);
+
-+ craftBlock.getNMS().getDrops(loottableinfo_builder).forEach((itemstack) -> {
-+ net.minecraft.world.level.block.Block.popResource(this.level(), blockposition, itemstack);
++ craftBlock.getNMS().getDrops(builder).forEach((stack) -> {
++ net.minecraft.world.level.block.Block.popResource(this.level(), pos, stack);
+ });
-+ craftBlock.getNMS().spawnAfterBreak((ServerLevel) this.level(), blockposition, net.minecraft.world.item.ItemStack.EMPTY, false);
++ craftBlock.getNMS().spawnAfterBreak((ServerLevel) this.level(), pos, net.minecraft.world.item.ItemStack.EMPTY, false);
+ }
+ // Paper start - TNTPrimeEvent
-+ org.bukkit.block.Block tntBlock = org.bukkit.craftbukkit.block.CraftBlock.at(this.level(), blockposition);
++ org.bukkit.block.Block tntBlock = org.bukkit.craftbukkit.block.CraftBlock.at(this.level(), pos);
+ if (!new com.destroystokyo.paper.event.block.TNTPrimeEvent(tntBlock, com.destroystokyo.paper.event.block.TNTPrimeEvent.PrimeReason.EXPLOSION, explosionSource.getIndirectSourceEntity().getBukkitEntity()).callEvent())
+ continue;
+ // Paper end - TNTPrimeEvent
-+ nmsBlock.wasExploded((ServerLevel) this.level(), blockposition, this.explosionSource);
++ nmsBlock.wasExploded((ServerLevel) this.level(), pos, this.explosionSource);
+
-+ this.level().removeBlock(blockposition, false);
++ this.level().removeBlock(pos, false);
+ }
+ }
+ // CraftBukkit end
diff --git a/paper-server/patches/sources/net/minecraft/world/entity/boss/enderdragon/phases/DragonStrafePlayerPhase.java.patch b/paper-server/patches/sources/net/minecraft/world/entity/boss/enderdragon/phases/DragonStrafePlayerPhase.java.patch
index 5556c6a0ae..86f2d47cd1 100644
--- a/paper-server/patches/sources/net/minecraft/world/entity/boss/enderdragon/phases/DragonStrafePlayerPhase.java.patch
+++ b/paper-server/patches/sources/net/minecraft/world/entity/boss/enderdragon/phases/DragonStrafePlayerPhase.java.patch
@@ -6,7 +6,7 @@
DragonFireball dragonFireball = new DragonFireball(level, this.dragon, vec32.normalize());
+ dragonFireball.preserveMotion = true; // Paper - Fix Entity Teleportation and cancel velocity if teleported
dragonFireball.moveTo(d2, d3, d4, 0.0F, 0.0F);
-+ if (new com.destroystokyo.paper.event.entity.EnderDragonShootFireballEvent((org.bukkit.entity.EnderDragon) dragon.getBukkitEntity(), (org.bukkit.entity.DragonFireball) dragonFireball.getBukkitEntity()).callEvent()) // Paper - EnderDragon Events
++ if (new com.destroystokyo.paper.event.entity.EnderDragonShootFireballEvent((org.bukkit.entity.EnderDragon) this.dragon.getBukkitEntity(), (org.bukkit.entity.DragonFireball) dragonFireball.getBukkitEntity()).callEvent()) // Paper - EnderDragon Events
level.addFreshEntity(dragonFireball);
+ else dragonFireball.discard(null); // Paper - EnderDragon Events
this.fireballCharge = 0;
diff --git a/paper-server/patches/sources/net/minecraft/world/entity/boss/enderdragon/phases/EnderDragonPhaseManager.java.patch b/paper-server/patches/sources/net/minecraft/world/entity/boss/enderdragon/phases/EnderDragonPhaseManager.java.patch
index a99fa7b9c1..c9272090aa 100644
--- a/paper-server/patches/sources/net/minecraft/world/entity/boss/enderdragon/phases/EnderDragonPhaseManager.java.patch
+++ b/paper-server/patches/sources/net/minecraft/world/entity/boss/enderdragon/phases/EnderDragonPhaseManager.java.patch
@@ -1,6 +1,6 @@
--- a/net/minecraft/world/entity/boss/enderdragon/phases/EnderDragonPhaseManager.java
+++ b/net/minecraft/world/entity/boss/enderdragon/phases/EnderDragonPhaseManager.java
-@@ -23,6 +_,19 @@
+@@ -23,6 +_,18 @@
this.currentPhase.end();
}
@@ -10,8 +10,7 @@
+ (this.currentPhase == null) ? null : org.bukkit.craftbukkit.entity.CraftEnderDragon.getBukkitPhase(this.currentPhase.getPhase()),
+ org.bukkit.craftbukkit.entity.CraftEnderDragon.getBukkitPhase(phase)
+ );
-+ this.dragon.level().getCraftServer().getPluginManager().callEvent(event);
-+ if (event.isCancelled()) {
++ if (!event.callEvent()) {
+ return;
+ }
+ phase = org.bukkit.craftbukkit.entity.CraftEnderDragon.getMinecraftPhase(event.getNewPhase());
diff --git a/paper-server/patches/sources/net/minecraft/world/entity/boss/wither/WitherBoss.java.patch b/paper-server/patches/sources/net/minecraft/world/entity/boss/wither/WitherBoss.java.patch
index 9d6f177cef..936e924c09 100644
--- a/paper-server/patches/sources/net/minecraft/world/entity/boss/wither/WitherBoss.java.patch
+++ b/paper-server/patches/sources/net/minecraft/world/entity/boss/wither/WitherBoss.java.patch
@@ -1,18 +1,13 @@
--- a/net/minecraft/world/entity/boss/wither/WitherBoss.java
+++ b/net/minecraft/world/entity/boss/wither/WitherBoss.java
-@@ -77,6 +_,12 @@
- && entity.attackable();
- private static final TargetingConditions TARGETING_CONDITIONS = TargetingConditions.forCombat().range(20.0).selector(LIVING_ENTITY_SELECTOR);
-
-+ // Paper start
-+ private boolean canPortal = false;
-+
-+ public void setCanTravelThroughPortals(boolean canPortal) { this.canPortal = canPortal; }
-+ // Paper end
-+
- public WitherBoss(EntityType<? extends WitherBoss> entityType, Level level) {
- super(entityType, level);
- this.moveControl = new FlyingMoveControl(this, 10, false);
+@@ -69,6 +_,7 @@
+ private final int[] nextHeadUpdate = new int[2];
+ private final int[] idleHeadUpdates = new int[2];
+ private int destroyBlocksTick;
++ private boolean canPortal = false; // Paper
+ public final ServerBossEvent bossEvent = (ServerBossEvent)new ServerBossEvent(
+ this.getDisplayName(), BossEvent.BossBarColor.PURPLE, BossEvent.BossBarOverlay.PROGRESS
+ )
@@ -260,15 +_,40 @@
int i = this.getInvulnerableTicks() - 1;
this.bossEvent.setProgress(1.0F - i / 220.0F);
@@ -106,13 +101,20 @@
} else {
this.noActionTime = 0;
}
-@@ -547,12 +_,12 @@
+@@ -547,12 +_,18 @@
@Override
public boolean canUsePortal(boolean allowPassengers) {
- return false;
+- }
+ return this.canPortal; // Paper
- }
++ }
++
++ // Paper start
++ public void setCanTravelThroughPortals(boolean canPortal) {
++ this.canPortal = canPortal;
++ }
++ // Paper end
@Override
public boolean canBeAffected(MobEffectInstance potioneffect) {
diff --git a/paper-server/patches/sources/net/minecraft/world/entity/decoration/ArmorStand.java.patch b/paper-server/patches/sources/net/minecraft/world/entity/decoration/ArmorStand.java.patch
index 146db06871..36711a9189 100644
--- a/paper-server/patches/sources/net/minecraft/world/entity/decoration/ArmorStand.java.patch
+++ b/paper-server/patches/sources/net/minecraft/world/entity/decoration/ArmorStand.java.patch
@@ -155,7 +155,7 @@
+ // CraftBukkit end
+ // Paper start - avoid duplicate event call
+ org.bukkit.event.entity.EntityDeathEvent event = this.brokenByAnything(level, damageSource);
-+ if (!event.isCancelled()) this.kill(damageSource, false); // CraftBukkit
++ if (!event.isCancelled()) this.kill(level, damageSource, false); // CraftBukkit
+ // Paper end
return false;
} else if (damageSource.is(DamageTypeTags.IGNITES_ARMOR_STANDS)) {
@@ -204,7 +204,7 @@
+ org.bukkit.event.entity.EntityDeathEvent event = this.brokenByPlayer(level, damageSource); // Paper
this.showBreakingParticles();
- this.kill(level);
-+ if (!event.isCancelled()) this.kill(damageSource, false); // Paper - we still need to kill to follow vanilla logic (emit the game event etc...)
++ if (!event.isCancelled()) this.kill(level, damageSource, false); // Paper - we still need to kill to follow vanilla logic (emit the game event etc...)
}
return true;
@@ -215,7 +215,7 @@
- this.kill(level);
+ // Paper start - avoid duplicate event call
+ org.bukkit.event.entity.EntityDeathEvent event = this.brokenByAnything(level, damageSource);
-+ if (!event.isCancelled()) this.kill(damageSource, false); // CraftBukkit
++ if (!event.isCancelled()) this.kill(level, damageSource, false); // CraftBukkit
+ // Paper end
} else {
this.setHealth(health);
@@ -289,7 +289,7 @@
Rotations rotations = this.entityData.get(DATA_HEAD_POSE);
if (!this.headPose.equals(rotations)) {
this.setHeadPose(rotations);
-@@ -587,9 +_,31 @@
+@@ -587,9 +_,32 @@
return this.isSmall();
}
@@ -309,9 +309,10 @@
+
+ public void kill(ServerLevel level, @Nullable DamageSource damageSource) {
+ // Paper start - make cancellable
-+ this.kill(damageSource, true);
++ this.kill(level, damageSource, true);
+ }
-+ public void kill(@Nullable DamageSource damageSource, boolean callEvent) {
++
++ public void kill(ServerLevel level, @Nullable DamageSource damageSource, boolean callEvent) {
+ if (callEvent) {
+ org.bukkit.event.entity.EntityDeathEvent event = org.bukkit.craftbukkit.event.CraftEventFactory.callEntityDeathEvent(this, (damageSource == null ? this.damageSources().genericKill() : damageSource), this.drops); // CraftBukkit - call event
+ if (event.isCancelled()) return;
diff --git a/paper-server/patches/sources/net/minecraft/world/entity/item/FallingBlockEntity.java.patch b/paper-server/patches/sources/net/minecraft/world/entity/item/FallingBlockEntity.java.patch
index 397795f3c0..96b38cb9de 100644
--- a/paper-server/patches/sources/net/minecraft/world/entity/item/FallingBlockEntity.java.patch
+++ b/paper-server/patches/sources/net/minecraft/world/entity/item/FallingBlockEntity.java.patch
@@ -4,7 +4,7 @@
import net.minecraft.world.phys.Vec3;
import org.slf4j.Logger;
-+// CraftBukkit start;
++// CraftBukkit start
+import org.bukkit.craftbukkit.event.CraftEventFactory;
+import org.bukkit.event.entity.EntityRemoveEvent;
+// CraftBukkit end
@@ -20,28 +20,14 @@
public FallingBlockEntity(EntityType<? extends FallingBlockEntity> entityType, Level level) {
super(entityType, level);
-@@ -80,6 +_,10 @@
- }
-
- public static FallingBlockEntity fall(Level level, BlockPos pos, BlockState blockState) {
-+ // CraftBukkit start
-+ return FallingBlockEntity.fall(level, pos, blockState, org.bukkit.event.entity.CreatureSpawnEvent.SpawnReason.DEFAULT);
-+ }
-+ public static FallingBlockEntity fall(Level level, BlockPos pos, BlockState blockState, org.bukkit.event.entity.CreatureSpawnEvent.SpawnReason creatureSpawnReason) {
- FallingBlockEntity fallingBlockEntity = new FallingBlockEntity(
- level,
- pos.getX() + 0.5,
-@@ -89,8 +_,9 @@
+@@ -89,6 +_,7 @@
? blockState.setValue(BlockStateProperties.WATERLOGGED, Boolean.valueOf(false))
: blockState
);
+ if (!CraftEventFactory.callEntityChangeBlockEvent(fallingBlockEntity, pos, blockState.getFluidState().createLegacyBlock())) return fallingBlockEntity; // CraftBukkit
level.setBlock(pos, blockState.getFluidState().createLegacyBlock(), 3);
-- level.addFreshEntity(fallingBlockEntity);
-+ level.addFreshEntity(fallingBlockEntity, creatureSpawnReason); // CraftBukkit
+ level.addFreshEntity(fallingBlockEntity);
return fallingBlockEntity;
- }
-
@@ -139,13 +_,22 @@
@Override
public void tick() {
@@ -147,9 +133,9 @@
}
+
+ // Paper start - Expand FallingBlock API
-+ if (compound.contains("Paper.AutoExpire")) {
++ if (compound.contains("Paper.AutoExpire")) {
+ this.autoExpire = compound.getBoolean("Paper.AutoExpire");
-+ }
++ }
+ // Paper end - Expand FallingBlock API
}
diff --git a/paper-server/patches/sources/net/minecraft/world/entity/item/ItemEntity.java.patch b/paper-server/patches/sources/net/minecraft/world/entity/item/ItemEntity.java.patch
index 8700616d07..487f6205a1 100644
--- a/paper-server/patches/sources/net/minecraft/world/entity/item/ItemEntity.java.patch
+++ b/paper-server/patches/sources/net/minecraft/world/entity/item/ItemEntity.java.patch
@@ -142,18 +142,18 @@
}
return true;
-@@ -308,6 +_,11 @@
-
- @Override
- public void addAdditionalSaveData(CompoundTag compound) {
+@@ -322,6 +_,11 @@
+ if (!this.getItem().isEmpty()) {
+ compound.put("Item", this.getItem().save(this.registryAccess()));
+ }
+ // Paper start - Friction API
+ if (this.frictionState != net.kyori.adventure.util.TriState.NOT_SET) {
+ compound.putString("Paper.FrictionState", this.frictionState.toString());
+ }
+ // Paper end - Friction API
- compound.putShort("Health", (short)this.health);
- compound.putShort("Age", (short)this.age);
- compound.putShort("PickupDelay", (short)this.pickupDelay);
+ }
+
+ @Override
@@ -347,9 +_,19 @@
} else {
this.setItem(ItemStack.EMPTY);
@@ -164,7 +164,7 @@
+ try {
+ frictionState = net.kyori.adventure.util.TriState.valueOf(fs);
+ } catch (Exception ignored) {
-+ com.mojang.logging.LogUtils.getLogger().error("Unknown friction state " + fs + " for " + this);
++ com.mojang.logging.LogUtils.getLogger().error("Unknown friction state {} for {}", fs, this);
+ }
+ }
+ // Paper end - Friction API
diff --git a/paper-server/patches/sources/net/minecraft/world/entity/item/PrimedTnt.java.patch b/paper-server/patches/sources/net/minecraft/world/entity/item/PrimedTnt.java.patch
index 49714990c2..1bbdb4c9b6 100644
--- a/paper-server/patches/sources/net/minecraft/world/entity/item/PrimedTnt.java.patch
+++ b/paper-server/patches/sources/net/minecraft/world/entity/item/PrimedTnt.java.patch
@@ -4,7 +4,7 @@
import net.minecraft.world.level.material.FluidState;
import net.minecraft.world.level.portal.TeleportTransition;
-+// CraftBukkit start;
++// CraftBukkit start
+import org.bukkit.craftbukkit.event.CraftEventFactory;
+import org.bukkit.event.entity.EntityRemoveEvent;
+import org.bukkit.event.entity.ExplosionPrimeEvent;
@@ -95,7 +95,7 @@
+ if (event.isCancelled()) {
+ return;
+ }
-+ // Craftbukkit end
++ // CraftBukkit end
this.level()
.explode(
this,
@@ -118,7 +118,7 @@
+ // Paper start - Option to prevent TNT from moving in water
+ @Override
+ public boolean isPushedByFluid() {
-+ return !level().paperConfig().fixes.preventTntFromMovingInWater && super.isPushedByFluid();
++ return !this.level().paperConfig().fixes.preventTntFromMovingInWater && super.isPushedByFluid();
+ }
+ // Paper end - Option to prevent TNT from moving in water
}
diff --git a/paper-server/patches/sources/net/minecraft/world/entity/monster/Bogged.java.patch b/paper-server/patches/sources/net/minecraft/world/entity/monster/Bogged.java.patch
index 2098a78455..a7203574ef 100644
--- a/paper-server/patches/sources/net/minecraft/world/entity/monster/Bogged.java.patch
+++ b/paper-server/patches/sources/net/minecraft/world/entity/monster/Bogged.java.patch
@@ -1,6 +1,6 @@
--- a/net/minecraft/world/entity/monster/Bogged.java
+++ b/net/minecraft/world/entity/monster/Bogged.java
-@@ -72,7 +_,20 @@
+@@ -72,7 +_,19 @@
ItemStack itemInHand = player.getItemInHand(hand);
if (itemInHand.is(Items.SHEARS) && this.readyForShearing()) {
if (this.level() instanceof ServerLevel serverLevel) {
@@ -11,18 +11,17 @@
+ org.bukkit.event.player.PlayerShearEntityEvent event = org.bukkit.craftbukkit.event.CraftEventFactory.handlePlayerShearEntityEvent(player, this, itemInHand, hand, drops);
+ if (event != null) {
+ if (event.isCancelled()) {
-+ // this.getEntityData().markDirty(Bogged.DATA_SHEARED); // CraftBukkit - mark dirty to restore sheared state to clients // Paper - no longer needed
+ return InteractionResult.PASS;
+ }
+ drops = org.bukkit.craftbukkit.inventory.CraftItemStack.asNMSCopy(event.getDrops());
-+ // Paper end - custom shear drops
++ // Paper end - custom shear drops
+ }
+ // CraftBukkit end
+ this.shear(serverLevel, SoundSource.PLAYERS, itemInHand, drops); // Paper - custom shear drops
this.gameEvent(GameEvent.SHEAR, player);
itemInHand.hurtAndBreak(1, player, getSlotForHand(hand));
}
-@@ -125,15 +_,34 @@
+@@ -125,15 +_,33 @@
@Override
public void shear(ServerLevel level, SoundSource soundSource, ItemStack shears) {
@@ -53,10 +52,9 @@
- level, BuiltInLootTables.BOGGED_SHEAR, stack, (serverLevel, itemStack) -> this.spawnAtLocation(serverLevel, itemStack, this.getBbHeight())
- );
+ // Paper start - custom shear drops
-+ private void spawnShearedMushrooms(ServerLevel world, ItemStack shears, java.util.List<ItemStack> drops) {
-+ final ServerLevel worldserver1 = world; // Named for lambda consumption
++ private void spawnShearedMushrooms(ServerLevel level, ItemStack stack, java.util.List<ItemStack> drops) {
+ this.forceDrops = true; // Paper - Add missing forceDrop toggles
-+ drops.forEach(itemstack1 -> this.spawnAtLocation(world, shears, this.getBbHeight()));
++ drops.forEach(itemstack1 -> this.spawnAtLocation(level, stack, this.getBbHeight()));
+ this.forceDrops = false; // Paper - Add missing forceDrop toggles
+ // Paper end - custom shear drops
}
diff --git a/paper-server/patches/sources/net/minecraft/world/entity/monster/Creeper.java.patch b/paper-server/patches/sources/net/minecraft/world/entity/monster/Creeper.java.patch
index 30d6bab42b..6a3c837696 100644
--- a/paper-server/patches/sources/net/minecraft/world/entity/monster/Creeper.java.patch
+++ b/paper-server/patches/sources/net/minecraft/world/entity/monster/Creeper.java.patch
@@ -13,7 +13,7 @@
if (compound.getBoolean("ignited")) {
- this.ignite();
-+ this.entityData.set(Creeper.DATA_IS_IGNITED, true); // Paper - set directly to avoid firing event
++ this.entityData.set(DATA_IS_IGNITED, true); // Paper - set directly to avoid firing event
}
}
@@ -66,7 +66,7 @@
+ // CraftBukkit start
+ } else {
+ this.swell = 0;
-+ this.entityData.set(DATA_IS_IGNITED, Boolean.valueOf(false)); // Paper
++ this.entityData.set(DATA_IS_IGNITED, false); // Paper
+ }
+ // CraftBukkit end
}
@@ -81,7 +81,7 @@
areaEffectCloud.setRadius(2.5F);
areaEffectCloud.setRadiusOnUse(-0.5F);
areaEffectCloud.setWaitTime(10);
-@@ -254,16 +_,26 @@
+@@ -254,16 +_,27 @@
areaEffectCloud.addEffect(new MobEffectInstance(mobEffectInstance));
}
@@ -91,12 +91,13 @@
+ this.level().addFreshEntity(areaEffectCloud, org.bukkit.event.entity.CreatureSpawnEvent.SpawnReason.EXPLOSION); // CraftBukkit
+ }
+ }
++
+ // Paper start - CreeperIgniteEvent
+ public void setIgnited(boolean ignited) {
+ if (isIgnited() != ignited) {
+ com.destroystokyo.paper.event.entity.CreeperIgniteEvent event = new com.destroystokyo.paper.event.entity.CreeperIgniteEvent((org.bukkit.entity.Creeper) getBukkitEntity(), ignited);
+ if (event.callEvent()) {
-+ this.entityData.set(Creeper.DATA_IS_IGNITED, event.isIgnited());
++ this.entityData.set(DATA_IS_IGNITED, event.isIgnited());
+ }
+ }
+ }
diff --git a/paper-server/patches/sources/net/minecraft/world/entity/monster/EnderMan.java.patch b/paper-server/patches/sources/net/minecraft/world/entity/monster/EnderMan.java.patch
index 5989e4cd04..d68e68e4c3 100644
--- a/paper-server/patches/sources/net/minecraft/world/entity/monster/EnderMan.java.patch
+++ b/paper-server/patches/sources/net/minecraft/world/entity/monster/EnderMan.java.patch
@@ -71,22 +71,23 @@
return flag1;
}
-@@ -400,6 +_,15 @@
- public void setBeingStaredAt() {
+@@ -401,6 +_,16 @@
this.entityData.set(DATA_STARED_AT, true);
}
+
+ // Paper start
+ public void setCreepy(boolean creepy) {
-+ this.entityData.set(EnderMan.DATA_CREEPY, creepy);
++ this.entityData.set(DATA_CREEPY, creepy);
+ }
+
+ public void setHasBeenStaredAt(boolean hasBeenStaredAt) {
-+ this.entityData.set(EnderMan.DATA_STARED_AT, hasBeenStaredAt);
++ this.entityData.set(DATA_STARED_AT, hasBeenStaredAt);
+ }
+ // Paper end
-
++
@Override
public boolean requiresCustomPersistence() {
+ return super.requiresCustomPersistence() || this.getCarriedBlock() != null;
@@ -460,16 +_,19 @@
int floor1 = Mth.floor(this.enderman.getY() + random.nextDouble() * 2.0);
int floor2 = Mth.floor(this.enderman.getZ() - 1.0 + random.nextDouble() * 2.0);
diff --git a/paper-server/patches/sources/net/minecraft/world/entity/monster/Ghast.java.patch b/paper-server/patches/sources/net/minecraft/world/entity/monster/Ghast.java.patch
index 9f53b5d8a3..20e8a59f9f 100644
--- a/paper-server/patches/sources/net/minecraft/world/entity/monster/Ghast.java.patch
+++ b/paper-server/patches/sources/net/minecraft/world/entity/monster/Ghast.java.patch
@@ -17,7 +17,7 @@
}
LargeFireball largeFireball = new LargeFireball(level, this.ghast, vec3.normalize(), this.ghast.getExplosionPower());
-+ largeFireball.bukkitYield = largeFireball.explosionPower = this.ghast.getExplosionPower(); // CraftBukkit - set bukkitYield when setting explosionpower
++ largeFireball.bukkitYield = largeFireball.explosionPower = this.ghast.getExplosionPower(); // CraftBukkit - set bukkitYield when setting explosionPower
largeFireball.setPos(this.ghast.getX() + viewVector.x * 4.0, this.ghast.getY(0.5) + 0.5, largeFireball.getZ() + viewVector.z * 4.0);
level.addFreshEntity(largeFireball);
this.chargeTime = -40;
diff --git a/paper-server/patches/sources/net/minecraft/world/entity/monster/Phantom.java.patch b/paper-server/patches/sources/net/minecraft/world/entity/monster/Phantom.java.patch
index ed1eed8680..3b9061d838 100644
--- a/paper-server/patches/sources/net/minecraft/world/entity/monster/Phantom.java.patch
+++ b/paper-server/patches/sources/net/minecraft/world/entity/monster/Phantom.java.patch
@@ -1,5 +1,17 @@
--- a/net/minecraft/world/entity/monster/Phantom.java
+++ b/net/minecraft/world/entity/monster/Phantom.java
+@@ -47,6 +_,11 @@
+ Vec3 moveTargetPoint = Vec3.ZERO;
+ public BlockPos anchorPoint = BlockPos.ZERO;
+ Phantom.AttackPhase attackPhase = Phantom.AttackPhase.CIRCLE;
++ // Paper start
++ @Nullable
++ public java.util.UUID spawningEntity;
++ public boolean shouldBurnInDay = true;
++ // Paper end
+
+ public Phantom(EntityType<? extends Phantom> entityType, Level level) {
+ super(entityType, level);
@@ -141,7 +_,7 @@
@Override
@@ -9,10 +21,11 @@
this.igniteForSeconds(8.0F);
}
-@@ -165,6 +_,14 @@
+@@ -165,6 +_,15 @@
}
this.setPhantomSize(compound.getInt("Size"));
++
+ // Paper start
+ if (compound.hasUUID("Paper.SpawningEntity")) {
+ this.spawningEntity = compound.getUUID("Paper.SpawningEntity");
@@ -32,31 +45,11 @@
+ if (this.spawningEntity != null) {
+ compound.putUUID("Paper.SpawningEntity", this.spawningEntity);
+ }
-+ compound.putBoolean("Paper.ShouldBurnInDay", shouldBurnInDay);
++ compound.putBoolean("Paper.ShouldBurnInDay", this.shouldBurnInDay);
+ // Paper end
}
@Override
-@@ -222,6 +_,19 @@
- return targetingConditions.test(level, this, entity);
- }
-
-+ // Paper start
-+ @Nullable
-+ java.util.UUID spawningEntity;
-+
-+ @Nullable
-+ public java.util.UUID getSpawningEntity() {
-+ return this.spawningEntity;
-+ }
-+ public void setSpawningEntity(java.util.UUID entity) { this.spawningEntity = entity; }
-+ private boolean shouldBurnInDay = true;
-+ public boolean shouldBurnInDay() { return shouldBurnInDay; }
-+ public void setShouldBurnInDay(boolean shouldBurnInDay) { this.shouldBurnInDay = shouldBurnInDay; }
-+ // Paper end
- static enum AttackPhase {
- CIRCLE,
- SWOOP;
@@ -247,7 +_,8 @@
for (Player player : nearbyPlayers) {
diff --git a/paper-server/patches/sources/net/minecraft/world/entity/monster/Slime.java.patch b/paper-server/patches/sources/net/minecraft/world/entity/monster/Slime.java.patch
index fc7af2dd2c..6f42d379d6 100644
--- a/paper-server/patches/sources/net/minecraft/world/entity/monster/Slime.java.patch
+++ b/paper-server/patches/sources/net/minecraft/world/entity/monster/Slime.java.patch
@@ -175,10 +175,11 @@
}
@Override
-@@ -398,6 +_,12 @@
+@@ -398,6 +_,13 @@
slimeMoveControl.setDirection(this.slime.getYRot(), this.slime.isDealsDamage());
}
}
++
+ // Paper start - Slime pathfinder events; clear timer and target when goal resets
+ public void stop() {
+ this.growTiredTimer = 0;
diff --git a/paper-server/patches/sources/net/minecraft/world/entity/npc/WanderingTrader.java.patch b/paper-server/patches/sources/net/minecraft/world/entity/npc/WanderingTrader.java.patch
index 9e1d1a6ace..6c74e0007b 100644
--- a/paper-server/patches/sources/net/minecraft/world/entity/npc/WanderingTrader.java.patch
+++ b/paper-server/patches/sources/net/minecraft/world/entity/npc/WanderingTrader.java.patch
@@ -30,7 +30,7 @@
PotionContents.createItemStack(Items.POTION, Potions.INVISIBILITY),
SoundEvents.WANDERING_TRADER_DISAPPEARED,
- wanderingTrader -> this.level().isNight() && !wanderingTrader.isInvisible()
-+ wanderingTrader -> this.canDrinkPotion && this.level().isNight() && !wanderingTrader.isInvisible() // Paper - Add more WanderingTrader API
++ wanderingTrader -> this.canDrinkPotion && this.level().isNight() && !wanderingTrader.isInvisible() // Paper - Add more WanderingTrader API
)
);
this.goalSelector
diff --git a/paper-server/patches/sources/net/minecraft/world/inventory/AbstractContainerMenu.java.patch b/paper-server/patches/sources/net/minecraft/world/inventory/AbstractContainerMenu.java.patch
index e1f470371c..f28508dd93 100644
--- a/paper-server/patches/sources/net/minecraft/world/inventory/AbstractContainerMenu.java.patch
+++ b/paper-server/patches/sources/net/minecraft/world/inventory/AbstractContainerMenu.java.patch
@@ -106,7 +106,7 @@
+ org.bukkit.inventory.InventoryView view = this.getBukkitView();
+ org.bukkit.inventory.ItemStack newcursor = org.bukkit.craftbukkit.inventory.CraftItemStack.asCraftMirror(itemStack);
+ newcursor.setAmount(count);
-+ java.util.Map<Integer, org.bukkit.inventory.ItemStack> eventmap = new java.util.HashMap<Integer, org.bukkit.inventory.ItemStack>();
++ java.util.Map<Integer, org.bukkit.inventory.ItemStack> eventmap = new java.util.HashMap<>();
+ for (java.util.Map.Entry<Integer, ItemStack> ditem : draggedSlots.entrySet()) {
+ eventmap.put(ditem.getKey(), org.bukkit.craftbukkit.inventory.CraftItemStack.asBukkitCopy(ditem.getValue()));
+ }
@@ -147,12 +147,11 @@
if (!this.getCarried().isEmpty()) {
if (clickAction == ClickAction.PRIMARY) {
- player.drop(this.getCarried(), true);
-- this.setCarried(ItemStack.EMPTY);
-+ // CraftBukkit start
-+ ItemStack carried = this.getCarried();
-+ this.setCarried(ItemStack.EMPTY);
-+ player.drop(carried, true);
-+ // CraftBukkit start
++ // CraftBukkit start
++ ItemStack carried = this.getCarried();
+ this.setCarried(ItemStack.EMPTY);
++ player.drop(carried, true);
++ // CraftBukkit end
} else {
player.drop(this.getCarried().split(1), true);
}
diff --git a/paper-server/patches/sources/net/minecraft/world/inventory/BrewingStandMenu.java.patch b/paper-server/patches/sources/net/minecraft/world/inventory/BrewingStandMenu.java.patch
index feccf70be9..1c0ac6136a 100644
--- a/paper-server/patches/sources/net/minecraft/world/inventory/BrewingStandMenu.java.patch
+++ b/paper-server/patches/sources/net/minecraft/world/inventory/BrewingStandMenu.java.patch
@@ -18,7 +18,8 @@
super(MenuType.BREWING_STAND, containerId);
+ this.player = playerInventory; // CraftBukkit
checkContainerSize(brewingStandContainer, 5);
- checkContainerDataCount(brewingStandData, 2);
+- checkContainerDataCount(brewingStandData, 2);
++ checkContainerDataCount(brewingStandData, 3); // Paper - Add recipeBrewTime
this.brewingStand = brewingStandContainer;
this.brewingStandData = brewingStandData;
PotionBrewing potionBrewing = playerInventory.player.level().potionBrewing();
@@ -61,7 +62,7 @@
return ItemStack.EMPTY;
}
- } else if (BrewingStandMenu.PotionSlot.mayPlaceItem(itemStack)) {
-+ } else if (PotionSlot.mayPlaceItem(itemStack, this.player.player.level().potionBrewing())) { // Paper - custom potion mixes
++ } else if (BrewingStandMenu.PotionSlot.mayPlaceItem(itemStack, this.player.player.level().potionBrewing())) { // Paper - custom potion mixes
if (!this.moveItemStackTo(item, 0, 3, false)) {
return ItemStack.EMPTY;
}
diff --git a/paper-server/patches/sources/net/minecraft/world/inventory/CartographyTableMenu.java.patch b/paper-server/patches/sources/net/minecraft/world/inventory/CartographyTableMenu.java.patch
index 854683fadb..2e2aa4a423 100644
--- a/paper-server/patches/sources/net/minecraft/world/inventory/CartographyTableMenu.java.patch
+++ b/paper-server/patches/sources/net/minecraft/world/inventory/CartographyTableMenu.java.patch
@@ -49,7 +49,7 @@
public CartographyTableMenu(int containerId, Inventory playerInventory, final ContainerLevelAccess access) {
super(MenuType.CARTOGRAPHY_TABLE, containerId);
-+ // Paper Start - Add missing InventoryHolders - move down
++ // Paper start - Add missing InventoryHolders - move down
+ this.container = new SimpleContainer(this.createBlockHolder(access), 2) { // Paper - Add missing InventoryHolders
+ @Override
+ public void setChanged() {
@@ -66,7 +66,7 @@
+ this.resultContainer = new ResultContainer(this.createBlockHolder(access)) { // Paper - Add missing InventoryHolders
+ @Override
+ public void setChanged() {
-+ CartographyTableMenu.this.slotsChanged(this);
++ // CartographyTableMenu.this.slotsChanged(this); // Paper - Add CartographyItemEvent - do not recompute results if the result slot changes - allows to set the result slot via api
+ super.setChanged();
+ }
+ // CraftBukkit start
@@ -76,7 +76,7 @@
+ }
+ // CraftBukkit end
+ };
-+ // Paper Start - Add missing InventoryHolders - move down
++ // Paper end - Add missing InventoryHolders - move down
this.access = access;
this.addSlot(new Slot(this.container, 0, 15, 15) {
@Override
diff --git a/paper-server/patches/sources/net/minecraft/world/inventory/EnchantmentMenu.java.patch b/paper-server/patches/sources/net/minecraft/world/inventory/EnchantmentMenu.java.patch
index bb590914a6..e37648a0fb 100644
--- a/paper-server/patches/sources/net/minecraft/world/inventory/EnchantmentMenu.java.patch
+++ b/paper-server/patches/sources/net/minecraft/world/inventory/EnchantmentMenu.java.patch
@@ -20,7 +20,7 @@
public final int[] levelClue = new int[]{-1, -1, -1};
+ // CraftBukkit start
+ private org.bukkit.craftbukkit.inventory.view.CraftEnchantmentView bukkitEntity = null;
-+ private org.bukkit.entity.Player player;
++ private final org.bukkit.entity.Player player;
+ // CraftBukkit end
public EnchantmentMenu(int containerId, Inventory playerInventory) {
@@ -48,13 +48,11 @@
this.access = access;
this.addSlot(new Slot(this.enchantSlots, 0, 15, 47) {
@Override
-@@ -80,13 +_,16 @@
+@@ -80,13 +_,14 @@
this.addDataSlot(DataSlot.shared(this.levelClue, 0));
this.addDataSlot(DataSlot.shared(this.levelClue, 1));
this.addDataSlot(DataSlot.shared(this.levelClue, 2));
-+ // CraftBukkit start
-+ this.player = (org.bukkit.entity.Player) playerInventory.player.getBukkitEntity();
-+ // CraftBukkit end
++ this.player = (org.bukkit.entity.Player) playerInventory.player.getBukkitEntity(); // CraftBukkit
}
@Override
@@ -180,10 +178,11 @@
return stillValid(this.access, player, Blocks.ENCHANTING_TABLE);
}
-@@ -261,4 +_,22 @@
+@@ -261,4 +_,23 @@
return itemStack;
}
++
+ // CraftBukkit start
+ @Override
+ public org.bukkit.craftbukkit.inventory.view.CraftEnchantmentView getBukkitView() {
diff --git a/paper-server/patches/sources/net/minecraft/world/inventory/LecternMenu.java.patch b/paper-server/patches/sources/net/minecraft/world/inventory/LecternMenu.java.patch
index eb58b2f0ef..11190b8898 100644
--- a/paper-server/patches/sources/net/minecraft/world/inventory/LecternMenu.java.patch
+++ b/paper-server/patches/sources/net/minecraft/world/inventory/LecternMenu.java.patch
@@ -26,13 +26,13 @@
+ }
+ // CraftBukkit end
+
-+ // CraftBukkit start - add player
++ // CraftBukkit start - add player inventory
+ public LecternMenu(int containerId, net.minecraft.world.entity.player.Inventory playerinventory) {
+ this(containerId, new SimpleContainer(1), new SimpleContainerData(1), playerinventory);
-+ // CraftBukkit end - add player
+ }
+
+ public LecternMenu(int containerId, Container lectern, ContainerData lecternData, net.minecraft.world.entity.player.Inventory playerinventory) {
++ // CraftBukkit end - add player inventory
super(MenuType.LECTERN, containerId);
checkContainerSize(lectern, 1);
checkContainerDataCount(lecternData, 1);
diff --git a/paper-server/patches/sources/net/minecraft/world/inventory/MerchantContainer.java.patch b/paper-server/patches/sources/net/minecraft/world/inventory/MerchantContainer.java.patch
index c41d046425..3168efc559 100644
--- a/paper-server/patches/sources/net/minecraft/world/inventory/MerchantContainer.java.patch
+++ b/paper-server/patches/sources/net/minecraft/world/inventory/MerchantContainer.java.patch
@@ -5,7 +5,7 @@
public int selectionHint;
private int futureXp;
+ // CraftBukkit start - add fields and methods
-+ public java.util.List<org.bukkit.entity.HumanEntity> transaction = new java.util.ArrayList<org.bukkit.entity.HumanEntity>();
++ public java.util.List<org.bukkit.entity.HumanEntity> transaction = new java.util.ArrayList<>();
+ private int maxStack = MAX_STACK;
+
+ public java.util.List<ItemStack> getContents() {
@@ -18,7 +18,7 @@
+
+ public void onClose(org.bukkit.craftbukkit.entity.CraftHumanEntity player) {
+ this.transaction.remove(player);
-+ this.merchant.setTradingPlayer((Player) null); // SPIGOT-4860
++ this.merchant.setTradingPlayer(null); // SPIGOT-4860
+ }
+
+ public java.util.List<org.bukkit.entity.HumanEntity> getViewers() {
@@ -35,12 +35,12 @@
+ }
+
+ public org.bukkit.inventory.InventoryHolder getOwner() {
-+ return (this.merchant instanceof net.minecraft.world.entity.npc.AbstractVillager abstractVillager) ? (org.bukkit.craftbukkit.entity.CraftAbstractVillager) ((net.minecraft.world.entity.npc.AbstractVillager) this.merchant).getBukkitEntity() : null;
++ return (this.merchant instanceof net.minecraft.world.entity.npc.AbstractVillager abstractVillager) ? (org.bukkit.craftbukkit.entity.CraftAbstractVillager) abstractVillager.getBukkitEntity() : null;
+ }
+
+ @Override
+ public org.bukkit.Location getLocation() {
-+ return (this.merchant instanceof net.minecraft.world.entity.npc.AbstractVillager) ? ((net.minecraft.world.entity.npc.AbstractVillager) this.merchant).getBukkitEntity().getLocation() : null; // Paper - Fix inventories returning null Locations
++ return (this.merchant instanceof net.minecraft.world.entity.npc.AbstractVillager abstractVillager) ? abstractVillager.getBukkitEntity().getLocation() : null; // Paper - Fix inventories returning null Locations
+ }
+ // CraftBukkit end
diff --git a/paper-server/patches/sources/net/minecraft/world/inventory/StonecutterMenu.java.patch b/paper-server/patches/sources/net/minecraft/world/inventory/StonecutterMenu.java.patch
index 4f3754e2e4..5f9f27b0f0 100644
--- a/paper-server/patches/sources/net/minecraft/world/inventory/StonecutterMenu.java.patch
+++ b/paper-server/patches/sources/net/minecraft/world/inventory/StonecutterMenu.java.patch
@@ -23,7 +23,7 @@
+ final ResultContainer resultContainer; // Paper - Add missing InventoryHolders - move down
+ // CraftBukkit start
+ private org.bukkit.craftbukkit.inventory.view.CraftStonecutterView bukkitEntity = null;
-+ private org.bukkit.entity.Player player;
++ private final org.bukkit.entity.Player player;
+
+ @Override
+ public org.bukkit.craftbukkit.inventory.view.CraftStonecutterView getBukkitView() {
diff --git a/paper-server/patches/sources/net/minecraft/world/item/FireworkRocketItem.java.patch b/paper-server/patches/sources/net/minecraft/world/item/FireworkRocketItem.java.patch
index d733c3578d..8ab255c440 100644
--- a/paper-server/patches/sources/net/minecraft/world/item/FireworkRocketItem.java.patch
+++ b/paper-server/patches/sources/net/minecraft/world/item/FireworkRocketItem.java.patch
@@ -14,7 +14,7 @@
),
serverLevel,
- itemInHand
-+ itemInHand, f -> f.spawningEntity = context.getPlayer() == null ? null : context.getPlayer().getUUID() // Paper - firework api - assign spawning entity uuid
++ itemInHand, f -> f.spawningEntity = context.getPlayer() == null ? null : context.getPlayer().getUUID() // Paper - firework api - assign spawning entity uuid
);
- itemInHand.shrink(1);
+ // Paper start - PlayerLaunchProjectileEvent
diff --git a/paper-server/patches/sources/net/minecraft/world/item/ItemStack.java.patch b/paper-server/patches/sources/net/minecraft/world/item/ItemStack.java.patch
index 9eba8654c6..2bd24dd054 100644
--- a/paper-server/patches/sources/net/minecraft/world/item/ItemStack.java.patch
+++ b/paper-server/patches/sources/net/minecraft/world/item/ItemStack.java.patch
@@ -38,7 +38,7 @@
}
}
};
-@@ -365,10 +_,178 @@
+@@ -365,10 +_,171 @@
return InteractionResult.PASS;
} else {
Item item = this.getItem();
@@ -127,13 +127,6 @@
+ serverLevel.isBlockPlaceCancelled = false; // Paper - prevent calling cleanup logic when undoing a block place upon a cancelled BlockPlaceEvent
+ serverLevel.preventPoiUpdated = false;
+
-+ // Brute force all possible updates
-+ // Paper start - Don't resync blocks
-+ // BlockPos placedPos = ((CraftBlock) placeEvent.getBlock()).getPosition();
-+ // for (Direction dir : Direction.values()) {
-+ // ((ServerPlayer) entityhuman).connection.send(new ClientboundBlockUpdatePacket(world, placedPos.relative(dir)));
-+ // }
-+ // Paper end - Don't resync blocks
+ SignItem.openSign = null; // SPIGOT-6758 - Reset on early return
+ } else {
+ // Change the stack to its new contents if it hasn't been tampered with.
@@ -179,9 +172,9 @@
+ // SPIGOT-4678
+ if (this.item instanceof SignItem && SignItem.openSign != null) {
+ try {
-+ if (serverLevel.getBlockEntity(SignItem.openSign) instanceof net.minecraft.world.level.block.entity.SignBlockEntity tileentitysign) {
-+ if (serverLevel.getBlockState(SignItem.openSign).getBlock() instanceof net.minecraft.world.level.block.SignBlock blocksign) {
-+ blocksign.openTextEdit(player, tileentitysign, true, io.papermc.paper.event.player.PlayerOpenSignEvent.Cause.PLACE); // Craftbukkit // Paper - Add PlayerOpenSignEvent
++ if (serverLevel.getBlockEntity(SignItem.openSign) instanceof net.minecraft.world.level.block.entity.SignBlockEntity blockEntity) {
++ if (serverLevel.getBlockState(SignItem.openSign).getBlock() instanceof net.minecraft.world.level.block.SignBlock signBlock) {
++ signBlock.openTextEdit(player, blockEntity, true, io.papermc.paper.event.player.PlayerOpenSignEvent.Cause.PLACE); // CraftBukkit // Paper - Add PlayerOpenSignEvent
+ }
+ }
+ } finally {
@@ -229,7 +222,7 @@
+ // Paper start - add force boolean overload
+ this.hurtAndBreak(damage, level, player, onBreak, false);
+ }
-+ public void hurtAndBreak(int damage, ServerLevel level, @Nullable LivingEntity player, Consumer<Item> onBreak, boolean force) { // Paper - Add EntityDamageItemEvent
++ public void hurtAndBreak(int damage, ServerLevel level, @Nullable LivingEntity player, Consumer<Item> onBreak, boolean force) { // Paper - Add EntityDamageItemEvent
+ // Paper end
+ final int originalDamage = damage; // Paper - Expand PlayerItemDamageEvent
+ int i = this.processDurabilityChange(damage, level, player, force); // Paper
diff --git a/paper-server/patches/sources/net/minecraft/world/level/BaseSpawner.java.patch b/paper-server/patches/sources/net/minecraft/world/level/BaseSpawner.java.patch
index 273c487386..a27f9ad41f 100644
--- a/paper-server/patches/sources/net/minecraft/world/level/BaseSpawner.java.patch
+++ b/paper-server/patches/sources/net/minecraft/world/level/BaseSpawner.java.patch
@@ -73,11 +73,11 @@
}
nextSpawnData.getEquipment().ifPresent(mob::equip);
-+ // Spigot Start
++ // Spigot start
+ if (mob.level().spigotConfig.nerfSpawnerMobs) {
+ mob.aware = false;
+ }
-+ // Spigot End
++ // Spigot end
}
- if (!serverLevel.tryAddFreshEntityWithPassengers(entity)) {
diff --git a/paper-server/patches/sources/net/minecraft/world/level/GameRules.java.patch b/paper-server/patches/sources/net/minecraft/world/level/GameRules.java.patch
index 79f390f51b..0e251ca8c9 100644
--- a/paper-server/patches/sources/net/minecraft/world/level/GameRules.java.patch
+++ b/paper-server/patches/sources/net/minecraft/world/level/GameRules.java.patch
@@ -140,7 +140,7 @@
}
- public void set(boolean value, @Nullable MinecraftServer server) {
-+ public void set(boolean value, @Nullable ServerLevel level) { // CraftBukkit - per-world
++ public void set(boolean value, @Nullable ServerLevel level) { // CraftBukkit - per-world
this.value = value;
- this.onChanged(server);
+ this.onChanged(level); // CraftBukkit - per-world
@@ -161,7 +161,7 @@
@Override
- public void setFrom(GameRules.BooleanValue value, @Nullable MinecraftServer server) {
-+ public void setFrom(GameRules.BooleanValue value, @Nullable ServerLevel level) { // CraftBukkit - per-world
++ public void setFrom(GameRules.BooleanValue value, @Nullable ServerLevel level) { // CraftBukkit - per-world
this.value = value.value;
- this.onChanged(server);
+ this.onChanged(level); // CraftBukkit - per-world
@@ -208,7 +208,7 @@
+ public void set(int value, @Nullable ServerLevel level) { // CraftBukkit - per-world
this.value = value;
- this.onChanged(server);
-+ this.onChanged(level) ;// CraftBukkit - per-world
++ this.onChanged(level); // CraftBukkit - per-world
}
@Override
diff --git a/paper-server/patches/sources/net/minecraft/world/level/Level.java.patch b/paper-server/patches/sources/net/minecraft/world/level/Level.java.patch
index 82aaac77b4..66f1c0a2ed 100644
--- a/paper-server/patches/sources/net/minecraft/world/level/Level.java.patch
+++ b/paper-server/patches/sources/net/minecraft/world/level/Level.java.patch
@@ -530,30 +530,25 @@
return chunk.getBlockState(pos);
}
}
-@@ -454,32 +_,54 @@
+@@ -454,32 +_,49 @@
this.pendingBlockEntityTickers.clear();
}
- Iterator<TickingBlockEntity> iterator = this.blockEntityTickers.iterator();
+ // Spigot start
-+ // Iterator<TickingBlockEntity> iterator = this.blockEntityTickers.iterator();
boolean runsNormally = this.tickRateManager().runsNormally();
- while (iterator.hasNext()) {
- TickingBlockEntity tickingBlockEntity = iterator.next();
-+ int tilesThisCycle = 0;
+ var toRemove = new it.unimi.dsi.fastutil.objects.ReferenceOpenHashSet<TickingBlockEntity>(); // Paper - Fix MC-117075; use removeAll
+ toRemove.add(null); // Paper - Fix MC-117075
+ 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(this.tileTickPosition);
++ TickingBlockEntity tickingBlockEntity = this.blockEntityTickers.get(this.tileTickPosition);
+ // Spigot end
if (tickingBlockEntity.isRemoved()) {
- iterator.remove();
-+ // Spigot start
-+ tilesThisCycle--;
-+ toRemove.add(tickingBlockEntity); // Paper - Fix MC-117075; use removeAll
-+ // Spigot end
++ toRemove.add(tickingBlockEntity); // Paper - Fix MC-117075; use removeAll
} else if (runsNormally && this.shouldTickBlocksAt(tickingBlockEntity.getPos())) {
tickingBlockEntity.tick();
}
diff --git a/paper-server/patches/sources/net/minecraft/world/level/NaturalSpawner.java.patch b/paper-server/patches/sources/net/minecraft/world/level/NaturalSpawner.java.patch
index 5f188bd666..ef63e798ef 100644
--- a/paper-server/patches/sources/net/minecraft/world/level/NaturalSpawner.java.patch
+++ b/paper-server/patches/sources/net/minecraft/world/level/NaturalSpawner.java.patch
@@ -107,7 +107,7 @@
if (nearestPlayer != null) {
double d2 = nearestPlayer.distanceToSqr(d, y, d1);
- if (isRightDistanceToPlayerAndSpawnPoint(level, chunk, mutableBlockPos, d2)) {
-+ if (level.isLoadedAndInBounds(mutableBlockPos) && isRightDistanceToPlayerAndSpawnPoint(level, chunk, mutableBlockPos, d2)) { // Paper - don't load chunks for mob spawn
++ if (level.isLoadedAndInBounds(mutableBlockPos) && isRightDistanceToPlayerAndSpawnPoint(level, chunk, mutableBlockPos, d2)) { // Paper - don't load chunks for mob spawn
if (spawnerData == null) {
Optional<MobSpawnSettings.SpawnerData> randomSpawnMobAt = getRandomSpawnMobAt(
level, structureManager, generator, category, level.random, mutableBlockPos
diff --git a/paper-server/patches/sources/net/minecraft/world/level/ServerExplosion.java.patch b/paper-server/patches/sources/net/minecraft/world/level/ServerExplosion.java.patch
index e16fda169d..263bafc98c 100644
--- a/paper-server/patches/sources/net/minecraft/world/level/ServerExplosion.java.patch
+++ b/paper-server/patches/sources/net/minecraft/world/level/ServerExplosion.java.patch
@@ -1,6 +1,6 @@
--- a/net/minecraft/world/level/ServerExplosion.java
+++ b/net/minecraft/world/level/ServerExplosion.java
-@@ -33,6 +_,18 @@
+@@ -33,6 +_,17 @@
import net.minecraft.world.phys.HitResult;
import net.minecraft.world.phys.Vec3;
@@ -8,7 +8,6 @@
+import net.minecraft.world.entity.boss.EnderDragonPart;
+import net.minecraft.world.entity.boss.enderdragon.EnderDragon;
+import net.minecraft.world.level.block.Blocks;
-+import net.minecraft.world.level.block.state.BlockState;
+import org.bukkit.craftbukkit.event.CraftEventFactory;
+import org.bukkit.craftbukkit.util.CraftLocation;
+import org.bukkit.event.entity.EntityExplodeEvent;
@@ -61,7 +60,7 @@
if (f > 0.0F && this.damageCalculator.shouldBlockExplode(this, this.level, blockPos, blockState, f)) {
set.add(blockPos);
+ // Paper start - prevent headless pistons from forming
-+ if (!io.papermc.paper.configuration.GlobalConfiguration.get().unsupportedSettings.allowHeadlessPistons && blockState.getBlock() == Blocks.MOVING_PISTON) {
++ if (!io.papermc.paper.configuration.GlobalConfiguration.get().unsupportedSettings.allowHeadlessPistons && blockState.is(Blocks.MOVING_PISTON)) {
+ net.minecraft.world.level.block.entity.BlockEntity extension = this.level.getBlockEntity(blockPos);
+ if (extension instanceof net.minecraft.world.level.block.piston.PistonMovingBlockEntity blockEntity && blockEntity.isSourcePiston()) {
+ net.minecraft.core.Direction direction = blockState.getValue(net.minecraft.world.level.block.piston.PistonHeadBlock.FACING);
@@ -78,7 +77,7 @@
int floor5 = Mth.floor(this.center.z + f + 1.0);
-
- for (Entity entity : this.level.getEntities(this.source, new AABB(floor, floor2, floor4, floor1, floor3, floor5))) {
-+ List <Entity> list = this.level.getEntities(excludeSourceFromDamage ? this.source : null, new AABB(floor, floor2, floor4, floor1, floor3, floor5), (com.google.common.base.Predicate<Entity>) entity -> entity.isAlive() && !entity.isSpectator()); // Paper - Fix lag from explosions processing dead entities, Allow explosions to damage source
++ List <Entity> list = this.level.getEntities(excludeSourceFromDamage ? this.source : null, new AABB(floor, floor2, floor4, floor1, floor3, floor5), entity -> entity.isAlive() && !entity.isSpectator()); // Paper - Fix lag from explosions processing dead entities, Allow explosions to damage source
+ for (Entity entity : list) { // Paper - used in loop
if (!entity.ignoreExplosion(this)) {
double d = Math.sqrt(entity.distanceToSqr(this.center)) / f;
@@ -95,10 +94,10 @@
+
+ // Special case ender dragon only give knockback if no damage is cancelled
+ // Thinks to note:
-+ // - Setting a velocity to a ComplexEntityPart is ignored (and therefore not needed)
-+ // - Damaging ComplexEntityPart while forward the damage to EntityEnderDragon
++ // - Setting a velocity to a EnderDragonPart is ignored (and therefore not needed)
++ // - Damaging EnderDragonPart while forward the damage to EnderDragon
+ // - Damaging EntityEnderDragon does nothing
-+ // - EntityEnderDragon hitbock always covers the other parts and is therefore always present
++ // - EnderDragon hitbock always covers the other parts and is therefore always present
+ if (entity instanceof EnderDragonPart) {
+ continue;
+ }
@@ -106,10 +105,10 @@
+ entity.lastDamageCancelled = false;
+
+ if (entity instanceof EnderDragon) {
-+ for (EnderDragonPart entityComplexPart : ((EnderDragon) entity).subEntities) {
++ for (EnderDragonPart dragonPart : ((EnderDragon) entity).getSubEntities()) {
+ // Calculate damage separately for each EntityComplexPart
-+ if (list.contains(entityComplexPart)) {
-+ entityComplexPart.hurtServer(this.level, this.damageSource, this.damageCalculator.getEntityDamageAmount(this, entity, f1));
++ if (list.contains(dragonPart)) {
++ dragonPart.hurtServer(this.level, this.damageSource, this.damageCalculator.getEntityDamageAmount(this, entity, f1));
+ }
+ }
+ } else {
diff --git a/paper-server/patches/sources/net/minecraft/world/level/block/Block.java.patch b/paper-server/patches/sources/net/minecraft/world/level/block/Block.java.patch
index 70ed7bd204..e58b07c7a7 100644
--- a/paper-server/patches/sources/net/minecraft/world/level/block/Block.java.patch
+++ b/paper-server/patches/sources/net/minecraft/world/level/block/Block.java.patch
@@ -128,7 +128,7 @@
+ // CraftBukkit start
+ //this.popExperience(level, pos, i);
+ return i;
-+ // Craftbukkit end
++ // CraftBukkit end
+ }
+ return 0; // CraftBukkit
+ }
diff --git a/paper-server/patches/sources/net/minecraft/world/level/block/CeilingHangingSignBlock.java.patch b/paper-server/patches/sources/net/minecraft/world/level/block/CeilingHangingSignBlock.java.patch
index 64f4e71297..f965aa92d2 100644
--- a/paper-server/patches/sources/net/minecraft/world/level/block/CeilingHangingSignBlock.java.patch
+++ b/paper-server/patches/sources/net/minecraft/world/level/block/CeilingHangingSignBlock.java.patch
@@ -5,6 +5,6 @@
@Override
public <T extends BlockEntity> BlockEntityTicker<T> getTicker(Level level, BlockState state, BlockEntityType<T> blockEntityType) {
- return createTickerHelper(blockEntityType, BlockEntityType.HANGING_SIGN, SignBlockEntity::tick);
-+ return null; // Craftbukkit - remove unnecessary sign ticking
++ return null; // CraftBukkit - remove unnecessary sign ticking
}
}
diff --git a/paper-server/patches/sources/net/minecraft/world/level/block/CropBlock.java.patch b/paper-server/patches/sources/net/minecraft/world/level/block/CropBlock.java.patch
index 2e9c06c89a..0897bcc22d 100644
--- a/paper-server/patches/sources/net/minecraft/world/level/block/CropBlock.java.patch
+++ b/paper-server/patches/sources/net/minecraft/world/level/block/CropBlock.java.patch
@@ -7,7 +7,7 @@
- if (random.nextInt((int)(25.0F / growthSpeed) + 1) == 0) {
- level.setBlock(pos, this.getStateForAge(age + 1), 2);
+ // Spigot start
-+ int modifier;
++ int modifier = 100;
+ if (this == Blocks.BEETROOTS) {
+ modifier = level.spigotConfig.beetrootModifier;
+ } else if (this == Blocks.CARROTS) {
@@ -18,7 +18,7 @@
+ } else if (this == Blocks.TORCHFLOWER_CROP) {
+ modifier = level.spigotConfig.torchFlowerModifier;
+ // Paper end - Fix Spigot growth modifiers
-+ } else {
++ } else if (this == Blocks.WHEAT) {
+ modifier = level.spigotConfig.wheatModifier;
+ }
+
diff --git a/paper-server/patches/sources/net/minecraft/world/level/block/EnderChestBlock.java.patch b/paper-server/patches/sources/net/minecraft/world/level/block/EnderChestBlock.java.patch
index cc9bee614b..82a4a56c86 100644
--- a/paper-server/patches/sources/net/minecraft/world/level/block/EnderChestBlock.java.patch
+++ b/paper-server/patches/sources/net/minecraft/world/level/block/EnderChestBlock.java.patch
@@ -5,7 +5,7 @@
if (enderChestInventory != null && level.getBlockEntity(pos) instanceof EnderChestBlockEntity enderChestBlockEntity) {
BlockPos blockPos = pos.above();
- if (level.getBlockState(blockPos).isRedstoneConductor(level, blockPos)) {
-+ if (level.getBlockState(blockPos).isRedstoneConductor(level, blockPos)) { // Paper - diff on change; make sure that EnderChest#isBlocked uses the same logic
++ if (level.getBlockState(blockPos).isRedstoneConductor(level, blockPos)) { // Paper - diff on change; make sure that EnderChest#isBlocked uses the same logic
return InteractionResult.SUCCESS;
} else {
- if (level instanceof ServerLevel serverLevel) {
diff --git a/paper-server/patches/sources/net/minecraft/world/level/block/GrowingPlantHeadBlock.java.patch b/paper-server/patches/sources/net/minecraft/world/level/block/GrowingPlantHeadBlock.java.patch
index ddbe3daa0a..997e408b2f 100644
--- a/paper-server/patches/sources/net/minecraft/world/level/block/GrowingPlantHeadBlock.java.patch
+++ b/paper-server/patches/sources/net/minecraft/world/level/block/GrowingPlantHeadBlock.java.patch
@@ -1,23 +1,23 @@
--- a/net/minecraft/world/level/block/GrowingPlantHeadBlock.java
+++ b/net/minecraft/world/level/block/GrowingPlantHeadBlock.java
-@@ -44,14 +_,31 @@
+@@ -44,13 +_,31 @@
@Override
protected void randomTick(BlockState state, ServerLevel level, BlockPos pos, RandomSource random) {
- if (state.getValue(AGE) < 25 && random.nextDouble() < this.growPerTickProbability) {
+ // Spigot start
-+ int modifier;
++ int modifier = 100;
+ if (this == Blocks.KELP) {
+ modifier = level.spigotConfig.kelpModifier;
+ } else if (this == Blocks.TWISTING_VINES) {
+ modifier = level.spigotConfig.twistingVinesModifier;
+ } else if (this == Blocks.WEEPING_VINES) {
+ modifier = level.spigotConfig.weepingVinesModifier;
-+ } else {
++ } else if (this == Blocks.CAVE_VINES) {
+ modifier = level.spigotConfig.caveVinesModifier;
+ }
-+ if ((Integer) state.getValue(GrowingPlantHeadBlock.AGE) < 25 && random.nextDouble() < ((modifier / 100.0D) * this.growPerTickProbability)) { // Spigot - SPIGOT-7159: Better modifier resolution
-+ // Spigot end
++ if (state.getValue(AGE) < 25 && random.nextDouble() < ((modifier / 100.0D) * this.growPerTickProbability)) { // Spigot - SPIGOT-7159: Better modifier resolution
++ // Spigot end
BlockPos blockPos = pos.relative(this.growthDirection);
if (this.canGrowInto(level.getBlockState(blockPos))) {
- level.setBlockAndUpdate(blockPos, this.getGrowIntoState(state, level.random));
@@ -25,12 +25,12 @@
}
}
}
-
++
+ // Paper start - Fix Spigot growth modifiers
+ protected BlockState getGrowIntoState(BlockState state, RandomSource random, @javax.annotation.Nullable Level level) {
+ return this.getGrowIntoState(state, random);
+ }
+ // Paper end - Fix Spigot growth modifiers
+
protected BlockState getGrowIntoState(BlockState state, RandomSource random) {
return state.cycle(AGE);
- }
diff --git a/paper-server/patches/sources/net/minecraft/world/level/block/NetherPortalBlock.java.patch b/paper-server/patches/sources/net/minecraft/world/level/block/NetherPortalBlock.java.patch
index cb2a17d059..fa161299ce 100644
--- a/paper-server/patches/sources/net/minecraft/world/level/block/NetherPortalBlock.java.patch
+++ b/paper-server/patches/sources/net/minecraft/world/level/block/NetherPortalBlock.java.patch
@@ -86,7 +86,7 @@
- private TeleportTransition getExitPortal(ServerLevel level, Entity entity, BlockPos pos, BlockPos exitPos, boolean isNether, WorldBorder worldBorder) {
- Optional<BlockPos> optional = level.getPortalForcer().findClosestPortalPosition(exitPos, isNether, worldBorder);
+ private TeleportTransition getExitPortal(ServerLevel level, Entity entity, BlockPos pos, BlockPos exitPos, boolean isNether, WorldBorder worldBorder, int searchRadius, boolean canCreatePortal, int createRadius) { // CraftBukkit
-+ Optional<BlockPos> optional = level.getPortalForcer().findClosestPortalPosition(exitPos, worldBorder, searchRadius); // Craftbukkit
++ Optional<BlockPos> optional = level.getPortalForcer().findClosestPortalPosition(exitPos, worldBorder, searchRadius); // CraftBukkit
BlockUtil.FoundRectangle largestRectangleAround;
TeleportTransition.PostTeleportTransition postTeleportTransition;
if (optional.isPresent()) {
diff --git a/paper-server/patches/sources/net/minecraft/world/level/block/ShulkerBoxBlock.java.patch b/paper-server/patches/sources/net/minecraft/world/level/block/ShulkerBoxBlock.java.patch
index 44b9126421..148aaa4fdc 100644
--- a/paper-server/patches/sources/net/minecraft/world/level/block/ShulkerBoxBlock.java.patch
+++ b/paper-server/patches/sources/net/minecraft/world/level/block/ShulkerBoxBlock.java.patch
@@ -7,7 +7,7 @@
- && canOpen(state, level, pos, shulkerBoxBlockEntity)) {
- player.openMenu(shulkerBoxBlockEntity);
+ && canOpen(state, level, pos, shulkerBoxBlockEntity) // Paper - Fix InventoryOpenEvent cancellation - expand if for belows check
-+ && player.openMenu(shulkerBoxBlockEntity).isPresent()) { // Paper - Fix InventoryOpenEvent cancellation
++ && player.openMenu(shulkerBoxBlockEntity).isPresent()) { // Paper - Fix InventoryOpenEvent cancellation
player.awardStat(Stats.OPEN_SHULKER_BOX);
PiglinAi.angerNearbyPiglins(serverLevel, player, true);
}
diff --git a/paper-server/patches/sources/net/minecraft/world/level/block/SignBlock.java.patch b/paper-server/patches/sources/net/minecraft/world/level/block/SignBlock.java.patch
index 36c68ab94b..8029d51d21 100644
--- a/paper-server/patches/sources/net/minecraft/world/level/block/SignBlock.java.patch
+++ b/paper-server/patches/sources/net/minecraft/world/level/block/SignBlock.java.patch
@@ -48,6 +48,6 @@
@Override
public <T extends BlockEntity> BlockEntityTicker<T> getTicker(Level level, BlockState state, BlockEntityType<T> blockEntityType) {
- return createTickerHelper(blockEntityType, BlockEntityType.SIGN, SignBlockEntity::tick);
-+ return null; // Craftbukkit - remove unnecessary sign ticking
++ return null; // CraftBukkit - remove unnecessary sign ticking
}
}
diff --git a/paper-server/patches/sources/net/minecraft/world/level/block/WallHangingSignBlock.java.patch b/paper-server/patches/sources/net/minecraft/world/level/block/WallHangingSignBlock.java.patch
index 0543306a35..ad86e1ce3a 100644
--- a/paper-server/patches/sources/net/minecraft/world/level/block/WallHangingSignBlock.java.patch
+++ b/paper-server/patches/sources/net/minecraft/world/level/block/WallHangingSignBlock.java.patch
@@ -5,6 +5,6 @@
@Override
public <T extends BlockEntity> BlockEntityTicker<T> getTicker(Level level, BlockState state, BlockEntityType<T> blockEntityType) {
- return createTickerHelper(blockEntityType, BlockEntityType.HANGING_SIGN, SignBlockEntity::tick);
-+ return null; // Craftbukkit - remove unnecessary sign ticking
++ return null; // CraftBukkit - remove unnecessary sign ticking
}
}
diff --git a/paper-server/patches/sources/net/minecraft/world/level/block/entity/BeaconBlockEntity.java.patch b/paper-server/patches/sources/net/minecraft/world/level/block/entity/BeaconBlockEntity.java.patch
index 7fb16a71ce..55e57b57f1 100644
--- a/paper-server/patches/sources/net/minecraft/world/level/block/entity/BeaconBlockEntity.java.patch
+++ b/paper-server/patches/sources/net/minecraft/world/level/block/entity/BeaconBlockEntity.java.patch
@@ -83,7 +83,7 @@
if (blockEntity.lastCheckY >= height) {
blockEntity.lastCheckY = level.getMinY() - 1;
-@@ -224,36 +_,99 @@
+@@ -224,35 +_,99 @@
@Override
public void setRemoved() {
@@ -177,7 +177,6 @@
}
}
- }
--
+ return list;
+ }
+
@@ -195,13 +194,13 @@
+ apiBlock, apiEffect, (org.bukkit.entity.Player) player.getBukkitEntity(), isPrimary
+ );
+ if (!event.callEvent()) continue;
-+ player.addEffect(org.bukkit.craftbukkit.potion.CraftPotionUtil.fromBukkit(event.getEffect()));
++ player.addEffect(org.bukkit.craftbukkit.potion.CraftPotionUtil.fromBukkit(event.getEffect()), org.bukkit.event.entity.EntityPotionEffectEvent.Cause.BEACON);
+ }
+ }
+ // Paper end - BeaconEffectEvent
+
public static void playSound(Level level, BlockPos pos, SoundEvent sound) {
level.playSound(null, pos, sound, SoundSource.BLOCKS, 1.0F, 1.0F);
- }
@@ -282,7 +_,7 @@
private static Holder<MobEffect> loadEffect(CompoundTag tag, String key) {
if (tag.contains(key, 8)) {
diff --git a/paper-server/patches/sources/net/minecraft/world/level/block/entity/HopperBlockEntity.java.patch b/paper-server/patches/sources/net/minecraft/world/level/block/entity/HopperBlockEntity.java.patch
index 4c305f64e5..f654073e2d 100644
--- a/paper-server/patches/sources/net/minecraft/world/level/block/entity/HopperBlockEntity.java.patch
+++ b/paper-server/patches/sources/net/minecraft/world/level/block/entity/HopperBlockEntity.java.patch
@@ -208,7 +208,7 @@
boolean flag = false;
boolean isEmpty = destination.isEmpty();
if (item.isEmpty()) {
-+ // Spigot start - SPIGOT-6693, InventorySubcontainer#setItem
++ // Spigot start - SPIGOT-6693, SimpleContainer#setItem
+ ItemStack leftover = ItemStack.EMPTY; // Paper - Make hoppers respect inventory max stack size
+ if (!stack.isEmpty() && stack.getCount() > destination.getMaxStackSize()) {
+ leftover = stack; // Paper - Make hoppers respect inventory max stack size
diff --git a/paper-server/patches/sources/net/minecraft/world/level/chunk/ChunkAccess.java.patch b/paper-server/patches/sources/net/minecraft/world/level/chunk/ChunkAccess.java.patch
index b70d49f1a0..baf2047d7c 100644
--- a/paper-server/patches/sources/net/minecraft/world/level/chunk/ChunkAccess.java.patch
+++ b/paper-server/patches/sources/net/minecraft/world/level/chunk/ChunkAccess.java.patch
@@ -35,7 +35,7 @@
}
replaceMissingSections(biomeRegistry, this.sections);
-+ this.biomeRegistry = biomeRegistry; // Craftbukkit
++ this.biomeRegistry = biomeRegistry; // CraftBukkit
}
private static void replaceMissingSections(Registry<Biome> biomeRegistry, LevelChunkSection[] sections) {
diff --git a/paper-server/patches/sources/net/minecraft/world/level/chunk/LevelChunk.java.patch b/paper-server/patches/sources/net/minecraft/world/level/chunk/LevelChunk.java.patch
index 7d3779bd7c..0adecb3d87 100644
--- a/paper-server/patches/sources/net/minecraft/world/level/chunk/LevelChunk.java.patch
+++ b/paper-server/patches/sources/net/minecraft/world/level/chunk/LevelChunk.java.patch
@@ -106,7 +106,7 @@
public FluidState getFluidState(int x, int y, int z) {
- try {
-+ // try { // Paper start - Perf: Optimise Chunk#getFluid
++ // try { // Paper start - Perf: Optimise Chunk#getFluid
int sectionIndex = this.getSectionIndex(y);
if (sectionIndex >= 0 && sectionIndex < this.sections.length) {
LevelChunkSection levelChunkSection = this.sections[sectionIndex];
diff --git a/paper-server/patches/sources/net/minecraft/world/level/levelgen/PatrolSpawner.java.patch b/paper-server/patches/sources/net/minecraft/world/level/levelgen/PatrolSpawner.java.patch
index 0e1624f5dc..b25a255606 100644
--- a/paper-server/patches/sources/net/minecraft/world/level/levelgen/PatrolSpawner.java.patch
+++ b/paper-server/patches/sources/net/minecraft/world/level/levelgen/PatrolSpawner.java.patch
@@ -57,7 +57,7 @@
+ } else {
+ long days;
+ if (level.paperConfig().entities.behavior.pillagerPatrols.start.perPlayer) {
-+ days = player.getStats().getValue(net.minecraft.stats.Stats.CUSTOM.get(net.minecraft.stats.Stats.PLAY_TIME)) / 24000L; // PLAY_ONE_MINUTE is actually counting in ticks, a misnomer by Mojang
++ days = player.getStats().getValue(net.minecraft.stats.Stats.CUSTOM.get(net.minecraft.stats.Stats.PLAY_TIME)) / 24000L; // PLAY_TIME is counting in ticks
+ } else {
+ days = level.getDayTime() / 24000L;
+ }
diff --git a/paper-server/patches/sources/net/minecraft/world/level/levelgen/PhantomSpawner.java.patch b/paper-server/patches/sources/net/minecraft/world/level/levelgen/PhantomSpawner.java.patch
index 80e3eeee2e..19c728a9ed 100644
--- a/paper-server/patches/sources/net/minecraft/world/level/levelgen/PhantomSpawner.java.patch
+++ b/paper-server/patches/sources/net/minecraft/world/level/levelgen/PhantomSpawner.java.patch
@@ -55,7 +55,7 @@
+ // Paper end - PhantomPreSpawnEvent
Phantom phantom = EntityType.PHANTOM.create(level, EntitySpawnReason.NATURAL);
if (phantom != null) {
-+ phantom.setSpawningEntity(serverPlayer.getUUID()); // Paper - PhantomPreSpawnEvent
++ phantom.spawningEntity = serverPlayer.getUUID(); // Paper - PhantomPreSpawnEvent
phantom.moveTo(blockPos1, 0.0F, 0.0F);
spawnGroupData = phantom.finalizeSpawn(
level, currentDifficultyAt, EntitySpawnReason.NATURAL, spawnGroupData
diff --git a/paper-server/patches/sources/net/minecraft/world/level/material/FlowingFluid.java.patch b/paper-server/patches/sources/net/minecraft/world/level/material/FlowingFluid.java.patch
index 4ade7f8dfa..9457eaacf4 100644
--- a/paper-server/patches/sources/net/minecraft/world/level/material/FlowingFluid.java.patch
+++ b/paper-server/patches/sources/net/minecraft/world/level/material/FlowingFluid.java.patch
@@ -41,7 +41,7 @@
for (Direction direction : Direction.Plane.HORIZONTAL) {
BlockPos blockPos = mutableBlockPos.setWithOffset(pos, direction);
- BlockState blockState = level.getBlockState(blockPos);
-+ BlockState blockState = level.getBlockStateIfLoaded(mutableBlockPos); // Paper - Prevent chunk loading from fluid flowing
++ BlockState blockState = level.getBlockStateIfLoaded(blockPos); // Paper - Prevent chunk loading from fluid flowing
+ if (blockState == null) continue; // Paper - Prevent chunk loading from fluid flowing
FluidState fluidState = blockState.getFluidState();
if (fluidState.getType().isSame(this) && canPassThroughWall(direction, level, pos, state, blockPos, blockState)) {
diff --git a/paper-server/patches/sources/net/minecraft/world/level/redstone/NeighborUpdater.java.patch b/paper-server/patches/sources/net/minecraft/world/level/redstone/NeighborUpdater.java.patch
index e4a2c7c33c..7c2db6c3ac 100644
--- a/paper-server/patches/sources/net/minecraft/world/level/redstone/NeighborUpdater.java.patch
+++ b/paper-server/patches/sources/net/minecraft/world/level/redstone/NeighborUpdater.java.patch
@@ -23,10 +23,10 @@
+ }
+ // CraftBukkit end
state.handleNeighborChanged(level, pos, neighborBlock, orientation, movedByPiston);
-+ // Spigot Start
++ // Spigot start
+ } catch (StackOverflowError ex) {
+ level.lastPhysicsProblem = new BlockPos(pos);
-+ // Spigot End
++ // Spigot end
} catch (Throwable var9) {
CrashReport crashReport = CrashReport.forThrowable(var9, "Exception while updating neighbours");
CrashReportCategory crashReportCategory = crashReport.addCategory("Block being updated");
diff --git a/paper-server/patches/sources/net/minecraft/world/level/storage/PlayerDataStorage.java.patch b/paper-server/patches/sources/net/minecraft/world/level/storage/PlayerDataStorage.java.patch
index f531362c07..23c6073c85 100644
--- a/paper-server/patches/sources/net/minecraft/world/level/storage/PlayerDataStorage.java.patch
+++ b/paper-server/patches/sources/net/minecraft/world/level/storage/PlayerDataStorage.java.patch
@@ -49,26 +49,26 @@
- File file = new File(this.playerDir, player.getStringUUID() + suffix);
+ private Optional<CompoundTag> load(String name, String stringUuid, String suffix) { // CraftBukkit
+ File file = new File(this.playerDir, stringUuid + suffix); // CraftBukkit
-+ // Spigot Start
++ // Spigot start
+ boolean usingWrongFile = false;
+ if (org.bukkit.Bukkit.getOnlineMode() && !file.exists()) { // Paper - Check online mode first
+ file = new File(file, java.util.UUID.nameUUIDFromBytes(("OfflinePlayer:" + name).getBytes(java.nio.charset.StandardCharsets.UTF_8)).toString() + suffix);
+ if (file.exists()) {
+ usingWrongFile = true;
-+ org.bukkit.Bukkit.getServer().getLogger().warning("Using offline mode UUID file for player " + name + " as it is the only copy we can find.");
++ LOGGER.warn("Using offline mode UUID file for player {} as it is the only copy we can find.", name);
+ }
+ }
-+ // Spigot End
++ // Spigot end
if (file.exists() && file.isFile()) {
try {
- return Optional.of(NbtIo.readCompressed(file.toPath(), NbtAccounter.unlimitedHeap()));
-+ // Spigot Start
++ // Spigot start
+ Optional<CompoundTag> optional = Optional.of(NbtIo.readCompressed(file.toPath(), NbtAccounter.unlimitedHeap()));
+ if (usingWrongFile) {
+ file.renameTo(new File(file.getPath() + ".offline-read"));
+ }
+ return optional;
-+ // Spigot End
++ // Spigot end
} catch (Exception var5) {
- LOGGER.warn("Failed to load player data for {}", player.getName().getString());
+ LOGGER.warn("Failed to load player data for {}", name); // CraftBukkit
diff --git a/paper-server/src/main/java/org/bukkit/craftbukkit/CraftServer.java b/paper-server/src/main/java/org/bukkit/craftbukkit/CraftServer.java
index 2cdfb3ac17..d3ad9f5097 100644
--- a/paper-server/src/main/java/org/bukkit/craftbukkit/CraftServer.java
+++ b/paper-server/src/main/java/org/bukkit/craftbukkit/CraftServer.java
@@ -904,13 +904,13 @@ public final class CraftServer implements Server {
@Override
public long getConnectionThrottle() {
- // Spigot Start - Automatically set connection throttle for bungee configurations
+ // Spigot start - Automatically set connection throttle for bungee configurations
if (org.spigotmc.SpigotConfig.bungee || io.papermc.paper.configuration.GlobalConfiguration.get().proxies.velocity.enabled) { // Paper - Add Velocity IP Forwarding Support
return -1;
} else {
return this.configuration.getInt("settings.connection-throttle");
}
- // Spigot End
+ // Spigot end
}
@Override
@@ -2131,7 +2131,7 @@ public final class CraftServer implements Server {
if (result == null) {
GameProfile profile = null;
// Only fetch an online UUID in online mode
- if (this.getOnlineMode() || io.papermc.paper.configuration.GlobalConfiguration.get().proxies.isProxyOnlineMode()) { // Paper - Add setting for proxy online mode status
+ if (io.papermc.paper.configuration.GlobalConfiguration.get().proxies.isProxyOnlineMode()) { // Paper - Add setting for proxy online mode status
// This is potentially blocking :(
profile = this.console.getProfileCache().get(name).orElse(null);
}
@@ -2585,12 +2585,11 @@ public final class CraftServer implements Server {
}
public List<String> tabCompleteCommand(Player player, String message, ServerLevel world, Vec3 pos) {
- // Spigot Start
- if ( (org.spigotmc.SpigotConfig.tabComplete < 0 || message.length() <= org.spigotmc.SpigotConfig.tabComplete) && !message.contains( " " ) )
- {
+ // Spigot start
+ if ((org.spigotmc.SpigotConfig.tabComplete < 0 || message.length() <= org.spigotmc.SpigotConfig.tabComplete) && !message.contains(" ")) {
return ImmutableList.of();
}
- // Spigot End
+ // Spigot end
List<String> completions = null;
try {
diff --git a/paper-server/src/main/java/org/bukkit/craftbukkit/Main.java b/paper-server/src/main/java/org/bukkit/craftbukkit/Main.java
index 1c2439ffc1..ecb0fcd1f3 100644
--- a/paper-server/src/main/java/org/bukkit/craftbukkit/Main.java
+++ b/paper-server/src/main/java/org/bukkit/craftbukkit/Main.java
@@ -149,13 +149,13 @@ public class Main {
this.acceptsAll(Main.asList("initSettings"), "Only create configuration files and then exit"); // SPIGOT-5761: Add initSettings option
- // Spigot Start
+ // Spigot start
this.acceptsAll(Main.asList("S", "spigot-settings"), "File for spigot settings")
.withRequiredArg()
.ofType(File.class)
.defaultsTo(new File("spigot.yml"))
.describedAs("Yml file");
- // Spigot End
+ // Spigot end
// Paper start
acceptsAll(asList("paper-dir", "paper-settings-directory"), "Directory for Paper settings")
diff --git a/paper-server/src/main/java/org/bukkit/craftbukkit/entity/CraftEnderDragon.java b/paper-server/src/main/java/org/bukkit/craftbukkit/entity/CraftEnderDragon.java
index 7b7b89e67d..1ef0ec7ed3 100644
--- a/paper-server/src/main/java/org/bukkit/craftbukkit/entity/CraftEnderDragon.java
+++ b/paper-server/src/main/java/org/bukkit/craftbukkit/entity/CraftEnderDragon.java
@@ -23,7 +23,7 @@ public class CraftEnderDragon extends CraftMob implements EnderDragon, CraftEnem
public Set<ComplexEntityPart> getParts() {
Builder<ComplexEntityPart> builder = ImmutableSet.builder();
- for (EnderDragonPart part : this.getHandle().subEntities) {
+ for (EnderDragonPart part : this.getHandle().getSubEntities()) {
builder.add((ComplexEntityPart) part.getBukkitEntity());
}
diff --git a/paper-server/src/main/java/org/bukkit/craftbukkit/entity/CraftPhantom.java b/paper-server/src/main/java/org/bukkit/craftbukkit/entity/CraftPhantom.java
index 83e77c6d28..429200b0b0 100644
--- a/paper-server/src/main/java/org/bukkit/craftbukkit/entity/CraftPhantom.java
+++ b/paper-server/src/main/java/org/bukkit/craftbukkit/entity/CraftPhantom.java
@@ -32,17 +32,17 @@ public class CraftPhantom extends CraftFlying implements Phantom, CraftEnemy {
// Paper start
@Override
public java.util.UUID getSpawningEntity() {
- return getHandle().getSpawningEntity();
+ return this.getHandle().spawningEntity;
}
@Override
public boolean shouldBurnInDay() {
- return getHandle().shouldBurnInDay();
+ return this.getHandle().shouldBurnInDay;
}
@Override
public void setShouldBurnInDay(boolean shouldBurnInDay) {
- getHandle().setShouldBurnInDay(shouldBurnInDay);
+ this.getHandle().shouldBurnInDay = shouldBurnInDay;
}
@Override
diff --git a/paper-server/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java b/paper-server/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java
index e9df37ff66..1bdad8088d 100644
--- a/paper-server/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java
+++ b/paper-server/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java
@@ -543,7 +543,7 @@ public class CraftPlayer extends CraftHumanEntity implements Player {
@Override
public String getDisplayName() {
- if(true) return io.papermc.paper.adventure.DisplayNames.getLegacy(this); // Paper
+ if (true) return io.papermc.paper.adventure.DisplayNames.getLegacy(this); // Paper
return this.getHandle().displayName;
}
diff --git a/paper-server/src/main/java/org/bukkit/craftbukkit/inventory/CraftMetaItem.java b/paper-server/src/main/java/org/bukkit/craftbukkit/inventory/CraftMetaItem.java
index 01ea7cdedd..eb7d90cfa9 100644
--- a/paper-server/src/main/java/org/bukkit/craftbukkit/inventory/CraftMetaItem.java
+++ b/paper-server/src/main/java/org/bukkit/craftbukkit/inventory/CraftMetaItem.java
@@ -2361,7 +2361,7 @@ class CraftMetaItem implements ItemMeta, Damageable, Repairable, BlockDataMeta {
for (Object object : addFrom) {
// Paper start - support components
- if(object instanceof net.md_5.bungee.api.chat.BaseComponent[] baseComponentArr) {
+ if (object instanceof net.md_5.bungee.api.chat.BaseComponent[] baseComponentArr) {
addTo.add(CraftChatMessage.fromJSON(net.md_5.bungee.chat.ComponentSerializer.toString(baseComponentArr)));
} else
// Paper end