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

Hey guys after some help I cannot get my block variants to render within the Creative tab/hotbar, when placed in the world as a block they render just fine with each with it's own texture.

 

My ModBlocks Class

public static final Block blockStained = new BlockStained();

public static void registerBlocks()
{
GameRegistry.register(blockStained);
Register blockStainedVarients();
}
public static void blockStainedVarients()
    {
    	String colors[] = {"white","orange","magenta","light_blue","yellow","lime","pink","gray","silver","cyan","purple","blue","brown","green","red","black"};
    	for (int i=0; i < colors.length; i++)
	{	
		ModelBakery.registerItemVariants(Item.getItemFromBlock(blockStained), new ModelResourceLocation(blockStained.getRegistryName() + "_" + colors[i], "inventory"));
	}

    }

 

My ModItems Class

public static void registerItems() 
{
GameRegistry.register(new [glow=red,2,300]ItemBlockMeta[/glow](ModBlocks.blockStained), ModBlocks.blockStained.getRegistryName());
}

 

My Custom ItemBlockMeta Class

public class ItemBlockMeta extends ItemBlock {

    public ItemBlockMeta(Block block) {
        super(block);
        if (!(block instanceof IMetaBlockName)) {
            throw new IllegalArgumentException(String.format("The given Block %s is not an instance of ISpecialBlockName!", block.getUnlocalizedName()));
        }
        this.setMaxDamage(0);
        this.setHasSubtypes(true);
        
    }

    public int getMetadata(int damage)
    {
        return damage;
    }

    @Override
    public String getUnlocalizedName(ItemStack stack) {
        return super.getUnlocalizedName(stack) + "." + ((IMetaBlockName)this.block).getSpecialName(stack); //This is a custom Interface class with String getSpecialName(ItemStack stack);
    }
}

 

My assets\modname\blockstates\blockstained.json with all 16 varients meta states

{
    "variants": {
        "color=white": { "model":"justsolars:blockstained_white" },
        "color=orange": { "model":"justsolars:blockstained_orange" },
	"color=magenta": { "model":"justsolars:blockstained_magenta" },
        "color=light_blue": { "model":"justsolars:blockstained_light_blue" },
	"color=yellow": { "model":"justsolars:blockstained_yellow" },
        "color=lime": { "model":"justsolars:blockstained_lime" },
	"color=pink": { "model":"justsolars:blockstained_pink" },
        "color=gray": { "model":"justsolars:blockstained_gray" },
	"color=silver": { "model":"justsolars:blockstained_silver" },
        "color=cyan": { "model":"justsolars:blockstained_cyan" },
	"color=purple": { "model":"justsolars:blockstained_purple" },
        "color=blue": { "model":"justsolars:blockstained_blue" },
	"color=brown": { "model":"justsolars:blockstained_brown" },
        "color=green": { "model":"justsolars:blockstained_green" },
	"color=red": { "model":"justsolars:blockstained_red" },
        "color=black": { "model":"justsolars:blockstained_black" }
    }
}

 

I have 16 model\block Json's, 16 model\item Json's and 16 textures/

 

I have attached a couple of screenshot to help understand.

tFyjjAj.png

9jSDESg.png

 

Any help appreciated.

 

Regards

 

Jolt

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.