forked from toxicity188/BetterModel
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathMountControllers.java
More file actions
84 lines (79 loc) · 2.06 KB
/
MountControllers.java
File metadata and controls
84 lines (79 loc) · 2.06 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
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
/**
* This source file is part of BetterModel.
* Copyright (c) 2024–2025 toxicity188
* Licensed under the MIT License.
* See LICENSE.md file for full license text.
*/
package kr.toxicity.model.api.mount;
import org.bukkit.entity.LivingEntity;
import org.bukkit.entity.Player;
import org.jetbrains.annotations.NotNull;
import org.joml.Vector3f;
/**
* Builtin mount controllers
*/
public enum MountControllers implements MountController {
/**
* Invalid
*/
INVALID {
@NotNull
@Override
public Vector3f move(@NotNull Player player, @NotNull LivingEntity entity, @NotNull Vector3f input, @NotNull Vector3f travelVector) {
return new Vector3f();
}
@Override
public boolean canMount() {
return false;
}
},
/**
* None
*/
NONE {
@NotNull
@Override
public Vector3f move(@NotNull Player player, @NotNull LivingEntity entity, @NotNull Vector3f input, @NotNull Vector3f travelVector) {
return new Vector3f();
}
@Override
public boolean canControl() {
return false;
}
},
/**
* Walk
*/
WALK {
@NotNull
@Override
public Vector3f move(@NotNull Player player, @NotNull LivingEntity entity, @NotNull Vector3f input, @NotNull Vector3f travelVector) {
input.normalize();
input.y = 0;
input.x = input.x * 0.5F;
if (input.z <= 0.0F) {
input.z *= 0.25F;
}
return input;
}
},
/**
* Fly
*/
FLY {
@NotNull
@Override
public Vector3f move(@NotNull Player player, @NotNull LivingEntity entity, @NotNull Vector3f input, @NotNull Vector3f travelVector) {
input.normalize();
input.x = input.x * 0.5F;
if (input.z <= 0.0F) {
input.z *= 0.25F;
}
return input;
}
@Override
public boolean canFly() {
return true;
}
}
}