From d76d40d7706a1a2bf90a22c7c12024cbb93031ec Mon Sep 17 00:00:00 2001 From: Samsuik Date: Sat, 9 Dec 2023 16:15:25 +0000 Subject: [PATCH] Iron golems take fall damage --- .../0004-Sakura-Configuration-Files.patch | 5 +-- .../0056-Iron-golems-take-fall-damage.patch | 31 +++++++++++++++++++ 2 files changed, 34 insertions(+), 2 deletions(-) create mode 100644 patches/server/0056-Iron-golems-take-fall-damage.patch diff --git a/patches/server/0004-Sakura-Configuration-Files.patch b/patches/server/0004-Sakura-Configuration-Files.patch index b33736b..eedfc9f 100644 --- a/patches/server/0004-Sakura-Configuration-Files.patch +++ b/patches/server/0004-Sakura-Configuration-Files.patch @@ -621,10 +621,10 @@ index 0000000000000000000000000000000000000000..5fc23a0b579d7cbe03baf5324bef887a +} diff --git a/src/main/java/me/samsuik/sakura/configuration/WorldConfiguration.java b/src/main/java/me/samsuik/sakura/configuration/WorldConfiguration.java new file mode 100644 -index 0000000000000000000000000000000000000000..123708bc292843dca90501d757346769f8b9f353 +index 0000000000000000000000000000000000000000..376322d8e47e24a76c7162d6379c7f71debd7505 --- /dev/null +++ b/src/main/java/me/samsuik/sakura/configuration/WorldConfiguration.java -@@ -0,0 +1,169 @@ +@@ -0,0 +1,170 @@ +package me.samsuik.sakura.configuration; + +import com.mojang.logging.LogUtils; @@ -775,6 +775,7 @@ index 0000000000000000000000000000000000000000..123708bc292843dca90501d757346769 + public boolean disableMobAi = false; + public boolean waterSensitivity = true; + public boolean instantDeathAnimation = false; ++ public boolean ironGolemsTakeFalldamage = false; + + public Items items = new Items(); + public class Items extends ConfigurationPart { diff --git a/patches/server/0056-Iron-golems-take-fall-damage.patch b/patches/server/0056-Iron-golems-take-fall-damage.patch new file mode 100644 index 0000000..72cbf75 --- /dev/null +++ b/patches/server/0056-Iron-golems-take-fall-damage.patch @@ -0,0 +1,31 @@ +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: Samsuik +Date: Sat, 9 Dec 2023 16:10:29 +0000 +Subject: [PATCH] Iron golems take fall damage + + +diff --git a/src/main/java/net/minecraft/world/entity/animal/IronGolem.java b/src/main/java/net/minecraft/world/entity/animal/IronGolem.java +index f383928fc5b331ddf128bdcb6a23010d8fe088d3..4dd778901f0327d30b993dffd73f75f631bb3a9b 100644 +--- a/src/main/java/net/minecraft/world/entity/animal/IronGolem.java ++++ b/src/main/java/net/minecraft/world/entity/animal/IronGolem.java +@@ -240,6 +240,20 @@ public class IronGolem extends AbstractGolem implements NeutralMob { + + } + ++ // Sakura start ++ @Override ++ protected int calculateFallDamage(float fallDistance, float damageMultiplier) { ++ if (!this.level().sakuraConfig().entity.ironGolemsTakeFalldamage) { ++ return super.calculateFallDamage(fallDistance, damageMultiplier); ++ } else { ++ net.minecraft.world.effect.MobEffectInstance mobeffect = this.getEffect(net.minecraft.world.effect.MobEffects.JUMP); ++ float f2 = mobeffect == null ? 0.0F : (float) (mobeffect.getAmplifier() + 1); ++ ++ return net.minecraft.util.Mth.ceil((fallDistance - 3.0F - f2) * damageMultiplier); ++ } ++ } ++ // Sakura end ++ + public int getAttackAnimationTick() { + return this.attackAnimationTick; + }