Jump to content

[SOLVED][1.14.4] shouldSideBeRendered() is now static - alternative to override?


logalu

Recommended Posts

First of all, I'm relative new to modding so please bear with me if I make some dead wrong statement or mistake.

 

I have a custom block, similar to a stained glass pane (i.e. not full block, translucent), and I want it to cull sides when two blocks of the kind are adjacent (to prevent rendering inside faces, basically what happens with glass blocks).

 

In 1.12.2, I could override Block#shouldSideBeRendered and put my logic there. However, in 1.14.4 the method seems to be static now, so I can't obviously override it. What is the correct approach in this version? I'm having a hard time finding anything useful/working regarding this.

 

Also, semi-related question: what's the difference between shouldSideBeRendered() and isSideInvisible()? 

 

Thank you in advance for your time

 

----

EDIT - SOLVED

 

The function to use in 1.14.4 is indeed isSideInvisible(). The method wasn't getting called because I accidentally removed the cullface option in the corresponding .json file (don't ask me why, stupid unnoticed mistake that drove me crazy and made me questioned myself and my understanding of stuff...)

Edited by logalu
Link to comment
Share on other sites

20 minutes ago, logalu said:

Also, semi-related question: what's the difference between shouldSideBeRendered() and isSideInvisible()? 

Let me just pull up the vanilla source and...

gosh, would you look at that.

One of them is static and does a bunch of stuff involving voxel shapes, the other isn't static, takes in an adjacent side, and returns a boolean.

And oh yeah, the former method calls the latter (if isSideInvisible returns true...shouldSideBeRendered returns false). That seems relevant.

Edited by Draco18s

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

I'd already seen that, my question was more in the sense of differences towards the better approach. I probably used the wrong words, so nevermind and let's just focus on the real issue.

 

However, my question was motivated because the first alternative I tried was exactly to override the isSideInvisible() method, yet it doesn't seem to get called. This should prevent rendering of all adjacent sides, right? 

 

    @Override
    @OnlyIn(Dist.CLIENT)
    public boolean isSideInvisible(BlockState state, BlockState adjacentBlockState, Direction side) {
        System.out.println("Test");
       return true;
    }

I might be doing something wrong, but I'm just overriding the method. So I was just trying to get a general answer about the issue, because maybe I was approaching it in the wrong way, and as I said I'm relative new to Forge modding. Are there maybe other related variables/methods I need to override too?

 

Apart from that, there's no need to be hostile imho. Yet I once again apologize if my lack of knowledge is a problem...

Edited by logalu
Link to comment
Share on other sites

2 hours ago, logalu said:

This should prevent rendering of all adjacent sides, right? 

I would have thought so. I can't find any reason why it wouldn't be.

 

2 hours ago, logalu said:

maybe I was approaching it in the wrong way, and as I said I'm relative new to Forge modding

The way to approach things is to ask "how does vanilla do this?" There's a few things that vanilla does poorly, but often answers can be found by asking yourself, "what vanilla blocks do the thing I want to do?"

 

Its fine that you asked a question when you had a problem with what you tried, but the problem with your post is that you asked:

  • a question that was dumb ("what's the difference?" answered by looking at the source and seeing that they do two very different things)
  • a question you already knew the answer to ("I'd already seen that")
  • and a question to which the answer supplies no helpful information to the problem you were facing ("I tried that and it still doesn't work")

What you should have asked was "I overrode isSideInvisible, but it isn't being called. Why?" and then posted all of the relevant code.

 

So.

 

Post all of your relevant code, preferably as a link to a clonable git repo. We need to see more than just your block class.

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

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.