Jump to content

1.5.1 Custom Block render problem, Invisible blocks


Jade_Knightblazer

Recommended Posts

Hmm, with the new 1.5.1 seems my Custom Blocks no longer render in the world....

 

Here is the Code I use:

 

Render Class

package mod_HarkenScythe.client;

import mod_HarkenScythe.common.BlockHSBloodCrucible;
import mod_HarkenScythe.common.BlockHSSoulCrucible;
import net.minecraft.block.Block;
import net.minecraft.client.renderer.EntityRenderer;
import net.minecraft.client.renderer.RenderBlocks;
import net.minecraft.client.renderer.Tessellator;
import net.minecraft.util.Icon;
import net.minecraft.world.IBlockAccess;
import cpw.mods.fml.client.registry.ISimpleBlockRenderingHandler;
import cpw.mods.fml.relauncher.SideOnly;
import mod_HarkenScythe.common.mod_HarkenScythe;

public class RenderHSCrucible implements ISimpleBlockRenderingHandler
{

@Override
public boolean shouldRender3DInInventory() {
	// TODO Auto-generated method stub
	return false;
}

@Override
public int getRenderId() {
	// TODO Auto-generated method stub
	return mod_HarkenScythe.HSCrucibleRenderID;
}


@Override
public void renderInventoryBlock(Block block, int metadata, int modelID, RenderBlocks renderer)
{
	// TODO Auto-generated method stub
}

@Override
public boolean renderWorldBlock(IBlockAccess blockAccess, int par2, int par3, int par4, Block par1BlockHSCrucible, int modelId, RenderBlocks renderer)
{
	// TODO Auto-generated method stub

	////Added*********************
	renderer.renderStandardBlock(par1BlockHSCrucible, par2, par3, par4);
        Tessellator tessellator = Tessellator.instance;
        tessellator.setBrightness(par1BlockHSCrucible.getMixedBrightnessForBlock(blockAccess, par2, par3, par4));
        float f = 1.0F;
        int l = par1BlockHSCrucible.colorMultiplier(renderer.blockAccess, par2, par3, par4);
        float f1 = (float)(l >> 16 & 255) / 255.0F;
        float f2 = (float)(l >> 8 & 255) / 255.0F;
        float f3 = (float)(l & 255) / 255.0F;
        float f4;

        if (EntityRenderer.anaglyphEnable)
        {
            float f5 = (f1 * 30.0F + f2 * 59.0F + f3 * 11.0F) / 100.0F;
            f4 = (f1 * 30.0F + f2 * 70.0F) / 100.0F;
            float f6 = (f1 * 30.0F + f3 * 70.0F) / 100.0F;
            f1 = f5;
            f2 = f4;
            f3 = f6;
        }

        tessellator.setColorOpaque_F(f * f1, f * f2, f * f3);
        Icon icon = par1BlockHSCrucible.getBlockTextureFromSide(2);
        f4 = 0.125F;
        renderer.renderSouthFace(par1BlockHSCrucible, (double)((float)par2 - 1.0F + f4), (double)par3, (double)par4, icon);
        renderer.renderNorthFace(par1BlockHSCrucible, (double)((float)par2 + 1.0F - f4), (double)par3, (double)par4, icon);
        renderer.renderWestFace(par1BlockHSCrucible, (double)par2, (double)par3, (double)((float)par4 - 1.0F + f4), icon);
        renderer.renderEastFace(par1BlockHSCrucible, (double)par2, (double)par3, (double)((float)par4 + 1.0F - f4), icon);
        
        Icon icon1;
        if (par1BlockHSCrucible == mod_HarkenScythe.HSBloodCrucible){icon1 = BlockHSBloodCrucible.iconInner;}
        else{icon1 = BlockHSSoulCrucible.iconInner;}
        
        renderer.renderTopFace(par1BlockHSCrucible, (double)par2, (double)((float)par3 - 1.0F + 0.25F), (double)par4, icon1);
        renderer.renderBottomFace(par1BlockHSCrucible, (double)par2, (double)((float)par3 + 1.0F - 0.75F), (double)par4, icon1);
        int i1 = blockAccess.getBlockMetadata(par2, par3, par4);

        if (i1 > 0)
        {
            Icon icon2;
            if (par1BlockHSCrucible == mod_HarkenScythe.HSBloodCrucible){icon2 = BlockHSBloodCrucible.iconLiquid;}
            else{icon2 = BlockHSSoulCrucible.iconLiquid;}

            if (i1 > 10)
            {
                i1 = 10;
            }
            
            renderer.renderTopFace(par1BlockHSCrucible, (double)par2, (double)((float)par3 - 1.0F + (3.6875F + (float)i1 * 1.1F) / 16.0F), (double)par4, icon2);
        }

        return true;
}
}

 

In my Client Proxy

RenderingRegistry.registerBlockHandler(mod_HarkenScythe.HSCrucibleRenderID, new RenderHSCrucible());

 

And in my mod_Class

//Setup Render IDs

    public static int HSCrucibleRenderID = RenderingRegistry.getNextAvailableRenderId();

 

 

The block is there, just invisible...

Link to comment
Share on other sites

I can confirm this. The hook in RenderBlocks that allows for custom rendering of world blocks using new render types seems to have just disappeared in the new version... There's no way Forge would remove such an important feature as this, so I would suggest waiting until a new version comes out and resolves the problem.

Link to comment
Share on other sites

I'm a first-time modder (though not a new programmer) and I was trying to do this the other day and am having the same issue, but I understand that a lot apparently just changed within Minecraft graphics-wise so I figured I'd wait it out. I've been stalking this forum and minecraftforum.net looking for info since then, glad it's not just me.

 

I based the part of my mod (the custom model rendering) I'm having trouble with on this post over at the minecraft forums, which for the most part was really helpful, unless it's just that outdated :P

 

I have the block/item coded properly, but it renders invisibly (or not at all, whichever).

 

I've gone through all sorts of code for existing blocks/items but I am kind of at a loss as to what parts of the vanilla minecraft code are appropriate to use in a forge mod because I've never done this before.

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.

Announcements



×
×
  • Create New...

Important Information

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