mirror of
https://codeberg.org/moonleay/Gimbal.git
synced 2025-04-04 11:44:13 +02:00
34 lines
1.2 KiB
Java
34 lines
1.2 KiB
Java
package net.moonleay.gimble.mixin;
|
|
|
|
import net.minecraft.client.MinecraftClient;
|
|
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.Capability;
|
|
import org.spongepowered.asm.mixin.Final;
|
|
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;
|
|
|
|
import java.util.Objects;
|
|
|
|
@Mixin(ClientPlayerInteractionManager.class)
|
|
public class BulldozerMixin2 {
|
|
|
|
@Shadow private int blockBreakingCooldown;
|
|
|
|
@Shadow
|
|
@Final
|
|
private MinecraftClient client;
|
|
|
|
@Inject(method = "updateBlockBreakingProgress", at = @At("HEAD"))
|
|
private void func(BlockPos pos, Direction direction, CallbackInfoReturnable<Boolean> cir) {
|
|
if (!ClientEditor.INSTANCE.shouldClient(Capability.BULLDOZER) || !Objects.requireNonNull(this.client.player).isCreative()) {
|
|
return;
|
|
}
|
|
this.blockBreakingCooldown = 0;
|
|
}
|
|
}
|