From a13725b1cb287bbc4d9e5e37bda0e8493fb7ccd9 Mon Sep 17 00:00:00 2001 From: KingRainbow44 Date: Sun, 24 Jul 2022 12:17:38 -0400 Subject: [PATCH] Add a `Location` class (Scene + Position) --- .../java/emu/grasscutter/utils/Location.java | 41 +++++++++++++++++++ 1 file changed, 41 insertions(+) create mode 100644 src/main/java/emu/grasscutter/utils/Location.java diff --git a/src/main/java/emu/grasscutter/utils/Location.java b/src/main/java/emu/grasscutter/utils/Location.java new file mode 100644 index 000000000..c0954b7ba --- /dev/null +++ b/src/main/java/emu/grasscutter/utils/Location.java @@ -0,0 +1,41 @@ +package emu.grasscutter.utils; + +import dev.morphia.annotations.Entity; +import dev.morphia.annotations.Transient; +import emu.grasscutter.game.world.Scene; +import lombok.Getter; +import lombok.Setter; + +@Entity +public class Location extends Position { + @Transient @Getter @Setter + private Scene scene; + + public Location(Scene scene, Position position) { + this.set(position); + + this.scene = scene; + } + + public Location(Scene scene, float x, float y) { + this.set(x, y); + + this.scene = scene; + } + + public Location(Scene scene, float x, float y, float z) { + this.set(x, y, z); + + this.scene = scene; + } + + @Override + public Location clone() { + return new Location(this.scene, super.clone()); + } + + @Override + public String toString() { + return String.format("%s:%s,%s,%s", this.scene.getId(), this.getX(), this.getY(), this.getZ()); + } +} \ No newline at end of file