Jump to content

[1.12.2] Use #inventory variant for a .obj model


Darth

Recommended Posts

Hi!. I'm use .obj model for block and this works pretty good, but i have so problems with #inventory variant for items. 

 

Spoiler

image.thumb.png.b34972ea392ce912a6dc9dddc4cfce7f.png

How i can fix that? That completly ignore all .json files. So please help set that model like standard minecraft block.

 

My .json files:

BlockStates:

Spoiler

{
    "forge_marker": 1,
    "defaults": {
        "model": "tg:teleportator.obj",
        "transform": "forge:default-block"
     },
    "variants": {
        "normal": 
        [
            {
            }
        ],
        "inventory": 
        [
            {
            "transform": 
                {       
                    "gui": { "translation": [0, 2, 0], "scale": 0.125 , "rotation": [{ "x": 300 },{ "z": 45 }] },
                    "firstperson_righthand": { "translation": [0, 2, 0], "scale": 0.125 , "rotation": [{ "x": 300 },{ "z": 45 }] }
                }
            }
        ]
    }
}

 

and models/item:

Spoiler

{
    "parent": "tg:block/teleportator.obj",
     "display":       
     {
         "gui": { "translation": [0, 2, 0], "scale": 0.125 , "rotation": [{ "x": 300 },{ "z": 45 }] },
         "firstperson_righthand": { "translation": [0, 2, 0], "scale": 0.125 , "rotation": [{ "x": 300 },{ "z": 45 }] }
     }
}

 

 

Edited by Darth
Link to comment
Share on other sites

Since the model is an obj model you can't scale it down using json(although you might be able to do something with the forge blockstates format since it allows you to specify transforms but I am no expert on that and whether you can specify your own custom transforms).

However the issue here is different. You are trying to use a big model for a 1x1x1 cube. That will not work for a multitude of reasons. One of which you've discovered already - you can't use the same scaled model for an item model.

The other issues would be the collision box, the selection box(none of which work with boxes bigger than 1x1.5x1), the block placement(blocks could be placed into your blockspace occupied by the model) and the frustrum culling(look up from your block and the model will dissappear from sight as soon as the block dissappears from sight(will only work in certain positions of the chunk if I understand MC's chunk rendering correctly as it uses and culls 16x16x16 regions, not individual blocks))

The solution to all those issues would be to scale your model down to a 1x1x1 cube and use a TESR to render it with the scale you need it instead. This solves all but 1(block placement, could be solved with transparent placeholder blocks) issues.

Link to comment
Share on other sites

3 hours ago, V0idWa1k3r said:

the selection box

The selection box can be as big as you want.

 

JSON models (I don’t know about other models) have a 3x3x3 size limit (at least according to BlockBench - I haven’t tried manually making larger models), so if your block/structure is smaller than 3x3x3 you don’t need a TESR, and can just put a scaling factor into your model’s GUI Transform.

Edited by Cadiboo

About Me

Spoiler

My Discord - Cadiboo#8887

My WebsiteCadiboo.github.io

My ModsCadiboo.github.io/projects

My TutorialsCadiboo.github.io/tutorials

Versions below 1.14.4 are no longer supported on this forum. Use the latest version to receive support.

When asking support remember to include all relevant log files (logs are found in .minecraft/logs/), code if applicable and screenshots if possible.

Only download mods from trusted sites like CurseForge (minecraft.curseforge.com). A list of bad sites can be found here, with more information available at stopmodreposts.org

Edit your own signature at www.minecraftforge.net/forum/settings/signature/ (Make sure to check its compatibility with the Dark Theme)

Link to comment
Share on other sites

4 minutes ago, Cadiboo said:

The selection box can be as big as you want

While it can be as big as you want the selection detection only works when you look at the 1x1.5x1 cube and not anywhere else. If you make your selection box a 10x10x10 you will only be able to see it when mousing over the 1x1x1 cube that produces this box. You will see the whole 10x10x10 box though. But this is not the behaviour you want since you want to see the box when you look at it, not the cube producing it.

Link to comment
Share on other sites

2 minutes ago, V0idWa1k3r said:

While it can be as big as you want the selection detection only works when you look at the 1x1.5x1 cube and not anywhere else. If you make your selection box a 10x10x10 you will only be able to see it when mousing over the 1x1x1 cube that produces this box. You will see the whole 10x10x10 box though. But this is not the behaviour you want since you want to see the box when you look at it, not the cube producing it.

Sorry yeah, I should have been more specific the size of the selected box that is rendered can be as large as you want, the bounding box that is used determine when that box is rendered is limited to 1x1.5x1 (I assume that box is the collisionBoundingBox or the normal boundingBox).

The solution is to use blocks around it that return the same renderBoundingBox as your block (this may require a TileEntity but only if you use the same type of surrounding blocks for multiple different types of structures)

About Me

Spoiler

My Discord - Cadiboo#8887

My WebsiteCadiboo.github.io

My ModsCadiboo.github.io/projects

My TutorialsCadiboo.github.io/tutorials

Versions below 1.14.4 are no longer supported on this forum. Use the latest version to receive support.

When asking support remember to include all relevant log files (logs are found in .minecraft/logs/), code if applicable and screenshots if possible.

Only download mods from trusted sites like CurseForge (minecraft.curseforge.com). A list of bad sites can be found here, with more information available at stopmodreposts.org

Edit your own signature at www.minecraftforge.net/forum/settings/signature/ (Make sure to check its compatibility with the Dark Theme)

Link to comment
Share on other sites

Also note that AI Pathfinding is similarly not affected by oversized blocks (as I see you already have invisible placeholders, that solves that problem, but it's a thing to be aware of).

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

This is a blockstate file I was using for a testblock. Note the scale and transform can all be set using a the blockstate file as well as different models for different states if that's what you want. That should be enough for most things. This probably isn't the best example, but it should be enough to get you pointed in the right direction. 

https://github.com/MachineMuse/MachineMusePowersuits/blob/1.12.2-experimental/src/main/resources/assets/powersuits/blockstates/tile.testBlock.json

Edited by lehjr
Link to comment
Share on other sites

On 9/26/2018 at 11:07 PM, lehjr said:

This is a blockstate file I was using for a testblock. Note the scale and transform can all be set using a the blockstate file as well as different models for different states if that's what you want. That should be enough for most things. This probably isn't the best example, but it should be enough to get you pointed in the right direction. 

https://github.com/MachineMuse/MachineMusePowersuits/blob/1.12.2-experimental/src/main/resources/assets/powersuits/blockstates/tile.testBlock.json

Hmm, strange, but thats doesn't work. 

Spoiler

{
    "forge_marker": 1,
    "defaults": 
    {
        "transform": "forge:default-block"
    },
    "variants": {
        "normal": 
        [
            {
                "model": "tg:teleportator.obj",
                "transform": 
                {       
                    "gui": { "translation": [0, 2, 0], "scale": 0.125 , "rotation": [{ "x": 300 },{ "z": 45 }] },
                    "firstperson_righthand": { "translation": [0, 2, 0], "scale": 0.125 , "rotation": [{ "x": 300 },{ "z": 45 }] }
                }
            }
        ],
        "inventory": 
        [
            {
            "model": "tg:teleportator.obj",
            "transform": 
                {       
                    "gui": { "translation": [0, 2, 0], "scale": 0.125 , "rotation": [{ "x": 300 },{ "z": 45 }] },
                    "firstperson_righthand": { "translation": [0, 2, 0], "scale": 0.125 , "rotation": [{ "x": 300 },{ "z": 45 }] }
                }
            }
        ]
    }
}

 

 

Any ideas?

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.