Class MiningManager
MinePhase for the slot model).
Requests. breakAt(MineRequest) asks for a break right now and reports
whether the pipeline took it; queue(MineRequest) guarantees eventual mining by
parking the block in this manager's own queue, which feeds the pipeline as slots free up.
This queue is independent of SilentMine's user-facing Queue setting group: it works with
that toggle off, and it deliberately ignores the user's block whitelist/blacklist — if a
plugin says mine this block, we mine it. The SilentMine module itself must still be
enabled for any packets to go out; while it is off (or mining is paused) the queue simply holds.
Ownership. Tag requests with MineRequest.owner(String) (normally the
plugin id): cancelAllFrom(String) then drops every claim in one call — active
slots, pending selects, and queued blocks — which plugins should do on unload.
Events. The pipeline posts MineStartEvent, MineBreakEvent and
RebreakArmedEvent on the EventBus as blocks move through it.
All methods must be called from the client main thread, except the pause family, which is safe from any thread.
-
Method Summary
Modifier and TypeMethodDescriptionbooleanabortRebreakAt(net.minecraft.core.BlockPos pos) Drops the rebreak slot if it is claimed atpos.booleanbreakAt(MineRequest request) Requests an immediate break.booleanbreakAt(net.minecraft.core.BlockPos pos) breakAt(MineRequest)with defaults: auto face, NORMAL priority, no owner.booleancanBreakAt(net.minecraft.core.BlockPos pos) True when a break request forposcould be attempted right now: module active, not paused, block breakable and in range.booleancancel(net.minecraft.core.BlockPos pos) Cancels whatever the pipeline holds atpos— active slot, pending select, or queued block (both this manager's queue and SilentMine's own).voidCancels everything: both slots, pending selects, and all queues.voidcancelAllFrom(String owner) Cancels every claim tagged withowner— active slots, pending selects, queued blocks — and releases the owner's pause token.booleanDrops the armed rebreak (a block already mined out, held to pop anything re-placed there), whoever owns it.voidDrops the armed rebreak / double-mine block unconditionally.booleancanInstaBreak(net.minecraft.core.BlockPos pos) True whenposbreaks in a single action with the best hotbar tool right now.voidEmpties this manager's queue.voidclearQueue(String owner) Removes every queued block tagged withowner.The block in the active/secondary slot, pre-break.doubleThe double-mine threshold setting (0.0–1.0) — the progress at which the active block is finished.static MiningManagerget()getQueue()Ordered snapshot of this manager's queue (feed order: priority desc, then FIFO).voidinit()Register event handlers.intinstaMineBatch(List<net.minecraft.core.BlockPos> positions) Bulk fast path: breaks the insta-breakable blocks amongpositionswith self-contained packet bursts, without occupying the mining slots.intinstaMineBatch(List<net.minecraft.core.BlockPos> positions, boolean aim) instaMineBatch(List); withoutaimno look goes out ahead of a burst.booleanTrue while any caller suppresses the dig look (suppressAim(java.lang.String, boolean)).booleanTrue when the SilentMine module is enabled, the player is in a world, and not in creative.booleanisMining()True if the pipeline is mining or tracking any block.booleanisMining(net.minecraft.core.BlockPos pos) True if the pipeline is mining or tracking the given position.booleanisPaused()True while any pause token is held.booleanisQueued(net.minecraft.core.BlockPos pos) True ifposwaits in this manager's queue.booleanisRebreak(net.minecraft.core.BlockPos pos) True ifposis the armed rebreak target.booleanTrue when mining needs ownership of the held slot for a tool swap.voidPauses all mining under the given token: no dig packets go out, no new blocks are claimed, and break requests are refused until every token is released.primary()The block in the primary slot.doubleprogressAt(net.minecraft.core.BlockPos pos) Break progress (0.0–1.0) of whichever slot trackspos, or -1 when no slot holds it.booleanqueue(MineRequest request) Adds the block to this manager's queue; it feeds into the pipeline as slots free up, highest priority first, FIFO among equals.booleanqueue(net.minecraft.core.BlockPos pos) queue(MineRequest)with defaults: auto face, NORMAL priority, no owner.voidqueueAll(Collection<net.minecraft.core.BlockPos> positions, BreakPriority priority, String owner) Adds every position to the queue with the given request template applied per block.intThe number of blocks waiting in this manager's queue.doublerange()The configured mining range in blocks.rebreak()The armed rebreak.voidsuppressAim(String token, boolean suppress) While any caller holds it, every dig goes out without SilentMine's look ahead of it.voidReleases the given pause token.booleanunqueue(net.minecraft.core.BlockPos pos) Removesposfrom this manager's queue (does not touch active slots — seecancel(net.minecraft.core.BlockPos)).booleanwouldInstaBreakOnGround(net.minecraft.core.BlockPos pos) True whenposwould insta-break once grounded, regardless of the current airborne state.
-
Method Details
-
get
-
init
public void init()Register event handlers. Call once during mod init. -
pause
Pauses all mining under the given token: no dig packets go out, no new blocks are claimed, and break requests are refused until every token is released. Tokens from different callers stack, so two plugins pausing don't fight over one flag. Queue contents survive a pause. Server-side break timers keep aging regardless — blocks mid-mine resume at least as far along as they left off.- Parameters:
token- pause identity, normally the plugin id; releasing requires the same token
-
unpause
Releases the given pause token. Mining resumes once no tokens remain. -
isPaused
public boolean isPaused()True while any pause token is held. -
suppressAim
While any caller holds it, every dig goes out without SilentMine's look ahead of it. The look is a movement packet of its own: for a player who walks while mining it is a second movement that tick, and a dig behind it lands after a movement packet, which Grim sets back or flags (Simulation, Timer, TickTimer on 1.21.2+, Post). The look only serves RotationBreak, which is experimental. Token-based likepause(java.lang.String). -
isAimSuppressed
public boolean isAimSuppressed()True while any caller suppresses the dig look (suppressAim(java.lang.String, boolean)). -
breakAt
public boolean breakAt(net.minecraft.core.BlockPos pos) breakAt(MineRequest)with defaults: auto face, NORMAL priority, no owner. -
breakAt
Requests an immediate break. The pipeline may refuse — both slots busy, out of range, paused, module disabled, creative — in which case nothing is scheduled andfalseis returned; usequeue(MineRequest)when the block must eventually be mined.- Returns:
- true when the pipeline took the request (block is now mining, pending selection, or was insta-broken)
-
canBreakAt
public boolean canBreakAt(net.minecraft.core.BlockPos pos) True when a break request forposcould be attempted right now: module active, not paused, block breakable and in range. -
canInstaBreak
public boolean canInstaBreak(net.minecraft.core.BlockPos pos) True whenposbreaks in a single action with the best hotbar tool right now. -
wouldInstaBreakOnGround
public boolean wouldInstaBreakOnGround(net.minecraft.core.BlockPos pos) True whenposwould insta-break once grounded, regardless of the current airborne state. -
instaMineBatch
Bulk fast path: breaks the insta-breakable blocks amongpositionswith self-contained packet bursts, without occupying the mining slots. How many go out per tick is set by AntiCheat's packet limits. Returns the number of blocks broken this call — callers re-feed remaining positions each tick. -
instaMineBatch
instaMineBatch(List); withoutaimno look goes out ahead of a burst. The look is a movement packet of its own, so a caller that walks while it mines passes false: a second movement in a tick is set back by Grim. -
isAvailable
public boolean isAvailable()True when the SilentMine module is enabled, the player is in a world, and not in creative. -
isMining
public boolean isMining()True if the pipeline is mining or tracking any block. -
isMining
public boolean isMining(net.minecraft.core.BlockPos pos) True if the pipeline is mining or tracking the given position. -
The block in the primary slot.
-
doubleMine
The block in the active/secondary slot, pre-break. -
rebreak
The armed rebreak. -
isRebreak
public boolean isRebreak(net.minecraft.core.BlockPos pos) True ifposis the armed rebreak target. Placers must not place here withoutabortRebreakAt(net.minecraft.core.BlockPos). -
progressAt
public double progressAt(net.minecraft.core.BlockPos pos) Break progress (0.0–1.0) of whichever slot trackspos, or -1 when no slot holds it. An armed rebreak reports 1.0. -
range
public double range()The configured mining range in blocks. -
doubleMineThreshold
public double doubleMineThreshold()The double-mine threshold setting (0.0–1.0) — the progress at which the active block is finished. -
needsToolSwap
public boolean needsToolSwap()True when mining needs ownership of the held slot for a tool swap. The SERVER holds the tool during that window, so raw-packet attackers must hold their swing or the hit lands with the tool. -
cancel
public boolean cancel(net.minecraft.core.BlockPos pos) Cancels whatever the pipeline holds atpos— active slot, pending select, or queued block (both this manager's queue and SilentMine's own).- Returns:
- true when anything was cancelled
-
cancelRebreak
public void cancelRebreak()Drops the armed rebreak / double-mine block unconditionally. -
cancelArmedRebreak
public boolean cancelArmedRebreak()Drops the armed rebreak (a block already mined out, held to pop anything re-placed there), whoever owns it. A double-mine block still aging and the primary keep mining, and nothing is sent. Call every tick while clearing a way block after block, so an armed rebreak never holds the slot against the next block.- Returns:
- true if a rebreak was dropped
-
abortRebreakAt
public boolean abortRebreakAt(net.minecraft.core.BlockPos pos) Drops the rebreak slot if it is claimed atpos. Call before placing a block there, or the placement is instantly rebroken out from under you. Whenposis already mined out (air), every other hold there is released as well — the primary slot, pending selects, and queued blocks — so the block you place isn't re-queued and mined again as soon as it lands.- Returns:
- true if any claim was dropped
-
cancelAll
public void cancelAll()Cancels everything: both slots, pending selects, and all queues. -
cancelAllFrom
Cancels every claim tagged withowner— active slots, pending selects, queued blocks — and releases the owner's pause token. Plugins should call this on unload. -
queue
public boolean queue(net.minecraft.core.BlockPos pos) queue(MineRequest)with defaults: auto face, NORMAL priority, no owner. -
queue
Adds the block to this manager's queue; it feeds into the pipeline as slots free up, highest priority first, FIFO among equals. UnlikebreakAt(net.minecraft.core.BlockPos), queued blocks survive busy slots, pauses, and the module being toggled — they hold until minable. Out-of-range blocks stay queued until the player walks into range; only broken or unbreakable blocks are pruned. Re-queueing a queued position refreshes its priority (upward only) and keeps its place in line.- Returns:
- true when the block is now queued (or already actively mining)
-
queueAll
public void queueAll(Collection<net.minecraft.core.BlockPos> positions, BreakPriority priority, String owner) Adds every position to the queue with the given request template applied per block. -
unqueue
public boolean unqueue(net.minecraft.core.BlockPos pos) Removesposfrom this manager's queue (does not touch active slots — seecancel(net.minecraft.core.BlockPos)). -
isQueued
public boolean isQueued(net.minecraft.core.BlockPos pos) True ifposwaits in this manager's queue. -
queueSize
public int queueSize()The number of blocks waiting in this manager's queue. -
clearQueue
public void clearQueue()Empties this manager's queue. Active slots are untouched. -
clearQueue
Removes every queued block tagged withowner. -
getQueue
Ordered snapshot of this manager's queue (feed order: priority desc, then FIFO).
-