#Error
1 messages · Page 1 of 1 (latest)
U need to make it 2 separate blocks
So a bottom and top then use scripts to add the top block when bottom block is placed
do you have an example?
hmm no sorry
You can use a custom component for this:
// Example
const doubleBlockComponent = {
onPlace({ block }) {
// Place another equal block above and change the 'mc:top_block' state to true.
if (block.above().isAir) {
block.above().setPermutation(
block.permutation.withState('mc:top_block', true)
);
} else {
// Removes the placed block if there is no space above it.
block.dimension.runCommand(`setblock ${block.x} ${block.y} ${block.z} air destroy`);
}
},
beforeOnPlayerPlace(event) {
// Cancels block placement if there is no space above it.
if (!event.block.above().isAir) event.cancel = true;
}
}
// Register the component
world.beforeEvents...
In the block file have a boolean state, change the geometry based on that state, and add the registered custom component.
@dark token cane you make particles appear automatically with no scripts
#1321944561097900083 message
yeah @dark token have done it and i have put my custom blocks in place, the detect system works so only comes from leaves but i have to do it from a command block
You have to change the particle to appear on other blocks besides leaves, like grass block or whatever block you want.
why?
It’s because it is constantly checking if it’s air then placing the block.
the way I handle double blocks is to check if its bottom is the same block and isn’t top block then do a return to prevent the placement that’s the simplified version that is
Btw you can set a block with block.settype or typeId (i forgot the extract thing)? Instead of running a command to set the block
block.above().setType = “minecraft:grass”
code may be wrong since im busy rn to double check
Apply the custom component only to the permutation of the bottom block
In the block json file, create 2 permutations, one for the top and one for the bottom, and apply the custom component to the bottom.
yes, it's done