geforkt von Mirrors/Paper
1020
Dieser Commit ist enthalten in:
Ursprung
6ca02ef090
Commit
42e181498c
@ -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<LivingEntity> predicate, DoubleSupplier... entityYChecks) {
|
@ -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,44 +72,41 @@ 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;
|
||||
}
|
||||
+ return InteractionResult.CONSUME; // Paper - Fix InventoryOpenEvent cancellation
|
||||
+ } // 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
|
||||
|
||||
@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(player, true);
|
||||
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) {
|
||||
|
||||
@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.getBlockEntity(pos) instanceof BeaconBlockEntity beaconBlockEntity && player.openMenu(beaconBlockEntity).isPresent()) { // Paper - Fix InventoryOpenEvent cancellation
|
||||
+ if (!world.isClientSide && world.getBlockEntity(pos) instanceof BeaconBlockEntity beaconBlockEntity && player.openMenu(beaconBlockEntity).isPresent()) { // Paper - Fix InventoryOpenEvent cancellation
|
||||
player.awardStat(Stats.INTERACT_WITH_BEACON);
|
||||
}
|
||||
|
||||
@ -129,12 +129,12 @@ 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
|
||||
|
||||
@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);
|
||||
}
|
||||
|
||||
@ -143,88 +143,82 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
||||
--- 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;
|
||||
}
|
||||
+ return InteractionResult.CONSUME; // Paper - Fix InventoryOpenEvent cancellation
|
||||
+ } // 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<ChestBlockEntity> 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 {
|
||||
@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_CRAFTING_TABLE);
|
||||
- return InteractionResult.CONSUME;
|
||||
}
|
||||
+ return InteractionResult.CONSUME; // Paper - Fix InventoryOpenEvent cancellation
|
||||
+ } // Paper - Fix InventoryOpenEvent cancellation
|
||||
}
|
||||
|
||||
@Override
|
||||
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<EnderChestBlockEntity> 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;
|
||||
- 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()) {
|
||||
+ // Paper end - Fix InventoryOpenEvent cancellation - moved up;
|
||||
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)
|
||||
- new SimpleMenuProvider((i, inventory, playerx) -> ChestMenu.threeRows(i, inventory, playerEnderChestContainer), CONTAINER_TITLE)
|
||||
- );
|
||||
- player.awardStat(Stats.OPEN_ENDERCHEST);
|
||||
- PiglinAi.angerNearbyPiglins(player, true);
|
||||
+ ).isPresent()) {
|
||||
+ player.awardStat(Stats.OPEN_ENDERCHEST);
|
||||
+ PiglinAi.angerNearbyPiglins(player, true);
|
||||
+ }
|
||||
+ // Paper end - Fix InventoryOpenEvent cancellation
|
||||
return InteractionResult.CONSUME;
|
||||
+ // Paper - Fix InventoryOpenEvent cancellation - moved up;
|
||||
player.awardStat(Stats.OPEN_ENDERCHEST);
|
||||
PiglinAi.angerNearbyPiglins(serverLevel, player, true);
|
||||
}
|
||||
} else {
|
||||
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,30 +238,27 @@ 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 {
|
||||
@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_GRINDSTONE);
|
||||
- return InteractionResult.CONSUME;
|
||||
}
|
||||
+ return InteractionResult.CONSUME; // Paper - Fix InventoryOpenEvent cancellation
|
||||
+ } // Paper - Fix InventoryOpenEvent cancellation
|
||||
}
|
||||
|
||||
@Override
|
||||
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
|
||||
|
||||
@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);
|
||||
}
|
||||
|
||||
@ -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 {
|
||||
@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_LOOM);
|
||||
- return InteractionResult.CONSUME;
|
||||
}
|
||||
+ return InteractionResult.CONSUME; // Paper - Fix InventoryOpenEvent cancellation
|
||||
+ } // Paper - Fix InventoryOpenEvent cancellation
|
||||
}
|
||||
|
||||
@Override
|
||||
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)) {
|
||||
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);
|
||||
+ if (canOpen(state, world, pos, shulkerBoxBlockEntity) && player.openMenu(shulkerBoxBlockEntity).isPresent()) { // Paper - Fix InventoryOpenEvent cancellation
|
||||
+ && 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(player, true);
|
||||
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;
|
||||
}
|
||||
+ return InteractionResult.CONSUME; // Paper - Fix InventoryOpenEvent cancellation
|
||||
}
|
||||
+ } // 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;
|
||||
}
|
||||
+ return InteractionResult.CONSUME; // Paper - Fix InventoryOpenEvent cancellation
|
||||
+ } // Paper - Fix InventoryOpenEvent cancellation
|
||||
}
|
||||
|
||||
@Nullable
|
||||
return InteractionResult.SUCCESS;
|
@ -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) {
|
||||
if (!this.level().isClientSide) {
|
||||
deflection.deflect(this, deflector, this.random);
|
||||
if (!this.level().isClientSide) {
|
||||
- this.setOwner(owner);
|
||||
+ // Paper start - Fix PickupStatus getting reset
|
||||
+ if (this instanceof AbstractArrow arrow) {
|
@ -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
|
||||
+
|
@ -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);
|
@ -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 {
|
||||
}
|
@ -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<NoneFeatureConfiguration> {
|
||||
// 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);
|
Laden…
In neuem Issue referenzieren
Einen Benutzer sperren