mirror of
https://github.com/YatopiaMC/Yatopia.git
synced 2024-12-03 08:05:02 +01:00
15bf6a2103
* Updated Upstream and Sidestream(s) (Paper) Upstream/An Sidestream has released updates that appears to apply and compile correctly This update has NOT been tested by YatopiaMC and as with ANY update, please do your own testing. Paper Changes: 808bd9198 Add fast alternative constructor for Vector3f (#5339) e849c51da fix #5336 0b25bacfc fix patch 'Remove streams from SensorNearest' (fixes #5330) 4d287e31c Use Adventure for `/version` command feedback, add copy to clipboard click event (#5333) * Updated Upstream and Sidestream(s) (Tuinity) Upstream/An Sidestream has released updates that appears to apply and compile correctly This update has NOT been tested by YatopiaMC and as with ANY update, please do your own testing. Tuinity Changes: 19ac660 Move region chunk unload & poi unload hook up 38ad5a1 Do not run close logic for inventories on chunk unload fb75a6f Do not allow the server to unload chunks at request of plugins
67 lines
3.1 KiB
Diff
67 lines
3.1 KiB
Diff
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
|
From: Ivan Pekov <ivan@mrivanplays.com>
|
|
Date: Tue, 22 Sep 2020 12:52:34 +0300
|
|
Subject: [PATCH] PlayerAttackEntityEvent
|
|
|
|
Added per request
|
|
|
|
diff --git a/src/main/java/net/minecraft/server/EntityHuman.java b/src/main/java/net/minecraft/server/EntityHuman.java
|
|
index f506a11a1f5774488eebd13fa80cd6eb090f7446..15a2065abf7c187a9b92bd743240085e2a61a906 100644
|
|
--- a/src/main/java/net/minecraft/server/EntityHuman.java
|
|
+++ b/src/main/java/net/minecraft/server/EntityHuman.java
|
|
@@ -1077,12 +1077,50 @@ public abstract class EntityHuman extends EntityLiving {
|
|
|
|
flag2 = flag2 && !world.paperConfig.disablePlayerCrits; // Paper
|
|
flag2 = flag2 && !this.isSprinting();
|
|
- if (flag2) {
|
|
- this.isCritical = true; // Purpur
|
|
- f *= 1.5F;
|
|
+ /* // Yatopia start - PlayerAttackEntityEvent
|
|
+ if (flag2) {
|
|
+ this.isCritical = true; // Purpur
|
|
+ f *= 1.5F;
|
|
+ }
|
|
+
|
|
+ f += f1;
|
|
+ */
|
|
+ net.yatopia.api.event.PlayerAttackEntityEvent playerAttackEntityEvent =
|
|
+ new net.yatopia.api.event.PlayerAttackEntityEvent(
|
|
+ getBukkitEntity(),
|
|
+ entity.getBukkitEntity(),
|
|
+ org.bukkit.craftbukkit.inventory.CraftItemStack.asBukkitCopy(getItemInMainHand()),
|
|
+ flag2, f + f1
|
|
+ );
|
|
+ float totalDamage = f + f1;
|
|
+ org.bukkit.Bukkit.getPluginManager().callEvent(playerAttackEntityEvent);
|
|
+ if (playerAttackEntityEvent.isCancelled()) {
|
|
+ return;
|
|
}
|
|
+ flag2 = playerAttackEntityEvent.isCritical() && !world.paperConfig.disablePlayerCrits;
|
|
+ if (playerAttackEntityEvent.getDamage() == totalDamage) {
|
|
+ if (flag2) {
|
|
+ this.isCritical = true; // Purpur
|
|
+ f *= 1.5F;
|
|
+ }
|
|
+ f += f1;
|
|
+ } else {
|
|
+ if (playerAttackEntityEvent.getDamage() < 0) {
|
|
+ return;
|
|
+ }
|
|
+ float damage = playerAttackEntityEvent.getDamage() - f1;
|
|
+ if (damage < 0) {
|
|
+ return;
|
|
+ }
|
|
+ if (flag2) {
|
|
+ this.isCritical = true; // Purpur
|
|
+ damage *= 1.5F;
|
|
+ }
|
|
+ damage += f1;
|
|
+ f = damage;
|
|
+ }
|
|
+ // Yatopia end
|
|
|
|
- f += f1;
|
|
boolean flag3 = false;
|
|
double d0 = (double) (this.A - this.z);
|
|
|