Skip to content

Commit

Permalink
fix: no mining cd (#5)
Browse files Browse the repository at this point in the history
* feat: TWEAK_NO_BREAK_BLOCK_CD

* fix
  • Loading branch information
zly2006 authored Jun 22, 2024
1 parent 028b143 commit 54c8563
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,7 @@ public enum FeatureToggle implements IHotkeyTogglable, IConfigNotifiable<IConfig
TWEAK_LAVA_VISIBILITY ("tweakLavaVisibility", false, "", "If enabled, then the level of Respiration and Aqua Affinity enchantments,\nand having the Fire Resistance effect active,\nwill greatly increase the visibility under lava."),
TWEAK_MAP_PREVIEW ("tweakMapPreview", false, "", "If enabled, then holding shift over maps in an inventory\nwill render a preview of the map"),
TWEAK_MOVEMENT_KEYS ("tweakMovementKeysLast", false, "", "If enabled, then opposite movement keys won't cancel each other,\nbut instead the last pressed key is the active input."),
TWEAK_NO_BREAK_BLOCK_CD ("tweakNoBreakBlockCooldown", false, "", "Disables the block breaking cooldown"),
TWEAK_PERIODIC_ATTACK ("tweakPeriodicAttack", false, "", "Enables periodic attacks (left clicks)\nConfigure the interval in Generic -> periodicAttackInterval"),
TWEAK_PERIODIC_USE ("tweakPeriodicUse", false, "", "Enables periodic uses (right clicks)\nConfigure the interval in Generic -> periodicUseInterval"),
TWEAK_PERIODIC_HOLD_ATTACK ("tweakPeriodicHoldAttack", false, "", "Enables periodically holding attack for a configurable amount of time.\nConfigure the interval in Generic -> periodicHoldAttackInterval\nand the duration in periodicHoldAttackDuration\n§6Note: You should not use the normal hold attack\n§6or the periodic attack at the same time"),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,8 @@ public abstract class MixinClientPlayerInteractionManager
{
@Shadow @Final private MinecraftClient client;

@Shadow private int blockBreakingCooldown;

@Inject(method = "interactItem", at = @At(
value = "INVOKE",
target = "Lnet/minecraft/client/network/ClientPlayerInteractionManager;syncSelectedSlot()V"),
Expand Down Expand Up @@ -148,6 +150,11 @@ private void handleBreakingRestriction1(BlockPos pos, Direction side, CallbackIn
@Inject(method = "updateBlockBreakingProgress", at = @At("HEAD"), cancellable = true) // MCP: onPlayerDamageBlock
private void handleBreakingRestriction2(BlockPos pos, Direction side, CallbackInfoReturnable<Boolean> cir)
{
if (FeatureToggle.TWEAK_NO_BREAK_BLOCK_CD.getBooleanValue())
{
blockBreakingCooldown = 0;
}

if (CameraUtils.shouldPreventPlayerInputs() ||
PlacementTweaks.isPositionAllowedByBreakingRestriction(pos, side) == false)
{
Expand Down

0 comments on commit 54c8563

Please sign in to comment.