Skip to content

Improve CubicPlayerManager and add support for third party modded cubic world generators#46

Merged
Cardinalstars merged 81 commits into
masterfrom
world-generators-and-player-manager
May 30, 2026
Merged

Improve CubicPlayerManager and add support for third party modded cubic world generators#46
Cardinalstars merged 81 commits into
masterfrom
world-generators-and-player-manager

Conversation

@RecursivePineapple
Copy link
Copy Markdown
Collaborator

@RecursivePineapple RecursivePineapple commented Apr 12, 2026

Code changes

  • Rewrote CubicPlayerManager to fix a lot of its race conditions. There's still a problem with the underworld's mushrooms and boulders not syncing, but I'm not sure what's causing that. Vanilla works fine, so I'm going to ignore it for now 🤣.
  • Added the ICubicWorldProvider interface, which is used by third party mods to make their dimensions cubic.
  • Added some (seemingly unused) utilities for this (see CubeStackBlockView).
  • Removed a large number of allocations (mostly CallbackInfoReturnables) by changing mixins around.
  • Sorted out cube/chunk ticking. This was a mess before, and there was a lot of unused pointless code.
  • Accidentally fixed the entity tracking issues by fixing CubicPlayerManager. Previously, entities in new chunks wouldn't be synced properly, causing them to glitch out constantly. Now, everything works normally.

Testing done

  • Fly around in the vanilla overworld. Whole chunks used to not sync, trees would pop into existence, and there would be this weird gradient pattern on water (see below). Now, everything will sync fine and there won't be skipped block updates.
  • Also fly around on a server, to make sure everything works the same.
  • For the memory allocations, I used visualvm and async profiler to diagnose which objects were allocated the most. The asprof -d 30 -f profile.html -e alloc GradleStart command will make a profile that shows allocations, but asprof only works on linux.
  • Publish CC to the local maven repo and run UtilitiesInExcess with it, to test the cubic underworld world generator.
  • For ticking, I placed water on a grassy hill and let it sit. The water cascaded properly and the grass below it slowly decayed into dirt.
  • For animals, I ran around the vanilla overworld and made sure they were working properly. I could bump into them as expected and hit them fine. I also tested mobs in the underworld, since it spawns them frequently.

See Also

Weird water gradients

image

Stress test

https://discord.com/channels/181078474394566657/1415607665375313961/1492890103457255564

Comment thread src/main/java/com/cardinalstar/cubicchunks/util/AddressTools.java
Copy link
Copy Markdown
Collaborator

@DarkShadow44 DarkShadow44 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

A bunch of questions and some points that could need improvement. Please don't resolve those, leave that for me.

Comment thread src/main/java/com/cardinalstar/cubicchunks/visibility/CuboidalCubeSelector.java Outdated
Comment thread src/main/java/com/cardinalstar/cubicchunks/world/cube/Cube.java Outdated
Comment thread src/main/java/com/cardinalstar/cubicchunks/util/AddressTools.java
Comment thread src/main/java/com/cardinalstar/cubicchunks/visibility/CuboidalCubeSelector.java Outdated
Comment thread src/main/java/com/cardinalstar/cubicchunks/server/WorldSyncStateMachine.java Outdated
@Cardinalstars
Copy link
Copy Markdown
Collaborator

Also, if it's not too much of an issue can we make sure that we have all the libs we need as required loading stuff in the mod annotation/deps in the dependencies file? I think some people were having issues with that, but I haven't looked into it too much yet and thought you might know what we're missing.

Comment thread src/main/java/com/cardinalstar/cubicchunks/util/Coords.java Outdated
Comment thread src/main/java/com/cardinalstar/cubicchunks/mixin/Mixins.java
Comment thread src/main/java/com/cardinalstar/cubicchunks/server/CubicPlayerManager.java Outdated
return mods;
}

public static void beforePopulate(World world, IChunkProvider vanilla) {
Copy link
Copy Markdown
Collaborator

@Cardinalstars Cardinalstars May 30, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm not exactly sure how I feel about this.

We can either leave it like this or add the mods that we need to add to the vanilaCompatPopulationFakeHeight list.

I'm not sure what's going to best in the long term. I ideally want to have it so that eventually mods do generate stuff outside of the normal world height, but this seems reasonable enough for now I guess as I assume we're going to have to add that manually.

I want some thoughts on this.

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think it's fine, there are proper interfaces for cubic worldgen now that replace this system. No mod that uses this interface will expect to have blocks outside of 0-255. IC2 rubber trees in specific broke badly, because they'd scan y down from ~1mil to 0, and it killed performance.

@Cardinalstars Cardinalstars merged commit a1f5923 into master May 30, 2026
1 check passed
@Cardinalstars Cardinalstars deleted the world-generators-and-player-manager branch May 30, 2026 21:44
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants