Removed Game Fog (cleaned up AngleViewer code)
All checks were successful
build / build (push) Successful in 1m2s
All checks were successful
build / build (push) Successful in 1m2s
This commit is contained in:
@ -0,0 +1,75 @@
|
||||
package wtf.hak.survivalfabric.features;
|
||||
|
||||
import net.fabricmc.fabric.api.client.event.lifecycle.v1.ClientTickEvents;
|
||||
import net.fabricmc.fabric.api.client.keybinding.v1.KeyBindingHelper;
|
||||
import net.minecraft.client.network.ClientPlayerEntity;
|
||||
import net.minecraft.client.option.KeyBinding;
|
||||
import net.minecraft.client.util.InputUtil;
|
||||
import org.lwjgl.glfw.GLFW;
|
||||
|
||||
import java.util.concurrent.Executors;
|
||||
import java.util.concurrent.ScheduledExecutorService;
|
||||
import java.util.concurrent.TimeUnit;
|
||||
|
||||
public class AngleViewer {
|
||||
|
||||
private static final ScheduledExecutorService scheduler = Executors.newSingleThreadScheduledExecutor();
|
||||
public static boolean PREVENT_HEAD_MOVEMENT = false;
|
||||
|
||||
public static void register() {
|
||||
for(Angle angle : Angle.values()) {
|
||||
KeyBinding keyBinding = KeyBindingHelper.registerKeyBinding(new KeyBinding(
|
||||
"key.survivalfabric." + angle.name().toLowerCase(),
|
||||
InputUtil.Type.KEYSYM,
|
||||
GLFW.GLFW_DONT_CARE,
|
||||
"category.survivalfabric.tpangles"
|
||||
));
|
||||
|
||||
ClientTickEvents.END_CLIENT_TICK.register(mc -> {
|
||||
while (keyBinding.wasPressed()) {
|
||||
ClientPlayerEntity player = mc.player;
|
||||
if(player == null) return;
|
||||
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);
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
public enum Angle {
|
||||
ANGLE0(-65.19f, -54.23f),
|
||||
ANGLE1(-24.86f, -54.23f),
|
||||
ANGLE2(-65.02f, -41.68f),
|
||||
ANGLE3(-25.03f, -41.71f),
|
||||
ANGLE4(24.81f, -54.23f),
|
||||
ANGLE5(65.14f, -54.23f),
|
||||
ANGLE6(24.98f, -41.68f),
|
||||
ANGLE7(64.97f, -41.71f),
|
||||
ANGLE8(114.81f, -54.23f),
|
||||
ANGLE9(155.14f, -54.23f),
|
||||
ANGLE10(114.98f, -41.68f),
|
||||
ANGLE11(154.97f, -41.71f),
|
||||
ANGLE12(204.81f, -54.23f),
|
||||
ANGLE13(245.14f, -54.23f),
|
||||
ANGLE14(204.98f, -41.68f),
|
||||
ANGLE15(244.97f, -41.71f);
|
||||
|
||||
public final float yaw;
|
||||
public final float pitch;
|
||||
|
||||
Angle(float yaw, float pitch) {
|
||||
this.yaw = yaw;
|
||||
this.pitch = pitch;
|
||||
}
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user