blob: 3d442d58e10b1a02f0a03dd5e69d57609711ff03 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
|
package io.github.moulberry.notenoughupdates.mixins;
import io.github.moulberry.notenoughupdates.NEUEventListener;
import net.minecraft.util.MouseHelper;
import org.lwjgl.input.Mouse;
import org.spongepowered.asm.mixin.Mixin;
import org.spongepowered.asm.mixin.injection.At;
import org.spongepowered.asm.mixin.injection.Inject;
import org.spongepowered.asm.mixin.injection.callback.CallbackInfo;
@Mixin(MouseHelper.class)
public class MixinMouseHelper {
@Inject(method = { "ungrabMouseCursor" }, at = { @At("HEAD") }, cancellable = true)
public void ungrabMouseCursor(final CallbackInfo ci) {
if (System.currentTimeMillis() - NEUEventListener.lastGuiClosed < 150L) {
ci.cancel();
Mouse.setGrabbed(false);
}
}
}
|