9
0
mirror of https://github.com/BX-Team/DivineMC.git synced 2026-01-04 15:31:43 +00:00

some lithium patches

This commit is contained in:
NONPLAYT
2025-04-27 14:19:14 +03:00
parent 2c364c71c9
commit 74b061aadb
5 changed files with 164 additions and 0 deletions

View File

@@ -0,0 +1,21 @@
--- a/net/minecraft/core/BlockPos.java
+++ b/net/minecraft/core/BlockPos.java
@@ -347,7 +_,18 @@
};
}
+ // DivineMC start - lithium: cached_iterate_outwards
+ private static final org.bxteam.divinemc.util.cache.IterateOutwardsCache ITERATE_OUTWARDS_CACHE = new org.bxteam.divinemc.util.cache.IterateOutwardsCache(50);
+ private static final it.unimi.dsi.fastutil.longs.LongList HOGLIN_PIGLIN_CACHE = ITERATE_OUTWARDS_CACHE.getOrCompute(8, 4, 8);
+ // DivineMC end - lithium: cached_iterate_outwards
+
public static Iterable<BlockPos> withinManhattan(BlockPos pos, int xSize, int ySize, int zSize) {
+ // DivineMC start - lithium: cached_iterate_outwards
+ if (pos != org.bxteam.divinemc.util.cache.IterateOutwardsCache.POS_ZERO) {
+ final it.unimi.dsi.fastutil.longs.LongList positions = xSize == 8 && ySize == 4 && zSize == 8 ? HOGLIN_PIGLIN_CACHE : ITERATE_OUTWARDS_CACHE.getOrCompute(xSize, ySize, zSize);
+ return new org.bxteam.divinemc.util.cache.LongList2BlockPosMutableIterable(pos, positions);
+ }
+ // DivineMC end - lithium: cached_iterate_outwards
int i = xSize + ySize + zSize;
int x1 = pos.getX();
int y1 = pos.getY();