mirror of
https://github.com/PaperMC/Paper.git
synced 2024-11-22 10:35:38 +01:00
33 lines
2.2 KiB
Diff
33 lines
2.2 KiB
Diff
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
|
From: Shane Freeder <theboyetronic@gmail.com>
|
|
Date: Sun, 11 Feb 2018 10:43:46 +0000
|
|
Subject: [PATCH] Extend Player Interact cancellation
|
|
|
|
GUIs are opened on the client, meaning that the server cannot block them from opening,
|
|
However, it is possible to close these GUIs from the server.
|
|
|
|
Flower pots are also not updated on the client when interaction is cancelled, this patch
|
|
also resolves this.
|
|
|
|
Update adjacent blocks of doors, double plants, pistons and beds
|
|
when cancelling interaction.
|
|
|
|
diff --git a/src/main/java/net/minecraft/server/level/ServerPlayerGameMode.java b/src/main/java/net/minecraft/server/level/ServerPlayerGameMode.java
|
|
index 45236a077d798d6a257a2e982b58901167ecd06e..e3b7441d875b55ffce295c948f3dc867be09e042 100644
|
|
--- a/src/main/java/net/minecraft/server/level/ServerPlayerGameMode.java
|
|
+++ b/src/main/java/net/minecraft/server/level/ServerPlayerGameMode.java
|
|
@@ -519,7 +519,13 @@ public class ServerPlayerGameMode {
|
|
|
|
// send a correcting update to the client for the block above as well, this because of replaceable blocks (such as grass, sea grass etc)
|
|
player.connection.send(new ClientboundBlockUpdatePacket(world, blockposition.above()));
|
|
+ // Paper start - extend Player Interact cancellation // TODO: consider merging this into the extracted method
|
|
+ } else if (iblockdata.getBlock() instanceof net.minecraft.world.level.block.StructureBlock) {
|
|
+ player.connection.send(new net.minecraft.network.protocol.game.ClientboundContainerClosePacket(this.player.containerMenu.containerId));
|
|
+ } else if (iblockdata.getBlock() instanceof net.minecraft.world.level.block.CommandBlock) {
|
|
+ player.connection.send(new net.minecraft.network.protocol.game.ClientboundContainerClosePacket(this.player.containerMenu.containerId));
|
|
}
|
|
+ // Paper end - extend Player Interact cancellation
|
|
player.getBukkitEntity().updateInventory(); // SPIGOT-2867
|
|
enuminteractionresult = (event.useItemInHand() != Event.Result.ALLOW) ? InteractionResult.SUCCESS : InteractionResult.PASS;
|
|
} else if (this.gameModeForPlayer == GameType.SPECTATOR) {
|