mirror of
https://github.com/YatopiaMC/Yatopia.git
synced 2024-11-29 14:15:43 +01:00
5431509f72
Remove more fucked up stream conversions. Also use cached recipe in furnaces when possible, and only lookup when absolutely necessary. On a server with 8.8K furnaces, the average tick rate was ~0.3-1ms higher when furnaces were burning vs idle furnaces, as compared to ~10ms difference in earlier revisions of these patches.
60 lines
2.7 KiB
Diff
60 lines
2.7 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 9fa597b49f156be49777a5b51e7c231c7728a42f..ff6a8473027d82db1fbf3ab18fd0cfe08e2d9d78 100644
|
|
--- a/src/main/java/net/minecraft/server/EntityHuman.java
|
|
+++ b/src/main/java/net/minecraft/server/EntityHuman.java
|
|
@@ -1049,11 +1049,47 @@ public abstract class EntityHuman extends EntityLiving {
|
|
|
|
flag2 = flag2 && !world.paperConfig.disablePlayerCrits; // Paper
|
|
flag2 = flag2 && !this.isSprinting();
|
|
+ /* // Yatopia start - PlayerAttackEntityEvent
|
|
if (flag2) {
|
|
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) {
|
|
+ f *= 1.5F;
|
|
+ }
|
|
+ f += f1;
|
|
+ } else {
|
|
+ if (playerAttackEntityEvent.getDamage() < 0) {
|
|
+ return;
|
|
+ }
|
|
+ float damage = playerAttackEntityEvent.getDamage() - f1;
|
|
+ if (damage < 0) {
|
|
+ return;
|
|
+ }
|
|
+ if (flag2) {
|
|
+ damage *= 1.5F;
|
|
+ }
|
|
+ damage += f1;
|
|
+ f = damage;
|
|
+ }
|
|
+ // Yatopia end
|
|
+
|
|
boolean flag3 = false;
|
|
double d0 = (double) (this.A - this.z);
|
|
|