Jump to content

Recommended Posts

Posted

I want to render a box that will be part of the entity's head bone using a RenderLayer. it should have some logic (to check the entities data, and render / not render accordingly), and use a different texture than the rest of the model. (note that the texture size is different as well.)

how should I implement that?

Posted

You seem to have described how to implement it?

Explain which part(s) you are having problems with. Showing the relevant parts of your code would be useful for this.

Boilerplate:

If you don't post your logs/debug.log we can't help you. For curseforge you need to enable the forge debug.log in its minecraft settings. You should also post your crash report if you have one.

If there is no error in the log file and you don't have a crash report then post the launcher_log.txt from the minecraft folder. Again for curseforge this will be in your curseforge/minecraft/Install

Large files should be posted to a file sharing site like https://gist.github.com  You should also read the support forum sticky post.

Posted
Quote

Specifically the render() method of the RenderLayer

That's not specific, that's the whole thing. 🙂

You would be better looking at some vanilla examples, e.g. the CustomHeadLayer which renders if the entity is wearing a skull

It sounds similar to what you are trying to do.

Boilerplate:

If you don't post your logs/debug.log we can't help you. For curseforge you need to enable the forge debug.log in its minecraft settings. You should also post your crash report if you have one.

If there is no error in the log file and you don't have a crash report then post the launcher_log.txt from the minecraft folder. Again for curseforge this will be in your curseforge/minecraft/Install

Large files should be posted to a file sharing site like https://gist.github.com  You should also read the support forum sticky post.

Posted

I did look at vanilla code, but I don't understand how it works.

For example, what does the PoseStack do? How should I use the buffers? And how does it "attach" to the model?

Posted

I don't know if this is the place to teach about minecraft's rendering system?

There's no docs, most people learn it by looking at the minecraft source.

Quick answers to your questions:

 

PoseStack is a stack of transformation matrices. The idea is you can push a new context on the stack, transform the pose (translate, scale, etc.), then pop to restore the previous state.

 

The buffers are what is sent to opengl. Typically you don't use them directly, instead you use helper methods and pass it a buffer, e.g. ItemRenderer.renderItem() takes a buffer as parameter.

If you do want to use them directly you can find some simple examples of what can be done in net.minecraft.client.gui.GuiComponent.

NOTE: Like the names suggest, these method are for drawing the gui, you will typically be passed a buffer to use in world rendering. You can still create your own.

 

For "attaching" look at EntityRenderEvent.AttachLayers. You can getRenderer() of the entity type you want to modify and addLayer()

Boilerplate:

If you don't post your logs/debug.log we can't help you. For curseforge you need to enable the forge debug.log in its minecraft settings. You should also post your crash report if you have one.

If there is no error in the log file and you don't have a crash report then post the launcher_log.txt from the minecraft folder. Again for curseforge this will be in your curseforge/minecraft/Install

Large files should be posted to a file sharing site like https://gist.github.com  You should also read the support forum sticky post.

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.