Jump to content

ModelRenderer Help


defiant810

Recommended Posts

I have a couple of questions about using Model Renderers to make custom blocks, and would appreciate help:

[*]How do I bind different textures to different boxes in the model renderer?

[*]How to I animate the parts (like change rotation over time)?

 

I'm sure that the texture binding/offsetting is simple. But how would one animate the blocks like Buildcraft? I know it has something to do with ticks, but how to update the renderer on each tick is what I don't understand.

 

Here is the source code to my mod: https://github.com/SeanMoss/QuantumCraft.

 

Here is a screenshot of the block: http://imgur.com/ZGKbK.

Creator and co-author of the mod Essencraft: https://github.com/defiant810/Essencraft

 

Please, dear God, learn Java before trying to mod. It saves ALL of us time.

Link to comment
Share on other sites

Well,

 

1) You can't. Minecraft doesn't support it. The best bet you have is to bind textures between rendering calls on the model renderers. Like, render Modelrenderer1, bind texture, render Modelrenderer2. However you can't do it inside modelrenderers that are a child node to other modelrenderers. I have a project, called ARC (Advanced Rendering Core) that is still under development. It is Open Source. It allows you to define a texture not only per block, but also per face. It also enables you to do a lot more things that Minecrafts rendering system doesn't support.

 

2) You need to save the reference to the specific modelrenderer and rotate it as you wish every time you render. This won't work inside custom block renderers, because they're barely even called. To achieve the kind of animation you want, you need a TileEntitySpecialRenderer. However, using a TESR is very expensive, and you should avoid it unless strictly necessary.

Did I help? Hitting 'Thank You' would be appreciated.

 

Soon, the lost city will rise from the bottom of the ocean, and spread it's technology across Minecraft.

Link to comment
Share on other sites

Thanks for the reply.

 

If you look at the code in my mod, you will see that I am using a TileEntitySpecialRenderer already. I am wondering where to increment the rotation amount each time; somewhere like the render() method, because that is called at set intervals each second, or does it have to go somewhere else?

 

Also, I was asking how to do multitexturing, like Buildcraft does with it's engines. I know about the binding new textures between rendering calls method, but is there some way to tell different modelrenderers to offset the texture?

Creator and co-author of the mod Essencraft: https://github.com/defiant810/Essencraft

 

Please, dear God, learn Java before trying to mod. It saves ALL of us time.

Link to comment
Share on other sites

I tried storing a time-based variable that updates ever render cycle in the TileEntity for the block (not the TESR), and I got a smooth, per-block animation going. It works, but I don't know if it is the most efficient. Can anyone confirm this?

 

Also, after looking at the Buildcraft Engine rendering code, I saw that they have a system that binds multiple textures per render call. So that answers my question as to that problem.

Creator and co-author of the mod Essencraft: https://github.com/defiant810/Essencraft

 

Please, dear God, learn Java before trying to mod. It saves ALL of us time.

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.