diff --git a/patches/unapplied/server/Add-API-for-CanPlaceOn-and-CanDestroy-NBT-values.patch b/patches/server/Add-API-for-CanPlaceOn-and-CanDestroy-NBT-values.patch similarity index 100% rename from patches/unapplied/server/Add-API-for-CanPlaceOn-and-CanDestroy-NBT-values.patch rename to patches/server/Add-API-for-CanPlaceOn-and-CanDestroy-NBT-values.patch diff --git a/patches/unapplied/server/Add-ItemType-getItemRarity.patch b/patches/server/Add-ItemType-getItemRarity.patch similarity index 100% rename from patches/unapplied/server/Add-ItemType-getItemRarity.patch rename to patches/server/Add-ItemType-getItemRarity.patch diff --git a/patches/unapplied/server/Add-enchantment-seed-update-API.patch b/patches/server/Add-enchantment-seed-update-API.patch similarity index 100% rename from patches/unapplied/server/Add-enchantment-seed-update-API.patch rename to patches/server/Add-enchantment-seed-update-API.patch diff --git a/patches/unapplied/server/Add-even-more-Enchantment-API.patch b/patches/server/Add-even-more-Enchantment-API.patch similarity index 100% rename from patches/unapplied/server/Add-even-more-Enchantment-API.patch rename to patches/server/Add-even-more-Enchantment-API.patch diff --git a/patches/unapplied/server/Add-plugin-info-at-startup.patch b/patches/server/Add-plugin-info-at-startup.patch similarity index 100% rename from patches/unapplied/server/Add-plugin-info-at-startup.patch rename to patches/server/Add-plugin-info-at-startup.patch diff --git a/patches/unapplied/server/Add-skipping-world-symlink-scan.patch b/patches/server/Add-skipping-world-symlink-scan.patch similarity index 100% rename from patches/unapplied/server/Add-skipping-world-symlink-scan.patch rename to patches/server/Add-skipping-world-symlink-scan.patch diff --git a/patches/unapplied/server/Check-dead-flag-in-isAlive.patch b/patches/server/Check-dead-flag-in-isAlive.patch similarity index 90% rename from patches/unapplied/server/Check-dead-flag-in-isAlive.patch rename to patches/server/Check-dead-flag-in-isAlive.patch index f50646ee4d..6f85870075 100644 --- a/patches/unapplied/server/Check-dead-flag-in-isAlive.patch +++ b/patches/server/Check-dead-flag-in-isAlive.patch @@ -26,4 +26,4 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 + return !this.isRemoved() && this.getHealth() > 0.0F && !this.dead; // Paper - Check this.dead } - @Override + public boolean isLookingAtMe(LivingEntity entity, double d0, boolean flag, boolean visualShape, Predicate predicate, DoubleSupplier... entityYChecks) { diff --git a/patches/unapplied/server/Check-for-block-type-in-SculkSensorBlock-canActivate.patch b/patches/server/Check-for-block-type-in-SculkSensorBlock-canActivate.patch similarity index 100% rename from patches/unapplied/server/Check-for-block-type-in-SculkSensorBlock-canActivate.patch rename to patches/server/Check-for-block-type-in-SculkSensorBlock-canActivate.patch diff --git a/patches/unapplied/server/Configuration-for-horizontal-only-item-merging.patch b/patches/server/Configuration-for-horizontal-only-item-merging.patch similarity index 100% rename from patches/unapplied/server/Configuration-for-horizontal-only-item-merging.patch rename to patches/server/Configuration-for-horizontal-only-item-merging.patch diff --git a/patches/unapplied/server/Fire-BlockExpEvent-on-grindstone-use.patch b/patches/server/Fire-BlockExpEvent-on-grindstone-use.patch similarity index 100% rename from patches/unapplied/server/Fire-BlockExpEvent-on-grindstone-use.patch rename to patches/server/Fire-BlockExpEvent-on-grindstone-use.patch diff --git a/patches/unapplied/server/Fix-CraftBukkit-drag-system.patch b/patches/server/Fix-CraftBukkit-drag-system.patch similarity index 100% rename from patches/unapplied/server/Fix-CraftBukkit-drag-system.patch rename to patches/server/Fix-CraftBukkit-drag-system.patch diff --git a/patches/unapplied/server/Fix-InventoryOpenEvent-cancellation.patch b/patches/server/Fix-InventoryOpenEvent-cancellation.patch similarity index 68% rename from patches/unapplied/server/Fix-InventoryOpenEvent-cancellation.patch rename to patches/server/Fix-InventoryOpenEvent-cancellation.patch index 6a24eaca39..5afd95b010 100644 --- a/patches/unapplied/server/Fix-InventoryOpenEvent-cancellation.patch +++ b/patches/server/Fix-InventoryOpenEvent-cancellation.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 net.minecraft.world.entity.player.Player imple +@@ -0,0 +0,0 @@ public class ServerPlayer extends net.minecraft.world.entity.player.Player { } else if (factory instanceof ChestBlock.DoubleInventory) { // SPIGOT-5355 - double chests too :( ((ChestBlock.DoubleInventory) factory).inventorylargechest.stopOpen(this); @@ -30,22 +30,25 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 - if (itileinventory != null) { - player.openMenu(itileinventory); + if (itileinventory != null && player.openMenu(itileinventory).isPresent()) { // Paper - Fix InventoryOpenEvent cancellation - return InteractionResult.SUCCESS; + return InteractionResult.CONSUME; } else { return InteractionResult.PASS; -diff --git a/src/main/java/net/minecraft/world/entity/vehicle/ChestBoat.java b/src/main/java/net/minecraft/world/entity/vehicle/ChestBoat.java +diff --git a/src/main/java/net/minecraft/world/entity/vehicle/AbstractChestBoat.java b/src/main/java/net/minecraft/world/entity/vehicle/AbstractChestBoat.java index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 ---- a/src/main/java/net/minecraft/world/entity/vehicle/ChestBoat.java -+++ b/src/main/java/net/minecraft/world/entity/vehicle/ChestBoat.java -@@ -0,0 +0,0 @@ public class ChestBoat extends Boat implements HasCustomInventoryScreen, Contain +--- a/src/main/java/net/minecraft/world/entity/vehicle/AbstractChestBoat.java ++++ b/src/main/java/net/minecraft/world/entity/vehicle/AbstractChestBoat.java +@@ -0,0 +0,0 @@ public abstract class AbstractChestBoat extends AbstractBoat implements HasCusto @Override public void openCustomInventoryScreen(Player player) { - player.openMenu(this); -- if (!player.level().isClientSide) { -+ if (!player.level().isClientSide && player.openMenu(this).isPresent()) { // Paper - Fix InventoryOpenEvent cancellation ++ // Paper - fix inventory open cancel - moved into below if + Level world = player.level(); + +- if (world instanceof ServerLevel worldserver) { ++ if (world instanceof ServerLevel worldserver && player.openMenu(this).isPresent()) { // Paper - Fix InventoryOpenEvent cancellation this.gameEvent(GameEvent.CONTAINER_OPEN, player); - PiglinAi.angerNearbyPiglins(player, true); + PiglinAi.angerNearbyPiglins(worldserver, player, true); } diff --git a/src/main/java/net/minecraft/world/entity/vehicle/ContainerEntity.java b/src/main/java/net/minecraft/world/entity/vehicle/ContainerEntity.java index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 @@ -61,7 +64,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 + return InteractionResult.PASS; + } + // Paper end - Fix InventoryOpenEvent cancellation - return !player.level().isClientSide ? InteractionResult.CONSUME : InteractionResult.SUCCESS; + return InteractionResult.SUCCESS; } diff --git a/src/main/java/net/minecraft/world/level/block/AnvilBlock.java b/src/main/java/net/minecraft/world/level/block/AnvilBlock.java @@ -69,46 +72,43 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 --- a/src/main/java/net/minecraft/world/level/block/AnvilBlock.java +++ b/src/main/java/net/minecraft/world/level/block/AnvilBlock.java @@ -0,0 +0,0 @@ public class AnvilBlock extends FallingBlock { + @Override protected InteractionResult useWithoutItem(BlockState state, Level world, BlockPos pos, Player player, BlockHitResult hit) { - if (world.isClientSide) { - return InteractionResult.SUCCESS; -- } else { + if (!world.isClientSide) { - player.openMenu(state.getMenuProvider(world, pos)); -+ } else if (player.openMenu(state.getMenuProvider(world, pos)).isPresent()) { // Paper - Fix InventoryOpenEvent cancellation ++ if (player.openMenu(state.getMenuProvider(world, pos)).isPresent()) { // Paper - Fix InventoryOpenEvent cancellation player.awardStat(Stats.INTERACT_WITH_ANVIL); -- return InteractionResult.CONSUME; ++ } // Paper - Fix InventoryOpenEvent cancellation } -+ return InteractionResult.CONSUME; // Paper - Fix InventoryOpenEvent cancellation - } - @Nullable + return InteractionResult.SUCCESS; diff --git a/src/main/java/net/minecraft/world/level/block/BarrelBlock.java b/src/main/java/net/minecraft/world/level/block/BarrelBlock.java index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 --- a/src/main/java/net/minecraft/world/level/block/BarrelBlock.java +++ b/src/main/java/net/minecraft/world/level/block/BarrelBlock.java @@ -0,0 +0,0 @@ public class BarrelBlock extends BaseEntityBlock { - return InteractionResult.SUCCESS; - } else { - BlockEntity blockEntity = world.getBlockEntity(pos); -- if (blockEntity instanceof BarrelBlockEntity) { -- player.openMenu((BarrelBlockEntity)blockEntity); -+ if (blockEntity instanceof BarrelBlockEntity && player.openMenu((BarrelBlockEntity)blockEntity).isPresent()) { // Paper - Fix InventoryOpenEvent cancellation - player.awardStat(Stats.OPEN_BARREL); - PiglinAi.angerNearbyPiglins(player, true); - } + + @Override + protected InteractionResult useWithoutItem(BlockState state, Level world, BlockPos pos, Player player, BlockHitResult hit) { +- if (world instanceof ServerLevel serverLevel && world.getBlockEntity(pos) instanceof BarrelBlockEntity barrelBlockEntity) { +- player.openMenu(barrelBlockEntity); ++ if (world instanceof ServerLevel serverLevel && world.getBlockEntity(pos) instanceof BarrelBlockEntity barrelBlockEntity && player.openMenu(barrelBlockEntity).isPresent()) { // Paper - Fix InventoryOpenEvent cancellation + player.awardStat(Stats.OPEN_BARREL); + PiglinAi.angerNearbyPiglins(serverLevel, player, true); + } diff --git a/src/main/java/net/minecraft/world/level/block/BeaconBlock.java b/src/main/java/net/minecraft/world/level/block/BeaconBlock.java index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 --- a/src/main/java/net/minecraft/world/level/block/BeaconBlock.java +++ b/src/main/java/net/minecraft/world/level/block/BeaconBlock.java @@ -0,0 +0,0 @@ public class BeaconBlock extends BaseEntityBlock implements BeaconBeamBlock { - if (world.isClientSide) { - return InteractionResult.SUCCESS; - } else { -- if (world.getBlockEntity(pos) instanceof BeaconBlockEntity beaconBlockEntity) { -- player.openMenu(beaconBlockEntity); -+ if (world.getBlockEntity(pos) instanceof BeaconBlockEntity beaconBlockEntity && player.openMenu(beaconBlockEntity).isPresent()) { // Paper - Fix InventoryOpenEvent cancellation - player.awardStat(Stats.INTERACT_WITH_BEACON); - } + + @Override + protected InteractionResult useWithoutItem(BlockState state, Level world, BlockPos pos, Player player, BlockHitResult hit) { +- if (!world.isClientSide && world.getBlockEntity(pos) instanceof BeaconBlockEntity beaconBlockEntity) { +- player.openMenu(beaconBlockEntity); ++ if (!world.isClientSide && world.getBlockEntity(pos) instanceof BeaconBlockEntity beaconBlockEntity && player.openMenu(beaconBlockEntity).isPresent()) { // Paper - Fix InventoryOpenEvent cancellation + player.awardStat(Stats.INTERACT_WITH_BEACON); + } diff --git a/src/main/java/net/minecraft/world/level/block/BlastFurnaceBlock.java b/src/main/java/net/minecraft/world/level/block/BlastFurnaceBlock.java index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 @@ -129,102 +129,96 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 --- a/src/main/java/net/minecraft/world/level/block/BrewingStandBlock.java +++ b/src/main/java/net/minecraft/world/level/block/BrewingStandBlock.java @@ -0,0 +0,0 @@ public class BrewingStandBlock extends BaseEntityBlock { - return InteractionResult.SUCCESS; - } else { - BlockEntity blockEntity = world.getBlockEntity(pos); -- if (blockEntity instanceof BrewingStandBlockEntity) { -- player.openMenu((BrewingStandBlockEntity)blockEntity); -+ if (blockEntity instanceof BrewingStandBlockEntity && player.openMenu((BrewingStandBlockEntity)blockEntity).isPresent()) { // Paper - Fix InventoryOpenEvent cancellation - player.awardStat(Stats.INTERACT_WITH_BREWINGSTAND); - } + + @Override + protected InteractionResult useWithoutItem(BlockState state, Level world, BlockPos pos, Player player, BlockHitResult hit) { +- if (!world.isClientSide && world.getBlockEntity(pos) instanceof BrewingStandBlockEntity brewingStandBlockEntity) { +- player.openMenu(brewingStandBlockEntity); ++ if (!world.isClientSide && world.getBlockEntity(pos) instanceof BrewingStandBlockEntity brewingStandBlockEntity && player.openMenu(brewingStandBlockEntity).isPresent()) { // Paper - Fix InventoryOpenEvent cancellation + player.awardStat(Stats.INTERACT_WITH_BREWINGSTAND); + } diff --git a/src/main/java/net/minecraft/world/level/block/CartographyTableBlock.java b/src/main/java/net/minecraft/world/level/block/CartographyTableBlock.java index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 --- a/src/main/java/net/minecraft/world/level/block/CartographyTableBlock.java +++ b/src/main/java/net/minecraft/world/level/block/CartographyTableBlock.java @@ -0,0 +0,0 @@ public class CartographyTableBlock extends Block { + @Override protected InteractionResult useWithoutItem(BlockState state, Level world, BlockPos pos, Player player, BlockHitResult hit) { - if (world.isClientSide) { - return InteractionResult.SUCCESS; -- } else { + if (!world.isClientSide) { - player.openMenu(state.getMenuProvider(world, pos)); -+ } else if (player.openMenu(state.getMenuProvider(world, pos)).isPresent()) { // Paper - Fix InventoryOpenEvent cancellation ++ if (player.openMenu(state.getMenuProvider(world, pos)).isPresent()) { // Paper - Fix InventoryOpenEvent cancellation player.awardStat(Stats.INTERACT_WITH_CARTOGRAPHY_TABLE); -- return InteractionResult.CONSUME; ++ } // Paper - Fix InventoryOpenEvent cancellation } -+ return InteractionResult.CONSUME; // Paper - Fix InventoryOpenEvent cancellation - } - @Nullable + return InteractionResult.SUCCESS; diff --git a/src/main/java/net/minecraft/world/level/block/ChestBlock.java b/src/main/java/net/minecraft/world/level/block/ChestBlock.java index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 --- a/src/main/java/net/minecraft/world/level/block/ChestBlock.java +++ b/src/main/java/net/minecraft/world/level/block/ChestBlock.java @@ -0,0 +0,0 @@ public class ChestBlock extends AbstractChestBlock implements - } else { + if (world instanceof ServerLevel worldserver) { MenuProvider itileinventory = this.getMenuProvider(state, world, pos); - if (itileinventory != null) { - player.openMenu(itileinventory); + if (itileinventory != null && player.openMenu(itileinventory).isPresent()) { // Paper - Fix InventoryOpenEvent cancellation player.awardStat(this.getOpenChestStat()); - PiglinAi.angerNearbyPiglins(player, true); + PiglinAi.angerNearbyPiglins(worldserver, player, true); } diff --git a/src/main/java/net/minecraft/world/level/block/CraftingTableBlock.java b/src/main/java/net/minecraft/world/level/block/CraftingTableBlock.java index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 --- a/src/main/java/net/minecraft/world/level/block/CraftingTableBlock.java +++ b/src/main/java/net/minecraft/world/level/block/CraftingTableBlock.java @@ -0,0 +0,0 @@ public class CraftingTableBlock extends Block { - protected InteractionResult useWithoutItem(BlockState state, Level world, BlockPos pos, Player player, BlockHitResult hit) { - if (world.isClientSide) { - return InteractionResult.SUCCESS; -- } else { -- player.openMenu(state.getMenuProvider(world, pos)); -+ } else if (player.openMenu(state.getMenuProvider(world, pos)).isPresent()) { // Paper - Fix InventoryOpenEvent cancellation - player.awardStat(Stats.INTERACT_WITH_CRAFTING_TABLE); -- return InteractionResult.CONSUME; - } -+ return InteractionResult.CONSUME; // Paper - Fix InventoryOpenEvent cancellation - } - @Override + protected InteractionResult useWithoutItem(BlockState state, Level world, BlockPos pos, Player player, BlockHitResult hit) { + if (!world.isClientSide) { +- player.openMenu(state.getMenuProvider(world, pos)); ++ if (player.openMenu(state.getMenuProvider(world, pos)).isPresent()) { // Paper - Fix InventoryOpenEvent cancellation + player.awardStat(Stats.INTERACT_WITH_CRAFTING_TABLE); ++ } // Paper - Fix InventoryOpenEvent cancellation + } + + return InteractionResult.SUCCESS; diff --git a/src/main/java/net/minecraft/world/level/block/DispenserBlock.java b/src/main/java/net/minecraft/world/level/block/DispenserBlock.java index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 --- a/src/main/java/net/minecraft/world/level/block/DispenserBlock.java +++ b/src/main/java/net/minecraft/world/level/block/DispenserBlock.java @@ -0,0 +0,0 @@ public class DispenserBlock extends BaseEntityBlock { - } else { - BlockEntity tileentity = world.getBlockEntity(pos); + if (tileentity instanceof DispenserBlockEntity) { + DispenserBlockEntity tileentitydispenser = (DispenserBlockEntity) tileentity; + +- player.openMenu(tileentitydispenser); ++ if (player.openMenu(tileentitydispenser).isPresent()) { // Paper - Fix InventoryOpenEvent cancellation + player.awardStat(tileentitydispenser instanceof DropperBlockEntity ? Stats.INSPECT_DROPPER : Stats.INSPECT_DISPENSER); ++ } // Paper - Fix InventoryOpenEvent cancellation + } + } -- if (tileentity instanceof DispenserBlockEntity) { -- player.openMenu((DispenserBlockEntity) tileentity); -+ if (tileentity instanceof DispenserBlockEntity && player.openMenu((DispenserBlockEntity) tileentity).isPresent()) { // Paper - Fix InventoryOpenEvent cancellation - if (tileentity instanceof DropperBlockEntity) { - player.awardStat(Stats.INSPECT_DROPPER); - } else { diff --git a/src/main/java/net/minecraft/world/level/block/EnderChestBlock.java b/src/main/java/net/minecraft/world/level/block/EnderChestBlock.java index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 --- a/src/main/java/net/minecraft/world/level/block/EnderChestBlock.java +++ b/src/main/java/net/minecraft/world/level/block/EnderChestBlock.java @@ -0,0 +0,0 @@ public class EnderChestBlock extends AbstractChestBlock i + if (world.getBlockState(blockPos).isRedstoneConductor(world, blockPos)) { // Paper - diff on change; make sure that EnderChest#isBlocked uses the same logic + return InteractionResult.SUCCESS; } else { - EnderChestBlockEntity enderChestBlockEntity = (EnderChestBlockEntity)blockEntity; - playerEnderChestContainer.setActiveChest(enderChestBlockEntity); -- player.openMenu( -+ // Paper start - Fix InventoryOpenEvent cancellation -+ if (player.openMenu( - new SimpleMenuProvider((i, inventory, playerx) -> ChestMenu.threeRows(i, inventory, playerEnderChestContainer), CONTAINER_TITLE) -- ); -- player.awardStat(Stats.OPEN_ENDERCHEST); -- PiglinAi.angerNearbyPiglins(player, true); +- if (world instanceof ServerLevel serverLevel) { ++ // Paper start - Fix InventoryOpenEvent cancellation - moved up; ++ if (world instanceof ServerLevel serverLevel && player.openMenu( ++ new SimpleMenuProvider((i, inventory, playerx) -> ChestMenu.threeRows(i, inventory, playerEnderChestContainer), CONTAINER_TITLE) + ).isPresent()) { -+ player.awardStat(Stats.OPEN_ENDERCHEST); -+ PiglinAi.angerNearbyPiglins(player, true); -+ } -+ // Paper end - Fix InventoryOpenEvent cancellation - return InteractionResult.CONSUME; - } - } else { ++ // Paper end - Fix InventoryOpenEvent cancellation - moved up; + playerEnderChestContainer.setActiveChest(enderChestBlockEntity); +- player.openMenu( +- new SimpleMenuProvider((i, inventory, playerx) -> ChestMenu.threeRows(i, inventory, playerEnderChestContainer), CONTAINER_TITLE) +- ); ++ // Paper - Fix InventoryOpenEvent cancellation - moved up; + player.awardStat(Stats.OPEN_ENDERCHEST); + PiglinAi.angerNearbyPiglins(serverLevel, player, true); + } diff --git a/src/main/java/net/minecraft/world/level/block/FurnaceBlock.java b/src/main/java/net/minecraft/world/level/block/FurnaceBlock.java index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 --- a/src/main/java/net/minecraft/world/level/block/FurnaceBlock.java @@ -244,32 +238,29 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 --- a/src/main/java/net/minecraft/world/level/block/GrindstoneBlock.java +++ b/src/main/java/net/minecraft/world/level/block/GrindstoneBlock.java @@ -0,0 +0,0 @@ public class GrindstoneBlock extends FaceAttachedHorizontalDirectionalBlock { - protected InteractionResult useWithoutItem(BlockState state, Level world, BlockPos pos, Player player, BlockHitResult hit) { - if (world.isClientSide) { - return InteractionResult.SUCCESS; -- } else { -- player.openMenu(state.getMenuProvider(world, pos)); -+ } else if (player.openMenu(state.getMenuProvider(world, pos)).isPresent()) { // Paper - Fix InventoryOpenEvent cancellation - player.awardStat(Stats.INTERACT_WITH_GRINDSTONE); -- return InteractionResult.CONSUME; - } -+ return InteractionResult.CONSUME; // Paper - Fix InventoryOpenEvent cancellation - } - @Override + protected InteractionResult useWithoutItem(BlockState state, Level world, BlockPos pos, Player player, BlockHitResult hit) { + if (!world.isClientSide) { +- player.openMenu(state.getMenuProvider(world, pos)); ++ if (player.openMenu(state.getMenuProvider(world, pos)).isPresent()) { // Paper - Fix InventoryOpenEvent cancellation + player.awardStat(Stats.INTERACT_WITH_GRINDSTONE); ++ } // Paper - Fix InventoryOpenEvent cancellation + } + + return InteractionResult.SUCCESS; diff --git a/src/main/java/net/minecraft/world/level/block/HopperBlock.java b/src/main/java/net/minecraft/world/level/block/HopperBlock.java index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 --- a/src/main/java/net/minecraft/world/level/block/HopperBlock.java +++ b/src/main/java/net/minecraft/world/level/block/HopperBlock.java @@ -0,0 +0,0 @@ public class HopperBlock extends BaseEntityBlock { - return InteractionResult.SUCCESS; - } else { - BlockEntity blockEntity = world.getBlockEntity(pos); -- if (blockEntity instanceof HopperBlockEntity) { -- player.openMenu((HopperBlockEntity)blockEntity); -+ if (blockEntity instanceof HopperBlockEntity && player.openMenu((HopperBlockEntity)blockEntity).isPresent()) { // Paper - Fix InventoryOpenEvent cancellation - player.awardStat(Stats.INSPECT_HOPPER); - } + + @Override + protected InteractionResult useWithoutItem(BlockState state, Level world, BlockPos pos, Player player, BlockHitResult hit) { +- if (!world.isClientSide && world.getBlockEntity(pos) instanceof HopperBlockEntity hopperBlockEntity) { +- player.openMenu(hopperBlockEntity); ++ if (!world.isClientSide && world.getBlockEntity(pos) instanceof HopperBlockEntity hopperBlockEntity && player.openMenu(hopperBlockEntity).isPresent()) { // Paper - Fix InventoryOpenEvent cancellation + player.awardStat(Stats.INSPECT_HOPPER); + } diff --git a/src/main/java/net/minecraft/world/level/block/LecternBlock.java b/src/main/java/net/minecraft/world/level/block/LecternBlock.java index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 @@ -290,50 +281,46 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 --- a/src/main/java/net/minecraft/world/level/block/LoomBlock.java +++ b/src/main/java/net/minecraft/world/level/block/LoomBlock.java @@ -0,0 +0,0 @@ public class LoomBlock extends HorizontalDirectionalBlock { - protected InteractionResult useWithoutItem(BlockState state, Level world, BlockPos pos, Player player, BlockHitResult hit) { - if (world.isClientSide) { - return InteractionResult.SUCCESS; -- } else { -- player.openMenu(state.getMenuProvider(world, pos)); -+ } else if (player.openMenu(state.getMenuProvider(world, pos)).isPresent()) { // Paper - Fix InventoryOpenEvent cancellation - player.awardStat(Stats.INTERACT_WITH_LOOM); -- return InteractionResult.CONSUME; - } -+ return InteractionResult.CONSUME; // Paper - Fix InventoryOpenEvent cancellation - } - @Override + protected InteractionResult useWithoutItem(BlockState state, Level world, BlockPos pos, Player player, BlockHitResult hit) { + if (!world.isClientSide) { +- player.openMenu(state.getMenuProvider(world, pos)); ++ if (player.openMenu(state.getMenuProvider(world, pos)).isPresent()) { // Paper - Fix InventoryOpenEvent cancellation + player.awardStat(Stats.INTERACT_WITH_LOOM); ++ } // Paper - Fix InventoryOpenEvent cancellation + } + + return InteractionResult.SUCCESS; diff --git a/src/main/java/net/minecraft/world/level/block/ShulkerBoxBlock.java b/src/main/java/net/minecraft/world/level/block/ShulkerBoxBlock.java index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 --- a/src/main/java/net/minecraft/world/level/block/ShulkerBoxBlock.java +++ b/src/main/java/net/minecraft/world/level/block/ShulkerBoxBlock.java @@ -0,0 +0,0 @@ public class ShulkerBoxBlock extends BaseEntityBlock { - } else if (player.isSpectator()) { - return InteractionResult.CONSUME; - } else if (world.getBlockEntity(pos) instanceof ShulkerBoxBlockEntity shulkerBoxBlockEntity) { -- if (canOpen(state, world, pos, shulkerBoxBlockEntity)) { -- player.openMenu(shulkerBoxBlockEntity); -+ if (canOpen(state, world, pos, shulkerBoxBlockEntity) && player.openMenu(shulkerBoxBlockEntity).isPresent()) { // Paper - Fix InventoryOpenEvent cancellation - player.awardStat(Stats.OPEN_SHULKER_BOX); - PiglinAi.angerNearbyPiglins(player, true); - } + protected InteractionResult useWithoutItem(BlockState state, Level world, BlockPos pos, Player player, BlockHitResult hit) { + if (world instanceof ServerLevel serverLevel + && world.getBlockEntity(pos) instanceof ShulkerBoxBlockEntity shulkerBoxBlockEntity +- && canOpen(state, world, pos, shulkerBoxBlockEntity)) { +- player.openMenu(shulkerBoxBlockEntity); ++ && canOpen(state, world, pos, shulkerBoxBlockEntity) // Paper - Fix InventoryOpenEvent cancellation - expand if for belows check ++ && player.openMenu(shulkerBoxBlockEntity).isPresent()) { // Paper - Fix InventoryOpenEvent cancellation + player.awardStat(Stats.OPEN_SHULKER_BOX); + PiglinAi.angerNearbyPiglins(serverLevel, player, true); + } diff --git a/src/main/java/net/minecraft/world/level/block/SmithingTableBlock.java b/src/main/java/net/minecraft/world/level/block/SmithingTableBlock.java index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 --- a/src/main/java/net/minecraft/world/level/block/SmithingTableBlock.java +++ b/src/main/java/net/minecraft/world/level/block/SmithingTableBlock.java @@ -0,0 +0,0 @@ public class SmithingTableBlock extends CraftingTableBlock { + @Override protected InteractionResult useWithoutItem(BlockState state, Level world, BlockPos pos, Player player, BlockHitResult hit) { - if (world.isClientSide) { - return InteractionResult.SUCCESS; -- } else { + if (!world.isClientSide) { - player.openMenu(state.getMenuProvider(world, pos)); -+ } else if (player.openMenu(state.getMenuProvider(world, pos)).isPresent()) { // Paper - Fix InventoryOpenEvent cancellation ++ if (player.openMenu(state.getMenuProvider(world, pos)).isPresent()) { // Paper - Fix InventoryOpenEvent cancellation player.awardStat(Stats.INTERACT_WITH_SMITHING_TABLE); -- return InteractionResult.CONSUME; ++ } // Paper - Fix InventoryOpenEvent cancellation } -+ return InteractionResult.CONSUME; // Paper - Fix InventoryOpenEvent cancellation - } - } + + return InteractionResult.SUCCESS; diff --git a/src/main/java/net/minecraft/world/level/block/SmokerBlock.java b/src/main/java/net/minecraft/world/level/block/SmokerBlock.java index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 --- a/src/main/java/net/minecraft/world/level/block/SmokerBlock.java @@ -353,16 +340,13 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 --- a/src/main/java/net/minecraft/world/level/block/StonecutterBlock.java +++ b/src/main/java/net/minecraft/world/level/block/StonecutterBlock.java @@ -0,0 +0,0 @@ public class StonecutterBlock extends Block { + @Override protected InteractionResult useWithoutItem(BlockState state, Level world, BlockPos pos, Player player, BlockHitResult hit) { - if (world.isClientSide) { - return InteractionResult.SUCCESS; -- } else { + if (!world.isClientSide) { - player.openMenu(state.getMenuProvider(world, pos)); -+ } else if (player.openMenu(state.getMenuProvider(world, pos)).isPresent()) { // Paper - Fix InventoryOpenEvent cancellation ++ if (player.openMenu(state.getMenuProvider(world, pos)).isPresent()) { // Paper - Fix InventoryOpenEvent cancellation player.awardStat(Stats.INTERACT_WITH_STONECUTTER); -- return InteractionResult.CONSUME; ++ } // Paper - Fix InventoryOpenEvent cancellation } -+ return InteractionResult.CONSUME; // Paper - Fix InventoryOpenEvent cancellation - } - @Nullable + return InteractionResult.SUCCESS; diff --git a/patches/unapplied/server/Fix-PickupStatus-getting-reset.patch b/patches/server/Fix-PickupStatus-getting-reset.patch similarity index 98% rename from patches/unapplied/server/Fix-PickupStatus-getting-reset.patch rename to patches/server/Fix-PickupStatus-getting-reset.patch index 4d67fea087..9e406fb0db 100644 --- a/patches/unapplied/server/Fix-PickupStatus-getting-reset.patch +++ b/patches/server/Fix-PickupStatus-getting-reset.patch @@ -29,8 +29,8 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 +++ b/src/main/java/net/minecraft/world/entity/projectile/Projectile.java @@ -0,0 +0,0 @@ public abstract class Projectile extends Entity implements TraceableEntity { public boolean deflect(ProjectileDeflection deflection, @Nullable Entity deflector, @Nullable Entity owner, boolean fromAttack) { + deflection.deflect(this, deflector, this.random); if (!this.level().isClientSide) { - deflection.deflect(this, deflector, this.random); - this.setOwner(owner); + // Paper start - Fix PickupStatus getting reset + if (this instanceof AbstractArrow arrow) { diff --git a/patches/unapplied/server/Fix-SculkBloomEvent-firing-for-block-entity-loading.patch b/patches/server/Fix-SculkBloomEvent-firing-for-block-entity-loading.patch similarity index 100% rename from patches/unapplied/server/Fix-SculkBloomEvent-firing-for-block-entity-loading.patch rename to patches/server/Fix-SculkBloomEvent-firing-for-block-entity-loading.patch diff --git a/patches/unapplied/server/Fix-synchronise-sending-chat-to-client-with-updating.patch b/patches/server/Fix-synchronise-sending-chat-to-client-with-updating.patch similarity index 100% rename from patches/unapplied/server/Fix-synchronise-sending-chat-to-client-with-updating.patch rename to patches/server/Fix-synchronise-sending-chat-to-client-with-updating.patch diff --git a/patches/unapplied/server/Leashable-API.patch b/patches/server/Leashable-API.patch similarity index 93% rename from patches/unapplied/server/Leashable-API.patch rename to patches/server/Leashable-API.patch index 86faf80b76..14d46d908d 100644 --- a/patches/unapplied/server/Leashable-API.patch +++ b/patches/server/Leashable-API.patch @@ -68,10 +68,10 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 import org.bukkit.entity.Boat; import org.bukkit.entity.Entity; --public class CraftBoat extends CraftVehicle implements Boat { -+public class CraftBoat extends CraftVehicle implements Boat, io.papermc.paper.entity.PaperLeashable { // Paper - Leashable API +-public abstract class CraftBoat extends CraftVehicle implements Boat { ++public abstract class CraftBoat extends CraftVehicle implements Boat, io.papermc.paper.entity.PaperLeashable { // Paper - Leashable API - public CraftBoat(CraftServer server, net.minecraft.world.entity.vehicle.Boat entity) { + public CraftBoat(CraftServer server, AbstractBoat entity) { super(server, entity); diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftLivingEntity.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftLivingEntity.java index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 @@ -138,7 +138,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 super(server, entity); paperPathfinder = new com.destroystokyo.paper.entity.PaperPathfinder(entity); // Paper - Mob Pathfinding API @@ -0,0 +0,0 @@ public abstract class CraftMob extends CraftLivingEntity implements Mob { - return getHandle().getExperienceReward((ServerLevel) this.getHandle().level(), null); + return getHandle().getExperienceReward((net.minecraft.server.level.ServerLevel) this.getHandle().level(), null); } // Paper end + diff --git a/patches/unapplied/server/Make-interaction-leniency-distance-configurable.patch b/patches/server/Make-interaction-leniency-distance-configurable.patch similarity index 96% rename from patches/unapplied/server/Make-interaction-leniency-distance-configurable.patch rename to patches/server/Make-interaction-leniency-distance-configurable.patch index b2afb5d25c..42fbaa592b 100644 --- a/patches/unapplied/server/Make-interaction-leniency-distance-configurable.patch +++ b/patches/server/Make-interaction-leniency-distance-configurable.patch @@ -19,8 +19,8 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 AABB axisalignedbb = entity.getBoundingBox(); -- if (this.player.canInteractWithEntity(axisalignedbb, 1.0D)) { -+ if (this.player.canInteractWithEntity(axisalignedbb, io.papermc.paper.configuration.GlobalConfiguration.get().misc.clientInteractionLeniencyDistance.or(1.0D))) { // Paper - configurable lenience value for interact range +- if (this.player.canInteractWithEntity(axisalignedbb, 3.0D)) { ++ if (this.player.canInteractWithEntity(axisalignedbb, io.papermc.paper.configuration.GlobalConfiguration.get().misc.clientInteractionLeniencyDistance.or(3.0D))) { // Paper - configurable lenience value for interact range packet.dispatch(new ServerboundInteractPacket.Handler() { private void performInteraction(InteractionHand enumhand, ServerGamePacketListenerImpl.EntityInteraction playerconnection_a, PlayerInteractEntityEvent event) { // CraftBukkit ItemStack itemstack = ServerGamePacketListenerImpl.this.player.getItemInHand(enumhand); diff --git a/patches/unapplied/server/Only-call-EntityDamageEvents-before-actuallyHurt.patch b/patches/server/Only-call-EntityDamageEvents-before-actuallyHurt.patch similarity index 94% rename from patches/unapplied/server/Only-call-EntityDamageEvents-before-actuallyHurt.patch rename to patches/server/Only-call-EntityDamageEvents-before-actuallyHurt.patch index 1ea5fb3e95..cbfa4f7432 100644 --- a/patches/unapplied/server/Only-call-EntityDamageEvents-before-actuallyHurt.patch +++ b/patches/server/Only-call-EntityDamageEvents-before-actuallyHurt.patch @@ -39,7 +39,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 + // Paper end - only call damage event when actuallyHurt will be called - move call logic down + // CraftBukkit start - if (!this.actuallyHurt(source, (float) event.getFinalDamage() - this.lastHurt, event)) { + if (!this.actuallyHurt(world, source, (float) event.getFinalDamage() - this.lastHurt, event)) { return false; @@ -0,0 +0,0 @@ public abstract class LivingEntity extends Entity implements Attackable { this.lastHurt = amount; @@ -50,7 +50,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 + amount = computeAmountFromEntityDamageEvent(event); + // Paper end - only call damage event when actuallyHurt will be called - move call logic down // CraftBukkit start - if (!this.actuallyHurt(source, (float) event.getFinalDamage(), event)) { + if (!this.actuallyHurt(world, source, (float) event.getFinalDamage(), event)) { return false; @@ -0,0 +0,0 @@ public abstract class LivingEntity extends Entity implements Attackable { } diff --git a/patches/unapplied/server/Remove-set-damage-lootable-item-function-from-compas.patch b/patches/server/Remove-set-damage-lootable-item-function-from-compas.patch similarity index 100% rename from patches/unapplied/server/Remove-set-damage-lootable-item-function-from-compas.patch rename to patches/server/Remove-set-damage-lootable-item-function-from-compas.patch diff --git a/patches/unapplied/server/fix-horse-inventories.patch b/patches/server/fix-horse-inventories.patch similarity index 100% rename from patches/unapplied/server/fix-horse-inventories.patch rename to patches/server/fix-horse-inventories.patch diff --git a/patches/unapplied/server/Properly-destroy-placed-blocks-on-the-end-platform.patch b/patches/unapplied/server/Properly-destroy-placed-blocks-on-the-end-platform.patch deleted file mode 100644 index d76758496b..0000000000 --- a/patches/unapplied/server/Properly-destroy-placed-blocks-on-the-end-platform.patch +++ /dev/null @@ -1,26 +0,0 @@ -From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 -From: DerEchtePilz <81232921+DerEchtePilz@users.noreply.github.com> -Date: Sun, 18 Aug 2024 13:05:31 +0200 -Subject: [PATCH] Properly destroy placed blocks on the end platform - -The craftbukkit provided implementation of LevelAccessor, -BlockStateListPopulator, does not support destroyBlock calls, simply -ignoring them. - -This causes the destroyBlock calls during the generation of the end -platform to be lost. The patch moves the destroy calls and executes them -on the actual world access. - -diff --git a/src/main/java/net/minecraft/world/level/levelgen/feature/EndPlatformFeature.java b/src/main/java/net/minecraft/world/level/levelgen/feature/EndPlatformFeature.java -index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 ---- a/src/main/java/net/minecraft/world/level/levelgen/feature/EndPlatformFeature.java -+++ b/src/main/java/net/minecraft/world/level/levelgen/feature/EndPlatformFeature.java -@@ -0,0 +0,0 @@ public class EndPlatformFeature extends Feature { - // CraftBukkit start - if (!blockList.getBlockState(blockposition_mutableblockposition1).is(block)) { - if (flag) { -- blockList.destroyBlock(blockposition_mutableblockposition1, true, (Entity) null); -+ // blockList.destroyBlock(blockposition_mutableblockposition1, true, (Entity) null); // Paper - moved down - cb implementation of LevelAccessor does not support destroyBlock - } - - blockList.setBlock(blockposition_mutableblockposition1, block.defaultBlockState(), 3);