From 8b9b485cab79bca689461842688dcd7bc4da54a2 Mon Sep 17 00:00:00 2001 From: Noah van der Aa Date: Thu, 24 Oct 2024 00:42:38 +0200 Subject: [PATCH] good luck americans --- .../Add-event-for-player-editing-sign.patch | 18 ++++++++--------- ...-to-remove-all-active-potion-effects.patch | 0 .../server/Add-transient-modifier-API.patch | 0 ...ll-BlockGrowEvent-for-missing-blocks.patch | 0 ...anhasbukkit-default-if-alias-block-e.patch | 0 .../server/Fix-block-place-logic.patch | 2 +- .../Fix-sniffer-removeExploredLocation.patch | 0 ...und-playing-for-BlockItem-ItemStacks.patch | 10 +++++----- ...esh-ProjectileSource-for-projectiles.patch | 14 +++++-------- ...apLike-spam-for-missing-key-selector.patch | 0 ...crafting-result-amount-for-fireworks.patch | 20 ------------------- 11 files changed, 20 insertions(+), 44 deletions(-) rename patches/{unapplied => }/server/Add-event-for-player-editing-sign.patch (87%) rename patches/{unapplied => }/server/Add-method-to-remove-all-active-potion-effects.patch (100%) rename patches/{unapplied => }/server/Add-transient-modifier-API.patch (100%) rename patches/{unapplied => }/server/Call-BlockGrowEvent-for-missing-blocks.patch (100%) rename patches/{unapplied => }/server/Don-t-enforce-icanhasbukkit-default-if-alias-block-e.patch (100%) rename patches/{unapplied => }/server/Fix-block-place-logic.patch (97%) rename patches/{unapplied => }/server/Fix-sniffer-removeExploredLocation.patch (100%) rename patches/{unapplied => }/server/Fix-spigot-sound-playing-for-BlockItem-ItemStacks.patch (66%) rename patches/{unapplied => }/server/Refresh-ProjectileSource-for-projectiles.patch (89%) rename patches/{unapplied => }/server/fix-MapLike-spam-for-missing-key-selector.patch (100%) delete mode 100644 patches/unapplied/server/Fix-incorrect-crafting-result-amount-for-fireworks.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 87% rename from patches/unapplied/server/Add-event-for-player-editing-sign.patch rename to patches/server/Add-event-for-player-editing-sign.patch index 8959a8ecf1..6786e4e0ee 100644 --- a/patches/unapplied/server/Add-event-for-player-editing-sign.patch +++ b/patches/server/Add-event-for-player-editing-sign.patch @@ -9,25 +9,25 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 --- 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 { - try { - if (world.getBlockEntity(SignItem.openSign) instanceof SignBlockEntity tileentitysign) { - if (world.getBlockState(SignItem.openSign).getBlock() instanceof SignBlock blocksign) { -- blocksign.openTextEdit(entityhuman, tileentitysign, true, org.bukkit.event.player.PlayerSignOpenEvent.Cause.PLACE); // Craftbukkit -+ blocksign.openTextEdit(entityhuman, tileentitysign, true, io.papermc.paper.event.player.PlayerOpenSignEvent.Cause.PLACE); // Paper - Add PlayerOpenSignEvent + try { + if (world.getBlockEntity(SignItem.openSign) instanceof SignBlockEntity tileentitysign) { + if (world.getBlockState(SignItem.openSign).getBlock() instanceof SignBlock blocksign) { +- blocksign.openTextEdit(entityhuman, tileentitysign, true, org.bukkit.event.player.PlayerSignOpenEvent.Cause.PLACE); // Craftbukkit ++ blocksign.openTextEdit(entityhuman, tileentitysign, true, io.papermc.paper.event.player.PlayerOpenSignEvent.Cause.PLACE); // Craftbukkit // Paper - Add PlayerOpenSignEvent + } } - } - } finally { + } finally { diff --git a/src/main/java/net/minecraft/world/level/block/SignBlock.java b/src/main/java/net/minecraft/world/level/block/SignBlock.java index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 --- a/src/main/java/net/minecraft/world/level/block/SignBlock.java +++ b/src/main/java/net/minecraft/world/level/block/SignBlock.java @@ -0,0 +0,0 @@ public abstract class SignBlock extends BaseEntityBlock implements SimpleWaterlo } else if (flag1) { - return InteractionResult.SUCCESS; + return InteractionResult.SUCCESS_SERVER; } else if (!this.otherPlayerIsEditingSign(player, tileentitysign) && player.mayBuild() && this.hasEditableText(player, tileentitysign, flag)) { - this.openTextEdit(player, tileentitysign, flag, org.bukkit.event.player.PlayerSignOpenEvent.Cause.INTERACT); // CraftBukkit + this.openTextEdit(player, tileentitysign, flag, io.papermc.paper.event.player.PlayerOpenSignEvent.Cause.INTERACT); // Paper - Add PlayerOpenSignEvent - return InteractionResult.SUCCESS; + return InteractionResult.SUCCESS_SERVER; } else { return InteractionResult.PASS; @@ -0,0 +0,0 @@ public abstract class SignBlock extends BaseEntityBlock implements SimpleWaterlo 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-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/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/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/Fix-block-place-logic.patch b/patches/server/Fix-block-place-logic.patch similarity index 97% rename from patches/unapplied/server/Fix-block-place-logic.patch rename to patches/server/Fix-block-place-logic.patch index ffe5f6beb6..aedf1867bc 100644 --- a/patches/unapplied/server/Fix-block-place-logic.patch +++ b/patches/server/Fix-block-place-logic.patch @@ -20,7 +20,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 + if (entityhuman == null) world.playSound(entityhuman, blockposition, this.getPlaceSound(iblockdata1), net.minecraft.sounds.SoundSource.BLOCKS, (soundeffecttype.getVolume() + 1.0F) / 2.0F, soundeffecttype.getPitch() * 0.8F); // Paper - Fix block place logic; reintroduce this for the dispenser (i.e the shulker) world.gameEvent((Holder) GameEvent.BLOCK_PLACE, blockposition, GameEvent.Context.of(entityhuman, iblockdata1)); itemstack.consume(1, entityhuman); - return InteractionResult.sidedSuccess(world.isClientSide); + return InteractionResult.SUCCESS; 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-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-sound-playing-for-BlockItem-ItemStacks.patch b/patches/server/Fix-spigot-sound-playing-for-BlockItem-ItemStacks.patch similarity index 66% 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 index aeb2e546f3..ec942baf21 100644 --- a/patches/unapplied/server/Fix-spigot-sound-playing-for-BlockItem-ItemStacks.patch +++ b/patches/server/Fix-spigot-sound-playing-for-BlockItem-ItemStacks.patch @@ -10,14 +10,14 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 +++ b/src/main/java/net/minecraft/world/item/ItemStack.java @@ -0,0 +0,0 @@ public final class ItemStack implements DataComponentHolder { - // SPIGOT-1288 - play sound stripped from ItemBlock - if (this.item instanceof BlockItem) { -- SoundType soundeffecttype = ((BlockItem) this.item).getBlock().defaultBlockState().getSoundType(); // TODO: not strictly correct, however currently only affects decorated pots + // SPIGOT-1288 - play sound stripped from ItemBlock + if (this.item instanceof BlockItem) { +- SoundType soundeffecttype = ((BlockItem) this.item).getBlock().defaultBlockState().getSoundType(); // TODO: not strictly correct, however currently only affects decorated pots + // Paper start - Fix spigot sound playing for BlockItem ItemStacks + BlockPos position = new net.minecraft.world.item.context.BlockPlaceContext(context).getClickedPos(); + net.minecraft.world.level.block.state.BlockState blockData = world.getBlockState(position); + SoundType soundeffecttype = blockData.getSoundType(); + // Paper end - Fix spigot sound playing for BlockItem ItemStacks - world.playSound(entityhuman, blockposition, soundeffecttype.getPlaceSound(), SoundSource.BLOCKS, (soundeffecttype.getVolume() + 1.0F) / 2.0F, soundeffecttype.getPitch() * 0.8F); - } + world.playSound(entityhuman, blockposition, soundeffecttype.getPlaceSound(), SoundSource.BLOCKS, (soundeffecttype.getVolume() + 1.0F) / 2.0F, soundeffecttype.getPitch() * 0.8F); + } diff --git a/patches/unapplied/server/Refresh-ProjectileSource-for-projectiles.patch b/patches/server/Refresh-ProjectileSource-for-projectiles.patch similarity index 89% rename from patches/unapplied/server/Refresh-ProjectileSource-for-projectiles.patch rename to patches/server/Refresh-ProjectileSource-for-projectiles.patch index 1366e580a0..1225444825 100644 --- a/patches/unapplied/server/Refresh-ProjectileSource-for-projectiles.patch +++ b/patches/server/Refresh-ProjectileSource-for-projectiles.patch @@ -59,18 +59,14 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 @Override public Entity getOwner() { if (this.cachedOwner != null && !this.cachedOwner.isRemoved()) { ++ this.refreshProjectileSource(false); // Paper - Refresh ProjectileSource for projectiles + return this.cachedOwner; + } else if (this.ownerUUID != null) { + this.cachedOwner = this.findOwner(this.ownerUUID); + this.refreshProjectileSource(false); // Paper - Refresh ProjectileSource for projectiles return this.cachedOwner; } else { - if (this.ownerUUID != null) { -@@ -0,0 +0,0 @@ public abstract class Projectile extends Entity implements TraceableEntity { - ServerLevel worldserver = (ServerLevel) world; - - this.cachedOwner = worldserver.getEntity(this.ownerUUID); -+ this.refreshProjectileSource(false); // Paper - Refresh ProjectileSource for projectiles - return this.cachedOwner; - } - } + return null; diff --git a/src/main/java/org/bukkit/craftbukkit/entity/AbstractProjectile.java b/src/main/java/org/bukkit/craftbukkit/entity/AbstractProjectile.java index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 --- a/src/main/java/org/bukkit/craftbukkit/entity/AbstractProjectile.java 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-incorrect-crafting-result-amount-for-fireworks.patch b/patches/unapplied/server/Fix-incorrect-crafting-result-amount-for-fireworks.patch deleted file mode 100644 index fe680dee83..0000000000 --- a/patches/unapplied/server/Fix-incorrect-crafting-result-amount-for-fireworks.patch +++ /dev/null @@ -1,20 +0,0 @@ -From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 -From: Redned -Date: Mon, 12 Jun 2023 11:54:12 -0500 -Subject: [PATCH] Fix incorrect crafting result amount for fireworks - -Although vanilla does not specifically call this method anywhere, this fixes a bug where the result using the Bukkit API returns the wrong amount. - -diff --git a/src/main/java/net/minecraft/world/item/crafting/FireworkRocketRecipe.java b/src/main/java/net/minecraft/world/item/crafting/FireworkRocketRecipe.java -index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 ---- a/src/main/java/net/minecraft/world/item/crafting/FireworkRocketRecipe.java -+++ b/src/main/java/net/minecraft/world/item/crafting/FireworkRocketRecipe.java -@@ -0,0 +0,0 @@ public class FireworkRocketRecipe extends CustomRecipe { - - @Override - public ItemStack getResultItem(HolderLookup.Provider registriesLookup) { -- return new ItemStack(Items.FIREWORK_ROCKET); -+ return new ItemStack(Items.FIREWORK_ROCKET, 3); // Paper - Fix incorrect crafting result amount - } - - @Override