Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: no mining cd #5

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading