Jump to content

Recommended Posts

Posted

What would be the best way to create an integer variable for every block that can be modified via a .cfg file? I've tried using the search function but I'm pretty bad at it.

Posted

Is this a question about how to have the block reference the value or how to build a config file?

This is my Forum Signature, I am currently attempting to transform it into a small guide for fixing easier issues using spoiler blocks to keep things tidy.

 

As the most common issue I feel I should put this outside the main bulk:

The only official source for Forge is https://files.minecraftforge.net, and the only site I trust for getting mods is CurseForge.

If you use any site other than these, please take a look at the StopModReposts project and install their browser extension, I would also advise running a virus scan.

 

For players asking for assistance with Forge please expand the spoiler below and read the appropriate section(s) in its/their entirety.

  Reveal hidden contents

 

Posted (edited)
  On 9/3/2018 at 5:06 PM, DaemonUmbra said:

Is this a question about how to have the block reference the value or how to build a config file?

Expand  

How would I build a config file system with a variable for every block?

Edited by 1SDAN
Posted

For a config file I would suggest Forge's @Config annotation, "for every block" still needs some interpretation though, do you mean every block of that kind will reference the same value or every block of that kind will have that variable but the value may be different from individual block to individual block?

This is my Forum Signature, I am currently attempting to transform it into a small guide for fixing easier issues using spoiler blocks to keep things tidy.

 

As the most common issue I feel I should put this outside the main bulk:

The only official source for Forge is https://files.minecraftforge.net, and the only site I trust for getting mods is CurseForge.

If you use any site other than these, please take a look at the StopModReposts project and install their browser extension, I would also advise running a virus scan.

 

For players asking for assistance with Forge please expand the spoiler below and read the appropriate section(s) in its/their entirety.

  Reveal hidden contents

 

Posted (edited)
  On 9/3/2018 at 5:22 PM, DaemonUmbra said:

For a config file I would suggest Forge's @Config annotation, "for every block" still needs some interpretation though, do you mean every block of that kind will reference the same value or every block of that kind will have that variable but the value may be different from individual block to individual block?

Expand  

I have a Capability set up that stores a "health" value for each block. I would like to create a default value for each block type and be able to modify them via a .cfg file.

 

Thank you, I must have overlooked that part of the documentation.

Edited by 1SDAN
Posted (edited)

I'm looking at the config annotation documentation but am still having trouble. What I'd prefer is if there was a region in the .cfg file where players can enter the name of a block and couple of health-related values, which the mod would use to fill an array of values.


I'm completely clueless as to how I would go about this. It seems the config annotation requires you to define the individual variables ahead of time, unless I'm misunderstanding this.

Edited by 1SDAN
Posted
  On 9/4/2018 at 9:36 PM, 1SDAN said:

I'm looking at the config annotation documentation but am still having trouble. What I'd prefer is if there was a region in the .cfg file where players can enter the name of a block and couple of health-related values, which the mod would use to fill an array of values.


I'm completely clueless as to how I would go about this. It seems the config annotation requires you to define the individual variables ahead of time, unless I'm misunderstanding this. 

Expand  

Use two arrays, one that will hold the registry name of the block and the other that will hold the value.

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.

Posted

I can't recall, does @Config work with Maps?

This is my Forum Signature, I am currently attempting to transform it into a small guide for fixing easier issues using spoiler blocks to keep things tidy.

 

As the most common issue I feel I should put this outside the main bulk:

The only official source for Forge is https://files.minecraftforge.net, and the only site I trust for getting mods is CurseForge.

If you use any site other than these, please take a look at the StopModReposts project and install their browser extension, I would also advise running a virus scan.

 

For players asking for assistance with Forge please expand the spoiler below and read the appropriate section(s) in its/their entirety.

  Reveal hidden contents

 

Posted
  On 9/4/2018 at 9:47 PM, DaemonUmbra said:

I can't recall, does @Config work with Maps?

Expand  

I don't believe it does since Configuration doesn't have support for Maps, but it does for arrays. So if you wanted to you could use one array and parse Strings numbers.

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.

Posted
  On 9/4/2018 at 9:54 PM, Animefan8888 said:

I don't believe it does since Configuration doesn't have support for Maps, but it does for arrays. So if you wanted to you could use one array and parse Strings numbers.

Expand  

Oh it works with arrays? That helps a lot then. Thank you.

Posted

@Config does work with Maps that have String keys, the Map becomes a category in the config file and the key-value pairs become properties.

 

See here for an example of this.

Please don't PM me to ask for help. Asking your question in a public thread preserves it for people who are having the same problem in the future.

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.