Jump to content

Modding help Not allows items/block to display in NEI/TMI


jamesscape2

Recommended Posts

Well, I can tell you how I hide items from NEI. Make a package in your client side package called:

codechicken.nei.api

 

Make a new class called:

API

 

Paste this in:

package codechicken.nei.api;

public class API {

    public static void hideItem(int id) {
    }
}

 

Then in both your proxy's, add this:

public void doNEICheck(int id) {}

Then in your Client proxy, add this to the body of that method(DO NOT IMPORT codechicken.nei.api!!!):

if (Minecraft.getMinecraft().thePlayer != null ) {
            Iterator modsIT = Loader.instance().getModList().iterator();
            ModContainer modc;
            while (modsIT.hasNext()) {
                modc = (ModContainer) modsIT.next();
                if ("Not Enough Items".equals(modc.getName().trim())) {
                    codechicken.nei.api.API.hideItem(id);
                    return;
                }
            }
        }

When you release, DO NOT INCLUDE the  codechicken.nei.api package. Players with NEI will already have it, and IT will do the hiding for you. Players who don't have nei will never reach the statement to error out.

 

Edit: Oh almost forgot, see how i check if the player exists? I do this because I remove the items after the player loads a world, this ensures your items are removed after nei adds them, and that idresolver hasn't changed any of your ID's in between.

Link to comment
Share on other sites

Uh you do realize you have to pass the id's of the blocks you want to hide to your proxies via Mod.proxy.doNEICheck(blockOrItemIDToHide) right? My example won't work unless the world is already loaded, you can  put the call in a tick, and toggle a boolean to disable the call if it succeeds. I don't know what would happen if you try to remove an ID that doesn't exist, probably nothing, but there is no point and is a waste of resources.

Link to comment
Share on other sites

  • 1 year later...

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.