Jump to content

Help with metadata sub-blocks in 1.5.1 for newb


Recommended Posts

Hey there!

Can anybody help me with getting metadata for blocks in 1.5.1

All what i got - is different icons in inventory of blocks sub-id, but i allways get  default block with no meta texture when placing it.

Here is my block code


package pyani.spellblock;
import java.util.ArrayList;
import java.util.List;
import net.minecraft.block.Block;
import net.minecraft.block.material.Material;
import net.minecraft.client.renderer.texture.IconRegister;
import net.minecraft.creativetab.CreativeTabs;
import net.minecraft.item.ItemStack;
import net.minecraft.util.Icon;
import net.minecraft.world.IBlockAccess;
import net.minecraft.world.World;
import cpw.mods.fml.relauncher.*;

public class BlockBricked extends Block 
protected Icon[] icon = new Icon[2]; 

public BlockBricked(int ID, Material material) 
{super(ID, material);}

/**Adds the texture from the directory stated**/
public void registerIcons(IconRegister iconRegister)
icon[0] = iconRegister.registerIcon("spellblock:Bricks");
icon[1] = iconRegister.registerIcon("spellblock:Bricks2");
    public int damageDropped(int meta){
            return meta;
public Icon getBlockTextureFromSideAndMetadata(int side, int meta)
return icon[meta];
    public void getSubBlocks(int unknown, CreativeTabs tab, List subItems) {
    	for (int ix = 0; ix < 2; ix++) {
    		subItems.add(new ItemStack(this, 1, ix));

Link to comment
Share on other sites

  • 1 month 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.

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.


  • Create New...

Important Information

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