Jump to content

[1.16.5] Config file on client side not synced with server config file


Recommended Posts

Posted

that's not how configs work,
there is the client config which is for client things like rendering,
there is the common config which is for everything else like Level generation,
and the server config is for server stuff

the name (type) of the config indicates on which side you can use the config,
so the server config doesn't know about the client config

Posted

Ok, i mightve explained it wrong.
Im trying to create a config for a potions mod, specifically to enable or disable crafting of those potions, so i dont want players changing those values.

However, when i try to remove a recipe server side, the recipe still shows up ingame (the actual potion cant be crafted, but if i use something like JEI to check out how to craft it, the recipe is loaded in).

My understanding was that if something like a recipe gets turned off on the server side, the players shouldnt be able to still see it ingame.


 

Posted

Sorry, im kinda new to this and not 100% sure which part does that.

This is the code i use to initiate the config 
 


       ModLoadingContext.get().registerConfig(Type.SERVER, PnsConfig.SPEC);
        PnsConfig.loadConfig(PnsConfig.SPEC, FMLPaths.CONFIGDIR.get().resolve("potsnstuff-server.toml").toString());

And the actual config class 
https://pastebin.com/BNaTVsjT

Posted

cuz i was trying to find a way to stop the config file from generating in a random order and that was the only way i found how to do it, seemed a bit weird but didnt know how else.
And calling them in the main class

    public PotsNStuff() {
    	IEventBus bus = FMLJavaModLoadingContext.get().getModEventBus();
        bus.addListener(this::setup);
        ConteinerTypeInit.CONTAINER_TYPES.register(bus);
        ItemInit.ITEMS.register(bus);
        EffectInit.EFFECTS.register(bus);
        RecepiesInit.RECIPE_SERIALIZERS.register(bus);
        PotionInit.POTIONS.register(bus);
        ModLoadingContext.get().registerConfig(Type.SERVER, PnsConfig.SPEC);
        PnsConfig.loadConfig(PnsConfig.SPEC, FMLPaths.CONFIGDIR.get().resolve("potsnstuff-server.toml").toString());
		MinecraftForge.EVENT_BUS.register(this);
    }

 

Posted
6 minutes ago, MR_Classy said:

generating in a random order

they are normally generate always in the same folder,
client config in: .minecraft/config
common config in: .minecraft/config
server config in: .minecraft/saves/world_name/serverconfig

Posted

 

2 minutes ago, Luis_ST said:

they are normally generate always in the same folder,
client config in: .minecraft/config
common config in: .minecraft/config
server config in: .minecraft/saves/world_name/serverconfig

i ment the variables in the .toml file not being in the order i added them via code

Posted

The recipes in question are for potions with custom effects so I need to initialise them and add them to the recipe registry myself, I'm not turning off base game recipes

Posted

And I'm aware the server should be the only one aware of what recipes exist, issue is the client also generates its own config instead of getting the info from the server.

On that note, I looked around a bit more and apparently the issue might be that I'm running logical server code on a logical client.

 

Posted (edited)
16 minutes ago, diesieben07 said:

This makes no sense. Recipes must be made using JSON files.

You can use a custom IRecipeSerializer if you need specialized recipes.

Potion recipes, as in brewing stand recipe, not crafting table recipe

And for those (as far as I know) you use BrewingRecipeRegistry.addRecipe(base potion, ingredient, resulting potion), No JSON files needed

Edited by MR_Classy
Clarity
Posted
12 minutes ago, diesieben07 said:

In that case you need to always register your recipe (on server and client!) and change its behavior dynamically based on the config file. Use a SERVER type config, which Forge automatically syncs to clients that join the server.

I'm already doing that, both the register part and server config part, it's not syncing.

Posted

i already do that, one line before i call the loadConfig method
And i think i already said this, but that was the only way i knew how to make the config files contents match the coded input.
Without it, the .toml files contents are added in a random order

Posted
48 minutes ago, diesieben07 said:

Do not load config files manually.

I deleted that command.
The only change is that the text in my config file isnt ordered properly.
The client server sync issue is still there.

Posted

you can, go into that file, change for example "frailness potion" = true to false and try to craft that potion ingame, recipe is awkward pot and rotten flesh, or better yet, add JEI so u can see that the recipe is still added even tho its turned off

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Announcements



×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use.