mirror of
https://github.com/YatopiaMC/Yatopia.git
synced 2024-12-04 00:23:21 +01:00
cc91a8080f
* 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: 8a29f5894 [Auto] Updated Upstream (Bukkit/CraftBukkit) 8756d232c Expose server protocol version (#5416) * Updated Upstream and Sidestream(s) (Tuinity/Purpur) 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: 32b4d52 Updated Upstream (Paper) ac5adca Make sure lit is set for pre 1.14 chunks Purpur Changes: 24d9e61 Piglin portal spawn modifier 5866f36 Fix #263 - NPE on TPSBar when player disconnects 7f7f024 Updated Upstream (Paper, Tuinity, & Airplane) * bump kotlin-stdlib * Updated Upstream and Sidestream(s) (Paper/Airplane/Purpur) 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: 606cdac60 Update the view distance before scheduling chunk loads (#5269) Airplane Changes: 0789789 Updated Upstream (Tuinity) c1e4d71 Fluid cache patch Purpur Changes: 04f73c5 Fix error when using non living entity on monster egg 76c35fc Fix #287 - TPSBarTask NPE (again) * Updated Upstream and Sidestream(s) (Purpur) 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. Purpur Changes: 2e62618 Fix #280 - Ridables do not reset idle timer
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/world/entity/player/EntityHuman.java b/src/main/java/net/minecraft/world/entity/player/EntityHuman.java
|
|
index 4e1289be9302b010d3803783904eef07e604f3e8..8c8716c94d813fc6de0ec2f7e8080c339e821207 100644
|
|
--- a/src/main/java/net/minecraft/world/entity/player/EntityHuman.java
|
|
+++ b/src/main/java/net/minecraft/world/entity/player/EntityHuman.java
|
|
@@ -1177,12 +1177,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);
|
|
|