#Custom Enchantment Help with creation [RESOLVED]
1 messages · Page 1 of 1 (latest)
itemStack.setLore(["myEnchantment"])
const eq = player.getComponent("equippable")
if (eq.getSlot("Feet").getLore()[0] == "myEnchantment") {
player.addEffect("speed", 2, { amplifier: 2 })
}
Thanks!
I've tried testing it, and it works. How do I get it to only work on sand?
Check the block below the player
player.dimension.getBlock({ x: player.location.x, y: player.location.y - 1, z: player.location.z })
Thanks.
Custom Enchantment Help with creation [RESOLVED]
So, would this all work:
world.beforeEvents.playerTick.subscribe(({ player }) => {
try {
// 1. Get the player's equipped item in the Feet slot
const eq = player.getComponent("equippable");
const feetItem = eq?.getEquipment("feet");
if (!feetItem) return;
const lore = feetItem.getLore();
// 2. Check if the boots have the custom "myEnchantment" tag
if (lore.length === 0 || lore[0] !== "myEnchantment") return;
// 3. Check the block under the player
const blockBelow = player.dimension.getBlock({
x: Math.floor(player.location.x),
y: Math.floor(player.location.y - 1),
z: Math.floor(player.location.z),
});
if (
blockBelow?.typeId === "minecraft:sand" ||
blockBelow?.typeId === "minecraft:red_sand"
) {
// 4. Apply Speed effect (amplifier 2 = Speed III)
player.addEffect(MinecraftEffectTypes.speed, 2, {
amplifier: 2,
showParticles: false,
});
}
} catch (err) {
console.warn("Sand Strider enchantment error:", err);
}
});```
no
please stop using AI like that
playerTick event is not even a thing 😭
what in the ai 😭