Jump to content
Search In
  • More options...
Find results that contain...
Find results in...

[1.9] Composite Models


Notunknown
 Share

Recommended Posts

Ok, so I am working on a mod which requires composite models (item models made from a set of sub-models joined together).

 

Now, I am on track for getting a basic composite model which would fit my minimum requirements, but as I do not know enough at the moment about how models (and mostly quads) work, I am asking about some information regarding the power of models.

 

Composite Models MUST have the following:

*MUST be able to be formed from two or more models, the number and type of which are determiend by an input ItemStack. (This I believe I can do.)

 

Composite Models SHOULD have the following:

*SHOULD be able to define arbitrary rotations relative to "base" rotation, which is determined by the model determined by the input ItemStack.

*SHOULD be able to define arbitrary translations relative to "base" translation, which is determined by the model determined by the input ItemStack. (This I believe I can do.)

 

Composite Models MAY have the following:

*MAY be able to define arbitrary scales relative to "base" scale, which is determined by the model determined by the input ItemStack.  (This I believe I can do.)

*MAY be able to define arbitrary rotations, translations and offsets relative to model relative rotation, translation and offset, which is determined by code determined by the input ItemStack.

*MAY be able to specify a simple hierarchy within models, which is used to allow models to share with their parents relative rotation, translation and scale.

 

For example, I might want to have a magical stone. The stone is made of three models, a core, a glyph and a ring. The core is the base model (determines the rotation, translation and scale relative to the hand), the glyph shares its rotation and translation with the core but has twice the scale (causing it to stick out) and the ring has the same translation and scale as the core but is rotated 90° to the core.

 

The stone also gently floats above the players hand following a sine wave (giving it a floating effect), the core and glyph additionally slowly rotate clockwise at the same rate, and the ring rotates counter-clockwise at a faster rate (giving it a spinning effect). When right clicked the entire model would increase in scale, then decrease again, following a simple curve.

 

So, before I waste time trying something which is impossible, which of those requirements are possible and which aren't?

Link to comment
Share on other sites

Okay, so I believe that I have gotten the basic system set up. Just a few questions:

 

1: How can I have a texture stitched into the texture atlas without an associated item or block to go with it (or does it automatically do this with everything in textures/items?)

 

2: How can I load a model without an associated item or block (for components to be used in composite models) (again, does it automatically do this with everything in the models folder?)

 

3: How can I load non-standard data from a model file (for use in composite models, things like relative translation and scales)?

 

Edit: For (2), I basically want to turn a ModelResourceLocation into an IBakedModel. My attempts are failing... :'(

Link to comment
Share on other sites

I was googling to day for some information today regarding ICustomModelLoader and ran across this mod source. The author does some of the things you are asking about. https://github.com/mrtska/slopeandcorner/tree/1.9

A blog page about the tech used: https://mrtska.net/2016/03/use-icustommodelloader-in-minecraft1-9/

 

It does not answer all your questions I'm sure, but I found it interesting.

Link to comment
Share on other sites

Okay, this is really annoying me. Currently I have managed to do it, but it seems really inefficient.

 

ModelLoaderRegistry.getModel(new ResourceLocation(model_location)).bake(new SimpleModelState(ImmutableMap.<IModelPart, TRSRTransformation>of()), DefaultVertexFormats.ITEM, ModelLoader.defaultTextureGetter());

 

I have gotten it to work for models which belong to pre-existing items with this, but when I try to load a model which does not belong to an actual item it returns the default model (the pink/black cube thing)

 

Minecraft.getMinecraft().getRenderItem().getItemModelMesher().getModelManager().getModel(model_location);

 

What am I missing? There must be a method that I have simply overlooked...

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
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.

 Share



×
×
  • Create New...

Important Information

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