Rivmun/SuperFancyCloudsRefabricated

How to use as a dependency?

Closed this issue · 16 comments

s5bug commented

I would like to determine whether or not an entity is inside a cloud. How can I do this?

Rivmun commented

Temporally, you can use cursemaven https://www.cursemaven.com/, add a SFCR file link which provided by curseforge in build.gradle.
image

s5bug commented

Does CurseMaven work differently from Modrinth Maven? My concern is that this will pull in the merged JAR:

image

I believe I need the separate common/fabric/forge JARs for an Architectury project. (Which, I'm guessing I could publishLocal myself, if the artifact names are set up correctly.)

Rivmun commented

Try to use fabric.com.rimo.sfcr.xxx or forge.com.rimo.sfcr.xxx to access class.
Forgix addon merged two of their code into one jar by adding a platform prefix. If your project use package name without this prefix, it won't work in ordinary gameplay.

Rivmun commented

var px = (startX - width / 2f + cx + 0.5f) * CONFIG.getCloudBlockSize(); // transform cloudpos to blockpos
var pz = (startZ - width / 2f + cz + 0.5f) * CONFIG.getCloudBlockSize();

As a reference of how to transform a cloudblock pos into blockpos. (Entity pos is blockpos)

s5bug commented

This means I would have to duplicate my logic for each platform, right? Considering I have no access to common classes?

I don't really mind that, but I want to make sure there's not something I'm unaware of.

s5bug commented

How do I grab the scrollX and scrollZ used in these calculations? And is there a way to get the existing cloud data without recalculating the samples?

Rivmun commented

This means I would have to duplicate my logic for each platform, right? Considering I have no access to common classes?

I don't really mind that, but I want to make sure there's not something I'm unaware of.

Yes, use fabric prefix if your project in fabric, elsewise forge, or just make a ExpectPlatform` method if you use Architectury.

Rivmun commented

How do I grab the scrollX and scrollZ used in these calculations? And is there a way to get the existing cloud data without recalculating the samples?

My sorry that you may need to calculate it by yourself for now... See in

var xScroll = (int) (player.getX() / CONFIG.getCloudBlockSize()) * CONFIG.getCloudBlockSize();
var zScroll = (int) (player.getZ() / CONFIG.getCloudBlockSize()) * CONFIG.getCloudBlockSize();

I want to make some public method to access cloud data in future version, but it'll no soon.

s5bug commented

Ok, thank you very much!

s5bug commented

Hmm, the cloud data is supposed to synchronize from server to client, right? What do xScroll and zScroll do then, if it looks like they're per-player? (i.e. how do I do the query server-side?)

My plan depends on every player being able to see the same (or at least close enough to the same) clouds.

s5bug commented

Ah, I see. The math cancels out between px including scrollX and getCloudSample removing it.

Rivmun commented

Send whole cloud data will consume lots of network. I've only synchronized sample seed (and most config which affect to visual) and total (and partial) z-offset from server to client. Cloud data calculate by client itself based on these two values.

s5bug commented

Yep, I have something that works well now. I've had to reimplement getDensity and getThreshold, but it works very well.

image

Is there any way I can force certain configuration values? I want to make sure

  • "Biome Detect From Chunk" is forced on, so that clouds are location-based and not player based
  • "Sync With Server" is forced on, so that whatever the server has set is synced to all clients

I've had to run /sfcr sync full manually on each client, but I'm assuming I can just force that to happen by adding my own network handler that runs the command (on join?).

Rivmun commented

I think you can call .sfcr.SFCReMod.COMMON_CONFIG.setBiomeDensityUseLoadedChunk(true) to force turn it on when player join and close config screen (to anti-editing :D
"Sync with Server"? Call .setEnableServerConfig(true)

Oh you make a mod that make player can standing on clouds? Awesome!

s5bug commented

Not standing on, but fishing from 😄

I'm going to see if I can make the server send the client way more biome data; considering I'm forcing configuration sync, I should be able to send the full render distance of the cloud plane to the client, right? Then I shouldn't have to force UseLoadedChunk?

Rivmun commented

Maybe.
Since players have different position, they'll have different loaded chunk. So players from different positions will get different results when looking at the same cloud. Unless you turn off biome affect, or limit cloud render distance to chunk load distance.