Jump to content

Custom Wood Block


jkorn2324swagg

Recommended Posts

Hi, I need help trying to render my wood block so it would kind of look like bamboo, but the block just always look like a regular block. Here is my code:

 

package mymod.blocks;

 

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.util.Icon;

import net.minecraft.world.IBlockAccess;

 

public class PapayaWood extends Block{

 

private Icon PapayaTreeBlock; //Side of Block

private Icon PapayaTreeBlockTop; //Top & Bottom of Block

 

public PapayaWood(int par1)

    {

        super(par1, Material.wood);

        this.setCreativeTab(CreativeTabs.tabBlock);

    }

   

    /**

    * If this block doesn't render as an ordinary block it will return False (examples: signs, buttons, stairs, etc)

    */

    public boolean renderAsNormalBlock()

    {

        return false;

    }

 

    public boolean getBlocksMovement(IBlockAccess par1IBlockAccess, int par2, int par3, int par4)

    {

        return false;

    }

 

    /**

    * Is this block (a) opaque and (b) a full 1m cube?  This determines whether or not to render the shared face of two

    * adjacent blocks and also whether the player can attach torches, redstone wire, etc to this block.

    */

    public boolean isOpaqueCube()

    {

        return false;

    }

 

 

@Override public void registerIcons(IconRegister iconRegister)

    {

this.PapayaTreeBlock = iconRegister.registerIcon("mymod:PapayaTreeBlock");

    this.PapayaTreeBlockTop = iconRegister.registerIcon("mymod:PapayaTreeBlockTop");

    }

 

public Icon getBlockTexture(IBlockAccess par1IBlockAccess, int par2, int par3, int par4, int par5)

    {

if (par5 == 0)

        {

            return this.PapayaTreeBlockTop;

        }

        else if (par5 == 1)

        {

            return this.PapayaTreeBlockTop;

        }

        else

        {

        return this.PapayaTreeBlock;

        }

    }

        public Icon getIcon(int par1, int par2)

        {

            return par1 == 1 ? this.PapayaTreeBlockTop : par1 == 0 ? this.PapayaTreeBlockTop : this.PapayaTreeBlock; // 1- Top    0- Bottom  else: Side );

        }

}

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.



×
×
  • Create New...

Important Information

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