diff --git a/patches/unapplied/server/Add-AnvilView-bypassEnchantmentLevelRestriction.patch b/patches/server/Add-AnvilView-bypassEnchantmentLevelRestriction.patch similarity index 100% rename from patches/unapplied/server/Add-AnvilView-bypassEnchantmentLevelRestriction.patch rename to patches/server/Add-AnvilView-bypassEnchantmentLevelRestriction.patch diff --git a/patches/unapplied/server/Add-Offline-PDC-API.patch b/patches/server/Add-Offline-PDC-API.patch similarity index 100% rename from patches/unapplied/server/Add-Offline-PDC-API.patch rename to patches/server/Add-Offline-PDC-API.patch diff --git a/patches/unapplied/server/Add-PlayerInsertLecternBookEvent.patch b/patches/server/Add-PlayerInsertLecternBookEvent.patch similarity index 100% rename from patches/unapplied/server/Add-PlayerInsertLecternBookEvent.patch rename to patches/server/Add-PlayerInsertLecternBookEvent.patch diff --git a/patches/unapplied/server/Add-enchantWithLevels-with-enchantment-registry-set.patch b/patches/server/Add-enchantWithLevels-with-enchantment-registry-set.patch similarity index 100% rename from patches/unapplied/server/Add-enchantWithLevels-with-enchantment-registry-set.patch rename to patches/server/Add-enchantWithLevels-with-enchantment-registry-set.patch diff --git a/patches/unapplied/server/Add-proper-async-player-disconnections.patch b/patches/server/Add-proper-async-player-disconnections.patch similarity index 93% rename from patches/unapplied/server/Add-proper-async-player-disconnections.patch rename to patches/server/Add-proper-async-player-disconnections.patch index 1f361ab041..c97a02a2a4 100644 --- a/patches/unapplied/server/Add-proper-async-player-disconnections.patch +++ b/patches/server/Add-proper-async-player-disconnections.patch @@ -80,7 +80,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 @@ -0,0 +0,0 @@ public class ServerGamePacketListenerImpl extends ServerCommonPacketListenerImpl // PacketUtils.ensureRunningOnSameThread(packet, this, this.player.serverLevel()); // Paper - AsyncTabCompleteEvent; run this async // CraftBukkit start - if (this.chatSpamTickCount.addAndGet(io.papermc.paper.configuration.GlobalConfiguration.get().spamLimiter.tabSpamIncrement) > io.papermc.paper.configuration.GlobalConfiguration.get().spamLimiter.tabSpamLimit && !this.server.getPlayerList().isOp(this.player.getGameProfile())) { // Paper - configurable tab spam limits + if (!this.tabSpamThrottler.isIncrementAndUnderThreshold() && !this.server.getPlayerList().isOp(this.player.getGameProfile()) && !this.server.isSingleplayerOwner(this.player.getGameProfile())) { // Paper - configurable tab spam limits - this.disconnect(Component.translatable("disconnect.spam"), org.bukkit.event.player.PlayerKickEvent.Cause.SPAM); // Paper - Kick event cause + this.disconnectAsync(Component.translatable("disconnect.spam"), org.bukkit.event.player.PlayerKickEvent.Cause.SPAM); // Paper - Kick event cause // Paper - add proper async disconnect return; @@ -131,8 +131,8 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 return optional; @@ -0,0 +0,0 @@ public class ServerGamePacketListenerImpl extends ServerCommonPacketListenerImpl - // this.chatSpamTickCount += 20; - if (counted && this.chatSpamTickCount.addAndGet(20) > 200 && !this.server.getPlayerList().isOp(this.player.getGameProfile()) && !this.server.isSingleplayerOwner(this.player.getGameProfile())) { // Paper - exclude from SpigotConfig.spamExclusions + // this.chatSpamThrottler.increment(); + if (counted && !this.chatSpamThrottler.isIncrementAndUnderThreshold() && !this.server.getPlayerList().isOp(this.player.getGameProfile()) && !this.server.isSingleplayerOwner(this.player.getGameProfile())) { // Paper - exclude from SpigotConfig.spamExclusions // CraftBukkit end - this.disconnect((Component) Component.translatable("disconnect.spam"), org.bukkit.event.player.PlayerKickEvent.Cause.SPAM); // Paper - kick event cause + this.disconnectAsync((Component) Component.translatable("disconnect.spam"), org.bukkit.event.player.PlayerKickEvent.Cause.SPAM); // Paper - kick event cause // Paper - add proper async disconnect @@ -160,7 +160,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 @@ -0,0 +0,0 @@ public class ServerGamePacketListenerImpl extends ServerCommonPacketListenerImpl // Paper start - auto recipe limit if (!org.bukkit.Bukkit.isPrimaryThread()) { - if (this.recipeSpamPackets.addAndGet(io.papermc.paper.configuration.GlobalConfiguration.get().spamLimiter.recipeSpamIncrement) > io.papermc.paper.configuration.GlobalConfiguration.get().spamLimiter.recipeSpamLimit) { + if (!this.recipeSpamPackets.isIncrementAndUnderThreshold()) { - this.disconnect(net.minecraft.network.chat.Component.translatable("disconnect.spam"), org.bukkit.event.player.PlayerKickEvent.Cause.SPAM); // Paper - kick event cause + this.disconnectAsync(net.minecraft.network.chat.Component.translatable("disconnect.spam"), org.bukkit.event.player.PlayerKickEvent.Cause.SPAM); // Paper - kick event cause // Paper - add proper async disconnect return; diff --git a/patches/unapplied/server/Add-recipeBrewTime.patch b/patches/server/Add-recipeBrewTime.patch similarity index 99% rename from patches/unapplied/server/Add-recipeBrewTime.patch rename to patches/server/Add-recipeBrewTime.patch index b12708cc1f..76392e4fc7 100644 --- a/patches/unapplied/server/Add-recipeBrewTime.patch +++ b/patches/server/Add-recipeBrewTime.patch @@ -63,8 +63,8 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 + } + }); + // Paper end - Add recipeBrewTime - - int j; + this.addStandardInventorySlots(playerInventory, 8, 84); + } diff --git a/src/main/java/net/minecraft/world/level/block/entity/BrewingStandBlockEntity.java b/src/main/java/net/minecraft/world/level/block/entity/BrewingStandBlockEntity.java index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 diff --git a/patches/unapplied/server/Always-send-Banner-patterns-to-the-client.patch b/patches/server/Always-send-Banner-patterns-to-the-client.patch similarity index 86% rename from patches/unapplied/server/Always-send-Banner-patterns-to-the-client.patch rename to patches/server/Always-send-Banner-patterns-to-the-client.patch index cedc8214bf..1779e2185d 100644 --- a/patches/unapplied/server/Always-send-Banner-patterns-to-the-client.patch +++ b/patches/server/Always-send-Banner-patterns-to-the-client.patch @@ -14,11 +14,11 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 +++ b/src/main/java/net/minecraft/world/level/block/entity/BannerBlockEntity.java @@ -0,0 +0,0 @@ public class BannerBlockEntity extends BlockEntity implements Nameable { @Override - protected void saveAdditional(CompoundTag nbt, HolderLookup.Provider registryLookup) { - super.saveAdditional(nbt, registryLookup); + protected void saveAdditional(CompoundTag nbt, HolderLookup.Provider registries) { + super.saveAdditional(nbt, registries); - if (!this.patterns.equals(BannerPatternLayers.EMPTY)) { + if (!this.patterns.equals(BannerPatternLayers.EMPTY) || serialisingForNetwork.get()) { // Paper - always send patterns to client - nbt.put("patterns", (Tag) BannerPatternLayers.CODEC.encodeStart(registryLookup.createSerializationContext(NbtOps.INSTANCE), this.patterns).getOrThrow()); + nbt.put("patterns", (Tag) BannerPatternLayers.CODEC.encodeStart(registries.createSerializationContext(NbtOps.INSTANCE), this.patterns).getOrThrow()); } @@ -0,0 +0,0 @@ public class BannerBlockEntity extends BlockEntity implements Nameable { @@ -28,12 +28,11 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 + // Paper start - always send patterns to client + ThreadLocal serialisingForNetwork = ThreadLocal.withInitial(() -> Boolean.FALSE); @Override - public CompoundTag getUpdateTag(HolderLookup.Provider registryLookup) { -- return this.saveWithoutMetadata(registryLookup); + public CompoundTag getUpdateTag(HolderLookup.Provider registries) { + final Boolean wasSerialisingForNetwork = serialisingForNetwork.get(); + try { + serialisingForNetwork.set(Boolean.TRUE); -+ return this.saveWithoutMetadata(registryLookup); + return this.saveWithoutMetadata(registries); + } finally { + serialisingForNetwork.set(wasSerialisingForNetwork); + } diff --git a/patches/unapplied/server/Call-bucket-events-for-cauldrons.patch b/patches/server/Call-bucket-events-for-cauldrons.patch similarity index 57% rename from patches/unapplied/server/Call-bucket-events-for-cauldrons.patch rename to patches/server/Call-bucket-events-for-cauldrons.patch index f535bb6a96..adc034497b 100644 --- a/patches/unapplied/server/Call-bucket-events-for-cauldrons.patch +++ b/patches/server/Call-bucket-events-for-cauldrons.patch @@ -14,15 +14,15 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 - object2objectopenhashmap.defaultReturnValue((iblockdata, world, blockposition, entityhuman, enumhand, itemstack) -> { + object2objectopenhashmap.defaultReturnValue((iblockdata, world, blockposition, entityhuman, enumhand, itemstack, hitDirection) -> { // Paper - add hitDirection - return ItemInteractionResult.PASS_TO_DEFAULT_BLOCK_INTERACTION; + return InteractionResult.TRY_WITH_EMPTY_HAND; }); CauldronInteraction.InteractionMap cauldroninteraction_a = new CauldronInteraction.InteractionMap(name, object2objectopenhashmap); @@ -0,0 +0,0 @@ public interface CauldronInteraction { return cauldroninteraction_a; } -- ItemInteractionResult interact(BlockState state, Level world, BlockPos pos, Player player, InteractionHand hand, ItemStack stack); -+ ItemInteractionResult interact(BlockState state, Level world, BlockPos pos, Player player, InteractionHand hand, ItemStack stack, final net.minecraft.core.Direction hitDirection); // Paper - add hitDirection +- InteractionResult interact(BlockState state, Level world, BlockPos pos, Player player, InteractionHand hand, ItemStack stack); ++ InteractionResult interact(BlockState state, Level world, BlockPos pos, Player player, InteractionHand hand, ItemStack stack, final net.minecraft.core.Direction hitDirection); // Paper - add hitDirection static void bootStrap() { Map map = CauldronInteraction.EMPTY.map(); @@ -51,15 +51,15 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 if (!LayeredCauldronBlock.lowerFillLevel(iblockdata, world, blockposition, entityhuman, CauldronLevelChangeEvent.ChangeReason.BOTTLE_FILL)) { @@ -0,0 +0,0 @@ public interface CauldronInteraction { - return ItemInteractionResult.sidedSuccess(world.isClientSide); + return InteractionResult.SUCCESS; }); - map1.put(Items.POTION, (iblockdata, world, blockposition, entityhuman, enumhand, itemstack) -> { + map1.put(Items.POTION, (iblockdata, world, blockposition, entityhuman, enumhand, itemstack, hitDirection) -> { // Paper - add hitDirection if ((Integer) iblockdata.getValue(LayeredCauldronBlock.LEVEL) == 3) { - return ItemInteractionResult.PASS_TO_DEFAULT_BLOCK_INTERACTION; + return InteractionResult.TRY_WITH_EMPTY_HAND; } else { @@ -0,0 +0,0 @@ public interface CauldronInteraction { - map1.put(Items.YELLOW_SHULKER_BOX, CauldronInteraction.SHULKER_BOX); + map1.put(Items.YELLOW_SHULKER_BOX, CauldronInteraction::shulkerBoxInteraction); Map map2 = CauldronInteraction.LAVA.map(); - map2.put(Items.BUCKET, (iblockdata, world, blockposition, entityhuman, enumhand, itemstack) -> { @@ -76,40 +76,44 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 + map3.put(Items.BUCKET, (iblockdata, world, blockposition, entityhuman, enumhand, itemstack, hitDirection) -> { // Paper - add hitDirection return CauldronInteraction.fillBucket(iblockdata, world, blockposition, entityhuman, enumhand, itemstack, new ItemStack(Items.POWDER_SNOW_BUCKET), (iblockdata1) -> { return (Integer) iblockdata1.getValue(LayeredCauldronBlock.LEVEL) == 3; - }, SoundEvents.BUCKET_FILL_POWDER_SNOW); +- }, SoundEvents.BUCKET_FILL_POWDER_SNOW); ++ }, SoundEvents.BUCKET_FILL_POWDER_SNOW, hitDirection); // Paper - add hitDirection + }); + CauldronInteraction.addDefaultInteractions(map3); + } @@ -0,0 +0,0 @@ public interface CauldronInteraction { } - static ItemInteractionResult fillBucket(BlockState state, Level world, BlockPos pos, Player player, InteractionHand hand, ItemStack stack, ItemStack output, Predicate fullPredicate, SoundEvent soundEvent) { + static InteractionResult fillBucket(BlockState state, Level world, BlockPos pos, Player player, InteractionHand hand, ItemStack stack, ItemStack output, Predicate fullPredicate, SoundEvent soundEvent) { + // Paper start - add hitDirection + return fillBucket(state, world, pos, player, hand, stack, output, fullPredicate, soundEvent, null); // Paper - add hitDirection + } -+ static ItemInteractionResult fillBucket(BlockState state, Level world, BlockPos pos, Player player, InteractionHand hand, ItemStack stack, ItemStack output, Predicate fullPredicate, SoundEvent soundEvent, @javax.annotation.Nullable net.minecraft.core.Direction hitDirection) { ++ static InteractionResult fillBucket(BlockState state, Level world, BlockPos pos, Player player, InteractionHand hand, ItemStack stack, ItemStack output, Predicate fullPredicate, SoundEvent soundEvent, @javax.annotation.Nullable net.minecraft.core.Direction hitDirection) { + // Paper end - add hitDirection if (!fullPredicate.test(state)) { - return ItemInteractionResult.PASS_TO_DEFAULT_BLOCK_INTERACTION; + return InteractionResult.TRY_WITH_EMPTY_HAND; } else { if (!world.isClientSide) { + // Paper start - fire PlayerBucketFillEvent + if (hitDirection != null) { + org.bukkit.event.player.PlayerBucketEvent event = org.bukkit.craftbukkit.event.CraftEventFactory.callPlayerBucketFillEvent((net.minecraft.server.level.ServerLevel) world, player, pos, pos, hitDirection, stack, output.getItem(), hand); + if (event.isCancelled()) { -+ return ItemInteractionResult.PASS_TO_DEFAULT_BLOCK_INTERACTION; ++ return InteractionResult.PASS; + } + output = event.getItemStack() != null ? org.bukkit.craftbukkit.inventory.CraftItemStack.asNMSCopy(event.getItemStack()) : ItemStack.EMPTY; + } + // Paper end - fire PlayerBucketFillEvent // CraftBukkit start if (!LayeredCauldronBlock.changeLevel(state, world, pos, Blocks.CAULDRON.defaultBlockState(), player, CauldronLevelChangeEvent.ChangeReason.BUCKET_FILL, false)) { // Paper - Call CauldronLevelChangeEvent - return ItemInteractionResult.SUCCESS; + return InteractionResult.SUCCESS; @@ -0,0 +0,0 @@ public interface CauldronInteraction { } - static ItemInteractionResult emptyBucket(Level world, BlockPos pos, Player player, InteractionHand hand, ItemStack stack, BlockState state, SoundEvent soundEvent) { + static InteractionResult emptyBucket(Level world, BlockPos pos, Player player, InteractionHand hand, ItemStack stack, BlockState state, SoundEvent soundEvent) { + // Paper start - add hitDirection + return emptyBucket(world, pos, player, hand, stack, state, soundEvent, null); + } -+ static ItemInteractionResult emptyBucket(Level world, BlockPos pos, Player player, InteractionHand hand, ItemStack stack, BlockState state, SoundEvent soundEvent, @javax.annotation.Nullable net.minecraft.core.Direction hitDirection) { ++ static InteractionResult emptyBucket(Level world, BlockPos pos, Player player, InteractionHand hand, ItemStack stack, BlockState state, SoundEvent soundEvent, @javax.annotation.Nullable net.minecraft.core.Direction hitDirection) { + // Paper end - add hitDirection if (!world.isClientSide) { + // Paper start - fire PlayerBucketEmptyEvent @@ -117,14 +121,14 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 + if (hitDirection != null) { + org.bukkit.event.player.PlayerBucketEvent event = org.bukkit.craftbukkit.event.CraftEventFactory.callPlayerBucketEmptyEvent((net.minecraft.server.level.ServerLevel) world, player, pos, pos, hitDirection, stack, hand); + if (event.isCancelled()) { -+ return ItemInteractionResult.PASS_TO_DEFAULT_BLOCK_INTERACTION; ++ return InteractionResult.PASS; + } + output = event.getItemStack() != null ? org.bukkit.craftbukkit.inventory.CraftItemStack.asNMSCopy(event.getItemStack()) : ItemStack.EMPTY; + } + // Paper end - fire PlayerBucketEmptyEvent // CraftBukkit start if (!LayeredCauldronBlock.changeLevel(state, world, pos, state, player, CauldronLevelChangeEvent.ChangeReason.BUCKET_EMPTY, false)) { // Paper - Call CauldronLevelChangeEvent - return ItemInteractionResult.SUCCESS; + return InteractionResult.SUCCESS; @@ -0,0 +0,0 @@ public interface CauldronInteraction { // CraftBukkit end Item item = stack.getItem(); @@ -135,53 +139,62 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 player.awardStat(Stats.ITEM_USED.get(item)); // world.setBlockAndUpdate(blockposition, iblockdata); // CraftBukkit @@ -0,0 +0,0 @@ public interface CauldronInteraction { - CauldronInteraction.InteractionMap WATER = CauldronInteraction.newInteractionMap("water"); - CauldronInteraction.InteractionMap LAVA = CauldronInteraction.newInteractionMap("lava"); - CauldronInteraction.InteractionMap POWDER_SNOW = CauldronInteraction.newInteractionMap("powder_snow"); -- CauldronInteraction FILL_WATER = (iblockdata, world, blockposition, entityhuman, enumhand, itemstack) -> { -- return CauldronInteraction.emptyBucket(world, blockposition, entityhuman, enumhand, itemstack, (BlockState) Blocks.WATER_CAULDRON.defaultBlockState().setValue(LayeredCauldronBlock.LEVEL, 3), SoundEvents.BUCKET_EMPTY); -+ CauldronInteraction FILL_WATER = (iblockdata, world, blockposition, entityhuman, enumhand, itemstack, hitDirection) -> { // Paper - add hitDirection -+ return CauldronInteraction.emptyBucket(world, blockposition, entityhuman, enumhand, itemstack, (BlockState) Blocks.WATER_CAULDRON.defaultBlockState().setValue(LayeredCauldronBlock.LEVEL, 3), SoundEvents.BUCKET_EMPTY, hitDirection); // Paper - add hitDirection - }; -- CauldronInteraction FILL_LAVA = (iblockdata, world, blockposition, entityhuman, enumhand, itemstack) -> { -- return CauldronInteraction.emptyBucket(world, blockposition, entityhuman, enumhand, itemstack, Blocks.LAVA_CAULDRON.defaultBlockState(), SoundEvents.BUCKET_EMPTY_LAVA); -+ CauldronInteraction FILL_LAVA = (iblockdata, world, blockposition, entityhuman, enumhand, itemstack, hitDirection) -> { // Paper - add hitDirection -+ return CauldronInteraction.emptyBucket(world, blockposition, entityhuman, enumhand, itemstack, Blocks.LAVA_CAULDRON.defaultBlockState(), SoundEvents.BUCKET_EMPTY_LAVA, hitDirection); // Paper - add hitDirection - }; -- CauldronInteraction FILL_POWDER_SNOW = (iblockdata, world, blockposition, entityhuman, enumhand, itemstack) -> { -+ CauldronInteraction FILL_POWDER_SNOW = (iblockdata, world, blockposition, entityhuman, enumhand, itemstack, hitDirection) -> { // Paper - add hitDirection - return CauldronInteraction.emptyBucket(world, blockposition, entityhuman, enumhand, itemstack, (BlockState) Blocks.POWDER_SNOW_CAULDRON.defaultBlockState().setValue(LayeredCauldronBlock.LEVEL, 3), SoundEvents.BUCKET_EMPTY_POWDER_SNOW); - }; -- CauldronInteraction SHULKER_BOX = (iblockdata, world, blockposition, entityhuman, enumhand, itemstack) -> { -+ CauldronInteraction SHULKER_BOX = (iblockdata, world, blockposition, entityhuman, enumhand, itemstack, hitDirection) -> { // Paper - add hitDirection - // CraftBukkit end - Block block = Block.byItem(itemstack.getItem()); + return InteractionResult.SUCCESS; + } -@@ -0,0 +0,0 @@ public interface CauldronInteraction { - return ItemInteractionResult.sidedSuccess(world.isClientSide); - } - }; -- CauldronInteraction BANNER = (iblockdata, world, blockposition, entityhuman, enumhand, itemstack) -> { // CraftBukkit - decompile error -+ CauldronInteraction BANNER = (iblockdata, world, blockposition, entityhuman, enumhand, itemstack, hitDirection) -> { // CraftBukkit - decompile error // Paper - add hitDirection - BannerPatternLayers bannerpatternlayers = (BannerPatternLayers) itemstack.getOrDefault(DataComponents.BANNER_PATTERNS, BannerPatternLayers.EMPTY); +- private static InteractionResult fillWaterInteraction(BlockState state, Level world, BlockPos pos, Player player, InteractionHand hand, ItemStack stack) { +- return CauldronInteraction.emptyBucket(world, pos, player, hand, stack, (BlockState) Blocks.WATER_CAULDRON.defaultBlockState().setValue(LayeredCauldronBlock.LEVEL, 3), SoundEvents.BUCKET_EMPTY); ++ private static InteractionResult fillWaterInteraction(BlockState state, Level world, BlockPos pos, Player player, InteractionHand hand, ItemStack stack, final net.minecraft.core.Direction hitDirection) { // Paper - add hitDirection ++ return CauldronInteraction.emptyBucket(world, pos, player, hand, stack, (BlockState) Blocks.WATER_CAULDRON.defaultBlockState().setValue(LayeredCauldronBlock.LEVEL, 3), SoundEvents.BUCKET_EMPTY, hitDirection); // Paper - add hitDirection + } - if (bannerpatternlayers.layers().isEmpty()) { +- private static InteractionResult fillLavaInteraction(BlockState state, Level world, BlockPos pos, Player player, InteractionHand hand, ItemStack stack) { +- return (InteractionResult) (CauldronInteraction.isUnderWater(world, pos) ? InteractionResult.CONSUME : CauldronInteraction.emptyBucket(world, pos, player, hand, stack, Blocks.LAVA_CAULDRON.defaultBlockState(), SoundEvents.BUCKET_EMPTY_LAVA)); ++ private static InteractionResult fillLavaInteraction(BlockState state, Level world, BlockPos pos, Player player, InteractionHand hand, ItemStack stack, final net.minecraft.core.Direction hitDirection) { // Paper - add hitDirection ++ return (InteractionResult) (CauldronInteraction.isUnderWater(world, pos) ? InteractionResult.CONSUME : CauldronInteraction.emptyBucket(world, pos, player, hand, stack, Blocks.LAVA_CAULDRON.defaultBlockState(), SoundEvents.BUCKET_EMPTY_LAVA, hitDirection)); // Paper - add hitDirection + } + +- private static InteractionResult fillPowderSnowInteraction(BlockState state, Level world, BlockPos pos, Player player, InteractionHand hand, ItemStack stack) { +- return (InteractionResult) (CauldronInteraction.isUnderWater(world, pos) ? InteractionResult.CONSUME : CauldronInteraction.emptyBucket(world, pos, player, hand, stack, (BlockState) Blocks.POWDER_SNOW_CAULDRON.defaultBlockState().setValue(LayeredCauldronBlock.LEVEL, 3), SoundEvents.BUCKET_EMPTY_POWDER_SNOW)); ++ private static InteractionResult fillPowderSnowInteraction(BlockState state, Level world, BlockPos pos, Player player, InteractionHand hand, ItemStack stack, final net.minecraft.core.Direction hitDirection) { // Paper - add hitDirection ++ return (InteractionResult) (CauldronInteraction.isUnderWater(world, pos) ? InteractionResult.CONSUME : CauldronInteraction.emptyBucket(world, pos, player, hand, stack, (BlockState) Blocks.POWDER_SNOW_CAULDRON.defaultBlockState().setValue(LayeredCauldronBlock.LEVEL, 3), SoundEvents.BUCKET_EMPTY_POWDER_SNOW, hitDirection)); // Paper - add hitDirection + } + +- private static InteractionResult shulkerBoxInteraction(BlockState state, Level world, BlockPos pos, Player player, InteractionHand hand, ItemStack stack) { ++ private static InteractionResult shulkerBoxInteraction(BlockState state, Level world, BlockPos pos, Player player, InteractionHand hand, ItemStack stack, final net.minecraft.core.Direction hitDirection) { // Paper - add hitDirection + Block block = Block.byItem(stack.getItem()); + + if (!(block instanceof ShulkerBoxBlock)) { @@ -0,0 +0,0 @@ public interface CauldronInteraction { - return ItemInteractionResult.sidedSuccess(world.isClientSide); + player.awardStat(Stats.CLEAN_SHULKER_BOX); + // LayeredCauldronBlock.lowerFillLevel(iblockdata, world, blockposition); // CraftBukkit } - }; -- CauldronInteraction DYED_ITEM = (iblockdata, world, blockposition, entityhuman, enumhand, itemstack) -> { // CraftBukkit - decompile error -+ CauldronInteraction DYED_ITEM = (iblockdata, world, blockposition, entityhuman, enumhand, itemstack, hitDirection) -> { // CraftBukkit - decompile error // Paper - add hitDirection - if (!itemstack.is(ItemTags.DYEABLE)) { - return ItemInteractionResult.PASS_TO_DEFAULT_BLOCK_INTERACTION; - } else if (!itemstack.has(DataComponents.DYED_COLOR)) { +- + return InteractionResult.SUCCESS; + } + } + +- private static InteractionResult bannerInteraction(BlockState state, Level world, BlockPos pos, Player player, InteractionHand hand, ItemStack stack) { ++ private static InteractionResult bannerInteraction(BlockState state, Level world, BlockPos pos, Player player, InteractionHand hand, ItemStack stack, final net.minecraft.core.Direction hitDirection) { // Paper - add hitDirection + BannerPatternLayers bannerpatternlayers = (BannerPatternLayers) stack.getOrDefault(DataComponents.BANNER_PATTERNS, BannerPatternLayers.EMPTY); + + if (bannerpatternlayers.layers().isEmpty()) { +@@ -0,0 +0,0 @@ public interface CauldronInteraction { + } + } + +- private static InteractionResult dyedItemIteration(BlockState state, Level world, BlockPos pos, Player player, InteractionHand hand, ItemStack stack) { ++ private static InteractionResult dyedItemIteration(BlockState state, Level world, BlockPos pos, Player player, InteractionHand hand, ItemStack stack, final net.minecraft.core.Direction hitDirection) { // Paper - add hitDirection + if (!stack.is(ItemTags.DYEABLE)) { + return InteractionResult.TRY_WITH_EMPTY_HAND; + } else if (!stack.has(DataComponents.DYED_COLOR)) { diff --git a/src/main/java/net/minecraft/world/level/block/AbstractCauldronBlock.java b/src/main/java/net/minecraft/world/level/block/AbstractCauldronBlock.java index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 --- a/src/main/java/net/minecraft/world/level/block/AbstractCauldronBlock.java +++ b/src/main/java/net/minecraft/world/level/block/AbstractCauldronBlock.java @@ -0,0 +0,0 @@ public abstract class AbstractCauldronBlock extends Block { - ItemStack stack, BlockState state, Level world, BlockPos pos, Player player, InteractionHand hand, BlockHitResult hit - ) { + @Override + protected InteractionResult useItemOn(ItemStack stack, BlockState state, Level world, BlockPos pos, Player player, InteractionHand hand, BlockHitResult hit) { CauldronInteraction cauldronInteraction = this.interactions.map().get(stack.getItem()); - return cauldronInteraction.interact(state, world, pos, player, hand, stack); + return cauldronInteraction.interact(state, world, pos, player, hand, stack, hit.getDirection()); // Paper - pass hit direction diff --git a/patches/unapplied/server/Disable-pretty-printing-for-advancement-saving.patch b/patches/server/Disable-pretty-printing-for-advancement-saving.patch similarity index 100% rename from patches/unapplied/server/Disable-pretty-printing-for-advancement-saving.patch rename to patches/server/Disable-pretty-printing-for-advancement-saving.patch diff --git a/patches/unapplied/server/Fix-PlayerCommandPreprocessEvent-on-signed-commands.patch b/patches/server/Fix-PlayerCommandPreprocessEvent-on-signed-commands.patch similarity index 100% rename from patches/unapplied/server/Fix-PlayerCommandPreprocessEvent-on-signed-commands.patch rename to patches/server/Fix-PlayerCommandPreprocessEvent-on-signed-commands.patch diff --git a/patches/unapplied/server/Improve-entity-effect-API.patch b/patches/server/Improve-entity-effect-API.patch similarity index 97% rename from patches/unapplied/server/Improve-entity-effect-API.patch rename to patches/server/Improve-entity-effect-API.patch index f6adedddaf..927de862ec 100644 --- a/patches/unapplied/server/Improve-entity-effect-API.patch +++ b/patches/server/Improve-entity-effect-API.patch @@ -50,8 +50,8 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 @Override @@ -0,0 +0,0 @@ public class CraftPlayer extends CraftHumanEntity implements Player { - ((ca.spottedleaf.moonrise.patches.chunk_system.player.ChunkSystemServerPlayer)this.getHandle()) - .moonrise$getViewDistanceHolder().setSendViewDistance(viewDistance); + public void setSendViewDistance(final int viewDistance) { + throw new UnsupportedOperationException("Not implemented yet"); } + + // Paper start - entity effect API diff --git a/patches/unapplied/server/Item-serialization-as-json.patch b/patches/server/Item-serialization-as-json.patch similarity index 100% rename from patches/unapplied/server/Item-serialization-as-json.patch rename to patches/server/Item-serialization-as-json.patch diff --git a/patches/unapplied/server/Remove-wall-time-unused-skip-tick-protection.patch b/patches/server/Remove-wall-time-unused-skip-tick-protection.patch similarity index 100% rename from patches/unapplied/server/Remove-wall-time-unused-skip-tick-protection.patch rename to patches/server/Remove-wall-time-unused-skip-tick-protection.patch diff --git a/patches/unapplied/server/Validate-slot-in-PlayerInventory-setSlot.patch b/patches/server/Validate-slot-in-PlayerInventory-setSlot.patch similarity index 100% rename from patches/unapplied/server/Validate-slot-in-PlayerInventory-setSlot.patch rename to patches/server/Validate-slot-in-PlayerInventory-setSlot.patch diff --git a/patches/unapplied/server/Void-damage-configuration-API.patch b/patches/server/Void-damage-configuration-API.patch similarity index 91% rename from patches/unapplied/server/Void-damage-configuration-API.patch rename to patches/server/Void-damage-configuration-API.patch index 96614aa47d..23971d31da 100644 --- a/patches/unapplied/server/Void-damage-configuration-API.patch +++ b/patches/server/Void-damage-configuration-API.patch @@ -13,10 +13,9 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 public void checkBelowWorld() { + if (!this.level.getWorld().isVoidDamageEnabled()) return; // Paper - check if void damage is enabled on the world -+ // Paper start - Configurable nether ceiling damage -- if (this.getY() < (double) (this.level.getMinBuildHeight() - 64) || (this.level.getWorld().getEnvironment() == org.bukkit.World.Environment.NETHER -+ if (this.getY() < (double) (this.level.getMinBuildHeight() + this.level.getWorld().getVoidDamageMinBuildHeightOffset()) || (this.level.getWorld().getEnvironment() == org.bukkit.World.Environment.NETHER // Paper - use configured min build height offset +- if (this.getY() < (double) (this.level.getMinY() - 64) || (this.level.getWorld().getEnvironment() == org.bukkit.World.Environment.NETHER ++ if (this.getY() < (double) (this.level.getMinY() + this.level.getWorld().getVoidDamageMinBuildHeightOffset()) || (this.level.getWorld().getEnvironment() == org.bukkit.World.Environment.NETHER // Paper - use configured min build height offset && this.level.paperConfig().environment.netherCeilingVoidDamageHeight.test(v -> this.getY() >= v) && (!(this instanceof Player player) || !player.getAbilities().invulnerable))) { // Paper end - Configurable nether ceiling damage