forked from isXander/Controlify
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathGyroComponent.java
More file actions
55 lines (40 loc) · 1.63 KB
/
Copy pathGyroComponent.java
File metadata and controls
55 lines (40 loc) · 1.63 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
package dev.isxander.controlify.controller.gyro;
import dev.isxander.controlify.controller.serialization.ConfigClass;
import dev.isxander.controlify.controller.serialization.ConfigHolder;
import dev.isxander.controlify.controller.ECSComponent;
import dev.isxander.controlify.controller.serialization.IConfig;
import dev.isxander.controlify.controller.impl.ConfigImpl;
import dev.isxander.controlify.utils.CUtil;
import net.minecraft.resources.ResourceLocation;
public class GyroComponent implements ECSComponent, ConfigHolder<GyroComponent.Config> {
public static final ResourceLocation ID = CUtil.rl("gyro");
private GyroStateC gyroState = GyroStateC.ZERO;
private final IConfig<Config> config = new ConfigImpl<>(Config::new, Config.class);
public GyroStateC getState() {
return this.gyroState;
}
public void setState(GyroStateC state) {
this.gyroState = state;
}
@Override
public IConfig<Config> config() {
return this.config;
}
@Override
public ResourceLocation id() {
return ID;
}
public static class Config implements ConfigClass {
public boolean calibrated = false;
public boolean delayedCalibration = false;
public float lookSensitivity = 0f;
public boolean relativeGyroMode = false;
public GyroButtonMode requiresButton = GyroButtonMode.ON;
public GyroYawMode yawMode = GyroYawMode.YAW;
public boolean flickStick = false;
public int flickAnimationTicks = 8;
public boolean invertX = false;
public boolean invertY = false;
public GyroState calibration = new GyroState();
}
}