9
0
mirror of https://github.com/Winds-Studio/Leaf.git synced 2025-12-31 04:46:38 +00:00
Files
Leaf/leaf-server/minecraft-patches/features/0156-Optimise-MobEffectUtil-getDigSpeedAmplification.patch
hayanesuru 124dc64a0d update async target finding and block finding (#296)
* reduce overhead on poll

* more async search entities

* async block search

* rename search entity config

* cleanup

* fix async search block too frequent

* remove alertOther Experimental anno

* Adjust the delay of RemoveBlockGoal to match vanilla behavior

* Optimize TemptGoal

* rollback interval change

* cleanup

* add async finding to DefendVillageTargetGoal

* rollback interval change for NearestHealableRaiderTargetGoal

* config searchPlayer

* fix DefendVillageTargetGoal condition doesn't check

* add async finding to BegGoal

* rollback interval change for FollowMobGoal

* cleanup

* add async finding to some follow goal

* add async finding to TemptGoal

* handle searchPlayer config

* fix TemptGoal
2025-04-24 13:18:53 +03:00

30 lines
1.3 KiB
Diff

From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: Taiyou06 <kaandindar21@gmail.com>
Date: Mon, 14 Apr 2025 18:07:21 +0200
Subject: [PATCH] Optimise MobEffectUtil#getDigSpeedAmplification
diff --git a/net/minecraft/world/effect/MobEffectUtil.java b/net/minecraft/world/effect/MobEffectUtil.java
index cbf1b6af928aa439c3264b302e5f1a1ddd4c14f0..c59a503ef8bc2dabcf9f7c85c8d93fb1fcadf71f 100644
--- a/net/minecraft/world/effect/MobEffectUtil.java
+++ b/net/minecraft/world/effect/MobEffectUtil.java
@@ -29,12 +29,14 @@ public final class MobEffectUtil {
public static int getDigSpeedAmplification(LivingEntity entity) {
int i = 0;
int i1 = 0;
- if (entity.hasEffect(MobEffects.DIG_SPEED)) {
- i = entity.getEffect(MobEffects.DIG_SPEED).getAmplifier();
+ MobEffectInstance digEffect = entity.getEffect(MobEffects.DIG_SPEED);
+ if (digEffect != null) {
+ i = digEffect.getAmplifier();
}
- if (entity.hasEffect(MobEffects.CONDUIT_POWER)) {
- i1 = entity.getEffect(MobEffects.CONDUIT_POWER).getAmplifier();
+ MobEffectInstance conduitEffect = entity.getEffect(MobEffects.CONDUIT_POWER);
+ if (conduitEffect != null) {
+ i1 = conduitEffect.getAmplifier();
}
return Math.max(i, i1);