mirror of
https://github.com/PaperMC/Paper.git
synced 2024-11-23 11:06:29 +01:00
38be4f873b
Upstream has released updates that appear to apply and compile correctly. This update has not been tested by PaperMC and as with ANY update, please do your own testing Bukkit Changes: 2c64d8c4 SPIGOT-7309: Add API for jukebox inventories a6d7e4ca PR-826: Add Sniffer API CraftBukkit Changes: 93813509b SPIGOT-7309: Add API for jukebox inventories 2d5209e8d PR-1153: Handle teleport reason in spreadplayers command f5b61387e SPIGOT-7308: Fix NullPointerException when calling Jukebox#setRecord() 388d458a6 SPIGOT-7306: Fix reset of coords in default teleportTo in EntityPlayer 40b87e1af PR-1150: Add Sniffer API and handle EntityItemDropEvent Spigot Changes: 6ad4b93c SPIGOT-7298: Fix debug stick always permission left click toggle
45 lines
3.1 KiB
Diff
45 lines
3.1 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 fc42bc68ae31f4fad1c382ef3d3c482c1f335f52..21401c872035d4dc46a05c066b321d99e0d94b72 100644
|
|
--- a/src/main/java/net/minecraft/server/level/ServerPlayerGameMode.java
|
|
+++ b/src/main/java/net/minecraft/server/level/ServerPlayerGameMode.java
|
|
@@ -186,6 +186,11 @@ public class ServerPlayerGameMode {
|
|
PlayerInteractEvent event = CraftEventFactory.callPlayerInteractEvent(this.player, Action.LEFT_CLICK_BLOCK, pos, direction, this.player.getInventory().getSelected(), InteractionHand.MAIN_HAND);
|
|
if (event.isCancelled()) {
|
|
// Let the client know the block still exists
|
|
+ // Paper start - brute force neighbor blocks for any attached blocks
|
|
+ for (Direction dir : Direction.values()) {
|
|
+ this.player.connection.send(new ClientboundBlockUpdatePacket(level, pos.relative(dir)));
|
|
+ }
|
|
+ // Paper end
|
|
this.player.connection.send(new ClientboundBlockUpdatePacket(this.level, pos));
|
|
// Update any tile entity data for this block
|
|
BlockEntity tileentity = this.level.getBlockEntity(pos);
|
|
@@ -519,7 +524,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) {
|