Jump to content
View in the app

A better way to browse. Learn more.

Forge Forums

A full-screen app on your home screen with push notifications, badges and more.

To install this app on iOS and iPadOS
  1. Tap the Share icon in Safari
  2. Scroll the menu and tap Add to Home Screen.
  3. Tap Add in the top-right corner.
To install this app on Android
  1. Tap the 3-dot menu (⋮) in the top-right corner of the browser.
  2. Tap Add to Home screen or Install app.
  3. Confirm by tapping Install.

Featured Replies

Posted

Hello, I've recently been having problems with server sided config files. My mod (Convenient Recipes) creates a config file in the config folder of the server but it doesn't work. The file works fine client side, but when I edit an option in the server config it doesn't do anything.

 

In the pre-initialisation method I am running this:

 

Configuration config = new Configuration(e.getSuggestedConfigurationFile());

config.load();

//Then my configuration options, for example:

allowChainMailCrafting = config.getBoolean("Chain Mail Crafting", "recipes", true, "Allows the crafting of chain mail armour from iron bars.");

config.save();

 

This all works fine in singleplayer but editing the server's config file doesn't do anything. It seems to be dependent on the client's configuration. Please let me know id I'm doing something stupid. Thank you for your consideration.

  • Author

Possibly. This is my only code related to configuration.

  • Author

My pre-initialisation method:

 

@EventHandler

public static void preInit(FMLPreInitialisationEvent e){}

 

I think the client being unable to see server config thing is my problem. Do you know of any mods with an example of how to pass server configurations to the client properly?

  • Author

I need the config to work on singleplayer worlds and on servers.

  • Author

In the load method

 

if(chainMailCrafting){

GameRegistry.addRecipe(new ItemStack(Items.chainmail_boots), new Object[]{"i i","i i",'i',Blocks.iron_bars});

GameRegistry.addRecipe(new ItemStack(Items.chainmail_leggings), new Object[]{"iii","i i","i i",'i',Blocks.iron_bars});

GameRegistry.addRecipe(new ItemStack(Items.chainmail_chestplate), new Object[]{"i i","iii","iii",'i',Blocks.iron_bars});

GameRegistry.addRecipe(new ItemStack(Items.chainmail_helmet), new Object[]{"iii","i i",'i',Blocks.iron_bars});

}

 

Why should that matter?

Situation:

Client has config with TRUE. Server has FALSE.

You log in on server - client will have recipe, server won't.

 

Try crafting item - it will most likely appear in crafting result but pulling it out will not work.

 

To pass this problem you can use packets that will synchronize value on client once he has logged in, then make new IRecipe that will always ask if the result can be crafted (depending on this boolean).

Otherwise you will be left with client-side void-recipy that will not work, yet be visible.

 

EDIT:

This might have been the dumbest thing I wrote on forums in a long while - please correct me if I am wrong: Are recipes both-sided (like blocks)? If they are server-sided (result from server) then everything above is false.

 

EDIT 2: In case my statement was right:

You should never make registration depend on config. Rather make booleans that will be checked in runtime. E.g: Server has recipe, but client didn't register it. What now?

1.7.10 is no longer supported by forge, you are on your own.

Situation:

Client has config with TRUE. Server has FALSE.

You log in on server - client will have recipe, server won't.

 

Try crafting item - it will most likely appear in crafting result but pulling it out will not work.

 

To pass this problem you can use packets that will synchronize value on client once he has logged in, then make new IRecipe that will always ask if the result can be crafted (depending on this boolean).

Otherwise you will be left with client-side void-recipy that will not work, yet be visible.

 

EDIT:

This might have been the dumbest thing I wrote on forums in a long while - please correct me if I am wrong: Are recipes both-sided (like blocks)? If they are server-sided (result from server) then everything above is false.

 

EDIT 2: In case my statement was right:

You should never make registration depend on config. Rather make booleans that will be checked in runtime. E.g: Server has recipe, but client didn't register it. What now?

 

If you're going to do this, I would suggest just removing client side configs entirely and depend solely upon server side configs since singleplayer runs it's own server, causing two sets of configs to be necessary.

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...

Important Information

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

Configure browser push notifications

Chrome (Android)
  1. Tap the lock icon next to the address bar.
  2. Tap Permissions → Notifications.
  3. Adjust your preference.
Chrome (Desktop)
  1. Click the padlock icon in the address bar.
  2. Select Site settings.
  3. Find Notifications and adjust your preference.