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



  • Recently Browsing

    • No registered users viewing this page.
  • Posts

    • Hello, I have this same problem. Did you manage to find a solution? Any help would be appreciated. Thanks.
    • log: https://mclo.gs/QJg3wYX as stated in the title, my game freezes upon loading into the server after i used a far-away waystone in it. The modpack i'm using is better minecraft V18. Issue only comes up in this specific server, singleplayer and other servers are A-okay. i've already experimented with removing possible culprits like modernfix and various others to no effect. i've also attempted a full reinstall of the modpack profile. Issue occurs shortly after the 'cancel' button dissapears on the 'loading world' section of the loading screen.   thanks in advance.
    • You would have better results asking a more specific question. What have you done? What exactly do you need help with? Please also read the FAQ regarding posting logs.
    • Hi, this is my second post with the same content as no one answered this and it's been a long time since I made the last post, I want to make a client-only mod, everything is ok, but when I use shaders, none of the textures rendered in RenderLevelStageEvent nor the crow entity model are rendered, I want them to be visible, because it's a horror themed mod I've already tried it with different shaders, but it didn't work with any of them and I really want to add support for shaders Here is how i render the crow model in the CrowEntityRenderer<CrowEntity>, by the time i use this method, i know is not the right method but i don't think this is the cause of the problem, the renderType i'm using is entityCutout @Override public void render(CrowEntity p_entity, float entityYaw, float partialTick, PoseStack poseStack, MultiBufferSource bufferSource, int packedLight) { super.render(p_entity, entityYaw, partialTick, poseStack, bufferSource, packedLight); ClientEventHandler.getClient().crow.renderToBuffer(poseStack, bufferSource.getBuffer(ClientEventHandler.getClient().crow .renderType(TEXTURE)), packedLight, OverlayTexture.NO_OVERLAY, Utils.rgb(255, 255, 255)); } Here renderLevelStage @Override public void renderWorld(RenderLevelStageEvent e) { horrorEvents.draw(e); } Here is how i render every event public void draw(RenderLevelStageEvent e) { for (HorrorEvent event : currentHorrorEvents) { event.tick(e.getPartialTick()); event.draw(e); } } Here is how i render the crow model on the event @Override public void draw(RenderLevelStageEvent e) { if(e.getStage() == RenderLevelStageEvent.Stage.AFTER_ENTITIES) { float arcProgress = getArcProgress(0.25f); int alpha = (int) Mth.lerp(arcProgress, 0, 255); int packedLight = LevelRenderer.getLightColor(Minecraft.getInstance().level, blockPos); VertexConsumer builder = ClientEventHandler.bufferSource.getBuffer(crow); Crow<CreepyBirdHorrorEvent> model = ClientEventHandler .getClient().crow; model.setupAnim(this); RenderHelper.renderModelInWorld(model, position, offset, e.getCamera(), e.getPoseStack(), builder, packedLight, OverlayTexture.NO_OVERLAY, alpha); builder = ClientEventHandler.bufferSource.getBuffer(eyes); RenderHelper.renderModelInWorld(model, position, offset, e.getCamera(), e.getPoseStack(), builder, 15728880, OverlayTexture.NO_OVERLAY, alpha); } } How i render the model public static void renderModelInWorld(Model model, Vector3f pos, Vector3f offset, Camera camera, PoseStack matrix, VertexConsumer builder, int light, int overlay, int alpha) { matrix.pushPose(); Vec3 cameraPos = camera.getPosition(); double finalX = pos.x - cameraPos.x + offset.x; double finalY = pos.y - cameraPos.y + offset.y; double finalZ = pos.z - cameraPos.z + offset.z; matrix.pushPose(); matrix.translate(finalX, finalY, finalZ); matrix.mulPose(Axis.XP.rotationDegrees(180f)); model.renderToBuffer(matrix, builder, light, overlay, Utils .rgba(255, 255, 255, alpha)); matrix.popPose(); matrix.popPose(); } Thanks in advance
  • Topics

  • Who's Online (See full list)

×
×
  • Create New...

Important Information

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