#Minecraft update breack my code
1 messages · Page 1 of 1 (latest)
it is no longer .selectedSlot
pretty sure its .selectSlotIndex
I still have a mistake
thats correct.
i dont know why its saying that.
are you using the correct script version?
1.11.0 stable and 1.12.0-beta are the current versions
let container = player.getComponent("minecraft:inventory").container;
let item = container.getItem(player.selectSlotIndex);
let itemDura = 0;
let inventory = player.getComponent("inventory")?.container;
let xp_level_farmeur = getObjective("xp_level_farmeur");
let gold = getObjective("gold");
let hoe_level = getScore(player, "hoe_level");
let hoe_xp = getScore(player, "hoe_xp");
let hoe_xp_objective = getObjective("hoe_xp");
let hoe_level_objective = getObjective("hoe_level");
const brokenBlockPermutation = event.brokenBlockPermutation;
if (brokenBlockPermutation.type.id === "minecraft:wheat") {
if (Number(brokenBlockPermutation.getState("growth")) === 7){
let xp_add = 1;
let gold_add = 2;
if (item.hasComponent("minecraft:durability")) {
const durability = item.getComponent("minecraft:durability");
const maxDurability = durability.maxDurability;
xp_level_farmeur.addScore(player, xp_add)
gold.addScore(player, gold_add)
player.runCommand(`title @s actionbar +${xp_add} Xp / +${gold_add} Gold \n ${maxDurability-itemDura} / ${maxDurability}`)
player.runCommand("playsound random.orb @s")
for (let i = 0; i < inventory.size; i++) {
let item = inventory.getItem(i);
if (item === undefined) continue;
if (item.typeId === "nc:hoe_jade") {
hoe_xp_objective.addScore(player, xp_add)
item.setLore([`§8Niveau : ${hoe_level} \nXp : ${hoe_xp}`]);
inventory.setItem(i, item);
}}
}else {
here is the part of the script concerned
make sure you have got @minecraft/[email protected] installed and not the older version
Just use the EntityEquippableComponent
thanks you
The mistake here is that it's called selectedSlotIndex not selectSlotIndex for anyone wondering
oh yeah
damn
sorry about that