KubeJS (Old)

KubeJS (Old)

3M Downloads

Creating item models ignores layer0 and renders default texture

TheLordofMelons opened this issue ยท 4 comments

commented

Minecraft Version

1.16.5

KubeJS Version

kubejs-forge-1605.3.19-build.299

Rhino Version

rhino-forge-1605.1.5-build.75

Architectury Version

architectury-1.32.66

Forge/Fabric Version

Forge 36.2.34

Describe your issue

When creating an item and supplying it with a model via .parentModel(), the model will ignore texture supplied as layer0 in the model .json file. Any other layer will render as expected, but layer0 will always render the default pink/black texture, or if there is a texture with the item name it will use that.

Example:
Startup Script:
event.create("test").parentModel("kubejs:item/test");
Model Json:
{ "parent": "minecraft:item/generated", "textures": { "layer0": "minecraft:item/paper", "layer1": "minecraft:item/ghast_tear" } }
This will not render a piece of paper with a ghast tear on top as expected.
2023-02-12_19 41 03

Crash report/logs

No response

commented

I feel like KubeJS should maybe still check if the model JSON contains a layer0 texture already, but yes, what Enigma said is correct

commented

The information on the Wiki is incorrect/misleading then and should be modified. Also the solution is not exactly correct because it will still fail to use the specified texture when assigning multiple textures via layers such as using textures("layer0", "minecraft:item/paper"). In fact every example on the Wiki does not work. This is unintuitive behavior as one would expect all of the texture(s) functions to override the default texture behavior. Also one would expect the texture specified in the model to override anything else, as that is the point of the model.

commented

The wiki is a mix of 1.18 and 1.16 information depending on when/who wrote it. .texture(key, path) is a 1.18 method not available in 1.16

commented

https://github.com/KubeJS-Mods/KubeJS/blob/eol/1.16/common/src/main/java/dev/latvian/kubejs/item/custom/ItemType.java#L20-L30
If no texture is defined, kubejs automatically adds a layer0 texture based on the item name, if you don't want that to happen instead use the layer0 texture there so it doesn't get overwritten
event.create("test").parentModel("kubejs:item/test").texture("minecraft:item/paper")