41 lines
2.1 KiB
Diff
41 lines
2.1 KiB
Diff
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
|
From: Jedediah Smith <jedediah@silencegreys.com>
|
|
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 9ff5b938f97da5ca1f13fd2bcbf3d13e8b8f760c..e1d219550006d22b0a8e949e820488c6ed96dc58 100644
|
|
--- a/src/main/java/net/minecraft/network/protocol/game/ServerboundInteractPacket.java
|
|
+++ b/src/main/java/net/minecraft/network/protocol/game/ServerboundInteractPacket.java
|
|
@@ -11,7 +11,7 @@ import net.minecraft.world.phys.Vec3;
|
|
|
|
public class ServerboundInteractPacket implements Packet<ServerGamePacketListener> {
|
|
|
|
- private int entityId;
|
|
+ private int entityId; public int getEntityId() { return this.entityId; } // Paper - add accessor
|
|
private ServerboundInteractPacket.Action action;
|
|
private Vec3 location;
|
|
private InteractionHand hand;
|
|
diff --git a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java
|
|
index 73683ba59d0aff3a61f555b4ae15753e9e4e6141..e2bfe8e916c9e59af81627ea0ee449970527034d 100644
|
|
--- a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java
|
|
+++ b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java
|
|
@@ -2198,6 +2198,16 @@ public class ServerGamePacketListenerImpl implements ServerGamePacketListener {
|
|
}
|
|
}
|
|
}
|
|
+ // Paper start - fire event
|
|
+ else {
|
|
+ this.craftServer.getPluginManager().callEvent(new com.destroystokyo.paper.event.player.PlayerUseUnknownEntityEvent(
|
|
+ this.getPlayer(),
|
|
+ packet.getEntityId(),
|
|
+ packet.getAction() == ServerboundInteractPacket.Action.ATTACK,
|
|
+ packet.getHand() == InteractionHand.MAIN_HAND ? EquipmentSlot.HAND : EquipmentSlot.OFF_HAND
|
|
+ ));
|
|
+ }
|
|
+ // Paper end
|
|
|
|
}
|
|
|