Jump to content

Recommended Posts

Posted

//Sorry for the bad english

Hi everyone

 

1-) i made a skull but i have a little problem in the texture

https://www.dropbox.com/s/6ouy6qsfjur25qk/BlockProblem.png

The face Goes to up when you put it on the ground

 

2-) Ican't wear the skull

 

MadaraSkull(Item)

package NarutoStyle;

import java.util.List;

import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
import net.minecraft.block.Block;
import net.minecraft.block.BlockSkull;
import net.minecraft.client.renderer.texture.IconRegister;
import net.minecraft.creativetab.CreativeTabs;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.item.Item;
import net.minecraft.item.ItemSkull;
import net.minecraft.item.ItemStack;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.tileentity.TileEntitySkull;
import net.minecraft.util.Icon;
import net.minecraft.util.MathHelper;
import net.minecraft.util.StatCollector;
import net.minecraft.world.World;

public class MadaraSkull extends Item {




private static final String[] skullTypes = new String[] {"skeleton", "wither", "zombie", "char", "creeper"};
    public static final String[] field_94587_a = new String[] {"skull_skeleton", "skull_wither", "skull_zombie", "skull_char", "skull_creeper","MadaraSkull"};
    @SideOnly(Side.CLIENT)
    private Icon[] field_94586_c;

    public MadaraSkull(int par1)
    {
        super(par1);
        this.setCreativeTab(CreativeTabs.tabDecorations);
        this.setMaxDamage(0);
        this.setHasSubtypes(true);
    }

    /**
     * Callback for item usage. If the item does something special on right clicking, he will have one of those. Return
     * True if something happen and false if it don't. This is for ITEMS, not BLOCKS
     */
    public boolean onItemUse(ItemStack par1ItemStack, EntityPlayer par2EntityPlayer, World par3World, int par4, int par5, int par6, int par7, float par8, float par9, float par10)
    {
        if (par7 == 0)
        {
            return false;
        }
        else if (!par3World.getBlockMaterial(par4, par5, par6).isSolid())
        {
            return false;
        }
        else
        {
            if (par7 == 1)
            {
                ++par5;
            }

            if (par7 == 2)
            {
                --par6;
            }

            if (par7 == 3)
            {
                ++par6;
            }

            if (par7 == 4)
            {
                --par4;
            }

            if (par7 == 5)
            {
                ++par4;
            }

            if (!par2EntityPlayer.canPlayerEdit(par4, par5, par6, par7, par1ItemStack))
            {
                return false;
            }
            else if (!NarutoStyle.BlockMadaraSkull.canPlaceBlockAt(par3World, par4, par5, par6))
            {
                return false;
            }
            else
            {
                par3World.setBlock(par4, par5, par6, NarutoStyle.BlockMadaraSkull.blockID, par7, 2);
                int i1 = 0;

                if (par7 == 1)
                {
                    i1 = MathHelper.floor_double((double)(par2EntityPlayer.rotationYaw * 16.0F / 360.0F) + 0.5D) & 15;
                }

                TileEntity tileentity = par3World.getBlockTileEntity(par4, par5, par6);

                if (tileentity != null && tileentity instanceof TileEntitySkull)
                {
                    String s = "";

                    if (par1ItemStack.hasTagCompound() && par1ItemStack.getTagCompound().hasKey("SkullOwner"))
                    {
                        s = par1ItemStack.getTagCompound().getString("SkullOwner");
                    }

                    ((TileEntitySkull)tileentity).setSkullType(par1ItemStack.getItemDamage(), s);
                    ((TileEntitySkull)tileentity).setSkullRotation(i1);
                    ((BlockSkull)NarutoStyle.BlockMadaraSkull).makeWither(par3World, par4, par5, par6, (TileEntitySkull)tileentity);
                }

                --par1ItemStack.stackSize;
                return true;
            }
        }
        

    
    }

    

    

}

 

BlockMadaraSkull(Block)

package NarutoStyle;

import net.minecraft.block.Block;
import net.minecraft.block.BlockContainer;
import net.minecraft.block.material.Material;
import net.minecraft.client.renderer.texture.IconRegister;
import net.minecraft.entity.EntityLiving;
import net.minecraft.entity.boss.EntityWither;
import net.minecraft.item.Item;
import net.minecraft.item.ItemStack;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.tileentity.TileEntitySkull;
import net.minecraft.util.AxisAlignedBB;
import net.minecraft.util.MathHelper;
import net.minecraft.world.IBlockAccess;
import net.minecraft.world.World;

