Jump to content

[1.10.2] FastTESR/IBakedModel Setup


oa10712

Recommended Posts

Hello again, back with some more questions about rendering. I have a TileEntity that can contain multiple materials at once, but does not need to update every tick, an example of which is here: 408a6eb9cac142fea3b42f47a8fcf1f7.png

I am currently using a standard TESR to render this, with that code being here: https://github.com/16ColorGames/SuperTechTweaks/blob/master/src/main/java/com/sixteencolorgames/supertechtweaks/render/TESRBlockOre.java

I have heard that FastTESRs can speed up performance, as well as IBakedModels, but there do not seem to be any tutorials for either online.

Can someone help explain to me how to set up either of those?

Link to comment
Share on other sites

Why do you need a TESR (fast or otherwise) to render a block?

Use the JSON model system.

Apparently I'm a complete and utter jerk and come to this forum just like to make fun of people, be confrontational, and make your personal life miserable.  If you think this is the case, JUST REPORT ME.  Otherwise you're just going to get reported when you reply to my posts and point it out, because odds are, I was trying to be nice.

 

Exception: If you do not understand Java, I WILL NOT HELP YOU and your thread will get locked.

 

DO NOT PM ME WITH PROBLEMS. No help will be given.

Link to comment
Share on other sites

I'd recommend using IBakedModels only, as you are using this for (seemingly common) worldgen.
(The official GregTech 4 port back in 1.7.10 I believe used TESR's for rendering ores, to bypass xray, and dear god, the FPS drops)

 

  1. You will need to create a custom model-cache
  2. You will need to register your own ICustomModelLoader
  3. You have to save your TE data to an IExtendedBlockState to provide the data for the models
    1. getExtendedState
    2. createBlockState
  4. You will have to create an IModel, that points to an IBakedModel
    1. Either get cached List<BakedQuad> from your cache, or create them on the fly, and cache them in your IBakedModel

 

 

Block implementing TE->IExtendedBlockState example: Compressed Block

Model Cache example: EchoModelCache

ICustomModelLoader example: EchoModelLoader

IBakedModel example: MengerBakedModel

 

You can of course not simply copy-and-paste these; they were tailored for one of my projects, but they should give you a hint on how to do things.

Edited by Matryoshika

Also previously known as eAndPi.

"Pi, is there a station coming up where we can board your train of thought?" -Kronnn

Published Mods: Underworld

Handy links: Vic_'s Forge events Own WIP Tutorials.

Link to comment
Share on other sites

My example doesn't use own textures, instead it creates a tessellation of vanilla and/or modded blocks, using their textures.

 

I have not handled colouring IBakedModels, so I cannot provide any information on that subject, however, for having several layers:
In the IBakedModels getQuads method, you get the state; From this state, get the IExtendedBlockState, and from that, it's properties, one which should be a collection of ores that this block "contains". Be it Enums, or mere strings, as long as you know "this block contains x & y".
Now, some pseudo-code

        List<IBakedQuad> quads = new ArrayList<IBakedQuad>();
        List<String> ores = extState.getProperty(SuperTechOre.LIST);
        
        //add stone/background texture to the quads list
        
        if(ores.contains("gold")){
        	//add gold texture to the quads list
        }
        if(ores.contains("silver")){
        	//add silver texture to the quads list
        }

The easiest approach to simply "adding" the texture, would probably be having JSON models with "faulty" ores, eg one model for each type of ore, without background, and just the actual metal/chunk parts, and get the IBakedModel from that, to add it's quads this model.
This shows how to get an IBakedModel from a resourcelocation.
 

Edited by Matryoshika

Also previously known as eAndPi.

"Pi, is there a station coming up where we can board your train of thought?" -Kronnn

Published Mods: Underworld

Handy links: Vic_'s Forge events Own WIP Tutorials.

Link to comment
Share on other sites

You only need tint(color), right? Then it is feasible only with Json model and Block#getColor(Or something similar). Look at the model code of vanilla spawn egg to figure out the tint, and wool code for specifying the color. (As far as I know you can reference world and position there)

I. Stellarium for Minecraft: Configurable Universe for Minecraft! (WIP)

II. Stellar Sky, Better Star Rendering&Sky Utility mod, had separated from Stellarium.

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.