Skip to content

block/item: Give swords and shears per-block mining speeds - #1440

Open
HashimTheArab wants to merge 1 commit into
df-mc:masterfrom
HashimTheArab:feat/sword-shears-mining-speed
Open

block/item: Give swords and shears per-block mining speeds#1440
HashimTheArab wants to merge 1 commit into
df-mc:masterfrom
HashimTheArab:feat/sword-shears-mining-speed

Conversation

@HashimTheArab

Copy link
Copy Markdown
Collaborator

Swords and shears each return a single number for every block: 1.5 from shears, and 1.5 from a sword except on cobweb. Bedrock decides their speed from the block instead — neither tool has a tier speed of its own the way a pickaxe does.

Shears

Bedrock sorts blocks into three tiers for shears:

speed blocks
15 cobweb, leaves
5 wool
2 vines

Everything else is 1. So shearing wool was more than three times too slow, and cutting leaves or cobweb ten times too slow. minecraft.wiki lists the same numbers under Bedrock breaking speed ("Wool: 5, Leaves: 15, Cobweb: 15").

Swords

15 on cobweb, 30 on bamboo and bamboo saplings, and 1.5 on leaves, vines, moss carpet, pumpkins, melons and cocoa. Everything else is 1 — a sword is no faster than a bare hand on stone.

Only cobweb reached that before. The speed is gated on the block naming the tool effective in its BreakInfo, and no block other than cobweb named a sword, so the old 1.5 default was unreachable everywhere else.

Shape

BaseMiningEfficiency asks the block, through two new interfaces:

type SwordMineable interface{ SwordMiningSpeed() float64 }
type ShearsMineable interface{ ShearsMiningSpeed() float64 }

That keeps the numbers next to the block that owns them, alongside its hardness and harvestability, and leaves BreakDuration untouched. The blocks that answer also name the tool in their Effective predicate, which is what that predicate already means — "can be mined more effectively with the tool passed than with an empty hand" — and is true of a sword on leaves.

anyEffective is a small combinator for the blocks that now have two tool types, replacing the hand-written closures.

The resulting times line up with those published for Bedrock: wool with shears 0.25s, cobweb with shears 0.4s, leaves with shears 0.05s, leaves with a sword 0.2s against 0.3s bare-handed, and a pumpkin with a sword 1s.

Not covered

Glow lichen, chorus plant, chorus flower and big dripleaf also take 1.5 from a sword in Bedrock. There are no such blocks yet, so there is nothing to hang the method on.

Both tools returned one number for every block: 1.5 from shears, and 1.5
from a sword except on cobweb. Bedrock decides their speed from the block
instead, and neither has a tier speed of its own.

Shears get 15 on leaves and cobweb, 5 on wool and 2 on vines, so shearing
wool was over three times too slow and cutting leaves or cobweb ten times
too slow. A sword gets 15 on cobweb, 30 on bamboo and 1.5 on leaves,
vines, moss carpet, pumpkins, melons and cocoa. Only cobweb reached it
before, since the speed is gated on the block naming the tool effective
and no other block named a sword.

BaseMiningEfficiency now asks the block through SwordMineable and
ShearsMineable, and the blocks that answer name the tool in Effective too.

Glow lichen, chorus plant, chorus flower and big dripleaf also take 1.5
from a sword and are left out until those blocks exist.
@HashimTheArab
HashimTheArab force-pushed the feat/sword-shears-mining-speed branch from 971cff9 to deeb9b4 Compare August 17, 2026 17:12
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants