diff --git a/patches/unapplied/server/API-for-an-entity-s-scoreboard-name.patch b/patches/server/API-for-an-entity-s-scoreboard-name.patch similarity index 100% rename from patches/unapplied/server/API-for-an-entity-s-scoreboard-name.patch rename to patches/server/API-for-an-entity-s-scoreboard-name.patch diff --git a/patches/unapplied/server/API-for-updating-recipes-on-clients.patch b/patches/server/API-for-updating-recipes-on-clients.patch similarity index 100% rename from patches/unapplied/server/API-for-updating-recipes-on-clients.patch rename to patches/server/API-for-updating-recipes-on-clients.patch diff --git a/patches/unapplied/server/Add-API-to-get-the-collision-shape-of-a-block-before.patch b/patches/server/Add-API-to-get-the-collision-shape-of-a-block-before.patch similarity index 100% rename from patches/unapplied/server/Add-API-to-get-the-collision-shape-of-a-block-before.patch rename to patches/server/Add-API-to-get-the-collision-shape-of-a-block-before.patch diff --git a/patches/unapplied/server/Add-BlockFace-to-BlockDamageEvent.patch b/patches/server/Add-BlockFace-to-BlockDamageEvent.patch similarity index 100% rename from patches/unapplied/server/Add-BlockFace-to-BlockDamageEvent.patch rename to patches/server/Add-BlockFace-to-BlockDamageEvent.patch diff --git a/patches/unapplied/server/Add-Listing-API-for-Player.patch b/patches/server/Add-Listing-API-for-Player.patch similarity index 100% rename from patches/unapplied/server/Add-Listing-API-for-Player.patch rename to patches/server/Add-Listing-API-for-Player.patch diff --git a/patches/unapplied/server/Add-Mob-Experience-reward-API.patch b/patches/server/Add-Mob-Experience-reward-API.patch similarity index 100% rename from patches/unapplied/server/Add-Mob-Experience-reward-API.patch rename to patches/server/Add-Mob-Experience-reward-API.patch diff --git a/patches/unapplied/server/Add-PlayerPickItemEvent.patch b/patches/server/Add-PlayerPickItemEvent.patch similarity index 100% rename from patches/unapplied/server/Add-PlayerPickItemEvent.patch rename to patches/server/Add-PlayerPickItemEvent.patch diff --git a/patches/unapplied/server/Add-Sign-getInteractableSideFor.patch b/patches/server/Add-Sign-getInteractableSideFor.patch similarity index 100% rename from patches/unapplied/server/Add-Sign-getInteractableSideFor.patch rename to patches/server/Add-Sign-getInteractableSideFor.patch diff --git a/patches/unapplied/server/Add-Structure-check-API.patch b/patches/server/Add-Structure-check-API.patch similarity index 100% rename from patches/unapplied/server/Add-Structure-check-API.patch rename to patches/server/Add-Structure-check-API.patch diff --git a/patches/unapplied/server/Add-UUID-attribute-modifier-API.patch b/patches/server/Add-UUID-attribute-modifier-API.patch similarity index 100% rename from patches/unapplied/server/Add-UUID-attribute-modifier-API.patch rename to patches/server/Add-UUID-attribute-modifier-API.patch diff --git a/patches/unapplied/server/Add-event-for-player-editing-sign.patch b/patches/server/Add-event-for-player-editing-sign.patch similarity index 100% rename from patches/unapplied/server/Add-event-for-player-editing-sign.patch rename to patches/server/Add-event-for-player-editing-sign.patch diff --git a/patches/unapplied/server/Add-hand-to-fish-event-for-all-player-interactions.patch b/patches/server/Add-hand-to-fish-event-for-all-player-interactions.patch similarity index 96% rename from patches/unapplied/server/Add-hand-to-fish-event-for-all-player-interactions.patch rename to patches/server/Add-hand-to-fish-event-for-all-player-interactions.patch index 0436d7f462..5ec68566b4 100644 --- a/patches/unapplied/server/Add-hand-to-fish-event-for-all-player-interactions.patch +++ b/patches/server/Add-hand-to-fish-event-for-all-player-interactions.patch @@ -68,8 +68,8 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 if (user.fishing != null) { if (!world.isClientSide) { -- i = user.fishing.retrieve(itemstack); -+ i = user.fishing.retrieve(hand, itemstack); // Paper - Add hand parameter to PlayerFishEvent +- int i = user.fishing.retrieve(itemstack); ++ int i = user.fishing.retrieve(hand, itemstack); // Paper - Add hand parameter to PlayerFishEvent + itemstack.hurtAndBreak(i, user, LivingEntity.getSlotForHand(hand)); } - diff --git a/patches/unapplied/server/Add-method-to-remove-all-active-potion-effects.patch b/patches/server/Add-method-to-remove-all-active-potion-effects.patch similarity index 100% rename from patches/unapplied/server/Add-method-to-remove-all-active-potion-effects.patch rename to patches/server/Add-method-to-remove-all-active-potion-effects.patch diff --git a/patches/unapplied/server/Add-missing-InventoryHolders-to-inventories.patch b/patches/server/Add-missing-InventoryHolders-to-inventories.patch similarity index 100% rename from patches/unapplied/server/Add-missing-InventoryHolders-to-inventories.patch rename to patches/server/Add-missing-InventoryHolders-to-inventories.patch diff --git a/patches/unapplied/server/Add-missing-logs-for-log-ips-config-option.patch b/patches/server/Add-missing-logs-for-log-ips-config-option.patch similarity index 100% rename from patches/unapplied/server/Add-missing-logs-for-log-ips-config-option.patch rename to patches/server/Add-missing-logs-for-log-ips-config-option.patch diff --git a/patches/unapplied/server/Add-option-to-disable-block-updates.patch b/patches/server/Add-option-to-disable-block-updates.patch similarity index 100% rename from patches/unapplied/server/Add-option-to-disable-block-updates.patch rename to patches/server/Add-option-to-disable-block-updates.patch diff --git a/patches/unapplied/server/Add-player-idle-duration-API.patch b/patches/server/Add-player-idle-duration-API.patch similarity index 100% rename from patches/unapplied/server/Add-player-idle-duration-API.patch rename to patches/server/Add-player-idle-duration-API.patch diff --git a/patches/unapplied/server/Add-predicate-for-blocks-when-raytracing.patch b/patches/server/Add-predicate-for-blocks-when-raytracing.patch similarity index 100% rename from patches/unapplied/server/Add-predicate-for-blocks-when-raytracing.patch rename to patches/server/Add-predicate-for-blocks-when-raytracing.patch diff --git a/patches/unapplied/server/Add-slot-sanity-checks-in-container-clicks.patch b/patches/server/Add-slot-sanity-checks-in-container-clicks.patch similarity index 76% rename from patches/unapplied/server/Add-slot-sanity-checks-in-container-clicks.patch rename to patches/server/Add-slot-sanity-checks-in-container-clicks.patch index dbe1b0a16e..da061b36f8 100644 --- a/patches/unapplied/server/Add-slot-sanity-checks-in-container-clicks.patch +++ b/patches/server/Add-slot-sanity-checks-in-container-clicks.patch @@ -4,19 +4,6 @@ Date: Mon, 11 Sep 2023 12:01:57 +1000 Subject: [PATCH] Add slot sanity checks in container clicks -diff --git a/src/main/java/net/minecraft/core/component/DataComponentPatch.java b/src/main/java/net/minecraft/core/component/DataComponentPatch.java -index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 ---- a/src/main/java/net/minecraft/core/component/DataComponentPatch.java -+++ b/src/main/java/net/minecraft/core/component/DataComponentPatch.java -@@ -0,0 +0,0 @@ public final class DataComponentPatch { - if (i == 0 && j == 0) { - return DataComponentPatch.EMPTY; - } else { -- Reference2ObjectMap, Optional> reference2objectmap = new Reference2ObjectArrayMap(i + j); -+ Reference2ObjectMap, Optional> reference2objectmap = new Reference2ObjectArrayMap(Math.min(i + j, 256)); // Paper - sensible initial size limit - - DataComponentType datacomponenttype; - int k; diff --git a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 --- a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java diff --git a/patches/unapplied/server/Add-titleOverride-to-InventoryOpenEvent.patch b/patches/server/Add-titleOverride-to-InventoryOpenEvent.patch similarity index 96% rename from patches/unapplied/server/Add-titleOverride-to-InventoryOpenEvent.patch rename to patches/server/Add-titleOverride-to-InventoryOpenEvent.patch index 7f5293d4b6..31ef77501a 100644 --- a/patches/unapplied/server/Add-titleOverride-to-InventoryOpenEvent.patch +++ b/patches/server/Add-titleOverride-to-InventoryOpenEvent.patch @@ -8,7 +8,7 @@ diff --git a/src/main/java/net/minecraft/server/level/ServerPlayer.java b/src/ma index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 --- a/src/main/java/net/minecraft/server/level/ServerPlayer.java +++ b/src/main/java/net/minecraft/server/level/ServerPlayer.java -@@ -0,0 +0,0 @@ public class ServerPlayer extends Player { +@@ -0,0 +0,0 @@ public class ServerPlayer extends net.minecraft.world.entity.player.Player { this.nextContainerCounter(); AbstractContainerMenu container = factory.createMenu(this.containerCounter, this.getInventory(), this); @@ -27,7 +27,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 if (container == null && !cancelled) { // Let pre-cancelled events fall through // SPIGOT-5263 - close chest if cancelled if (factory instanceof Container) { -@@ -0,0 +0,0 @@ public class ServerPlayer extends Player { +@@ -0,0 +0,0 @@ public class ServerPlayer extends net.minecraft.world.entity.player.Player { } else { // CraftBukkit start this.containerMenu = container; @@ -117,4 +117,4 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 + return com.mojang.datafixers.util.Pair.of(event.titleOverride(), container); // Paper - Add titleOverride to InventoryOpenEvent } - public static ItemStack callPreCraftEvent(Container matrix, Container resultInventory, ItemStack result, InventoryView lastCraftView, boolean isRepair) { + public static ItemStack callPreCraftEvent(CraftingContainer matrix, Container resultInventory, ItemStack result, InventoryView lastCraftView, boolean isRepair) { diff --git a/patches/unapplied/server/Add-transient-modifier-API.patch b/patches/server/Add-transient-modifier-API.patch similarity index 100% rename from patches/unapplied/server/Add-transient-modifier-API.patch rename to patches/server/Add-transient-modifier-API.patch diff --git a/patches/unapplied/server/Add-whitelist-events.patch b/patches/server/Add-whitelist-events.patch similarity index 100% rename from patches/unapplied/server/Add-whitelist-events.patch rename to patches/server/Add-whitelist-events.patch diff --git a/patches/unapplied/server/Allow-null-itemstack-for-Player-sendEquipmentChange.patch b/patches/server/Allow-null-itemstack-for-Player-sendEquipmentChange.patch similarity index 100% rename from patches/unapplied/server/Allow-null-itemstack-for-Player-sendEquipmentChange.patch rename to patches/server/Allow-null-itemstack-for-Player-sendEquipmentChange.patch diff --git a/patches/unapplied/server/Allow-proper-checking-of-empty-item-stacks.patch b/patches/server/Allow-proper-checking-of-empty-item-stacks.patch similarity index 100% rename from patches/unapplied/server/Allow-proper-checking-of-empty-item-stacks.patch rename to patches/server/Allow-proper-checking-of-empty-item-stacks.patch diff --git a/patches/unapplied/server/Allow-trident-custom-damage.patch b/patches/server/Allow-trident-custom-damage.patch similarity index 80% rename from patches/unapplied/server/Allow-trident-custom-damage.patch rename to patches/server/Allow-trident-custom-damage.patch index c05ddfe707..abe325f080 100644 --- a/patches/unapplied/server/Allow-trident-custom-damage.patch +++ b/patches/server/Allow-trident-custom-damage.patch @@ -16,9 +16,9 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 } public ThrownTrident(Level world, LivingEntity owner, ItemStack stack) { - super(EntityType.TRIDENT, owner, world, stack); + super(EntityType.TRIDENT, owner, world, stack, (ItemStack) null); + this.setBaseDamage(net.minecraft.world.item.TridentItem.BASE_DAMAGE); // Paper - Allow trident custom damage - this.entityData.set(ThrownTrident.ID_LOYALTY, (byte) EnchantmentHelper.getLoyalty(stack)); + this.entityData.set(ThrownTrident.ID_LOYALTY, this.getLoyaltyFromItem(stack)); this.entityData.set(ThrownTrident.ID_FOIL, stack.hasFoil()); } @@ -0,0 +0,0 @@ public class ThrownTrident extends AbstractArrow { @@ -27,6 +27,6 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 Entity entity = entityHitResult.getEntity(); - float f = 8.0F; + float f = (float) this.getBaseDamage(); // Paper - Allow trident custom damage - - if (entity instanceof LivingEntity entityliving) { - f += EnchantmentHelper.getDamageBonus(this.getPickupItemStackOrigin(), entityliving.getType()); + Entity entity1 = this.getOwner(); + DamageSource damagesource = this.damageSources().trident(this, (Entity) (entity1 == null ? this : entity1)); + Level world = this.level(); diff --git a/patches/unapplied/server/Avoid-Lazy-Initialization-for-Enum-Fields.patch b/patches/server/Avoid-Lazy-Initialization-for-Enum-Fields.patch similarity index 100% rename from patches/unapplied/server/Avoid-Lazy-Initialization-for-Enum-Fields.patch rename to patches/server/Avoid-Lazy-Initialization-for-Enum-Fields.patch diff --git a/patches/unapplied/server/Bandaid-fix-for-Effect.patch b/patches/server/Bandaid-fix-for-Effect.patch similarity index 100% rename from patches/unapplied/server/Bandaid-fix-for-Effect.patch rename to patches/server/Bandaid-fix-for-Effect.patch diff --git a/patches/unapplied/server/Break-redstone-on-top-of-trap-doors-early.patch b/patches/server/Break-redstone-on-top-of-trap-doors-early.patch similarity index 100% rename from patches/unapplied/server/Break-redstone-on-top-of-trap-doors-early.patch rename to patches/server/Break-redstone-on-top-of-trap-doors-early.patch diff --git a/patches/unapplied/server/Broadcast-take-item-packets-with-collector-as-source.patch b/patches/server/Broadcast-take-item-packets-with-collector-as-source.patch similarity index 100% rename from patches/unapplied/server/Broadcast-take-item-packets-with-collector-as-source.patch rename to patches/server/Broadcast-take-item-packets-with-collector-as-source.patch diff --git a/patches/unapplied/server/Cache-map-ids-on-item-frames.patch b/patches/server/Cache-map-ids-on-item-frames.patch similarity index 98% rename from patches/unapplied/server/Cache-map-ids-on-item-frames.patch rename to patches/server/Cache-map-ids-on-item-frames.patch index 2b661b917d..0d385c6e65 100644 --- a/patches/unapplied/server/Cache-map-ids-on-item-frames.patch +++ b/patches/server/Cache-map-ids-on-item-frames.patch @@ -22,7 +22,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 --- a/src/main/java/net/minecraft/world/entity/decoration/ItemFrame.java +++ b/src/main/java/net/minecraft/world/entity/decoration/ItemFrame.java @@ -0,0 +0,0 @@ public class ItemFrame extends HangingEntity { - public static final int NUM_ROTATIONS = 8; + private static final float HEIGHT = 0.75F; public float dropChance; public boolean fixed; + public @Nullable MapId cachedMapId; // Paper - Perf: Cache map ids on item frames diff --git a/patches/unapplied/server/Call-BlockGrowEvent-for-missing-blocks.patch b/patches/server/Call-BlockGrowEvent-for-missing-blocks.patch similarity index 100% rename from patches/unapplied/server/Call-BlockGrowEvent-for-missing-blocks.patch rename to patches/server/Call-BlockGrowEvent-for-missing-blocks.patch diff --git a/patches/unapplied/server/Call-BlockRedstoneEvents-for-lecterns.patch b/patches/server/Call-BlockRedstoneEvents-for-lecterns.patch similarity index 100% rename from patches/unapplied/server/Call-BlockRedstoneEvents-for-lecterns.patch rename to patches/server/Call-BlockRedstoneEvents-for-lecterns.patch diff --git a/patches/unapplied/server/Call-missing-BlockDispenseEvent.patch b/patches/server/Call-missing-BlockDispenseEvent.patch similarity index 100% rename from patches/unapplied/server/Call-missing-BlockDispenseEvent.patch rename to patches/server/Call-missing-BlockDispenseEvent.patch diff --git a/patches/unapplied/server/Configurable-Region-Compression-Format.patch b/patches/server/Configurable-Region-Compression-Format.patch similarity index 100% rename from patches/unapplied/server/Configurable-Region-Compression-Format.patch rename to patches/server/Configurable-Region-Compression-Format.patch diff --git a/patches/unapplied/server/Configurable-entity-tracking-range-by-Y-coordinate.patch b/patches/server/Configurable-entity-tracking-range-by-Y-coordinate.patch similarity index 100% rename from patches/unapplied/server/Configurable-entity-tracking-range-by-Y-coordinate.patch rename to patches/server/Configurable-entity-tracking-range-by-Y-coordinate.patch diff --git a/patches/unapplied/server/Configure-sniffer-egg-hatch-time.patch b/patches/server/Configure-sniffer-egg-hatch-time.patch similarity index 100% rename from patches/unapplied/server/Configure-sniffer-egg-hatch-time.patch rename to patches/server/Configure-sniffer-egg-hatch-time.patch diff --git a/patches/unapplied/server/Deprecate-and-replace-methods-with-old-StructureType.patch b/patches/server/Deprecate-and-replace-methods-with-old-StructureType.patch similarity index 100% rename from patches/unapplied/server/Deprecate-and-replace-methods-with-old-StructureType.patch rename to patches/server/Deprecate-and-replace-methods-with-old-StructureType.patch diff --git a/patches/unapplied/server/Determine-lava-and-water-fluid-explosion-resistance-.patch b/patches/server/Determine-lava-and-water-fluid-explosion-resistance-.patch similarity index 100% rename from patches/unapplied/server/Determine-lava-and-water-fluid-explosion-resistance-.patch rename to patches/server/Determine-lava-and-water-fluid-explosion-resistance-.patch diff --git a/patches/unapplied/server/Do-crystal-portal-proximity-check-before-entity-look.patch b/patches/server/Do-crystal-portal-proximity-check-before-entity-look.patch similarity index 100% rename from patches/unapplied/server/Do-crystal-portal-proximity-check-before-entity-look.patch rename to patches/server/Do-crystal-portal-proximity-check-before-entity-look.patch diff --git a/patches/unapplied/server/Do-not-read-tile-entities-in-chunks-that-are-positio.patch b/patches/server/Do-not-read-tile-entities-in-chunks-that-are-positio.patch similarity index 100% rename from patches/unapplied/server/Do-not-read-tile-entities-in-chunks-that-are-positio.patch rename to patches/server/Do-not-read-tile-entities-in-chunks-that-are-positio.patch diff --git a/patches/unapplied/server/Don-t-check-if-we-can-see-non-visible-entities.patch b/patches/server/Don-t-check-if-we-can-see-non-visible-entities.patch similarity index 100% rename from patches/unapplied/server/Don-t-check-if-we-can-see-non-visible-entities.patch rename to patches/server/Don-t-check-if-we-can-see-non-visible-entities.patch diff --git a/patches/unapplied/server/Don-t-enforce-icanhasbukkit-default-if-alias-block-e.patch b/patches/server/Don-t-enforce-icanhasbukkit-default-if-alias-block-e.patch similarity index 100% rename from patches/unapplied/server/Don-t-enforce-icanhasbukkit-default-if-alias-block-e.patch rename to patches/server/Don-t-enforce-icanhasbukkit-default-if-alias-block-e.patch diff --git a/patches/unapplied/server/Don-t-fire-sync-events-during-worldgen.patch b/patches/server/Don-t-fire-sync-events-during-worldgen.patch similarity index 100% rename from patches/unapplied/server/Don-t-fire-sync-events-during-worldgen.patch rename to patches/server/Don-t-fire-sync-events-during-worldgen.patch diff --git a/patches/unapplied/server/Don-t-load-chunks-for-supporting-block-checks.patch b/patches/server/Don-t-load-chunks-for-supporting-block-checks.patch similarity index 100% rename from patches/unapplied/server/Don-t-load-chunks-for-supporting-block-checks.patch rename to patches/server/Don-t-load-chunks-for-supporting-block-checks.patch diff --git a/patches/unapplied/server/Don-t-tab-complete-namespaced-commands-if-send-names.patch b/patches/server/Don-t-tab-complete-namespaced-commands-if-send-names.patch similarity index 100% rename from patches/unapplied/server/Don-t-tab-complete-namespaced-commands-if-send-names.patch rename to patches/server/Don-t-tab-complete-namespaced-commands-if-send-names.patch diff --git a/patches/unapplied/server/Expand-LingeringPotion-API.patch b/patches/server/Expand-LingeringPotion-API.patch similarity index 100% rename from patches/unapplied/server/Expand-LingeringPotion-API.patch rename to patches/server/Expand-LingeringPotion-API.patch diff --git a/patches/unapplied/server/Expand-PlayerItemMendEvent.patch b/patches/server/Expand-PlayerItemMendEvent.patch similarity index 70% rename from patches/unapplied/server/Expand-PlayerItemMendEvent.patch rename to patches/server/Expand-PlayerItemMendEvent.patch index e0331a7bc2..32f9780a51 100644 --- a/patches/unapplied/server/Expand-PlayerItemMendEvent.patch +++ b/patches/server/Expand-PlayerItemMendEvent.patch @@ -9,29 +9,31 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 --- a/src/main/java/net/minecraft/world/entity/ExperienceOrb.java +++ b/src/main/java/net/minecraft/world/entity/ExperienceOrb.java @@ -0,0 +0,0 @@ public class ExperienceOrb extends Entity { - ItemStack itemstack = (ItemStack) entry.getValue(); - int j = Math.min(this.xpToDurability(amount), itemstack.getDamageValue()); + + if (optional.isPresent()) { + ItemStack itemstack = ((EnchantedItemInUse) optional.get()).itemStack(); +- int j = EnchantmentHelper.modifyDurabilityToRepairFromXp(player.serverLevel(), itemstack, amount); +- int k = Math.min(j, itemstack.getDamageValue()); ++ int j = EnchantmentHelper.modifyDurabilityToRepairFromXp(player.serverLevel(), itemstack, amount);; int xpTranslatedToDurability = j; // Paper - mending event - obfhelper ++ int k = Math.min(j, itemstack.getDamageValue()); int durabilityToAddBack = k; // Paper - mending event - obfhelper // CraftBukkit start -- org.bukkit.event.player.PlayerItemMendEvent event = CraftEventFactory.callPlayerItemMendEvent(player, this, itemstack, entry.getKey(), j); -+ org.bukkit.event.player.PlayerItemMendEvent event = CraftEventFactory.callPlayerItemMendEvent(player, this, itemstack, entry.getKey(), j, this::durabilityToXp); // Paper - Expand PlayerItemMendEvent - j = event.getRepairAmount(); +- org.bukkit.event.player.PlayerItemMendEvent event = CraftEventFactory.callPlayerItemMendEvent(player, this, itemstack, optional.get().inSlot(), k); +- k = event.getRepairAmount(); ++ org.bukkit.event.player.PlayerItemMendEvent event = CraftEventFactory.callPlayerItemMendEvent(player, this, itemstack, optional.get().inSlot(), durabilityToAddBack, d -> d * amount / xpTranslatedToDurability); // Paper - Expand PlayerItemMendEvent ++ durabilityToAddBack = event.getRepairAmount(); // Paper - mending event - obfhelper if (event.isCancelled()) { return amount; -@@ -0,0 +0,0 @@ public class ExperienceOrb extends Entity { + } // CraftBukkit end - itemstack.setDamageValue(itemstack.getDamageValue() - j); -- int k = amount - this.durabilityToXp(j); -+ int k = amount - event.getDurabilityToXpOperation().applyAsInt(j); // Paper - Expand PlayerItemMendEvent - // this.value = k; // CraftBukkit - update exp value of orb for PlayerItemMendEvent calls // Paper - the value field should not be mutated here because it doesn't take "count" into account -+ // Paper start - Expand PlayerItemMendEvent -+ if (j == 0 && amount == k) { // if repair amount is 0 and no xp was removed, don't do recursion; treat as cancelled -+ return k; -+ } -+ // Paper end - Expand PlayerItemMendEvent +- itemstack.setDamageValue(itemstack.getDamageValue() - k); ++ itemstack.setDamageValue(itemstack.getDamageValue() - durabilityToAddBack); // Paper - mending event - obfhelper + if (k > 0) { +- int l = amount - k * amount / j; ++ int l = amount - event.getDurabilityToXpOperation().applyAsInt(durabilityToAddBack); // Paper - mending event - obfhelper - return k > 0 ? this.repairPlayerItems(player, k) : 0; - } else { + if (l > 0) { + // this.value = l; // CraftBukkit - update exp value of orb for PlayerItemMendEvent calls // Paper - the value field should not be mutated here because it doesn't take "count" into account diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 --- a/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java @@ -41,7 +43,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 int i = Math.min(orb.xpToDurability(amount), itemstack.getDamageValue()); - org.bukkit.event.player.PlayerItemMendEvent event = org.bukkit.craftbukkit.event.CraftEventFactory.callPlayerItemMendEvent(handle, orb, itemstack, stackEntry.getKey(), i); -+ org.bukkit.event.player.PlayerItemMendEvent event = org.bukkit.craftbukkit.event.CraftEventFactory.callPlayerItemMendEvent(handle, orb, itemstack, stackEntry.getKey(), i, orb::durabilityToXp); // Paper - Expand PlayerItemMendEvent ++ org.bukkit.event.player.PlayerItemMendEvent event = org.bukkit.craftbukkit.event.CraftEventFactory.callPlayerItemMendEvent(handle, orb, itemstack, stackEntry.get().inSlot(), i, orb::durabilityToXp); // Paper - Expand PlayerItemMendEvent i = event.getRepairAmount(); orb.discard(org.bukkit.event.entity.EntityRemoveEvent.Cause.DESPAWN); if (!event.isCancelled()) { diff --git a/patches/unapplied/server/Expand-Pose-API.patch b/patches/server/Expand-Pose-API.patch similarity index 100% rename from patches/unapplied/server/Expand-Pose-API.patch rename to patches/server/Expand-Pose-API.patch diff --git a/patches/unapplied/server/ExperienceOrb-should-call-EntitySpawnEvent.patch b/patches/server/ExperienceOrb-should-call-EntitySpawnEvent.patch similarity index 100% rename from patches/unapplied/server/ExperienceOrb-should-call-EntitySpawnEvent.patch rename to patches/server/ExperienceOrb-should-call-EntitySpawnEvent.patch diff --git a/patches/unapplied/server/Expose-hand-in-BlockCanBuildEvent.patch b/patches/server/Expose-hand-in-BlockCanBuildEvent.patch similarity index 100% rename from patches/unapplied/server/Expose-hand-in-BlockCanBuildEvent.patch rename to patches/server/Expose-hand-in-BlockCanBuildEvent.patch diff --git a/patches/unapplied/server/Fire-entity-death-event-for-ender-dragon.patch b/patches/server/Fire-entity-death-event-for-ender-dragon.patch similarity index 100% rename from patches/unapplied/server/Fire-entity-death-event-for-ender-dragon.patch rename to patches/server/Fire-entity-death-event-for-ender-dragon.patch diff --git a/patches/unapplied/server/Fix-BanList-API.patch b/patches/server/Fix-BanList-API.patch similarity index 100% rename from patches/unapplied/server/Fix-BanList-API.patch rename to patches/server/Fix-BanList-API.patch diff --git a/patches/unapplied/server/Fix-CraftMetaItem-getAttributeModifier-duplication-c.patch b/patches/server/Fix-CraftMetaItem-getAttributeModifier-duplication-c.patch similarity index 67% rename from patches/unapplied/server/Fix-CraftMetaItem-getAttributeModifier-duplication-c.patch rename to patches/server/Fix-CraftMetaItem-getAttributeModifier-duplication-c.patch index 13cb4ace14..56a52de2d5 100644 --- a/patches/unapplied/server/Fix-CraftMetaItem-getAttributeModifier-duplication-c.patch +++ b/patches/server/Fix-CraftMetaItem-getAttributeModifier-duplication-c.patch @@ -12,8 +12,8 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 Preconditions.checkNotNull(modifier, "AttributeModifier cannot be null"); this.checkAttributeList(); for (Map.Entry entry : this.attributeModifiers.entries()) { -- Preconditions.checkArgument(!entry.getValue().getUniqueId().equals(modifier.getUniqueId()), "Cannot register AttributeModifier. Modifier is already applied! %s", modifier); -+ Preconditions.checkArgument(!(entry.getValue().getUniqueId().equals(modifier.getUniqueId()) && entry.getKey() == attribute), "Cannot register AttributeModifier. Modifier is already applied! %s", modifier); // Paper +- Preconditions.checkArgument(!entry.getValue().getKey().equals(modifier.getKey()), "Cannot register AttributeModifier. Modifier is already applied! %s", modifier); ++ Preconditions.checkArgument(!entry.getValue().getKey().equals(modifier.getKey()) && entry.getKey() == attribute, "Cannot register AttributeModifier. Modifier is already applied! %s", modifier); // Paper - attribute modifiers with same namespaced key but on different attributes are fine } return this.attributeModifiers.put(attribute, modifier); } diff --git a/patches/unapplied/server/Fix-NPE-in-AdvancementProgress-getDateAwarded.patch b/patches/server/Fix-NPE-in-AdvancementProgress-getDateAwarded.patch similarity index 100% rename from patches/unapplied/server/Fix-NPE-in-AdvancementProgress-getDateAwarded.patch rename to patches/server/Fix-NPE-in-AdvancementProgress-getDateAwarded.patch diff --git a/patches/unapplied/server/Fix-NPE-in-SculkBloomEvent-world-access.patch b/patches/server/Fix-NPE-in-SculkBloomEvent-world-access.patch similarity index 100% rename from patches/unapplied/server/Fix-NPE-in-SculkBloomEvent-world-access.patch rename to patches/server/Fix-NPE-in-SculkBloomEvent-world-access.patch diff --git a/patches/unapplied/server/Fix-NPE-on-Boat-getStatus.patch b/patches/server/Fix-NPE-on-Boat-getStatus.patch similarity index 100% rename from patches/unapplied/server/Fix-NPE-on-Boat-getStatus.patch rename to patches/server/Fix-NPE-on-Boat-getStatus.patch diff --git a/patches/unapplied/server/Fix-UnsafeValues-loadAdvancement.patch b/patches/server/Fix-UnsafeValues-loadAdvancement.patch similarity index 100% rename from patches/unapplied/server/Fix-UnsafeValues-loadAdvancement.patch rename to patches/server/Fix-UnsafeValues-loadAdvancement.patch diff --git a/patches/unapplied/server/Fix-a-couple-of-upstream-bed-issues.patch b/patches/server/Fix-a-couple-of-upstream-bed-issues.patch similarity index 100% rename from patches/unapplied/server/Fix-a-couple-of-upstream-bed-issues.patch rename to patches/server/Fix-a-couple-of-upstream-bed-issues.patch diff --git a/patches/unapplied/server/Fix-block-place-logic.patch b/patches/server/Fix-block-place-logic.patch similarity index 73% rename from patches/unapplied/server/Fix-block-place-logic.patch rename to patches/server/Fix-block-place-logic.patch index bf0fa06728..ffe5f6beb6 100644 --- a/patches/unapplied/server/Fix-block-place-logic.patch +++ b/patches/server/Fix-block-place-logic.patch @@ -21,25 +21,6 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 world.gameEvent((Holder) GameEvent.BLOCK_PLACE, blockposition, GameEvent.Context.of(entityhuman, iblockdata1)); itemstack.consume(1, entityhuman); return InteractionResult.sidedSuccess(world.isClientSide); -diff --git a/src/main/java/net/minecraft/world/item/ItemStack.java b/src/main/java/net/minecraft/world/item/ItemStack.java -index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 ---- a/src/main/java/net/minecraft/world/item/ItemStack.java -+++ b/src/main/java/net/minecraft/world/item/ItemStack.java -@@ -0,0 +0,0 @@ public final class ItemStack implements DataComponentHolder { - if (tileentity instanceof JukeboxBlockEntity) { - JukeboxBlockEntity tileentityjukebox = (JukeboxBlockEntity) tileentity; - -- // There can only be one -- ItemStack record = this.copy(); -- if (!record.isEmpty()) { -- record.setCount(1); -- } -- -- tileentityjukebox.setTheItem(record); -+ tileentityjukebox.setTheItem(this.copy()); // Paper - Fix block place logic; sync this with record item, jukebox has now an inventory - world.gameEvent(GameEvent.BLOCK_CHANGE, blockposition, GameEvent.Context.of(entityhuman, world.getBlockState(blockposition))); - } - diff --git a/src/main/java/net/minecraft/world/level/Level.java b/src/main/java/net/minecraft/world/level/Level.java index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 --- a/src/main/java/net/minecraft/world/level/Level.java diff --git a/patches/unapplied/server/Fix-cmd-permission-levels-for-command-blocks.patch b/patches/server/Fix-cmd-permission-levels-for-command-blocks.patch similarity index 100% rename from patches/unapplied/server/Fix-cmd-permission-levels-for-command-blocks.patch rename to patches/server/Fix-cmd-permission-levels-for-command-blocks.patch diff --git a/patches/unapplied/server/Fix-custom-statistic-criteria-creation.patch b/patches/server/Fix-custom-statistic-criteria-creation.patch similarity index 100% rename from patches/unapplied/server/Fix-custom-statistic-criteria-creation.patch rename to patches/server/Fix-custom-statistic-criteria-creation.patch diff --git a/patches/unapplied/server/Fix-demo-flag-not-enabling-demo-mode.patch b/patches/server/Fix-demo-flag-not-enabling-demo-mode.patch similarity index 100% rename from patches/unapplied/server/Fix-demo-flag-not-enabling-demo-mode.patch rename to patches/server/Fix-demo-flag-not-enabling-demo-mode.patch diff --git a/patches/unapplied/server/Fix-incorrect-crafting-result-amount-for-fireworks.patch b/patches/server/Fix-incorrect-crafting-result-amount-for-fireworks.patch similarity index 100% rename from patches/unapplied/server/Fix-incorrect-crafting-result-amount-for-fireworks.patch rename to patches/server/Fix-incorrect-crafting-result-amount-for-fireworks.patch diff --git a/patches/unapplied/server/Fix-inventory-desync.patch b/patches/server/Fix-inventory-desync.patch similarity index 83% rename from patches/unapplied/server/Fix-inventory-desync.patch rename to patches/server/Fix-inventory-desync.patch index fc8dee24c1..ca22ca9811 100644 --- a/patches/unapplied/server/Fix-inventory-desync.patch +++ b/patches/server/Fix-inventory-desync.patch @@ -8,7 +8,7 @@ diff --git a/src/main/java/net/minecraft/server/level/ServerPlayer.java b/src/ma index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 --- a/src/main/java/net/minecraft/server/level/ServerPlayer.java +++ b/src/main/java/net/minecraft/server/level/ServerPlayer.java -@@ -0,0 +0,0 @@ public class ServerPlayer extends Player { +@@ -0,0 +0,0 @@ public class ServerPlayer extends net.minecraft.world.entity.player.Player { // Use method to resend items in hands in case of client desync, because the item use got cancelled. // For example, when cancelling the leash event @@ -16,21 +16,6 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 public void resendItemInHands() { this.containerMenu.findSlot(this.getInventory(), this.getInventory().selected).ifPresent(s -> { this.containerSynchronizer.sendSlotChange(this.containerMenu, s, this.getMainHandItem()); -diff --git a/src/main/java/net/minecraft/world/entity/Mob.java b/src/main/java/net/minecraft/world/entity/Mob.java -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 EquipmentUser, Targeti - if (itemstack.is(Items.LEAD) && this.canBeLeashed(player)) { - // CraftBukkit start - fire PlayerLeashEntityEvent - if (CraftEventFactory.callPlayerLeashEntityEvent(this, player, player, hand).isCancelled()) { -- ((ServerPlayer) player).resendItemInHands(); // SPIGOT-7615: Resend to fix client desync with used item -+ // ((ServerPlayer) player).resendItemInHands(); // SPIGOT-7615: Resend to fix client desync with used item // Paper - handled below - ((ServerPlayer) player).connection.send(new ClientboundSetEntityLinkPacket(this, this.getLeashHolder())); -+ player.containerMenu.sendAllDataToRemote(); // Paper - Fix inventory desync - return InteractionResult.PASS; - } - // CraftBukkit end diff --git a/src/main/java/net/minecraft/world/entity/animal/Cow.java b/src/main/java/net/minecraft/world/entity/animal/Cow.java index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 --- a/src/main/java/net/minecraft/world/entity/animal/Cow.java diff --git a/patches/unapplied/server/Fix-missing-event-call-for-entity-teleport-API.patch b/patches/server/Fix-missing-event-call-for-entity-teleport-API.patch similarity index 100% rename from patches/unapplied/server/Fix-missing-event-call-for-entity-teleport-API.patch rename to patches/server/Fix-missing-event-call-for-entity-teleport-API.patch diff --git a/patches/unapplied/server/Fix-missing-map-initialize-event-call.patch b/patches/server/Fix-missing-map-initialize-event-call.patch similarity index 100% rename from patches/unapplied/server/Fix-missing-map-initialize-event-call.patch rename to patches/server/Fix-missing-map-initialize-event-call.patch diff --git a/patches/unapplied/server/Fix-possible-NPE-on-painting-creation.patch b/patches/server/Fix-possible-NPE-on-painting-creation.patch similarity index 90% rename from patches/unapplied/server/Fix-possible-NPE-on-painting-creation.patch rename to patches/server/Fix-possible-NPE-on-painting-creation.patch index d48a987fd2..7bf5116748 100644 --- a/patches/unapplied/server/Fix-possible-NPE-on-painting-creation.patch +++ b/patches/server/Fix-possible-NPE-on-painting-creation.patch @@ -26,8 +26,8 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 entity.setDirection(hangingData.direction()); @@ -0,0 +0,0 @@ public final class CraftEntityTypes { AABB bb = (ItemFrame.class.isAssignableFrom(clazz)) - ? net.minecraft.world.entity.decoration.ItemFrame.calculateBoundingBox(null, pos, CraftBlock.blockFaceToNotch(dir).getOpposite(), width, height) - : HangingEntity.calculateBoundingBox(null, pos, CraftBlock.blockFaceToNotch(dir).getOpposite(), width, height); + ? net.minecraft.world.entity.decoration.ItemFrame.calculateBoundingBoxStatic(pos, CraftBlock.blockFaceToNotch(dir).getOpposite()) + : net.minecraft.world.entity.decoration.Painting.calculateBoundingBoxStatic(pos, CraftBlock.blockFaceToNotch(dir).getOpposite(), width, height); + if (!spawnData.world.noCollision(bb)) continue; // Paper - add collision check List list = spawnData.world().getEntities(null, bb); for (Iterator it = list.iterator(); !taken && it.hasNext(); ) { diff --git a/patches/unapplied/server/Fix-race-condition-on-UpgradeData.BlockFixers-class-.patch b/patches/server/Fix-race-condition-on-UpgradeData.BlockFixers-class-.patch similarity index 100% rename from patches/unapplied/server/Fix-race-condition-on-UpgradeData.BlockFixers-class-.patch rename to patches/server/Fix-race-condition-on-UpgradeData.BlockFixers-class-.patch diff --git a/patches/unapplied/server/Fix-rotation-when-spawning-display-entities.patch b/patches/server/Fix-rotation-when-spawning-display-entities.patch similarity index 93% rename from patches/unapplied/server/Fix-rotation-when-spawning-display-entities.patch rename to patches/server/Fix-rotation-when-spawning-display-entities.patch index 4ce3268c96..282528c6ff 100644 --- a/patches/unapplied/server/Fix-rotation-when-spawning-display-entities.patch +++ b/patches/server/Fix-rotation-when-spawning-display-entities.patch @@ -9,8 +9,8 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 --- a/src/main/java/org/bukkit/craftbukkit/entity/CraftEntityTypes.java +++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftEntityTypes.java @@ -0,0 +0,0 @@ public final class CraftEntityTypes { - Vector direction = spawnData.location().getDirection().multiply(10); - entity.assignPower(direction.getX(), direction.getY(), direction.getZ()); + Vector direction = spawnData.location().getDirection(); + entity.assignDirectionalMovement(new Vec3(direction.getX(), direction.getY(), direction.getZ()), 1.0); }; + private static final BiConsumer ROT = (spawnData, entity) -> entity.setRot(spawnData.yaw(), spawnData.pitch()); // Paper private static final Map, EntityTypeData> CLASS_TYPE_DATA = new HashMap<>(); diff --git a/patches/unapplied/server/Fix-several-issues-with-EntityBreedEvent.patch b/patches/server/Fix-several-issues-with-EntityBreedEvent.patch similarity index 100% rename from patches/unapplied/server/Fix-several-issues-with-EntityBreedEvent.patch rename to patches/server/Fix-several-issues-with-EntityBreedEvent.patch diff --git a/patches/unapplied/server/Fix-silent-equipment-change-for-mobs.patch b/patches/server/Fix-silent-equipment-change-for-mobs.patch similarity index 98% rename from patches/unapplied/server/Fix-silent-equipment-change-for-mobs.patch rename to patches/server/Fix-silent-equipment-change-for-mobs.patch index 2d33b32dc6..e234139ec4 100644 --- a/patches/unapplied/server/Fix-silent-equipment-change-for-mobs.patch +++ b/patches/server/Fix-silent-equipment-change-for-mobs.patch @@ -8,7 +8,7 @@ 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 EquipmentUser, Targeti +@@ -0,0 +0,0 @@ public abstract class Mob extends LivingEntity implements EquipmentUser, Leashab @Override public void setItemSlot(EquipmentSlot slot, ItemStack stack) { @@ -25,11 +25,11 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 - this.onEquipItem(slot, (ItemStack) this.handItems.set(slot.getIndex(), stack), stack); + this.onEquipItem(slot, (ItemStack) this.handItems.set(slot.getIndex(), stack), stack, silent); // Paper - Fix silent equipment change break; - case ARMOR: + case HUMANOID_ARMOR: - this.onEquipItem(slot, (ItemStack) this.armorItems.set(slot.getIndex(), stack), stack); + this.onEquipItem(slot, (ItemStack) this.armorItems.set(slot.getIndex(), stack), stack, silent); // Paper - Fix silent equipment change break; - case BODY: + case ANIMAL_ARMOR: ItemStack itemstack1 = this.bodyArmorItem; this.bodyArmorItem = stack; diff --git a/patches/unapplied/server/Fix-sniffer-removeExploredLocation.patch b/patches/server/Fix-sniffer-removeExploredLocation.patch similarity index 100% rename from patches/unapplied/server/Fix-sniffer-removeExploredLocation.patch rename to patches/server/Fix-sniffer-removeExploredLocation.patch diff --git a/patches/unapplied/server/Fix-spigot-s-Forced-Stats.patch b/patches/server/Fix-spigot-s-Forced-Stats.patch similarity index 100% rename from patches/unapplied/server/Fix-spigot-s-Forced-Stats.patch rename to patches/server/Fix-spigot-s-Forced-Stats.patch diff --git a/patches/unapplied/server/Fix-spigot-sound-playing-for-BlockItem-ItemStacks.patch b/patches/server/Fix-spigot-sound-playing-for-BlockItem-ItemStacks.patch similarity index 100% rename from patches/unapplied/server/Fix-spigot-sound-playing-for-BlockItem-ItemStacks.patch rename to patches/server/Fix-spigot-sound-playing-for-BlockItem-ItemStacks.patch diff --git a/patches/unapplied/server/Fix-strikeLightningEffect-powers-lightning-rods-and-.patch b/patches/server/Fix-strikeLightningEffect-powers-lightning-rods-and-.patch similarity index 100% rename from patches/unapplied/server/Fix-strikeLightningEffect-powers-lightning-rods-and-.patch rename to patches/server/Fix-strikeLightningEffect-powers-lightning-rods-and-.patch diff --git a/patches/unapplied/server/Fix-team-sidebar-objectives-not-being-cleared.patch b/patches/server/Fix-team-sidebar-objectives-not-being-cleared.patch similarity index 100% rename from patches/unapplied/server/Fix-team-sidebar-objectives-not-being-cleared.patch rename to patches/server/Fix-team-sidebar-objectives-not-being-cleared.patch diff --git a/patches/unapplied/server/Folia-scheduler-and-owned-region-API.patch b/patches/server/Folia-scheduler-and-owned-region-API.patch similarity index 100% rename from patches/unapplied/server/Folia-scheduler-and-owned-region-API.patch rename to patches/server/Folia-scheduler-and-owned-region-API.patch diff --git a/patches/unapplied/server/Implement-OfflinePlayer-isConnected.patch b/patches/server/Implement-OfflinePlayer-isConnected.patch similarity index 100% rename from patches/unapplied/server/Implement-OfflinePlayer-isConnected.patch rename to patches/server/Implement-OfflinePlayer-isConnected.patch diff --git a/patches/unapplied/server/Implement-PlayerFailMoveEvent.patch b/patches/server/Implement-PlayerFailMoveEvent.patch similarity index 100% rename from patches/unapplied/server/Implement-PlayerFailMoveEvent.patch rename to patches/server/Implement-PlayerFailMoveEvent.patch diff --git a/patches/unapplied/server/Lazily-create-LootContext-for-criterions.patch b/patches/server/Lazily-create-LootContext-for-criterions.patch similarity index 100% rename from patches/unapplied/server/Lazily-create-LootContext-for-criterions.patch rename to patches/server/Lazily-create-LootContext-for-criterions.patch diff --git a/patches/unapplied/server/Make-Amethyst-throw-both-Spread-and-Grow-Events.patch b/patches/server/Make-Amethyst-throw-both-Spread-and-Grow-Events.patch similarity index 100% rename from patches/unapplied/server/Make-Amethyst-throw-both-Spread-and-Grow-Events.patch rename to patches/server/Make-Amethyst-throw-both-Spread-and-Grow-Events.patch diff --git a/patches/unapplied/server/More-DragonBattle-API.patch b/patches/server/More-DragonBattle-API.patch similarity index 100% rename from patches/unapplied/server/More-DragonBattle-API.patch rename to patches/server/More-DragonBattle-API.patch diff --git a/patches/unapplied/server/More-accurate-isInOpenWater-impl.patch b/patches/server/More-accurate-isInOpenWater-impl.patch similarity index 100% rename from patches/unapplied/server/More-accurate-isInOpenWater-impl.patch rename to patches/server/More-accurate-isInOpenWater-impl.patch diff --git a/patches/unapplied/server/Only-capture-actual-tree-growth.patch b/patches/server/Only-capture-actual-tree-growth.patch similarity index 100% rename from patches/unapplied/server/Only-capture-actual-tree-growth.patch rename to patches/server/Only-capture-actual-tree-growth.patch diff --git a/patches/unapplied/server/Only-erase-allay-memory-on-non-item-targets.patch b/patches/server/Only-erase-allay-memory-on-non-item-targets.patch similarity index 100% rename from patches/unapplied/server/Only-erase-allay-memory-on-non-item-targets.patch rename to patches/server/Only-erase-allay-memory-on-non-item-targets.patch diff --git a/patches/unapplied/server/Only-set-despawnTimer-for-Wandering-Traders-spawned-.patch b/patches/server/Only-set-despawnTimer-for-Wandering-Traders-spawned-.patch similarity index 100% rename from patches/unapplied/server/Only-set-despawnTimer-for-Wandering-Traders-spawned-.patch rename to patches/server/Only-set-despawnTimer-for-Wandering-Traders-spawned-.patch diff --git a/patches/unapplied/server/Only-tick-item-frames-if-players-can-see-it.patch b/patches/server/Only-tick-item-frames-if-players-can-see-it.patch similarity index 100% rename from patches/unapplied/server/Only-tick-item-frames-if-players-can-see-it.patch rename to patches/server/Only-tick-item-frames-if-players-can-see-it.patch diff --git a/patches/unapplied/server/Optimize-VarInts.patch b/patches/server/Optimize-VarInts.patch similarity index 100% rename from patches/unapplied/server/Optimize-VarInts.patch rename to patches/server/Optimize-VarInts.patch diff --git a/patches/unapplied/server/Optimize-nearest-structure-border-iteration.patch b/patches/server/Optimize-nearest-structure-border-iteration.patch similarity index 100% rename from patches/unapplied/server/Optimize-nearest-structure-border-iteration.patch rename to patches/server/Optimize-nearest-structure-border-iteration.patch diff --git a/patches/unapplied/server/Optimize-player-lookups-for-beacons.patch b/patches/server/Optimize-player-lookups-for-beacons.patch similarity index 100% rename from patches/unapplied/server/Optimize-player-lookups-for-beacons.patch rename to patches/server/Optimize-player-lookups-for-beacons.patch diff --git a/patches/unapplied/server/Prevent-GameEvents-being-fired-from-unloaded-chunks.patch b/patches/server/Prevent-GameEvents-being-fired-from-unloaded-chunks.patch similarity index 100% rename from patches/unapplied/server/Prevent-GameEvents-being-fired-from-unloaded-chunks.patch rename to patches/server/Prevent-GameEvents-being-fired-from-unloaded-chunks.patch diff --git a/patches/unapplied/server/Prevent-causing-expired-keys-from-impacting-new-join.patch b/patches/server/Prevent-causing-expired-keys-from-impacting-new-join.patch similarity index 95% rename from patches/unapplied/server/Prevent-causing-expired-keys-from-impacting-new-join.patch rename to patches/server/Prevent-causing-expired-keys-from-impacting-new-join.patch index 46af8940cc..96a56c514e 100644 --- a/patches/unapplied/server/Prevent-causing-expired-keys-from-impacting-new-join.patch +++ b/patches/server/Prevent-causing-expired-keys-from-impacting-new-join.patch @@ -38,7 +38,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 private final LastSeenMessagesValidator lastSeenMessages = new LastSeenMessagesValidator(20); private final MessageSignatureCache messageSignatureCache = MessageSignatureCache.createDefault(); @@ -0,0 +0,0 @@ public class ServerGamePacketListenerImpl extends ServerCommonPacketListenerImpl - this.disconnect(Component.translatable("multiplayer.disconnect.idling"), org.bukkit.event.player.PlayerKickEvent.Cause.IDLING); // Paper - kick event cause + this.disconnect((Component) Component.translatable("multiplayer.disconnect.idling"), org.bukkit.event.player.PlayerKickEvent.Cause.IDLING); // Paper - kick event cause } + // Paper start - Prevent causing expired keys from impacting new joins diff --git a/patches/unapplied/server/Properly-handle-BlockBreakEvent-isDropItems.patch b/patches/server/Properly-handle-BlockBreakEvent-isDropItems.patch similarity index 99% rename from patches/unapplied/server/Properly-handle-BlockBreakEvent-isDropItems.patch rename to patches/server/Properly-handle-BlockBreakEvent-isDropItems.patch index e9e6cb86b3..071f4ecb43 100644 --- a/patches/unapplied/server/Properly-handle-BlockBreakEvent-isDropItems.patch +++ b/patches/server/Properly-handle-BlockBreakEvent-isDropItems.patch @@ -36,7 +36,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 + public void playerDestroy(Level world, Player player, BlockPos pos, BlockState state, @Nullable BlockEntity blockEntity, ItemStack tool, boolean includeDrops, boolean dropExp) { // Paper - fix drops not preventing stats/food exhaustion + super.playerDestroy(world, player, pos, state, blockEntity, tool, includeDrops, dropExp); // Paper - fix drops not preventing stats/food exhaustion if (!world.isClientSide && blockEntity instanceof BeehiveBlockEntity tileentitybeehive) { - if (EnchantmentHelper.getItemEnchantmentLevel(Enchantments.SILK_TOUCH, tool) == 0) { + if (!EnchantmentHelper.hasTag(tool, EnchantmentTags.PREVENTS_BEE_SPAWNS_WHEN_MINING)) { tileentitybeehive.emptyAllLivingFromHive(player, state, BeehiveBlockEntity.BeeReleaseStatus.EMERGENCY); diff --git a/src/main/java/net/minecraft/world/level/block/Block.java b/src/main/java/net/minecraft/world/level/block/Block.java index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 diff --git a/patches/unapplied/server/Refresh-ProjectileSource-for-projectiles.patch b/patches/server/Refresh-ProjectileSource-for-projectiles.patch similarity index 100% rename from patches/unapplied/server/Refresh-ProjectileSource-for-projectiles.patch rename to patches/server/Refresh-ProjectileSource-for-projectiles.patch diff --git a/patches/unapplied/server/Remove-UpgradeData-neighbour-ticks-outside-of-range.patch b/patches/server/Remove-UpgradeData-neighbour-ticks-outside-of-range.patch similarity index 100% rename from patches/unapplied/server/Remove-UpgradeData-neighbour-ticks-outside-of-range.patch rename to patches/server/Remove-UpgradeData-neighbour-ticks-outside-of-range.patch diff --git a/patches/unapplied/server/Respect-randomizeData-on-more-entities-when-spawning.patch b/patches/server/Respect-randomizeData-on-more-entities-when-spawning.patch similarity index 98% rename from patches/unapplied/server/Respect-randomizeData-on-more-entities-when-spawning.patch rename to patches/server/Respect-randomizeData-on-more-entities-when-spawning.patch index a19d9941ad..2172922f80 100644 --- a/patches/unapplied/server/Respect-randomizeData-on-more-entities-when-spawning.patch +++ b/patches/server/Respect-randomizeData-on-more-entities-when-spawning.patch @@ -13,7 +13,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 --- a/src/main/java/org/bukkit/craftbukkit/entity/CraftEntityTypes.java +++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftEntityTypes.java @@ -0,0 +0,0 @@ public final class CraftEntityTypes { - entity.assignPower(direction.getX(), direction.getY(), direction.getZ()); + entity.assignDirectionalMovement(new Vec3(direction.getX(), direction.getY(), direction.getZ()), 1.0); }; private static final BiConsumer ROT = (spawnData, entity) -> entity.setRot(spawnData.yaw(), spawnData.pitch()); // Paper + // Paper start - respect randomizeData diff --git a/patches/unapplied/server/Restore-vanilla-entity-drops-behavior.patch b/patches/server/Restore-vanilla-entity-drops-behavior.patch similarity index 94% rename from patches/unapplied/server/Restore-vanilla-entity-drops-behavior.patch rename to patches/server/Restore-vanilla-entity-drops-behavior.patch index 643d8f5b20..73e7ff1a12 100644 --- a/patches/unapplied/server/Restore-vanilla-entity-drops-behavior.patch +++ b/patches/server/Restore-vanilla-entity-drops-behavior.patch @@ -12,7 +12,7 @@ diff --git a/src/main/java/net/minecraft/server/level/ServerPlayer.java b/src/ma index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 --- a/src/main/java/net/minecraft/server/level/ServerPlayer.java +++ b/src/main/java/net/minecraft/server/level/ServerPlayer.java -@@ -0,0 +0,0 @@ public class ServerPlayer extends Player { +@@ -0,0 +0,0 @@ public class ServerPlayer extends net.minecraft.world.entity.player.Player { if (this.isRemoved()) { return; } @@ -22,7 +22,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 if (!keepInventory) { for (ItemStack item : this.getInventory().getContents()) { - if (!item.isEmpty() && !EnchantmentHelper.hasVanishingCurse(item)) { + if (!item.isEmpty() && EnchantmentHelper.has(item, EnchantmentEffectComponents.PREVENT_EQUIPMENT_DROP)) { - loot.add(CraftItemStack.asCraftMirror(item)); + loot.add(new DefaultDrop(item, stack -> this.drop(stack, true, false, false))); // Paper - Restore vanilla drops behavior; drop function taken from Inventory#dropAll (don't fire drop event) } @@ -38,7 +38,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 this.drops.clear(); // SPIGOT-5188: make sure to clear } // Paper - fix player loottables running when mob loot gamerule is false -@@ -0,0 +0,0 @@ public class ServerPlayer extends Player { +@@ -0,0 +0,0 @@ public class ServerPlayer extends net.minecraft.world.entity.player.Player { } @Override @@ -108,9 +108,9 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 --- a/src/main/java/net/minecraft/world/entity/LivingEntity.java +++ b/src/main/java/net/minecraft/world/entity/LivingEntity.java @@ -0,0 +0,0 @@ public abstract class LivingEntity extends Entity implements Attackable { + protected float appliedScale; // CraftBukkit start public int expToDrop; - public boolean forceDrops; - public ArrayList drops = new ArrayList(); + public ArrayList drops = new ArrayList<>(); // Paper - Restore vanilla drops behavior public final org.bukkit.craftbukkit.attribute.CraftAttributeMap craftAttributes; @@ -122,11 +122,11 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 +++ b/src/main/java/net/minecraft/world/entity/boss/wither/WitherBoss.java @@ -0,0 +0,0 @@ public class WitherBoss extends Monster implements PowerableMob, RangedAttackMob @Override - protected void dropCustomDeathLoot(DamageSource source, int lootingMultiplier, boolean allowDrops) { - super.dropCustomDeathLoot(source, lootingMultiplier, allowDrops); + protected void dropCustomDeathLoot(ServerLevel world, DamageSource source, boolean causedByPlayer) { + super.dropCustomDeathLoot(world, source, causedByPlayer); - ItemEntity entityitem = this.spawnAtLocation((ItemLike) Items.NETHER_STAR); +- + ItemEntity entityitem = this.spawnAtLocation(new net.minecraft.world.item.ItemStack(Items.NETHER_STAR), 0, ItemEntity::setExtendedLifetime); // Paper - Restore vanilla drops behavior; spawnAtLocation returns null so modify the item entity with a consumer - if (entityitem != null) { - entityitem.setExtendedLifetime(); + entityitem.setExtendedLifetime(); // Paper - diff on change @@ -143,7 +143,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 itemstack.set(DataComponents.CUSTOM_NAME, this.getCustomName()); - this.drops.add(org.bukkit.craftbukkit.inventory.CraftItemStack.asBukkitCopy(itemstack)); // CraftBukkit - add to drops + this.drops.add(new DefaultDrop(itemstack, stack -> Block.popResource(this.level(), this.blockPosition(), stack))); // CraftBukkit - add to drops // Paper - Restore vanilla drops behavior - return this.brokenByAnything(damageSource); // Paper + return this.brokenByAnything(world, damageSource); // Paper } @@ -0,0 +0,0 @@ public class ArmorStand extends LivingEntity { @@ -192,8 +192,8 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 // Paper end CraftLivingEntity entity = (CraftLivingEntity) victim.getBukkitEntity(); CraftDamageSource bukkitDamageSource = new CraftDamageSource(damageSource); -- EntityDeathEvent event = new EntityDeathEvent(entity, bukkitDamageSource, drops, victim.getExpReward()); -+ EntityDeathEvent event = new EntityDeathEvent(entity, bukkitDamageSource, new io.papermc.paper.util.TransformingRandomAccessList<>(drops, Entity.DefaultDrop::stack, FROM_FUNCTION), victim.getExpReward()); // Paper - Restore vanilla drops behavior +- EntityDeathEvent event = new EntityDeathEvent(entity, bukkitDamageSource, drops, victim.getExpReward(damageSource.getEntity())); ++ EntityDeathEvent event = new EntityDeathEvent(entity, bukkitDamageSource, new io.papermc.paper.util.TransformingRandomAccessList<>(drops, Entity.DefaultDrop::stack, FROM_FUNCTION), victim.getExpReward(damageSource.getEntity())); // Paper - Restore vanilla drops behavior populateFields(victim, event); // Paper - make cancellable CraftWorld world = (CraftWorld) entity.getWorld(); Bukkit.getServer().getPluginManager().callEvent(event); @@ -221,8 +221,8 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 + public static PlayerDeathEvent callPlayerDeathEvent(ServerPlayer victim, DamageSource damageSource, List drops, net.kyori.adventure.text.Component deathMessage, boolean keepInventory) { // Paper - Adventure & Restore vanilla drops behavior CraftPlayer entity = victim.getBukkitEntity(); CraftDamageSource bukkitDamageSource = new CraftDamageSource(damageSource); -- PlayerDeathEvent event = new PlayerDeathEvent(entity, bukkitDamageSource, drops, victim.getExpReward(), 0, deathMessage); -+ PlayerDeathEvent event = new PlayerDeathEvent(entity, bukkitDamageSource, new io.papermc.paper.util.TransformingRandomAccessList<>(drops, Entity.DefaultDrop::stack, FROM_FUNCTION), victim.getExpReward(), 0, deathMessage); // Paper - Restore vanilla drops behavior +- PlayerDeathEvent event = new PlayerDeathEvent(entity, bukkitDamageSource, drops, victim.getExpReward(damageSource.getEntity()), 0, deathMessage); ++ PlayerDeathEvent event = new PlayerDeathEvent(entity, bukkitDamageSource, new io.papermc.paper.util.TransformingRandomAccessList<>(drops, Entity.DefaultDrop::stack, FROM_FUNCTION), victim.getExpReward(damageSource.getEntity()), 0, deathMessage); // Paper - Restore vanilla drops behavior event.setKeepInventory(keepInventory); event.setKeepLevel(victim.keepLevel); // SPIGOT-2222: pre-set keepLevel populateFields(victim, event); // Paper - make cancellable diff --git a/patches/unapplied/server/SculkCatalyst-bloom-API.patch b/patches/server/SculkCatalyst-bloom-API.patch similarity index 100% rename from patches/unapplied/server/SculkCatalyst-bloom-API.patch rename to patches/server/SculkCatalyst-bloom-API.patch diff --git a/patches/unapplied/server/Skip-POI-finding-if-stuck-in-vehicle.patch b/patches/server/Skip-POI-finding-if-stuck-in-vehicle.patch similarity index 100% rename from patches/unapplied/server/Skip-POI-finding-if-stuck-in-vehicle.patch rename to patches/server/Skip-POI-finding-if-stuck-in-vehicle.patch diff --git a/patches/unapplied/server/Update-entity-data-when-attaching-firework-to-entity.patch b/patches/server/Update-entity-data-when-attaching-firework-to-entity.patch similarity index 100% rename from patches/unapplied/server/Update-entity-data-when-attaching-firework-to-entity.patch rename to patches/server/Update-entity-data-when-attaching-firework-to-entity.patch diff --git a/patches/unapplied/server/Use-array-for-gamerule-storage.patch b/patches/server/Use-array-for-gamerule-storage.patch similarity index 100% rename from patches/unapplied/server/Use-array-for-gamerule-storage.patch rename to patches/server/Use-array-for-gamerule-storage.patch diff --git a/patches/unapplied/server/Use-correct-seed-on-api-world-load.patch b/patches/server/Use-correct-seed-on-api-world-load.patch similarity index 100% rename from patches/unapplied/server/Use-correct-seed-on-api-world-load.patch rename to patches/server/Use-correct-seed-on-api-world-load.patch diff --git a/patches/unapplied/server/Use-correct-source-for-mushroom-block-spread-event.patch b/patches/server/Use-correct-source-for-mushroom-block-spread-event.patch similarity index 100% rename from patches/unapplied/server/Use-correct-source-for-mushroom-block-spread-event.patch rename to patches/server/Use-correct-source-for-mushroom-block-spread-event.patch diff --git a/patches/unapplied/server/fix-MapLike-spam-for-missing-key-selector.patch b/patches/server/fix-MapLike-spam-for-missing-key-selector.patch similarity index 100% rename from patches/unapplied/server/fix-MapLike-spam-for-missing-key-selector.patch rename to patches/server/fix-MapLike-spam-for-missing-key-selector.patch diff --git a/patches/unapplied/server/fix-item-meta-for-tadpole-buckets.patch b/patches/server/fix-item-meta-for-tadpole-buckets.patch similarity index 100% rename from patches/unapplied/server/fix-item-meta-for-tadpole-buckets.patch rename to patches/server/fix-item-meta-for-tadpole-buckets.patch diff --git a/patches/unapplied/server/remove-duplicate-animate-packet-for-records.patch b/patches/unapplied/server/remove-duplicate-animate-packet-for-records.patch deleted file mode 100644 index 3b3150f0a5..0000000000 --- a/patches/unapplied/server/remove-duplicate-animate-packet-for-records.patch +++ /dev/null @@ -1,19 +0,0 @@ -From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 -From: Jake Potrebic -Date: Thu, 1 Dec 2022 12:42:18 -0800 -Subject: [PATCH] remove duplicate animate packet for records - - -diff --git a/src/main/java/net/minecraft/world/item/RecordItem.java b/src/main/java/net/minecraft/world/item/RecordItem.java -index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 ---- a/src/main/java/net/minecraft/world/item/RecordItem.java -+++ b/src/main/java/net/minecraft/world/item/RecordItem.java -@@ -0,0 +0,0 @@ public class RecordItem extends Item { - ItemStack itemstack = context.getItemInHand(); - - if (!world.isClientSide) { -- if (true) return InteractionResult.SUCCESS; // CraftBukkit - handled in ItemStack -+ if (true) return InteractionResult.sidedSuccess(world.isClientSide); // CraftBukkit - handled in ItemStack // Paper - fix duplicate animate packet - Player entityhuman = context.getPlayer(); - BlockEntity tileentity = world.getBlockEntity(blockposition); -