geforkt von Mirrors/Paper
90fe0d58a5
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: 897a0a23 SPIGOT-5753: Back PotionType by a minecraft registry 255b2aa1 SPIGOT-7080: Add World#locateNearestBiome ff984826 Remove javadoc.io doc links CraftBukkit Changes: 71b0135cc SPIGOT-5753: Back PotionType by a minecraft registry a6bcb8489 SPIGOT-7080: Add World#locateNearestBiome ad0e57434 SPIGOT-7502: CraftMetaItem - cannot deserialize BlockStateTag b3efca57a SPIGOT-6400: Use Mockito instead of InvocationHandler 38c599f9d PR-1272: Only allow one entity in CraftItem instead of two f065271ac SPIGOT-7498: ChunkSnapshot.getBlockEmittedLight() gets 64 blocks upper in Overworld Spigot Changes: e0e223fe Remove javadoc.io doc links
31 Zeilen
1.5 KiB
Diff
31 Zeilen
1.5 KiB
Diff
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
|
From: Owen1212055 <23108066+Owen1212055@users.noreply.github.com>
|
|
Date: Sun, 18 Sep 2022 13:10:18 -0400
|
|
Subject: [PATCH] Add PrePlayerAttackEntityEvent
|
|
|
|
|
|
diff --git a/src/main/java/net/minecraft/world/entity/player/Player.java b/src/main/java/net/minecraft/world/entity/player/Player.java
|
|
index b40961ad53437a5aa603f658ed56fca827de5716..6bf59f8e7f23ffabd2c6f739fe0daf9da6246e1d 100644
|
|
--- a/src/main/java/net/minecraft/world/entity/player/Player.java
|
|
+++ b/src/main/java/net/minecraft/world/entity/player/Player.java
|
|
@@ -1245,8 +1245,17 @@ public abstract class Player extends LivingEntity {
|
|
}
|
|
|
|
public void attack(Entity target) {
|
|
- if (target.isAttackable()) {
|
|
- if (!target.skipAttackInteraction(this)) {
|
|
+ // Paper start - PlayerAttackEntityEvent
|
|
+ boolean willAttack = target.isAttackable() && !target.skipAttackInteraction(this); // Vanilla logic
|
|
+ io.papermc.paper.event.player.PrePlayerAttackEntityEvent playerAttackEntityEvent = new io.papermc.paper.event.player.PrePlayerAttackEntityEvent(
|
|
+ (org.bukkit.entity.Player) this.getBukkitEntity(),
|
|
+ target.getBukkitEntity(),
|
|
+ willAttack
|
|
+ );
|
|
+
|
|
+ if (playerAttackEntityEvent.callEvent() && willAttack) { // Logic moved to willAttack local variable.
|
|
+ {
|
|
+ // Paper end
|
|
float f = (float) this.getAttributeValue(Attributes.ATTACK_DAMAGE);
|
|
float f1;
|
|
|