#Changing blocks' mining level
18 messages · Page 1 of 1 (latest)
Once your ticket has been resolved, please close it with </ticket close:1054771505520717835> command!
//priority 97
ServerEvents.tags('block', event => {
//Adding tags
event.add('minecraft:needs_stone_tool','#minecraft:logs')
})
That's all I have so far, but doesn't make it so the player can't just mine it with their hands
It justs makes the example mining tool stone
But doesn't change anything
You can try looking into the source code of the no punch trees mod https://github.com/alcatrazEscapee/no-tree-punching/tree/1.20.x/Common/src/main/java/com/alcatrazescapee/notreepunching
A Minecraft mod which adds a bit of realism to the early game. - alcatrazEscapee/no-tree-punching
I believe this is the correct class https://github.com/alcatrazEscapee/no-tree-punching/blob/1.20.x/Common/src/main/java/com/alcatrazescapee/notreepunching/util/HarvestBlockHandler.java
Do you want them to be unbreakable or just drop nothing?
WHEN NOT USING STONE TOOLS, I'd like it to be unbreakable
I was searching through it but I have no idea how to make something like this:
public final class HarvestBlockHandler
{
public static void setup()
{
for (Block block : BuiltInRegistries.BLOCK)
{
final AbstractBlockAccessor blockAccess = (AbstractBlockAccessor) block;
final BlockBehaviour.Properties settings = blockAccess.getProperties();
// Forcefully set everything to require a tool
// Need to do both the block settings and the block state since the value is copied there for every state
settings.requiresCorrectToolForDrops();
for (BlockState state : block.getStateDefinition().getPossibleStates())
{
((AbstractBlockStateAccessor) state).setRequiresCorrectToolForDrops(true);
}
}
}
But for kubejs
ForgeEvents.onEvent('net.minecraftforge.event.entity.player.PlayerEvent$BreakSpeed', event => {
global.harvestChecker(event)
})
global.harvestChecker = (/** @type {Internal.PlayerEvent$BreakSpeed} */ event) => {
const { entity, state } = event
if (!state.tags.anyMatch(tag => tag.location() == 'minecraft:logs')) return
if (!entity.mainHandItem.hasTag('minecraft:axes')) event.setNewSpeed(0)
}
StartupScripts
you just need to add a new tag to all the axes above stone level
and change the tag in the script
Wdym by new tag? Like ANY new tag or something specific that I have to set in the code you sent
I got it working
@fading charm Dude thank you so much
You've helped me a lot with my KubeJS issues and I really appreciate it🥲
THE FIRST tools are flint tools(from gregtech) in my pack so I didn't have to adda new tags