Jump to content

[1.8] Forge Model Format


ShetiPhian

Recommended Posts

Here is the link to the format to get everyone on the same page; https://github.com/MinecraftForge/MinecraftForge/pull/1885

 

I decided to play with this by converting my old files I made just after the release of Forge for 1.8

With the base Minecraft system this is what it took to simply change textures: blockstate file was 4373 lines, with 550 models (24KB)

 

With this new system its only taking ~300 lines and 2 models (might need 4), and its far cleaner.

 

Sadly its not working 100% correctly yet, I don't know if I'm doing something wrong, I'm hitting a bug, or if the new system just can't do what I want.

 

The old way works perfectly so I know its not in the code, its solely the blockstate.

 

 

I'll sum up the issue right now and go deeper into what I've done bellow;

It looks like the new system is unable to change the main model, and submodels get the wrong texture data

 

 

 

If I do not define a model in "defaults" but define it in one of the variants Minecraft crashes telling me there is no model or submodel

 

{
    "forge_marker": 1,
    "defaults": {
        "textures": {
            "particle": "multibeds:blocks/bed_earth1",
            "top_sides": "multibeds:blocks/bed_earth1",
            "bottom_ends": "multibeds:blocks/bed_earth0",
            "base": "multibeds:blocks/blank",
            "art": "multibeds:blocks/blank"
        }
    },
    "variants": {
        "occupied": {
            "true": {},
            "false": {}
        },
        "part": {
            "head": { "model": "multibeds:base_head" },
            "foot": { "model": "multibeds:base_foot" }
        },
        "facing": {
            "south": { "y": 0 },
            "west": { "y": 90 },
            "north": { "y": 180 },
            "east": { "y": 270 }
        },
        "spread": {
            "0": {"textures": { "base": "multibeds:blocks/blank", "art": "multibeds:blocks/blank" } },
            "1": {"textures": { "base": "multibeds:blocks/spread_base0", "art": "multibeds:blocks/blank" } },

 

 

 

If I define a model in defaults, it is used for both blocks (thus ignoring that is gets changed in variants) but the overlay texture is correct.

 

{
    "forge_marker": 1,
    "defaults": {
        "textures": {
            "particle": "multibeds:blocks/bed_earth1",
            "top_sides": "multibeds:blocks/bed_earth1",
            "bottom_ends": "multibeds:blocks/bed_earth0",
            "base": "multibeds:blocks/blank",
            "art": "multibeds:blocks/blank"
        },
        "model": "multibeds:base_head"
    },
    "variants": {
        "occupied": {
            "true": {},
            "false": {}
        },
        "part": {
            "head": { "model": "multibeds:base_head" },
            "foot": { "model": "multibeds:base_foot" }
        },
        "facing": {
            "south": { "y": 0 },
            "west": { "y": 90 },
            "north": { "y": 180 },
            "east": { "y": 270 }
        },
        "spread": {
            "0": {"textures": { "base": "multibeds:blocks/blank", "art": "multibeds:blocks/blank" } },
            "1": {"textures": { "base": "multibeds:blocks/spread_base0", "art": "multibeds:blocks/blank" } },

 

 

If I do not define a model in "defaults" but define a submodel in one of the variants, the models are correct but the overlays are wrong.

regardless of what the spread number is the models seem to ignore it, every north+head will use the same texture, and every south+foot will use another, its like this for all eight blocks.

 

{
    "forge_marker": 1,
    "defaults": {
        "textures": {
            "particle": "multibeds:blocks/bed_earth1",
            "top_sides": "multibeds:blocks/bed_earth1",
            "bottom_ends": "multibeds:blocks/bed_earth0",
            "base": "multibeds:blocks/blank",
            "art": "multibeds:blocks/blank"
        }
    },
    "variants": {
        "occupied": {
            "true": {},
            "false": {}
        },
        "part": {
            "head": { "submodel": "multibeds:base_head" },
            "foot": { "submodel": "multibeds:base_foot" }
        },
        "facing": {
            "south": { "y": 0 },
            "west": { "y": 90 },
            "north": { "y": 180 },
            "east": { "y": 270 }
        },
        "spread": {
            "0": {"textures": { "base": "multibeds:blocks/blank", "art": "multibeds:blocks/blank" } },
            "1": {"textures": { "base": "multibeds:blocks/spread_base0", "art": "multibeds:blocks/blank" } },

 

 

So it appears like the main model can not be altered in variants, and submodels do not process texture data correctly.

It also very possible it can do what I want but I'm making a mistake, but I can't seem to find what it is.

 

EDIT:

So I thought maybe textures are only screwy on models defined outside of the "defaults" but I ran into new issues and was unable to text that.

First you can only have one model, this I expected.

Second you don't seem to be able to define submodels in defaults.

Error I kept getting when I tried: "defaults" variant cannot contain a simple "submodel" definition

I tried all three submodel formats Zaggy1024 provided in the examples (Zaggy1024 wrote the sub model system)

Even the submodel format shown in the "defaults" throws that error.  ???

https://github.com/LexManos/MinecraftForge/pull/1 & http://pastebin.com/TjW6V9a3

 

 

"submodel": "multibeds:base_head"
"submodel": { "headmodel": { "model": "multibeds:base_head" } }
"submodel": { "headmodel": [ { "model": "multibeds:base_head" } ] }

 

Link to comment
Share on other sites

So I found out why it seemed variants could not change the model.

 

modelSet is always false, so the parent variant's model is always used, even if its undefined (results in null) and the child has a model set.

 

So as it currently stands the only variant that can change the model is the first one alphabetically, and if that one has no model defined it falls back to the one in defaults.

 

Changing the check from !this.modelSet to this.model == null in ForgeBlockStateV1.sync, allows any variant to change the model.

But this is not the proper fix, modelSet needs correcting, and that will correct the check.

 

 

Duh  ::)

This is a new instance of Variant, this.modelSet is always going to be false.

But the parent on the other hand, if its model has been set its modelSet will be true.

So the sync code should not be checking the child only, the parent should be checked also.

In turn making it:

if (!this.modelSet && parent.modelSet) {
    this.model = parent.model;
    this.modelSet = true;
}

 

just adding: if (!this.modelSet) this.modelSet = parent.modelSet; after: if (!this.modelSet) this.model = parent.model; works also, and its just one line added rather then 1 deleted and 4 added.

 

This make my first two code snip-its function correctly.

 

This still doesn't solve the issue of the submodels and incorrect textures though.

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.