Skip to content

Commit 7caf133

Browse files
committed
feat: HypixelPosition and Rays
1 parent 5a9f8ba commit 7caf133

File tree

197 files changed

+2552
-1149
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

197 files changed

+2552
-1149
lines changed
Lines changed: 5 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,10 @@
11
package net.swofty.commons;
22

3+
import lombok.Getter;
4+
import lombok.Setter;
5+
6+
@Setter
7+
@Getter
38
public class Tuple<A, B> {
49
private A key;
510
private B value;
@@ -9,19 +14,4 @@ public Tuple(A key, B value) {
914
this.value = value;
1015
}
1116

12-
public void setKey(A key) {
13-
this.key = key;
14-
}
15-
16-
public void setValue(B value) {
17-
this.value = value;
18-
}
19-
20-
public A getKey() {
21-
return key;
22-
}
23-
24-
public B getValue() {
25-
return value;
26-
}
2717
}

commons/src/main/java/net/swofty/commons/bedwars/map/BedWarsMapsConfig.java

Lines changed: 8 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
import lombok.Getter;
44
import lombok.Setter;
55
import net.swofty.commons.bedwars.BedWarsGameType;
6+
import net.swofty.commons.mc.HypixelPosition;
67

78
import java.util.List;
89
import java.util.Map;
@@ -33,8 +34,8 @@ public static class MapConfiguration {
3334
@Getter
3435
@Setter
3536
public static class MapLocations {
36-
private Position waiting;
37-
private Position spectator;
37+
private HypixelPosition waiting;
38+
private HypixelPosition spectator;
3839
}
3940

4041
@Getter
@@ -51,19 +52,13 @@ public static class MapBounds {
5152
public static class GlobalGenerator {
5253
private int amount;
5354
private int max;
54-
private List<Position> locations;
55+
private List<HypixelPosition> locations;
5556
}
5657

5758
}
5859
}
5960

60-
public record Position(double x, double y, double z) {
61-
}
62-
63-
public record PitchYawPosition(double x, double y, double z, float pitch, float yaw) {
64-
}
65-
66-
public record TwoBlockPosition(Position feet, Position head) {
61+
public record TwoBlockPosition(HypixelPosition feet, HypixelPosition head) {
6762
}
6863

6964
public record MinMax(double min, double max) {
@@ -143,11 +138,11 @@ public int getGoldDelaySeconds() {
143138
@Setter
144139
public static class MapTeam {
145140
private Shops shop;
146-
private PitchYawPosition spawn;
141+
private HypixelPosition spawn;
147142
private TwoBlockPosition bed;
148-
private Position generator;
143+
private HypixelPosition generator;
149144

150-
public record Shops(PitchYawPosition item, PitchYawPosition team) {
145+
public record Shops(HypixelPosition item, HypixelPosition team) {
151146
}
152147
}
153148

Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
package net.swofty.commons.mc;
2+
3+
4+
public record HypixelPosition(double x, double y, double z, float yaw, float pitch) {
5+
6+
public static HypixelPosition ZERO = new HypixelPosition(0, 0, 0);
7+
8+
public HypixelPosition(double x, double y, double z) {
9+
this(x, y, z, 0, 0);
10+
}
11+
12+
public HypixelPosition sub(double x, double y, double z) {
13+
return new HypixelPosition(this.x - x, this.y - y, this.z - z, yaw, pitch);
14+
}
15+
16+
public HypixelPosition sub(double value) {
17+
return sub(value, value, value);
18+
}
19+
20+
public HypixelPosition sub(HypixelPosition other) {
21+
return sub(other.x, other.y, other.z);
22+
}
23+
24+
public HypixelPosition add(double x, double y, double z) {
25+
return new HypixelPosition(this.x + x, this.y + y, this.z + z, yaw, pitch);
26+
}
27+
28+
public HypixelPosition add(double value) {
29+
return add(value, value, value);
30+
}
31+
32+
public HypixelPosition add(HypixelPosition other) {
33+
return add(other.x, other.y, other.z);
34+
}
35+
36+
}

commons/src/main/java/net/swofty/commons/murdermystery/map/MurderMysteryMapsConfig.java

Lines changed: 5 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22

33
import lombok.Getter;
44
import lombok.Setter;
5+
import net.swofty.commons.mc.HypixelPosition;
56
import net.swofty.commons.murdermystery.MurderMysteryGameType;
67

78
import java.util.List;
@@ -24,25 +25,19 @@ public static class MapEntry {
2425
public static class MapConfiguration {
2526
private List<MurderMysteryGameType> types;
2627
private MapLocations locations;
27-
private List<Position> goldSpawns;
28-
private List<Position> playerSpawns;
28+
private List<HypixelPosition> goldSpawns;
29+
private List<HypixelPosition> playerSpawns;
2930
private List<KillRegion> killRegions;
3031

3132
@Getter
3233
@Setter
3334
public static class MapLocations {
34-
private PitchYawPosition waiting;
35+
private HypixelPosition waiting;
3536
}
3637
}
3738
}
3839

39-
public record Position(double x, double y, double z) {
40-
}
41-
42-
public record PitchYawPosition(double x, double y, double z, float pitch, float yaw) {
43-
}
44-
45-
public record KillRegion(String name, Position min, Position max) {
40+
public record KillRegion(String name, HypixelPosition min, HypixelPosition max) {
4641
public boolean isComplete() {
4742
return min != null && max != null;
4843
}

commons/src/main/java/net/swofty/commons/skywars/map/SkywarsMapsConfig.java

Lines changed: 4 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22

33
import lombok.Getter;
44
import lombok.Setter;
5+
import net.swofty.commons.mc.HypixelPosition;
56
import net.swofty.commons.skywars.SkywarsGameType;
67

78
import java.util.List;
@@ -23,7 +24,7 @@ public static class MapEntry {
2324
@Setter
2425
public static class MapConfiguration {
2526
private List<SkywarsGameType> types;
26-
private PitchYawPosition center;
27+
private HypixelPosition center;
2728
private List<IslandSpawn> islands;
2829
private int voidY;
2930
private MapBounds bounds;
@@ -34,16 +35,10 @@ public static class MapConfiguration {
3435
@Setter
3536
public static class IslandSpawn {
3637
private int teamId;
37-
private PitchYawPosition cageCenter;
38+
private HypixelPosition cageCenter;
3839
}
3940

40-
public record Position(double x, double y, double z) {
41-
}
42-
43-
public record PitchYawPosition(double x, double y, double z, float pitch, float yaw) {
44-
}
45-
46-
public record MapBounds(Position min, Position max) {
41+
public record MapBounds(HypixelPosition min, HypixelPosition max) {
4742
public boolean isWithinBounds(double x, double y, double z) {
4843
if (min == null || max == null) return true;
4944
double minX = Math.min(min.x(), max.x());

0 commit comments

Comments
 (0)