Hello!
Excuse me, can someone help me? I want to generate a relatively large structure but I can't because I think the limit is 40x38 or something like that, so I made a block that will generate throughout the world, and I connected it to a script so that when the player is near it it will generate, but I don't know what I have wrong, could someone help me please? D:
import { world, system } from '@minecraft/server';
/** @type {import("@minecraft/server").BlockCustomComponent} */
const generateStructureComponent = {
onUpdate(event) {
console.log('Block update detected'); // Línea de depuración
const block = event.block;
const dimension = world.getDimension("overworld");
// Verificar si el bloque es rg:delta
if (block.id === "rg:delta") {
const x = block.location.x;
const y = block.location.y;
const z = block.location.z;
// Ejecutar el comando para cargar la estructura
const command = structure load delta_estructura ${x - 18} ${y - 5} ${z - 18};
console.log(Executing command: ${command}); // Línea de depuración
dimension.runCommand(command);
// Desactivar la actualización para que no se ejecute repetidamente
block.removeCustomComponent("rg:generate_structure");
}
}
};
// Registrar el componente personalizado
world.beforeEvents.worldInitialize.subscribe(({ blockComponentRegistry }) => {
console.log('Registering custom component for structure generation'); // Línea de depuración
blockComponentRegistry.registerCustomComponent(
"rg:generate_structure",
generateStructureComponent
);
});