Leaf: Lithium faster hash palette

This is a part of Leaf(https://github.com/Winds-Studio/Leaf/blob/8293ae2d0ada9df24e944f755b50e93208c1496d/leaf-server/minecraft-patches/features/0281-Lithium-faster-hash-palette.patch)

Original proj license: https://github.com/Winds-Studio/Leaf/blob/8293ae2d0ada9df24e944f755b50e93208c1496d/LICENSE.md

This patch is based on the following mixins:
* "net/caffeinemc/mods/lithium/mixin/chunk/palette/StrategyMixin.java"
By: 2No2Name <2No2Name@web.de>
As part of: Lithium (https://github.com/CaffeineMC/lithium)
Licensed under: LGPL-3.0-only (https://www.gnu.org/licenses/lgpl-3.0.html)
This commit is contained in:
2026-07-20 20:48:14 +08:00
parent 221b1474c5
commit 64cbc78484
19 changed files with 307 additions and 0 deletions
@@ -0,0 +1,58 @@
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: MrHua269 <mrhua269@gmail.com>
Date: Thu, 4 Jun 2026 17:22:55 +0800
Subject: [PATCH] Gale: Reduce enderman teleport chunk lookups
License: GPL-3.0-only (https://www.gnu.org/licenses/gpl-3.0.html)
Gale - https://github.com/GaleMC/Gale
This patch is based on the following patch:
"Reduce chunk loading & lookups"
By: Paul Sauve <paul@technove.co>
As part of: Airplane (https://github.com/TECHNOVE/Airplane)
Licensed under: GPL-3.0-only (https://www.gnu.org/licenses/gpl-3.0.html)
* Airplane copyright *
Airplane
Copyright (C) 2020 Technove LLC
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program. If not, see <https://www.gnu.org/licenses/>.
diff --git a/net/minecraft/world/entity/monster/EnderMan.java b/net/minecraft/world/entity/monster/EnderMan.java
index 9b4ae8afda1f2202761cb49bc4f1181ce4eb55d5..d2ac2a0c5bb18c2bca18e5166ed65afd01166e04 100644
--- a/net/minecraft/world/entity/monster/EnderMan.java
+++ b/net/minecraft/world/entity/monster/EnderMan.java
@@ -298,11 +298,19 @@ public class EnderMan extends Monster implements NeutralMob {
private boolean teleport(final double x, final double y, final double z) {
BlockPos.MutableBlockPos pos = new BlockPos.MutableBlockPos(x, y, z);
- while (pos.getY() > this.level().getMinY() && !this.level().getBlockState(pos).blocksMotion()) {
+ // Gale start - Airplane - single chunk lookup
+ net.minecraft.world.level.chunk.LevelChunk chunk = this.level().getChunkIfLoaded(pos);
+
+ if (chunk == null) {
+ return false;
+ }
+
+ while (pos.getY() > this.level().getMinY() && !chunk.getBlockState(pos).blocksMotion()) {
+ // Gale end - Airplane - single chunk lookup
pos.move(Direction.DOWN);
}
- BlockState blockState = this.level().getBlockState(pos);
+ BlockState blockState = chunk.getBlockState(pos); // Gale - Airplane - single chunk lookup
boolean couldStandOn = blockState.blocksMotion();
boolean isWet = blockState.getFluidState().is(FluidTags.WATER);
if (couldStandOn && !isWet) {