Work on compile errors

This commit is contained in:
Bjarne Koll
2024-10-25 12:30:19 +02:00
parent a040040900
commit f37c1be91e
16 changed files with 60 additions and 39 deletions

View File

@@ -162,23 +162,24 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
+ };
+ }
+
+ public static net.minecraft.world.entity.RelativeMovement toNmsRelativeFlag(io.papermc.paper.entity.TeleportFlag.Relative apiFlag) {
+ public static net.minecraft.world.entity.Relative toNmsRelativeFlag(io.papermc.paper.entity.TeleportFlag.Relative apiFlag) {
+ return switch (apiFlag) {
+ case X -> net.minecraft.world.entity.RelativeMovement.X;
+ case Y -> net.minecraft.world.entity.RelativeMovement.Y;
+ case Z -> net.minecraft.world.entity.RelativeMovement.Z;
+ case PITCH -> net.minecraft.world.entity.RelativeMovement.X_ROT;
+ case YAW -> net.minecraft.world.entity.RelativeMovement.Y_ROT;
+ case X -> net.minecraft.world.entity.Relative.X;
+ case Y -> net.minecraft.world.entity.Relative.Y;
+ case Z -> net.minecraft.world.entity.Relative.Z;
+ case PITCH -> net.minecraft.world.entity.Relative.X_ROT;
+ case YAW -> net.minecraft.world.entity.Relative.Y_ROT;
+ };
+ }
+
+ public static io.papermc.paper.entity.TeleportFlag.Relative toApiRelativeFlag(net.minecraft.world.entity.RelativeMovement nmsFlag) {
+ public static io.papermc.paper.entity.TeleportFlag.Relative toApiRelativeFlag(net.minecraft.world.entity.Relative nmsFlag) {
+ return switch (nmsFlag) {
+ case X -> io.papermc.paper.entity.TeleportFlag.Relative.X;
+ case Y -> io.papermc.paper.entity.TeleportFlag.Relative.Y;
+ case Z -> io.papermc.paper.entity.TeleportFlag.Relative.Z;
+ case X_ROT -> io.papermc.paper.entity.TeleportFlag.Relative.PITCH;
+ case Y_ROT -> io.papermc.paper.entity.TeleportFlag.Relative.YAW;
+ default -> throw new RuntimeException("not yet"); // TODO figure out what to do with new flags
+ };
+ }
+
@@ -258,7 +259,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
if (fromWorld == toWorld) {
- entity.connection.teleport(to);
+ // Paper start - Teleport API
+ final Set<net.minecraft.world.entity.RelativeMovement> nms = java.util.EnumSet.noneOf(net.minecraft.world.entity.RelativeMovement.class);
+ final Set<net.minecraft.world.entity.Relative> nms = java.util.EnumSet.noneOf(net.minecraft.world.entity.Relative.class);
+ for (final io.papermc.paper.entity.TeleportFlag.Relative bukkit : relativeArguments) {
+ nms.add(toNmsRelativeFlag(bukkit));
+ }