mirror of
https://github.com/PaperMC/Paper.git
synced 2025-01-02 09:21:57 +01:00
40 lines
2.1 KiB
Diff
40 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 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
|
|
--- a/src/main/java/net/minecraft/network/protocol/game/ServerboundInteractPacket.java
|
|
+++ b/src/main/java/net/minecraft/network/protocol/game/ServerboundInteractPacket.java
|
|
@@ -0,0 +0,0 @@ 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 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
|
|
--- a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java
|
|
+++ b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java
|
|
@@ -0,0 +0,0 @@ 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
|
|
|
|
}
|
|
|