Conversation
RecursivePineapple
commented
Nov 14, 2025
- Work on worlgen framework some more
- CoordinatePacker mixin
- Prevent LightingManager NPE
- Cleanup
- Angelica interop
- Lots of changes
- spotless
...ava/com/cardinalstar/cubicchunks/mixin/early/common/worldgen/MixinChunkProviderGenerate.java
Show resolved
Hide resolved
src/main/java/com/cardinalstar/cubicchunks/api/world/storage/ICubicStorage.java
Show resolved
Hide resolved
src/main/java/com/cardinalstar/cubicchunks/api/worldgen/impl/StandardDependencyRegistry.java
Outdated
Show resolved
Hide resolved
Co-authored-by: Ryan Nasers <42074409+Cardinalstars@users.noreply.github.com>
| TaskContainer<TTask, TResult> container = new TaskContainer<>(executor); | ||
| container.tasks.add(future); | ||
|
|
||
| TASK_QUEUE.addLast(container); |
There was a problem hiding this comment.
| TASK_QUEUE.addLast(container); | |
| TASK_QUEUE.add(container); |
It's a nitpick, but this is a bit more clear imo
There was a problem hiding this comment.
I prefer addLast because you can add to the front or to the end of the queue, and add isn't explicit enough IMO.
Co-authored-by: GitHub GTNH Actions <>
There was a problem hiding this comment.
Is this something to eventually go into gtnhlib itself? Mixin on mods we control is sus obviously.
There was a problem hiding this comment.
No, this is the best solution. It's ugly, but we can't add any indirection to these methods or it'll kill their performance. As it is, the JVM will inline and optimize everything as if the gtnhlib versions didn't exist.
There was a problem hiding this comment.
Just delete the method if we comment it out? Or is this something wip?
There was a problem hiding this comment.
I commented it out because that method didn't exist in the newer version of regionlib, and I couldn't tell what it was supposed to do. I'll have to look at it again, I haven't looked into this much further.
| @Inject(method = "getChunkSaveLocation", at = @At("HEAD"), cancellable = true, remap = false) | ||
| private void redirectChunkSaveLocation(CallbackInfoReturnable<File> cir) { | ||
| if (this.theChunkProviderServer == null) { | ||
| WorldFormatSavedData format = WorldFormatSavedData.get((WorldServer) (Object) this); | ||
|
|
||
| // noinspection DataFlowIssue | ||
| cir.setReturnValue( | ||
| format.getFormat() | ||
| .getWorldSaveDirectory(this.saveHandler, (WorldServer) (Object) this) | ||
| .toFile()); | ||
| } | ||
| } | ||
|
|
There was a problem hiding this comment.
What's the context on this change?
There was a problem hiding this comment.
This decouples the world directory location from the anvil save format, since it wasn't being used at all. I forget why I had to do this, I think that world savedata wasn't being put in the right directories or something.
There was a problem hiding this comment.
I just realized one of these is named _HeightLimit and the other _HeightLimits.
Maybe make them the same name.
| return delegate; | ||
| } | ||
|
|
||
| public static void setDelegate(IAngelicaDelegate delegate) { |
There was a problem hiding this comment.
I currently see no uses of this. How is this supposed to be used?
There was a problem hiding this comment.
It gets called in Angelica, then CC will call the various methods on the delegate to tell Angelica when cubes and columns are loaded. I haven't put up that PR yet because there are still some cube render culling issues.
| } | ||
|
|
||
| return new PacketHeightMapUpdate(pos, updates, heights); | ||
| return new PacketHeightMapUpdate(pos, updates.clone(), heights); |
There was a problem hiding this comment.
I can sort of guess why you have to clone here, but I can't say I understand the full picture. Could you explain a bit? Is there some threading issue here that causes you needing to clone this?
There was a problem hiding this comment.
I don't think there was an explicit bug, but I copied it just to be sure everything worked fine. The packet can stick around for any amount of time, but the provided updates list can be modified in the mean time.
src/main/java/com/cardinalstar/cubicchunks/server/CubicPlayerManager.java
Outdated
Show resolved
Hide resolved
|
|
||
| MinecraftForge.EVENT_BUS.post(event); | ||
|
|
||
| tag = event.tag; |
There was a problem hiding this comment.
Wait, the event can change the tag right?
There was a problem hiding this comment.
Yeah, event handlers can do anything they want with the tag. It probably isn't used like that, but I did this just to make sure.
| TaskPool.submit(columnLoadExecutor, pos, tag -> { | ||
| if (tag == null) { | ||
| if (preloadFailures != null) preloadFailures.onColumnPreloadFailed(pos); | ||
| } else { | ||
| synchronized (columnCache) { | ||
| columnCache.put(pos, new SaveData(tag.orElse(null), null, System.currentTimeMillis())); | ||
| } | ||
| } | ||
| }); |
There was a problem hiding this comment.
Shouldn't you be checking tag.isEmpty, and otherwise you don't need to do the orElse(null)?
Inspection of the columnLoadExecutor makes me think that this can't really ever be a null value given from tag.
There was a problem hiding this comment.
Yep you're right, I fixed it.
| synchronized (columnCache) { | ||
| columnCache.put(pos, new SaveData(tag, task, now)); | ||
|
|
||
| if (columnCache.size() > 5000) { | ||
| int i = 0; | ||
|
|
||
| var iter = columnCache.object2ObjectEntrySet() | ||
| .fastIterator(); | ||
|
|
||
| while (columnCache.size() > 5000 && i++ < 100) { | ||
| var e = iter.next(); | ||
|
|
||
| SaveData data = e.getValue(); | ||
|
|
||
| if (data.task != null && data.task.isDone()) { | ||
| data.task = null; | ||
| } | ||
|
|
||
| if (data.task == null && data.lastAccess + EXPIRY < now) { | ||
| iter.remove(); | ||
| } | ||
| } | ||
| } |
There was a problem hiding this comment.
I don't really understand this part of the saveColumn. Why do this in this method? Putting in the columnCache sure, but why do this iteration here if we want to make this as fast as possible. Can't some off-thread do this?
There was a problem hiding this comment.
I'll make a task + executor for this. It's meant to be a garbage collector that scans the cache when it's full to remove old SaveData objects but it's definitely not ideal now that I'm looking at it again. The i++ portion basically only allows it to scan the first 100 elements in the map, and since I'm not using the getAndMoveToLast/putAndMoveToLast methods the map ordering is undefined.
| @Override | ||
| public void preloadCube(CubePos pos, CubeInitLevel wanted) { | ||
| TaskPool.submit(cubeLoadExecutor, pos, tag -> { | ||
| CubeInitLevel actual = !tag.isPresent() ? CubeInitLevel.None : IONbtReader.getCubeInitLevel(tag.get()); |
There was a problem hiding this comment.
| CubeInitLevel actual = !tag.isPresent() ? CubeInitLevel.None : IONbtReader.getCubeInitLevel(tag.get()); | |
| CubeInitLevel actual = tag.isEmpty() ? CubeInitLevel.None : IONbtReader.getCubeInitLevel(tag.get()); |
There was a problem hiding this comment.
isEmpty was added in java 11, I can't use it. Intellij kept insisting on the same change so I had to disable that lint 🤣.
src/main/java/com/cardinalstar/cubicchunks/server/chunkio/CubeLoaderServer.java
Show resolved
Hide resolved
src/main/java/com/cardinalstar/cubicchunks/server/chunkio/CubeLoaderServer.java
Outdated
Show resolved
Hide resolved
src/main/java/com/cardinalstar/cubicchunks/server/chunkio/CubeLoaderServer.java
Outdated
Show resolved
Hide resolved
src/main/java/com/cardinalstar/cubicchunks/server/chunkio/CubeLoaderServer.java
Show resolved
Hide resolved
src/main/java/com/cardinalstar/cubicchunks/server/chunkio/CubeLoaderServer.java
Show resolved
Hide resolved
src/main/java/com/cardinalstar/cubicchunks/util/biome3d/PalettizedBiomeArray.java
Show resolved
Hide resolved
There was a problem hiding this comment.
What exactly is the problem here?
There was a problem hiding this comment.
Forced cube loading wasn't important when I wrote this PR, so to keep things simple I just disabled most of its logic. It was highly coupled to the player manager. I wanted to revisit it later once the player manager matured (which it has at this point).
Cardinalstars
left a comment
There was a problem hiding this comment.
Once you look at these comments, I think it's ready. Shouldn't be much work either.
…anager.java Co-authored-by: Ryan Nasers <42074409+Cardinalstars@users.noreply.github.com>
* Work on worlgen framework some more * CoordinatePacker mixin * Prevent LightingManager NPE * Cleanup * Angelica interop * Lots of changes * spotless * Works somewhat better * Several improvements * MORE WORLDGEN FIXES!!! + chunk api/endless ids compat + 3d biomes + other misc fixes * Make sure it compiles * spotless * Fix EBS Y Level * Checkstyle fixes * fix dep versions * :clueless: * Update src/main/java/com/cardinalstar/cubicchunks/api/CCAPI.java Co-authored-by: Ryan Nasers <42074409+Cardinalstars@users.noreply.github.com> * Update dependency graphs * oops * spotlessApply (#40) Co-authored-by: GitHub GTNH Actions <> * Update src/main/java/com/cardinalstar/cubicchunks/server/CubicPlayerManager.java Co-authored-by: Ryan Nasers <42074409+Cardinalstars@users.noreply.github.com> * Review changes + biome fixes --------- Co-authored-by: Ryan Nasers <42074409+Cardinalstars@users.noreply.github.com> Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
* Work on worlgen framework some more * CoordinatePacker mixin * Prevent LightingManager NPE * Cleanup * Angelica interop * Lots of changes * spotless * Works somewhat better * Several improvements * MORE WORLDGEN FIXES!!! + chunk api/endless ids compat + 3d biomes + other misc fixes * Make sure it compiles * spotless * Fix EBS Y Level * Checkstyle fixes * fix dep versions * :clueless: * Update src/main/java/com/cardinalstar/cubicchunks/api/CCAPI.java Co-authored-by: Ryan Nasers <42074409+Cardinalstars@users.noreply.github.com> * Update dependency graphs * oops * spotlessApply (#40) Co-authored-by: GitHub GTNH Actions <> * Update src/main/java/com/cardinalstar/cubicchunks/server/CubicPlayerManager.java Co-authored-by: Ryan Nasers <42074409+Cardinalstars@users.noreply.github.com> * Review changes + biome fixes --------- Co-authored-by: Ryan Nasers <42074409+Cardinalstars@users.noreply.github.com> Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>