#Rotate hitbox by blockstate

27 messages · Page 1 of 1 (latest)

earnest tree
#

How can I do this? As shown, it doesnt rotate.

event.create('iron_chain')
        .displayName('Iron Chain')
        .hardness(6)
        .resistance(5)
        .mapColor('NONE')
        .requiresTool(true)
        .soundType('chain')
        .renderType('cutout')
        .fullBlock(false)
        .waterlogged()
        .opaque(false)
        .transparent(true)
        .notSolid()
        .suffocating(false)
        .box(6.5, 0, 6.5, 9.5, 16, 9.5)
        .tagBlock('minecraft:mineable/pickaxe')
        .property(BlockProperties.AXIS)
        .placementState(global['loglike_waterloggable'])
        .blockstateJson = {
            "variants": {
                "axis=x": {
                    "model": "kubejs:block/iron_chain",
                    "x": 90,
                    "y": 90
                },
                "axis=y": {
                    "model": "kubejs:block/iron_chain"
                },
                "axis=z": {
                    "model": "kubejs:block/iron_chain",
                    "x": 90
                }
            }
        }
        JsonIO.write('kubejs/assets/kubejs/models/block/iron_chain.json', {
            "parent": 'minecraft:block/chain',
            "textures": {
                "all": 'kubejs:block/iron_chain',
                "particle": '#all'
            }
        })
        JsonIO.write(`kubejs/assets/kubejs/models/item/iron_chain.json`, {
            "parent": "minecraft:item/generated",
            "textures": {
                "layer0": "kubejs:item/iron_chain"
            }
        })

global['loglike_waterloggable'] = context => {
    const $Fluids = Java.loadClass("net.minecraft.world.level.material.Fluids")
    let isInWater = context.getLevel().getFluidState(context.getClickedPos()).getType() == $Fluids.WATER
    context.set(BlockProperties.AXIS, context.clickedFace.axis)
    context.set(BlockProperties.WATERLOGGED, isInWater)
}
glass berryBOT
#

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

naive elbow
#

use

{
  "from": [...],
  "to": [...],
  ...
}

in the model element

#

wait this should automatically happen

earnest tree
#

yea idk

silver elbow
#

not for a 'basic' block.... it'll handle it if you use one of the directional block builders

naive elbow
#

it rotates

#

just not the hitbox

#

oh, remove the .box

#

in your builder

#

this is already defined in the model 'minecraft:block/chain'

earnest tree
earnest tree
silver elbow
#

only one I see at quick glance is the horizontal one (so like furnaces and such)

earnest tree
#

might have to build that functionality myself but im not sure how to do it

naive elbow
#

yeah that wouldn't make sense if it would

earnest tree
#

Still not sure what i can do, since that block preset isnt going to work with what im doing (it uses facing, im using axis blockstate)

silver elbow
#

pr a new builder lol.... or use createCustom based on the already existing chain block

earnest tree
#

i tried createcustom and the game crashed lol

silver elbow
#
const $ChainBlock = Java.loadClass('net.minecraft.world.level.block.ChainBlock')
const $Properties = Java.loadClass('net.minecraft.world.level.block.state.BlockBehaviour$Properties')
const $BlockItem = Java.loadClass('net.minecraft.world.item.BlockItem')
const $IProperties = Java.loadClass('net.minecraft.world.item.Item$Properties')

let ironChain

StartupEvents.registry('block', event => {
    ironChain = event.createCustom('iron_chain', () => new $ChainBlock($Properties.copy(Blocks.CHAIN)))
})

StartupEvents.registry('item', event => {
    event.createCustom('iron_chain', () => new $BlockItem(ironChain.get(), new $IProperties()))
)]
earnest tree
#

its working, now i just need to change the rendertype to cutout. thanks!

silver elbow
#

for forge you can add that in the model

#

add "render_type":"cutout"

earnest tree
#

thank you for the help. now i just need to figure out how to make supplementaries give the wall lanterns i made their own textured holder