Posted October 6, 20213 yr Im trying to make a config file that can only be edited server side. However, no matter what i change on the server, the config file on the client side doesnt get updated.
October 6, 20213 yr 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
October 6, 20213 yr Author 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.
October 6, 20213 yr Author 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
October 6, 20213 yr Author 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); }
October 6, 20213 yr 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
October 6, 20213 yr Author 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
October 6, 20213 yr you need to run the game a few times and delete the config file are the run and the error will fixed by himself
October 6, 20213 yr i will test that. but back to your question, you need to send a custom packet to the client, which updates the value there
October 6, 20213 yr Author ok, ill look into that, hopefully it helps and yea, testing might be a good idea, i wouldnt be surprised if i messed something up
October 7, 20213 yr Author Sorry, I'm not sure I understood that. Which custom code are you referring to, the config class?
October 7, 20213 yr Author 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
October 7, 20213 yr Author 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.
October 7, 20213 yr Author 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 October 7, 20213 yr by MR_Classy Clarity
October 7, 20213 yr Author 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.
October 7, 20213 yr Author 6 hours ago, diesieben07 said: Show your code. I already posted the code for just the config class, this is the entire mod https://github.com/MRClassyy/pots_n_stuff
October 7, 20213 yr Author 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
October 7, 20213 yr Author 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.
October 7, 20213 yr Author yea, the client still keeps generating a config file thats different from the one on server
October 7, 20213 yr Author 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.