mirror of
https://codeberg.org/moonleay/Gimble.git
synced 2024-11-22 14:52:50 +00:00
fix: fixed Button being pressed after leaving Visual or Normal mode
parent
7be72ac9d9
commit
00f1c66972
1 changed files with 23 additions and 0 deletions
|
@ -1,9 +1,13 @@
|
||||||
package net.moonleay.mods.gimble.mixin;
|
package net.moonleay.mods.gimble.mixin;
|
||||||
|
|
||||||
import net.minecraft.client.MinecraftClient;
|
import net.minecraft.client.MinecraftClient;
|
||||||
|
import net.minecraft.client.network.ClientPlayerEntity;
|
||||||
|
import net.minecraft.client.option.GameOptions;
|
||||||
import net.moonleay.mods.gimble.client.editor.Editor;
|
import net.moonleay.mods.gimble.client.editor.Editor;
|
||||||
import net.moonleay.mods.gimble.client.editor.modes.Mode;
|
import net.moonleay.mods.gimble.client.editor.modes.Mode;
|
||||||
|
import org.jetbrains.annotations.Nullable;
|
||||||
import org.spongepowered.asm.mixin.Mixin;
|
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.At;
|
||||||
import org.spongepowered.asm.mixin.injection.Inject;
|
import org.spongepowered.asm.mixin.injection.Inject;
|
||||||
import org.spongepowered.asm.mixin.injection.callback.CallbackInfo;
|
import org.spongepowered.asm.mixin.injection.callback.CallbackInfo;
|
||||||
|
@ -11,6 +15,10 @@ import org.spongepowered.asm.mixin.injection.callback.CallbackInfo;
|
||||||
@Mixin(MinecraftClient.class)
|
@Mixin(MinecraftClient.class)
|
||||||
public class NormalModeMixin {
|
public class NormalModeMixin {
|
||||||
|
|
||||||
|
@Shadow
|
||||||
|
@Nullable
|
||||||
|
public GameOptions options;
|
||||||
|
|
||||||
@Inject(method = "openPauseMenu", at = @At("HEAD"), cancellable = true)
|
@Inject(method = "openPauseMenu", at = @At("HEAD"), cancellable = true)
|
||||||
private void setNormalMode(boolean pause, CallbackInfo ci) {
|
private void setNormalMode(boolean pause, CallbackInfo ci) {
|
||||||
if (Editor.INSTANCE.getCURRENT_MODE() != Mode.NORMAL){
|
if (Editor.INSTANCE.getCURRENT_MODE() != Mode.NORMAL){
|
||||||
|
@ -20,4 +28,19 @@ public class NormalModeMixin {
|
||||||
ci.cancel();
|
ci.cancel();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Inject(method = "handleInputEvents", at = @At(value = "INVOKE", target = "Lnet/minecraft/client/network/ClientPlayerEntity;isUsingItem()Z"), cancellable = true)
|
||||||
|
private void blockWorldManipulation(CallbackInfo ci) {
|
||||||
|
if (Editor.INSTANCE.getCURRENT_MODE() == Mode.NORMAL || Editor.INSTANCE.getCURRENT_MODE() == Mode.VISUAL) {
|
||||||
|
while(this.options.attackKey.wasPressed()) {
|
||||||
|
}
|
||||||
|
|
||||||
|
while(this.options.useKey.wasPressed()) {
|
||||||
|
}
|
||||||
|
|
||||||
|
while(this.options.pickItemKey.wasPressed()) {
|
||||||
|
}
|
||||||
|
ci.cancel();
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue