mirror of
https://github.com/PaperMC/Paper.git
synced 2024-11-24 08:06:41 +01:00
29 lines
2.2 KiB
Diff
29 lines
2.2 KiB
Diff
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
|
From: TheMolkaPL <themolkapl@gmail.com>
|
|
Date: Sun, 21 Jun 2020 17:21:46 +0200
|
|
Subject: [PATCH] Fix interact event not being called in adventure
|
|
|
|
Call PlayerInteractEvent when left-clicking on a block in adventure mode
|
|
|
|
diff --git a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java
|
|
index dd468a6f8185545930eae95d8f22beb25ae493b0..b5b451ce6f29c69123b975a7b1943ca17388e6db 100644
|
|
--- a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java
|
|
+++ b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java
|
|
@@ -1847,7 +1847,7 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Tic
|
|
MutableComponent ichatmutablecomponent = Component.translatable("build.tooHigh", i - 1).withStyle(ChatFormatting.RED);
|
|
|
|
this.player.sendSystemMessage(ichatmutablecomponent, true);
|
|
- } else if (enuminteractionresult.shouldSwing()) {
|
|
+ } else if (enuminteractionresult.shouldSwing() && !this.player.gameMode.interactResult) { // Paper
|
|
this.player.swing(enumhand, true);
|
|
}
|
|
}
|
|
@@ -2473,7 +2473,7 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Tic
|
|
// SPIGOT-5607: Only call interact event if no block or entity is being clicked. Use bukkit ray trace method, because it handles blocks and entities at the same time
|
|
org.bukkit.util.RayTraceResult result = this.player.level.getWorld().rayTrace(origin, origin.getDirection(), d3, org.bukkit.FluidCollisionMode.NEVER, false, 0.1, entity -> entity != this.player.getBukkitEntity());
|
|
|
|
- if (result == null) {
|
|
+ if (result == null || this.player.gameMode.getGameModeForPlayer() == GameType.ADVENTURE) { // Paper - call PlayerInteractEvent when left-clicking on a block in adventure mode
|
|
CraftEventFactory.callPlayerInteractEvent(this.player, Action.LEFT_CLICK_AIR, this.player.getInventory().getSelected(), InteractionHand.MAIN_HAND);
|
|
}
|
|
|