Jump to content

Recommended Posts

Posted

How can i make a "Overlay" to a block with the normal ...

 

       

@SideOnly(Side.CLIENT)
public void registerIcons(IconRegister par1IconRegister)
{


            this.Overlay = par1IconRegister.registerIcon("FjonGCraft:AnimatedBlocks/test");
            this.iconArray = par1IconRegister.registerIcon("FjonGCraft:AnimatedBlockOverlay/" + getBlockOverlay);
          }

 

What the block look like

IR6Oruv.png

 

What the Block Should look like

d1DRPpk.png

 

 

U can see i have tried, but the only thing i can see ingame is the "block overlay", the blockbackground i missing...

but i cant find the problem...

 

Please leave an answer... ;)...

 

-Regards TheFjonG^  <3

Posted

I come so far:

 

[embed=425,349]package com.thefjong.tf.core;

 

import net.minecraft.block.Block;

import net.minecraft.block.material.Material;

import net.minecraft.client.renderer.texture.IconRegister;

import net.minecraft.util.Icon;

import cpw.mods.fml.relauncher.Side;

import cpw.mods.fml.relauncher.SideOnly;

 

public class ISidedAnimatedTextureBlock extends Block{

public static String getBlockOverlay;

Icon icons[];

public ISidedAnimatedTextureBlock(int par1, Material par2Material, String GetOverlay ){

super(par1, par2Material);

GetOverlay = getBlockOverlay;

icons = new Icon[2];

}

 

 

 

 

@SideOnly(Side.CLIENT)

public void registerIcons(IconRegister par1IconRegister)

{

 

 

          icons[0] = par1IconRegister.registerIcon("FjonGCraft:AnimatedBlocks/test");

            icons[1] = par1IconRegister.registerIcon("FjonGCraft:AnimatedBlockOverlay/" + getBlockOverlay);

    }

 

public int getRenderBlockPass()

    {

        return icons.length;

    }

 

 

public boolean canRenderInPass(int pass)

    {

        return pass == this.getRenderBlockPass();

    }

}

[/embed]

 

Posted

public int getRenderBlockPass()
    {
        return icons.length;
    }


public boolean canRenderInPass(int pass)
    {
        return pass == this.getRenderBlockPass();
    }

There are only two passes for blocks: 0 and 1.

icons.length returns 2, so nothing is rendered.

What you probably want:

public int pass;

public int getRenderBlockPass()
    {
        return this.pass;
    }

@Override
public boolean canRenderInPass(int pass)
    {
        this.pass = pass;
        return true;
    }

The block will be rendered twice, with the pass variable indicating which pass (0 or 1) is occurring.

You can then use this variable in your block renderer.

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.