Jump to content

I've just created a way to render glitch-free multi-textured blocks!


Brian_Entei

Recommended Posts

So I was wanting a block that I can place and have it's top surface face me wherever I place it, but I was using the source code from logs, and that wasn't working out too well, so I decided to base my block code off of the piston's code. Well, that worked, but some of the sides of the block(especially the bottom) were flipped/textured incorrectly or just looked weird, so I decided to learn how to make my own renderer based on the vanilla source code for pistons, and I found out that the minecraft source code has a feature that you can use to flip textures called "renderer.flipTexture". So great, I thought, now I can manually edit the block's sides based off of the block's metadata, right? Nope, only some of the sides would even listen to the renderer.flipTexture boolean, and I wanted to find out why(There's even a block rendering tutorial that tells you that renderFaceYNeg/Pos ignores renderer.flipTexture!). So, I dug deep into the minecraft code and found those renderFace**** methods and then I looked through them and, after hours of tinkering, I was able to reproduce working copies of those methods! And better yet, I was also able to add another kind of texture flipping: VERTICAL flipping! So I re-named the original texture flip boolean to "flipTextureHorizontally" and named the new one "flipTextureVertically" so that others can use it. I then tested those booleans out and MAN, did they work! I think it's so awesome that it would be selfish of me NOT to share this with others and see what they think, so here you go, here is the rendering class where all the magic is, and the block class that I used to test the rendering class:

 

Rendering class:

http://redsandbox.no-ip.org/Files/Minecraft/My_Mods/MINERSCROLLS/Java_Files/RenderCustomBlock.java

 

Block class:

http://redsandbox.no-ip.org/Files/Minecraft/My_Mods/MINERSCROLLS/Java_Files/MultiTexturedBlock.java

 

I hope you guys find this useful! A lot of work and time went into this!

P.S. Here's a link to that tutorial I mentioned: http://greyminecraftcoder.blogspot.com.au/2013/07/rendering-non-standard-blocks.html

 

EDIT: I've just finished changing and updating these two classes and have managed to create this so far:

 

(Almost)Completely rotatable blocks: http://redsandbox.no-ip.org/FTP_Files/Pictures/2014-08-29_19.38.32.png

Can only rotate vertical facing blocks so far: http://redsandbox.no-ip.org/FTP_Files/Pictures/2014-08-29_19.38.32_1.png

Link to comment
Share on other sites

FYI, there's something called pastebin.

 

Would you like me to move your thread to modder support?

Read the EAQ before posting! OR ELSE!

 

This isn't building better software, its trying to grab a place in the commit list of a highly visible github project.

 

www.forgeessentials.com

 

Don't PM me, I don't check this account unless I have to.

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.