diff options
author | Owen <[email protected]> | 2022-03-11 15:13:46 -0500 |
---|---|---|
committer | GitHub <[email protected]> | 2022-03-11 21:13:46 +0100 |
commit | ea1efef1164aa7653119eb4be000749930e5b4da (patch) | |
tree | 104968ec407cf897e14388b14d2bf397844c8279 /patches/server/0079-Add-PlayerUseUnknownEntityEvent.patch | |
parent | 1790528a6104c7c801e02a6f6d2ec0dda70e2af9 (diff) | |
download | Paper-ea1efef1164aa7653119eb4be000749930e5b4da.tar.gz Paper-ea1efef1164aa7653119eb4be000749930e5b4da.zip |
Remove Patches (#7541)
Diffstat (limited to 'patches/server/0079-Add-PlayerUseUnknownEntityEvent.patch')
-rw-r--r-- | patches/server/0079-Add-PlayerUseUnknownEntityEvent.patch | 63 |
1 files changed, 63 insertions, 0 deletions
diff --git a/patches/server/0079-Add-PlayerUseUnknownEntityEvent.patch b/patches/server/0079-Add-PlayerUseUnknownEntityEvent.patch new file mode 100644 index 0000000000..da2c587acd --- /dev/null +++ b/patches/server/0079-Add-PlayerUseUnknownEntityEvent.patch @@ -0,0 +1,63 @@ +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: Jedediah Smith <[email protected]> +Date: Sat, 2 Apr 2016 05:09:16 -0400 +Subject: [PATCH] Add PlayerUseUnknownEntityEvent + + +diff --git a/src/main/java/net/minecraft/network/protocol/game/ServerboundInteractPacket.java b/src/main/java/net/minecraft/network/protocol/game/ServerboundInteractPacket.java +index 8834ed411a7db86b4d2b88183a1315317107d719..c45b5ab6776f3ac79f856c3a6467c510e20db25a 100644 +--- a/src/main/java/net/minecraft/network/protocol/game/ServerboundInteractPacket.java ++++ b/src/main/java/net/minecraft/network/protocol/game/ServerboundInteractPacket.java +@@ -10,8 +10,8 @@ import net.minecraft.world.entity.Entity; + import net.minecraft.world.phys.Vec3; + + public class ServerboundInteractPacket implements Packet<ServerGamePacketListener> { +- private final int entityId; +- private final ServerboundInteractPacket.Action action; ++ private final int entityId; public final int getEntityId() { return this.entityId; } // Paper - add accessor ++ private final ServerboundInteractPacket.Action action; public final ServerboundInteractPacket.ActionType getActionType() { return this.action.getType(); } // Paper - add accessor + private final boolean usingSecondaryAction; + static final ServerboundInteractPacket.Action ATTACK_ACTION = new ServerboundInteractPacket.Action() { + @Override +diff --git a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java +index 0429a019d8f25dc9df6c3a9d7e28eea739431a71..8e976184215b2db7684bb0488e4a8124b5dedde0 100644 +--- a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java ++++ b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java +@@ -2219,8 +2219,37 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Ser + }); + } + } ++ // Paper start - fire event ++ else { ++ packet.dispatch(new net.minecraft.network.protocol.game.ServerboundInteractPacket.Handler() { ++ @Override ++ public void onInteraction(net.minecraft.world.InteractionHand hand) { ++ ServerGamePacketListenerImpl.this.callPlayerUseUnknownEntityEvent(packet, hand); ++ } ++ ++ @Override ++ public void onInteraction(net.minecraft.world.InteractionHand hand, net.minecraft.world.phys.Vec3 pos) { ++ ServerGamePacketListenerImpl.this.callPlayerUseUnknownEntityEvent(packet, hand); ++ } ++ ++ @Override ++ public void onAttack() { ++ ServerGamePacketListenerImpl.this.callPlayerUseUnknownEntityEvent(packet, net.minecraft.world.InteractionHand.MAIN_HAND); ++ } ++ }); ++ } ++ ++ } + ++ private void callPlayerUseUnknownEntityEvent(ServerboundInteractPacket packet, InteractionHand hand) { ++ this.cserver.getPluginManager().callEvent(new com.destroystokyo.paper.event.player.PlayerUseUnknownEntityEvent( ++ this.getCraftPlayer(), ++ packet.getEntityId(), ++ packet.getActionType() == ServerboundInteractPacket.ActionType.ATTACK, ++ hand == InteractionHand.MAIN_HAND ? EquipmentSlot.HAND : EquipmentSlot.OFF_HAND ++ )); + } ++ // Paper end + + @Override + public void handleClientCommand(ServerboundClientCommandPacket packet) { |