Jump to content
View in the app

A better way to browse. Learn more.

Forge Forums

A full-screen app on your home screen with push notifications, badges and more.

To install this app on iOS and iPadOS
  1. Tap the Share icon in Safari
  2. Scroll the menu and tap Add to Home Screen.
  3. Tap Add in the top-right corner.
To install this app on Android
  1. Tap the 3-dot menu (⋮) in the top-right corner of the browser.
  2. Tap Add to Home screen or Install app.
  3. Confirm by tapping Install.

Featured Replies

Posted

So I am trying to make an item that will change textures when it changes modes, and it crashes when I try.  I took a similar code from the bow pullback I have used, but it is not working because there are some bow specific properties that I tried to replace but it wasn't right.  How can I make it so when it changes modes, it changes textures

 

Icon code

 

  @SideOnly(Side.CLIENT)

    private IIcon[] iconArray;

   

    @SideOnly(Side.CLIENT)

    public void registerIcons(IIconRegister par1IconRegister)

    {

        this.itemIcon = par1IconRegister.registerIcon(this.getIconString() + "_standby");

        this.iconArray = new IIcon[iconString.length()];

     

        for (int i = 0; i < this.iconArray.length; ++i)

        {

            this.iconArray = par1IconRegister.registerIcon(this.getIconString() + "_" + iconArray);

        }

   

    }

    public IIcon getIcon(ItemStack stack, int renderPass, EntityPlayer player, ItemStack usingItem, int useRemaining) {

if(usingItem.stackTagCompound.getInteger("mode")==0){

return iconArray[0];

}

else if(usingItem.stackTagCompound.getInteger("mode")==2){

return iconArray[2];

}

else if(usingItem.stackTagCompound.getInteger("mode")==1){

return iconArray[1];

}

 

   

    return itemIcon;

   

    }

 

 

Thank you

  • Author

It works when I use this in a bow

 

@SideOnly(Side.CLIENT)

    public void registerIcons(IIconRegister par1IconRegister)

    {

        this.itemIcon = par1IconRegister.registerIcon(this.getIconString() + "_standby");

        this.iconArray = new IIcon[bowPullIconNameArray.length];

     

        for (int i = 0; i < this.iconArray.length; ++i)

        {

            this.iconArray = par1IconRegister.registerIcon(this.getIconString() + "_" + bowPullIconNameArray);

        }

   

    }

 

And can you at least be helpful and tell me what is wrong...

  • Author

Ok, thanks, My formatting is not like that in the code the copy paste must have messed it up. Also I have never used any of this Icon stuff before. I am sorry, I am new to forge coding and it does not help me learn by telling me that I suck at what I am trying to learn

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...

Important Information

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

Configure browser push notifications

Chrome (Android)
  1. Tap the lock icon next to the address bar.
  2. Tap Permissions → Notifications.
  3. Adjust your preference.
Chrome (Desktop)
  1. Click the padlock icon in the address bar.
  2. Select Site settings.
  3. Find Notifications and adjust your preference.