geforkt von Mirrors/Paper
d385af0e01
Upstream has released updates that appear to apply and compile correctly. This update has not been tested by PaperMC and as with ANY update, please do your own testing Bukkit Changes: 0a4b84d6 SPIGOT-7003: Add missing PlayerAnimationType 830db7d5 SPIGOT-5984: Add non deprecated / magic value way to set pixel in MapCanvas 20caf8ff PR-754: Add DamageCause.SONIC_BOOM CraftBukkit Changes: 576a03704 SPIGOT-7003: Add missing PlayerAnimationType 0dcc5fdd0 SPIGOT-5984: Add non deprecated / magic value way to set pixel in MapCanvas d75aacb43 Update Netty version 3b34c6bea SPIGOT-7044: Modified RandomSourceWrapper to ensure random is not null before setting seed 4b60bfd18 PR-1059: Add DamageCause.SONIC_BOOM
64 Zeilen
3.5 KiB
Diff
64 Zeilen
3.5 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 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 d5cbeb088c95537fa63a489603a71307481ee455..3100b69930682ccb9f72ba15e00254d91ab79b4f 100644
|
|
--- a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java
|
|
+++ b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java
|
|
@@ -2411,8 +2411,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) {
|