mirror of
https://github.com/Winds-Studio/Leaf.git
synced 2025-12-19 15:09:25 +00:00
29 lines
1.3 KiB
Diff
29 lines
1.3 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 94b45579dc371ee980565aed2f5dee78ebd44427..48746d84f18cc8ee2f57785c65a5659ced454d39 100644
|
|
--- a/src/main/java/net/minecraft/world/entity/Mob.java
|
|
+++ b/src/main/java/net/minecraft/world/entity/Mob.java
|
|
@@ -873,10 +873,10 @@ public abstract class Mob extends LivingEntity {
|
|
return;
|
|
}
|
|
// Paper end
|
|
+ int i = this.level.getServer().getTickCount() + this.getId(); // petal - move up
|
|
this.level.getProfiler().push("sensing");
|
|
- this.sensing.tick();
|
|
+ if (i % 10 == 0) this.sensing.tick(); // petal - only refresh line of sight cache every half second
|
|
this.level.getProfiler().pop();
|
|
- int i = this.level.getServer().getTickCount() + this.getId();
|
|
|
|
if (i % 2 != 0 && this.tickCount > 1) {
|
|
this.level.getProfiler().push("targetSelector");
|