diff --git a/patches/unapplied/server/API-to-get-Material-from-Boats-and-Minecarts.patch b/patches/server/API-to-get-Material-from-Boats-and-Minecarts.patch similarity index 100% rename from patches/unapplied/server/API-to-get-Material-from-Boats-and-Minecarts.patch rename to patches/server/API-to-get-Material-from-Boats-and-Minecarts.patch diff --git a/patches/unapplied/server/Add-API-for-quit-reason.patch b/patches/server/Add-API-for-quit-reason.patch similarity index 99% rename from patches/unapplied/server/Add-API-for-quit-reason.patch rename to patches/server/Add-API-for-quit-reason.patch index 9204e9806..9f2a6c849 100644 --- a/patches/unapplied/server/Add-API-for-quit-reason.patch +++ b/patches/server/Add-API-for-quit-reason.patch @@ -18,7 +18,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 + if (player != null) player.quitReason = org.bukkit.event.player.PlayerQuitEvent.QuitReason.TIMED_OUT; // Paper - Add API for quit reason this.disconnect(Component.translatable("disconnect.timeout")); } else { - MutableComponent ichatmutablecomponent = Component.translatable("disconnect.genericReason", "Internal Exception: " + throwable); + MutableComponent ichatmutablecomponent = Component.translatable("disconnect.genericReason", "Internal Exception: " + String.valueOf(throwable)); + if (player != null) player.quitReason = org.bukkit.event.player.PlayerQuitEvent.QuitReason.ERRONEOUS_STATE; // Paper - Add API for quit reason if (flag) { diff --git a/patches/unapplied/server/Add-Adventure-message-to-PlayerAdvancementDoneEvent.patch b/patches/server/Add-Adventure-message-to-PlayerAdvancementDoneEvent.patch similarity index 100% rename from patches/unapplied/server/Add-Adventure-message-to-PlayerAdvancementDoneEvent.patch rename to patches/server/Add-Adventure-message-to-PlayerAdvancementDoneEvent.patch diff --git a/patches/unapplied/server/Add-Block-isValidTool.patch b/patches/server/Add-Block-isValidTool.patch similarity index 100% rename from patches/unapplied/server/Add-Block-isValidTool.patch rename to patches/server/Add-Block-isValidTool.patch diff --git a/patches/unapplied/server/Add-BlockFailedDispenseEvent.patch b/patches/server/Add-BlockFailedDispenseEvent.patch similarity index 94% rename from patches/unapplied/server/Add-BlockFailedDispenseEvent.patch rename to patches/server/Add-BlockFailedDispenseEvent.patch index 63a8ac09a..43156fa42 100644 --- a/patches/unapplied/server/Add-BlockFailedDispenseEvent.patch +++ b/patches/server/Add-BlockFailedDispenseEvent.patch @@ -14,11 +14,11 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 if (i < 0) { + if (org.bukkit.craftbukkit.event.CraftEventFactory.handleBlockFailedDispenseEvent(world, pos)) { // Paper - Add BlockFailedDispenseEvent world.levelEvent(1001, pos, 0); - world.gameEvent(GameEvent.BLOCK_ACTIVATE, pos, GameEvent.Context.of(tileentitydispenser.getBlockState())); + world.gameEvent((Holder) GameEvent.BLOCK_ACTIVATE, pos, GameEvent.Context.of(tileentitydispenser.getBlockState())); + } // Paper - Add BlockFailedDispenseEvent } else { ItemStack itemstack = tileentitydispenser.getItem(i); - DispenseItemBehavior idispensebehavior = this.getDispenseMethod(itemstack); + DispenseItemBehavior idispensebehavior = this.getDispenseMethod(world, itemstack); diff --git a/src/main/java/net/minecraft/world/level/block/DropperBlock.java b/src/main/java/net/minecraft/world/level/block/DropperBlock.java index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 --- a/src/main/java/net/minecraft/world/level/block/DropperBlock.java diff --git a/patches/unapplied/server/Add-BlockPreDispenseEvent.patch b/patches/server/Add-BlockPreDispenseEvent.patch similarity index 98% rename from patches/unapplied/server/Add-BlockPreDispenseEvent.patch rename to patches/server/Add-BlockPreDispenseEvent.patch index 13f89ce1e..d04ab0850 100644 --- a/patches/unapplied/server/Add-BlockPreDispenseEvent.patch +++ b/patches/server/Add-BlockPreDispenseEvent.patch @@ -9,7 +9,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 --- a/src/main/java/net/minecraft/world/level/block/DispenserBlock.java +++ b/src/main/java/net/minecraft/world/level/block/DispenserBlock.java @@ -0,0 +0,0 @@ public class DispenserBlock extends BaseEntityBlock { - DispenseItemBehavior idispensebehavior = this.getDispenseMethod(itemstack); + DispenseItemBehavior idispensebehavior = this.getDispenseMethod(world, itemstack); if (idispensebehavior != DispenseItemBehavior.NOOP) { + if (!org.bukkit.craftbukkit.event.CraftEventFactory.handleBlockPreDispenseEvent(world, pos, itemstack, i)) return; // Paper - Add BlockPreDispenseEvent diff --git a/patches/unapplied/server/Add-Channel-initialization-listeners.patch b/patches/server/Add-Channel-initialization-listeners.patch similarity index 98% rename from patches/unapplied/server/Add-Channel-initialization-listeners.patch rename to patches/server/Add-Channel-initialization-listeners.patch index a6393e3f2..ac9c7aae0 100644 --- a/patches/unapplied/server/Add-Channel-initialization-listeners.patch +++ b/patches/server/Add-Channel-initialization-listeners.patch @@ -127,7 +127,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 +++ b/src/main/java/net/minecraft/network/Connection.java @@ -0,0 +0,0 @@ public class Connection extends SimpleChannelInboundHandler> { } else { - this.channel.pipeline().addBefore("encoder", "compress", new CompressionEncoder(compressionThreshold)); + this.channel.pipeline().addAfter("prepender", "compress", new CompressionEncoder(compressionThreshold)); } + this.channel.pipeline().fireUserEventTriggered(io.papermc.paper.network.ConnectionEvent.COMPRESSION_THRESHOLD_SET); // Paper - Add Channel initialization listeners } else { diff --git a/patches/unapplied/server/Add-Destroy-Speed-API.patch b/patches/server/Add-Destroy-Speed-API.patch similarity index 100% rename from patches/unapplied/server/Add-Destroy-Speed-API.patch rename to patches/server/Add-Destroy-Speed-API.patch diff --git a/patches/unapplied/server/Add-DragonEggFormEvent.patch b/patches/server/Add-DragonEggFormEvent.patch similarity index 100% rename from patches/unapplied/server/Add-DragonEggFormEvent.patch rename to patches/server/Add-DragonEggFormEvent.patch diff --git a/patches/unapplied/server/Add-EntityBlockStorage-clearEntities.patch b/patches/server/Add-EntityBlockStorage-clearEntities.patch similarity index 94% rename from patches/unapplied/server/Add-EntityBlockStorage-clearEntities.patch rename to patches/server/Add-EntityBlockStorage-clearEntities.patch index 586950bd2..ab052368a 100644 --- a/patches/unapplied/server/Add-EntityBlockStorage-clearEntities.patch +++ b/patches/server/Add-EntityBlockStorage-clearEntities.patch @@ -25,8 +25,8 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 --- a/src/main/java/org/bukkit/craftbukkit/block/CraftBeehive.java +++ b/src/main/java/org/bukkit/craftbukkit/block/CraftBeehive.java @@ -0,0 +0,0 @@ public class CraftBeehive extends CraftBlockEntityState impl - public CraftBeehive copy() { - return new CraftBeehive(this); + public CraftBeehive copy(Location location) { + return new CraftBeehive(this, location); } + + // Paper start - Add EntityBlockStorage clearEntities diff --git a/patches/server/Add-EntityLoadCrossbowEvent.patch b/patches/server/Add-EntityLoadCrossbowEvent.patch new file mode 100644 index 000000000..29dbcb26a --- /dev/null +++ b/patches/server/Add-EntityLoadCrossbowEvent.patch @@ -0,0 +1,68 @@ +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: Josh Roy <10731363+JRoy@users.noreply.github.com> +Date: Wed, 7 Oct 2020 12:04:01 -0400 +Subject: [PATCH] Add EntityLoadCrossbowEvent + + +diff --git a/src/main/java/net/minecraft/world/item/CrossbowItem.java b/src/main/java/net/minecraft/world/item/CrossbowItem.java +index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 +--- a/src/main/java/net/minecraft/world/item/CrossbowItem.java ++++ b/src/main/java/net/minecraft/world/item/CrossbowItem.java +@@ -0,0 +0,0 @@ public class CrossbowItem extends ProjectileWeaponItem { + public void releaseUsing(ItemStack stack, Level world, LivingEntity user, int remainingUseTicks) { + int i = this.getUseDuration(stack) - remainingUseTicks; + float f = getPowerForTime(i, stack); +- if (f >= 1.0F && !isCharged(stack) && tryLoadProjectiles(user, stack)) { ++ // Paper start ++ if (f >= 1.0F && !isCharged(stack)) { ++ final io.papermc.paper.event.entity.EntityLoadCrossbowEvent event = new io.papermc.paper.event.entity.EntityLoadCrossbowEvent(user.getBukkitLivingEntity(), stack.asBukkitMirror(), org.bukkit.craftbukkit.CraftEquipmentSlot.getHand(user.getUsedItemHand())); ++ if (!event.callEvent() || !tryLoadProjectiles(user, stack, event.shouldConsumeItem())) { ++ if (user instanceof ServerPlayer player) player.containerMenu.sendAllDataToRemote(); ++ return; ++ } ++ // Paper end - Add EntityLoadCrossbowEvent + world.playSound( + null, + user.getX(), +@@ -0,0 +0,0 @@ public class CrossbowItem extends ProjectileWeaponItem { + } + } + +- private static boolean tryLoadProjectiles(LivingEntity shooter, ItemStack crossbow) { +- List list = draw(crossbow, shooter.getProjectile(crossbow), shooter); ++ @io.papermc.paper.annotation.DoNotUse // Paper - Add EntityLoadCrossbowEvent ++ private static boolean tryLoadProjectiles(LivingEntity shooter, ItemStack crossbow) { ++ // Paper start - Add EntityLoadCrossbowEvent ++ return CrossbowItem.tryLoadProjectiles(shooter, crossbow, true); ++ } ++ private static boolean tryLoadProjectiles(LivingEntity shooter, ItemStack crossbow, boolean consume) { ++ List list = draw(crossbow, shooter.getProjectile(crossbow), shooter, consume); ++ // Paper end - Add EntityLoadCrossbowEvent + if (!list.isEmpty()) { + crossbow.set(DataComponents.CHARGED_PROJECTILES, ChargedProjectiles.of(list)); + return true; +diff --git a/src/main/java/net/minecraft/world/item/ProjectileWeaponItem.java b/src/main/java/net/minecraft/world/item/ProjectileWeaponItem.java +index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 +--- a/src/main/java/net/minecraft/world/item/ProjectileWeaponItem.java ++++ b/src/main/java/net/minecraft/world/item/ProjectileWeaponItem.java +@@ -0,0 +0,0 @@ public abstract class ProjectileWeaponItem extends Item { + } + + protected static List draw(ItemStack weaponStack, ItemStack projectileStack, LivingEntity shooter) { ++ // Paper start ++ return draw(weaponStack, projectileStack, shooter, false); ++ } ++ protected static List draw(ItemStack weaponStack, ItemStack projectileStack, LivingEntity shooter, boolean consume) { ++ // Paper end + if (projectileStack.isEmpty()) { + return List.of(); + } else { +@@ -0,0 +0,0 @@ public abstract class ProjectileWeaponItem extends Item { + ItemStack itemstack2 = projectileStack.copy(); + + for (int k = 0; k < j; ++k) { +- list.add(ProjectileWeaponItem.useAmmo(weaponStack, k == 0 ? projectileStack : itemstack2, shooter, k > 0)); ++ list.add(ProjectileWeaponItem.useAmmo(weaponStack, k == 0 ? projectileStack : itemstack2, shooter, k > 0 || consume)); // Paper + } + + return list; diff --git a/patches/unapplied/server/Add-EntityMoveEvent.patch b/patches/server/Add-EntityMoveEvent.patch similarity index 97% rename from patches/unapplied/server/Add-EntityMoveEvent.patch rename to patches/server/Add-EntityMoveEvent.patch index 96604ba15..ebe504a3b 100644 --- a/patches/unapplied/server/Add-EntityMoveEvent.patch +++ b/patches/server/Add-EntityMoveEvent.patch @@ -15,7 +15,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 + worldserver.hasEntityMoveEvent = io.papermc.paper.event.entity.EntityMoveEvent.getHandlerList().getRegisteredListeners().length > 0; // Paper - Add EntityMoveEvent this.profiler.push(() -> { - return worldserver + " " + worldserver.dimension().location(); + String s = String.valueOf(worldserver); diff --git a/src/main/java/net/minecraft/server/level/ServerLevel.java b/src/main/java/net/minecraft/server/level/ServerLevel.java index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 --- a/src/main/java/net/minecraft/server/level/ServerLevel.java diff --git a/patches/unapplied/server/Add-HiddenPotionEffect-API.patch b/patches/server/Add-HiddenPotionEffect-API.patch similarity index 89% rename from patches/unapplied/server/Add-HiddenPotionEffect-API.patch rename to patches/server/Add-HiddenPotionEffect-API.patch index 486e4daf6..bea5e26a3 100644 --- a/patches/unapplied/server/Add-HiddenPotionEffect-API.patch +++ b/patches/server/Add-HiddenPotionEffect-API.patch @@ -13,7 +13,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 @@ -0,0 +0,0 @@ public class CraftPotionUtil { public static MobEffectInstance fromBukkit(PotionEffect effect) { - MobEffect type = CraftPotionEffectType.bukkitToMinecraft(effect.getType()); + Holder type = CraftPotionEffectType.bukkitToMinecraftHolder(effect.getType()); + // Paper - Note: do not copy over the hidden effect, as this method is only used for applying to entities which we do not want to convert over. return new MobEffectInstance(type, effect.getDuration(), effect.getAmplifier(), effect.isAmbient(), effect.hasParticles(), effect.hasIcon()); // Paper } @@ -26,4 +26,4 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 + return new PotionEffect(type, duration, amp, ambient, particles, effect.showIcon(), effect.hiddenEffect == null ? null : toBukkit(effect.hiddenEffect)); // Paper } - public static boolean equals(MobEffect mobEffect, PotionEffectType type) { + public static boolean equals(Holder mobEffect, PotionEffectType type) { diff --git a/patches/unapplied/server/Add-LivingEntity-clearActiveItem.patch b/patches/server/Add-LivingEntity-clearActiveItem.patch similarity index 100% rename from patches/unapplied/server/Add-LivingEntity-clearActiveItem.patch rename to patches/server/Add-LivingEntity-clearActiveItem.patch diff --git a/patches/unapplied/server/Add-Mob-lookAt-API.patch b/patches/server/Add-Mob-lookAt-API.patch similarity index 100% rename from patches/unapplied/server/Add-Mob-lookAt-API.patch rename to patches/server/Add-Mob-lookAt-API.patch diff --git a/patches/unapplied/server/Add-OBSTRUCTED-reason-to-BedEnterResult.patch b/patches/server/Add-OBSTRUCTED-reason-to-BedEnterResult.patch similarity index 100% rename from patches/unapplied/server/Add-OBSTRUCTED-reason-to-BedEnterResult.patch rename to patches/server/Add-OBSTRUCTED-reason-to-BedEnterResult.patch diff --git a/patches/unapplied/server/Add-PlayerBedFailEnterEvent.patch b/patches/server/Add-PlayerBedFailEnterEvent.patch similarity index 100% rename from patches/unapplied/server/Add-PlayerBedFailEnterEvent.patch rename to patches/server/Add-PlayerBedFailEnterEvent.patch diff --git a/patches/unapplied/server/Add-PlayerChangeBeaconEffectEvent.patch b/patches/server/Add-PlayerChangeBeaconEffectEvent.patch similarity index 71% rename from patches/unapplied/server/Add-PlayerChangeBeaconEffectEvent.patch rename to patches/server/Add-PlayerChangeBeaconEffectEvent.patch index 6ee5d02c3..2d7e66385 100644 --- a/patches/unapplied/server/Add-PlayerChangeBeaconEffectEvent.patch +++ b/patches/server/Add-PlayerChangeBeaconEffectEvent.patch @@ -13,23 +13,24 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 } + // Paper start - Add PlayerChangeBeaconEffectEvent -+ private static @Nullable org.bukkit.potion.PotionEffectType convert(Optional optionalEffect) { ++ private static @Nullable org.bukkit.potion.PotionEffectType convert(Optional> optionalEffect) { + return optionalEffect.map(org.bukkit.craftbukkit.potion.CraftPotionEffectType::minecraftToBukkit).orElse(null); + } + // Paper end - Add PlayerChangeBeaconEffectEvent + - public void updateEffects(Optional primary, Optional secondary) { + public void updateEffects(Optional> primary, Optional> secondary) { if (this.paymentSlot.hasItem()) { -- this.beaconData.set(1, BeaconMenu.encodeEffect((MobEffect) primary.orElse(null))); // CraftBukkit - decompile error -- this.beaconData.set(2, BeaconMenu.encodeEffect((MobEffect) secondary.orElse(null))); // CraftBukkit - decompile error +- this.beaconData.set(1, BeaconMenu.encodeEffect((Holder) primary.orElse(null)));// CraftBukkit - decompile error +- this.beaconData.set(2, BeaconMenu.encodeEffect((Holder) secondary.orElse(null)));// CraftBukkit - decompile error + // Paper start - Add PlayerChangeBeaconEffectEvent + io.papermc.paper.event.player.PlayerChangeBeaconEffectEvent event = new io.papermc.paper.event.player.PlayerChangeBeaconEffectEvent((org.bukkit.entity.Player) this.player.player.getBukkitEntity(), convert(primary), convert(secondary), this.access.getLocation().getBlock()); + if (event.callEvent()) { -+ this.beaconData.set(1, BeaconMenu.encodeEffect(event.getPrimary() == null ? null : org.bukkit.craftbukkit.potion.CraftPotionEffectType.bukkitToMinecraft(event.getPrimary()))); -+ this.beaconData.set(2, BeaconMenu.encodeEffect(event.getSecondary() == null ? null : org.bukkit.craftbukkit.potion.CraftPotionEffectType.bukkitToMinecraft(event.getSecondary()))); -+ if (event.willConsumeItem()) { ++ // Paper end - Add PlayerChangeBeaconEffectEvent ++ this.beaconData.set(1, BeaconMenu.encodeEffect(event.getPrimary() == null ? null : org.bukkit.craftbukkit.potion.CraftPotionEffectType.bukkitToMinecraftHolder(event.getPrimary())));// CraftBukkit - decompile error ++ this.beaconData.set(2, BeaconMenu.encodeEffect(event.getSecondary() == null ? null : org.bukkit.craftbukkit.potion.CraftPotionEffectType.bukkitToMinecraftHolder(event.getSecondary())));// CraftBukkit - decompile error ++ if (event.willConsumeItem()) { // Paper this.paymentSlot.remove(1); -+ } ++ } // Paper this.access.execute(Level::blockEntityChanged); + } // Paper end - Add PlayerChangeBeaconEffectEvent } diff --git a/patches/unapplied/server/Add-PlayerDeepSleepEvent.patch b/patches/server/Add-PlayerDeepSleepEvent.patch similarity index 100% rename from patches/unapplied/server/Add-PlayerDeepSleepEvent.patch rename to patches/server/Add-PlayerDeepSleepEvent.patch diff --git a/patches/unapplied/server/Add-PlayerFlowerPotManipulateEvent.patch b/patches/server/Add-PlayerFlowerPotManipulateEvent.patch similarity index 53% rename from patches/unapplied/server/Add-PlayerFlowerPotManipulateEvent.patch rename to patches/server/Add-PlayerFlowerPotManipulateEvent.patch index 763e37850..fca138a6b 100644 --- a/patches/unapplied/server/Add-PlayerFlowerPotManipulateEvent.patch +++ b/patches/server/Add-PlayerFlowerPotManipulateEvent.patch @@ -9,17 +9,33 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 --- a/src/main/java/net/minecraft/world/level/block/FlowerPotBlock.java +++ b/src/main/java/net/minecraft/world/level/block/FlowerPotBlock.java @@ -0,0 +0,0 @@ public class FlowerPotBlock extends Block { - boolean bl = blockState.is(Blocks.AIR); - boolean bl2 = this.isEmpty(); - if (bl != bl2) { + } else if (!this.isEmpty()) { + return ItemInteractionResult.CONSUME; + } else { + // Paper start - Add PlayerFlowerPotManipulateEvent -+ boolean placing = bl2; // OBFHELPER + org.bukkit.block.Block block = org.bukkit.craftbukkit.block.CraftBlock.at(world, pos); -+ org.bukkit.inventory.ItemStack placedStack = org.bukkit.craftbukkit.inventory.CraftItemStack.asBukkitCopy(itemStack); -+ org.bukkit.inventory.ItemStack pottedStack = new org.bukkit.inventory.ItemStack(org.bukkit.craftbukkit.block.CraftBlockType.minecraftToBukkit(this.potted)); -+ org.bukkit.inventory.ItemStack stack = placing ? placedStack : pottedStack; ++ org.bukkit.inventory.ItemStack placedStack = org.bukkit.craftbukkit.inventory.CraftItemStack.asBukkitCopy(stack); + -+ io.papermc.paper.event.player.PlayerFlowerPotManipulateEvent event = new io.papermc.paper.event.player.PlayerFlowerPotManipulateEvent((org.bukkit.entity.Player) player.getBukkitEntity(), block, stack, placing); ++ io.papermc.paper.event.player.PlayerFlowerPotManipulateEvent event = new io.papermc.paper.event.player.PlayerFlowerPotManipulateEvent((org.bukkit.entity.Player) player.getBukkitEntity(), block, placedStack, true); ++ if (!event.callEvent()) { ++ // Update client ++ player.containerMenu.sendAllDataToRemote(); ++ ++ return ItemInteractionResult.CONSUME; ++ } ++ // Paper end - Add PlayerFlowerPotManipulateEvent + world.setBlock(pos, blockState, 3); + world.gameEvent(player, GameEvent.BLOCK_CHANGE, pos); + player.awardStat(Stats.POT_FLOWER); +@@ -0,0 +0,0 @@ public class FlowerPotBlock extends Block { + return InteractionResult.CONSUME; + } else { + ItemStack itemStack = new ItemStack(this.potted); ++ // Paper start - Add PlayerFlowerPotManipulateEvent ++ org.bukkit.block.Block block = org.bukkit.craftbukkit.block.CraftBlock.at(world, pos); ++ org.bukkit.inventory.ItemStack pottedStack = new org.bukkit.inventory.ItemStack(org.bukkit.craftbukkit.block.CraftBlockType.minecraftToBukkit(this.potted)); ++ ++ io.papermc.paper.event.player.PlayerFlowerPotManipulateEvent event = new io.papermc.paper.event.player.PlayerFlowerPotManipulateEvent((org.bukkit.entity.Player) player.getBukkitEntity(), block, pottedStack, false); + if (!event.callEvent()) { + // Update client + player.containerMenu.sendAllDataToRemote(); @@ -27,6 +43,6 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 + return InteractionResult.PASS; + } + // Paper end - Add PlayerFlowerPotManipulateEvent - if (bl2) { - world.setBlock(pos, blockState, 3); - player.awardStat(Stats.POT_FLOWER); + if (!player.addItem(itemStack)) { + player.drop(itemStack, false); + } diff --git a/patches/unapplied/server/Add-PlayerItemCooldownEvent.patch b/patches/server/Add-PlayerItemCooldownEvent.patch similarity index 100% rename from patches/unapplied/server/Add-PlayerItemCooldownEvent.patch rename to patches/server/Add-PlayerItemCooldownEvent.patch diff --git a/patches/unapplied/server/Add-PlayerLecternPageChangeEvent.patch b/patches/server/Add-PlayerLecternPageChangeEvent.patch similarity index 100% rename from patches/unapplied/server/Add-PlayerLecternPageChangeEvent.patch rename to patches/server/Add-PlayerLecternPageChangeEvent.patch diff --git a/patches/unapplied/server/Add-PlayerLoomPatternSelectEvent.patch b/patches/server/Add-PlayerLoomPatternSelectEvent.patch similarity index 100% rename from patches/unapplied/server/Add-PlayerLoomPatternSelectEvent.patch rename to patches/server/Add-PlayerLoomPatternSelectEvent.patch diff --git a/patches/unapplied/server/Add-PlayerNameEntityEvent.patch b/patches/server/Add-PlayerNameEntityEvent.patch similarity index 73% rename from patches/unapplied/server/Add-PlayerNameEntityEvent.patch rename to patches/server/Add-PlayerNameEntityEvent.patch index e8f2a3da7..aed17ddd5 100644 --- a/patches/unapplied/server/Add-PlayerNameEntityEvent.patch +++ b/patches/server/Add-PlayerNameEntityEvent.patch @@ -9,20 +9,18 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 --- a/src/main/java/net/minecraft/world/item/NameTagItem.java +++ b/src/main/java/net/minecraft/world/item/NameTagItem.java @@ -0,0 +0,0 @@ public class NameTagItem extends Item { - public InteractionResult interactLivingEntity(ItemStack stack, Player user, LivingEntity entity, InteractionHand hand) { - if (stack.hasCustomHoverName() && !(entity instanceof Player)) { + Component component = stack.get(DataComponents.CUSTOM_NAME); + if (component != null && !(entity instanceof Player)) { if (!user.level().isClientSide && entity.isAlive()) { -- entity.setCustomName(stack.getHoverName()); -- if (entity instanceof Mob) { -- ((Mob)entity).setPersistenceRequired(); +- entity.setCustomName(component); +- if (entity instanceof Mob mob) { + // Paper start - Add PlayerNameEntityEvent + io.papermc.paper.event.player.PlayerNameEntityEvent event = new io.papermc.paper.event.player.PlayerNameEntityEvent(((net.minecraft.server.level.ServerPlayer) user).getBukkitEntity(), entity.getBukkitLivingEntity(), io.papermc.paper.adventure.PaperAdventure.asAdventure(stack.getHoverName()), true); + if (!event.callEvent()) return InteractionResult.PASS; + LivingEntity newEntity = ((org.bukkit.craftbukkit.entity.CraftLivingEntity) event.getEntity()).getHandle(); + newEntity.setCustomName(event.getName() != null ? io.papermc.paper.adventure.PaperAdventure.asVanilla(event.getName()) : null); -+ if (event.isPersistent() && newEntity instanceof Mob) { -+ ((Mob) newEntity).setPersistenceRequired(); -+ // Paper end - Add PlayerNameEntityEvent ++ if (event.isPersistent() && newEntity instanceof Mob mob) { ++ // Paper end - Add PlayerNameEntityEvent + mob.setPersistenceRequired(); } - stack.shrink(1); diff --git a/patches/unapplied/server/Add-PlayerShearBlockEvent.patch b/patches/server/Add-PlayerShearBlockEvent.patch similarity index 50% rename from patches/unapplied/server/Add-PlayerShearBlockEvent.patch rename to patches/server/Add-PlayerShearBlockEvent.patch index 908c06900..b52fc498a 100644 --- a/patches/unapplied/server/Add-PlayerShearBlockEvent.patch +++ b/patches/server/Add-PlayerShearBlockEvent.patch @@ -18,9 +18,9 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 @Override @@ -0,0 +0,0 @@ public class BeehiveBlock extends BaseEntityBlock { - Item item = itemstack.getItem(); + Item item = stack.getItem(); - if (itemstack.is(Items.SHEARS)) { + if (stack.is(Items.SHEARS)) { + // Paper start - Add PlayerShearBlockEvent + io.papermc.paper.event.block.PlayerShearBlockEvent event = new io.papermc.paper.event.block.PlayerShearBlockEvent((org.bukkit.entity.Player) player.getBukkitEntity(), org.bukkit.craftbukkit.block.CraftBlock.at(world, pos), org.bukkit.craftbukkit.inventory.CraftItemStack.asCraftMirror(itemstack), org.bukkit.craftbukkit.CraftEquipmentSlot.getHand(hand), new java.util.ArrayList<>()); + event.getDrops().add(org.bukkit.craftbukkit.inventory.CraftItemStack.asCraftMirror(new ItemStack(Items.HONEYCOMB, 3))); @@ -35,44 +35,37 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 + popResource(world, pos, org.bukkit.craftbukkit.inventory.CraftItemStack.asNMSCopy(itemDrop)); + } + // Paper end - Add PlayerShearBlockEvent - itemstack.hurtAndBreak(1, player, (entityhuman1) -> { - entityhuman1.broadcastBreakEvent(hand); - }); + stack.hurtAndBreak(1, player, LivingEntity.getSlotForHand(hand)); + flag = true; + world.gameEvent((Entity) player, (Holder) GameEvent.SHEAR, pos); diff --git a/src/main/java/net/minecraft/world/level/block/PumpkinBlock.java b/src/main/java/net/minecraft/world/level/block/PumpkinBlock.java index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 --- a/src/main/java/net/minecraft/world/level/block/PumpkinBlock.java +++ b/src/main/java/net/minecraft/world/level/block/PumpkinBlock.java @@ -0,0 +0,0 @@ public class PumpkinBlock extends Block { - ItemStack itemStack = player.getItemInHand(hand); - if (itemStack.is(Items.SHEARS)) { - if (!world.isClientSide) { -+ // Paper start - Add PlayerShearBlockEvent -+ io.papermc.paper.event.block.PlayerShearBlockEvent event = new io.papermc.paper.event.block.PlayerShearBlockEvent((org.bukkit.entity.Player) player.getBukkitEntity(), org.bukkit.craftbukkit.block.CraftBlock.at(world, pos), org.bukkit.craftbukkit.inventory.CraftItemStack.asCraftMirror(itemStack), org.bukkit.craftbukkit.CraftEquipmentSlot.getHand(hand), new java.util.ArrayList<>()); -+ event.getDrops().add(org.bukkit.craftbukkit.inventory.CraftItemStack.asCraftMirror(new ItemStack(Items.PUMPKIN_SEEDS, 4))); -+ if (!event.callEvent()) { -+ return InteractionResult.PASS; -+ } -+ // Paper end - Add PlayerShearBlockEvent - Direction direction = hit.getDirection(); - Direction direction2 = direction.getAxis() == Direction.Axis.Y ? player.getDirection().getOpposite() : direction; - world.playSound(null, pos, SoundEvents.PUMPKIN_CARVE, SoundSource.BLOCKS, 1.0F, 1.0F); - world.setBlock(pos, Blocks.CARVED_PUMPKIN.defaultBlockState().setValue(CarvedPumpkinBlock.FACING, direction2), 11); -+ for (org.bukkit.inventory.ItemStack item : event.getDrops()) { // Paper - Add PlayerShearBlockEvent - ItemEntity itemEntity = new ItemEntity( - world, - (double)pos.getX() + 0.5 + (double)direction2.getStepX() * 0.65, - (double)pos.getY() + 0.1, - (double)pos.getZ() + 0.5 + (double)direction2.getStepZ() * 0.65, -- new ItemStack(Items.PUMPKIN_SEEDS, 4) -+ org.bukkit.craftbukkit.inventory.CraftItemStack.asNMSCopy(item) // Paper - Add PlayerShearBlockEvent - ); - itemEntity.setDeltaMovement( - 0.05 * (double)direction2.getStepX() + world.random.nextDouble() * 0.02, + } else if (world.isClientSide) { + return ItemInteractionResult.sidedSuccess(world.isClientSide); + } else { ++ // Paper start - Add PlayerShearBlockEvent ++ io.papermc.paper.event.block.PlayerShearBlockEvent event = new io.papermc.paper.event.block.PlayerShearBlockEvent((org.bukkit.entity.Player) player.getBukkitEntity(), org.bukkit.craftbukkit.block.CraftBlock.at(world, pos), org.bukkit.craftbukkit.inventory.CraftItemStack.asCraftMirror(itemStack), org.bukkit.craftbukkit.CraftEquipmentSlot.getHand(hand), new java.util.ArrayList<>()); ++ event.getDrops().add(org.bukkit.craftbukkit.inventory.CraftItemStack.asCraftMirror(new ItemStack(Items.PUMPKIN_SEEDS, 4))); ++ if (!event.callEvent()) { ++ return InteractionResult.PASS; ++ } ++ // Paper end - Add PlayerShearBlockEvent + Direction direction = hit.getDirection(); + Direction direction2 = direction.getAxis() == Direction.Axis.Y ? player.getDirection().getOpposite() : direction; + world.playSound(null, pos, SoundEvents.PUMPKIN_CARVE, SoundSource.BLOCKS, 1.0F, 1.0F); + world.setBlock(pos, Blocks.CARVED_PUMPKIN.defaultBlockState().setValue(CarvedPumpkinBlock.FACING, direction2), 11); ++ for (org.bukkit.inventory.ItemStack item : event.getDrops()) { // Paper - Add PlayerShearBlockEvent + ItemEntity itemEntity = new ItemEntity( + world, + (double)pos.getX() + 0.5 + (double)direction2.getStepX() * 0.65, @@ -0,0 +0,0 @@ public class PumpkinBlock extends Block { - 0.05 * (double)direction2.getStepZ() + world.random.nextDouble() * 0.02 - ); - world.addFreshEntity(itemEntity); -+ } // Paper - Add PlayerShearBlockEvent - itemStack.hurtAndBreak(1, player, playerx -> playerx.broadcastBreakEvent(hand)); - world.gameEvent(player, GameEvent.SHEAR, pos); - player.awardStat(Stats.ITEM_USED.get(Items.SHEARS)); + 0.05 * (double)direction2.getStepZ() + world.random.nextDouble() * 0.02 + ); + world.addFreshEntity(itemEntity); ++ } // Paper - Add PlayerShearBlockEvent + stack.hurtAndBreak(1, player, LivingEntity.getSlotForHand(hand)); + world.gameEvent(player, GameEvent.SHEAR, pos); + player.awardStat(Stats.ITEM_USED.get(Items.SHEARS)); diff --git a/patches/unapplied/server/Add-PlayerStonecutterRecipeSelectEvent.patch b/patches/server/Add-PlayerStonecutterRecipeSelectEvent.patch similarity index 100% rename from patches/unapplied/server/Add-PlayerStonecutterRecipeSelectEvent.patch rename to patches/server/Add-PlayerStonecutterRecipeSelectEvent.patch diff --git a/patches/unapplied/server/Add-ServerResourcesReloadedEvent.patch b/patches/server/Add-ServerResourcesReloadedEvent.patch similarity index 96% rename from patches/unapplied/server/Add-ServerResourcesReloadedEvent.patch rename to patches/server/Add-ServerResourcesReloadedEvent.patch index 79633027a..d6362f14d 100644 --- a/patches/unapplied/server/Add-ServerResourcesReloadedEvent.patch +++ b/patches/server/Add-ServerResourcesReloadedEvent.patch @@ -19,9 +19,9 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 + } + public CompletableFuture reloadResources(Collection dataPacks, io.papermc.paper.event.server.ServerResourcesReloadedEvent.Cause cause) { + // Paper end - Add ServerResourcesReloadedEvent - RegistryAccess.Frozen iregistrycustom_dimension = this.registries.getAccessForLoading(RegistryLayer.RELOADABLE); CompletableFuture completablefuture = CompletableFuture.supplyAsync(() -> { Stream stream = dataPacks.stream(); // CraftBukkit - decompile error + PackRepository resourcepackrepository = this.packRepository; @@ -0,0 +0,0 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop implements Registry { - return new CraftRegistry<>(DamageType.class, registryHolder.registryOrThrow(Registries.DAMAGE_TYPE), CraftDamageType::new); + return new CraftRegistry<>(Wolf.Variant.class, registryHolder.registryOrThrow(Registries.WOLF_VARIANT), CraftWolf.CraftVariant::new); } // TODO registry modification API + // Paper start - remove this after a while along with all ConfiguredStructure stuff diff --git a/patches/unapplied/server/Add-TargetHitEvent.patch b/patches/server/Add-TargetHitEvent.patch similarity index 96% rename from patches/unapplied/server/Add-TargetHitEvent.patch rename to patches/server/Add-TargetHitEvent.patch index 0cba4f9d5..daf664a6f 100644 --- a/patches/unapplied/server/Add-TargetHitEvent.patch +++ b/patches/server/Add-TargetHitEvent.patch @@ -10,7 +10,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 +++ b/src/main/java/net/minecraft/world/level/block/TargetBlock.java @@ -0,0 +0,0 @@ public class TargetBlock extends Block { @Override - public void onProjectileHit(Level world, BlockState state, BlockHitResult hit, Projectile projectile) { + protected void onProjectileHit(Level world, BlockState state, BlockHitResult hit, Projectile projectile) { int i = updateRedstoneOutput(world, state, hit, projectile); + // Paper start - Add TargetHitEvent + } diff --git a/patches/unapplied/server/Add-Unix-domain-socket-support.patch b/patches/server/Add-Unix-domain-socket-support.patch similarity index 76% rename from patches/unapplied/server/Add-Unix-domain-socket-support.patch rename to patches/server/Add-Unix-domain-socket-support.patch index 467dea0c8..0e56871e4 100644 --- a/patches/unapplied/server/Add-Unix-domain-socket-support.patch +++ b/patches/server/Add-Unix-domain-socket-support.patch @@ -107,31 +107,31 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 --- a/src/main/java/net/minecraft/server/network/ServerHandshakePacketListenerImpl.java +++ b/src/main/java/net/minecraft/server/network/ServerHandshakePacketListenerImpl.java @@ -0,0 +0,0 @@ public class ServerHandshakePacketListenerImpl implements ServerHandshakePacketL - this.connection.setClientboundProtocolAfterHandshake(ClientIntent.LOGIN); - // CraftBukkit start - Connection throttle - try { -+ if (!(this.connection.channel.localAddress() instanceof io.netty.channel.unix.DomainSocketAddress)) { // Paper - Unix domain socket support; the connection throttle is useless when you have a Unix domain socket - long currentTime = System.currentTimeMillis(); - long connectionThrottle = this.server.server.getConnectionThrottle(); - InetAddress address = ((java.net.InetSocketAddress) this.connection.getRemoteAddress()).getAddress(); + this.connection.setupOutboundProtocol(LoginProtocols.CLIENTBOUND); + // CraftBukkit start - Connection throttle + try { ++ if (!(this.connection.channel.localAddress() instanceof io.netty.channel.unix.DomainSocketAddress)) { // Paper - Unix domain socket support; the connection throttle is useless when you have a Unix domain socket + long currentTime = System.currentTimeMillis(); + long connectionThrottle = this.server.server.getConnectionThrottle(); + InetAddress address = ((java.net.InetSocketAddress) this.connection.getRemoteAddress()).getAddress(); @@ -0,0 +0,0 @@ public class ServerHandshakePacketListenerImpl implements ServerHandshakePacketL - } - } } -+ } // Paper - Unix domain socket support - } catch (Throwable t) { - org.apache.logging.log4j.LogManager.getLogger().debug("Failed to check connection throttle", t); } + } ++ } // Paper - Unix domain socket support + } catch (Throwable t) { + org.apache.logging.log4j.LogManager.getLogger().debug("Failed to check connection throttle", t); + } @@ -0,0 +0,0 @@ public class ServerHandshakePacketListenerImpl implements ServerHandshakePacketL - // Paper end - PlayerHandshakeEvent - // if (org.spigotmc.SpigotConfig.bungee) { // Paper - comment out, we check above! - if ( ( split.length == 3 || split.length == 4 ) && ( ServerHandshakePacketListenerImpl.BYPASS_HOSTCHECK || ServerHandshakePacketListenerImpl.HOST_PATTERN.matcher( split[1] ).matches() ) ) { // Paper - Add bypass host check -+ // Paper start - Unix domain socket support -+ java.net.SocketAddress socketAddress = this.connection.getRemoteAddress(); - this.connection.hostname = split[0]; -- this.connection.address = new java.net.InetSocketAddress(split[1], ((java.net.InetSocketAddress) this.connection.getRemoteAddress()).getPort()); -+ this.connection.address = new java.net.InetSocketAddress(split[1], socketAddress instanceof java.net.InetSocketAddress ? ((java.net.InetSocketAddress) socketAddress).getPort() : 0); -+ // Paper end - Unix domain socket support - this.connection.spoofedUUID = com.mojang.util.UndashedUuid.fromStringLenient( split[2] ); - } else - { + if (!handledByEvent && proxyLogicEnabled) { // Paper + // if (org.spigotmc.SpigotConfig.bungee) { // Paper - comment out, we check above! + if ( ( split.length == 3 || split.length == 4 ) && ( ServerHandshakePacketListenerImpl.BYPASS_HOSTCHECK || ServerHandshakePacketListenerImpl.HOST_PATTERN.matcher( split[1] ).matches() ) ) { // Paper - Add bypass host check ++ // Paper start - Unix domain socket support ++ java.net.SocketAddress socketAddress = this.connection.getRemoteAddress(); + this.connection.hostname = split[0]; +- this.connection.address = new java.net.InetSocketAddress(split[1], ((java.net.InetSocketAddress) this.connection.getRemoteAddress()).getPort()); ++ this.connection.address = new java.net.InetSocketAddress(split[1], socketAddress instanceof java.net.InetSocketAddress ? ((java.net.InetSocketAddress) socketAddress).getPort() : 0); ++ // Paper end - Unix domain socket support + this.connection.spoofedUUID = com.mojang.util.UndashedUuid.fromStringLenient( split[2] ); + } else + { diff --git a/patches/unapplied/server/Add-Wandering-Trader-spawn-rate-config-options.patch b/patches/server/Add-Wandering-Trader-spawn-rate-config-options.patch similarity index 100% rename from patches/unapplied/server/Add-Wandering-Trader-spawn-rate-config-options.patch rename to patches/server/Add-Wandering-Trader-spawn-rate-config-options.patch diff --git a/patches/unapplied/server/Add-WorldGameRuleChangeEvent.patch b/patches/server/Add-WorldGameRuleChangeEvent.patch similarity index 100% rename from patches/unapplied/server/Add-WorldGameRuleChangeEvent.patch rename to patches/server/Add-WorldGameRuleChangeEvent.patch diff --git a/patches/unapplied/server/Add-a-should-burn-in-sunlight-API-for-Phantoms-and-S.patch b/patches/server/Add-a-should-burn-in-sunlight-API-for-Phantoms-and-S.patch similarity index 96% rename from patches/unapplied/server/Add-a-should-burn-in-sunlight-API-for-Phantoms-and-S.patch rename to patches/server/Add-a-should-burn-in-sunlight-API-for-Phantoms-and-S.patch index 135625530..81c172a01 100644 --- a/patches/unapplied/server/Add-a-should-burn-in-sunlight-API-for-Phantoms-and-S.patch +++ b/patches/server/Add-a-should-burn-in-sunlight-API-for-Phantoms-and-S.patch @@ -10,8 +10,8 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 --- a/src/main/java/net/minecraft/world/entity/monster/AbstractSkeleton.java +++ b/src/main/java/net/minecraft/world/entity/monster/AbstractSkeleton.java @@ -0,0 +0,0 @@ public abstract class AbstractSkeleton extends Monster implements RangedAttackMo - return MobType.UNDEAD; - } + + abstract SoundEvent getStepSound(); + // Paper start - shouldBurnInDay API + private boolean shouldBurnInDay = true; @@ -56,8 +56,8 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 @Override public void aiStep() { - if (this.isAlive() && this.isSunBurnTick()) { -+ if (this.isAlive() && shouldBurnInDay && this.isSunBurnTick()) { // Paper - shouldBurnInDay API - this.setSecondsOnFire(8); ++ if (this.isAlive() && this.shouldBurnInDay && this.isSunBurnTick()) { // Paper - shouldBurnInDay API + this.igniteForSeconds(8); } @@ -0,0 +0,0 @@ public class Phantom extends FlyingMob implements Enemy { @@ -79,15 +79,15 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 } @@ -0,0 +0,0 @@ public class Phantom extends FlyingMob implements Enemy { - return spawningEntity; + 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 - private static enum AttackPhase { + private static enum AttackPhase { diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftAbstractSkeleton.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftAbstractSkeleton.java index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 --- a/src/main/java/org/bukkit/craftbukkit/entity/CraftAbstractSkeleton.java diff --git a/patches/unapplied/server/Add-additional-open-container-api-to-HumanEntity.patch b/patches/server/Add-additional-open-container-api-to-HumanEntity.patch similarity index 100% rename from patches/unapplied/server/Add-additional-open-container-api-to-HumanEntity.patch rename to patches/server/Add-additional-open-container-api-to-HumanEntity.patch diff --git a/patches/unapplied/server/Add-basic-Datapack-API.patch b/patches/server/Add-basic-Datapack-API.patch similarity index 100% rename from patches/unapplied/server/Add-basic-Datapack-API.patch rename to patches/server/Add-basic-Datapack-API.patch diff --git a/patches/unapplied/server/Add-bypass-host-check.patch b/patches/server/Add-bypass-host-check.patch similarity index 57% rename from patches/unapplied/server/Add-bypass-host-check.patch rename to patches/server/Add-bypass-host-check.patch index 7f73a878d..ce22312a8 100644 --- a/patches/unapplied/server/Add-bypass-host-check.patch +++ b/patches/server/Add-bypass-host-check.patch @@ -20,11 +20,11 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 public ServerHandshakePacketListenerImpl(MinecraftServer server, Connection connection) { this.server = server; @@ -0,0 +0,0 @@ public class ServerHandshakePacketListenerImpl implements ServerHandshakePacketL - if (!handledByEvent && proxyLogicEnabled) { - // Paper end - PlayerHandshakeEvent - // if (org.spigotmc.SpigotConfig.bungee) { // Paper - comment out, we check above! -- if ( ( split.length == 3 || split.length == 4 ) && ( ServerHandshakePacketListenerImpl.HOST_PATTERN.matcher( split[1] ).matches() ) ) { -+ if ( ( split.length == 3 || split.length == 4 ) && ( ServerHandshakePacketListenerImpl.BYPASS_HOSTCHECK || ServerHandshakePacketListenerImpl.HOST_PATTERN.matcher( split[1] ).matches() ) ) { // Paper - Add bypass host check - this.connection.hostname = split[0]; - this.connection.address = new java.net.InetSocketAddress(split[1], ((java.net.InetSocketAddress) this.connection.getRemoteAddress()).getPort()); - this.connection.spoofedUUID = com.mojang.util.UndashedUuid.fromStringLenient( split[2] ); + String[] split = packet.hostName().split("\00"); + if (!handledByEvent && proxyLogicEnabled) { // Paper + // if (org.spigotmc.SpigotConfig.bungee) { // Paper - comment out, we check above! +- if ( ( split.length == 3 || split.length == 4 ) && ( ServerHandshakePacketListenerImpl.HOST_PATTERN.matcher( split[1] ).matches() ) ) { ++ if ( ( split.length == 3 || split.length == 4 ) && ( ServerHandshakePacketListenerImpl.BYPASS_HOSTCHECK || ServerHandshakePacketListenerImpl.HOST_PATTERN.matcher( split[1] ).matches() ) ) { // Paper - Add bypass host check + this.connection.hostname = split[0]; + this.connection.address = new java.net.InetSocketAddress(split[1], ((java.net.InetSocketAddress) this.connection.getRemoteAddress()).getPort()); + this.connection.spoofedUUID = com.mojang.util.UndashedUuid.fromStringLenient( split[2] ); diff --git a/patches/unapplied/server/Add-environment-variable-to-disable-server-gui.patch b/patches/server/Add-environment-variable-to-disable-server-gui.patch similarity index 87% rename from patches/unapplied/server/Add-environment-variable-to-disable-server-gui.patch rename to patches/server/Add-environment-variable-to-disable-server-gui.patch index bf7cb984e..5e3a4bfa6 100644 --- a/patches/unapplied/server/Add-environment-variable-to-disable-server-gui.patch +++ b/patches/server/Add-environment-variable-to-disable-server-gui.patch @@ -10,9 +10,9 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 +++ b/src/main/java/net/minecraft/server/Main.java @@ -0,0 +0,0 @@ public class Main { */ - boolean flag1 = !optionset.has("nogui") && !optionset.nonOptionArguments().contains("nogui"); + boolean flag2 = !optionset.has("nogui") && !optionset.nonOptionArguments().contains("nogui"); + if(!Boolean.parseBoolean(System.getenv().getOrDefault("PAPER_DISABLE_SERVER_GUI", String.valueOf(false)))) // Paper - Add environment variable to disable server gui - if (flag1 && !GraphicsEnvironment.isHeadless()) { + if (flag2 && !GraphicsEnvironment.isHeadless()) { dedicatedserver1.showGui(); } diff --git a/patches/unapplied/server/Add-fast-alternative-constructor-for-Rotations.patch b/patches/server/Add-fast-alternative-constructor-for-Rotations.patch similarity index 100% rename from patches/unapplied/server/Add-fast-alternative-constructor-for-Rotations.patch rename to patches/server/Add-fast-alternative-constructor-for-Rotations.patch diff --git a/patches/unapplied/server/Add-getMainThreadExecutor-to-BukkitScheduler.patch b/patches/server/Add-getMainThreadExecutor-to-BukkitScheduler.patch similarity index 100% rename from patches/unapplied/server/Add-getMainThreadExecutor-to-BukkitScheduler.patch rename to patches/server/Add-getMainThreadExecutor-to-BukkitScheduler.patch diff --git a/patches/unapplied/server/Add-getOfflinePlayerIfCached-String.patch b/patches/server/Add-getOfflinePlayerIfCached-String.patch similarity index 100% rename from patches/unapplied/server/Add-getOfflinePlayerIfCached-String.patch rename to patches/server/Add-getOfflinePlayerIfCached-String.patch diff --git a/patches/unapplied/server/Add-ignore-discounts-API.patch b/patches/server/Add-ignore-discounts-API.patch similarity index 66% rename from patches/unapplied/server/Add-ignore-discounts-API.patch rename to patches/server/Add-ignore-discounts-API.patch index 5fd454db0..42d04a295 100644 --- a/patches/unapplied/server/Add-ignore-discounts-API.patch +++ b/patches/server/Add-ignore-discounts-API.patch @@ -28,6 +28,17 @@ diff --git a/src/main/java/net/minecraft/world/item/trading/MerchantOffer.java b index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 --- a/src/main/java/net/minecraft/world/item/trading/MerchantOffer.java +++ b/src/main/java/net/minecraft/world/item/trading/MerchantOffer.java +@@ -0,0 +0,0 @@ public class MerchantOffer { + return merchantrecipe.priceMultiplier; + }), Codec.INT.lenientOptionalFieldOf("xp", 1).forGetter((merchantrecipe) -> { + return merchantrecipe.xp; ++ // Paper start ++ }), Codec.BOOL.lenientOptionalFieldOf("Paper.IgnoreDiscounts", false).forGetter((merchantrecipe) -> { ++ return merchantrecipe.ignoreDiscounts; ++ // Paper end + })).apply(instance, MerchantOffer::new); + }); + public static final StreamCodec STREAM_CODEC = StreamCodec.of(MerchantOffer::writeToStream, MerchantOffer::createFromStream); @@ -0,0 +0,0 @@ public class MerchantOffer { public int demand; public float priceMultiplier; @@ -38,58 +49,35 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 @@ -0,0 +0,0 @@ public class MerchantOffer { } - - public MerchantOffer(ItemStack itemstack, ItemStack itemstack1, ItemStack itemstack2, int uses, int maxUses, int experience, float priceMultiplier, int demand, CraftMerchantRecipe bukkit) { -- this(itemstack, itemstack1, itemstack2, uses, maxUses, experience, priceMultiplier, demand); -+ // Paper start - Add ignore discounts API -+ this(itemstack, itemstack1, itemstack2, uses, maxUses, experience, priceMultiplier, demand, false, bukkit); -+ } -+ public MerchantOffer(ItemStack itemstack, ItemStack itemstack1, ItemStack itemstack2, int uses, int maxUses, int experience, float priceMultiplier, boolean ignoreDiscounts, CraftMerchantRecipe bukkit) { -+ this(itemstack, itemstack1, itemstack2, uses, maxUses, experience, priceMultiplier, 0, ignoreDiscounts, bukkit); -+ } -+ public MerchantOffer(ItemStack itemstack, ItemStack itemstack1, ItemStack itemstack2, int uses, int maxUses, int experience, float priceMultiplier, int demand, boolean ignoreDiscounts, CraftMerchantRecipe bukkit) { -+ this(itemstack, itemstack1, itemstack2, uses, maxUses, experience, priceMultiplier, demand, ignoreDiscounts); -+ // Paper end - Add ignore discounts API - this.bukkitHandle = bukkit; - } // CraftBukkit end -@@ -0,0 +0,0 @@ public class MerchantOffer { - this.specialPriceDiff = nbt.getInt("specialPrice"); - this.demand = nbt.getInt("demand"); -+ this.ignoreDiscounts = nbt.getBoolean("Paper.IgnoreDiscounts"); // Paper - Add ignore discounts API - } - - public MerchantOffer(ItemStack buyItem, ItemStack sellItem, int maxUses, int merchantExperience, float priceMultiplier) { -@@ -0,0 +0,0 @@ public class MerchantOffer { - } - - public MerchantOffer(ItemStack firstBuyItem, ItemStack secondBuyItem, ItemStack sellItem, int uses, int maxUses, int merchantExperience, float priceMultiplier) { -- this(firstBuyItem, secondBuyItem, sellItem, uses, maxUses, merchantExperience, priceMultiplier, 0); -+ // Paper start - Add ignore discounts API -+ this(firstBuyItem, secondBuyItem, sellItem, uses, maxUses, merchantExperience, priceMultiplier, false); -+ } -+ public MerchantOffer(ItemStack firstBuyItem, ItemStack secondBuyItem, ItemStack sellItem, int uses, int maxUses, int merchantExperience, float priceMultiplier, boolean ignoreDiscounts) { -+ this(firstBuyItem, secondBuyItem, sellItem, uses, maxUses, merchantExperience, priceMultiplier, 0, ignoreDiscounts); - } - - public MerchantOffer(ItemStack firstBuyItem, ItemStack secondBuyItem, ItemStack sellItem, int uses, int maxUses, int merchantExperience, float priceMultiplier, int demandBonus) { -+ this(firstBuyItem, secondBuyItem, sellItem, uses, maxUses, merchantExperience, priceMultiplier, demandBonus, false); -+ } -+ public MerchantOffer(ItemStack firstBuyItem, ItemStack secondBuyItem, ItemStack sellItem, int uses, int maxUses, int merchantExperience, float priceMultiplier, int demandBonus, boolean ignoreDiscounts) { -+ this.ignoreDiscounts = ignoreDiscounts; -+ // Paper end - Add ignore discounts API - this.rewardExp = true; - this.xp = 1; +- private MerchantOffer(ItemCost firstBuyItem, Optional secondBuyItem, ItemStack sellItem, int uses, int maxUses, boolean rewardingPlayerExperience, int specialPrice, int demandBonus, float priceMultiplier, int merchantExperience) { ++ private MerchantOffer(ItemCost firstBuyItem, Optional secondBuyItem, ItemStack sellItem, int uses, int maxUses, boolean rewardingPlayerExperience, int specialPrice, int demandBonus, float priceMultiplier, int merchantExperience, boolean ignoreDiscounts) { // Paper this.baseCostA = firstBuyItem; + this.costB = secondBuyItem; + this.result = sellItem; @@ -0,0 +0,0 @@ public class MerchantOffer { - nbttagcompound.putFloat("priceMultiplier", this.priceMultiplier); - nbttagcompound.putInt("specialPrice", this.specialPriceDiff); - nbttagcompound.putInt("demand", this.demand); -+ nbttagcompound.putBoolean("Paper.IgnoreDiscounts", this.ignoreDiscounts); // Paper - Add ignore discounts API - return nbttagcompound; + this.demand = demandBonus; + this.priceMultiplier = priceMultiplier; + this.xp = merchantExperience; ++ this.ignoreDiscounts = ignoreDiscounts; } + public MerchantOffer(ItemCost buyItem, ItemStack sellItem, int maxUses, int merchantExperience, float priceMultiplier) { +@@ -0,0 +0,0 @@ public class MerchantOffer { + } + + public MerchantOffer(ItemCost firstBuyItem, Optional secondBuyItem, ItemStack sellItem, int uses, int maxUses, int merchantExperience, float priceMultiplier, int demandBonus) { +- this(firstBuyItem, secondBuyItem, sellItem, uses, maxUses, true, 0, demandBonus, priceMultiplier, merchantExperience); ++ this(firstBuyItem, secondBuyItem, sellItem, uses, maxUses, true, 0, demandBonus, priceMultiplier, merchantExperience, false); // Paper + } + + private MerchantOffer(MerchantOffer offer) { +- this(offer.baseCostA, offer.costB, offer.result.copy(), offer.uses, offer.maxUses, offer.rewardExp, offer.specialPriceDiff, offer.demand, offer.priceMultiplier, offer.xp); ++ this(offer.baseCostA, offer.costB, offer.result.copy(), offer.uses, offer.maxUses, offer.rewardExp, offer.specialPriceDiff, offer.demand, offer.priceMultiplier, offer.xp, offer.ignoreDiscounts); // Paper + } + + public ItemStack getBaseCostA() { diff --git a/src/main/java/org/bukkit/craftbukkit/inventory/CraftMerchantRecipe.java b/src/main/java/org/bukkit/craftbukkit/inventory/CraftMerchantRecipe.java index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 --- a/src/main/java/org/bukkit/craftbukkit/inventory/CraftMerchantRecipe.java @@ -114,8 +102,8 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 + super(result, uses, maxUses, experienceReward, experience, priceMultiplier, demand, specialPrice, ignoreDiscounts); + // Paper end this.handle = new net.minecraft.world.item.trading.MerchantOffer( - net.minecraft.world.item.ItemStack.EMPTY, - net.minecraft.world.item.ItemStack.EMPTY, + new ItemCost(Items.AIR), + Optional.empty(), @@ -0,0 +0,0 @@ public class CraftMerchantRecipe extends MerchantRecipe { experience, priceMultiplier, diff --git a/patches/unapplied/server/Add-missing-default-perms-for-commands.patch b/patches/server/Add-missing-default-perms-for-commands.patch similarity index 100% rename from patches/unapplied/server/Add-missing-default-perms-for-commands.patch rename to patches/server/Add-missing-default-perms-for-commands.patch diff --git a/patches/unapplied/server/Add-more-WanderingTrader-API.patch b/patches/server/Add-more-WanderingTrader-API.patch similarity index 95% rename from patches/unapplied/server/Add-more-WanderingTrader-API.patch rename to patches/server/Add-more-WanderingTrader-API.patch index 4eddf85de..f168743f0 100644 --- a/patches/unapplied/server/Add-more-WanderingTrader-API.patch +++ b/patches/server/Add-more-WanderingTrader-API.patch @@ -22,7 +22,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 @@ -0,0 +0,0 @@ public class WanderingTrader extends net.minecraft.world.entity.npc.AbstractVill protected void registerGoals() { this.goalSelector.addGoal(0, new FloatGoal(this)); - this.goalSelector.addGoal(0, new UseItemGoal<>(this, PotionUtils.setPotion(new ItemStack(Items.POTION), Potions.INVISIBILITY), SoundEvents.WANDERING_TRADER_DISAPPEARED, (entityvillagertrader) -> { + this.goalSelector.addGoal(0, new UseItemGoal<>(this, PotionContents.createItemStack(Items.POTION, Potions.INVISIBILITY), SoundEvents.WANDERING_TRADER_DISAPPEARED, (entityvillagertrader) -> { - return this.level().isNight() && !entityvillagertrader.isInvisible(); + return this.canDrinkPotion && this.level().isNight() && !entityvillagertrader.isInvisible(); // Paper - Add more WanderingTrader API })); diff --git a/patches/unapplied/server/Add-recipe-to-cook-events.patch b/patches/server/Add-recipe-to-cook-events.patch similarity index 100% rename from patches/unapplied/server/Add-recipe-to-cook-events.patch rename to patches/server/Add-recipe-to-cook-events.patch diff --git a/patches/unapplied/server/Add-sendOpLevel-API.patch b/patches/server/Add-sendOpLevel-API.patch similarity index 100% rename from patches/unapplied/server/Add-sendOpLevel-API.patch rename to patches/server/Add-sendOpLevel-API.patch diff --git a/patches/unapplied/server/Add-toggle-for-always-placing-the-dragon-egg.patch b/patches/server/Add-toggle-for-always-placing-the-dragon-egg.patch similarity index 100% rename from patches/unapplied/server/Add-toggle-for-always-placing-the-dragon-egg.patch rename to patches/server/Add-toggle-for-always-placing-the-dragon-egg.patch diff --git a/patches/unapplied/server/Add-world-settings-for-mobs-picking-up-loot.patch b/patches/server/Add-world-settings-for-mobs-picking-up-loot.patch similarity index 98% rename from patches/unapplied/server/Add-world-settings-for-mobs-picking-up-loot.patch rename to patches/server/Add-world-settings-for-mobs-picking-up-loot.patch index 6c759e5aa..a92a54f7d 100644 --- a/patches/unapplied/server/Add-world-settings-for-mobs-picking-up-loot.patch +++ b/patches/server/Add-world-settings-for-mobs-picking-up-loot.patch @@ -22,7 +22,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 --- a/src/main/java/net/minecraft/world/entity/monster/Zombie.java +++ b/src/main/java/net/minecraft/world/entity/monster/Zombie.java @@ -0,0 +0,0 @@ public class Zombie extends Monster { - Object object = super.finalizeSpawn(world, difficulty, spawnReason, entityData, entityNbt); + Object object = super.finalizeSpawn(world, difficulty, spawnReason, entityData); float f = difficulty.getSpecialMultiplier(); - this.setCanPickUpLoot(randomsource.nextFloat() < 0.55F * f); diff --git a/patches/unapplied/server/Add-worldborder-events.patch b/patches/server/Add-worldborder-events.patch similarity index 100% rename from patches/unapplied/server/Add-worldborder-events.patch rename to patches/server/Add-worldborder-events.patch diff --git a/patches/unapplied/server/Additional-Block-Material-API.patch b/patches/server/Additional-Block-Material-API.patch similarity index 100% rename from patches/unapplied/server/Additional-Block-Material-API.patch rename to patches/server/Additional-Block-Material-API.patch diff --git a/patches/unapplied/server/Allow-adding-items-to-BlockDropItemEvent.patch b/patches/server/Allow-adding-items-to-BlockDropItemEvent.patch similarity index 100% rename from patches/unapplied/server/Allow-adding-items-to-BlockDropItemEvent.patch rename to patches/server/Allow-adding-items-to-BlockDropItemEvent.patch diff --git a/patches/unapplied/server/Allow-disabling-mob-spawner-spawn-egg-transformation.patch b/patches/server/Allow-disabling-mob-spawner-spawn-egg-transformation.patch similarity index 93% rename from patches/unapplied/server/Allow-disabling-mob-spawner-spawn-egg-transformation.patch rename to patches/server/Allow-disabling-mob-spawner-spawn-egg-transformation.patch index f795f0986..e691b2126 100644 --- a/patches/unapplied/server/Allow-disabling-mob-spawner-spawn-egg-transformation.patch +++ b/patches/server/Allow-disabling-mob-spawner-spawn-egg-transformation.patch @@ -16,4 +16,4 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 + Spawner spawner = (Spawner) tileentity; - entitytypes = this.getType(itemstack.getTag()); + entitytypes = this.getType(itemstack); diff --git a/patches/unapplied/server/Allow-using-signs-inside-spawn-protection.patch b/patches/server/Allow-using-signs-inside-spawn-protection.patch similarity index 62% rename from patches/unapplied/server/Allow-using-signs-inside-spawn-protection.patch rename to patches/server/Allow-using-signs-inside-spawn-protection.patch index 9d96d232a..cb577a13d 100644 --- a/patches/unapplied/server/Allow-using-signs-inside-spawn-protection.patch +++ b/patches/server/Allow-using-signs-inside-spawn-protection.patch @@ -12,8 +12,9 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 int i = this.player.level().getMaxBuildHeight(); if (blockposition.getY() < i) { -- if (this.awaitingPositionFromClient == null && this.player.distanceToSqr((double) blockposition.getX() + 0.5D, (double) blockposition.getY() + 0.5D, (double) blockposition.getZ() + 0.5D) < 64.0D && worldserver.mayInteract(this.player, blockposition)) { -+ if (this.awaitingPositionFromClient == null && this.player.distanceToSqr((double) blockposition.getX() + 0.5D, (double) blockposition.getY() + 0.5D, (double) blockposition.getZ() + 0.5D) < 64.0D && (worldserver.mayInteract(this.player, blockposition) || (worldserver.paperConfig().spawn.allowUsingSignsInsideSpawnProtection && worldserver.getBlockState(blockposition).getBlock() instanceof net.minecraft.world.level.block.SignBlock))) { // Paper - Allow using signs inside spawn protection - this.player.stopUsingItem(); // CraftBukkit - SPIGOT-4706 +- if (this.awaitingPositionFromClient == null && worldserver.mayInteract(this.player, blockposition)) { +- this.player.stopUsingItem(); // CraftBukkit - SPIGOT-4706 ++ if (this.awaitingPositionFromClient == null && (worldserver.mayInteract(this.player, blockposition) || (worldserver.paperConfig().spawn.allowUsingSignsInsideSpawnProtection && worldserver.getBlockState(blockposition).getBlock() instanceof net.minecraft.world.level.block.SignBlock))) { // Paper - Allow using signs inside spawn protection InteractionResult enuminteractionresult = this.player.gameMode.useItemOn(this.player, worldserver, itemstack, enumhand, movingobjectpositionblock); + if (enuminteractionresult.consumesAction()) { diff --git a/patches/unapplied/server/Avoid-error-bubbling-up-when-item-stack-is-empty-in-.patch b/patches/server/Avoid-error-bubbling-up-when-item-stack-is-empty-in-.patch similarity index 100% rename from patches/unapplied/server/Avoid-error-bubbling-up-when-item-stack-is-empty-in-.patch rename to patches/server/Avoid-error-bubbling-up-when-item-stack-is-empty-in-.patch diff --git a/patches/unapplied/server/Beacon-API-custom-effect-ranges.patch b/patches/server/Beacon-API-custom-effect-ranges.patch similarity index 95% rename from patches/unapplied/server/Beacon-API-custom-effect-ranges.patch rename to patches/server/Beacon-API-custom-effect-ranges.patch index 4dc26c800..32c638c43 100644 --- a/patches/unapplied/server/Beacon-API-custom-effect-ranges.patch +++ b/patches/server/Beacon-API-custom-effect-ranges.patch @@ -34,7 +34,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 + // Paper end - Custom beacon ranges @Nullable - static MobEffect filterEffect(@Nullable MobEffect effect) { + static Holder filterEffect(@Nullable Holder effect) { @@ -0,0 +0,0 @@ public class BeaconBlockEntity extends BlockEntity implements MenuProvider, Name } @@ -62,8 +62,8 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 @@ -0,0 +0,0 @@ public class BeaconBlockEntity extends BlockEntity implements MenuProvider, Name } - private static void applyEffects(Level world, BlockPos pos, int beaconLevel, @Nullable MobEffect primaryEffect, @Nullable MobEffect secondaryEffect) { -+ // Paper start - Custom beacon ranges + private static void applyEffects(Level world, BlockPos pos, int beaconLevel, @Nullable Holder primaryEffect, @Nullable Holder secondaryEffect) { ++ // Paper start - Custom beacon ranges + BeaconBlockEntity.applyEffects(world, pos, beaconLevel, primaryEffect, secondaryEffect, null); + } + private static void applyEffects(Level world, BlockPos pos, int beaconLevel, @Nullable MobEffect primaryEffect, @Nullable MobEffect secondaryEffect, @Nullable BeaconBlockEntity blockEntity) { @@ -108,8 +108,8 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 for (Player human : nms) { @@ -0,0 +0,0 @@ public class CraftBeacon extends CraftBlockEntityState implem - public CraftBeacon copy() { - return new CraftBeacon(this); + public CraftBeacon copy(Location location) { + return new CraftBeacon(this, location); } + + // Paper start diff --git a/patches/unapplied/server/Cache-DataFixerUpper-Rewrite-Rules-on-demand.patch b/patches/server/Cache-DataFixerUpper-Rewrite-Rules-on-demand.patch similarity index 100% rename from patches/unapplied/server/Cache-DataFixerUpper-Rewrite-Rules-on-demand.patch rename to patches/server/Cache-DataFixerUpper-Rewrite-Rules-on-demand.patch diff --git a/patches/unapplied/server/Climbing-should-not-bypass-cramming-gamerule.patch b/patches/server/Climbing-should-not-bypass-cramming-gamerule.patch similarity index 98% rename from patches/unapplied/server/Climbing-should-not-bypass-cramming-gamerule.patch rename to patches/server/Climbing-should-not-bypass-cramming-gamerule.patch index 1f9a7b294..bc31e5b98 100644 --- a/patches/unapplied/server/Climbing-should-not-bypass-cramming-gamerule.patch +++ b/patches/server/Climbing-should-not-bypass-cramming-gamerule.patch @@ -8,7 +8,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 } public boolean isPushable() { diff --git a/patches/unapplied/server/Collision-option-for-requiring-a-player-participant.patch b/patches/server/Collision-option-for-requiring-a-player-participant.patch similarity index 96% rename from patches/unapplied/server/Collision-option-for-requiring-a-player-participant.patch rename to patches/server/Collision-option-for-requiring-a-player-participant.patch index 8b56d55cc..c7886a7dc 100644 --- a/patches/unapplied/server/Collision-option-for-requiring-a-player-participant.patch +++ b/patches/server/Collision-option-for-requiring-a-player-participant.patch @@ -8,7 +8,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 public void push(Entity entity) { if (!this.isPassengerOfSameVehicle(entity)) { if (!entity.noPhysics && !this.noPhysics) { diff --git a/patches/unapplied/server/Configurable-door-breaking-difficulty.patch b/patches/server/Configurable-door-breaking-difficulty.patch similarity index 100% rename from patches/unapplied/server/Configurable-door-breaking-difficulty.patch rename to patches/server/Configurable-door-breaking-difficulty.patch diff --git a/patches/unapplied/server/Configurable-max-leash-distance.patch b/patches/server/Configurable-max-leash-distance.patch similarity index 100% rename from patches/unapplied/server/Configurable-max-leash-distance.patch rename to patches/server/Configurable-max-leash-distance.patch diff --git a/patches/unapplied/server/Correctly-check-if-bucket-dispenses-will-succeed-for.patch b/patches/server/Correctly-check-if-bucket-dispenses-will-succeed-for.patch similarity index 100% rename from patches/unapplied/server/Correctly-check-if-bucket-dispenses-will-succeed-for.patch rename to patches/server/Correctly-check-if-bucket-dispenses-will-succeed-for.patch diff --git a/patches/unapplied/server/Don-t-ignore-result-of-PlayerEditBookEvent.patch b/patches/server/Don-t-ignore-result-of-PlayerEditBookEvent.patch similarity index 59% rename from patches/unapplied/server/Don-t-ignore-result-of-PlayerEditBookEvent.patch rename to patches/server/Don-t-ignore-result-of-PlayerEditBookEvent.patch index d1011abe6..ea788e5bd 100644 --- a/patches/unapplied/server/Don-t-ignore-result-of-PlayerEditBookEvent.patch +++ b/patches/server/Don-t-ignore-result-of-PlayerEditBookEvent.patch @@ -9,11 +9,11 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 --- a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java +++ b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java @@ -0,0 +0,0 @@ public class ServerGamePacketListenerImpl extends ServerCommonPacketListenerImpl - } + List> list1 = pages.stream().map(this::filterableFromOutgoing).toList(); - itemstack.addTagElement("pages", nbttaglist); -- CraftEventFactory.handleEditBookEvent(this.player, slot, handItem, itemstack); // CraftBukkit -+ this.player.getInventory().setItem(slot, CraftEventFactory.handleEditBookEvent(this.player, slot, handItem, itemstack)); // CraftBukkit // Paper - Don't ignore result (see other callsite for handleEditBookEvent) + itemstack.set(DataComponents.WRITABLE_BOOK_CONTENT, new WritableBookContent(list1)); +- CraftEventFactory.handleEditBookEvent(this.player, slotId, handItem, itemstack); // CraftBukkit ++ this.player.getInventory().setItem(slotId, CraftEventFactory.handleEditBookEvent(this.player, slotId, handItem, itemstack)); // CraftBukkit // Paper - Don't ignore result (see other callsite for handleEditBookEvent) + } } - @Override diff --git a/patches/unapplied/server/Drop-carried-item-when-player-has-disconnected.patch b/patches/server/Drop-carried-item-when-player-has-disconnected.patch similarity index 100% rename from patches/unapplied/server/Drop-carried-item-when-player-has-disconnected.patch rename to patches/server/Drop-carried-item-when-player-has-disconnected.patch diff --git a/patches/unapplied/server/Empty-commands-shall-not-be-dispatched.patch b/patches/server/Empty-commands-shall-not-be-dispatched.patch similarity index 100% rename from patches/unapplied/server/Empty-commands-shall-not-be-dispatched.patch rename to patches/server/Empty-commands-shall-not-be-dispatched.patch diff --git a/patches/unapplied/server/Enhance-console-tab-completions-for-brigadier-comman.patch b/patches/server/Enhance-console-tab-completions-for-brigadier-comman.patch similarity index 100% rename from patches/unapplied/server/Enhance-console-tab-completions-for-brigadier-comman.patch rename to patches/server/Enhance-console-tab-completions-for-brigadier-comman.patch diff --git a/patches/unapplied/server/Entity-isTicking.patch b/patches/server/Entity-isTicking.patch similarity index 94% rename from patches/unapplied/server/Entity-isTicking.patch rename to patches/server/Entity-isTicking.patch index 6cd64384d..906b1f253 100644 --- a/patches/unapplied/server/Entity-isTicking.patch +++ b/patches/server/Entity-isTicking.patch @@ -8,7 +8,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 public static int nextEntityId() { return ENTITY_COUNTER.incrementAndGet(); } diff --git a/patches/unapplied/server/Expand-EntityUnleashEvent.patch b/patches/server/Expand-EntityUnleashEvent.patch similarity index 97% rename from patches/unapplied/server/Expand-EntityUnleashEvent.patch rename to patches/server/Expand-EntityUnleashEvent.patch index b3438dfb0..b002e5849 100644 --- a/patches/unapplied/server/Expand-EntityUnleashEvent.patch +++ b/patches/server/Expand-EntityUnleashEvent.patch @@ -8,25 +8,25 @@ diff --git a/src/main/java/net/minecraft/world/entity/Mob.java b/src/main/java/n index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 --- a/src/main/java/net/minecraft/world/entity/Mob.java +++ b/src/main/java/net/minecraft/world/entity/Mob.java -@@ -0,0 +0,0 @@ public abstract class Mob extends LivingEntity implements Targeting { +@@ -0,0 +0,0 @@ public abstract class Mob extends LivingEntity implements EquipmentUser, Targeti return InteractionResult.PASS; } else if (this.getLeashHolder() == player) { // CraftBukkit start - fire PlayerUnleashEntityEvent - if (CraftEventFactory.callPlayerUnleashEntityEvent(this, player, hand).isCancelled()) { + // Paper start - Expand EntityUnleashEvent -+ org.bukkit.event.player.PlayerUnleashEntityEvent event = CraftEventFactory.callPlayerUnleashEntityEvent(this, player, hand, !player.getAbilities().instabuild); ++ org.bukkit.event.player.PlayerUnleashEntityEvent event = CraftEventFactory.callPlayerUnleashEntityEvent(this, player, hand, !player.hasInfiniteMaterials()); + if (event.isCancelled()) { + // Paper end - Expand EntityUnleashEvent ((ServerPlayer) player).connection.send(new ClientboundSetEntityLinkPacket(this, this.getLeashHolder())); return InteractionResult.PASS; } // CraftBukkit end -- this.dropLeash(true, !player.getAbilities().instabuild); +- this.dropLeash(true, !player.hasInfiniteMaterials()); + this.dropLeash(true, event.isDropLeash()); // Paper - Expand EntityUnleashEvent this.gameEvent(GameEvent.ENTITY_INTERACT, player); return InteractionResult.sidedSuccess(this.level().isClientSide); } else { -@@ -0,0 +0,0 @@ public abstract class Mob extends LivingEntity implements Targeting { +@@ -0,0 +0,0 @@ public abstract class Mob extends LivingEntity implements EquipmentUser, Targeti if (this.leashHolder != null) { if (!this.isAlive() || !this.leashHolder.isAlive()) { @@ -40,7 +40,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 } } -@@ -0,0 +0,0 @@ public abstract class Mob extends LivingEntity implements Targeting { +@@ -0,0 +0,0 @@ public abstract class Mob extends LivingEntity implements EquipmentUser, Targeti boolean flag1 = super.startRiding(entity, force); if (flag1 && this.isLeashed()) { @@ -54,7 +54,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 } return flag1; -@@ -0,0 +0,0 @@ public abstract class Mob extends LivingEntity implements Targeting { +@@ -0,0 +0,0 @@ public abstract class Mob extends LivingEntity implements EquipmentUser, Targeti @Override protected void removeAfterChangingDimensions() { super.removeAfterChangingDimensions(); diff --git a/patches/unapplied/server/Expand-PlayerGameModeChangeEvent.patch b/patches/server/Expand-PlayerGameModeChangeEvent.patch similarity index 97% rename from patches/unapplied/server/Expand-PlayerGameModeChangeEvent.patch rename to patches/server/Expand-PlayerGameModeChangeEvent.patch index 142d7fa98..d7c6239e6 100644 --- a/patches/unapplied/server/Expand-PlayerGameModeChangeEvent.patch +++ b/patches/server/Expand-PlayerGameModeChangeEvent.patch @@ -122,9 +122,10 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 } // CraftBukkit end this.setGameModeForPlayer(gameMode, this.previousGameModeForPlayer); - this.player.onUpdateAbilities(); - this.player.server.getPlayerList().broadcastAll(new ClientboundPlayerInfoUpdatePacket(ClientboundPlayerInfoUpdatePacket.Action.UPDATE_GAME_MODE, this.player), this.player); // CraftBukkit - this.level.updateSleepingPlayerList(); +@@ -0,0 +0,0 @@ public class ServerPlayerGameMode { + this.player.resetCurrentImpulseContext(); + } + - return true; + return event; // Paper - Expand PlayerGameModeChangeEvent } diff --git a/patches/unapplied/server/Expand-PlayerRespawnEvent-fix-passed-parameter-issue.patch b/patches/server/Expand-PlayerRespawnEvent-fix-passed-parameter-issue.patch similarity index 100% rename from patches/unapplied/server/Expand-PlayerRespawnEvent-fix-passed-parameter-issue.patch rename to patches/server/Expand-PlayerRespawnEvent-fix-passed-parameter-issue.patch diff --git a/patches/unapplied/server/Expand-world-key-API.patch b/patches/server/Expand-world-key-API.patch similarity index 95% rename from patches/unapplied/server/Expand-world-key-API.patch rename to patches/server/Expand-world-key-API.patch index b91f67933..7dd3948c6 100644 --- a/patches/unapplied/server/Expand-world-key-API.patch +++ b/patches/server/Expand-world-key-API.patch @@ -49,7 +49,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 + worldKey = ResourceKey.create(Registries.DIMENSION, new net.minecraft.resources.ResourceLocation(creator.key().getNamespace().toLowerCase(java.util.Locale.ENGLISH), creator.key().getKey().toLowerCase(java.util.Locale.ENGLISH))); // Paper } - ServerLevel internal = (ServerLevel) new ServerLevel(this.console, this.console.executor, worldSession, worlddata, worldKey, worlddimension, this.getServer().progressListenerFactory.create(11), + // If set to not keep spawn in memory (changed from default) then adjust rule accordingly @@ -0,0 +0,0 @@ public final class CraftServer implements Server { return null; } diff --git a/patches/unapplied/server/Expose-LivingEntity-hurt-direction.patch b/patches/server/Expose-LivingEntity-hurt-direction.patch similarity index 96% rename from patches/unapplied/server/Expose-LivingEntity-hurt-direction.patch rename to patches/server/Expose-LivingEntity-hurt-direction.patch index 616788313..7eac648f0 100644 --- a/patches/unapplied/server/Expose-LivingEntity-hurt-direction.patch +++ b/patches/server/Expose-LivingEntity-hurt-direction.patch @@ -14,9 +14,9 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 public FishingHook fishing; - protected float hurtDir; + public float hurtDir; // Paper - protected -> public - public boolean affectsSpawning = true; // Paper - Affects Spawning API - - // CraftBukkit start + @Nullable + public Vec3 currentImpulseImpactPos; + @Nullable diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftHumanEntity.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftHumanEntity.java index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 --- a/src/main/java/org/bukkit/craftbukkit/entity/CraftHumanEntity.java diff --git a/patches/unapplied/server/Expose-Tracked-Players.patch b/patches/server/Expose-Tracked-Players.patch similarity index 100% rename from patches/unapplied/server/Expose-Tracked-Players.patch rename to patches/server/Expose-Tracked-Players.patch diff --git a/patches/unapplied/server/Expose-protocol-version.patch b/patches/server/Expose-protocol-version.patch similarity index 100% rename from patches/unapplied/server/Expose-protocol-version.patch rename to patches/server/Expose-protocol-version.patch diff --git a/patches/unapplied/server/Expose-the-Entity-Counter-to-allow-plugins-to-use-va.patch b/patches/server/Expose-the-Entity-Counter-to-allow-plugins-to-use-va.patch similarity index 94% rename from patches/unapplied/server/Expose-the-Entity-Counter-to-allow-plugins-to-use-va.patch rename to patches/server/Expose-the-Entity-Counter-to-allow-plugins-to-use-va.patch index 43f12fddb..d30b1984a 100644 --- a/patches/unapplied/server/Expose-the-Entity-Counter-to-allow-plugins-to-use-va.patch +++ b/patches/server/Expose-the-Entity-Counter-to-allow-plugins-to-use-va.patch @@ -9,7 +9,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 void accept(Entity entity, double x, double y, double z); } diff --git a/patches/unapplied/server/Expose-world-spawn-angle.patch b/patches/server/Expose-world-spawn-angle.patch similarity index 100% rename from patches/unapplied/server/Expose-world-spawn-angle.patch rename to patches/server/Expose-world-spawn-angle.patch diff --git a/patches/unapplied/server/Extend-block-drop-capture-to-capture-all-items-added.patch b/patches/server/Extend-block-drop-capture-to-capture-all-items-added.patch similarity index 100% rename from patches/unapplied/server/Extend-block-drop-capture-to-capture-all-items-added.patch rename to patches/server/Extend-block-drop-capture-to-capture-all-items-added.patch diff --git a/patches/unapplied/server/Fix-Concurrency-issue-in-ShufflingList.patch b/patches/server/Fix-Concurrency-issue-in-ShufflingList.patch similarity index 100% rename from patches/unapplied/server/Fix-Concurrency-issue-in-ShufflingList.patch rename to patches/server/Fix-Concurrency-issue-in-ShufflingList.patch diff --git a/patches/unapplied/server/Fix-CraftSound-backwards-compatibility.patch b/patches/server/Fix-CraftSound-backwards-compatibility.patch similarity index 100% rename from patches/unapplied/server/Fix-CraftSound-backwards-compatibility.patch rename to patches/server/Fix-CraftSound-backwards-compatibility.patch diff --git a/patches/server/Fix-Entity-Teleportation-and-cancel-velocity-if-tele.patch b/patches/server/Fix-Entity-Teleportation-and-cancel-velocity-if-tele.patch index cb26cd7e9..34235e5e1 100644 --- a/patches/server/Fix-Entity-Teleportation-and-cancel-velocity-if-tele.patch +++ b/patches/server/Fix-Entity-Teleportation-and-cancel-velocity-if-tele.patch @@ -22,9 +22,9 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 this.lastGoodY = this.awaitingPositionFromClient.y; this.lastGoodZ = this.awaitingPositionFromClient.z; @@ -0,0 +0,0 @@ public class ServerGamePacketListenerImpl extends ServerCommonPacketListenerImpl - // CraftBukkit end this.awaitingTeleportTime = this.tickCount; + this.player.resetCurrentImpulseContext(); - this.player.absMoveTo(d0, d1, d2, f, f1); + this.player.moveTo(d0, d1, d2, f, f1); // Paper - Fix Entity Teleportation and cancel velocity if teleported this.player.connection.send(new ClientboundPlayerPositionPacket(d0 - d3, d1 - d4, d2 - d5, f - f2, f1 - f3, set, this.awaitingTeleport)); @@ -34,7 +34,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 // CraftBukkit start private static final int CURRENT_LEVEL = 2; @@ -42,7 +42,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 static boolean isLevelAtLeast(CompoundTag tag, int level) { return tag.contains("Bukkit.updateLevel") && tag.getInt("Bukkit.updateLevel") >= level; } -@@ -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 } public void moveTo(double x, double y, double z, float yaw, float pitch) { diff --git a/patches/unapplied/server/Fix-Not-a-string-Map-Conversion-spam.patch b/patches/server/Fix-Not-a-string-Map-Conversion-spam.patch similarity index 92% rename from patches/unapplied/server/Fix-Not-a-string-Map-Conversion-spam.patch rename to patches/server/Fix-Not-a-string-Map-Conversion-spam.patch index 04e422aaf..44d3d8784 100644 --- a/patches/unapplied/server/Fix-Not-a-string-Map-Conversion-spam.patch +++ b/patches/server/Fix-Not-a-string-Map-Conversion-spam.patch @@ -15,19 +15,19 @@ diff --git a/src/main/java/net/minecraft/world/level/saveddata/maps/MapItemSaved index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 --- a/src/main/java/net/minecraft/world/level/saveddata/maps/MapItemSavedData.java +++ b/src/main/java/net/minecraft/world/level/saveddata/maps/MapItemSavedData.java -@@ -0,0 +0,0 @@ import net.minecraft.core.BlockPos; +@@ -0,0 +0,0 @@ import net.minecraft.core.component.DataComponents; import net.minecraft.nbt.CompoundTag; import net.minecraft.nbt.ListTag; import net.minecraft.nbt.NbtOps; +import net.minecraft.nbt.NumericTag; +import net.minecraft.nbt.StringTag; import net.minecraft.nbt.Tag; + import net.minecraft.network.FriendlyByteBuf; import net.minecraft.network.chat.Component; - import net.minecraft.network.protocol.Packet; @@ -0,0 +0,0 @@ public class MapItemSavedData extends SavedData { } - public static MapItemSavedData load(CompoundTag nbt) { + public static MapItemSavedData load(CompoundTag nbt, HolderLookup.Provider registryLookup) { - DataResult> dataresult = DimensionType.parseLegacy(new Dynamic(NbtOps.INSTANCE, nbt.get("dimension"))); // CraftBukkit - decompile error + // Paper start - fix "Not a string" spam + Tag dimension = nbt.get("dimension"); diff --git a/patches/unapplied/server/Fix-Player-spawnParticle-x-y-z-precision-loss.patch b/patches/server/Fix-Player-spawnParticle-x-y-z-precision-loss.patch similarity index 100% rename from patches/unapplied/server/Fix-Player-spawnParticle-x-y-z-precision-loss.patch rename to patches/server/Fix-Player-spawnParticle-x-y-z-precision-loss.patch diff --git a/patches/unapplied/server/Fix-PlayerItemConsumeEvent-cancelling-properly.patch b/patches/server/Fix-PlayerItemConsumeEvent-cancelling-properly.patch similarity index 100% rename from patches/unapplied/server/Fix-PlayerItemConsumeEvent-cancelling-properly.patch rename to patches/server/Fix-PlayerItemConsumeEvent-cancelling-properly.patch diff --git a/patches/unapplied/server/Fix-bell-block-entity-memory-leak.patch b/patches/server/Fix-bell-block-entity-memory-leak.patch similarity index 100% rename from patches/unapplied/server/Fix-bell-block-entity-memory-leak.patch rename to patches/server/Fix-bell-block-entity-memory-leak.patch diff --git a/patches/unapplied/server/Fix-client-lag-on-advancement-loading.patch b/patches/server/Fix-client-lag-on-advancement-loading.patch similarity index 100% rename from patches/unapplied/server/Fix-client-lag-on-advancement-loading.patch rename to patches/server/Fix-client-lag-on-advancement-loading.patch diff --git a/patches/unapplied/server/Fix-crash-from-invalid-ingredient-lists-in-VillagerA.patch b/patches/server/Fix-crash-from-invalid-ingredient-lists-in-VillagerA.patch similarity index 100% rename from patches/unapplied/server/Fix-crash-from-invalid-ingredient-lists-in-VillagerA.patch rename to patches/server/Fix-crash-from-invalid-ingredient-lists-in-VillagerA.patch diff --git a/patches/unapplied/server/Fix-deop-kicking-non-whitelisted-player-when-white-l.patch b/patches/server/Fix-deop-kicking-non-whitelisted-player-when-white-l.patch similarity index 100% rename from patches/unapplied/server/Fix-deop-kicking-non-whitelisted-player-when-white-l.patch rename to patches/server/Fix-deop-kicking-non-whitelisted-player-when-white-l.patch diff --git a/patches/unapplied/server/Fix-for-large-move-vectors-crashing-server.patch b/patches/server/Fix-for-large-move-vectors-crashing-server.patch similarity index 98% rename from patches/unapplied/server/Fix-for-large-move-vectors-crashing-server.patch rename to patches/server/Fix-for-large-move-vectors-crashing-server.patch index a1296e1ff..8320c9b43 100644 --- a/patches/unapplied/server/Fix-for-large-move-vectors-crashing-server.patch +++ b/patches/server/Fix-for-large-move-vectors-crashing-server.patch @@ -81,6 +81,6 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 + d6 = d0 - this.lastGoodX; // Paper - diff on change, used for checking large move vectors above + d7 = d1 - this.lastGoodY; // Paper - diff on change, used for checking large move vectors above + d8 = d2 - this.lastGoodZ; // Paper - diff on change, used for checking large move vectors above - boolean flag = d7 > 0.0D; + boolean flag1 = d7 > 0.0D; - if (this.player.onGround() && !packet.isOnGround() && flag) { + if (this.player.onGround() && !packet.isOnGround() && flag1) { diff --git a/patches/unapplied/server/Fix-harming-potion-dupe.patch b/patches/server/Fix-harming-potion-dupe.patch similarity index 67% rename from patches/unapplied/server/Fix-harming-potion-dupe.patch rename to patches/server/Fix-harming-potion-dupe.patch index 7ca123aef..2c80a8de7 100644 --- a/patches/unapplied/server/Fix-harming-potion-dupe.patch +++ b/patches/server/Fix-harming-potion-dupe.patch @@ -15,29 +15,27 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 CriteriaTriggers.CONSUME_ITEM.trigger((ServerPlayer) entityhuman, stack); } -+ List instantLater = new java.util.ArrayList<>(); // Paper - Fix harming potion dupe ++ List instantLater = new java.util.ArrayList<>(); // Paper - Fix harming potion dupe if (!world.isClientSide) { - List list = PotionUtils.getMobEffects(stack); - Iterator iterator = list.iterator(); -@@ -0,0 +0,0 @@ public class PotionItem extends Item { - MobEffectInstance mobeffect = (MobEffectInstance) iterator.next(); + PotionContents potioncontents = (PotionContents) stack.getOrDefault(DataComponents.POTION_CONTENTS, PotionContents.EMPTY); - if (mobeffect.getEffect().isInstantenous()) { -- mobeffect.getEffect().applyInstantenousEffect(entityhuman, entityhuman, user, mobeffect.getAmplifier(), 1.0D); -+ instantLater.add(mobeffect); // Paper - Fix harming potion dupe + potioncontents.forEachEffect((mobeffect) -> { + if (((MobEffect) mobeffect.getEffect().value()).isInstantenous()) { +- ((MobEffect) mobeffect.getEffect().value()).applyInstantenousEffect(entityhuman, entityhuman, user, mobeffect.getAmplifier(), 1.0D); ++ instantLater.add(mobeffect); // Paper } else { - user.addEffect(new MobEffectInstance(mobeffect), org.bukkit.event.entity.EntityPotionEffectEvent.Cause.POTION_DRINK); // CraftBukkit + user.addEffect(mobeffect, org.bukkit.event.entity.EntityPotionEffectEvent.Cause.POTION_DRINK); // CraftBukkit } @@ -0,0 +0,0 @@ public class PotionItem extends Item { - } + stack.consume(1, entityhuman); } + // Paper start - Fix harming potion dupe -+ for (MobEffectInstance mobeffect : instantLater) { -+ mobeffect.getEffect().applyInstantenousEffect(entityhuman, entityhuman, user, mobeffect.getAmplifier(), 1.0D); ++ for (net.minecraft.world.effect.MobEffectInstance mobeffect : instantLater) { ++ mobeffect.getEffect().value().applyInstantenousEffect(entityhuman, entityhuman, user, mobeffect.getAmplifier(), 1.0D); + } + // Paper end - Fix harming potion dupe - if (entityhuman == null || !entityhuman.getAbilities().instabuild) { + if (entityhuman == null || !entityhuman.hasInfiniteMaterials()) { + // Paper start - Fix harming potion dupe + if (user.getHealth() <= 0 && !user.level().getGameRules().getBoolean(net.minecraft.world.level.GameRules.RULE_KEEPINVENTORY)) { + user.spawnAtLocation(new ItemStack(Items.GLASS_BOTTLE), 0); diff --git a/patches/unapplied/server/Fix-interact-event-not-being-called-sometimes.patch b/patches/server/Fix-interact-event-not-being-called-sometimes.patch similarity index 100% rename from patches/unapplied/server/Fix-interact-event-not-being-called-sometimes.patch rename to patches/server/Fix-interact-event-not-being-called-sometimes.patch diff --git a/patches/unapplied/server/Fix-item-locations-dropped-from-campfires.patch b/patches/server/Fix-item-locations-dropped-from-campfires.patch similarity index 95% rename from patches/unapplied/server/Fix-item-locations-dropped-from-campfires.patch rename to patches/server/Fix-item-locations-dropped-from-campfires.patch index 505853353..f69fafe95 100644 --- a/patches/unapplied/server/Fix-item-locations-dropped-from-campfires.patch +++ b/patches/server/Fix-item-locations-dropped-from-campfires.patch @@ -25,4 +25,4 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 + // Paper end - Fix item locations dropped from campfires campfire.items.set(i, ItemStack.EMPTY); world.sendBlockUpdated(pos, state, state, 3); - world.gameEvent(GameEvent.BLOCK_CHANGE, pos, GameEvent.Context.of(state)); + world.gameEvent((Holder) GameEvent.BLOCK_CHANGE, pos, GameEvent.Context.of(state)); diff --git a/patches/unapplied/server/Fix-nerfed-slime-when-splitting.patch b/patches/server/Fix-nerfed-slime-when-splitting.patch similarity index 100% rename from patches/unapplied/server/Fix-nerfed-slime-when-splitting.patch rename to patches/server/Fix-nerfed-slime-when-splitting.patch diff --git a/patches/unapplied/server/Fix-villager-boat-exploit.patch b/patches/server/Fix-villager-boat-exploit.patch similarity index 100% rename from patches/unapplied/server/Fix-villager-boat-exploit.patch rename to patches/server/Fix-villager-boat-exploit.patch diff --git a/patches/unapplied/server/Implement-methods-to-convert-between-Component-and-B.patch b/patches/server/Implement-methods-to-convert-between-Component-and-B.patch similarity index 100% rename from patches/unapplied/server/Implement-methods-to-convert-between-Component-and-B.patch rename to patches/server/Implement-methods-to-convert-between-Component-and-B.patch diff --git a/patches/unapplied/server/Improve-ServerGUI.patch b/patches/server/Improve-ServerGUI.patch similarity index 100% rename from patches/unapplied/server/Improve-ServerGUI.patch rename to patches/server/Improve-ServerGUI.patch diff --git a/patches/unapplied/server/Inline-shift-direction-fields.patch b/patches/server/Inline-shift-direction-fields.patch similarity index 90% rename from patches/unapplied/server/Inline-shift-direction-fields.patch rename to patches/server/Inline-shift-direction-fields.patch index 95b4d6b3b..e4f4e3a7d 100644 --- a/patches/unapplied/server/Inline-shift-direction-fields.patch +++ b/patches/server/Inline-shift-direction-fields.patch @@ -20,9 +20,9 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 + private final int adjZ; + // Paper end - Perf: Inline shift direction fields + - private Direction(int id, int idOpposite, int idHorizontal, String name, Direction.AxisDirection direction, Direction.Axis axis, Vec3i vector) { - this.data3d = id; - this.data2d = idHorizontal; + private Direction( + final int id, + final int idOpposite, @@ -0,0 +0,0 @@ public enum Direction implements StringRepresentable { this.axis = axis; this.axisDirection = direction; diff --git a/patches/unapplied/server/Introduce-beacon-activation-deactivation-events.patch b/patches/server/Introduce-beacon-activation-deactivation-events.patch similarity index 100% rename from patches/unapplied/server/Introduce-beacon-activation-deactivation-events.patch rename to patches/server/Introduce-beacon-activation-deactivation-events.patch diff --git a/patches/unapplied/server/Inventory-close.patch b/patches/server/Inventory-close.patch similarity index 100% rename from patches/unapplied/server/Inventory-close.patch rename to patches/server/Inventory-close.patch diff --git a/patches/unapplied/server/Item-Rarity-API.patch b/patches/server/Item-Rarity-API.patch similarity index 100% rename from patches/unapplied/server/Item-Rarity-API.patch rename to patches/server/Item-Rarity-API.patch diff --git a/patches/unapplied/server/Item-no-age-no-player-pickup.patch b/patches/server/Item-no-age-no-player-pickup.patch similarity index 100% rename from patches/unapplied/server/Item-no-age-no-player-pickup.patch rename to patches/server/Item-no-age-no-player-pickup.patch diff --git a/patches/unapplied/server/ItemStack-repair-check-API.patch b/patches/server/ItemStack-repair-check-API.patch similarity index 100% rename from patches/unapplied/server/ItemStack-repair-check-API.patch rename to patches/server/ItemStack-repair-check-API.patch diff --git a/patches/unapplied/server/Lazily-track-plugin-scoreboards-by-default.patch b/patches/server/Lazily-track-plugin-scoreboards-by-default.patch similarity index 100% rename from patches/unapplied/server/Lazily-track-plugin-scoreboards-by-default.patch rename to patches/server/Lazily-track-plugin-scoreboards-by-default.patch diff --git a/patches/unapplied/server/Limit-recipe-packets.patch b/patches/server/Limit-recipe-packets.patch similarity index 100% rename from patches/unapplied/server/Limit-recipe-packets.patch rename to patches/server/Limit-recipe-packets.patch diff --git a/patches/unapplied/server/MC-4-Fix-item-position-desync.patch b/patches/server/MC-4-Fix-item-position-desync.patch similarity index 96% rename from patches/unapplied/server/MC-4-Fix-item-position-desync.patch rename to patches/server/MC-4-Fix-item-position-desync.patch index 0f06d8f8a..d5de632dc 100644 --- a/patches/unapplied/server/MC-4-Fix-item-position-desync.patch +++ b/patches/server/MC-4-Fix-item-position-desync.patch @@ -31,7 +31,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; } // Paper end - Block invalid positions and bounding box diff --git a/patches/unapplied/server/Make-schedule-command-per-world.patch b/patches/server/Make-schedule-command-per-world.patch similarity index 100% rename from patches/unapplied/server/Make-schedule-command-per-world.patch rename to patches/server/Make-schedule-command-per-world.patch diff --git a/patches/unapplied/server/Merchant-getRecipes-should-return-an-immutable-list.patch b/patches/server/Merchant-getRecipes-should-return-an-immutable-list.patch similarity index 100% rename from patches/unapplied/server/Merchant-getRecipes-should-return-an-immutable-list.patch rename to patches/server/Merchant-getRecipes-should-return-an-immutable-list.patch diff --git a/patches/unapplied/server/More-Enchantment-API.patch b/patches/server/More-Enchantment-API.patch similarity index 100% rename from patches/unapplied/server/More-Enchantment-API.patch rename to patches/server/More-Enchantment-API.patch diff --git a/patches/unapplied/server/More-World-API.patch b/patches/server/More-World-API.patch similarity index 100% rename from patches/unapplied/server/More-World-API.patch rename to patches/server/More-World-API.patch diff --git a/patches/unapplied/server/More-lightning-API.patch b/patches/server/More-lightning-API.patch similarity index 100% rename from patches/unapplied/server/More-lightning-API.patch rename to patches/server/More-lightning-API.patch diff --git a/patches/unapplied/server/Move-range-check-for-block-placing-up.patch b/patches/server/Move-range-check-for-block-placing-up.patch similarity index 94% rename from patches/unapplied/server/Move-range-check-for-block-placing-up.patch rename to patches/server/Move-range-check-for-block-placing-up.patch index 438aeb4c5..b56c109a9 100644 --- a/patches/unapplied/server/Move-range-check-for-block-placing-up.patch +++ b/patches/server/Move-range-check-for-block-placing-up.patch @@ -18,5 +18,5 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 + } + // Paper end - improve distance check BlockPos blockposition = movingobjectpositionblock.getBlockPos(); - Vec3 vec3d1 = Vec3.atCenterOf(blockposition); + if (this.player.canInteractWithBlock(blockposition, 1.0D)) { diff --git a/patches/unapplied/server/Optimise-getType-calls.patch b/patches/server/Optimise-getType-calls.patch similarity index 97% rename from patches/unapplied/server/Optimise-getType-calls.patch rename to patches/server/Optimise-getType-calls.patch index feb050bdd..e7cebbc3f 100644 --- a/patches/unapplied/server/Optimise-getType-calls.patch +++ b/patches/server/Optimise-getType-calls.patch @@ -23,7 +23,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 + return this.cachedMaterial; + } + // Paper end - optimise getType calls - public BlockState(Block block, ImmutableMap, Comparable> propertyMap, MapCodec codec) { + public BlockState(Block block, Reference2ObjectArrayMap, Comparable> propertyMap, MapCodec codec) { super(block, propertyMap, codec); } diff --git a/src/main/java/org/bukkit/craftbukkit/CraftChunkSnapshot.java b/src/main/java/org/bukkit/craftbukkit/CraftChunkSnapshot.java diff --git a/patches/unapplied/server/Optimize-Dynamic-get-Missing-Keys.patch b/patches/server/Optimize-Dynamic-get-Missing-Keys.patch similarity index 100% rename from patches/unapplied/server/Optimize-Dynamic-get-Missing-Keys.patch rename to patches/server/Optimize-Dynamic-get-Missing-Keys.patch diff --git a/patches/unapplied/server/Player-Chunk-Load-Unload-Events.patch b/patches/server/Player-Chunk-Load-Unload-Events.patch similarity index 100% rename from patches/unapplied/server/Player-Chunk-Load-Unload-Events.patch rename to patches/server/Player-Chunk-Load-Unload-Events.patch diff --git a/patches/unapplied/server/Remove-ProjectileHitEvent-call-when-fireballs-dead.patch b/patches/server/Remove-ProjectileHitEvent-call-when-fireballs-dead.patch similarity index 100% rename from patches/unapplied/server/Remove-ProjectileHitEvent-call-when-fireballs-dead.patch rename to patches/server/Remove-ProjectileHitEvent-call-when-fireballs-dead.patch diff --git a/patches/unapplied/server/Remove-stale-POIs.patch b/patches/server/Remove-stale-POIs.patch similarity index 100% rename from patches/unapplied/server/Remove-stale-POIs.patch rename to patches/server/Remove-stale-POIs.patch diff --git a/patches/unapplied/server/Reset-Ender-Crystals-on-Dragon-Spawn.patch b/patches/server/Reset-Ender-Crystals-on-Dragon-Spawn.patch similarity index 100% rename from patches/unapplied/server/Reset-Ender-Crystals-on-Dragon-Spawn.patch rename to patches/server/Reset-Ender-Crystals-on-Dragon-Spawn.patch diff --git a/patches/unapplied/server/Reset-shield-blocking-on-dimension-change.patch b/patches/server/Reset-shield-blocking-on-dimension-change.patch similarity index 100% rename from patches/unapplied/server/Reset-shield-blocking-on-dimension-change.patch rename to patches/server/Reset-shield-blocking-on-dimension-change.patch diff --git a/patches/unapplied/server/Retain-block-place-order-when-capturing-blockstates.patch b/patches/server/Retain-block-place-order-when-capturing-blockstates.patch similarity index 100% rename from patches/unapplied/server/Retain-block-place-order-when-capturing-blockstates.patch rename to patches/server/Retain-block-place-order-when-capturing-blockstates.patch diff --git a/patches/unapplied/server/Return-chat-component-with-empty-text-instead-of-thr.patch b/patches/server/Return-chat-component-with-empty-text-instead-of-thr.patch similarity index 100% rename from patches/unapplied/server/Return-chat-component-with-empty-text-instead-of-thr.patch rename to patches/server/Return-chat-component-with-empty-text-instead-of-thr.patch diff --git a/patches/unapplied/server/Send-empty-commands-if-tab-completion-is-disabled.patch b/patches/server/Send-empty-commands-if-tab-completion-is-disabled.patch similarity index 100% rename from patches/unapplied/server/Send-empty-commands-if-tab-completion-is-disabled.patch rename to patches/server/Send-empty-commands-if-tab-completion-is-disabled.patch diff --git a/patches/unapplied/server/Set-area-affect-cloud-rotation.patch b/patches/server/Set-area-affect-cloud-rotation.patch similarity index 86% rename from patches/unapplied/server/Set-area-affect-cloud-rotation.patch rename to patches/server/Set-area-affect-cloud-rotation.patch index f1cf21b73..fad8ac996 100644 --- a/patches/unapplied/server/Set-area-affect-cloud-rotation.patch +++ b/patches/server/Set-area-affect-cloud-rotation.patch @@ -15,5 +15,5 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 - register(new EntityTypeData<>(EntityType.AREA_EFFECT_CLOUD, AreaEffectCloud.class, CraftAreaEffectCloud::new, spawnData -> new net.minecraft.world.entity.AreaEffectCloud(spawnData.minecraftWorld(), spawnData.x(), spawnData.y(), spawnData.z()))); + register(new EntityTypeData<>(EntityType.AREA_EFFECT_CLOUD, AreaEffectCloud.class, CraftAreaEffectCloud::new, createAndMove(net.minecraft.world.entity.EntityType.AREA_EFFECT_CLOUD))); // Paper - set area effect cloud rotation register(new EntityTypeData<>(EntityType.EGG, Egg.class, CraftEgg::new, spawnData -> new ThrownEgg(spawnData.minecraftWorld(), spawnData.x(), spawnData.y(), spawnData.z()))); - register(new EntityTypeData<>(EntityType.LEASH_HITCH, LeashHitch.class, CraftLeash::new, spawnData -> new LeashFenceKnotEntity(spawnData.minecraftWorld(), BlockPos.containing(spawnData.x(), spawnData.y(), spawnData.z())))); // SPIGOT-5732: LeashHitch has no direction and is always centered at a block + register(new EntityTypeData<>(EntityType.LEASH_KNOT, LeashHitch.class, CraftLeash::new, spawnData -> new LeashFenceKnotEntity(spawnData.minecraftWorld(), BlockPos.containing(spawnData.x(), spawnData.y(), spawnData.z())))); // SPIGOT-5732: LeashHitch has no direction and is always centered at a block register(new EntityTypeData<>(EntityType.SNOWBALL, Snowball.class, CraftSnowball::new, spawnData -> new net.minecraft.world.entity.projectile.Snowball(spawnData.minecraftWorld(), spawnData.x(), spawnData.y(), spawnData.z()))); diff --git a/patches/unapplied/server/Significantly-improve-performance-of-the-end-generat.patch b/patches/server/Significantly-improve-performance-of-the-end-generat.patch similarity index 100% rename from patches/unapplied/server/Significantly-improve-performance-of-the-end-generat.patch rename to patches/server/Significantly-improve-performance-of-the-end-generat.patch diff --git a/patches/unapplied/server/TODO-Registry-Modification-API.patch b/patches/server/TODO-Registry-Modification-API.patch similarity index 78% rename from patches/unapplied/server/TODO-Registry-Modification-API.patch rename to patches/server/TODO-Registry-Modification-API.patch index 749d22e64..42fac961f 100644 --- a/patches/unapplied/server/TODO-Registry-Modification-API.patch +++ b/patches/server/TODO-Registry-Modification-API.patch @@ -9,8 +9,8 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 --- a/src/main/java/org/bukkit/craftbukkit/CraftRegistry.java +++ b/src/main/java/org/bukkit/craftbukkit/CraftRegistry.java @@ -0,0 +0,0 @@ public class CraftRegistry implements Registry { - if (bukkitClass == DamageType.class) { - return new CraftRegistry<>(DamageType.class, registryHolder.registryOrThrow(Registries.DAMAGE_TYPE), CraftDamageType::new); + if (bukkitClass == Wolf.Variant.class) { + return new CraftRegistry<>(Wolf.Variant.class, registryHolder.registryOrThrow(Registries.WOLF_VARIANT), CraftWolf.CraftVariant::new); } + // TODO registry modification API diff --git a/patches/unapplied/server/Toggle-for-removing-existing-dragon.patch b/patches/server/Toggle-for-removing-existing-dragon.patch similarity index 100% rename from patches/unapplied/server/Toggle-for-removing-existing-dragon.patch rename to patches/server/Toggle-for-removing-existing-dragon.patch diff --git a/patches/unapplied/server/Villager-resetOffers.patch b/patches/server/Villager-resetOffers.patch similarity index 100% rename from patches/unapplied/server/Villager-resetOffers.patch rename to patches/server/Villager-resetOffers.patch diff --git a/patches/unapplied/server/Zombie-API-breaking-doors.patch b/patches/server/Zombie-API-breaking-doors.patch similarity index 100% rename from patches/unapplied/server/Zombie-API-breaking-doors.patch rename to patches/server/Zombie-API-breaking-doors.patch diff --git a/patches/unapplied/server/add-consumeFuel-to-FurnaceBurnEvent.patch b/patches/server/add-consumeFuel-to-FurnaceBurnEvent.patch similarity index 100% rename from patches/unapplied/server/add-consumeFuel-to-FurnaceBurnEvent.patch rename to patches/server/add-consumeFuel-to-FurnaceBurnEvent.patch diff --git a/patches/unapplied/server/add-get-set-drop-chance-to-EntityEquipment.patch b/patches/server/add-get-set-drop-chance-to-EntityEquipment.patch similarity index 100% rename from patches/unapplied/server/add-get-set-drop-chance-to-EntityEquipment.patch rename to patches/server/add-get-set-drop-chance-to-EntityEquipment.patch diff --git a/patches/unapplied/server/add-isDeeplySleeping-to-HumanEntity.patch b/patches/server/add-isDeeplySleeping-to-HumanEntity.patch similarity index 100% rename from patches/unapplied/server/add-isDeeplySleeping-to-HumanEntity.patch rename to patches/server/add-isDeeplySleeping-to-HumanEntity.patch diff --git a/patches/unapplied/server/added-option-to-disable-pathfinding-updates-on-block.patch b/patches/server/added-option-to-disable-pathfinding-updates-on-block.patch similarity index 95% rename from patches/unapplied/server/added-option-to-disable-pathfinding-updates-on-block.patch rename to patches/server/added-option-to-disable-pathfinding-updates-on-block.patch index 9871d1bf7..4f1feda37 100644 --- a/patches/unapplied/server/added-option-to-disable-pathfinding-updates-on-block.patch +++ b/patches/server/added-option-to-disable-pathfinding-updates-on-block.patch @@ -13,9 +13,9 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 this.getChunkSource().blockChanged(pos); + if(this.paperConfig().misc.updatePathfindingOnBlockUpdate) { // Paper - option to disable pathfinding updates + this.pathTypesByPosCache.invalidate(pos); VoxelShape voxelshape = oldState.getCollisionShape(this, pos); VoxelShape voxelshape1 = newState.getCollisionShape(this, pos); - @@ -0,0 +0,0 @@ public class ServerLevel extends Level implements WorldGenLevel { } diff --git a/patches/unapplied/server/fix-PigZombieAngerEvent-cancellation.patch b/patches/server/fix-PigZombieAngerEvent-cancellation.patch similarity index 93% rename from patches/unapplied/server/fix-PigZombieAngerEvent-cancellation.patch rename to patches/server/fix-PigZombieAngerEvent-cancellation.patch index 69c482b91..70f3a7095 100644 --- a/patches/unapplied/server/fix-PigZombieAngerEvent-cancellation.patch +++ b/patches/server/fix-PigZombieAngerEvent-cancellation.patch @@ -9,9 +9,9 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 --- a/src/main/java/net/minecraft/world/entity/monster/ZombifiedPiglin.java +++ b/src/main/java/net/minecraft/world/entity/monster/ZombifiedPiglin.java @@ -0,0 +0,0 @@ public class ZombifiedPiglin extends Zombie implements NeutralMob { + private static final int ALERT_RANGE_Y = 10; + private static final UniformInt ALERT_INTERVAL = TimeUtil.rangeOfSeconds(4, 6); private int ticksUntilNextAlert; - private static final float ZOMBIFIED_PIGLIN_EYE_HEIGHT = 1.79F; - private static final float ZOMBIFIED_PIGLIN_BABY_EYE_HEIGHT_ADJUSTMENT = 0.82F; + private HurtByTargetGoal pathfinderGoalHurtByTarget; // Paper - fix PigZombieAngerEvent cancellation public ZombifiedPiglin(EntityType type, Level world) { diff --git a/patches/unapplied/server/fix-PlayerItemHeldEvent-firing-twice.patch b/patches/server/fix-PlayerItemHeldEvent-firing-twice.patch similarity index 100% rename from patches/unapplied/server/fix-PlayerItemHeldEvent-firing-twice.patch rename to patches/server/fix-PlayerItemHeldEvent-firing-twice.patch diff --git a/patches/unapplied/server/fix-converting-txt-to-json-file.patch b/patches/server/fix-converting-txt-to-json-file.patch similarity index 100% rename from patches/unapplied/server/fix-converting-txt-to-json-file.patch rename to patches/server/fix-converting-txt-to-json-file.patch diff --git a/patches/unapplied/server/fix-dead-slime-setSize-invincibility.patch b/patches/server/fix-dead-slime-setSize-invincibility.patch similarity index 100% rename from patches/unapplied/server/fix-dead-slime-setSize-invincibility.patch rename to patches/server/fix-dead-slime-setSize-invincibility.patch diff --git a/patches/unapplied/server/forced-whitelist-use-configurable-kick-message.patch b/patches/server/forced-whitelist-use-configurable-kick-message.patch similarity index 100% rename from patches/unapplied/server/forced-whitelist-use-configurable-kick-message.patch rename to patches/server/forced-whitelist-use-configurable-kick-message.patch diff --git a/patches/unapplied/server/living-entity-allow-attribute-registration.patch b/patches/server/living-entity-allow-attribute-registration.patch similarity index 97% rename from patches/unapplied/server/living-entity-allow-attribute-registration.patch rename to patches/server/living-entity-allow-attribute-registration.patch index 744b47105..6e8fcdbce 100644 --- a/patches/unapplied/server/living-entity-allow-attribute-registration.patch +++ b/patches/server/living-entity-allow-attribute-registration.patch @@ -9,7 +9,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 --- a/src/main/java/net/minecraft/world/entity/ai/attributes/AttributeMap.java +++ b/src/main/java/net/minecraft/world/entity/ai/attributes/AttributeMap.java @@ -0,0 +0,0 @@ public class AttributeMap { - }, () -> LOGGER.warn("Ignoring unknown attribute '{}'", string)); + } } } + diff --git a/patches/unapplied/server/Add-EntityLoadCrossbowEvent.patch b/patches/unapplied/server/Add-EntityLoadCrossbowEvent.patch deleted file mode 100644 index 7ea980c88..000000000 --- a/patches/unapplied/server/Add-EntityLoadCrossbowEvent.patch +++ /dev/null @@ -1,44 +0,0 @@ -From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 -From: Josh Roy <10731363+JRoy@users.noreply.github.com> -Date: Wed, 7 Oct 2020 12:04:01 -0400 -Subject: [PATCH] Add EntityLoadCrossbowEvent - - -diff --git a/src/main/java/net/minecraft/world/item/CrossbowItem.java b/src/main/java/net/minecraft/world/item/CrossbowItem.java -index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 ---- a/src/main/java/net/minecraft/world/item/CrossbowItem.java -+++ b/src/main/java/net/minecraft/world/item/CrossbowItem.java -@@ -0,0 +0,0 @@ public class CrossbowItem extends ProjectileWeaponItem implements Vanishable { - int j = this.getUseDuration(stack) - remainingUseTicks; - float f = CrossbowItem.getPowerForTime(j, stack); - -- if (f >= 1.0F && !CrossbowItem.isCharged(stack) && CrossbowItem.tryLoadProjectiles(user, stack)) { -+ // Paper start - Add EntityLoadCrossbowEvent -+ if (f >= 1.0F && !CrossbowItem.isCharged(stack) /*&& CrossbowItem.tryLoadProjectiles(entityliving, itemstack)*/) { -+ final io.papermc.paper.event.entity.EntityLoadCrossbowEvent event = new io.papermc.paper.event.entity.EntityLoadCrossbowEvent(user.getBukkitLivingEntity(), stack.asBukkitMirror(), org.bukkit.craftbukkit.CraftEquipmentSlot.getHand(user.getUsedItemHand())); -+ if (!event.callEvent() || !tryLoadProjectiles(user, stack, event.shouldConsumeItem())) { -+ if (user instanceof ServerPlayer player) player.containerMenu.sendAllDataToRemote(); -+ return; -+ } -+ // Paper end - Add EntityLoadCrossbowEvent - CrossbowItem.setCharged(stack, true); - SoundSource soundcategory = user instanceof Player ? SoundSource.PLAYERS : SoundSource.HOSTILE; - -@@ -0,0 +0,0 @@ public class CrossbowItem extends ProjectileWeaponItem implements Vanishable { - - } - -+ @io.papermc.paper.annotation.DoNotUse // Paper - Add EntityLoadCrossbowEvent - private static boolean tryLoadProjectiles(LivingEntity shooter, ItemStack crossbow) { -+ // Paper start - Add EntityLoadCrossbowEvent -+ return CrossbowItem.tryLoadProjectiles(shooter, crossbow, true); -+ } -+ private static boolean tryLoadProjectiles(LivingEntity shooter, ItemStack crossbow, boolean consume) { -+ // Paper end - Add EntityLoadCrossbowEvent - int i = EnchantmentHelper.getItemEnchantmentLevel(Enchantments.MULTISHOT, crossbow); - int j = i == 0 ? 1 : 3; -- boolean flag = shooter instanceof Player && ((Player) shooter).getAbilities().instabuild; -+ boolean flag = !consume || shooter instanceof Player && ((Player) shooter).getAbilities().instabuild; // Paper - Add EntityLoadCrossbowEvent - ItemStack itemstack1 = shooter.getProjectile(crossbow); - ItemStack itemstack2 = itemstack1.copy(); - diff --git a/patches/unapplied/server/Reduce-blockpos-allocation-from-pathfinding.patch b/removed-patches-1-20-5/0452-Reduce-blockpos-allocation-from-pathfinding.patch similarity index 100% rename from patches/unapplied/server/Reduce-blockpos-allocation-from-pathfinding.patch rename to removed-patches-1-20-5/0452-Reduce-blockpos-allocation-from-pathfinding.patch diff --git a/patches/unapplied/server/Cache-burn-durations.patch b/removed-patches-1-20-5/0486-Cache-burn-durations.patch similarity index 100% rename from patches/unapplied/server/Cache-burn-durations.patch rename to removed-patches-1-20-5/0486-Cache-burn-durations.patch diff --git a/patches/unapplied/server/Prevent-grindstones-from-overstacking-items.patch b/removed-patches-1-20-5/0532-Prevent-grindstones-from-overstacking-items.patch similarity index 100% rename from patches/unapplied/server/Prevent-grindstones-from-overstacking-items.patch rename to removed-patches-1-20-5/0532-Prevent-grindstones-from-overstacking-items.patch