Rivmun / SuperFancyCloudsRefabricated

A unofficial multiloader port of Minecraft quilt-side mod SuperFancyClouds.
MIT License
6 stars 1 forks source link

How to use as a dependency? #90

Closed s5bug closed 1 year ago

s5bug commented 1 year ago

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

Rivmun commented 1 year ago

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

s5bug commented 1 year ago

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 1 year ago

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 1 year ago

https://github.com/Rivmun/SuperFancyCloudsRefabricated/blob/fd14f60223334c3344274172ae9104769ddeb32f/common/src/main/java/com/rimo/sfcr/core/CloudData.java#L127-L128 As a reference of how to transform a cloudblock pos into blockpos. (Entity pos is blockpos)

s5bug commented 1 year ago

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 1 year ago

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 1 year ago

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 1 year ago

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 https://github.com/Rivmun/SuperFancyCloudsRefabricated/blob/fd14f60223334c3344274172ae9104769ddeb32f/common/src/main/java/com/rimo/sfcr/core/Renderer.java#L81-L82 I want to make some public method to access cloud data in future version, but it'll no soon.

s5bug commented 1 year ago

Ok, thank you very much!

s5bug commented 1 year ago

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 1 year ago

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

Rivmun commented 1 year ago

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 1 year ago

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

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 1 year ago

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 1 year ago

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 1 year ago

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.