Jump to content

[SOLVED][1.8] Syncing config files across server and client?


Recommended Posts

Posted

Hello guys,

 

I've been following TheGreyGhost's great MinecraftByExample series and have set up a configuration file for my mod.

Depending on the configuration file, the mod makes certain blocks unbreakable.

The config's loading/saving/using works perfectly in SSP.

However, when in SMP, the client still uses its own configuration file (by how awesome Forge is, I've expected it to synchronize the config automagically).

So, if the clients config file allows harvesting block A for example, and not block B, and the servers config file is the other way around, the client won't be able to mine block B (I'm setting the break speed to 0f in the BreakSpeed event), but the player will be able to start breaking block A, only to have it instantly respawn on breaking the block.

Also, if the client connects to a server without the mod installed, it won't be able to break the blocks as set up in the config file either.

 

My question is: Is there an easy work-around for this? If not, will I have to set up custom network messages which get sent when a client joins the server? If yes, is there any good tutorial out here on how to do stuff involving networking in Minecraft?

 

Thanks in advance,

 

- Apace

Posted

Short: There is no workaround, your thinking is good.

http://www.minecraftforum.net/forums/mapping-and-modding/mapping-and-modding-tutorials/2137055-1-7-x-1-8-customizing-packet-handling-with

Nice and tidy: http://www.minecraftforge.net/forum/index.php/topic,20135.0.html

Important info: http://greyminecraftcoder.blogspot.com.au/2015/01/thread-safety-with-network-messages.html

 

Longer: You will need to set client's hardness from packet after logging on (PlayerLoggedInEvent).

After sending that info you can cache it in client's config.

  Quote

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

Posted

Yes, this can be a bit tricky.

 

Usually the configuration file is loaded/synced in the common proxy so technically it will be loaded on both sides. But the actual file would of course not be the same file on two different computers when you're running server/client or LAN.

 

So the "safe" thing to do would be to sync as needed. In the case where the config info is only used by server, then there is no problem -- just the config on the server will be used and there is only one so there is no conflict. Similarly, in some cases you might have config options that are purely client side (like maybe change rendering, or add info in HUD) and you could just allow each client to load their own config and it is okay if they are different. But in other cases you might have some config that is used on both sides. I think you're right that the config is not synced automatically so the safe way to do that is to load only on server side and sync the values to client using packets.

Check out my tutorials here: http://jabelarminecraft.blogspot.com/

Posted

Thanks to both of you guys for answering!

 

I feared that there was no easy way to do this. Alright then, I guess I'll get to work.

 

Will mark as solved for now, hopefully it will stay that way. ;)

Guest
This topic is now closed to further replies.

Announcements



  • Recently Browsing

    • No registered users viewing this page.
  • Posts

    • Betafort Recovery has emerged as a prominent figure in the realm of cryptocurrency recovery, gaining a reputation for their exceptional ability to retrieve lost Bitcoin (BTC) and other cryptocurrencies. Their expertise and track record have made them a beacon of hope for individuals facing the distressing situation of lost or inaccessible crypto assets.  
    • When you name a method like that, with no return value, it is a constructor. The constructor must have the same name as the class it constructs, in this case, ModItems. I would strongly advise reading up on some basic Java tutorials, because you will definitely be running into a lot more issues as you go along without the basics. *I should also add that the Forge documentation is a reference, not a tutorial. Even following tutorials, you should know Java basics, otherwise the smallest of mistakes will trip you up as you copy someone elses code.
    • so, I'm starting modding and I'm following the official documantation for forge: https://docs.minecraftforge.net, but in the registries part it is not working as it is in the docs:   public class ModItems { private static final DeferredRegister<Item> ITEMS = DeferredRegister.create(ForgeRegistries.ITEMS, DarkStarvation.MOD_ID); public static final RegistryObject<Item> TEST_ITEM = ITEMS.register("test_item", () -> new Item(new Item.Properties())); public DarkStarvation(FMLJavaModLoadingContext context) { ITEMS.register(context.getModEventBus()); } } in 'public DarkStarvation(...' the DarkStarvation has this error: Invalid method declaration; return type required and the getModEventBus(): Cannot resolve method 'getModEventBus' in 'FMLJavaModLoadingContext' please help, I asked gpt but it is saying that I'm using an old method, but I'm following the latest version of Forge Docs???
    • I merged your second post with the original , there is no need to post a new thread asking for an answer. If someone sees your post and can help, they will reply. If you are seeking a quicker response, you could try asking in the Minecraft Forge diacord.
    • Create a new instance and start with cobblemon - if this works, add the rest of your mods in groups   Maybe another mod is conflicting - like Sodium/Iris or Radical Cobblemon Trainers
  • Topics

×
×
  • Create New...

Important Information

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