Jump to content

[1.7.10] [SOLVED] Changing the Texture of Redstone


Magthidon

Recommended Posts

Hey there.  I have a block which extends BlockRedstoneWire and I'm trying to change the texture of it.  The normal methods of changing a texture don't seem to be having an effect; no matter what I name the new textures, it still always shows the normal Redstone textures.

 

EDIT:

The solution is to create a custom renderer.

Link to comment
Share on other sites

Derp me... I was misunderstanding your entire question.

You need to override registerIcons in your Block

 

That's what I've done, but it still shows up red for some reason.  Here's what the code looks like:

    @SideOnly(Side.CLIENT)
    public IIcon cross;
    @SideOnly(Side.CLIENT)
    public IIcon line;
    @SideOnly(Side.CLIENT)
    public IIcon cross_overlay;
    @SideOnly(Side.CLIENT)
    public IIcon line_overlay;

    @SideOnly(Side.CLIENT)
    public void registerBlockIcons(IIconRegister registerer)
    {
        this.cross = registerer.registerIcon(ModReferences.MODID + ":redstone_dust" + "_" + "cross");
        this.line = registerer.registerIcon(ModReferences.MODID + ":redstone_dust" + "_" + "line");
        this.cross_overlay = registerer.registerIcon(ModReferences.MODID + ":redstone_dust" + "_" + "cross_overlay");
        this.line_overlay = registerer.registerIcon(ModReferences.MODID + ":redstone_dust" + "_" + "line_overlay");
this.blockIcon = this.cross;
    }

Link to comment
Share on other sites

I've looked through the code to see where getRedstoneWireIcon is called, but the BlockRedstoneWire.class didn't seem to call it anywhere.

 

    @SideOnly(Side.CLIENT)
    public static IIcon cross;
    @SideOnly(Side.CLIENT)
    public static IIcon line;
    @SideOnly(Side.CLIENT)
    public static IIcon cross_overlay;
    @SideOnly(Side.CLIENT)
    public static IIcon line_overlay;

    @SideOnly(Side.CLIENT)
public IIcon getIcon(IBlockAccess world, int x, int y, int z, int meta)
{
		return this.blockIcon;
	}
    
    @SideOnly(Side.CLIENT)
    public IIcon getIcon(int par1, int par2)
    {
		return this.blockIcon;
    }

    @SideOnly(Side.CLIENT)
    public IIcon func_149735_b(int par1, int par2)
    {
		return this.blockIcon;
    }

    @SideOnly(Side.CLIENT)
    public void registerBlockIcons(IIconRegister registerer)
    {
        this.cross = registerer.registerIcon(ModReferences.MODID + ":redstone_dust" + "_" + "cross");
        this.line = registerer.registerIcon(ModReferences.MODID + ":redstone_dust" + "_" + "line");
        this.cross_overlay = registerer.registerIcon(ModReferences.MODID + ":redstone_dust" + "_" + "cross_overlay");
        this.line_overlay = registerer.registerIcon(ModReferences.MODID + ":redstone_dust" + "_" + "line_overlay");
this.blockIcon = this.cross;
    }

    @SideOnly(Side.CLIENT)
    public static IIcon getRedstoneWireIcon(String icon)
    {
        return icon.equals("cross") ? cross : (icon.equals("line") ? line : (icon.equals("cross_overlay") ? cross_overlay :
                           (icon.equals("line_overlay") ? line_overlay : null)));
    }

 

Edit: This code didn't work either, by the way.

Link to comment
Share on other sites

This class, if I am remembering correctly, is a modified version of the redstone renderer.

 

https://github.com/Draco18s/Artifacts/blob/master/main/java/com/draco18s/artifacts/client/RenderLaserBeam.java

 

It's got some alterations to handle "corners" as pluses and to render "into" glass and other transparent blocks that don't actually interrupt the beam (but in which it can't occupy due to the cellular automata nature of Minecraft).  But it might help you get started.

Apparently I'm a complete and utter jerk and come to this forum just like to make fun of people, be confrontational, and make your personal life miserable.  If you think this is the case, JUST REPORT ME.  Otherwise you're just going to get reported when you reply to my posts and point it out, because odds are, I was trying to be nice.

 

Exception: If you do not understand Java, I WILL NOT HELP YOU and your thread will get locked.

 

DO NOT PM ME WITH PROBLEMS. No help will be given.

Link to comment
Share on other sites

This class, if I am remembering correctly, is a modified version of the redstone renderer.

 

https://github.com/Draco18s/Artifacts/blob/master/main/java/com/draco18s/artifacts/client/RenderLaserBeam.java

 

It's got some alterations to handle "corners" as pluses and to render "into" glass and other transparent blocks that don't actually interrupt the beam (but in which it can't occupy due to the cellular automata nature of Minecraft).  But it might help you get started.

 

Oh, thanks very much Draco!  Very helpful!

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.



×
×
  • Create New...

Important Information

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