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

I have a block that has a few different textures and I hae gotten it so, the front texture faces you when it is placed.  But how would I make the icon when it is in my inventory display similar to how the furnace does?  Here is my code:

 

@SideOnly(Side.CLIENT)
    private IIcon blockTop;

    @SideOnly(Side.CLIENT)
    private IIcon blockSide;

    public BlockFactoryTerminal() {

        super();

        this.setBlockName("factoryFactoryTerminal");

    }

    public void onBlockPlacedBy(World world, int x, int y, int z, EntityLivingBase player, ItemStack stack) {

        int l = MathHelper.floor_double((double) (player.rotationYaw * 4f / 360f) + .5d) & 3;

        if(l == 0)
            world.setBlockMetadataWithNotify(x, y, z, 2, 2);

        if(l == 1)
            world.setBlockMetadataWithNotify(x, y, z, 5, 2);

        if(l == 2)
            world.setBlockMetadataWithNotify(x, y, z, 3, 2);

        if(l == 3)
            world.setBlockMetadataWithNotify(x, y, z, 4, 2);

    }

    @SideOnly(Side.CLIENT)
    public void registerBlockIcons(IIconRegister iconRegister) {

        blockIcon = iconRegister.registerIcon(String.format("%s", getUnWrappedUnlocalizedName(this.getUnlocalizedName())));
        blockTop = iconRegister.registerIcon(String.format("%s", getUnWrappedUnlocalizedName(ElectricFactoryBlocks.factoryFactoryStructureBlock.getUnlocalizedName() + "Top")));
        blockSide = iconRegister.registerIcon(String.format("%s", getUnWrappedUnlocalizedName(ElectricFactoryBlocks.factoryFactoryStructureBlock.getUnlocalizedName())));

    }

    @SideOnly(Side.CLIENT)
    public IIcon getIcon(int side, int meta) {

        if(side == 0 || side == 1)
            return blockTop;
        else if(side != meta)
            return blockSide;
        else
            return blockIcon;

    }

I have a block that has a few different textures and I hae gotten it so, the front texture faces you when it is placed.  But how would I make the icon when it is in my inventory display similar to how the furnace does?

What do you mean "similar to how the furnace does" ?

Do you mean you want the inventory block to face a particular direction?

 

If so, I would suggest one of two things-

either change your metadata meanings so that medata=0 gives you the inventory rendering appearance that you want, or use an ISimpleBlockRenderingHandler or an IItemRenderer for your item to give you more control.

For some background info, see here under the Item Rendering topics

http://greyminecraftcoder.blogspot.com.au/p/list-of-topics.html

 

-TGG

 

  • Author

yes in the direction it faces, I got it figured out by doing what you said and if the meta = 0, render it the way I want it to

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.