Jump to content

ConfigOption to allow users to show certain blocks/items in custom Creat


Recommended Posts

Posted

[move]SOLVED!

[/move]

Hi guys!  I'm making a cool mod with my friend and we both don't know how we can create a line in the config which allows the user to show certain blocks/items in our custom Creative Tab. Currently, this is our Config code:

 

  Reveal hidden contents

 

This code is from the @PreInit method in our main class:

 

  Reveal hidden contents

 

 

But the code, in this case I, wrote doesn't work. Could you help us out with this, please?

 

Thanks in advance

~bl4ckscor3

↑↑↑↑↑↑↑↑↑↑ Click it please? :3 ↑↑↑↑↑↑↑↑↑↑

Posted
  On 6/24/2013 at 4:54 PM, ObsequiousNewt said:

What doesn't work about it?

 

BTW, you might try instead overriding getSubBlocks()/getSubItems() in your block and item files.

When I change the Config option to true, the block/item doesn't show up. And what are thoe getSubBlocks()/getSubItems() methods you are speaking of? Why do I need them?

↑↑↑↑↑↑↑↑↑↑ Click it please? :3 ↑↑↑↑↑↑↑↑↑↑

Posted
  On 6/24/2013 at 5:15 PM, bl4ckscor3 said:

  Quote

What doesn't work about it?

 

BTW, you might try instead overriding getSubBlocks()/getSubItems() in your block and item files.

When I change the Config option to true, the block/item doesn't show up. And what are thoe getSubBlocks()/getSubItems() methods you are speaking of? Why do I need them?

They are meant for blocks that differentiate between metadata (and show multiple blocks in the creative tabs), but, if you use it to return an empty list, it will show nothing in the creative tabs, not even in the "all items" tab. Which, I assume, you would want.

BEWARE OF GOD

---

Co-author of Pentachoron Labs' SBFP Tech.

Posted
  On 6/24/2013 at 5:22 PM, ObsequiousNewt said:

  Quote

  Quote

What doesn't work about it?

 

BTW, you might try instead overriding getSubBlocks()/getSubItems() in your block and item files.

When I change the Config option to true, the block/item doesn't show up. And what are thoe getSubBlocks()/getSubItems() methods you are speaking of? Why do I need them?

They are meant for blocks that differentiate between metadata (and show multiple blocks in the creative tabs), but, if you use it to return an empty list, it will show nothing in the creative tabs, not even in the "all items" tab. Which, I assume, you would want.

Hm. Basically I want to have a config option where the user can choose wether he wants the e.g. Slime Portal in the More Dimensions Creative Tab or not.

↑↑↑↑↑↑↑↑↑↑ Click it please? :3 ↑↑↑↑↑↑↑↑↑↑

Posted

OK, I know how set up this.

Simply add to main mod file (the core) this:

public static Boolean[] par0Boolean = new Boolean[2];

and this you need to write into the config load:

par0Boolean[1] = config.get("GROUP","NAME", defaultBolean).getBoolean(true);

And for the setting the visibility of block/item you can use my API for this:

 

  Reveal hidden contents

 

 

in the main file you need to add regTab(item(or block unlocalizedName),your creative tab,par0Boolean[1]);

example:  regTab(mixed_dust,tabOmega,par0Boolean[1]);

It works for me fine.

 

//EDIT

if you want the api I can send the file to you  :)

Check out my m2cAPI: http://pastebin.com/SJmjgdgK [WIP! If something doesnt work or you have a better resolution, write me a PM]

If you want to use my API please give me a Karma/Thank you

Sorry for some bad words ´cause I am not a walkin´ library!

Posted
  On 6/25/2013 at 12:39 PM, mar21 said:

OK, I know how set up this.

Simply add to main mod file (the core) this:

public static Boolean[] par0Boolean = new Boolean[2];

and this you need to write into the config load:

par0Boolean[1] = config.get("GROUP","NAME", defaultBolean).getBoolean(true);

And for the setting the visibility of block/item you can use my API for this:

 

  Reveal hidden contents

 

 

in the main file you need to add regTab(item(or block unlocalizedName),your creative tab,par0Boolean[1]);

example:  regTab(mixed_dust,tabOmega,par0Boolean[1]);

It works for me fine.

 

//EDIT

if you want the api I can send the file to you  :)

Thank you SO much :) That helped :) Oh, and could you send me the API please? I'm pretty interested in it.

↑↑↑↑↑↑↑↑↑↑ Click it please? :3 ↑↑↑↑↑↑↑↑↑↑

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.