Skip to content

Commit

Permalink
Add a Location class (Scene + Position)
Browse files Browse the repository at this point in the history
  • Loading branch information
KingRainbow44 committed Jul 24, 2022
1 parent 7397c7f commit a13725b
Showing 1 changed file with 41 additions and 0 deletions.
41 changes: 41 additions & 0 deletions src/main/java/emu/grasscutter/utils/Location.java
Original file line number Diff line number Diff line change
@@ -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());
}
}

0 comments on commit a13725b

Please sign in to comment.