


// Remove one item from hand after use const inventory = source.getComponent("inventory").container; const selectedSlot = source.selectedSlotIndex; const currentItem = inventory.getItem(selectedSlot);
This addon adds a (Rabocaa Levaa Ruka) that, when used, gives the player a temporary speed & jump boost with a special effect. 📦 File Structure Rabocaa_Levaa_Ruka_1.21/ ├── behavior_pack/ │ ├── manifest.json │ ├── pack_icon.png │ └── scripts/ │ └── main.js ├── resource_pack/ │ ├── manifest.json │ ├── pack_icon.png │ └── textures/ │ └── rabocaa_levaa_ruka.png └── README.txt ⚙️ Behavior Pack Manifest ( behavior_pack/manifest.json ) { "format_version": 2, "header": { "name": "Rabocaa Levaa Ruka - BP", "description": "Adds the Rabocaa Levaa Ruka item with special abilities.", "uuid": "a7f5e3d2-1b4c-4e8a-9f2b-6d3c7e1a5b9f", "version": [1, 0, 0], "min_engine_version": [1, 21, 0] }, "modules": [ { "type": "script", "language": "javascript", "uuid": "b8c4d3e2-5f6a-4b7c-9d1e-2a3b4c5d6e7f", "entry": "scripts/main.js", "version": [1, 0, 0] } ], "dependencies": [ { "module_name": "@minecraft/server", "version": "1.12.0" }, { "module_name": "@minecraft/server-ui", "version": "1.3.0" } ], "capabilities": ["script_eval"] } 📜 Script ( behavior_pack/scripts/main.js ) import { world, system, ItemStack } from "@minecraft/server"; // Item ID (custom, but using a vanilla head as base for simplicity) const ITEM_ID = "minecraft:skull 5"; // Using skeleton skull as base (you can replace with custom item later) const CUSTOM_ITEM_NAME = "Rabocaa Levaa Ruka";
// Check if player doesn't already have it let hasItem = false; for (let i = 0; i < inventory.size; i++) { const item = inventory.getItem(i); if (item?.typeId === "minecraft:skull" && item.amount === 5) { hasItem = true; break; } }
if (currentItem && currentItem.amount > 1) { currentItem.amount -= 1; inventory.setItem(selectedSlot, currentItem); } else { inventory.setItem(selectedSlot, undefined); } } }); Addon- Rabocaa levaa ruka -1.21 -
// Give the item on player join (optional) world.afterEvents.playerJoin.subscribe(({ player }) => { const inventory = player.getComponent("inventory").container;
if (itemStack?.typeId === "minecraft:skull" && itemStack.amount === 5) { // Custom check for our "Rabocaa Levaa Ruka" // In a real addon, you'd use a custom item ID. Here we simulate with skull type 5.
// Apply effects source.addEffect("speed", DURATION_SECONDS * 20, { amplifier: SPEED_AMPLIFIER, showParticles: true }); // Remove one item from hand after use
// Register item use event world.afterEvents.itemUse.subscribe((event) => { const { source, itemStack } = event;
source.addEffect("jump_boost", DURATION_SECONDS * 20, { amplifier: JUMP_AMPLIFIER, showParticles: true });
source.sendMessage("§5✨ You feel the power of Rabocaa Levaa Ruka! ✨"); // Apply effects source
// Effect properties const SPEED_AMPLIFIER = 2; const JUMP_AMPLIFIER = 2; const DURATION_SECONDS = 15;
// Optional: Give a temporary glowing effect source.addEffect("glowing", DURATION_SECONDS * 20, { amplifier: 0, showParticles: false });