#How to edit harvest level of a block?

18 messages · Page 1 of 1 (latest)

unreal pebble
#

Im trying to edit the harvest level of ancient debris so that it can only be broken with netherite tier equipment. I tried this script (see screenshot) and it doesnt work for me. How do I make this work?

hasty cryptBOT
#

Once your ticket has been resolved, please close it with </ticket close:1054771505520717835> command!

dusky badge
#

whait needs_netherite_tool ? i have thought it's just a fabric thing and not forge

fluid niche
#

its 'minecraft:needs_netherite_tool'

#

not forge

fluid niche
dusky badge
#

I was just wondering because the Fabric Wiki says that:

Fabric API provides dynamic tags for mining levels above diamond, as well as for wood (mining level 0). Dynamic mining level tags are in the format fabric:needs_tool_level_N, where N is the wanted tool level as an integer. For example, a mining level tag for netherite (mining level 4) would be fabric:needs_tool_level_4. Dynamic tags are checked automatically. You put these tags in resources/fabric/tags/blocks/.
unreal pebble
fluid niche
#

thankfully theres a forge event for everything heh ```js
ForgeEvents.onEvent('net.minecraftforge.event.entity.player.PlayerEvent$HarvestCheck', event => {
global.HarvestCheck(event)
})
let PickaxeItem = Java.loadClass("net.minecraft.world.item.PickaxeItem")
/**
*

  • @param {Internal.PlayerEvent$HarvestCheck} event
    */
    global.HarvestCheck = (event) => {
    const { entity, targetBlock } = event
    try {
    if (targetBlock.block.id != "minecraft:ancient_debris") return
    //Detect if the player has a netherite tool in their hand by tag
    if (!entity.mainHandItem.hasTag("forge:tools/netherite") || !(entity.mainHandItem instanceof PickaxeItem)) {
    event.setCanHarvest(false)
    }
    } catch (error) {
    console.log(error)
    }
    }```
#

this is a startup script

unreal pebble
#

Thank you! I will try this.

fluid niche
#

im pretty sure its forge:tools/netherite though youll have to double check which you can do with /kjs hand ofcourse

unreal pebble
#

The script works but the tag doesnt. Though I used kjs hand and i dont see any tags specific to netherite on this list. Is there any way to get around this?

fluid niche
#

you can always add the pickaxes you want to the forge:tools/netherite tag

#

(or any tag you wanna make)

#

or if its just the netherite pickaxe you can do ```js
if (entity.mainHandItem.id != "minecraft:netherite_pickaxe" || !(entity.mainHandItem instanceof PickaxeItem))

unreal pebble
#

Thank you that works, though I just remebered that there are 4 pickaxes that should be able to mine ancient debris so ill use tags instead. I think I can figure out tags on my own, but thank you for your help.