public class BlockMadaraSkull extends Block {

public BlockMadaraSkull(int par1, Material par2Material) {
	super(par1, par2Material);
	this.setBlockBounds(0.25F, 0.0F, 0.25F, 0.75F, 0.5F, 0.75F);

}

public void RegisterIcons(IconRegister IR)
{
	this.blockIcon = IR.registerIcon(NarutoStyle.modid + ":" + this.getUnlocalizedName());
}



    /**
     * 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;
    }

    /**
     * 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 void setBlockBoundsBasedOnState(IBlockAccess par1IBlockAccess, int par2, int par3, int par4)
    {
        int l = par1IBlockAccess.getBlockMetadata(par2, par3, par4) & 7;

        switch (l)
        {
            case 1:
            default:
                this.setBlockBounds(0.25F, 0.0F, 0.25F, 0.75F, 0.5F, 0.75F);
                break;
            case 2:
                this.setBlockBounds(0.25F, 0.25F, 0.5F, 0.75F, 0.75F, 1.0F);
                break;
            case 3:
                this.setBlockBounds(0.25F, 0.25F, 0.0F, 0.75F, 0.75F, 0.5F);
                break;
            case 4:
                this.setBlockBounds(0.5F, 0.25F, 0.25F, 1.0F, 0.75F, 0.75F);
                break;
            case 5:
                this.setBlockBounds(0.0F, 0.25F, 0.25F, 0.5F, 0.75F, 0.75F);
        }
    }
    public AxisAlignedBB getCollisionBoundingBoxFromPool(World par1World, int par2, int par3, int par4)
    {
        this.setBlockBoundsBasedOnState(par1World, par2, par3, par4);
        return super.getCollisionBoundingBoxFromPool(par1World, par2, par3, par4);
    }
    public void onBlockPlacedBy(World par1World, int par2, int par3, int par4, EntityLiving par5EntityLiving, ItemStack par6ItemStack)
    {
        int l = MathHelper.floor_double((double)(par5EntityLiving.rotationYaw * 4.0F / 360.0F) + 2.5D) & 3;
        par1World.setBlockMetadataWithNotify(par2, par3, par4, l, 2);
    }

    /**
     * Returns a new instance of a block's tile entity class. Called on placing the block.
     */
    public TileEntity createNewTileEntity(World par1World)
    {
        return new TileEntitySkull();
    }
    /**
     * This method attempts to create a wither at the given location and skull
     */
    public void makeWither(World par1World, int par2, int par3, int par4, TileEntitySkull par5TileEntitySkull)
    {
        if (par5TileEntitySkull.getSkullType() == 1 && par3 >= 2 && par1World.difficultySetting > 0 && !par1World.isRemote)
        {
            int l = Block.slowSand.blockID;
            int i1;
            EntityWither entitywither;
            int j1;

            for (i1 = -2; i1 <= 0; ++i1)
            {
                if (par1World.getBlockId(par2, par3 - 1, par4 + i1) == l && par1World.getBlockId(par2, par3 - 1, par4 + i1 + 1) == l && par1World.getBlockId(par2, par3 - 2, par4 + i1 + 1) == l && par1World.getBlockId(par2, par3 - 1, par4 + i1 + 2) == l && this.func_82528_d(par1World, par2, par3, par4 + i1, 1) && this.func_82528_d(par1World, par2, par3, par4 + i1 + 1, 1) && this.func_82528_d(par1World, par2, par3, par4 + i1 + 2, 1))
                {
                    par1World.setBlockMetadataWithNotify(par2, par3, par4 + i1, 8, 2);
                    par1World.setBlockMetadataWithNotify(par2, par3, par4 + i1 + 1, 8, 2);
                    par1World.setBlockMetadataWithNotify(par2, par3, par4 + i1 + 2, 8, 2);
                    par1World.setBlock(par2, par3, par4 + i1, 0, 0, 2);
                    par1World.setBlock(par2, par3, par4 + i1 + 1, 0, 0, 2);
                    par1World.setBlock(par2, par3, par4 + i1 + 2, 0, 0, 2);
                    par1World.setBlock(par2, par3 - 1, par4 + i1, 0, 0, 2);
                    par1World.setBlock(par2, par3 - 1, par4 + i1 + 1, 0, 0, 2);
                    par1World.setBlock(par2, par3 - 1, par4 + i1 + 2, 0, 0, 2);
                    par1World.setBlock(par2, par3 - 2, par4 + i1 + 1, 0, 0, 2);

                    if (!par1World.isRemote)
                    {
                        entitywither = new EntityWither(par1World);
                        entitywither.setLocationAndAngles((double)par2 + 0.5D, (double)par3 - 1.45D, (double)(par4 + i1) + 1.5D, 90.0F, 0.0F);
                        entitywither.renderYawOffset = 90.0F;
                        entitywither.func_82206_m();
                        par1World.spawnEntityInWorld(entitywither);
                    }

                    for (j1 = 0; j1 < 120; ++j1)
                    {
                        par1World.spawnParticle("snowballpoof", (double)par2 + par1World.rand.nextDouble(), (double)(par3 - 2) + par1World.rand.nextDouble() * 3.9D, (double)(par4 + i1 + 1) + par1World.rand.nextDouble(), 0.0D, 0.0D, 0.0D);
                    }

                    par1World.notifyBlockChange(par2, par3, par4 + i1, 0);
                    par1World.notifyBlockChange(par2, par3, par4 + i1 + 1, 0);
                    par1World.notifyBlockChange(par2, par3, par4 + i1 + 2, 0);
                    par1World.notifyBlockChange(par2, par3 - 1, par4 + i1, 0);
                    par1World.notifyBlockChange(par2, par3 - 1, par4 + i1 + 1, 0);
                    par1World.notifyBlockChange(par2, par3 - 1, par4 + i1 + 2, 0);
                    par1World.notifyBlockChange(par2, par3 - 2, par4 + i1 + 1, 0);
                    return;
                }
            }

            for (i1 = -2; i1 <= 0; ++i1)
            {
                if (par1World.getBlockId(par2 + i1, par3 - 1, par4) == l && par1World.getBlockId(par2 + i1 + 1, par3 - 1, par4) == l && par1World.getBlockId(par2 + i1 + 1, par3 - 2, par4) == l && par1World.getBlockId(par2 + i1 + 2, par3 - 1, par4) == l && this.func_82528_d(par1World, par2 + i1, par3, par4, 1) && this.func_82528_d(par1World, par2 + i1 + 1, par3, par4, 1) && this.func_82528_d(par1World, par2 + i1 + 2, par3, par4, 1))
                {
                    par1World.setBlockMetadataWithNotify(par2 + i1, par3, par4, 8, 2);
                    par1World.setBlockMetadataWithNotify(par2 + i1 + 1, par3, par4, 8, 2);
                    par1World.setBlockMetadataWithNotify(par2 + i1 + 2, par3, par4, 8, 2);
                    par1World.setBlock(par2 + i1, par3, par4, 0, 0, 2);
                    par1World.setBlock(par2 + i1 + 1, par3, par4, 0, 0, 2);
                    par1World.setBlock(par2 + i1 + 2, par3, par4, 0, 0, 2);
                    par1World.setBlock(par2 + i1, par3 - 1, par4, 0, 0, 2);
                    par1World.setBlock(par2 + i1 + 1, par3 - 1, par4, 0, 0, 2);
                    par1World.setBlock(par2 + i1 + 2, par3 - 1, par4, 0, 0, 2);
                    par1World.setBlock(par2 + i1 + 1, par3 - 2, par4, 0, 0, 2);

                    if (!par1World.isRemote)
                    {
                        entitywither = new EntityWither(par1World);
                        entitywither.setLocationAndAngles((double)(par2 + i1) + 1.5D, (double)par3 - 1.45D, (double)par4 + 0.5D, 0.0F, 0.0F);
                        entitywither.func_82206_m();
                        par1World.spawnEntityInWorld(entitywither);
                    }

                    for (j1 = 0; j1 < 120; ++j1)
                    {
                        par1World.spawnParticle("snowballpoof", (double)(par2 + i1 + 1) + par1World.rand.nextDouble(), (double)(par3 - 2) + par1World.rand.nextDouble() * 3.9D, (double)par4 + par1World.rand.nextDouble(), 0.0D, 0.0D, 0.0D);
                    }

                    par1World.notifyBlockChange(par2 + i1, par3, par4, 0);
                    par1World.notifyBlockChange(par2 + i1 + 1, par3, par4, 0);
                    par1World.notifyBlockChange(par2 + i1 + 2, par3, par4, 0);
                    par1World.notifyBlockChange(par2 + i1, par3 - 1, par4, 0);
                    par1World.notifyBlockChange(par2 + i1 + 1, par3 - 1, par4, 0);
                    par1World.notifyBlockChange(par2 + i1 + 2, par3 - 1, par4, 0);
                    par1World.notifyBlockChange(par2 + i1 + 1, par3 - 2, par4, 0);
                    return;
                }
            }
        }
    }

	private boolean func_82528_d(World par1World, int i, int par3,
			int par4, int j) {
		// TODO Auto-generated method stub
		return false;
	}











}

 

:)

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.