From f5177aa12138b4341241c73aab85782f2512ba58 Mon Sep 17 00:00:00 2001 From: Bjarne Koll Date: Wed, 23 Oct 2024 17:58:11 +0200 Subject: [PATCH] Some more work --- .../0451-Fix-harming-potion-dupe.patch | 0 .../0445-Add-TargetHitEvent.patch} | 0 .../0446-MC-4-Fix-item-position-desync.patch} | 4 +-- .../0447-Additional-Block-Material-API.patch} | 2 +- ...t-Material-from-Boats-and-Minecarts.patch} | 4 +-- ...ob-spawner-spawn-egg-transformation.patch} | 4 +-- ...ix-Not-a-string-Map-Conversion-spam.patch} | 23 +++++---------- ...-Add-PlayerFlowerPotManipulateEvent.patch} | 8 +++--- ...ct-event-not-being-called-sometimes.patch} | 18 ++++++------ .../0453-Zombie-API-breaking-doors.patch} | 0 ...0454-Fix-nerfed-slime-when-splitting.patch | 18 ++++++++++++ .../0455-Add-EntityLoadCrossbowEvent.patch} | 14 +++++----- .../0456-Add-WorldGameRuleChangeEvent.patch} | 28 ++++++++++--------- ...57-Add-ServerResourcesReloadedEvent.patch} | 8 +++--- ...d-settings-for-mobs-picking-up-loot.patch} | 18 ++++++------ .../0459-Add-BlockFailedDispenseEvent.patch} | 8 +++--- ...60-Add-PlayerLecternPageChangeEvent.patch} | 0 ...61-Add-PlayerLoomPatternSelectEvent.patch} | 4 +-- ...nfigurable-door-breaking-difficulty.patch} | 8 +++--- ...ty-commands-shall-not-be-dispatched.patch} | 4 +-- ...0458-Fix-nerfed-slime-when-splitting.patch | 18 ------------ 21 files changed, 92 insertions(+), 99 deletions(-) rename patches/{unapplied/server => later}/0451-Fix-harming-potion-dupe.patch (100%) rename patches/{unapplied/server/0448-Add-TargetHitEvent.patch => server/0445-Add-TargetHitEvent.patch} (100%) rename patches/{unapplied/server/0449-MC-4-Fix-item-position-desync.patch => server/0446-MC-4-Fix-item-position-desync.patch} (93%) rename patches/{unapplied/server/0450-Additional-Block-Material-API.patch => server/0447-Additional-Block-Material-API.patch} (93%) rename patches/{unapplied/server/0452-API-to-get-Material-from-Boats-and-Minecarts.patch => server/0448-API-to-get-Material-from-Boats-and-Minecarts.patch} (93%) rename patches/{unapplied/server/0453-Allow-disabling-mob-spawner-spawn-egg-transformation.patch => server/0449-Allow-disabling-mob-spawner-spawn-egg-transformation.patch} (84%) rename patches/{unapplied/server/0454-Fix-Not-a-string-Map-Conversion-spam.patch => server/0450-Fix-Not-a-string-Map-Conversion-spam.patch} (65%) rename patches/{unapplied/server/0455-Add-PlayerFlowerPotManipulateEvent.patch => server/0451-Add-PlayerFlowerPotManipulateEvent.patch} (90%) rename patches/{unapplied/server/0456-Fix-interact-event-not-being-called-sometimes.patch => server/0452-Fix-interact-event-not-being-called-sometimes.patch} (80%) rename patches/{unapplied/server/0457-Zombie-API-breaking-doors.patch => server/0453-Zombie-API-breaking-doors.patch} (100%) create mode 100644 patches/server/0454-Fix-nerfed-slime-when-splitting.patch rename patches/{unapplied/server/0459-Add-EntityLoadCrossbowEvent.patch => server/0455-Add-EntityLoadCrossbowEvent.patch} (87%) rename patches/{unapplied/server/0460-Add-WorldGameRuleChangeEvent.patch => server/0456-Add-WorldGameRuleChangeEvent.patch} (86%) rename patches/{unapplied/server/0461-Add-ServerResourcesReloadedEvent.patch => server/0457-Add-ServerResourcesReloadedEvent.patch} (90%) rename patches/{unapplied/server/0462-Add-world-settings-for-mobs-picking-up-loot.patch => server/0458-Add-world-settings-for-mobs-picking-up-loot.patch} (68%) rename patches/{unapplied/server/0463-Add-BlockFailedDispenseEvent.patch => server/0459-Add-BlockFailedDispenseEvent.patch} (89%) rename patches/{unapplied/server/0464-Add-PlayerLecternPageChangeEvent.patch => server/0460-Add-PlayerLecternPageChangeEvent.patch} (100%) rename patches/{unapplied/server/0465-Add-PlayerLoomPatternSelectEvent.patch => server/0461-Add-PlayerLoomPatternSelectEvent.patch} (94%) rename patches/{unapplied/server/0466-Configurable-door-breaking-difficulty.patch => server/0462-Configurable-door-breaking-difficulty.patch} (86%) rename patches/{unapplied/server/0467-Empty-commands-shall-not-be-dispatched.patch => server/0463-Empty-commands-shall-not-be-dispatched.patch} (84%) delete mode 100644 patches/unapplied/server/0458-Fix-nerfed-slime-when-splitting.patch diff --git a/patches/unapplied/server/0451-Fix-harming-potion-dupe.patch b/patches/later/0451-Fix-harming-potion-dupe.patch similarity index 100% rename from patches/unapplied/server/0451-Fix-harming-potion-dupe.patch rename to patches/later/0451-Fix-harming-potion-dupe.patch diff --git a/patches/unapplied/server/0448-Add-TargetHitEvent.patch b/patches/server/0445-Add-TargetHitEvent.patch similarity index 100% rename from patches/unapplied/server/0448-Add-TargetHitEvent.patch rename to patches/server/0445-Add-TargetHitEvent.patch diff --git a/patches/unapplied/server/0449-MC-4-Fix-item-position-desync.patch b/patches/server/0446-MC-4-Fix-item-position-desync.patch similarity index 93% rename from patches/unapplied/server/0449-MC-4-Fix-item-position-desync.patch rename to patches/server/0446-MC-4-Fix-item-position-desync.patch index 3f4003c4f5..26cf19c2b6 100644 --- a/patches/unapplied/server/0449-MC-4-Fix-item-position-desync.patch +++ b/patches/server/0446-MC-4-Fix-item-position-desync.patch @@ -28,10 +28,10 @@ index 488ebd443903af812913437f1ade3002093f2470..a043ac10834562d357ef0b5aded2e916 public Vec3 decode(long x, long y, long z) { diff --git a/src/main/java/net/minecraft/world/entity/Entity.java b/src/main/java/net/minecraft/world/entity/Entity.java -index dae7643897b47dba304cbea56112445df2736cff..bed376337035545e7ec677f2f7fe3372a3c9ea25 100644 +index 25f625e28c8c9f63a1b2207d5e8d1a48e2fea039..ad34a525f54a157140323a26752a420a8e348a55 100644 --- a/src/main/java/net/minecraft/world/entity/Entity.java +++ b/src/main/java/net/minecraft/world/entity/Entity.java -@@ -4260,6 +4260,16 @@ public abstract class Entity implements SyncedDataHolder, Nameable, EntityAccess +@@ -4449,6 +4449,16 @@ public abstract class Entity implements SyncedDataHolder, Nameable, EntityAccess return; } // Paper end - Block invalid positions and bounding box diff --git a/patches/unapplied/server/0450-Additional-Block-Material-API.patch b/patches/server/0447-Additional-Block-Material-API.patch similarity index 93% rename from patches/unapplied/server/0450-Additional-Block-Material-API.patch rename to patches/server/0447-Additional-Block-Material-API.patch index 81728edf48..19f5b4b7ef 100644 --- a/patches/unapplied/server/0450-Additional-Block-Material-API.patch +++ b/patches/server/0447-Additional-Block-Material-API.patch @@ -9,7 +9,7 @@ process to do this in the Bukkit API Adds API for buildable, replaceable, burnable too. diff --git a/src/main/java/org/bukkit/craftbukkit/block/CraftBlock.java b/src/main/java/org/bukkit/craftbukkit/block/CraftBlock.java -index aa644231425b9622437538b5c092d4064a40cced..98e87dc15e2ed23f6897ba6359846ff5bc32b655 100644 +index 5f4dcf6d86db66186dc31075bdb739f5dbae6480..1595e877b02b447b36f5c316ae70d4023b78a862 100644 --- a/src/main/java/org/bukkit/craftbukkit/block/CraftBlock.java +++ b/src/main/java/org/bukkit/craftbukkit/block/CraftBlock.java @@ -440,6 +440,25 @@ public class CraftBlock implements Block { diff --git a/patches/unapplied/server/0452-API-to-get-Material-from-Boats-and-Minecarts.patch b/patches/server/0448-API-to-get-Material-from-Boats-and-Minecarts.patch similarity index 93% rename from patches/unapplied/server/0452-API-to-get-Material-from-Boats-and-Minecarts.patch rename to patches/server/0448-API-to-get-Material-from-Boats-and-Minecarts.patch index 9bcb17ad14..8462025bf8 100644 --- a/patches/unapplied/server/0452-API-to-get-Material-from-Boats-and-Minecarts.patch +++ b/patches/server/0448-API-to-get-Material-from-Boats-and-Minecarts.patch @@ -5,10 +5,10 @@ Subject: [PATCH] API to get Material from Boats and Minecarts diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftBoat.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftBoat.java -index f332bd4e6f663147c9ef6ce03d926feb74b55e93..d161cbf9c83cd78593864850b98f688da2c85aa5 100644 +index eaa46bf5954ed7c2be6d4b3772b5f2e971505c78..5de1ada561d11c247a597effab1e0aa363b7c90f 100644 --- a/src/main/java/org/bukkit/craftbukkit/entity/CraftBoat.java +++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftBoat.java -@@ -79,6 +79,13 @@ public class CraftBoat extends CraftVehicle implements Boat { +@@ -78,6 +78,13 @@ public abstract class CraftBoat extends CraftVehicle implements Boat { this.getHandle().landBoats = workOnLand; } diff --git a/patches/unapplied/server/0453-Allow-disabling-mob-spawner-spawn-egg-transformation.patch b/patches/server/0449-Allow-disabling-mob-spawner-spawn-egg-transformation.patch similarity index 84% rename from patches/unapplied/server/0453-Allow-disabling-mob-spawner-spawn-egg-transformation.patch rename to patches/server/0449-Allow-disabling-mob-spawner-spawn-egg-transformation.patch index da8441444c..893e6ffe60 100644 --- a/patches/unapplied/server/0453-Allow-disabling-mob-spawner-spawn-egg-transformation.patch +++ b/patches/server/0449-Allow-disabling-mob-spawner-spawn-egg-transformation.patch @@ -5,10 +5,10 @@ Subject: [PATCH] Allow disabling mob spawner spawn egg transformation diff --git a/src/main/java/net/minecraft/world/item/SpawnEggItem.java b/src/main/java/net/minecraft/world/item/SpawnEggItem.java -index 6e91fec416493b2fabe1e8a6214ab7673212e451..9cea8da84f39bb3f687139ef213ccea358724dee 100644 +index ac35651e4f415243a0f84cca9a4f776b1f1623a5..9956ed42df55daa6d97fd6e3ab5368dad91cfaf0 100644 --- a/src/main/java/net/minecraft/world/item/SpawnEggItem.java +++ b/src/main/java/net/minecraft/world/item/SpawnEggItem.java -@@ -69,6 +69,8 @@ public class SpawnEggItem extends Item { +@@ -68,6 +68,8 @@ public class SpawnEggItem extends Item { EntityType entitytypes; if (tileentity instanceof Spawner) { diff --git a/patches/unapplied/server/0454-Fix-Not-a-string-Map-Conversion-spam.patch b/patches/server/0450-Fix-Not-a-string-Map-Conversion-spam.patch similarity index 65% rename from patches/unapplied/server/0454-Fix-Not-a-string-Map-Conversion-spam.patch rename to patches/server/0450-Fix-Not-a-string-Map-Conversion-spam.patch index 5b2328afe8..8952de7633 100644 --- a/patches/unapplied/server/0454-Fix-Not-a-string-Map-Conversion-spam.patch +++ b/patches/server/0450-Fix-Not-a-string-Map-Conversion-spam.patch @@ -12,26 +12,17 @@ requesting the world. Track spigot issue to see when fixed: https://hub.spigotmc.org/jira/browse/SPIGOT-6181 diff --git a/src/main/java/net/minecraft/world/level/saveddata/maps/MapItemSavedData.java b/src/main/java/net/minecraft/world/level/saveddata/maps/MapItemSavedData.java -index 5e469bd4d9ca428abdd9d758993164635dc86f27..d6a0a882331226c3ae4ced09e449eb7931740f8f 100644 +index c21ae4975206398e7d20b37a749b830b9219c746..a89f0b652c515efbc24ffc9af47fa65082946e54 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 -@@ -21,6 +21,8 @@ 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; -@@ -121,7 +123,26 @@ public class MapItemSavedData extends SavedData { +@@ -123,7 +123,26 @@ public class MapItemSavedData extends SavedData { } - public static MapItemSavedData load(CompoundTag nbt, HolderLookup.Provider registryLookup) { + public static MapItemSavedData load(CompoundTag nbt, HolderLookup.Provider registries) { - 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"); -+ if (dimension instanceof NumericTag && ((NumericTag) dimension).getAsInt() >= CraftWorld.CUSTOM_DIMENSION_OFFSET) { ++ if (dimension instanceof final net.minecraft.nbt.NumericTag numericTag && numericTag.getAsInt() >= CraftWorld.CUSTOM_DIMENSION_OFFSET) { + long least = nbt.getLong("UUIDLeast"); + long most = nbt.getLong("UUIDMost"); + @@ -39,12 +30,12 @@ index 5e469bd4d9ca428abdd9d758993164635dc86f27..d6a0a882331226c3ae4ced09e449eb79 + UUID uuid = new UUID(most, least); + CraftWorld world = (CraftWorld) Bukkit.getWorld(uuid); + if (world != null) { -+ dimension = StringTag.valueOf("minecraft:" + world.getName().toLowerCase(java.util.Locale.ENGLISH)); ++ dimension = net.minecraft.nbt.StringTag.valueOf("minecraft:" + world.getName().toLowerCase(java.util.Locale.ENGLISH)); + } else { -+ dimension = StringTag.valueOf("bukkit:_invalidworld_"); ++ dimension = net.minecraft.nbt.StringTag.valueOf("bukkit:_invalidworld_"); + } + } else { -+ dimension = StringTag.valueOf("bukkit:_invalidworld_"); ++ dimension = net.minecraft.nbt.StringTag.valueOf("bukkit:_invalidworld_"); + } + } + DataResult> dataresult = DimensionType.parseLegacy(new Dynamic(NbtOps.INSTANCE, dimension)); // CraftBukkit - decompile error diff --git a/patches/unapplied/server/0455-Add-PlayerFlowerPotManipulateEvent.patch b/patches/server/0451-Add-PlayerFlowerPotManipulateEvent.patch similarity index 90% rename from patches/unapplied/server/0455-Add-PlayerFlowerPotManipulateEvent.patch rename to patches/server/0451-Add-PlayerFlowerPotManipulateEvent.patch index 8b61833059..aa78c43c60 100644 --- a/patches/unapplied/server/0455-Add-PlayerFlowerPotManipulateEvent.patch +++ b/patches/server/0451-Add-PlayerFlowerPotManipulateEvent.patch @@ -5,12 +5,12 @@ Subject: [PATCH] Add PlayerFlowerPotManipulateEvent diff --git a/src/main/java/net/minecraft/world/level/block/FlowerPotBlock.java b/src/main/java/net/minecraft/world/level/block/FlowerPotBlock.java -index b0c950fa7426dc762b99080d98831b961fc19da2..7194565ad1a910fe300d8664a30b35c4eff18cb7 100644 +index c6de1b6587b300404c38c27f566c80de11bc0814..863eec736b4941930c62ca357703a56d4d21c950 100644 --- a/src/main/java/net/minecraft/world/level/block/FlowerPotBlock.java +++ b/src/main/java/net/minecraft/world/level/block/FlowerPotBlock.java -@@ -63,6 +63,18 @@ public class FlowerPotBlock extends Block { +@@ -61,6 +61,18 @@ public class FlowerPotBlock extends Block { } else if (!this.isEmpty()) { - return ItemInteractionResult.CONSUME; + return InteractionResult.CONSUME; } else { + // Paper start - Add PlayerFlowerPotManipulateEvent + org.bukkit.block.Block block = org.bukkit.craftbukkit.block.CraftBlock.at(world, pos); @@ -27,7 +27,7 @@ index b0c950fa7426dc762b99080d98831b961fc19da2..7194565ad1a910fe300d8664a30b35c4 world.setBlock(pos, blockState, 3); world.gameEvent(player, GameEvent.BLOCK_CHANGE, pos); player.awardStat(Stats.POT_FLOWER); -@@ -77,6 +89,18 @@ public class FlowerPotBlock extends Block { +@@ -75,6 +87,18 @@ public class FlowerPotBlock extends Block { return InteractionResult.CONSUME; } else { ItemStack itemStack = new ItemStack(this.potted); diff --git a/patches/unapplied/server/0456-Fix-interact-event-not-being-called-sometimes.patch b/patches/server/0452-Fix-interact-event-not-being-called-sometimes.patch similarity index 80% rename from patches/unapplied/server/0456-Fix-interact-event-not-being-called-sometimes.patch rename to patches/server/0452-Fix-interact-event-not-being-called-sometimes.patch index fc4bcdc2d1..9aa0d988fa 100644 --- a/patches/unapplied/server/0456-Fix-interact-event-not-being-called-sometimes.patch +++ b/patches/server/0452-Fix-interact-event-not-being-called-sometimes.patch @@ -11,19 +11,19 @@ Subject: [PATCH] Fix interact event not being called sometimes Co-authored-by: Moulberry diff --git a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java -index 57063f01993445a9965976332306c7f2ab20ed1f..d7d36b5148f2e7280816cc70b300b9b10720f751 100644 +index b61cb778196a31df2139deb31dfd924abc6e5d1c..0c413f4981038c5c3f12ba17309ce354c3f13ec6 100644 --- a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java +++ b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java -@@ -1770,7 +1770,7 @@ public class ServerGamePacketListenerImpl extends ServerCommonPacketListenerImpl - MutableComponent ichatmutablecomponent = Component.translatable("build.tooHigh", i - 1).withStyle(ChatFormatting.RED); +@@ -1777,7 +1777,7 @@ public class ServerGamePacketListenerImpl extends ServerCommonPacketListenerImpl + } else if (enuminteractionresult instanceof InteractionResult.Success) { + InteractionResult.Success enuminteractionresult_d = (InteractionResult.Success) enuminteractionresult; - this.player.sendSystemMessage(ichatmutablecomponent, true); -- } else if (enuminteractionresult.shouldSwing()) { -+ } else if (enuminteractionresult.shouldSwing() && !this.player.gameMode.interactResult) { // Paper - Call interact event - this.player.swing(enumhand, true); +- if (enuminteractionresult_d.swingSource() == InteractionResult.SwingSource.SERVER) { ++ if (enuminteractionresult_d.swingSource() == InteractionResult.SwingSource.SERVER && !this.player.gameMode.interactResult) { + this.player.swing(enumhand, true); + } } - } -@@ -2391,13 +2391,20 @@ public class ServerGamePacketListenerImpl extends ServerCommonPacketListenerImpl +@@ -2401,13 +2401,20 @@ public class ServerGamePacketListenerImpl extends ServerCommonPacketListenerImpl double d3 = Math.max(this.player.blockInteractionRange(), this.player.entityInteractionRange()); // SPIGOT-5607: Only call interact event if no block or entity is being clicked. Use bukkit ray trace method, because it handles blocks and entities at the same time // SPIGOT-7429: Make sure to call PlayerInteractEvent for spectators and non-pickable entities diff --git a/patches/unapplied/server/0457-Zombie-API-breaking-doors.patch b/patches/server/0453-Zombie-API-breaking-doors.patch similarity index 100% rename from patches/unapplied/server/0457-Zombie-API-breaking-doors.patch rename to patches/server/0453-Zombie-API-breaking-doors.patch diff --git a/patches/server/0454-Fix-nerfed-slime-when-splitting.patch b/patches/server/0454-Fix-nerfed-slime-when-splitting.patch new file mode 100644 index 0000000000..c35358b895 --- /dev/null +++ b/patches/server/0454-Fix-nerfed-slime-when-splitting.patch @@ -0,0 +1,18 @@ +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: Jake Potrebic +Date: Mon, 24 Aug 2020 08:39:06 -0700 +Subject: [PATCH] Fix nerfed slime when splitting + + +diff --git a/src/main/java/net/minecraft/world/entity/monster/Slime.java b/src/main/java/net/minecraft/world/entity/monster/Slime.java +index 26f4db572dc6c25a9815b8f352d8829e252fa1a2..129f0cbc0469cb2804db6088b53347d88d91f4eb 100644 +--- a/src/main/java/net/minecraft/world/entity/monster/Slime.java ++++ b/src/main/java/net/minecraft/world/entity/monster/Slime.java +@@ -250,6 +250,7 @@ public class Slime extends Mob implements Enemy { + float f3 = ((float) (l / 2) - 0.5F) * f1; + + Slime converted = this.convertTo(this.getType(), new ConversionParams(ConversionType.SPLIT_ON_DEATH, false, false, scoreboardteam), EntitySpawnReason.TRIGGERED, (entityslime) -> { // CraftBukkit ++ entityslime.aware = this.aware; // Paper - Fix nerfed slime when splitting + entityslime.setSize(j, true); + entityslime.moveTo(this.getX() + (double) f2, this.getY() + 0.5D, this.getZ() + (double) f3, this.random.nextFloat() * 360.0F, 0.0F); + // CraftBukkit start diff --git a/patches/unapplied/server/0459-Add-EntityLoadCrossbowEvent.patch b/patches/server/0455-Add-EntityLoadCrossbowEvent.patch similarity index 87% rename from patches/unapplied/server/0459-Add-EntityLoadCrossbowEvent.patch rename to patches/server/0455-Add-EntityLoadCrossbowEvent.patch index a2f95139f8..72ec5141a0 100644 --- a/patches/unapplied/server/0459-Add-EntityLoadCrossbowEvent.patch +++ b/patches/server/0455-Add-EntityLoadCrossbowEvent.patch @@ -5,11 +5,11 @@ 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 f64cdfac1fc1333845ea4ea5efb7922f0ae39619..c39fa953accd6cf35672f452052cca42fe6f29d0 100644 +index 710181cf04563f06690eee5b46a5a0d84844ac29..52c40eafc77e50a6fd21b9a7a250cea501f11690 100644 --- a/src/main/java/net/minecraft/world/item/CrossbowItem.java +++ b/src/main/java/net/minecraft/world/item/CrossbowItem.java @@ -89,7 +89,14 @@ public class CrossbowItem extends ProjectileWeaponItem { - public void releaseUsing(ItemStack stack, Level world, LivingEntity user, int remainingUseTicks) { + public boolean releaseUsing(ItemStack stack, Level world, LivingEntity user, int remainingUseTicks) { int i = this.getUseDuration(stack, user) - remainingUseTicks; float f = getPowerForTime(i, stack, user); - if (f >= 1.0F && !isCharged(stack) && tryLoadProjectiles(user, stack)) { @@ -18,13 +18,13 @@ index f64cdfac1fc1333845ea4ea5efb7922f0ae39619..c39fa953accd6cf35672f452052cca42 + 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()) || !event.shouldConsumeItem()) { + if (user instanceof ServerPlayer player) player.containerMenu.sendAllDataToRemote(); -+ return; ++ return false; + } + // Paper end - Add EntityLoadCrossbowEvent CrossbowItem.ChargingSounds chargingSounds = this.getChargingSounds(stack); chargingSounds.end() .ifPresent( -@@ -107,8 +114,14 @@ public class CrossbowItem extends ProjectileWeaponItem { +@@ -110,8 +117,14 @@ public class CrossbowItem extends ProjectileWeaponItem { } } @@ -42,10 +42,10 @@ index f64cdfac1fc1333845ea4ea5efb7922f0ae39619..c39fa953accd6cf35672f452052cca42 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 56595dd3a0b7df4b5f9819ade797212278c8fd40..32dd0b13a0819f597d8a93c6bc3a155781067544 100644 +index a7d0ac6513fd888e222b3128afc1a227ea91f1d2..78ba170a83f8c026bd110eae494c52577182ed61 100644 --- a/src/main/java/net/minecraft/world/item/ProjectileWeaponItem.java +++ b/src/main/java/net/minecraft/world/item/ProjectileWeaponItem.java -@@ -114,6 +114,11 @@ public abstract class ProjectileWeaponItem extends Item { +@@ -109,6 +109,11 @@ public abstract class ProjectileWeaponItem extends Item { } protected static List draw(ItemStack stack, ItemStack projectileStack, LivingEntity shooter) { @@ -57,7 +57,7 @@ index 56595dd3a0b7df4b5f9819ade797212278c8fd40..32dd0b13a0819f597d8a93c6bc3a1557 if (projectileStack.isEmpty()) { return List.of(); } else { -@@ -133,7 +138,7 @@ public abstract class ProjectileWeaponItem extends Item { +@@ -128,7 +133,7 @@ public abstract class ProjectileWeaponItem extends Item { ItemStack itemstack2 = projectileStack.copy(); for (int k = 0; k < j; ++k) { diff --git a/patches/unapplied/server/0460-Add-WorldGameRuleChangeEvent.patch b/patches/server/0456-Add-WorldGameRuleChangeEvent.patch similarity index 86% rename from patches/unapplied/server/0460-Add-WorldGameRuleChangeEvent.patch rename to patches/server/0456-Add-WorldGameRuleChangeEvent.patch index 25259dc06e..7925a1810a 100644 --- a/patches/unapplied/server/0460-Add-WorldGameRuleChangeEvent.patch +++ b/patches/server/0456-Add-WorldGameRuleChangeEvent.patch @@ -5,10 +5,10 @@ Subject: [PATCH] Add WorldGameRuleChangeEvent diff --git a/src/main/java/net/minecraft/server/commands/GameRuleCommand.java b/src/main/java/net/minecraft/server/commands/GameRuleCommand.java -index c8c358531dbc167e249bac2af246c5e34fbdd4df..10c1790226e25da3b9b599c9a40de57d5727ddc4 100644 +index 6fc70f07f9ba964ff6f5176367dab788decfc917..da0600ab3b0a983ac36cb777d21160bdaced7c52 100644 --- a/src/main/java/net/minecraft/server/commands/GameRuleCommand.java +++ b/src/main/java/net/minecraft/server/commands/GameRuleCommand.java -@@ -33,7 +33,7 @@ public class GameRuleCommand { +@@ -36,7 +36,7 @@ public class GameRuleCommand { CommandSourceStack commandlistenerwrapper = (CommandSourceStack) context.getSource(); T t0 = commandlistenerwrapper.getLevel().getGameRules().getRule(key); // CraftBukkit @@ -18,10 +18,10 @@ index c8c358531dbc167e249bac2af246c5e34fbdd4df..10c1790226e25da3b9b599c9a40de57d return Component.translatable("commands.gamerule.set", key.getId(), t0.toString()); }, true); diff --git a/src/main/java/net/minecraft/world/level/GameRules.java b/src/main/java/net/minecraft/world/level/GameRules.java -index 0b46ad360be919e4aeb0ffc0eebae9fe712fb861..51e560d7856f230c5aa2dc32706c3a4996720aa5 100644 +index 7ea92a0b0f5d4eb6bd873e61c42bc0499d5d2028..09299e45552eb998fd02123c3921c0653f85083d 100644 --- a/src/main/java/net/minecraft/world/level/GameRules.java +++ b/src/main/java/net/minecraft/world/level/GameRules.java -@@ -293,10 +293,10 @@ public class GameRules { +@@ -322,10 +322,10 @@ public class GameRules { this.type = type; } @@ -35,7 +35,7 @@ index 0b46ad360be919e4aeb0ffc0eebae9fe712fb861..51e560d7856f230c5aa2dc32706c3a49 this.onChanged(((CommandSourceStack) context.getSource()).getLevel()); // CraftBukkit - per-world } -@@ -354,8 +354,11 @@ public class GameRules { +@@ -383,8 +383,11 @@ public class GameRules { } @Override @@ -49,7 +49,7 @@ index 0b46ad360be919e4aeb0ffc0eebae9fe712fb861..51e560d7856f230c5aa2dc32706c3a49 } public boolean get() { -@@ -427,8 +430,11 @@ public class GameRules { +@@ -456,8 +459,11 @@ public class GameRules { } @Override @@ -64,33 +64,35 @@ index 0b46ad360be919e4aeb0ffc0eebae9fe712fb861..51e560d7856f230c5aa2dc32706c3a49 public int get() { diff --git a/src/main/java/org/bukkit/craftbukkit/CraftWorld.java b/src/main/java/org/bukkit/craftbukkit/CraftWorld.java -index 99fccedaab2600881683140e10ee17377375b911..f698ac90bd3086519f49e92451228415efaf5530 100644 +index 04ef1c3433d3ac8a58f0d460877e176668e0fc8f..5541a9f197777124dd908e3f56050b49df821acc 100644 --- a/src/main/java/org/bukkit/craftbukkit/CraftWorld.java +++ b/src/main/java/org/bukkit/craftbukkit/CraftWorld.java -@@ -1887,8 +1887,13 @@ public class CraftWorld extends CraftRegionAccessor implements World { +@@ -1899,9 +1899,14 @@ public class CraftWorld extends CraftRegionAccessor implements World { + if (rule == null || value == null) return false; if (!this.isGameRule(rule)) return false; - + // Paper start - Add WorldGameRuleChangeEvent + GameRule gameRule = GameRule.getByName(rule); + io.papermc.paper.event.world.WorldGameRuleChangeEvent event = new io.papermc.paper.event.world.WorldGameRuleChangeEvent(this, null, gameRule, value); + if (!event.callEvent()) return false; + // Paper end - Add WorldGameRuleChangeEvent - GameRules.Value handle = this.getHandle().getGameRules().getRule(CraftWorld.getGameRulesNMS().get(rule)); + + GameRules.Value handle = this.getHandle().getGameRules().getRule(this.getGameRulesNMS().get(rule)); - handle.deserialize(value); + handle.deserialize(event.getValue()); // Paper - Add WorldGameRuleChangeEvent handle.onChanged(this.getHandle()); return true; } -@@ -1924,8 +1929,12 @@ public class CraftWorld extends CraftRegionAccessor implements World { +@@ -1936,9 +1941,13 @@ public class CraftWorld extends CraftRegionAccessor implements World { + Preconditions.checkArgument(newValue != null, "GameRule value cannot be null"); if (!this.isGameRule(rule.getName())) return false; - + // Paper start - Add WorldGameRuleChangeEvent + io.papermc.paper.event.world.WorldGameRuleChangeEvent event = new io.papermc.paper.event.world.WorldGameRuleChangeEvent(this, null, rule, String.valueOf(newValue)); + if (!event.callEvent()) return false; + // Paper end - Add WorldGameRuleChangeEvent - GameRules.Value handle = this.getHandle().getGameRules().getRule(CraftWorld.getGameRulesNMS().get(rule.getName())); + + GameRules.Value handle = this.getHandle().getGameRules().getRule(this.getGameRulesNMS().get(rule.getName())); - handle.deserialize(newValue.toString()); + handle.deserialize(event.getValue()); // Paper - Add WorldGameRuleChangeEvent handle.onChanged(this.getHandle()); diff --git a/patches/unapplied/server/0461-Add-ServerResourcesReloadedEvent.patch b/patches/server/0457-Add-ServerResourcesReloadedEvent.patch similarity index 90% rename from patches/unapplied/server/0461-Add-ServerResourcesReloadedEvent.patch rename to patches/server/0457-Add-ServerResourcesReloadedEvent.patch index 830f76c615..faae21851f 100644 --- a/patches/unapplied/server/0461-Add-ServerResourcesReloadedEvent.patch +++ b/patches/server/0457-Add-ServerResourcesReloadedEvent.patch @@ -5,10 +5,10 @@ Subject: [PATCH] Add ServerResourcesReloadedEvent diff --git a/src/main/java/net/minecraft/server/MinecraftServer.java b/src/main/java/net/minecraft/server/MinecraftServer.java -index 05aa3323e9ae971fba5ab8c6c319c7805a3808aa..39ce74bc3fbb282f56028273d53f980171bdb464 100644 +index 263ed74fd8a8a53ce6d676201f75c5b334345c84..058719f8b768b5a1227a19927d0f632815190a91 100644 --- a/src/main/java/net/minecraft/server/MinecraftServer.java +++ b/src/main/java/net/minecraft/server/MinecraftServer.java -@@ -2114,7 +2114,13 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop completablefuture = CompletableFuture.supplyAsync(() -> { Stream stream = dataPacks.stream(); // CraftBukkit - decompile error PackRepository resourcepackrepository = this.packRepository; -@@ -2146,6 +2152,7 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop= 0 && id < this.selectablePatterns.size()) { diff --git a/patches/unapplied/server/0466-Configurable-door-breaking-difficulty.patch b/patches/server/0462-Configurable-door-breaking-difficulty.patch similarity index 86% rename from patches/unapplied/server/0466-Configurable-door-breaking-difficulty.patch rename to patches/server/0462-Configurable-door-breaking-difficulty.patch index 679bb5f5e7..76df839d0d 100644 --- a/patches/unapplied/server/0466-Configurable-door-breaking-difficulty.patch +++ b/patches/server/0462-Configurable-door-breaking-difficulty.patch @@ -10,10 +10,10 @@ public net.minecraft.world.entity.monster.Zombie DOOR_BREAKING_PREDICATE Co-authored-by: Doc diff --git a/src/main/java/net/minecraft/world/entity/monster/Vindicator.java b/src/main/java/net/minecraft/world/entity/monster/Vindicator.java -index 7c3aff97ba777af131d7efad0b08b844bf6e8946..0615bb305d70f660a6baa7f78078990d6db227d3 100644 +index b06eedb1cb13771bbc7d0b812a9df864d1f73142..96b105697c91314148fd1b783501389214b1a3f0 100644 --- a/src/main/java/net/minecraft/world/entity/monster/Vindicator.java +++ b/src/main/java/net/minecraft/world/entity/monster/Vindicator.java -@@ -179,7 +179,7 @@ public class Vindicator extends AbstractIllager { +@@ -184,7 +184,7 @@ public class Vindicator extends AbstractIllager { static class VindicatorBreakDoorGoal extends BreakDoorGoal { public VindicatorBreakDoorGoal(Mob mob) { @@ -23,10 +23,10 @@ index 7c3aff97ba777af131d7efad0b08b844bf6e8946..0615bb305d70f660a6baa7f78078990d } diff --git a/src/main/java/net/minecraft/world/entity/monster/Zombie.java b/src/main/java/net/minecraft/world/entity/monster/Zombie.java -index 5908f1646b542d61b5a2b23b284b1532e4b276c1..fd304e7d8305877d56de7a38b8664e5a70bf0c33 100644 +index 4477d1a82a49e391760689eb991d1595995914f5..6dc9fc3451edec01f11f526c05d84138c46a3a8e 100644 --- a/src/main/java/net/minecraft/world/entity/monster/Zombie.java +++ b/src/main/java/net/minecraft/world/entity/monster/Zombie.java -@@ -101,7 +101,7 @@ public class Zombie extends Monster { +@@ -103,7 +103,7 @@ public class Zombie extends Monster { public Zombie(EntityType type, Level world) { super(type, world); diff --git a/patches/unapplied/server/0467-Empty-commands-shall-not-be-dispatched.patch b/patches/server/0463-Empty-commands-shall-not-be-dispatched.patch similarity index 84% rename from patches/unapplied/server/0467-Empty-commands-shall-not-be-dispatched.patch rename to patches/server/0463-Empty-commands-shall-not-be-dispatched.patch index f58be08904..ca4dd56d56 100644 --- a/patches/unapplied/server/0467-Empty-commands-shall-not-be-dispatched.patch +++ b/patches/server/0463-Empty-commands-shall-not-be-dispatched.patch @@ -5,10 +5,10 @@ Subject: [PATCH] Empty commands shall not be dispatched diff --git a/src/main/java/net/minecraft/commands/Commands.java b/src/main/java/net/minecraft/commands/Commands.java -index 8ca9ac8eff9d605baa878ca24e165ac5642bf160..f52e9732524b62b0fecdc48e099163f31fe367b4 100644 +index a7eb2a37a81a414dcb19319c075faefe0382aeba..e38f1d972d87f33a5f28459aa988e09f24614453 100644 --- a/src/main/java/net/minecraft/commands/Commands.java +++ b/src/main/java/net/minecraft/commands/Commands.java -@@ -286,6 +286,7 @@ public class Commands { +@@ -291,6 +291,7 @@ public class Commands { command = event.getCommand(); String[] args = command.split(" "); diff --git a/patches/unapplied/server/0458-Fix-nerfed-slime-when-splitting.patch b/patches/unapplied/server/0458-Fix-nerfed-slime-when-splitting.patch deleted file mode 100644 index a32a88f5ad..0000000000 --- a/patches/unapplied/server/0458-Fix-nerfed-slime-when-splitting.patch +++ /dev/null @@ -1,18 +0,0 @@ -From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 -From: Jake Potrebic -Date: Mon, 24 Aug 2020 08:39:06 -0700 -Subject: [PATCH] Fix nerfed slime when splitting - - -diff --git a/src/main/java/net/minecraft/world/entity/monster/Slime.java b/src/main/java/net/minecraft/world/entity/monster/Slime.java -index ef27b0af849f071f79271689783b7a557e6d660a..b54c30ba73b6ab069c0c7c1cd2b193090da79667 100644 ---- a/src/main/java/net/minecraft/world/entity/monster/Slime.java -+++ b/src/main/java/net/minecraft/world/entity/monster/Slime.java -@@ -254,6 +254,7 @@ public class Slime extends Mob implements Enemy { - entityslime.setPersistenceRequired(); - } - -+ entityslime.aware = this.aware; // Paper - Fix nerfed slime when splitting - entityslime.setCustomName(ichatbasecomponent); - entityslime.setNoAi(flag); - entityslime.setInvulnerable(this.isInvulnerable());