blob: ff71ad1ed1f13015b82b97bab0092b4c41dfc81b (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
|
package io.github.moulberry.notenoughupdates.mixins;
import io.github.moulberry.notenoughupdates.listener.RenderListener;
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() - RenderListener.lastGuiClosed < 150L) {
ci.cancel();
Mouse.setGrabbed(false);
}
}
}
|