Files
Shiroha/shiroha-server/minecraft-patches/features/0051-Petal-Reduce-sensor-work.patch
T

29 lines
1.8 KiB
Diff
Raw Normal View History

2026-07-09 00:03:09 +08:00
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: MrHua269 <mrhua269@gmail.com>
Date: Sat, 18 Apr 2026 12:30:47 +0800
Subject: [PATCH] Petal: Reduce sensor work
Co-authored by: peaches94 <peachescu94@gmail.com>
As part of: Petal (https://github.com/Bloom-host/Petal/blob/cc691540fb48240f38b376f3d94c8b0db2b60d99/patches/server/0005-feat-reduce-sensor-work.patch)
Licensed under: GPL-3.0 (https://github.com/Bloom-host/Petal/blob/cc691540fb48240f38b376f3d94c8b0db2b60d99/LICENSE)
diff --git a/net/minecraft/world/entity/Mob.java b/net/minecraft/world/entity/Mob.java
2026-07-14 15:09:17 +08:00
index 60db243d8d9680900f75238e93740b08307f2086..ab60915f052893a34b54d161e253fe24447a9f24 100644
2026-07-09 00:03:09 +08:00
--- a/net/minecraft/world/entity/Mob.java
+++ b/net/minecraft/world/entity/Mob.java
@@ -840,11 +840,12 @@ public abstract class Mob extends LivingEntity implements Targeting, EquipmentUs
return;
}
// Paper end - Allow nerfed mobs to jump and float
2026-07-14 11:32:51 +08:00
+ int idBasedTickCount = this.tickCount + this.getId(); // Shiroha - Petal - Move up
2026-07-09 00:03:09 +08:00
ProfilerFiller profiler = Profiler.get();
profiler.push("sensing");
- this.sensing.tick();
2026-07-14 12:22:17 +08:00
+ if (idBasedTickCount % io.nanachiyo0721.shiroha.config.modules.optimizations.PetalReduceSensorWorkConfig.delayTicks == 0 || !io.nanachiyo0721.shiroha.config.modules.optimizations.PetalReduceSensorWorkConfig.enabled) this.sensing.tick(); // Shiroha - Petal - Reduce sensor work
2026-07-09 00:03:09 +08:00
profiler.pop();
- int idBasedTickCount = this.tickCount + this.getId();
2026-07-14 11:32:51 +08:00
+ //int idBasedTickCount = this.tickCount + this.getId(); // Shiroha - Petal - Move up
2026-07-09 00:03:09 +08:00
if (idBasedTickCount % 2 != 0 && this.tickCount > 1) {
profiler.push("targetSelector");
this.targetSelector.tickRunningGoals(false);