Daymare Posted August 21, 2025 Report Posted August 21, 2025 Hello, I am quite new to modding and am trying to apply different textures for a few variants of an object. Here is my shape script: { "editor": { "allAngles": false, "entityTextureMode": true }, "textureWidth": 16, "textureHeight": 16, "textureSizes": { "ceramic": [16,16] }, "textures": { }, "elements": [ { "name": "Base", "from": [ 6.5, 0.0, 6.5 ], "to": [ 9.5, 1.0, 9.5 ], "uv": [ 3.0, 11.5 ], "rotationOrigin": [ 6.0, 0.0, 6.0 ], "faces": { "north": { "texture": "#mat", "uv": [ 3.0, 14.5, 6.0, 15.5 ] }, "east": { "texture": "#mat", "uv": [ 6.0, 14.5, 9.0, 15.5 ] }, "south": { "texture": "#mat", "uv": [ 9.0, 14.5, 12.0, 15.5 ] }, "west": { "texture": "#mat", "uv": [ 12.0, 14.5, 15.0, 15.5 ] }, "up": { "texture": "#mat", "uv": [ 3.0, 11.5, 6.0, 14.5 ] }, "down": { "texture": "#mat", "uv": [ 6.0, 11.5, 9.0, 14.5 ] } }, "children": [ { "name": "Left", "from": [ 0.0, 1.0, 0.0 ], "to": [ 0.5, 4.0, 3.0 ], "uv": [ 0.0, 5.5 ], "rotationOrigin": [ 0.0, 1.0, 0.0 ], "faces": { "north": { "texture": "#mat", "uv": [ 0.0, 8.5, 0.5, 11.5 ] }, "east": { "texture": "#mat", "uv": [ 0.5, 8.5, 3.5, 11.5 ] }, "south": { "texture": "#mat", "uv": [ 3.5, 8.5, 4.0, 11.5 ] }, "west": { "texture": "#mat", "uv": [ 4.0, 8.5, 7.0, 11.5 ] }, "up": { "texture": "#mat", "uv": [ 0.0, 5.5, 0.5, 8.5 ] }, "down": { "texture": "#mat", "uv": [ 0.5, 5.5, 1.0, 8.5 ] } } }, { "name": "Right", "from": [ 2.5, 1.0, 0.0 ], "to": [ 3.0, 4.0, 3.0 ], "uv": [ 8.0, 1.5 ], "rotationOrigin": [ 3.0, 1.0, 0.0 ], "faces": { "north": { "texture": "#mat", "uv": [ 8.0, 4.5, 8.5, 7.5 ] }, "east": { "texture": "#mat", "uv": [ 8.5, 4.5, 11.5, 7.5 ] }, "south": { "texture": "#mat", "uv": [ 11.5, 4.5, 12.0, 7.5 ] }, "west": { "texture": "#mat", "uv": [ 12.0, 4.5, 15.0, 7.5 ] }, "up": { "texture": "#mat", "uv": [ 8.0, 1.5, 8.5, 4.5 ] }, "down": { "texture": "#mat", "uv": [ 8.5, 1.5, 9.0, 4.5 ] } } }, { "name": "Front", "from": [ 0.5, 1.0, 2.5 ], "to": [ 2.5, 4.0, 3.0 ], "uv": [ 8.0, 7.5 ], "rotationOrigin": [ 1.0, 1.0, 2.0 ], "faces": { "north": { "texture": "#mat", "uv": [ 8.0, 8.0, 10.0, 11.0 ] }, "east": { "texture": "#mat", "uv": [ 10.0, 8.0, 10.5, 11.0 ] }, "south": { "texture": "#mat", "uv": [ 10.5, 8.0, 12.5, 11.0 ] }, "west": { "texture": "#mat", "uv": [ 12.5, 8.0, 13.0, 11.0 ] }, "up": { "texture": "#mat", "uv": [ 8.0, 7.5, 10.0, 8.0 ] }, "down": { "texture": "#mat", "uv": [ 10.0, 7.5, 12.0, 8.0 ] } } }, { "name": "Back", "from": [ 0.5, 1.0, 0.0 ], "to": [ 2.5, 4.0, 0.5 ], "uv": [ 4.0, 3.5 ], "rotationOrigin": [ 1.0, 1.0, 0.0 ], "faces": { "north": { "texture": "#mat", "uv": [ 4.0, 4.0, 6.0, 7.0 ] }, "east": { "texture": "#mat", "uv": [ 6.0, 4.0, 6.5, 7.0 ] }, "south": { "texture": "#mat", "uv": [ 6.5, 4.0, 8.5, 7.0 ] }, "west": { "texture": "#mat", "uv": [ 8.5, 4.0, 9.0, 7.0 ] }, "up": { "texture": "#mat", "uv": [ 4.0, 3.5, 6.0, 4.0 ] }, "down": { "texture": "#mat", "uv": [ 6.0, 3.5, 8.0, 4.0 ] } } } ] } ]} and here is the script for the object itself: { code: "cup", class: "cupmod.cup", behaviors: [ { name: "GroundStorable", properties: { layout: 'Quadrants', collisionBox: { x1: 0, y1: 0, z1: 0, x2: 1, y2: 0.125, z2: 1 } } }, { name: "Unplaceable", "__comment": "The ground storable obsoletes this being a block. Should be an item, but is kept a block for backwards compatibility" }, { name: "RightClickPickup"} ], variantgroups: [ { code: "material", states: ["clay", "glass"]}, { code: "color", states: ["blue", "fire", "black", "brown", "cream", "gray", "orange", "red", "tan", "smoky", "pink", "violet", "green"]}, { code: "cupshape", states: ["basecup", "mug", "wine"]} ], allowedVariants: [ "cup-glass-smoky-*", "cup-glass-pink-*", "cup-glass-violet-*", "cup-glass-green-*", "cup-clay-*-*" ], skipVariants: [ "cup-clay-*-wine", "cup-clay-smoky-*", "cup-clay-pink-*", "cup-clay-violet-*", "cup-clay-green-*" ], shapeByType: { "cup-*-*-basecup": { base: "cupmod:block/cups/cup" }, "cup-*-*-mug": { base: "cupmod:block/cups/mug" }, "cup-*-*-wine": { base: "cupmod:block/cups/wine" } }, texturesByType: { "cup-clay-blue-basecup": { "mat": { base: "game:block/clay/hardened/{color}" } }, "cup-glass-*-*": { "mat": { base: "game:block/glass/{color}"}, "wine": { base: "game:block/glass/{color}"} }, "*":{ "mat": { base: "game:block/clay/hardened/{color}" } } }, attributes: { handbook: { ignoreCreativeInvStacks: true, groupBy: ["cup-*-{color}"] }, shelvable: true, liquidContainerProps: { capacityLitres: 0.5, transferSizeLitres: 0.1, emptyShapeLoc: "cupmod:block/cups/cup", opaqueContentShapeLoc: "cupmod:block/cups/cup-contents", liquidContentShapeLoc: "cupmod:block/cups/cup-liquidcontents", liquidMaxYTranslate: 0.05 }, onTongTransform: { translation: { x: -0.9, y: -1.4, z: -0.49 }, rotation: { x: 45, y: 86, z: -67 }, scale: 0.9 }, breakchance: 0.1 }, doNotRenderAtLod2: true, blockmaterial: "Ceramic", creativeinventory: { "general": ["*"], "decorative": ["*"] }, replaceable: 300, liquidSelectable: 1, resistance: 0.75, maxStackSize: 16, lightAbsorption: 0, texturesByType: { "*-honey": { content: { base: "game:block/liquid/honey" } }, "*-milk": { content: { base: "game:block/food/dairy/milk" } } }, sounds: { walk: "game:walk/stone", }, sideopaque: { all: false }, sidesolid: { all: false }, collisionbox: { x1: 0.3125, y1: 0, z1: 0.3125, x2: 0.6875, y2: 0.125, z2: 0.6875 }, selectionbox: { x1: 0.3125, y1: 0, z1: 0.3125, x2: 0.6875, y2: 0.125, z2: 0.6875 }, guiTransform: { translation: { x: 0, y: 3, z: 0 }, origin: { x: 0.5, y: 0.0625, z: 0.5 }, scale: 3 }, groundTransform: { scale: 3.5 }, tpHandTransform: { translation: { x: -0.97, y: -0.14, z: -0.63 }, rotation: { x: -50, y: 15, z: -104 }, origin: { x: 0.5, y: 0.1, z: 0.5 }, scale: 0.66 } } It was my understanding that the texturesByType would allow me to apply different textures as I have done here, but I instead get errors: Missing mapping for texture code #mat during shape tesselation of block cupmod:cup-glass-violet-wine using shape cupmod:block/cups/wine, or one of its alternates for every variant type. If it is not within the 'by type' sections, the texture works fine, and the shapeByType seems to work work without error. I'm at a loss of what to do here, since I have looked at existing JSON files for armor etc which utilise many variants, and the formatting seems to be the same as what I have here. Am I missing something obvious?
Echo Weaver Posted August 21, 2025 Report Posted August 21, 2025 Hmm. Are you trying to specify two types in one wildcard statement, e.g. cup-glass-*-* where the first wildcard is mat and the second one is wine? Someone with more experience may contradict me, but I'm not sure the json can handle that.
Daymare Posted August 21, 2025 Author Report Posted August 21, 2025 I thought this at first, but I've seen in the survival files that armour uses statements like "armor-*-tailored-*-linen": { base: "entity/humanoid/seraph/armor/gambeson/{bodypart}" }, for defining shapes, so I think it should be able to do two fine. I think I figured it out. I noticed that I removed the original "textures" section, and I actually completely missed that I had a texturesByType already down below for the milk and honey textures, so it's likely just that that section was overriding the one I added above with textures for each variant. I probably need to just add the textures statement back in, and add my changes to the existing textures by type area towards the bottom.
Recommended Posts