Jump to content

Recommended Posts

Posted

I have looked around for a while for a way to custom render vanilla blocks, and I have not had any luck. The only way I have been able to accomplish this is by adding a hook to the RenderBlocks class to function like the event bus, which is not ideal for me.

 

Is there a system in place currently that would allow overriding the rendering on custom blocks?

 

If I wrote some event bus integration and made a pull request, how likely do you guys think it would be to get accepted?

Posted

If you're going that deep down, just replace the vanilla blocks.

Vanilla blocks are what they are, we will change some functionality a little to play more nicely with mods, but we're not gunna change dirt to cheese.

Its something you can do in your own and would be really really bad for us to do generically in forge.

I do Forge for free, however the servers to run it arn't free, so anything is appreciated.
Consider supporting the team on Patreon

Posted

If you're going that deep down, just replace the vanilla blocks.

Vanilla blocks are what they are, we will change some functionality a little to play more nicely with mods, but we're not gunna change dirt to cheese.

Its something you can do in your own and would be really really bad for us to do generically in forge.

 

No, I don't want to chang dirt to cheese, but replacing vanilla blocks is harder than duplicating the blocks, as they would all need to be replaced to behave nicely.

 

I have a mod called the paint gun mod, which allows people to paint blocks, and I currently do block replacements just as you say, but it is absolutely full of cheap hacks and workarounds to fix vanilla blocks not seeing my blocks as one of its own. It wouldn't really need to go that deep, here is an example:

In renderBlockByRenderType:

public boolean renderBlockByRenderType(Block par1Block, int par2, int par3, int par4) {
        RenderBlockEvent rbe = new RenderBlockEvent(this, par1Block, par2, par3, par4);
        if (MinecraftForge.EVENT_BUS.post(rbe)) {
            return rbe.returnValue;
        }

and the new event:

@Cancelable
public class RenderBlockEvent extends Event{
    public boolean returnValue = false;
    public final RenderBlocks context;
    public final Block block;
    public final int x;
    public final int y;
    public final int z;
    public RenderBlockEvent(RenderBlocks context, Block block, int x, int y, int z)
    {
        this.context = context;
        this.block = block;
        this.x = x;
        this.y = y;
        this.z = z;
    }
    public void cancelDefaultRender(){
        setCanceled(true);
    }
    public void setReturnValue(boolean v){
        this.returnValue = v;
    }
}

 

This would also allow me to do some other idea's I have, like improving the modeling on a couple of blocks in the game.

 

Edit: Oh if you are afraid it would open up a pandora's box of 'wtf' mods, I understand. Thanks for letting me know it wouldn't be considered before I wasted my time.

Posted

You may wanna look at the RenderWolrdLast handler.

Its been used by many mods to render overlays onto the world, and your paintball thing just sounds like a overlay on the block to me.

I do Forge for free, however the servers to run it arn't free, so anything is appreciated.
Consider supporting the team on Patreon

Posted

Actually I did think of this and scrapped the idea. Reason is, this would be very inefficient, as all painted blocks would need to be rendered a second time, which would be a huge performance hit for low end computers. In areas with a large number of painted blocks.

 

It's not a big a deal, I have a core mod ready when and if I decide to do it this way, This was mostly to see if it would qualify as an accepted pull. Since it is not it is no big deal, my mod would just be a core mod instead.

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.