#Custom block with multiple textures won't show it

3 messages · Page 1 of 1 (latest)

fierce raft
#

Texture won't show, got this working on 1.20.1, now updating to 1.21.1 , thanks for any help.

code:


StartupEvents.registry('block', event => {

   let mold = (name, c1) => {
       let id = name.toLowerCase().replace("'", "").split(' ').join('_')
       event.create(`molten_${id}_in_a_mold`)
           .box(5, 0, 2, 11, 4, 14)
           .hardness(3.0)
           .parentModel("kubejs:block/ingot_mold")
           .color(1,c1)
           .texture("up", "kubejs:block/texture_ingot_mold_1")
           .displayName(`Molten ${id} in a mold`)
           .notSolid()
           .renderType("solid")
           .item(item => item
               .color(1, c1)
               .tooltip([Text.gray('Molten '+name+' in a mold. Still hot.'), Text.gray('You should cool it')])
           )
           
   }

   mold('Iron', 0xD1312E )
   mold('Copper', 0xE47B55 )
   mold('Gold', 0xFAF25E )
   mold('Zinc', 0xA3BE9E )
   mold('Brass', 0xF8CA67 )
})

model json:



"textures": {
       "0": "kubejs:block/texture_ingot_mold_0",
       "1": "kubejs:block/texture_ingot_mold_1",
       "particle": "kubejs:block/texture_ingot_mold_0"
   },

Some images of the current texture and how should look like

west wingBOT
#

Once your ticket has been resolved, please close it with </ticket close:1054771505520717835> command!

fierce raft
#

Finally got it, this is the working code

StartupEvents.registry('block', event => {

   let mold = (name, c1) => {
       let id = name.toLowerCase().replace("'", "").split(' ').join('_')
       event.create(`molten_${id}_in_a_mold`)
           .box(5, 0, 2, 11, 4, 14)
           .hardness(3.0)
           .modelGenerator(model => { model.parent('kubejs:block/ingot_mold') })
           .color(1,c1)
           .notSolid()
           .renderType("cutout")
           .displayName(`Molten ${id} in a mold`)
           .item(item => item
               .color(1, c1)
               .tooltip([Text.gray('Molten '+name+' in a mold. Still hot.'), Text.gray('You should cool it')])
           )
           
   }

   mold('Iron', 0xD1312E )
   mold('Copper', 0xE47B55 )
   mold('Gold', 0xFAF25E )
   mold('Zinc', 0xA3BE9E )
   mold('Brass', 0xF8CA67 )
})