|
|
@@ -8,7 +8,7 @@ diff --git a/src/main/java/net/minecraft/server/level/ServerPlayer.java b/src/ma
|
|
|
|
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
|
|
|
|
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
|
|
|
|
--- a/src/main/java/net/minecraft/server/level/ServerPlayer.java
|
|
|
|
--- a/src/main/java/net/minecraft/server/level/ServerPlayer.java
|
|
|
|
+++ b/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) {
|
|
|
|
} else if (factory instanceof ChestBlock.DoubleInventory) {
|
|
|
|
// SPIGOT-5355 - double chests too :(
|
|
|
|
// SPIGOT-5355 - double chests too :(
|
|
|
|
((ChestBlock.DoubleInventory) factory).inventorylargechest.stopOpen(this);
|
|
|
|
((ChestBlock.DoubleInventory) factory).inventorylargechest.stopOpen(this);
|
|
|
@@ -30,22 +30,25 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
|
|
|
- if (itileinventory != null) {
|
|
|
|
- if (itileinventory != null) {
|
|
|
|
- player.openMenu(itileinventory);
|
|
|
|
- player.openMenu(itileinventory);
|
|
|
|
+ if (itileinventory != null && player.openMenu(itileinventory).isPresent()) { // Paper - Fix InventoryOpenEvent cancellation
|
|
|
|
+ if (itileinventory != null && player.openMenu(itileinventory).isPresent()) { // Paper - Fix InventoryOpenEvent cancellation
|
|
|
|
return InteractionResult.SUCCESS;
|
|
|
|
return InteractionResult.CONSUME;
|
|
|
|
} else {
|
|
|
|
} else {
|
|
|
|
return InteractionResult.PASS;
|
|
|
|
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
|
|
|
|
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
|
|
|
|
--- a/src/main/java/net/minecraft/world/entity/vehicle/ChestBoat.java
|
|
|
|
--- a/src/main/java/net/minecraft/world/entity/vehicle/AbstractChestBoat.java
|
|
|
|
+++ b/src/main/java/net/minecraft/world/entity/vehicle/ChestBoat.java
|
|
|
|
+++ b/src/main/java/net/minecraft/world/entity/vehicle/AbstractChestBoat.java
|
|
|
|
@@ -0,0 +0,0 @@ public class ChestBoat extends Boat implements HasCustomInventoryScreen, Contain
|
|
|
|
@@ -0,0 +0,0 @@ public abstract class AbstractChestBoat extends AbstractBoat implements HasCusto
|
|
|
|
|
|
|
|
|
|
|
|
@Override
|
|
|
|
@Override
|
|
|
|
public void openCustomInventoryScreen(Player player) {
|
|
|
|
public void openCustomInventoryScreen(Player player) {
|
|
|
|
- player.openMenu(this);
|
|
|
|
- player.openMenu(this);
|
|
|
|
- if (!player.level().isClientSide) {
|
|
|
|
+ // Paper - fix inventory open cancel - moved into below if
|
|
|
|
+ if (!player.level().isClientSide && player.openMenu(this).isPresent()) { // Paper - Fix InventoryOpenEvent cancellation
|
|
|
|
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);
|
|
|
|
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
|
|
|
|
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
|
|
|
|
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
|
|
|
@@ -61,7 +64,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
|
|
|
+ return InteractionResult.PASS;
|
|
|
|
+ return InteractionResult.PASS;
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ // Paper end - Fix InventoryOpenEvent cancellation
|
|
|
|
+ // 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
|
|
|
|
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
|
|
|
|
--- a/src/main/java/net/minecraft/world/level/block/AnvilBlock.java
|
|
|
|
+++ b/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 {
|
|
|
|
@@ -0,0 +0,0 @@ public class AnvilBlock extends FallingBlock {
|
|
|
|
|
|
|
|
@Override
|
|
|
|
protected InteractionResult useWithoutItem(BlockState state, Level world, BlockPos pos, Player player, BlockHitResult hit) {
|
|
|
|
protected InteractionResult useWithoutItem(BlockState state, Level world, BlockPos pos, Player player, BlockHitResult hit) {
|
|
|
|
if (world.isClientSide) {
|
|
|
|
if (!world.isClientSide) {
|
|
|
|
return InteractionResult.SUCCESS;
|
|
|
|
|
|
|
|
- } else {
|
|
|
|
|
|
|
|
- player.openMenu(state.getMenuProvider(world, pos));
|
|
|
|
- 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);
|
|
|
|
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
|
|
|
|
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
|
|
|
|
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
|
|
|
|
--- a/src/main/java/net/minecraft/world/level/block/BarrelBlock.java
|
|
|
|
--- a/src/main/java/net/minecraft/world/level/block/BarrelBlock.java
|
|
|
|
+++ b/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 {
|
|
|
|
@@ -0,0 +0,0 @@ public class BarrelBlock extends BaseEntityBlock {
|
|
|
|
return InteractionResult.SUCCESS;
|
|
|
|
|
|
|
|
} else {
|
|
|
|
@Override
|
|
|
|
BlockEntity blockEntity = world.getBlockEntity(pos);
|
|
|
|
protected InteractionResult useWithoutItem(BlockState state, Level world, BlockPos pos, Player player, BlockHitResult hit) {
|
|
|
|
- if (blockEntity instanceof BarrelBlockEntity) {
|
|
|
|
- if (world instanceof ServerLevel serverLevel && world.getBlockEntity(pos) instanceof BarrelBlockEntity barrelBlockEntity) {
|
|
|
|
- player.openMenu((BarrelBlockEntity)blockEntity);
|
|
|
|
- player.openMenu(barrelBlockEntity);
|
|
|
|
+ if (blockEntity instanceof BarrelBlockEntity && player.openMenu((BarrelBlockEntity)blockEntity).isPresent()) { // Paper - Fix InventoryOpenEvent cancellation
|
|
|
|
+ if (world instanceof ServerLevel serverLevel && world.getBlockEntity(pos) instanceof BarrelBlockEntity barrelBlockEntity && player.openMenu(barrelBlockEntity).isPresent()) { // Paper - Fix InventoryOpenEvent cancellation
|
|
|
|
player.awardStat(Stats.OPEN_BARREL);
|
|
|
|
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
|
|
|
|
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
|
|
|
|
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
|
|
|
|
--- a/src/main/java/net/minecraft/world/level/block/BeaconBlock.java
|
|
|
|
--- a/src/main/java/net/minecraft/world/level/block/BeaconBlock.java
|
|
|
|
+++ b/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 {
|
|
|
|
@@ -0,0 +0,0 @@ public class BeaconBlock extends BaseEntityBlock implements BeaconBeamBlock {
|
|
|
|
if (world.isClientSide) {
|
|
|
|
|
|
|
|
return InteractionResult.SUCCESS;
|
|
|
|
@Override
|
|
|
|
} else {
|
|
|
|
protected InteractionResult useWithoutItem(BlockState state, Level world, BlockPos pos, Player player, BlockHitResult hit) {
|
|
|
|
- if (world.getBlockEntity(pos) instanceof BeaconBlockEntity beaconBlockEntity) {
|
|
|
|
- if (!world.isClientSide && world.getBlockEntity(pos) instanceof BeaconBlockEntity beaconBlockEntity) {
|
|
|
|
- player.openMenu(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);
|
|
|
|
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
|
|
|
|
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
|
|
|
|
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
|
|
|
@@ -129,102 +129,96 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
|
|
|
--- a/src/main/java/net/minecraft/world/level/block/BrewingStandBlock.java
|
|
|
|
--- a/src/main/java/net/minecraft/world/level/block/BrewingStandBlock.java
|
|
|
|
+++ b/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 {
|
|
|
|
@@ -0,0 +0,0 @@ public class BrewingStandBlock extends BaseEntityBlock {
|
|
|
|
return InteractionResult.SUCCESS;
|
|
|
|
|
|
|
|
} else {
|
|
|
|
@Override
|
|
|
|
BlockEntity blockEntity = world.getBlockEntity(pos);
|
|
|
|
protected InteractionResult useWithoutItem(BlockState state, Level world, BlockPos pos, Player player, BlockHitResult hit) {
|
|
|
|
- if (blockEntity instanceof BrewingStandBlockEntity) {
|
|
|
|
- if (!world.isClientSide && world.getBlockEntity(pos) instanceof BrewingStandBlockEntity brewingStandBlockEntity) {
|
|
|
|
- player.openMenu((BrewingStandBlockEntity)blockEntity);
|
|
|
|
- player.openMenu(brewingStandBlockEntity);
|
|
|
|
+ if (blockEntity instanceof BrewingStandBlockEntity && player.openMenu((BrewingStandBlockEntity)blockEntity).isPresent()) { // Paper - Fix InventoryOpenEvent cancellation
|
|
|
|
+ if (!world.isClientSide && world.getBlockEntity(pos) instanceof BrewingStandBlockEntity brewingStandBlockEntity && player.openMenu(brewingStandBlockEntity).isPresent()) { // Paper - Fix InventoryOpenEvent cancellation
|
|
|
|
player.awardStat(Stats.INTERACT_WITH_BREWINGSTAND);
|
|
|
|
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
|
|
|
|
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
|
|
|
|
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
|
|
|
|
--- a/src/main/java/net/minecraft/world/level/block/CartographyTableBlock.java
|
|
|
|
--- a/src/main/java/net/minecraft/world/level/block/CartographyTableBlock.java
|
|
|
|
+++ b/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 {
|
|
|
|
@@ -0,0 +0,0 @@ public class CartographyTableBlock extends Block {
|
|
|
|
|
|
|
|
@Override
|
|
|
|
protected InteractionResult useWithoutItem(BlockState state, Level world, BlockPos pos, Player player, BlockHitResult hit) {
|
|
|
|
protected InteractionResult useWithoutItem(BlockState state, Level world, BlockPos pos, Player player, BlockHitResult hit) {
|
|
|
|
if (world.isClientSide) {
|
|
|
|
if (!world.isClientSide) {
|
|
|
|
return InteractionResult.SUCCESS;
|
|
|
|
|
|
|
|
- } else {
|
|
|
|
|
|
|
|
- player.openMenu(state.getMenuProvider(world, pos));
|
|
|
|
- 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);
|
|
|
|
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
|
|
|
|
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
|
|
|
|
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
|
|
|
|
--- a/src/main/java/net/minecraft/world/level/block/ChestBlock.java
|
|
|
|
--- a/src/main/java/net/minecraft/world/level/block/ChestBlock.java
|
|
|
|
+++ b/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
|
|
|
|
@@ -0,0 +0,0 @@ public class ChestBlock extends AbstractChestBlock<ChestBlockEntity> implements
|
|
|
|
} else {
|
|
|
|
if (world instanceof ServerLevel worldserver) {
|
|
|
|
MenuProvider itileinventory = this.getMenuProvider(state, world, pos);
|
|
|
|
MenuProvider itileinventory = this.getMenuProvider(state, world, pos);
|
|
|
|
|
|
|
|
|
|
|
|
- if (itileinventory != null) {
|
|
|
|
- if (itileinventory != null) {
|
|
|
|
- player.openMenu(itileinventory);
|
|
|
|
- player.openMenu(itileinventory);
|
|
|
|
+ if (itileinventory != null && player.openMenu(itileinventory).isPresent()) { // Paper - Fix InventoryOpenEvent cancellation
|
|
|
|
+ if (itileinventory != null && player.openMenu(itileinventory).isPresent()) { // Paper - Fix InventoryOpenEvent cancellation
|
|
|
|
player.awardStat(this.getOpenChestStat());
|
|
|
|
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
|
|
|
|
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
|
|
|
|
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
|
|
|
|
--- a/src/main/java/net/minecraft/world/level/block/CraftingTableBlock.java
|
|
|
|
--- a/src/main/java/net/minecraft/world/level/block/CraftingTableBlock.java
|
|
|
|
+++ b/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 {
|
|
|
|
@@ -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
|
|
|
|
@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
|
|
|
|
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
|
|
|
|
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
|
|
|
|
--- a/src/main/java/net/minecraft/world/level/block/DispenserBlock.java
|
|
|
|
--- a/src/main/java/net/minecraft/world/level/block/DispenserBlock.java
|
|
|
|
+++ b/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 {
|
|
|
|
@@ -0,0 +0,0 @@ public class DispenserBlock extends BaseEntityBlock {
|
|
|
|
} else {
|
|
|
|
if (tileentity instanceof DispenserBlockEntity) {
|
|
|
|
BlockEntity tileentity = world.getBlockEntity(pos);
|
|
|
|
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
|
|
|
|
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
|
|
|
|
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
|
|
|
|
--- a/src/main/java/net/minecraft/world/level/block/EnderChestBlock.java
|
|
|
|
--- a/src/main/java/net/minecraft/world/level/block/EnderChestBlock.java
|
|
|
|
+++ b/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
|
|
|
|
@@ -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 {
|
|
|
|
} else {
|
|
|
|
EnderChestBlockEntity enderChestBlockEntity = (EnderChestBlockEntity)blockEntity;
|
|
|
|
- if (world instanceof ServerLevel serverLevel) {
|
|
|
|
playerEnderChestContainer.setActiveChest(enderChestBlockEntity);
|
|
|
|
+ // Paper start - Fix InventoryOpenEvent cancellation - moved up;
|
|
|
|
- player.openMenu(
|
|
|
|
+ if (world instanceof ServerLevel serverLevel && player.openMenu(
|
|
|
|
+ // Paper start - Fix InventoryOpenEvent cancellation
|
|
|
|
+ new SimpleMenuProvider((i, inventory, playerx) -> ChestMenu.threeRows(i, inventory, playerEnderChestContainer), CONTAINER_TITLE)
|
|
|
|
+ if (player.openMenu(
|
|
|
|
|
|
|
|
new SimpleMenuProvider((i, inventory, playerx) -> ChestMenu.threeRows(i, inventory, playerEnderChestContainer), CONTAINER_TITLE)
|
|
|
|
|
|
|
|
- );
|
|
|
|
|
|
|
|
- player.awardStat(Stats.OPEN_ENDERCHEST);
|
|
|
|
|
|
|
|
- PiglinAi.angerNearbyPiglins(player, true);
|
|
|
|
|
|
|
|
+ ).isPresent()) {
|
|
|
|
+ ).isPresent()) {
|
|
|
|
+ player.awardStat(Stats.OPEN_ENDERCHEST);
|
|
|
|
+ // Paper end - Fix InventoryOpenEvent cancellation - moved up;
|
|
|
|
+ PiglinAi.angerNearbyPiglins(player, true);
|
|
|
|
playerEnderChestContainer.setActiveChest(enderChestBlockEntity);
|
|
|
|
+ }
|
|
|
|
- player.openMenu(
|
|
|
|
+ // Paper end - Fix InventoryOpenEvent cancellation
|
|
|
|
- new SimpleMenuProvider((i, inventory, playerx) -> ChestMenu.threeRows(i, inventory, playerEnderChestContainer), CONTAINER_TITLE)
|
|
|
|
return InteractionResult.CONSUME;
|
|
|
|
- );
|
|
|
|
}
|
|
|
|
+ // Paper - Fix InventoryOpenEvent cancellation - moved up;
|
|
|
|
} else {
|
|
|
|
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
|
|
|
|
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
|
|
|
|
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
|
|
|
|
--- a/src/main/java/net/minecraft/world/level/block/FurnaceBlock.java
|
|
|
|
--- 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
|
|
|
|
--- a/src/main/java/net/minecraft/world/level/block/GrindstoneBlock.java
|
|
|
|
+++ b/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 {
|
|
|
|
@@ -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
|
|
|
|
@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
|
|
|
|
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
|
|
|
|
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
|
|
|
|
--- a/src/main/java/net/minecraft/world/level/block/HopperBlock.java
|
|
|
|
--- a/src/main/java/net/minecraft/world/level/block/HopperBlock.java
|
|
|
|
+++ b/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 {
|
|
|
|
@@ -0,0 +0,0 @@ public class HopperBlock extends BaseEntityBlock {
|
|
|
|
return InteractionResult.SUCCESS;
|
|
|
|
|
|
|
|
} else {
|
|
|
|
@Override
|
|
|
|
BlockEntity blockEntity = world.getBlockEntity(pos);
|
|
|
|
protected InteractionResult useWithoutItem(BlockState state, Level world, BlockPos pos, Player player, BlockHitResult hit) {
|
|
|
|
- if (blockEntity instanceof HopperBlockEntity) {
|
|
|
|
- if (!world.isClientSide && world.getBlockEntity(pos) instanceof HopperBlockEntity hopperBlockEntity) {
|
|
|
|
- player.openMenu((HopperBlockEntity)blockEntity);
|
|
|
|
- player.openMenu(hopperBlockEntity);
|
|
|
|
+ if (blockEntity instanceof HopperBlockEntity && player.openMenu((HopperBlockEntity)blockEntity).isPresent()) { // Paper - Fix InventoryOpenEvent cancellation
|
|
|
|
+ if (!world.isClientSide && world.getBlockEntity(pos) instanceof HopperBlockEntity hopperBlockEntity && player.openMenu(hopperBlockEntity).isPresent()) { // Paper - Fix InventoryOpenEvent cancellation
|
|
|
|
player.awardStat(Stats.INSPECT_HOPPER);
|
|
|
|
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
|
|
|
|
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
|
|
|
|
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
|
|
|
@@ -290,50 +281,46 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
|
|
|
--- a/src/main/java/net/minecraft/world/level/block/LoomBlock.java
|
|
|
|
--- a/src/main/java/net/minecraft/world/level/block/LoomBlock.java
|
|
|
|
+++ b/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 {
|
|
|
|
@@ -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
|
|
|
|
@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
|
|
|
|
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
|
|
|
|
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
|
|
|
|
--- a/src/main/java/net/minecraft/world/level/block/ShulkerBoxBlock.java
|
|
|
|
--- a/src/main/java/net/minecraft/world/level/block/ShulkerBoxBlock.java
|
|
|
|
+++ b/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 {
|
|
|
|
@@ -0,0 +0,0 @@ public class ShulkerBoxBlock extends BaseEntityBlock {
|
|
|
|
} else if (player.isSpectator()) {
|
|
|
|
protected InteractionResult useWithoutItem(BlockState state, Level world, BlockPos pos, Player player, BlockHitResult hit) {
|
|
|
|
return InteractionResult.CONSUME;
|
|
|
|
if (world instanceof ServerLevel serverLevel
|
|
|
|
} else if (world.getBlockEntity(pos) instanceof ShulkerBoxBlockEntity shulkerBoxBlockEntity) {
|
|
|
|
&& world.getBlockEntity(pos) instanceof ShulkerBoxBlockEntity shulkerBoxBlockEntity
|
|
|
|
- if (canOpen(state, world, pos, shulkerBoxBlockEntity)) {
|
|
|
|
- && canOpen(state, world, pos, shulkerBoxBlockEntity)) {
|
|
|
|
- player.openMenu(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.awardStat(Stats.OPEN_SHULKER_BOX);
|
|
|
|
+ && player.openMenu(shulkerBoxBlockEntity).isPresent()) { // Paper - Fix InventoryOpenEvent cancellation
|
|
|
|
PiglinAi.angerNearbyPiglins(player, true);
|
|
|
|
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
|
|
|
|
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
|
|
|
|
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
|
|
|
|
--- a/src/main/java/net/minecraft/world/level/block/SmithingTableBlock.java
|
|
|
|
--- a/src/main/java/net/minecraft/world/level/block/SmithingTableBlock.java
|
|
|
|
+++ b/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 {
|
|
|
|
@@ -0,0 +0,0 @@ public class SmithingTableBlock extends CraftingTableBlock {
|
|
|
|
|
|
|
|
@Override
|
|
|
|
protected InteractionResult useWithoutItem(BlockState state, Level world, BlockPos pos, Player player, BlockHitResult hit) {
|
|
|
|
protected InteractionResult useWithoutItem(BlockState state, Level world, BlockPos pos, Player player, BlockHitResult hit) {
|
|
|
|
if (world.isClientSide) {
|
|
|
|
if (!world.isClientSide) {
|
|
|
|
return InteractionResult.SUCCESS;
|
|
|
|
|
|
|
|
- } else {
|
|
|
|
|
|
|
|
- player.openMenu(state.getMenuProvider(world, pos));
|
|
|
|
- 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);
|
|
|
|
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
|
|
|
|
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
|
|
|
|
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
|
|
|
|
--- a/src/main/java/net/minecraft/world/level/block/SmokerBlock.java
|
|
|
|
--- 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
|
|
|
|
--- a/src/main/java/net/minecraft/world/level/block/StonecutterBlock.java
|
|
|
|
+++ b/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 {
|
|
|
|
@@ -0,0 +0,0 @@ public class StonecutterBlock extends Block {
|
|
|
|
|
|
|
|
@Override
|
|
|
|
protected InteractionResult useWithoutItem(BlockState state, Level world, BlockPos pos, Player player, BlockHitResult hit) {
|
|
|
|
protected InteractionResult useWithoutItem(BlockState state, Level world, BlockPos pos, Player player, BlockHitResult hit) {
|
|
|
|
if (world.isClientSide) {
|
|
|
|
if (!world.isClientSide) {
|
|
|
|
return InteractionResult.SUCCESS;
|
|
|
|
|
|
|
|
- } else {
|
|
|
|
|
|
|
|
- player.openMenu(state.getMenuProvider(world, pos));
|
|
|
|
- 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);
|
|
|
|
player.awardStat(Stats.INTERACT_WITH_STONECUTTER);
|
|
|
|
- return InteractionResult.CONSUME;
|
|
|
|
+ } // Paper - Fix InventoryOpenEvent cancellation
|
|
|
|
}
|
|
|
|
}
|
|
|
|
+ return InteractionResult.CONSUME; // Paper - Fix InventoryOpenEvent cancellation
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@Nullable
|
|
|
|
return InteractionResult.SUCCESS;
|