From 7528cd207b33efac9ad7723c7d0054eed4674cbf Mon Sep 17 00:00:00 2001 From: atferrys <61624086+atferrys@users.noreply.github.com> Date: Thu, 13 Aug 2026 18:35:19 +0200 Subject: [PATCH] Implement Fast Fly Block Breaking tweak --- README.md | 1 + .../universaltweaks/config/UTConfigTweaks.java | 5 +++++ .../universaltweaks/core/UTLoadingPlugin.java | 1 + .../mixin/UTDigSpeedEntityPlayerMixin.java | 18 ++++++++++++++++++ .../util/compat/UTObsoleteModsHandler.java | 1 + .../mixins.blocks.fastflyblockbreaking.json | 7 +++++++ 6 files changed, 33 insertions(+) create mode 100644 src/main/java/mod/acgaming/universaltweaks/tweaks/blocks/fastflyblockbreaking/mixin/UTDigSpeedEntityPlayerMixin.java create mode 100644 src/main/resources/mixins/tweaks/mixins.blocks.fastflyblockbreaking.json diff --git a/README.md b/README.md index f36a1069..73a1f93a 100644 --- a/README.md +++ b/README.md @@ -209,6 +209,7 @@ Available in flavors [**Cleanroom**](https://www.curseforge.com/minecraft/modpac * **Explosion Block Drop Chance:** Determines the numerator of the block drop formula on explosions * **Falling Block Lifespan:** Determines how long falling blocks remain in ticks until they are dropped under normal circumstances * **Fast Dye Blending:** Replaces color lookup for sheep to check a predefined table rather than querying the recipe registry +* **Fast Fly Block Breaking:** Allows breaking blocks with normal speed while flying * **Fast Leaf Decay:** Makes leaves decay faster when trees are chopped * **Fast Prefix Checking:** Optimizes Forge's ID prefix checking and removes prefix warnings impacting load time * **Fast World Loading:** Skips garbage collection to speed up world loading diff --git a/src/main/java/mod/acgaming/universaltweaks/config/UTConfigTweaks.java b/src/main/java/mod/acgaming/universaltweaks/config/UTConfigTweaks.java index 395ec70e..d65ef165 100644 --- a/src/main/java/mod/acgaming/universaltweaks/config/UTConfigTweaks.java +++ b/src/main/java/mod/acgaming/universaltweaks/config/UTConfigTweaks.java @@ -195,6 +195,11 @@ public static class BlocksCategory @Config.Comment("Sets the delay in ticks between breaking blocks") public int utBlockHitDelay = 5; + @Config.RequiresMcRestart + @Config.Name("Fast Fly Block Breaking") + @Config.Comment("Allows breaking blocks with normal speed while flying") + public boolean utFastFlyBlockBreakingToggle = false; + @Config.RequiresMcRestart @Config.Name("Cactus Size") @Config.Comment("Determines how tall cacti can grow") diff --git a/src/main/java/mod/acgaming/universaltweaks/core/UTLoadingPlugin.java b/src/main/java/mod/acgaming/universaltweaks/core/UTLoadingPlugin.java index 35e4c93f..7a5cbf81 100644 --- a/src/main/java/mod/acgaming/universaltweaks/core/UTLoadingPlugin.java +++ b/src/main/java/mod/acgaming/universaltweaks/core/UTLoadingPlugin.java @@ -109,6 +109,7 @@ public class UTLoadingPlugin implements IFMLLoadingPlugin, IEarlyMixinLoader put("mixins/tweaks/mixins.blocks.endportal.json", c -> UTConfigTweaks.BLOCKS.utRenderEndPortalBottom); put("mixins/tweaks/mixins.blocks.explosion.json", c -> UTConfigTweaks.BLOCKS.utExplosionDropChance != 1.0D); put("mixins/tweaks/mixins.blocks.falling.json", c -> UTConfigTweaks.BLOCKS.utFallingBlockLifespan != 600); + put("mixins/tweaks/mixins.blocks.fastflyblockbreaking.json", c -> UTConfigTweaks.BLOCKS.utFastFlyBlockBreakingToggle); put("mixins/tweaks/mixins.blocks.fencegateplacing.json", c -> UTConfigTweaks.BLOCKS.utUnsupportedFenceGatePlacing); put("mixins/tweaks/mixins.blocks.golemstructure.json", c -> UTConfigTweaks.ENTITIES.utGolemPlacement); put("mixins/tweaks/mixins.blocks.growthsize.json", c -> UTConfigTweaks.BLOCKS.utCactusSize != 3 && UTConfigTweaks.BLOCKS.utSugarCaneSize != 3 && UTConfigTweaks.BLOCKS.utVineSize != 0); diff --git a/src/main/java/mod/acgaming/universaltweaks/tweaks/blocks/fastflyblockbreaking/mixin/UTDigSpeedEntityPlayerMixin.java b/src/main/java/mod/acgaming/universaltweaks/tweaks/blocks/fastflyblockbreaking/mixin/UTDigSpeedEntityPlayerMixin.java new file mode 100644 index 00000000..eeaf1c09 --- /dev/null +++ b/src/main/java/mod/acgaming/universaltweaks/tweaks/blocks/fastflyblockbreaking/mixin/UTDigSpeedEntityPlayerMixin.java @@ -0,0 +1,18 @@ +package mod.acgaming.universaltweaks.tweaks.blocks.fastflyblockbreaking.mixin; + +import net.minecraft.entity.player.EntityPlayer; + +import com.llamalad7.mixinextras.injector.ModifyExpressionValue; +import org.objectweb.asm.Opcodes; +import org.spongepowered.asm.mixin.Mixin; +import org.spongepowered.asm.mixin.injection.At; + +@Mixin(EntityPlayer.class) +public class UTDigSpeedEntityPlayerMixin +{ + @ModifyExpressionValue(method = "getDigSpeed(Lnet/minecraft/block/state/IBlockState;Lnet/minecraft/util/math/BlockPos;)F", at = @At(value = "FIELD", target = "Lnet/minecraft/entity/player/EntityPlayer;onGround:Z", opcode = Opcodes.GETFIELD, ordinal = 0)) + private boolean utCancelFlyPenalty(boolean original) + { + return true; + } +} diff --git a/src/main/java/mod/acgaming/universaltweaks/util/compat/UTObsoleteModsHandler.java b/src/main/java/mod/acgaming/universaltweaks/util/compat/UTObsoleteModsHandler.java index 04728e84..71595ac5 100644 --- a/src/main/java/mod/acgaming/universaltweaks/util/compat/UTObsoleteModsHandler.java +++ b/src/main/java/mod/acgaming/universaltweaks/util/compat/UTObsoleteModsHandler.java @@ -173,6 +173,7 @@ public class UTObsoleteModsHandler put("unridekeybind", () -> UTConfigTweaks.MISC.utUseSeparateDismountKey); put("voidfog", () -> UTConfigTweaks.WORLD.VOID_FOG.utVoidFogToggle); put("watercontrolextreme", () -> UTConfigTweaks.BLOCKS.FINITE_WATER.utFiniteWaterToggle); + put("fastflyblockbreaking", () -> UTConfigTweaks.BLOCKS.utFastFlyBlockBreakingToggle); } put("bedpatch", () -> true); // Fix integrated in Forge 14.23.2.2643 (#4784) diff --git a/src/main/resources/mixins/tweaks/mixins.blocks.fastflyblockbreaking.json b/src/main/resources/mixins/tweaks/mixins.blocks.fastflyblockbreaking.json new file mode 100644 index 00000000..9cf55a3a --- /dev/null +++ b/src/main/resources/mixins/tweaks/mixins.blocks.fastflyblockbreaking.json @@ -0,0 +1,7 @@ +{ + "package": "mod.acgaming.universaltweaks.tweaks.blocks.fastflyblockbreaking.mixin", + "refmap": "universaltweaks.refmap.json", + "minVersion": "0.8", + "compatibilityLevel": "JAVA_8", + "mixins": ["UTDigSpeedEntityPlayerMixin"] +} \ No newline at end of file