geforkt von Mirrors/Paper
41 Zeilen
2.2 KiB
Diff
41 Zeilen
2.2 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 1b316ecf2d8725b9c91a4869e6c2362c1443160d..964101d314f182574efba09bfe3907fbbf97fb13 100644
|
|
--- a/src/main/java/net/minecraft/network/protocol/game/ServerboundInteractPacket.java
|
|
+++ b/src/main/java/net/minecraft/network/protocol/game/ServerboundInteractPacket.java
|
|
@@ -10,7 +10,7 @@ import net.minecraft.world.entity.Entity;
|
|
import net.minecraft.world.phys.Vec3;
|
|
|
|
public class ServerboundInteractPacket implements Packet<ServerGamePacketListener> {
|
|
- private final int entityId;
|
|
+ private final int entityId; public final int getEntityId() { return this.entityId; } // Paper - add accessor
|
|
private final ServerboundInteractPacket.Action action;
|
|
private final boolean usingSecondaryAction;
|
|
static final ServerboundInteractPacket.Action ATTACK_ACTION = new ServerboundInteractPacket.Action() {
|
|
diff --git a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java
|
|
index 714fb0d766b654ad05134dea9b1e1b628a939993..c8f17466fe4ccfd8fa727e15281d015c2de2aaee 100644
|
|
--- a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java
|
|
+++ b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java
|
|
@@ -1630,6 +1630,16 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Ser
|
|
}
|
|
}
|
|
}
|
|
+ // 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
|
|
|
|
}
|
|
|