Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
28 commits
Select commit Hold shift + click to select a range
0311092
probably working properly subchunk aware version
jcw780 Sep 11, 2025
ea67a2f
more refinments
jcw780 Sep 12, 2025
d1f8cb5
saving work
jcw780 Sep 15, 2025
5c24c80
fix distance + ring bugs
jcw780 Sep 16, 2025
fbed15c
concentric square iterator completed
jcw780 Sep 19, 2025
7c95b43
add subchunk search skip if unsearched distance increases
jcw780 Sep 19, 2025
1a91276
probably working array limiter
jcw780 Sep 19, 2025
38a28cd
saving work on LongArrayList version
jcw780 Sep 19, 2025
b7878a8
Merge branch 'develop' of https://github.com/jcw780/lithium into ips_…
jcw780 Sep 19, 2025
2d8515d
plausibly working LongArrayList version
jcw780 Sep 20, 2025
1b4e904
improved ringaddition logic
jcw780 Sep 20, 2025
cecdbcf
remove ifpresent lambda
jcw780 Sep 20, 2025
deca282
working record version
jcw780 Sep 20, 2025
70eeec4
loop to consume subchunk list - this noticeably reduces lag from gett…
jcw780 Sep 20, 2025
187caf0
cache closestringdistancesq
jcw780 Sep 20, 2025
647e780
presort column + some refactors
jcw780 Sep 21, 2025
fc2a302
comments and minor changes
jcw780 Sep 21, 2025
3a2a0f8
clean up imports
jcw780 Sep 21, 2025
1fc615e
cache nextSubchunkDistanceSq minor changes
jcw780 Sep 21, 2025
62352af
minor refactors/formats
jcw780 Sep 29, 2025
36cada8
Merge branch 'develop' into ips3_work_branch
jcw780 Sep 29, 2025
5d73c27
pull from develop 0.18.1
jcw780 Sep 29, 2025
2fdab93
fix distance bug from refactoring
jcw780 Oct 4, 2025
5836e70
renaming
jcw780 Oct 4, 2025
9eeccf8
update list limit
jcw780 Oct 5, 2025
ef103bf
save work - reminder to remove comments later
jcw780 Oct 5, 2025
4fb5af1
rename nearbypoistreams: new became the normal one, original became o…
jcw780 Oct 23, 2025
a1193c7
comment out testing code
jcw780 Oct 23, 2025
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -30,17 +30,29 @@ public static boolean isWithinCircleRadius(BlockPos origin, double radiusSq, Blo
return origin.distSqr(pos) <= radiusSq;
}

public static int getClosestAlongSectionAxis(int originAxis, int chunkMinAxis){
public static int getClosestAlongSectionAxis(int originAxis, int chunkAxis){
final int chunkMinAxis = SectionPos.sectionToBlockCoord(chunkAxis);
return Math.min(Math.max(originAxis, chunkMinAxis), chunkMinAxis+15);
}

public static long getClosestPositionWithinChunk(BlockPos origin, int chunkX, int chunkZ){
int chunkMinX = SectionPos.sectionToBlockCoord(chunkX);
int chunkMinZ = SectionPos.sectionToBlockCoord(chunkZ);
return BlockPos.asLong(getClosestAlongSectionAxis(origin.getX(), chunkX),
origin.getY(), getClosestAlongSectionAxis(origin.getZ(), chunkZ));

return BlockPos.asLong(getClosestAlongSectionAxis(origin.getX(), chunkMinX),
origin.getY(), getClosestAlongSectionAxis(origin.getZ(), chunkMinZ));
}

public static double getMinSectionDistanceSq(BlockPos origin, int chunkX, int chunkY, int chunkZ){
final int originX = origin.getX(), originY = origin.getY(), originZ = origin.getZ();
final int distX = getClosestAlongSectionAxis(originX, chunkX) - originX;
final int distY = getClosestAlongSectionAxis(originY, chunkY) - originY;
final int distZ = getClosestAlongSectionAxis(originZ, chunkZ) - originZ;

return distX * distX + distY * distY + distZ * distZ;
}

public static long getClosestPositionWithinSubchunk(BlockPos origin, int chunkX, int chunkY, int chunkZ){
return BlockPos.asLong(getClosestAlongSectionAxis(origin.getX(), chunkX),
getClosestAlongSectionAxis(origin.getY(), chunkY),
getClosestAlongSectionAxis(origin.getZ(), chunkZ));
}
}
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
package net.caffeinemc.mods.lithium.common.world.interests;

import java.util.stream.Stream;
import java.util.BitSet;
import java.util.Optional;

public interface RegionBasedStorageSectionExtended<R> {
/**
Expand All @@ -20,4 +22,9 @@ public interface RegionBasedStorageSectionExtended<R> {
* @param chunkZ The z-coordinate of the chunk column
*/
Iterable<R> lithium$getInChunkColumn(int chunkX, int chunkZ);

BitSet lithium$getNonEmptyPOISections(int chunkX, int chunkZ);
int lithium$getChunkYMin();
int lithium$getChunkYMaxInclusive();
Optional<R> lithium$getElementAt(long sectionPos);
}
Loading