From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 From: peaches94 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 2db9ce11dc52b8fb737e3344265e2a40d07ffc26..29fa9ad2223de668c15a5e5b433704b2c4765610 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"); // Purpur - this.sensing.tick(); + if (i % 10 == 0) this.sensing.tick(); // petal - only refresh line of sight cache every half second //this.level.getProfiler().pop(); // Purpur - int i = this.level.getServer().getTickCount() + this.getId(); if (i % 2 != 0 && this.tickCount > 1) { //this.level.getProfiler().push("targetSelector"); // Purpur