rewrite the code again # i want to make it easy for me to add new stuff, and its the 5th time i rewrite the whole code. i keep forgetting what i code and how i do it, and then thare is that script v2 thing and custom command, so i just make thing up to patch it and the code is a mess(for me) because of it. now i want to code it so that its eazy to fix and update.
how it work # it chenga the time it need to finish 1 cycle of day or night for example: if you set the day to 20 minute, a full day night cycle will be 30 minute, couse by default day and night is 10 minute each so 20 per cycle
(it still in progres)
how to use # go to my github repo here and see its page, or use this link for the wiki page.
this use minecraft’s own api CustomCommandRegistry for custom command
it make the making of custom command easyer to read and understand (thats what i hope)
DZombies45/MCBE-CustomCommand Custom Command for Minecraft Bedrock
so yeah, lots of stuff that use beta api is broken. so it might need some time to fix it.
script api is updated to v2 beta # after this update most script that use beta api is broken, but, the one on stable v1 is fine, so no need to change it.
well it might take some time for me to fix it
what to do # so i here is what i want to add when i update this addon, so unless i add 1 of this thisng, i won’t upload the update event if the new version is up, ill do this first.
item durability limit new setting ui using action bar/title easy custom sort system inv sort function auto add from sellected chest auto sort to/from chest better item(enchant) filter make sort template ui for sort action form why do i use action event # so basicly no easy way to detect inventory is open or close at the moment, so i need to use every action player can use.
working on it # it’s an addon that will make changing noteblock note easy with ui (fornow)
so it seems making it its own block will be hard, so will need to wait till we can check restone update on custom block like its posible with tick interval, but when i test it, it will lag after some block is placed on low end device, so ill wait till then
silk spawner code # just copy this code, and paste it on your behavior pack script. or just download the addon here on mcpedl
// import minecraft api import { world, system } from "@minecraft/server"; // addon version const version = "1.0"; // item use to destroy the spawner const pickaxe = [ "minecraft:iron_pickaxe", "minecraft:golden_pickaxe", "minecraft:diamond_pickaxe", "minecraft:netherite_pickaxe", ]; // on block break world.beforeEvents.playerBreakBlock.subscribe( (data) => { // extrack data const { block, player, itemStack } = data; // verify if hold item match pickaxe list above and has silk touch enchantment if (!itemStack || !pickaxe.includes(itemStack.typeId)) return; if ( !itemStack .getComponent("minecraft:enchantable") ?.getEnchantment("silk_touch") ) return; data.cancel = true; // what to do after const spawnPos = centerBlockToEntity(block.location); const item = block.getItemStack(1, true); // spawn the item and add feedback, on the next active tick, couse beforeEvents run on idle tick or read only system.run(() => { pickDurability(player); block.setType("minecraft:air"); block.dimension.spawnItem(item, spawnPos); player.playSound("block.mob_spawner.break", { pitch: randomRange(0.8, 1.2), location: block.location, volume: 1, }); }); }, { blockTypes: ["minecraft:mob_spawner"], }, ); // convert block position to entity location function centerBlockToEntity(pos) { return { x: pos.x + 0.5, y: pos.y + 0.5, z: pos.z + 0.5, }; } // remove durability from pickaxe function pickDurability(player) { const inv = player.getComponent("inventory").container; const item = inv.getItem(player.selectedSlotIndex); if (!item) return true; const durability = item.getComponent("minecraft:durability"); const unbreakingLv = item.getComponent("minecraft:enchantable")?.getEnchantment("unbreaking") ?.level || 0; const breakChance = durability.getDamageChance(unbreakingLv); if (Math.random() * 100 <= breakChance) durability.damage += 1; if (durability.damage >= durability.maxDurability) { inv.setItem(player.selectedSlotIndex, undefined); player.playSound("random.break", { pitch: randomRange(0.8, 1.2), location: player.location, volume: 1, }); return true; } inv.setItem(player.selectedSlotIndex, item); return false; } // just random function function randomRange(min = 0, max = 1) { return Math.random() * (max - min) + min; } // just to check if addon work or not world.afterEvents.playerSpawn.subscribe((data) => { if (!data.initialSpawn) return; data.player.sendMessage({ rawtext: [ { text: `§2+ §asilky spawn v${version} is installed`, }, ], }); });