geforkt von Mirrors/Paper
2873869bb1
Signs no longer have a specific isEdiable state, the entire API in this regard needs updating/deprecation. The boolean field is completely gone, replaced by a uuid (which will need a new setEditingPlayer(UUID) method on the Sign interface), and the current upstream implementation of setEdiable simply flips the is_waxed state. This patch is hence not needed as it neither allows editing (which will be redone in a later patch) nor is required to copy the is_waxed boolean flag as it lives in the signs compound tag and is covered by applyTo.
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 b69e0cd17467752707a33540cd6113dc21554ca1..53487f0a4fe672298c3b83d24a2a603641afcde8 100644
|
|
--- a/src/main/java/net/minecraft/world/entity/player/Player.java
|
|
+++ b/src/main/java/net/minecraft/world/entity/player/Player.java
|
|
@@ -1239,8 +1239,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;
|
|
|