Jump to content

[Solved][1.8.9] Fast/Fancy graphics for leaves


Recommended Posts

Posted

Hello,

 

I'm currently porting a mod from 1.7.10 to 1.8.8 and I'm having trouble with a tree.

I would like the leaves to be transparent if and only if the "Fancy Graphics" game setting is set, just like vanilla leaves. In 1.7.10 this was possible by checking this setting in Block.getIcon() and return the according icon. Obviously this isn't possible in 1.8.

 

Unfortuntately Minecraft hardcoded the setting to only affect its own leaves: In loadRenderers() we have:

Blocks.leaves.setGraphicsLevel(this.mc.gameSettings.fancyGraphics);
Blocks.leaves2.setGraphicsLevel(this.mc.gameSettings.fancyGraphics);

 

Is there any way to get Minecraft to call setGraphicsLevel() on my leaves as well, or some other method to get fast and fancy graphics working for leaves?

Posted

You could call

BlockLeaves#setGraphicsLevel

with the return value of

Minecraft.isFancyGraphicsEnabled

every time the fields set by it are queried. I don't think there's any other way to do this apart from inserting a callback/event using ASM.

Please don't PM me to ask for help. Asking your question in a public thread preserves it for people who are having the same problem in the future.

Posted

Thanks, that worked! I hoped I could utilize setGraphicsLevel() but seems like I have to live with that.

 

It seems like Minecraft is using the same textures for opaque and transparent leaves, but I am having slightly different ones. I guess now I can use getActualState() to select between the textures. Or is there a better way?

Posted

It seems like Minecraft is using the same textures for opaque and transparent leaves, but I am having slightly different ones. I guess now I can use getActualState() to select between the textures. Or is there a better way?

 

You could do that, but do you need to? If your block renders in

EnumWorldBlockLayer.SOLID

(i.e. it returns that from

Block#getBlockLayer

), transparent pixels will be rendered as black. This is how vanilla handles it.

Please don't PM me to ask for help. Asking your question in a public thread preserves it for people who are having the same problem in the future.

Posted
transparent pixels will be rendered as black. This is how vanilla handles it.

Actually seems like that's not what happens. If the alpha value of a pixel is 0 that doesn't mean the pixel can't have a color. So the transparent pixels of my texture are still rendered in color.

But well, I guess when I do want to use different textures for both getActualState() is a way.

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.