mirror of
https://github.com/Winds-Studio/Leaf.git
synced 2025-12-27 10:59:16 +00:00
Originally vanilla logic is to use stream, and Mojang switched it to Guava's Collections2 since 1.21.4. It is much faster than using stream or manually adding to a new ArrayList. Manually adding to a new ArrayList requires allocating a new object array. However, the Collections2 lazy handles filter condition on iteration, so much better.
24 lines
1.1 KiB
Diff
24 lines
1.1 KiB
Diff
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
|
From: hayanesuru <hayanesuru@outlook.jp>
|
|
Date: Fri, 4 Jul 2025 03:06:55 +0900
|
|
Subject: [PATCH] optimize no action time
|
|
|
|
|
|
diff --git a/net/minecraft/world/entity/monster/Monster.java b/net/minecraft/world/entity/monster/Monster.java
|
|
index 04d5910d736dee2a88a2602f4a98495459277157..22fd0fe972a732aae409f0a0ab2aa5756a9b06ce 100644
|
|
--- a/net/minecraft/world/entity/monster/Monster.java
|
|
+++ b/net/minecraft/world/entity/monster/Monster.java
|
|
@@ -46,6 +46,12 @@ public abstract class Monster extends PathfinderMob implements Enemy {
|
|
}
|
|
|
|
protected void updateNoActionTime() {
|
|
+ // Leaf start - optimize no action time
|
|
+ if (org.dreeam.leaf.config.modules.opt.OptimizeNoActionTime.disableLightCheck) {
|
|
+ this.noActionTime++;
|
|
+ return;
|
|
+ }
|
|
+ // Leaf end - optimize no action time
|
|
float lightLevelDependentMagicValue = this.getLightLevelDependentMagicValue();
|
|
if (lightLevelDependentMagicValue > 0.5F) {
|
|
this.noActionTime += 2;
|