feat: added Bulldozer Modifier

This commit is contained in:
moonleay 2024-04-27 04:25:07 +02:00
parent 5bd5e48f0d
commit 7ab5a7c72f
Signed by: moonleay
GPG key ID: 82667543CCD715FB
4 changed files with 64 additions and 1 deletions

View file

@ -13,7 +13,7 @@ This project aims to improve the experience of creating structures in Minecraft.
- **Replace** Replace blocks in the world [x]
## Modifiers
- **Bulldozer** Basically an auto-clicker
- **Bulldozer** Basically an auto-clicker [x]
- **Force Place** Ignore block placing restrictions [x]
- **No Clip** Walk and fly through blocks [x]
- **No Updates** Prevent block updates [x]

View file

@ -0,0 +1,35 @@
package net.moonleay.gimble.mixin;
import net.minecraft.client.MinecraftClient;
import net.moonleay.gimble.client.editor.ClientEditor;
import net.moonleay.gimble.editor.state.mode.ModeModifier;
import org.spongepowered.asm.mixin.Mixin;
import org.spongepowered.asm.mixin.Shadow;
import org.spongepowered.asm.mixin.injection.At;
import org.spongepowered.asm.mixin.injection.Inject;
import org.spongepowered.asm.mixin.injection.callback.CallbackInfo;
import org.spongepowered.asm.mixin.injection.callback.CallbackInfoReturnable;
@Mixin(MinecraftClient.class)
public abstract class BulldozerMixin {
@Shadow protected int attackCooldown;
@Inject(method = "doAttack", at = @At(value = "HEAD"))
private void func(CallbackInfoReturnable<Boolean> cir) {
if (!ClientEditor.INSTANCE.containsModifier(ModeModifier.BULLDOZER)){
return;
}
this.attackCooldown = 0;
}
@Inject(method = "handleBlockBreaking", at = @At(value = "HEAD"))
private void func2(boolean breaking, CallbackInfo ci) {
if (!ClientEditor.INSTANCE.containsModifier(ModeModifier.BULLDOZER) || !breaking){
return;
}
this.attackCooldown = 0;
}
}

View file

@ -0,0 +1,26 @@
package net.moonleay.gimble.mixin;
import net.minecraft.client.network.ClientPlayerInteractionManager;
import net.minecraft.util.math.BlockPos;
import net.minecraft.util.math.Direction;
import net.moonleay.gimble.client.editor.ClientEditor;
import net.moonleay.gimble.editor.state.mode.ModeModifier;
import org.spongepowered.asm.mixin.Mixin;
import org.spongepowered.asm.mixin.Shadow;
import org.spongepowered.asm.mixin.injection.At;
import org.spongepowered.asm.mixin.injection.Inject;
import org.spongepowered.asm.mixin.injection.callback.CallbackInfoReturnable;
@Mixin(ClientPlayerInteractionManager.class)
public class BulldozerMixin2 {
@Shadow private int blockBreakingCooldown;
@Inject(method = "updateBlockBreakingProgress", at = @At("HEAD"))
private void func(BlockPos pos, Direction direction, CallbackInfoReturnable<Boolean> cir) {
if (!ClientEditor.INSTANCE.containsModifier(ModeModifier.BULLDOZER)) {
return;
}
this.blockBreakingCooldown = 0;
}
}

View file

@ -9,6 +9,8 @@
"NoClipMixin"
],
"client": [
"BulldozerMixin",
"BulldozerMixin2",
"HudMixin",
"NoClipCameraFixMixin",
"NormalModeMixin",