Jump to content

Recommended Posts

Posted

I'm a bit confused on syncing annotated config files. Guidance on this forum has generally been to send a packet to the client on PlayerLoggedIn and update a "client" config file.

 

So let's say I have a ServerConfig class and a Config class, where the latter is the client's config that gets updated. If I want to register a dimension using an ID based on the config, I have to register it on both the client and server, right? Using DimensionType.register()? If I put this in my CommonProxy, it'll get called on both. Assuming Config is only updated when a player logs in, I can't use Config on the server. But I also can't use ServerConfig on the client cause the client could have the wrong thing in their config file. Anyone know the right way to do this?

Posted (edited)

Perhaps a better question is - is there an event for when the config gets loaded from the file?Does ConfigChangedEvent.OnConfigChangedEvent cover that? If so I could just update the Config class when the file initially loads? But does dimension registering happen before or after the config is loaded?

Edited by stepsword
Posted
1 minute ago, Animefan8888 said:

The better question is why is your dimension ID configurable?

I was hoping to avoid conflicts with other mods by allowing modpack creators to set this. Is that something I don't have to worry about?

Posted
7 minutes ago, stepsword said:

Is that something I don't have to worry about?

I dont believe so. I believe there is a method to provide you with an ID that hasn't been used in 1.12 and in 1.14 I dont think it uses integer ids for anything other than saving to disk.

  • Thanks 1

VANILLA MINECRAFT CLASSES ARE THE BEST RESOURCES WHEN MODDING

I will be posting 1.15.2 modding tutorials on this channel. If you want to be notified of it do the normal YouTube stuff like subscribing, ect.

Forge and vanilla BlockState generator.

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



  • Recently Browsing

    • No registered users viewing this page.
  • Posts

    • Delete the config of RandomTweaker (config folder) If there is no change, remove this mod
    • Hello! So i have been trying to make a mod that adds plant fiber to minecraft 1.16.5 (i believe there are mods that add plant fiber but not for 1.16.5) but the problem is that i want to modify the loot table of grass to always drop plant fiber but also keep the vanilla drops. Most common answer i have seen is GlobalLootModifiers. But my tiny brain cant understand any tutorials. So any help is appreciated.
    • Minecraft forge 1.12.2 does not load. Here is both logs. I assume its because of a mod that i have, idk. (L521)
    • Found the solution! Instead of using PlayerEvent.Clone to sync capabilities with a client use EntityJoinWorldEvent! That's how CapabilitySync class should look like: public class CapabilitySync { @SubscribeEvent public void EntityJoinWorldEvent(EntityJoinWorldEvent event) { Entity entity = event.getEntity(); if (entity.world.isRemote || !(entity instanceof EntityPlayerMP)) return; EntityPlayer player = (EntityPlayer) entity; NetworkHandler.channel.sendTo(new ServerToClient(player), (EntityPlayerMP) player); } @SubscribeEvent public void onPlayerClone(PlayerEvent.Clone event) { EntityPlayer player = event.getEntityPlayer(); IFolder folder = player.getCapability(FolderProvider.FOLDER_CAP, null); IFolder oldfolder = event.getOriginal().getCapability(FolderProvider.FOLDER_CAP, null); folder.setFolders(oldfolder.getFolders()); } }   Here is a full code if you need one! https://github.com/R4L34/capabilitynetworking
×
×
  • Create New...

Important Information

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