9
0
mirror of https://github.com/Samsuik/Sakura.git synced 2025-12-28 19:29:07 +00:00
Files
SakuraMC/patches/server/0072-Change-shields-to-reduce-damage.patch
Samsuik ac8701995c Updated Upstream (Paper)
Upstream has released updates that appear to apply and compile correctly

Paper Changes:
PaperMC/Paper@906df69 Prevent internal NPE on ItemStack#damage (#10836)
PaperMC/Paper@79e2cb6 Update upstream (Bukkit/CraftBukkit/Spigot) (#10875)
2024-06-13 17:00:07 +01:00

25 lines
1.4 KiB
Diff

From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: Samsuik <kfian294ma4@gmail.com>
Date: Fri, 23 Feb 2024 02:07:03 +0000
Subject: [PATCH] Change shields to reduce damage
diff --git a/src/main/java/net/minecraft/world/entity/LivingEntity.java b/src/main/java/net/minecraft/world/entity/LivingEntity.java
index ec501831c187b6d3aaa9396325289d080647fb12..5727ab8a124a31a53e92ab2ed3ab58416b539688 100644
--- a/src/main/java/net/minecraft/world/entity/LivingEntity.java
+++ b/src/main/java/net/minecraft/world/entity/LivingEntity.java
@@ -2323,7 +2323,13 @@ public abstract class LivingEntity extends Entity implements Attackable {
Function<Double, Double> blocking = new Function<Double, Double>() {
@Override
public Double apply(Double f) {
+ // Sakura start - shield damage reduction
+ if (!level().sakuraConfig().players.combat.shieldDamageReduction || damagesource.getDirectEntity() instanceof AbstractArrow) {
return -((LivingEntity.this.isDamageSourceBlocked(damagesource)) ? f : 0.0);
+ } else {
+ return -(LivingEntity.this.isBlocking() ? f * 0.5 : 0.0);
+ }
+ // Sakura end - shield damage reduction
}
};
float blockingModifier = blocking.apply((double) f).floatValue();