more more more more more more more more more more more work: passing the torch
This commit is contained in:
		
					parent
					
						
							
								9e63e24f0b
							
						
					
				
			
			
				commit
				
					
						411f78293c
					
				
			
		
					 54 changed files with 88 additions and 96 deletions
				
			
		| 
						 | 
				
			
			@ -1,30 +0,0 @@
 | 
			
		|||
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 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
 | 
			
		||||
--- a/src/main/java/net/minecraft/world/entity/player/Player.java
 | 
			
		||||
+++ b/src/main/java/net/minecraft/world/entity/player/Player.java
 | 
			
		||||
@@ -0,0 +0,0 @@ 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;
 | 
			
		||||
 
 | 
			
		||||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue