package party._2a03.mc.util; import org.json.JSONArray; import net.minecraft.util.Identifier; import net.minecraft.util.registry.Registry; import net.minecraft.util.registry.RegistryKey; public class PlayerPosition { public double x; public double y; public double z; public float yaw; public float pitch; public RegistryKey registrykey; public PlayerPosition() { } public PlayerPosition(JSONArray data) { String registry_string = data.getString(5); if (!registry_string.isEmpty()) { this.x = data.getDouble(0); this.y = data.getDouble(1); this.z = data.getDouble(2); this.yaw = data.getNumber(3).floatValue(); this.pitch = data.getNumber(4).floatValue(); this.registrykey = RegistryKey.of(Registry.DIMENSION_KEY, new Identifier(registry_string)); } } public PlayerPosition(double p_x, double p_y, double p_z, float p_yaw, float p_pitch, RegistryKey p_registrykey) { this.x = p_x; this.y = p_y; this.z = p_z; this.yaw = p_yaw; this.pitch = p_pitch; this.registrykey = p_registrykey; } public JSONArray getJSON() { JSONArray json = new JSONArray(); if (this.registrykey != null) { json.put(this.x); json.put(this.y); json.put(this.z); json.put(this.yaw); json.put(this.pitch); json.put(this.registrykey.getValue().toString()); } else { json.put(0); json.put(0); json.put(0); json.put(0); json.put(0); json.put(""); } return json; } }