Jump to content

[1.7.10] [SOLVED] Custom Logs


Rohzek

Recommended Posts

Okay, I'm.. stumped.. I'm making a set of logs to go a long with the vanilla logs which are basically the vanilla logs without bark.. So I've tried extending BlockLog and BlockNewLog.. both of which work the same way.. and overridden the methods and passed in my custom textures and such.. and am being held back by a problem. Oak, Spruce, Birch, and Jungle logs work perfectly but Acacia and Dark Oak aren't working correctly. They're named correctly but the textures are loading from my Oak and Spruce textures, not my acacia and dark oak ones.

 

Going through and printing whats loading in my ItemBlockWithMetadata class and in the registerBlockIcons method both print out the correct things... it's just not working. Do I really have to split logs into two classes like the vanilla code has done? Or am I missing something basic?

 

 

 

public class DebarkedWood extends BlockNewLog
{

public DebarkedWood() 
{
	super();

	setCreativeTab(ATCreativeTabs.blocksTab);
	setHardness(2.0f);
	setResistance(10.0f);
	setStepSound(soundTypeWood);
}

    public static final String[] types = new String[] {"oak", "spruce", "birch", "jungle", "acacia", "darkOak"};
    
    @SideOnly(Side.CLIENT)
    private IIcon[] iconSide;
    @SideOnly(Side.CLIENT)
    private IIcon[] iconTop;

    @Override
    public int damageDropped(int meta)
    {
        return meta;
    }

    @SideOnly(Side.CLIENT)
    @Override
    public void getSubBlocks(Item item, CreativeTabs tab, List list)
    {
    	list.add(new ItemStack(item, 1, 0));
    	list.add(new ItemStack(item, 1, 1));
    	list.add(new ItemStack(item, 1, 2));
    	list.add(new ItemStack(item, 1, 3));
    	list.add(new ItemStack(item, 1, 4));
    	list.add(new ItemStack(item, 1, 5));
    }
    
    @SideOnly(Side.CLIENT)
    @Override
    protected IIcon getSideIcon(int meta)
    {
        return iconSide[meta];
    }

    @SideOnly(Side.CLIENT)
    @Override
    protected IIcon getTopIcon(int meta)
    {
        return iconTop[meta];
    }
    

    @SideOnly(Side.CLIENT)
    @Override
    public void registerBlockIcons(IIconRegister register)
    {
        iconSide = new IIcon[types.length];
        iconTop = new IIcon[types.length];

        for (int i = 0; i < iconSide.length; ++i)
        {
            iconSide[i] = register.registerIcon(Reference.RESOURCEID + types[i] + this.getTextureName());
        }
        
        for (int i = 0; i < iconTop.length; ++i)
        {
            iconTop[i] = register.registerIcon(Reference.RESOURCEID + types[i] + "LogTop");
        }
    }
}

 

 

Developing the Spiral Power Mod .

こんにちは!お元気ですか?

Link to comment
Share on other sites

Logs require 4* metadata values per type, so you can only have a maximum of 4 log types per block instance, which is basically the same as per unique block class (though you could "get around it" by passing in the types array to the constructor and making a separate instance of the same class).

 

So yes, you do need to split them up.

 

* More technically: meta 0-3 (bits 1 and 2) are used for the wood type, and then bits 3 (i.e. meta = 4) and 4 (i.e. meta = 8 ) are used for block rotation, so there is no room left for other variants in a 4-bit space. E.g. type 0 also has values at 4, 8, and 12; a total of 4 states per type.

Link to comment
Share on other sites

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.