@@ -1,90 +1,14 @@
|
||||
package mc.core;
|
||||
|
||||
import mc.core.player.ILook;
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Data;
|
||||
import mc.core.player.Look;
|
||||
import mc.core.world.World;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.util.Objects;
|
||||
|
||||
public class WarpPosition extends Location implements Serializable, ILook {
|
||||
private ILook look;
|
||||
|
||||
public WarpPosition(double x, double y, double z, World world) {
|
||||
super(x, y, z, world);
|
||||
}
|
||||
|
||||
public WarpPosition(double x, double y, double z, float yaw, float pitch, World world) {
|
||||
super(x, y, z, world);
|
||||
this.look = new Look(yaw, pitch);
|
||||
}
|
||||
|
||||
public WarpPosition(double x, double y, double z) {
|
||||
super(x, y, z);
|
||||
}
|
||||
|
||||
public WarpPosition(double x, double y, double z, float yaw, float pitch) {
|
||||
super(x, y, z);
|
||||
this.look = new Look(yaw, pitch);
|
||||
}
|
||||
|
||||
public WarpPosition(long compactValue) {
|
||||
super(compactValue);
|
||||
}
|
||||
|
||||
public WarpPosition(Location location) {
|
||||
super(location.getX(), location.getY(), location.getZ());
|
||||
}
|
||||
|
||||
public WarpPosition(Location location, Look look) {
|
||||
super(location.getX(), location.getY(), location.getZ());
|
||||
this.look = look;
|
||||
}
|
||||
|
||||
public WarpPosition(long compactValue, World world) {
|
||||
super(compactValue, world);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void set(Look look) {
|
||||
this.look = look;
|
||||
}
|
||||
|
||||
@Override
|
||||
public float getYaw() {
|
||||
return this.look.getYaw();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setYaw(float yaw) {
|
||||
this.look.setYaw(yaw);
|
||||
}
|
||||
|
||||
@Override
|
||||
public float getPitch() {
|
||||
return this.look.getPitch();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setPitch(float pitch) {
|
||||
this.look.setPitch(pitch);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean equals(Object o) {
|
||||
if (this == o) return true;
|
||||
if (o == null || getClass() != o.getClass()) return false;
|
||||
if (!super.equals(o)) return false;
|
||||
WarpPosition that = (WarpPosition) o;
|
||||
return Objects.equals(look, that.look);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int hashCode() {
|
||||
return Objects.hash(super.hashCode(), look);
|
||||
}
|
||||
|
||||
public boolean hasLook() {
|
||||
return look != null;
|
||||
}
|
||||
@Data
|
||||
@AllArgsConstructor
|
||||
public class WarpPosition implements Serializable {
|
||||
private Location location;
|
||||
private Look look;
|
||||
}
|
||||
|
||||
@@ -1,15 +0,0 @@
|
||||
package mc.core.player;
|
||||
|
||||
import java.io.Serializable;
|
||||
|
||||
public interface ILook extends Serializable {
|
||||
void set(Look look);
|
||||
|
||||
float getYaw();
|
||||
|
||||
float getPitch();
|
||||
|
||||
void setYaw(float yaw);
|
||||
|
||||
void setPitch(float pitch);
|
||||
}
|
||||
@@ -7,12 +7,13 @@ package mc.core.player;
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Data;
|
||||
|
||||
import java.io.Serializable;
|
||||
|
||||
@Data
|
||||
@AllArgsConstructor
|
||||
public class Look implements ILook {
|
||||
public class Look implements Serializable{
|
||||
private float yaw, pitch;
|
||||
|
||||
@Override
|
||||
public void set(Look look) {
|
||||
this.yaw = look.yaw;
|
||||
this.pitch = look.pitch;
|
||||
|
||||
Reference in New Issue
Block a user