#How do you create a block that does the same rotation as the End Rod ?
15 messages · Page 1 of 1 (latest)
Once your ticket has been resolved, please close it with </ticket close:1054771505520717835> command!
I don't have an example for a block which can face all 6 directions, but I do have an example of a block that can be placed like a log (i.e. 3 directions, one for each axis), and we might be able to jury-rig that
Let me grab it for you
event.create('bismuth_pillar').material('heavy_metal').hardness(5.0).resistance(6.0).tagBlock('minecraft:mineable/pickaxe').tagBlock('minecraft:needs_stone_tool').requiresTool(true).displayName('Bismuth Pillar').property(BlockProperties.AXIS).placementState(event => event.set(BlockProperties.AXIS, event.clickedFace.axis)).model('kubejs:block/bismuth_pillar').blockstateJson = {
"variants": {
"axis=x": {
"model": "kubejs:block/bismuth_pillar",
"x": 90,
"y": 90
},
"axis=y": {
"model": "kubejs:block/bismuth_pillar"
},
"axis=z": {
"model": "kubejs:block/bismuth_pillar",
"x": 90
}
}
}```
The bits which make directional placement work in this case are the .property(), .placementState(), and .model() functions, plus the .blockstateJson variable
I'm gonna do a little testing on my end to figure out what the property used by End Rods is called, and see if I can figure it out from there
Alright, the property used by End Rods is called "facing", with its states being "north", "east", "south", "west", "up", and "down"
If I'm understanding everything here correctly, then, you should be able to get directional placement working by replacing your current event.create() call with something like this:
event.create("your_block_id")/*Use this space for assorted block setup functions, like .material(), .hardness(), etc.*/.property(BlockProperties.FACING).placementState(event => event.set(BlockProperties.FACING, event.clickedFace)).model("kubejs:block/your_block_model").blockstateJson = {
"variants": {
"facing=north": {
"model": "kubejs:block/your_block_model",
"x": 90
},
"facing=east": {
"model": "kubejs:block/your_block_model",
"x": 90,
"y": 90
},
"facing=south": {
"model": "kubejs:block/your_block_model",
"x": 90,
"y": 180
},
"facing=west": {
"model": "kubejs:block/your_block_model",
"x": 90,
"y": 270
},
"facing=up": {
"model": "kubejs:block/your_block_model"
},
"facing=down": {
"model": "kubejs:block/your_block_model",
"x": 180
}
}
}```
Just make sure you fill in the "your_block_model" spots with the name of your block model file (minus the ".json"), and that should start working once you boot/reboot the game
If not, shoot me a ping
@maiden wing
It works, thank you! Is there any way it can also rotate the HitBox?
Ahh, yeah, that bit did slip my mind
Well, I'm less familiar with that, admittedly
I know how you set up a custom hitbox, through .fullBlock(false) and a bunch of .box() calls, but I don't have any examples to work from for how to set up .box() calls to depend on the block's properties