diff --git a/patches/unapplied/server/Add-BellRevealRaiderEvent.patch b/patches/server/Add-BellRevealRaiderEvent.patch similarity index 100% rename from patches/unapplied/server/Add-BellRevealRaiderEvent.patch rename to patches/server/Add-BellRevealRaiderEvent.patch diff --git a/patches/unapplied/server/Add-ElderGuardianAppearanceEvent.patch b/patches/server/Add-ElderGuardianAppearanceEvent.patch similarity index 90% rename from patches/unapplied/server/Add-ElderGuardianAppearanceEvent.patch rename to patches/server/Add-ElderGuardianAppearanceEvent.patch index d6592fa2cc..3c9cdce592 100644 --- a/patches/unapplied/server/Add-ElderGuardianAppearanceEvent.patch +++ b/patches/server/Add-ElderGuardianAppearanceEvent.patch @@ -19,11 +19,11 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 + public static List addEffectToPlayersAround(ServerLevel worldserver, @Nullable Entity entity, Vec3 vec3d, double d0, MobEffectInstance mobeffect, int i, org.bukkit.event.entity.EntityPotionEffectEvent.Cause cause, @Nullable java.util.function.Predicate playerPredicate) { + // Paper end - Add ElderGuardianAppearanceEvent // CraftBukkit end - MobEffect mobeffectlist = mobeffect.getEffect(); + Holder holder = mobeffect.getEffect(); List list = worldserver.getPlayers((entityplayer) -> { -- return entityplayer.gameMode.isSurvival() && (entity == null || !entity.isAlliedTo((Entity) entityplayer)) && vec3d.closerThan(entityplayer.position(), d0) && (!entityplayer.hasEffect(mobeffectlist) || entityplayer.getEffect(mobeffectlist).getAmplifier() < mobeffect.getAmplifier() || entityplayer.getEffect(mobeffectlist).endsWithin(i - 1)); +- return entityplayer.gameMode.isSurvival() && (entity == null || !entity.isAlliedTo((Entity) entityplayer)) && vec3d.closerThan(entityplayer.position(), d0) && (!entityplayer.hasEffect(holder) || entityplayer.getEffect(holder).getAmplifier() < mobeffect.getAmplifier() || entityplayer.getEffect(holder).endsWithin(i - 1)); + // Paper start - Add ElderGuardianAppearanceEvent -+ boolean condition = entityplayer.gameMode.isSurvival() && (entity == null || !entity.isAlliedTo((Entity) entityplayer)) && vec3d.closerThan(entityplayer.position(), d0) && (!entityplayer.hasEffect(mobeffectlist) || entityplayer.getEffect(mobeffectlist).getAmplifier() < mobeffect.getAmplifier() || entityplayer.getEffect(mobeffectlist).endsWithin(i - 1)); ++ boolean condition = entityplayer.gameMode.isSurvival() && (entity == null || !entity.isAlliedTo((Entity) entityplayer)) && vec3d.closerThan(entityplayer.position(), d0) && (!entityplayer.hasEffect(holder) || entityplayer.getEffect(holder).getAmplifier() < mobeffect.getAmplifier() || entityplayer.getEffect(holder).endsWithin(i - 1)); + if (condition) { + return playerPredicate == null || playerPredicate.test(entityplayer); // Only test the player AFTER it is true + } else { diff --git a/patches/unapplied/server/Add-EntityInsideBlockEvent.patch b/patches/server/Add-EntityInsideBlockEvent.patch similarity index 89% rename from patches/unapplied/server/Add-EntityInsideBlockEvent.patch rename to patches/server/Add-EntityInsideBlockEvent.patch index 23db72bdf8..acd88689ce 100644 --- a/patches/unapplied/server/Add-EntityInsideBlockEvent.patch +++ b/patches/server/Add-EntityInsideBlockEvent.patch @@ -11,7 +11,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 @@ -0,0 +0,0 @@ public abstract class BaseFireBlock extends Block { @Override - public void entityInside(BlockState state, Level world, BlockPos pos, Entity entity) { + protected void entityInside(BlockState state, Level world, BlockPos pos, Entity entity) { + if (!new io.papermc.paper.event.entity.EntityInsideBlockEvent(entity.getBukkitEntity(), org.bukkit.craftbukkit.block.CraftBlock.at(world, pos)).callEvent()) { return; } // Paper - Add EntityInsideBlockEvent if (!entity.fireImmune()) { entity.setRemainingFireTicks(entity.getRemainingFireTicks() + 1); @@ -23,7 +23,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 @@ -0,0 +0,0 @@ public abstract class BasePressurePlateBlock extends Block { @Override - public void entityInside(BlockState state, Level world, BlockPos pos, Entity entity) { + protected void entityInside(BlockState state, Level world, BlockPos pos, Entity entity) { + if (!new io.papermc.paper.event.entity.EntityInsideBlockEvent(entity.getBukkitEntity(), org.bukkit.craftbukkit.block.CraftBlock.at(world, pos)).callEvent()) { return; } // Paper - Add EntityInsideBlockEvent if (!world.isClientSide) { int i = this.getSignalForState(state); @@ -35,7 +35,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 @@ -0,0 +0,0 @@ public class BigDripleafBlock extends HorizontalDirectionalBlock implements Bone @Override - public void entityInside(BlockState state, Level world, BlockPos pos, Entity entity) { + protected void entityInside(BlockState state, Level world, BlockPos pos, Entity entity) { + if (!new io.papermc.paper.event.entity.EntityInsideBlockEvent(entity.getBukkitEntity(), org.bukkit.craftbukkit.block.CraftBlock.at(world, pos)).callEvent()) { return; } // Paper - Add EntityInsideBlockEvent if (!world.isClientSide) { if (state.getValue(BigDripleafBlock.TILT) == Tilt.NONE && BigDripleafBlock.canEntityTilt(pos, entity) && !world.hasNeighborSignal(pos)) { @@ -47,7 +47,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 @@ -0,0 +0,0 @@ public class BubbleColumnBlock extends Block implements BucketPickup { @Override - public void entityInside(BlockState state, Level world, BlockPos pos, Entity entity) { + protected void entityInside(BlockState state, Level world, BlockPos pos, Entity entity) { + if (!new io.papermc.paper.event.entity.EntityInsideBlockEvent(entity.getBukkitEntity(), org.bukkit.craftbukkit.block.CraftBlock.at(world, pos)).callEvent()) { return; } // Paper - Add EntityInsideBlockEvent BlockState blockState = world.getBlockState(pos.above()); if (blockState.isAir()) { @@ -59,7 +59,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 @@ -0,0 +0,0 @@ public class ButtonBlock extends FaceAttachedHorizontalDirectionalBlock { @Override - public void entityInside(BlockState state, Level world, BlockPos pos, Entity entity) { + protected void entityInside(BlockState state, Level world, BlockPos pos, Entity entity) { + if (!new io.papermc.paper.event.entity.EntityInsideBlockEvent(entity.getBukkitEntity(), org.bukkit.craftbukkit.block.CraftBlock.at(world, pos)).callEvent()) { return; } // Paper - Add EntityInsideBlockEvent if (!world.isClientSide && this.type.canButtonBeActivatedByArrows() && !(Boolean) state.getValue(ButtonBlock.POWERED)) { this.checkPressed(state, world, pos); @@ -71,7 +71,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 @@ -0,0 +0,0 @@ public class CactusBlock extends Block { @Override - public void entityInside(BlockState state, Level world, BlockPos pos, Entity entity) { + protected void entityInside(BlockState state, Level world, BlockPos pos, Entity entity) { + if (!new io.papermc.paper.event.entity.EntityInsideBlockEvent(entity.getBukkitEntity(), org.bukkit.craftbukkit.block.CraftBlock.at(world, pos)).callEvent()) { return; } // Paper - Add EntityInsideBlockEvent entity.hurt(world.damageSources().cactus().directBlock(world, pos), 1.0F); // CraftBukkit } @@ -83,7 +83,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 @@ -0,0 +0,0 @@ public class CampfireBlock extends BaseEntityBlock implements SimpleWaterloggedB @Override - public void entityInside(BlockState state, Level world, BlockPos pos, Entity entity) { + protected void entityInside(BlockState state, Level world, BlockPos pos, Entity entity) { + if (!new io.papermc.paper.event.entity.EntityInsideBlockEvent(entity.getBukkitEntity(), org.bukkit.craftbukkit.block.CraftBlock.at(world, pos)).callEvent()) { return; } // Paper - Add EntityInsideBlockEvent if ((Boolean) state.getValue(CampfireBlock.LIT) && entity instanceof LivingEntity && !EnchantmentHelper.hasFrostWalker((LivingEntity) entity)) { entity.hurt(world.damageSources().inFire().directBlock(world, pos), (float) this.fireDamage); // CraftBukkit @@ -95,7 +95,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 @@ -0,0 +0,0 @@ public class CropBlock extends BushBlock implements BonemealableBlock { @Override - public void entityInside(BlockState state, Level world, BlockPos pos, Entity entity) { + protected void entityInside(BlockState state, Level world, BlockPos pos, Entity entity) { + if (!new io.papermc.paper.event.entity.EntityInsideBlockEvent(entity.getBukkitEntity(), org.bukkit.craftbukkit.block.CraftBlock.at(world, pos)).callEvent()) { return; } // Paper - Add EntityInsideBlockEvent if (entity instanceof Ravager && CraftEventFactory.callEntityChangeBlockEvent(entity, pos, Blocks.AIR.defaultBlockState(), !world.getGameRules().getBoolean(GameRules.RULE_MOBGRIEFING))) { // CraftBukkit world.destroyBlock(pos, true, entity); @@ -107,7 +107,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 @@ -0,0 +0,0 @@ public class DetectorRailBlock extends BaseRailBlock { @Override - public void entityInside(BlockState state, Level world, BlockPos pos, Entity entity) { + protected void entityInside(BlockState state, Level world, BlockPos pos, Entity entity) { + if (!new io.papermc.paper.event.entity.EntityInsideBlockEvent(entity.getBukkitEntity(), org.bukkit.craftbukkit.block.CraftBlock.at(world, pos)).callEvent()) { return; } // Paper - Add EntityInsideBlockEvent if (!world.isClientSide) { if (!(Boolean) state.getValue(DetectorRailBlock.POWERED)) { @@ -119,7 +119,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 @@ -0,0 +0,0 @@ public class EndPortalBlock extends BaseEntityBlock { @Override - public void entityInside(BlockState state, Level world, BlockPos pos, Entity entity) { + protected void entityInside(BlockState state, Level world, BlockPos pos, Entity entity) { + if (!new io.papermc.paper.event.entity.EntityInsideBlockEvent(entity.getBukkitEntity(), org.bukkit.craftbukkit.block.CraftBlock.at(world, pos)).callEvent()) { return; } // Paper - Add EntityInsideBlockEvent if (world instanceof ServerLevel && entity.canChangeDimensions() && Shapes.joinIsNotEmpty(Shapes.create(entity.getBoundingBox().move((double) (-pos.getX()), (double) (-pos.getY()), (double) (-pos.getZ()))), state.getShape(world, pos), BooleanOp.AND)) { ResourceKey resourcekey = world.getTypeKey() == LevelStem.END ? Level.OVERWORLD : Level.END; // CraftBukkit - SPIGOT-6152: send back to main overworld in custom ends @@ -131,7 +131,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 @@ -0,0 +0,0 @@ public class FrogspawnBlock extends Block { @Override - public void entityInside(BlockState state, Level world, BlockPos pos, Entity entity) { + protected void entityInside(BlockState state, Level world, BlockPos pos, Entity entity) { + if (!new io.papermc.paper.event.entity.EntityInsideBlockEvent(entity.getBukkitEntity(), org.bukkit.craftbukkit.block.CraftBlock.at(world, pos)).callEvent()) { return; } // Paper - Add EntityInsideBlockEvent if (entity.getType().equals(EntityType.FALLING_BLOCK)) { this.destroyBlock(world, pos); @@ -143,7 +143,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 @@ -0,0 +0,0 @@ public class HoneyBlock extends HalfTransparentBlock { @Override - public void entityInside(BlockState state, Level world, BlockPos pos, Entity entity) { + protected void entityInside(BlockState state, Level world, BlockPos pos, Entity entity) { + if (!new io.papermc.paper.event.entity.EntityInsideBlockEvent(entity.getBukkitEntity(), org.bukkit.craftbukkit.block.CraftBlock.at(world, pos)).callEvent()) { return; } // Paper - Add EntityInsideBlockEvent if (this.isSlidingDown(pos, entity)) { this.maybeDoSlideAchievement(entity, pos); @@ -155,7 +155,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 @@ -0,0 +0,0 @@ public class HopperBlock extends BaseEntityBlock { @Override - public void entityInside(BlockState state, Level world, BlockPos pos, Entity entity) { + protected void entityInside(BlockState state, Level world, BlockPos pos, Entity entity) { + if (!new io.papermc.paper.event.entity.EntityInsideBlockEvent(entity.getBukkitEntity(), org.bukkit.craftbukkit.block.CraftBlock.at(world, pos)).callEvent()) { return; } // Paper - Add EntityInsideBlockEvent BlockEntity blockEntity = world.getBlockEntity(pos); if (blockEntity instanceof HopperBlockEntity) { @@ -167,7 +167,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 @@ -0,0 +0,0 @@ public class LavaCauldronBlock extends AbstractCauldronBlock { @Override - public void entityInside(BlockState state, Level world, BlockPos pos, Entity entity) { + protected void entityInside(BlockState state, Level world, BlockPos pos, Entity entity) { + if (!new io.papermc.paper.event.entity.EntityInsideBlockEvent(entity.getBukkitEntity(), org.bukkit.craftbukkit.block.CraftBlock.at(world, pos)).callEvent()) { return; } // Paper - Add EntityInsideBlockEvent if (this.isEntityInsideContent(state, pos, entity)) { entity.lavaHurt(); @@ -179,7 +179,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 @@ -0,0 +0,0 @@ public class LayeredCauldronBlock extends AbstractCauldronBlock { @Override - public void entityInside(BlockState state, Level world, BlockPos pos, Entity entity) { + protected void entityInside(BlockState state, Level world, BlockPos pos, Entity entity) { + if (!new io.papermc.paper.event.entity.EntityInsideBlockEvent(entity.getBukkitEntity(), org.bukkit.craftbukkit.block.CraftBlock.at(world, pos)).callEvent()) { return; } // Paper - Add EntityInsideBlockEvent if (!world.isClientSide && entity.isOnFire() && this.isEntityInsideContent(state, pos, entity)) { // CraftBukkit start @@ -191,7 +191,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 @@ -0,0 +0,0 @@ public class NetherPortalBlock extends Block { @Override - public void entityInside(BlockState state, Level world, BlockPos pos, Entity entity) { + protected void entityInside(BlockState state, Level world, BlockPos pos, Entity entity) { + if (!new io.papermc.paper.event.entity.EntityInsideBlockEvent(entity.getBukkitEntity(), org.bukkit.craftbukkit.block.CraftBlock.at(world, pos)).callEvent()) { return; } // Paper - Add EntityInsideBlockEvent if (entity.canChangeDimensions()) { // CraftBukkit start - Entity in portal @@ -215,9 +215,9 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 @@ -0,0 +0,0 @@ public class PowderSnowBlock extends Block implements BucketPickup { @Override - public void entityInside(BlockState state, Level world, BlockPos pos, Entity entity) { + protected void entityInside(BlockState state, Level world, BlockPos pos, Entity entity) { + if (!new io.papermc.paper.event.entity.EntityInsideBlockEvent(entity.getBukkitEntity(), org.bukkit.craftbukkit.block.CraftBlock.at(world, pos)).callEvent()) { return; } // Paper - Add EntityInsideBlockEvent - if (!(entity instanceof LivingEntity) || entity.getFeetBlockState().is((Block) this)) { + if (!(entity instanceof LivingEntity) || entity.getInBlockState().is((Block) this)) { entity.makeStuckInBlock(state, new Vec3(0.8999999761581421D, 1.5D, 0.8999999761581421D)); if (world.isClientSide) { diff --git a/src/main/java/net/minecraft/world/level/block/SweetBerryBushBlock.java b/src/main/java/net/minecraft/world/level/block/SweetBerryBushBlock.java @@ -227,7 +227,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 @@ -0,0 +0,0 @@ public class SweetBerryBushBlock extends BushBlock implements BonemealableBlock @Override - public void entityInside(BlockState state, Level world, BlockPos pos, Entity entity) { + protected void entityInside(BlockState state, Level world, BlockPos pos, Entity entity) { + if (!new io.papermc.paper.event.entity.EntityInsideBlockEvent(entity.getBukkitEntity(), org.bukkit.craftbukkit.block.CraftBlock.at(world, pos)).callEvent()) { return; } // Paper - Add EntityInsideBlockEvent if (entity instanceof LivingEntity && entity.getType() != EntityType.FOX && entity.getType() != EntityType.BEE) { entity.makeStuckInBlock(state, new Vec3(0.800000011920929D, 0.75D, 0.800000011920929D)); @@ -239,7 +239,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 @@ -0,0 +0,0 @@ public class TripWireBlock extends Block { @Override - public void entityInside(BlockState state, Level world, BlockPos pos, Entity entity) { + protected void entityInside(BlockState state, Level world, BlockPos pos, Entity entity) { + if (!new io.papermc.paper.event.entity.EntityInsideBlockEvent(entity.getBukkitEntity(), org.bukkit.craftbukkit.block.CraftBlock.at(world, pos)).callEvent()) { return; } // Paper - Add EntityInsideBlockEvent if (!world.isClientSide) { if (!(Boolean) state.getValue(TripWireBlock.POWERED)) { @@ -250,7 +250,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 +++ b/src/main/java/net/minecraft/world/level/block/WaterlilyBlock.java @@ -0,0 +0,0 @@ public class WaterlilyBlock extends BushBlock { @Override - public void entityInside(BlockState state, Level world, BlockPos pos, Entity entity) { + protected void entityInside(BlockState state, Level world, BlockPos pos, Entity entity) { super.entityInside(state, world, pos, entity); + if (!new io.papermc.paper.event.entity.EntityInsideBlockEvent(entity.getBukkitEntity(), org.bukkit.craftbukkit.block.CraftBlock.at(world, pos)).callEvent()) { return; } // Paper - Add EntityInsideBlockEvent if (world instanceof ServerLevel && entity instanceof Boat) { @@ -263,11 +263,11 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 @@ -0,0 +0,0 @@ public class WebBlock extends Block { @Override - public void entityInside(BlockState state, Level world, BlockPos pos, Entity entity) { + protected void entityInside(BlockState state, Level world, BlockPos pos, Entity entity) { + if (!new io.papermc.paper.event.entity.EntityInsideBlockEvent(entity.getBukkitEntity(), org.bukkit.craftbukkit.block.CraftBlock.at(world, pos)).callEvent()) { return; } // Paper - Add EntityInsideBlockEvent - entity.makeStuckInBlock(state, new Vec3(0.25, 0.05F, 0.25)); - } - } + Vec3 vec3 = new Vec3(0.25, 0.05F, 0.25); + if (entity instanceof LivingEntity livingEntity && livingEntity.hasEffect(MobEffects.WEAVING)) { + vec3 = new Vec3(0.5, 0.25, 0.5); diff --git a/src/main/java/net/minecraft/world/level/block/WitherRoseBlock.java b/src/main/java/net/minecraft/world/level/block/WitherRoseBlock.java index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 --- a/src/main/java/net/minecraft/world/level/block/WitherRoseBlock.java @@ -275,7 +275,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 @@ -0,0 +0,0 @@ public class WitherRoseBlock extends FlowerBlock { @Override - public void entityInside(BlockState state, Level world, BlockPos pos, Entity entity) { + protected void entityInside(BlockState state, Level world, BlockPos pos, Entity entity) { + if (!new io.papermc.paper.event.entity.EntityInsideBlockEvent(entity.getBukkitEntity(), org.bukkit.craftbukkit.block.CraftBlock.at(world, pos)).callEvent()) { return; } // Paper - Add EntityInsideBlockEvent if (!world.isClientSide && world.getDifficulty() != Difficulty.PEACEFUL) { if (entity instanceof LivingEntity) { diff --git a/patches/unapplied/server/Add-PlayerArmSwingEvent.patch b/patches/server/Add-PlayerArmSwingEvent.patch similarity index 100% rename from patches/unapplied/server/Add-PlayerArmSwingEvent.patch rename to patches/server/Add-PlayerArmSwingEvent.patch diff --git a/patches/unapplied/server/Add-PlayerKickEvent-causes.patch b/patches/server/Add-PlayerKickEvent-causes.patch similarity index 85% rename from patches/unapplied/server/Add-PlayerKickEvent-causes.patch rename to patches/server/Add-PlayerKickEvent-causes.patch index 26019aaaab..f2dc7bfeb9 100644 --- a/patches/unapplied/server/Add-PlayerKickEvent-causes.patch +++ b/patches/server/Add-PlayerKickEvent-causes.patch @@ -9,44 +9,39 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 --- a/src/main/java/net/minecraft/network/chat/SignedMessageChain.java +++ b/src/main/java/net/minecraft/network/chat/SignedMessageChain.java @@ -0,0 +0,0 @@ public class SignedMessageChain { - return (signature, body) -> { - SignedMessageLink signedMessageLink = this.advanceLink(); - if (signedMessageLink == null) { -- throw new SignedMessageChain.DecodeException(Component.translatable("chat.disabled.chain_broken"), false); -+ throw new SignedMessageChain.DecodeException(Component.translatable("chat.disabled.chain_broken"), false); // Paper - diff on change (if disconnects, need a new kick event cause) - } else if (playerPublicKey.data().hasExpired()) { -- throw new SignedMessageChain.DecodeException(Component.translatable("chat.disabled.expiredProfileKey"), false); -+ throw new SignedMessageChain.DecodeException(Component.translatable("chat.disabled.expiredProfileKey"), false, org.bukkit.event.player.PlayerKickEvent.Cause.EXPIRED_PROFILE_PUBLIC_KEY); // Paper - kick event causes - } else if (body.timeStamp().isBefore(this.lastTimeStamp)) { -- throw new SignedMessageChain.DecodeException(Component.translatable("multiplayer.disconnect.out_of_order_chat"), true); -+ throw new SignedMessageChain.DecodeException(Component.translatable("multiplayer.disconnect.out_of_order_chat"), true, org.bukkit.event.player.PlayerKickEvent.Cause.OUT_OF_ORDER_CHAT); // Paper - kick event causes - } else { - this.lastTimeStamp = body.timeStamp(); - PlayerChatMessage playerChatMessage = new PlayerChatMessage(signedMessageLink, signature, body, null, FilterMask.PASS_THROUGH); - if (!playerChatMessage.verify(signatureValidator)) { -- throw new SignedMessageChain.DecodeException(Component.translatable("multiplayer.disconnect.unsigned_chat"), true); -+ throw new SignedMessageChain.DecodeException(Component.translatable("multiplayer.disconnect.unsigned_chat"), true, org.bukkit.event.player.PlayerKickEvent.Cause.UNSIGNED_CHAT); // Paper - kick event causes + if (signature == null) { + throw new SignedMessageChain.DecodeException(SignedMessageChain.DecodeException.MISSING_PROFILE_KEY); + } else if (playerPublicKey.data().hasExpired()) { +- throw new SignedMessageChain.DecodeException(SignedMessageChain.DecodeException.EXPIRED_PROFILE_KEY); ++ throw new SignedMessageChain.DecodeException(SignedMessageChain.DecodeException.EXPIRED_PROFILE_KEY, org.bukkit.event.player.PlayerKickEvent.Cause.EXPIRED_PROFILE_PUBLIC_KEY); // Paper - kick event causes } else { - if (playerChatMessage.hasExpiredServer(Instant.now())) { - LOGGER.warn("Received expired chat: '{}'. Is the client/server system time unsynchronized?", body.content()); + SignedMessageLink signedMessageLink = SignedMessageChain.this.nextLink; + if (signedMessageLink == null) { + throw new SignedMessageChain.DecodeException(SignedMessageChain.DecodeException.CHAIN_BROKEN); + } else if (body.timeStamp().isBefore(SignedMessageChain.this.lastTimeStamp)) { + this.setChainBroken(); +- throw new SignedMessageChain.DecodeException(SignedMessageChain.DecodeException.OUT_OF_ORDER_CHAT); ++ throw new SignedMessageChain.DecodeException(SignedMessageChain.DecodeException.OUT_OF_ORDER_CHAT, org.bukkit.event.player.PlayerKickEvent.Cause.OUT_OF_ORDER_CHAT); // Paper - kick event causes + } else { + SignedMessageChain.this.lastTimeStamp = body.timeStamp(); + PlayerChatMessage playerChatMessage = new PlayerChatMessage(signedMessageLink, signature, body, null, FilterMask.PASS_THROUGH); @@ -0,0 +0,0 @@ public class SignedMessageChain { + static final Component INVALID_SIGNATURE = Component.translatable("chat.disabled.invalid_signature"); + static final Component OUT_OF_ORDER_CHAT = Component.translatable("chat.disabled.out_of_order_chat"); - public static class DecodeException extends ThrowingComponent { - private final boolean shouldDisconnect; -+ public final org.bukkit.event.player.PlayerKickEvent.Cause kickCause; // Paper - kick event causes - - public DecodeException(Component message, boolean shouldDisconnect) { -+ // Paper start - kick event causes -+ this(message, shouldDisconnect, org.bukkit.event.player.PlayerKickEvent.Cause.UNKNOWN); -+ } -+ public DecodeException(Component message, boolean shouldDisconnect, org.bukkit.event.player.PlayerKickEvent.Cause kickCause) { -+ // Paper end - kick event causes +- public DecodeException(Component message) { ++ // Paper start ++ public final org.bukkit.event.player.PlayerKickEvent.Cause kickCause; ++ public DecodeException(Component message, org.bukkit.event.player.PlayerKickEvent.Cause event) { super(message); - this.shouldDisconnect = shouldDisconnect; -+ this.kickCause = kickCause; // Paper - kick event causes ++ this.kickCause = event; ++ } ++ // Paper end ++ public DecodeException(Component message) { ++ this(message, org.bukkit.event.player.PlayerKickEvent.Cause.UNKNOWN); // Paper } + } - public boolean shouldDisconnect() { diff --git a/src/main/java/net/minecraft/server/MinecraftServer.java b/src/main/java/net/minecraft/server/MinecraftServer.java index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 --- a/src/main/java/net/minecraft/server/MinecraftServer.java @@ -149,14 +144,23 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 // Paper start - adventure pack callbacks // call the callbacks before the previously-existing event so the event has final say @@ -0,0 +0,0 @@ public abstract class ServerCommonPacketListenerImpl implements ServerCommonPack - if (this.keepAlivePending) { - if (!this.processedDisconnect && elapsedTime >= KEEPALIVE_LIMIT) { // check keepalive limit, don't fire if already disconnected - ServerGamePacketListenerImpl.LOGGER.warn("{} was kicked due to keepalive timeout!", this.player.getScoreboardName()); // more info + + if (!this.isSingleplayerOwner() && elapsedTime >= KEEPALIVE_LIMIT) { // Paper - check keepalive limit, don't fire if already disconnected + if (this.keepAlivePending && !this.processedDisconnect) { // Paper +- this.disconnect(ServerCommonPacketListenerImpl.TIMEOUT_DISCONNECTION_MESSAGE); ++ this.disconnect(ServerCommonPacketListenerImpl.TIMEOUT_DISCONNECTION_MESSAGE, org.bukkit.event.player.PlayerKickEvent.Cause.TIMEOUT); // Paper - kick event cause + } else if (this.checkIfClosed(currentTime)) { // Paper + this.keepAlivePending = true; + this.keepAliveTime = currentTime; +@@ -0,0 +0,0 @@ public abstract class ServerCommonPacketListenerImpl implements ServerCommonPack + private boolean checkIfClosed(long time) { + if (this.closed) { + if (time - this.closedListenerTime >= 15000L) { - this.disconnect(ServerCommonPacketListenerImpl.TIMEOUT_DISCONNECTION_MESSAGE); + this.disconnect(ServerCommonPacketListenerImpl.TIMEOUT_DISCONNECTION_MESSAGE, org.bukkit.event.player.PlayerKickEvent.Cause.TIMEOUT); // Paper - kick event cause } - } else { - if (elapsedTime >= 15000L) { // 15 seconds + + return false; @@ -0,0 +0,0 @@ public abstract class ServerCommonPacketListenerImpl implements ServerCommonPack } @@ -214,7 +218,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 +++ b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java @@ -0,0 +0,0 @@ public class ServerGamePacketListenerImpl extends ServerCommonPacketListenerImpl if (this.clientIsFloating && !this.player.isSleeping() && !this.player.isPassenger() && !this.player.isDeadOrDying()) { - if (++this.aboveGroundTickCount > 80) { + if (++this.aboveGroundTickCount > this.getMaximumFlyingTicks(this.player)) { ServerGamePacketListenerImpl.LOGGER.warn("{} was kicked for floating too long!", this.player.getName().getString()); - this.disconnect(io.papermc.paper.configuration.GlobalConfiguration.get().messages.kick.flyingPlayer); // Paper - use configurable kick message + this.disconnect(io.papermc.paper.configuration.GlobalConfiguration.get().messages.kick.flyingPlayer, org.bukkit.event.player.PlayerKickEvent.Cause.FLYING_PLAYER); // Paper - use configurable kick message & kick event cause @@ -222,8 +226,8 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 } } else { @@ -0,0 +0,0 @@ public class ServerGamePacketListenerImpl extends ServerCommonPacketListenerImpl - if (this.clientVehicleIsFloating && this.player.getRootVehicle().getControllingPassenger() == this.player) { - if (++this.aboveGroundVehicleTickCount > 80) { + if (this.clientVehicleIsFloating && this.lastVehicle.getControllingPassenger() == this.player) { + if (++this.aboveGroundVehicleTickCount > this.getMaximumFlyingTicks(this.lastVehicle)) { ServerGamePacketListenerImpl.LOGGER.warn("{} was kicked for floating a vehicle too long!", this.player.getName().getString()); - this.disconnect(io.papermc.paper.configuration.GlobalConfiguration.get().messages.kick.flyingVehicle); // Paper - use configurable kick message + this.disconnect(io.papermc.paper.configuration.GlobalConfiguration.get().messages.kick.flyingVehicle, org.bukkit.event.player.PlayerKickEvent.Cause.FLYING_VEHICLE); // Paper - use configurable kick message & kick event cause @@ -329,32 +333,14 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 } @@ -0,0 +0,0 @@ public class ServerGamePacketListenerImpl extends ServerCommonPacketListenerImpl - } - // CraftBukkit end - if (ServerGamePacketListenerImpl.isChatMessageIllegal(packet.message())) { -- this.disconnect(Component.translatable("multiplayer.disconnect.illegal_characters")); -+ this.disconnect(Component.translatable("multiplayer.disconnect.illegal_characters"), org.bukkit.event.player.PlayerKickEvent.Cause.ILLEGAL_CHARACTERS); // Paper - add cause - } else { - Optional optional = this.tryHandleChat(packet.lastSeenMessages()); -@@ -0,0 +0,0 @@ public class ServerGamePacketListenerImpl extends ServerCommonPacketListenerImpl - @Override - public void handleChatCommand(ServerboundChatCommandPacket packet) { - if (ServerGamePacketListenerImpl.isChatMessageIllegal(packet.command())) { + private void tryHandleChat(String s, Runnable runnable, boolean sync) { // CraftBukkit + if (ServerGamePacketListenerImpl.isChatMessageIllegal(s)) { - this.disconnect(Component.translatable("multiplayer.disconnect.illegal_characters")); + this.disconnect(Component.translatable("multiplayer.disconnect.illegal_characters"), org.bukkit.event.player.PlayerKickEvent.Cause.ILLEGAL_CHARACTERS); // Paper + } else if (this.player.isRemoved() || this.player.getChatVisibility() == ChatVisiblity.HIDDEN) { // CraftBukkit - dead men tell no tales + this.send(new ClientboundSystemChatPacket(Component.translatable("chat.disabled.options").withStyle(ChatFormatting.RED), false)); } else { - Optional optional = this.tryHandleChat(packet.lastSeenMessages()); - -@@ -0,0 +0,0 @@ public class ServerGamePacketListenerImpl extends ServerCommonPacketListenerImpl - private void handleMessageDecodeFailure(SignedMessageChain.DecodeException exception) { - ServerGamePacketListenerImpl.LOGGER.warn("Failed to update secure chat state for {}: '{}'", this.player.getGameProfile().getName(), exception.getComponent().getString()); - if (exception.shouldDisconnect()) { -- this.disconnect(exception.getComponent()); -+ this.disconnect(exception.getComponent(), exception.kickCause); // Paper - kick event causes - } else { - this.player.sendSystemMessage(exception.getComponent().copy().withStyle(ChatFormatting.RED)); - } @@ -0,0 +0,0 @@ public class ServerGamePacketListenerImpl extends ServerCommonPacketListenerImpl if (optional.isEmpty()) { @@ -401,14 +387,14 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 } // Spigot End @@ -0,0 +0,0 @@ public class ServerGamePacketListenerImpl extends ServerCommonPacketListenerImpl - // CraftBukkit end } - } else { -- ServerGamePacketListenerImpl.this.disconnect(Component.translatable("multiplayer.disconnect.invalid_entity_attacked")); -+ ServerGamePacketListenerImpl.this.disconnect(Component.translatable("multiplayer.disconnect.invalid_entity_attacked"), org.bukkit.event.player.PlayerKickEvent.Cause.INVALID_ENTITY_ATTACKED); // Paper - add cause - ServerGamePacketListenerImpl.LOGGER.warn("Player {} tried to attack an invalid entity", ServerGamePacketListenerImpl.this.player.getName().getString()); } + +- ServerGamePacketListenerImpl.this.disconnect(Component.translatable("multiplayer.disconnect.invalid_entity_attacked")); ++ ServerGamePacketListenerImpl.this.disconnect(Component.translatable("multiplayer.disconnect.invalid_entity_attacked"), org.bukkit.event.player.PlayerKickEvent.Cause.INVALID_ENTITY_ATTACKED); // Paper - add cause + ServerGamePacketListenerImpl.LOGGER.warn("Player {} tried to attack an invalid entity", ServerGamePacketListenerImpl.this.player.getName().getString()); } + }); @@ -0,0 +0,0 @@ public class ServerGamePacketListenerImpl extends ServerCommonPacketListenerImpl // Paper start - auto recipe limit if (!org.bukkit.Bukkit.isPrimaryThread()) { diff --git a/patches/unapplied/server/Add-PufferFishStateChangeEvent.patch b/patches/server/Add-PufferFishStateChangeEvent.patch similarity index 86% rename from patches/unapplied/server/Add-PufferFishStateChangeEvent.patch rename to patches/server/Add-PufferFishStateChangeEvent.patch index 131e6ec10d..b5e055848c 100644 --- a/patches/unapplied/server/Add-PufferFishStateChangeEvent.patch +++ b/patches/server/Add-PufferFishStateChangeEvent.patch @@ -15,12 +15,12 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 + boolean increase = true; // Paper - Add PufferFishStateChangeEvent if (this.getPuffState() == 0) { + if (new io.papermc.paper.event.entity.PufferFishStateChangeEvent((org.bukkit.entity.PufferFish) getBukkitEntity(), 1).callEvent()) { // Paper - Add PufferFishStateChangeEvent - this.playSound(SoundEvents.PUFFER_FISH_BLOW_UP, this.getSoundVolume(), this.getVoicePitch()); + this.makeSound(SoundEvents.PUFFER_FISH_BLOW_UP); this.setPuffState(1); + } else { increase = false; } // Paper - Add PufferFishStateChangeEvent } else if (this.inflateCounter > 40 && this.getPuffState() == 1) { + if (new io.papermc.paper.event.entity.PufferFishStateChangeEvent((org.bukkit.entity.PufferFish) getBukkitEntity(), 2).callEvent()) { // Paper - Add PufferFishStateChangeEvent - this.playSound(SoundEvents.PUFFER_FISH_BLOW_UP, this.getSoundVolume(), this.getVoicePitch()); + this.makeSound(SoundEvents.PUFFER_FISH_BLOW_UP); this.setPuffState(2); + } else { increase = false; } // Paper - Add PufferFishStateChangeEvent } @@ -32,12 +32,12 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 + boolean increase = true; // Paper - Add PufferFishStateChangeEvent if (this.deflateTimer > 60 && this.getPuffState() == 2) { + if (new io.papermc.paper.event.entity.PufferFishStateChangeEvent((org.bukkit.entity.PufferFish) getBukkitEntity(), 1).callEvent()) { // Paper - Add PufferFishStateChangeEvent - this.playSound(SoundEvents.PUFFER_FISH_BLOW_OUT, this.getSoundVolume(), this.getVoicePitch()); + this.makeSound(SoundEvents.PUFFER_FISH_BLOW_OUT); this.setPuffState(1); + } else { increase = false; } // Paper - Add PufferFishStateChangeEvent } else if (this.deflateTimer > 100 && this.getPuffState() == 1) { + if (new io.papermc.paper.event.entity.PufferFishStateChangeEvent((org.bukkit.entity.PufferFish) getBukkitEntity(), 0).callEvent()) { // Paper - Add PufferFishStateChangeEvent - this.playSound(SoundEvents.PUFFER_FISH_BLOW_OUT, this.getSoundVolume(), this.getVoicePitch()); + this.makeSound(SoundEvents.PUFFER_FISH_BLOW_OUT); this.setPuffState(0); + } else { increase = false; } // Paper - Add PufferFishStateChangeEvent } diff --git a/patches/unapplied/server/Add-cause-to-Weather-ThunderChangeEvents.patch b/patches/server/Add-cause-to-Weather-ThunderChangeEvents.patch similarity index 100% rename from patches/unapplied/server/Add-cause-to-Weather-ThunderChangeEvents.patch rename to patches/server/Add-cause-to-Weather-ThunderChangeEvents.patch diff --git a/patches/unapplied/server/Add-missing-forceDrop-toggles.patch b/patches/server/Add-missing-forceDrop-toggles.patch similarity index 93% rename from patches/unapplied/server/Add-missing-forceDrop-toggles.patch rename to patches/server/Add-missing-forceDrop-toggles.patch index 4272df16ac..f939302057 100644 --- a/patches/unapplied/server/Add-missing-forceDrop-toggles.patch +++ b/patches/server/Add-missing-forceDrop-toggles.patch @@ -23,11 +23,15 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 --- a/src/main/java/net/minecraft/world/entity/animal/Panda.java +++ b/src/main/java/net/minecraft/world/entity/animal/Panda.java @@ -0,0 +0,0 @@ public class Panda extends Animal { - } + List list1 = loottable.getRandomItems(lootparams); + Iterator iterator1 = list1.iterator(); - if (!this.level().isClientSide() && this.random.nextInt(700) == 0 && this.level().getGameRules().getBoolean(GameRules.RULE_DOMOBLOOT)) { + this.forceDrops = true; // Paper - Add missing forceDrop toggles - this.spawnAtLocation((ItemLike) Items.SLIME_BALL); + while (iterator1.hasNext()) { + ItemStack itemstack = (ItemStack) iterator1.next(); + + this.spawnAtLocation(itemstack); + } + this.forceDrops = false; // Paper - Add missing forceDrop toggles } @@ -35,7 +39,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 @@ -0,0 +0,0 @@ public class Panda extends Animal { ItemStack itemstack1 = this.getItemBySlot(EquipmentSlot.MAINHAND); - if (!itemstack1.isEmpty() && !player.getAbilities().instabuild) { + if (!itemstack1.isEmpty() && !player.hasInfiniteMaterials()) { + this.forceDrops = true; // Paper - Add missing forceDrop toggles this.spawnAtLocation(itemstack1); + this.forceDrops = false; // Paper - Add missing forceDrop toggles diff --git a/patches/unapplied/server/Add-more-LimitedRegion-API.patch b/patches/server/Add-more-LimitedRegion-API.patch similarity index 100% rename from patches/unapplied/server/Add-more-LimitedRegion-API.patch rename to patches/server/Add-more-LimitedRegion-API.patch diff --git a/patches/unapplied/server/Add-option-to-fix-items-merging-through-walls.patch b/patches/server/Add-option-to-fix-items-merging-through-walls.patch similarity index 100% rename from patches/unapplied/server/Add-option-to-fix-items-merging-through-walls.patch rename to patches/server/Add-option-to-fix-items-merging-through-walls.patch diff --git a/patches/unapplied/server/Attributes-API-for-item-defaults.patch b/patches/server/Attributes-API-for-item-defaults.patch similarity index 100% rename from patches/unapplied/server/Attributes-API-for-item-defaults.patch rename to patches/server/Attributes-API-for-item-defaults.patch diff --git a/patches/unapplied/server/Don-t-apply-cramming-damage-to-players.patch b/patches/server/Don-t-apply-cramming-damage-to-players.patch similarity index 100% rename from patches/unapplied/server/Don-t-apply-cramming-damage-to-players.patch rename to patches/server/Don-t-apply-cramming-damage-to-players.patch diff --git a/patches/unapplied/server/Ensure-disconnect-for-book-edit-is-called-on-main.patch b/patches/server/Ensure-disconnect-for-book-edit-is-called-on-main.patch similarity index 100% rename from patches/unapplied/server/Ensure-disconnect-for-book-edit-is-called-on-main.patch rename to patches/server/Ensure-disconnect-for-book-edit-is-called-on-main.patch diff --git a/patches/unapplied/server/Fix-PlayerBucketEmptyEvent-result-itemstack.patch b/patches/server/Fix-PlayerBucketEmptyEvent-result-itemstack.patch similarity index 96% rename from patches/unapplied/server/Fix-PlayerBucketEmptyEvent-result-itemstack.patch rename to patches/server/Fix-PlayerBucketEmptyEvent-result-itemstack.patch index 6e0b08b574..1c56aee13e 100644 --- a/patches/unapplied/server/Fix-PlayerBucketEmptyEvent-result-itemstack.patch +++ b/patches/server/Fix-PlayerBucketEmptyEvent-result-itemstack.patch @@ -29,7 +29,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 + return itemInHand; + } + // Paper end - Fix PlayerBucketEmptyEvent result itemstack - return !player.getAbilities().instabuild ? new ItemStack(Items.BUCKET) : stack; + return !player.hasInfiniteMaterials() ? new ItemStack(Items.BUCKET) : stack; } @@ -0,0 +0,0 @@ public class BucketItem extends Item implements DispensibleContainerItem { diff --git a/patches/unapplied/server/Fix-PlayerDropItemEvent-using-wrong-item.patch b/patches/server/Fix-PlayerDropItemEvent-using-wrong-item.patch similarity index 100% rename from patches/unapplied/server/Fix-PlayerDropItemEvent-using-wrong-item.patch rename to patches/server/Fix-PlayerDropItemEvent-using-wrong-item.patch diff --git a/patches/unapplied/server/Fix-commands-from-signs-not-firing-command-events.patch b/patches/server/Fix-commands-from-signs-not-firing-command-events.patch similarity index 100% rename from patches/unapplied/server/Fix-commands-from-signs-not-firing-command-events.patch rename to patches/server/Fix-commands-from-signs-not-firing-command-events.patch diff --git a/patches/unapplied/server/Fix-dangerous-end-portal-logic.patch b/patches/server/Fix-dangerous-end-portal-logic.patch similarity index 95% rename from patches/unapplied/server/Fix-dangerous-end-portal-logic.patch rename to patches/server/Fix-dangerous-end-portal-logic.patch index 25ce4925e5..6f0c4c2a83 100644 --- a/patches/unapplied/server/Fix-dangerous-end-portal-logic.patch +++ b/patches/server/Fix-dangerous-end-portal-logic.patch @@ -14,7 +14,7 @@ diff --git a/src/main/java/net/minecraft/world/entity/Entity.java b/src/main/jav index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 --- a/src/main/java/net/minecraft/world/entity/Entity.java +++ b/src/main/java/net/minecraft/world/entity/Entity.java -@@ -0,0 +0,0 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource, S +@@ -0,0 +0,0 @@ public abstract class Entity implements SyncedDataHolder, Nameable, EntityAccess return this.originWorld; } // Paper end - Entity origin API @@ -51,7 +51,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 public float getBukkitYaw() { return this.yRot; } -@@ -0,0 +0,0 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource, S +@@ -0,0 +0,0 @@ public abstract class Entity implements SyncedDataHolder, Nameable, EntityAccess } this.processPortalCooldown(); diff --git a/patches/unapplied/server/Fix-invulnerable-end-crystals.patch b/patches/server/Fix-invulnerable-end-crystals.patch similarity index 100% rename from patches/unapplied/server/Fix-invulnerable-end-crystals.patch rename to patches/server/Fix-invulnerable-end-crystals.patch diff --git a/patches/unapplied/server/Fix-kick-event-leave-message-not-being-sent.patch b/patches/server/Fix-kick-event-leave-message-not-being-sent.patch similarity index 100% rename from patches/unapplied/server/Fix-kick-event-leave-message-not-being-sent.patch rename to patches/server/Fix-kick-event-leave-message-not-being-sent.patch diff --git a/patches/unapplied/server/Fix-potions-splash-events.patch b/patches/server/Fix-potions-splash-events.patch similarity index 76% rename from patches/unapplied/server/Fix-potions-splash-events.patch rename to patches/server/Fix-potions-splash-events.patch index 51b6728d57..91aa865b38 100644 --- a/patches/unapplied/server/Fix-potions-splash-events.patch +++ b/patches/server/Fix-potions-splash-events.patch @@ -12,28 +12,27 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 --- a/src/main/java/net/minecraft/world/entity/projectile/ThrownPotion.java +++ b/src/main/java/net/minecraft/world/entity/projectile/ThrownPotion.java @@ -0,0 +0,0 @@ public class ThrownPotion extends ThrowableItemProjectile implements ItemSupplie - Potion potionregistry = PotionUtils.getPotion(itemstack); - List list = PotionUtils.getMobEffects(itemstack); - boolean flag = potionregistry == Potions.WATER && list.isEmpty(); -+ boolean showParticles = true; // Paper - Fix potions splash events + ItemStack itemstack = this.getItem(); + PotionContents potioncontents = (PotionContents) itemstack.getOrDefault(DataComponents.POTION_CONTENTS, PotionContents.EMPTY); - if (flag) { ++ boolean showParticles = true; // Paper - Fix potions splash events + if (potioncontents.is(Potions.WATER)) { - this.applyWater(); + showParticles = this.applyWater(hitResult); // Paper - Fix potions splash events - } else if (true || !list.isEmpty()) { // CraftBukkit - Call event even if no effects to apply + } else if (true || potioncontents.hasEffects()) { // CraftBukkit - Call event even if no effects to apply if (this.isLingering()) { -- this.makeAreaOfEffectCloud(itemstack, potionregistry, hitResult); // CraftBukkit - Pass MovingObjectPosition -+ showParticles = this.makeAreaOfEffectCloud(itemstack, potionregistry, hitResult); // CraftBukkit - Pass MovingObjectPosition // Paper +- this.makeAreaOfEffectCloud(potioncontents, hitResult); // CraftBukkit - Pass MovingObjectPosition ++ showParticles = this.makeAreaOfEffectCloud(itemstack, hitResult); // CraftBukkit - Pass MovingObjectPosition // Paper } else { -- this.applySplash(list, hitResult.getType() == HitResult.Type.ENTITY ? ((EntityHitResult) hitResult).getEntity() : null, hitResult); // CraftBukkit - Pass MovingObjectPosition +- this.applySplash(potioncontents.getAllEffects(), hitResult.getType() == HitResult.Type.ENTITY ? ((EntityHitResult) hitResult).getEntity() : null, hitResult); // CraftBukkit - Pass MovingObjectPosition + showParticles = this.applySplash(list, hitResult.getType() == HitResult.Type.ENTITY ? ((EntityHitResult) hitResult).getEntity() : null, hitResult); // CraftBukkit - Pass MovingObjectPosition // Paper } } + if (showParticles) { // Paper - Fix potions splash events - int i = potionregistry.hasInstantEffects() ? 2007 : 2002; + int i = potioncontents.potion().isPresent() && ((Potion) ((Holder) potioncontents.potion().get()).value()).hasInstantEffects() ? 2007 : 2002; - this.level().levelEvent(i, this.blockPosition(), PotionUtils.getColor(itemstack)); + this.level().levelEvent(i, this.blockPosition(), potioncontents.getColor()); + } // Paper - Fix potions splash events this.discard(EntityRemoveEvent.Cause.HIT); // CraftBukkit - add Bukkit remove cause } @@ -99,10 +98,10 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 } -- private void applySplash(List list, @Nullable Entity entity, HitResult position) { // CraftBukkit - Pass MovingObjectPosition -+ private boolean applySplash(List list, @Nullable Entity entity, HitResult position) { // CraftBukkit - Pass MovingObjectPosition // Paper - Fix potions splash events +- private void applySplash(Iterable iterable, @Nullable Entity entity, HitResult position) { // CraftBukkit - Pass MovingObjectPosition ++ private boolean applySplash(Iterable iterable, @Nullable Entity entity, HitResult position) { // CraftBukkit - Pass MovingObjectPosition // Paper - Fix potions splash events AABB axisalignedbb = this.getBoundingBox().inflate(4.0D, 2.0D, 4.0D); - List list1 = this.level().getEntitiesOfClass(net.minecraft.world.entity.LivingEntity.class, axisalignedbb); + List list = this.level().getEntitiesOfClass(net.minecraft.world.entity.LivingEntity.class, axisalignedbb); Map affected = new HashMap(); // CraftBukkit @@ -0,0 +0,0 @@ public class ThrownPotion extends ThrowableItemProjectile implements ItemSupplie if (d0 < 16.0D) { @@ -120,30 +119,20 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 } -- private void makeAreaOfEffectCloud(ItemStack itemstack, Potion potionregistry, HitResult position) { // CraftBukkit - Pass MovingObjectPosition -+ private boolean makeAreaOfEffectCloud(ItemStack itemstack, Potion potionregistry, HitResult position) { // CraftBukkit - Pass MovingObjectPosition // Paper - return boolean +- private void makeAreaOfEffectCloud(PotionContents potioncontents, HitResult position) { // CraftBukkit - Pass MovingObjectPosition ++ private boolean makeAreaOfEffectCloud(PotionContents potioncontents, HitResult position) { // CraftBukkit - Pass MovingObjectPosition AreaEffectCloud entityareaeffectcloud = new AreaEffectCloud(this.level(), this.getX(), this.getY(), this.getZ()); Entity entity = this.getOwner(); @@ -0,0 +0,0 @@ public class ThrownPotion extends ThrowableItemProjectile implements ItemSupplie - entityareaeffectcloud.setPotion(potionregistry); - Iterator iterator = PotionUtils.getCustomEffects(itemstack).iterator(); - -+ boolean noEffects = potionregistry.getEffects().isEmpty(); // Paper - Fix potions splash events - while (iterator.hasNext()) { - MobEffectInstance mobeffect = (MobEffectInstance) iterator.next(); - - entityareaeffectcloud.addEffect(new MobEffectInstance(mobeffect)); -+ noEffects = false; // Paper - Fix potions splash events - } - - CompoundTag nbttagcompound = itemstack.getTag(); -@@ -0,0 +0,0 @@ public class ThrownPotion extends ThrowableItemProjectile implements ItemSupplie - + entityareaeffectcloud.setWaitTime(10); + entityareaeffectcloud.setRadiusPerTick(-entityareaeffectcloud.getRadius() / (float) entityareaeffectcloud.getDuration()); + entityareaeffectcloud.setPotionContents(potioncontents); ++ boolean noEffects = potioncontents.hasEffects(); // Paper - Fix potions splash events // CraftBukkit start org.bukkit.event.entity.LingeringPotionSplashEvent event = org.bukkit.craftbukkit.event.CraftEventFactory.callLingeringPotionSplashEvent(this, position, entityareaeffectcloud); - if (!(event.isCancelled() || entityareaeffectcloud.isRemoved())) { -+ if (!(event.isCancelled() || entityareaeffectcloud.isRemoved() || (noEffects && entityareaeffectcloud.effects.isEmpty() && entityareaeffectcloud.getPotion().getEffects().isEmpty()))) { // Paper - don't spawn area effect cloud if the effects were empty and not changed during the event handling ++ if (!(event.isCancelled() || entityareaeffectcloud.isRemoved() || (noEffects && !entityareaeffectcloud.potionContents.hasEffects()))) { // Paper - don't spawn area effect cloud if the effects were empty and not changed during the event handling this.level().addFreshEntity(entityareaeffectcloud); } else { entityareaeffectcloud.discard(null); // CraftBukkit - add Bukkit remove cause diff --git a/patches/unapplied/server/Fix-return-value-of-Block-applyBoneMeal-always-being.patch b/patches/server/Fix-return-value-of-Block-applyBoneMeal-always-being.patch similarity index 100% rename from patches/unapplied/server/Fix-return-value-of-Block-applyBoneMeal-always-being.patch rename to patches/server/Fix-return-value-of-Block-applyBoneMeal-always-being.patch diff --git a/patches/unapplied/server/Limit-item-frame-cursors-on-maps.patch b/patches/server/Limit-item-frame-cursors-on-maps.patch similarity index 84% rename from patches/unapplied/server/Limit-item-frame-cursors-on-maps.patch rename to patches/server/Limit-item-frame-cursors-on-maps.patch index d9454802b9..cd21324617 100644 --- a/patches/unapplied/server/Limit-item-frame-cursors-on-maps.patch +++ b/patches/server/Limit-item-frame-cursors-on-maps.patch @@ -13,12 +13,12 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 MapFrame worldmapframe1 = new MapFrame(blockposition, entityitemframe.getDirection().get2DDataValue() * 90, entityitemframe.getId()); + if (this.decorations.size() < player.level().paperConfig().maps.itemFrameCursorLimit) { // Paper - Limit item frame cursors on maps - this.addDecoration(MapDecoration.Type.FRAME, player.level(), "frame-" + entityitemframe.getId(), (double) blockposition.getX(), (double) blockposition.getZ(), (double) (entityitemframe.getDirection().get2DDataValue() * 90), (Component) null); + this.addDecoration(MapDecorationTypes.FRAME, player.level(), "frame-" + entityitemframe.getId(), (double) blockposition.getX(), (double) blockposition.getZ(), (double) (entityitemframe.getDirection().get2DDataValue() * 90), (Component) null); this.frameMarkers.put(worldmapframe1.getId(), worldmapframe1); + } // Paper - Limit item frame cursors on maps } - CompoundTag nbttagcompound = stack.getTag(); + MapDecorations mapdecorations = (MapDecorations) stack.getOrDefault(DataComponents.MAP_DECORATIONS, MapDecorations.EMPTY); @@ -0,0 +0,0 @@ public class MapItemSavedData extends SavedData { return true; } @@ -26,5 +26,5 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 - if (!this.isTrackedCountOverLimit(256)) { + if (!this.isTrackedCountOverLimit(((Level) world).paperConfig().maps.itemFrameCursorLimit)) { // Paper - Limit item frame cursors on maps this.bannerMarkers.put(mapiconbanner.getId(), mapiconbanner); - this.addDecoration(mapiconbanner.getDecoration(), world, mapiconbanner.getId(), d0, d1, 180.0D, mapiconbanner.getName()); + this.addDecoration(mapiconbanner.getDecoration(), world, mapiconbanner.getId(), d0, d1, 180.0D, (Component) mapiconbanner.name().orElse(null)); // CraftBukkit - decompile error return true; diff --git a/patches/unapplied/server/Line-Of-Sight-Changes.patch b/patches/server/Line-Of-Sight-Changes.patch similarity index 100% rename from patches/unapplied/server/Line-Of-Sight-Changes.patch rename to patches/server/Line-Of-Sight-Changes.patch diff --git a/patches/unapplied/server/Missing-Entity-API.patch b/patches/server/Missing-Entity-API.patch similarity index 98% rename from patches/unapplied/server/Missing-Entity-API.patch rename to patches/server/Missing-Entity-API.patch index f13e15397c..6258a590a2 100644 --- a/patches/unapplied/server/Missing-Entity-API.patch +++ b/patches/server/Missing-Entity-API.patch @@ -179,13 +179,13 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 @Nullable @@ -0,0 +0,0 @@ public class Tadpole extends AbstractFish { - CompoundTag nbttagcompound = stack.getOrCreateTag(); - - nbttagcompound.putInt("Age", this.getAge()); -+ nbttagcompound.putBoolean("AgeLocked", this.ageLocked); // Paper + Bucketable.saveDefaultDataToBucketTag(this, stack); + CustomData.update(DataComponents.BUCKET_ENTITY_DATA, stack, (nbttagcompound) -> { + nbttagcompound.putInt("Age", this.getAge()); ++ nbttagcompound.putBoolean("AgeLocked", this.ageLocked); // Paper + }); } - @Override @@ -0,0 +0,0 @@ public class Tadpole extends AbstractFish { this.setAge(nbt.getInt("Age")); } @@ -252,7 +252,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 --- a/src/main/java/net/minecraft/world/entity/boss/wither/WitherBoss.java +++ b/src/main/java/net/minecraft/world/entity/boss/wither/WitherBoss.java @@ -0,0 +0,0 @@ public class WitherBoss extends Monster implements PowerableMob, RangedAttackMob - return entityliving.getMobType() != MobType.UNDEAD && entityliving.attackable(); + return !entityliving.getType().is(EntityTypeTags.WITHER_FRIENDS) && entityliving.attackable(); }; private static final TargetingConditions TARGETING_CONDITIONS = TargetingConditions.forCombat().range(20.0D).selector(WitherBoss.LIVING_ENTITY_SELECTOR); + // Paper start @@ -506,7 +506,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 --- a/src/main/java/org/bukkit/craftbukkit/entity/CraftCat.java +++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftCat.java @@ -0,0 +0,0 @@ public class CraftCat extends CraftTameableAnimal implements Cat { - return registry.get(CraftNamespacedKey.toMinecraft(bukkit.getKey())); + + ", this can happen if a plugin creates its own cat variant with out properly registering it."); } } + @@ -1174,7 +1174,7 @@ diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftTrident.java b/src index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 --- a/src/main/java/org/bukkit/craftbukkit/entity/CraftTrident.java +++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftTrident.java -@@ -0,0 +0,0 @@ public class CraftTrident extends CraftArrow implements Trident { +@@ -0,0 +0,0 @@ public class CraftTrident extends CraftAbstractArrow implements Trident { public String toString() { return "CraftTrident"; } diff --git a/patches/unapplied/server/More-Lidded-Block-API.patch b/patches/server/More-Lidded-Block-API.patch similarity index 89% rename from patches/unapplied/server/More-Lidded-Block-API.patch rename to patches/server/More-Lidded-Block-API.patch index 93b5f12ea4..1be32ce592 100644 --- a/patches/unapplied/server/More-Lidded-Block-API.patch +++ b/patches/server/More-Lidded-Block-API.patch @@ -9,8 +9,8 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 --- a/src/main/java/org/bukkit/craftbukkit/block/CraftBarrel.java +++ b/src/main/java/org/bukkit/craftbukkit/block/CraftBarrel.java @@ -0,0 +0,0 @@ public class CraftBarrel extends CraftLootable implements Bar - public CraftBarrel copy() { - return new CraftBarrel(this); + public CraftBarrel copy(Location location) { + return new CraftBarrel(this, location); } + + // Paper start - More Lidded Block API @@ -25,8 +25,8 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 --- a/src/main/java/org/bukkit/craftbukkit/block/CraftChest.java +++ b/src/main/java/org/bukkit/craftbukkit/block/CraftChest.java @@ -0,0 +0,0 @@ public class CraftChest extends CraftLootable implements Chest - public CraftChest copy() { - return new CraftChest(this); + public CraftChest copy(Location location) { + return new CraftChest(this, location); } + + // Paper start - More Lidded Block API @@ -41,8 +41,8 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 --- a/src/main/java/org/bukkit/craftbukkit/block/CraftEnderChest.java +++ b/src/main/java/org/bukkit/craftbukkit/block/CraftEnderChest.java @@ -0,0 +0,0 @@ public class CraftEnderChest extends CraftBlockEntityState implem - public CraftShulkerBox copy() { - return new CraftShulkerBox(this); + public CraftShulkerBox copy(Location location) { + return new CraftShulkerBox(this, location); } + + // Paper start - More Lidded Block API diff --git a/patches/unapplied/server/Optimize-Biome-Mob-Lookups-for-Mob-Spawning.patch b/patches/server/Optimize-Biome-Mob-Lookups-for-Mob-Spawning.patch similarity index 100% rename from patches/unapplied/server/Optimize-Biome-Mob-Lookups-for-Mob-Spawning.patch rename to patches/server/Optimize-Biome-Mob-Lookups-for-Mob-Spawning.patch diff --git a/patches/unapplied/server/Rate-options-and-timings-for-sensors-and-behaviors.patch b/patches/server/Rate-options-and-timings-for-sensors-and-behaviors.patch similarity index 100% rename from patches/unapplied/server/Rate-options-and-timings-for-sensors-and-behaviors.patch rename to patches/server/Rate-options-and-timings-for-sensors-and-behaviors.patch diff --git a/patches/unapplied/server/Synchronize-PalettedContainer-instead-of-ThreadingDe.patch b/patches/server/Synchronize-PalettedContainer-instead-of-ThreadingDe.patch similarity index 100% rename from patches/unapplied/server/Synchronize-PalettedContainer-instead-of-ThreadingDe.patch rename to patches/server/Synchronize-PalettedContainer-instead-of-ThreadingDe.patch diff --git a/patches/unapplied/server/Use-getChunkIfLoadedImmediately-in-places.patch b/patches/server/Use-getChunkIfLoadedImmediately-in-places.patch similarity index 100% rename from patches/unapplied/server/Use-getChunkIfLoadedImmediately-in-places.patch rename to patches/server/Use-getChunkIfLoadedImmediately-in-places.patch diff --git a/patches/unapplied/server/add-per-world-spawn-limits.patch b/patches/server/add-per-world-spawn-limits.patch similarity index 100% rename from patches/unapplied/server/add-per-world-spawn-limits.patch rename to patches/server/add-per-world-spawn-limits.patch diff --git a/patches/unapplied/server/Make-item-validations-configurable.patch b/removed-patches-1-20-5/0590-Make-item-validations-configurable.patch similarity index 100% rename from patches/unapplied/server/Make-item-validations-configurable.patch rename to removed-patches-1-20-5/0590-Make-item-validations-configurable.patch diff --git a/patches/unapplied/server/Add-config-for-mobs-immune-to-default-effects.patch b/removed-patches-1-20-5/0603-Add-config-for-mobs-immune-to-default-effects.patch similarity index 100% rename from patches/unapplied/server/Add-config-for-mobs-immune-to-default-effects.patch rename to removed-patches-1-20-5/0603-Add-config-for-mobs-immune-to-default-effects.patch