Made head movement locked while "angle viewing"
All checks were successful
build / build (push) Successful in 1m6s
All checks were successful
build / build (push) Successful in 1m6s
This commit is contained in:
@ -14,6 +14,7 @@ import java.util.concurrent.TimeUnit;
|
||||
public class AngleViewHandler {
|
||||
|
||||
private static final ScheduledExecutorService scheduler = Executors.newSingleThreadScheduledExecutor();
|
||||
public static boolean PREVENT_HEAD_MOVEMENT = false;
|
||||
|
||||
public static void registerKeybindings() {
|
||||
for(Angle angle : Angle.values()) {
|
||||
@ -31,9 +32,14 @@ public class AngleViewHandler {
|
||||
player.setYaw(angle.yaw);
|
||||
player.setPitch(angle.pitch);
|
||||
|
||||
PREVENT_HEAD_MOVEMENT = true;
|
||||
|
||||
scheduler.schedule(() -> {
|
||||
if(player == null) return;
|
||||
PREVENT_HEAD_MOVEMENT = false;
|
||||
player.setPitch(-90);
|
||||
PREVENT_HEAD_MOVEMENT = true;
|
||||
scheduler.schedule(() -> PREVENT_HEAD_MOVEMENT = false, 1500, TimeUnit.MILLISECONDS);
|
||||
}, 1500, TimeUnit.MILLISECONDS);
|
||||
}
|
||||
});
|
||||
|
Reference in New Issue
Block a user