Jump to content

Recommended Posts

Posted

Hey guys. I'm relatively new to this whole modding scene, but I've got a pretty solid Java background.

 

Here's the skinny: I'm trying to create a block with a custom shape and appearance. I've created a model and texture and it seems to be correct. What I'm now trying to figure out is how to tell Minecraft to use my model when rendering my block. My searches have turned up little information on this subject and what information I've found is either outdated or doesn't seem to agree with anything else I've read. I think it would be helpful if I understood the flow of information in terms of how Minecraft renders blocks, but I can't even begin to attempt to trace through Minecraft's rendering code.

 

The bottom line is this: how do I use a custom model for a block? Thanks for any help.

Posted

you can check out these source files (it's a simple decorative block):

https://github.com/mnn/jaffas/blob/master/src/minecraft/monnef/jaffas/food/block/BlockColumn.java

https://github.com/mnn/jaffas/blob/master/src/minecraft/monnef/jaffas/food/client/TileEntityColumnRenderer.java

https://github.com/mnn/jaffas/blob/master/src/minecraft/monnef/jaffas/food/client/ClientProxy.java#L39

https://github.com/mnn/jaffas/blob/master/src/minecraft/monnef/jaffas/food/client/ModelColumn.java

the model class comes from Techne with just few modifications (if I remember correctly setRotationAngles and render methods).

^source code is working, but some things may be redundant or not done the best way (like manual creation of TE by block).

 

mnn.getNativeLang() != English

If I helped you please click on the "thank you" button.

  • 2 weeks later...
Posted

Ive been messing around with custom model block and just had a question.  Basically the model is like a fence block where it will render differently if certain conditions are met.  Im wondering the best place to put these conditions.  I've gotten it to work but Im just paranoid that I put it in the wrong place, because it seems like I may have put the conditions in a place where each block checks the conditions every second, but I want it only to check when the blocks surrounding it change.

 

I placed the conditions in the renderModelAt function within my TileEntityRenderer and it passes those conditions to the model and renders.  Obviously though the conditions will only change the model when an adjacent block is changed so I wouldn't need to do these checks when that happens, but I am having a hunch that the check is happening continuously though I could be wrong.  Hope I explained that properly.  If anyone could give some advice that would be great.

Posted

renderModelAt is called not every second, but every frame (for each your custom block). I'd move the checks into block's onNeighborBlockChange (and fire block changed when renderer type changes).

mnn.getNativeLang() != English

If I helped you please click on the "thank you" button.

Posted

I'd do this: add a field to fence TE, this field will store which model to render (I mean type like crossing or single rod). this field will be used in renderer instead of the heavy conditions. to the fence block on neighbour change you'd move those conditions and result would be saved in the TE's field. You might need to alert neighbour blocks if your render type changes (it depens on how exactly you have implemented conditions).

mnn.getNativeLang() != English

If I helped you please click on the "thank you" button.

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.