9
0
mirror of https://github.com/Winds-Studio/Leaf.git synced 2025-12-19 15:09:25 +00:00
Files
Leaf/patches/server/0028-Petal-Reduce-sensor-work.patch

27 lines
1.2 KiB
Diff

From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: peaches94 <peachescu94@gmail.com>
Date: Sun, 10 Jul 2022 15:44:38 -0500
Subject: [PATCH] Petal: Reduce sensor work
Original license: GPL v3
Original project: https://github.com/Bloom-host/Petal
this patch is focused around the sensors used for ai
delete the line of sight cache less often and use a faster nearby comparison
diff --git a/src/main/java/net/minecraft/world/entity/Mob.java b/src/main/java/net/minecraft/world/entity/Mob.java
index 27fc50571305132c86497fcb1d5b1bb514610a4e..f1a33fd186fa9c10ac99b7b0e6379902a10dfb14 100644
--- a/src/main/java/net/minecraft/world/entity/Mob.java
+++ b/src/main/java/net/minecraft/world/entity/Mob.java
@@ -867,8 +867,8 @@ public abstract class Mob extends LivingEntity {
return;
}
// Paper end
- this.sensing.tick();
- int i = this.level.getServer().getTickCount() + this.getId();
+ int i = this.level.getServer().getTickCount() + this.getId(); // petal - move up
+ if (i % 10 == 0) this.sensing.tick(); // petal - only refresh line of sight cache every half second
if (i % 2 != 0 && this.tickCount > 1) {
this.targetSelector.tickRunningGoals(false);