mc.world.events.beforeItemUseOn.subscribe(data => {
let hoeList = [
"minecraft:wooden_hoe",
"minecraft:stone_hoe",
"minecraft:iron_hoe",
"minecraft:golden_hoe",
"minecraft:diamond_hoe",
"minecraft:netherite_hoe"
];
let lc = data.blockLocation;
if (hoeList.includes(`${data.item.typeId}`) && data.source.dimension.getBlock(lc).typeId == "minecraft:grass" && Math.floor(Math.random()*2) == 0)
data.source.dimension.spawnItem(new mc.ItemStack(mc.MinecraftItemTypes.wheatSeeds, 1, 0), new mc.BlockLocation(lc.x, lc.y + 1, lc.z));
});``` I am trying to run some code in version 1.19.81, but I am getting an error on line 12. Can you please help me identify what is causing the error:(?
#Why it isn't work anymore
1 messages · Page 1 of 1 (latest)