#Making Custom Plants Break with Water Streams

1 messages · Page 1 of 1 (latest)

slate gull
#

¿Cómo puedo hacer que una planta personalizada en mi addon de Minecraft Bedrock se rompa cuando entra en contacto con corrientes de agua, al igual que el pasto en el juego base?

Estoy desarrollando un addon de naturaleza, pero muchos jugadores me han expresado su frustración porque la vegetación añadida no se destruye con el agua, lo que dificulta la construcción. Actualmente, deben eliminar las plantas manualmente, lo que resulta tedioso. Recibo muchas quejas al respecto y no sé cómo solucionarlo. Agradecería mucho cualquier ayuda o sugerencia.

idle imp
#

Try this code (It's not the exact working option, but it should work). Also, in order for the code to work, you need the block to have a Tick.


server.world.beforeEvents.worldInitialize.subscribe(initEvent => {
    initEvent.blockComponentRegistry.registerCustomComponent("cus:pla", {
        onTick: result => {
            let block = result.block;
            let dimension = block.dimension;
            let { x, y, z } = block.location;

            // Проверяем, есть ли вода рядом
            let isWaterNearby = [-1, 0, 1].some(dx =>
                [-1, 0, 1].some(dy =>
                    [-1, 0, 1].some(dz => {
                        let checkBlock = dimension.getBlock({ x: x + dx, y: y + dy, z: z + dz });
                        return checkBlock && (checkBlock.typeId === "minecraft:water" || checkBlock.typeId === "minecraft:flowing_water");
                    })
                )
            );

            // Если есть вода, ломаем растение
            if (isWaterNearby) {
                dimension.runCommand(`setblock ${x} ${y} ${z} air destroy`);
            }
        }
    });
});```
slate gull
slate gull
idle imp
#

You should have this "minecraft:tick": { "looping": true, "interval_range": [ 0, 0 ] } in "components": { },

idle imp
light lynx
#

Use the liquid_detection component

slate gull
slate gull
slate gull
light lynx
#

Que format_version usaste?

#

Se necesita 1.21.60

slate gull
light lynx
#

No

slate gull
#

no entiendo

slate gull
# light lynx No

si yo pongo esa version de formato mis bloques no dejarian de funcionar en versiones inferiores a la 1.21.60?

light lynx
#

Si

#

Que versión del juego tienes?

slate gull
#

y la min_engine_version la tengo en 1.21.50, le pongo la 60?

slate gull
light lynx
#

Si se puede usar con 1.21.50 pero necesitas activar el interruptor experimental de las próximas características del creador

#

Y el format_version 1.21.50

slate gull
#

a ya, entonces solo seria poner la version de formato del bloque a la 1.21.60?

slate gull
slate gull
light lynx
slate gull
#

me acabe de dar cuenta que lo tengo es en 1.20.50 xd

slate gull
# light lynx Si

acabe de hacer lo que me dijiste y sigue sin funcionar mi bloque ::/

#

@idle imp Do you know how the minecraft:liquid_detection component works? I installed it and my block stopped working, and that's despite the fact that the block format is 1.21.50 and the min_engine_version is also 1.21.50. What else do I have to do to make this component work?

idle imp
slate gull
slate gull
idle imp
#

Yep

slate gull
slate gull
# idle imp Yep

for some reason no matter how I type it or what the format version and min_engine_version are my block just doesn't work ::(

idle imp
#

Well then try using JS