#"Edit" Vanilla loot tables

1 messages · Page 1 of 1 (latest)

prisma gyro
#

So I'm working on something that I need to be able to override Vanilla loot tables however I know this isn't possible so I'm using scripts to do this but. Any way I do it doesn't work can someone Tell me what I'm doing wrong maybe it's a simple fix
Here's the code

import { world, system, ItemStack } from "@minecraft/server";
world.afterEvents.playerBreakBlock.subscribe((dat) => {
let block = dat.block;
let namespace = block.typeId;
let player = dat.player
let itemstackBefore = dat.itemStackBeforeBreak;
let itemstackAfter = dat.itemStackAfterBreak;
let item = block.dimension.getEntitiesAtBlockLocation(block.location);
const Block_handle = {
"minecraft:dirt": () => {

  for (const entity of item) {
    entity.kill();
    let item_dirt = new ItemStack("better_mechanics:dirt_powder", 1)
    block.dimension.spawnItem(item_dirt, block.location)
  }
}

}

Block_handle[namespace]?.()
})

I also tried using If statements Also didn't work

prisma gyro
#

Well I'm gonna try to figure this out if anyone does figure out what's wrong then don't hesitate to ping me

long flint
long flint
prisma gyro
#

Thanks Guess I was overcomplicating it