Jump to content

TheGreyGhost

Members
  • Posts

    3280
  • Joined

  • Last visited

  • Days Won

    8

Posts posted by TheGreyGhost

  1. Hi.

     

    I suspect you need to change your handleRenderType to return true for EQUIPPED_FIRST_PERSON as well as EQUIPPED.  EQUIPPED is 3rd person only.  Likewise your renderItem code.

     

    This sample code might help:

     

    http://greyminecraftcoder.blogspot.com.au/2013/09/sample-code-for-rendering-items.html

     

    https://github.com/TheGreyGhost/ItemRendering/blob/master/src/TestItemRendering/items/ItemLampshadeRenderer.java

     

  2. It may be helpful to have a look at the piston.  It is a block not a tile entity, and it uses metadata to record which direction the piston is pointing in (based on the player direction when the piston was placed). 

    BlockPistonBase:
       public void onBlockPlacedBy(World par1World, int par2, int par3, int par4, EntityLivingBase par5EntityLivingBase, ItemStack par6ItemStack)
        {
            int l = determineOrientation(par1World, par2, par3, par4, par5EntityLivingBase);
            par1World.setBlockMetadataWithNotify(par2, par3, par4, l, 2);
            //etc
    

     

    During the block render it looks at the metadata to figure out how to rotate the faces as necessary for proper rendering.

        
    RenderBlocks:
    public boolean renderPistonBase(Block par1Block, int par2, int par3, int par4, boolean par5)
        {
            int l = this.blockAccess.getBlockMetadata(par2, par3, par4);
            boolean flag1 = par5 || (l &  != 0;
            int i1 = BlockPistonBase.getOrientation(l);
            float f = 0.25F;
    
            if (flag1)
            {
                switch (i1)
                {
                    case 0:
                        this.uvRotateEast = 3;
                        this.uvRotateWest = 3;
                        this.uvRotateSouth = 3;
                        this.uvRotateNorth = 3;
                        this.setRenderBounds(0.0D, 0.25D, 0.0D, 1.0D, 1.0D, 1.0D);
                        break;
                    case 1:
                        this.setRenderBounds(0.0D, 0.0D, 0.0D, 1.0D, 0.75D, 1.0D);
                        break;
    

     

     

    -->Richard

  3. Hi

     

    The answers you're looking for are probably in here:

    RenderBlocks.renderBlockRedstoneWire()
    

    There is a section near the top that figures out how many neighbouring redstone blocks there are:

            boolean flag = BlockRedstoneWire.isPowerProviderOrWire(this.blockAccess, par2 - 1, par3, par4, 1) || !this.blockAccess.isBlockNormalCube(par2 - 1, par3, par4) && BlockRedstoneWire.isPowerProviderOrWire(this.blockAccess, par2 - 1, par3 - 1, par4, -1);
            boolean flag1 = BlockRedstoneWire.isPowerProviderOrWire(this.blockAccess, par2 + 1, par3, par4, 3) || !this.blockAccess.isBlockNormalCube(par2 + 1, par3, par4) && BlockRedstoneWire.isPowerProviderOrWire(this.blockAccess, par2 + 1, par3 - 1, par4, -1);
            boolean flag2 = BlockRedstoneWire.isPowerProviderOrWire(this.blockAccess, par2, par3, par4 - 1, 2) || !this.blockAccess.isBlockNormalCube(par2, par3, par4 - 1) && BlockRedstoneWire.isPowerProviderOrWire(this.blockAccess, par2, par3 - 1, par4 - 1, -1);
            boolean flag3 = BlockRedstoneWire.isPowerProviderOrWire(this.blockAccess, par2, par3, par4 + 1, 0) || !this.blockAccess.isBlockNormalCube(par2, par3, par4 + 1) && BlockRedstoneWire.isPowerProviderOrWire(this.blockAccess, par2, par3 - 1, par4 + 1, -1);
    {etc}
    

    par2, par3, par4 correspond to [x,y,z].

     

    Based on these flags, the rendering code chooses the right icons to render (using tessellator.addVertexWithUV()...)

    See also http://greyminecraftcoder.blogspot.com.au/2013/08/the-tessellator.html

     

  4. After three hours wrestling with this damn error:

    [sEVERE] [Minecraft-Client] Using missing texture, unable to load: testitemrendering:textures/items/Error.png

    I finally figured out where to place my icons and textures so that Minecraft will find them.

     

    In order to find the icon corresponding to

    itemIcon = iconRegister.registerIcon("TestItemRendering:Error");

    it is constructed as :

    {base path}/assets/{mod name}/textures/items/{Icon name}.png

     

    In my case, this comes out as

    C:\Documents and Settings\TheGreyGhost\My Documents\IDEAprojects\ForgeCurrent\out\production\TestItemRendering\assets\testitemrendering\textures\items/error.png

     

    where my base path was

    C:\Documents and Settings\TheGreyGhost\My Documents\IDEAprojects\ForgeCurrent\out\production\TestItemRendering

     

    The hardest bit was figuring out what the base path should be, it will be different for you of course.

     

    I finally found it by inserting a breakpoint in here.

     

        public AbstractResourcePack(File par1File)
        {
            this.basePath = par1File;
        }

     

    If that doesn't work for you, you might also try

     

    FolderResourcePack 
        protected boolean makeFullPath(String par1Str)
        {
            return (new File(this.basePath, par1Str)).isFile();
        }
    
    FileResourcePack
        protected boolean makeFullPath(String par1Str)
        {
            return (new File(this.basePath, par1Str)).isFile();
        }

  5. Hi

     

    I'm slowly wrestling my way through the various rendering code and I think I've come across a couple of  mistakes.

     

    RenderBlocks has six renderFace methods (eg renderFaceYNeg), and these renderFace methods use some flags (set by the caller) to alter how the faces are rendered, for example uvRotateEast.

     

    The problem I'm found is that some of these aren't properly named.

     

    For example-

    renderFaceZPos uses the uvRotateWest flag, but the positive Z face is south, not west.

     

    Is there a robust way I can change these?  i.e. so I can write

    renderBlock.uvRotateSouth = 1; renderBlock.renderFaceZpos();

     

    I don't understand how Forge decompiles the Minecraft jar and gives meaningful names to everything - is this something I can customise (for example - giving better names to the parameters of various interface functions (eg par1, par2)), without having to do it all from scratch every time I update to a new version of Forge? 

     

    Cheers

      Richard

     

     

     

     

     

     

×
×
  • Create New...

Important Information

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