Skip to main content

Custom Blocks

materialThis is a startup script.

onEvent('block.registry', event => {
  event.create('test_block').material('glass').hardness(0.5).displayName('Test Block')
})


The texture for this block has to be placed in kubejs/assets/kubejs/textures/block/test_block.png.
If you want a custom block model, you can create one in Blockbench and put it in kubejs/assets/kubejs/models/block/test_block.json.

 

List of available materials - to change break/walk sounds and to change some properties (tool used to mine, etc):

Material
air
wood
rock
iron
organic

earth

water
lava
leaves
plants
sponge
wool
sand
glass
tnt
coral
ice
snow
clay
groud
dragon_egg
portal
cake
web
slime
honey
berry_bush
lantern

 

Other methods block builder supports: [you can chain these methods after displayName()]

  • material('material')
  • hardness(float) // >= 0.0
  • resistance(float) // >= 0.0
  • unbreakable()
  • lightLevel(int) // 0.0 - 1.0
  • harvestTool('tool', level) // Available tools: pickaxe, axe, hoe, shovel, level >= 0
  • opaque(boolean)
  • fullBlock(boolean)
  • requiresTool(boolean)
  • renderType('type') // solid, cutout, translucent, cutout required for blocks with texture like glass, translucent required for blocks like stained glass
  • color(tintindex, color)
  • texture('texturepath')
  • texture('side', 'texturepath')
  • model('modelpath')
  • noItem()
  • shapeCube(x0, y0, z0, x1, y1, z1) // 0.0 - 16.0, default is (0,0,0,16,16,16)
  • notSolid()
  • waterlogged()
  • noDrops()
  • slipperiness(float) // 
  • speedFactor(float)
  • jumpFactor(float)
  • randomTick(randomTickEvent => {}) // see below
  • item(itemBuilder => {})
  • setLootTableJson(json)
  • setBlockstateJson(json)
  • setModelJson(json)