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



  • Recently Browsing

    • No registered users viewing this page.
  • Posts

    • I tried do download the essential mod to my mod pack but i didnt work. I paly on 1.21 and it should work. I use neoforge for my modding. The weird things is my friend somehow added the mod to his modpack and many others that I somehow can´t. Is there anything i can do? 
    • Thanks, I've now installed a slightly newer version and the server is at least starting up now.
    • i have the same issue. Found 1 Create mod class dependency(ies) in createdeco-1.3.3-1.19.2.jar, which are missing from the current create-1.19.2-0.5.1.i.jar Found 11 Create mod class dependency(ies) in createaddition-fabric+1.19.2-20230723a.jar, which are missing from the current create-1.19.2-0.5.1.i.jar Detailed walkthrough of mods which rely on missing Create mod classes: Mod: createaddition-fabric+1.19.2-20230723a.jar Missing classes of create: com/simibubi/create/compat/jei/category/sequencedAssembly/JeiSequencedAssemblySubCategory com/simibubi/create/compat/recipeViewerCommon/SequencedAssemblySubCategoryType com/simibubi/create/compat/rei/CreateREI com/simibubi/create/compat/rei/EmptyBackground com/simibubi/create/compat/rei/ItemIcon com/simibubi/create/compat/rei/category/CreateRecipeCategory com/simibubi/create/compat/rei/category/WidgetUtil com/simibubi/create/compat/rei/category/animations/AnimatedBlazeBurner com/simibubi/create/compat/rei/category/animations/AnimatedKinetics com/simibubi/create/compat/rei/category/sequencedAssembly/ReiSequencedAssemblySubCategory com/simibubi/create/compat/rei/display/CreateDisplay Mod: createdeco-1.3.3-1.19.2.jar Missing classes of create: com/simibubi/create/content/kinetics/fan/SplashingRecipe
    • The crash points to moonlight lib - try other builds or make a test without this mod and the mods requiring it
    • Do you have shaders enabled? There is an issue with the mod simpleclouds - remove this mod or disable shaders, if enabled  
  • Topics

×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use.