Fix all warnings
Add and make use of Lombok Remove Mojang API Remove ZipFileUtils Remove StreamTools in favor of Apache IOUtils Keyframe should be abstract all derivatives final Replace clone in Keyframe with copy Move some constants from GuiReplaySetttings to GuiConstants
This commit is contained in:
@@ -1,9 +1,12 @@
|
||||
package eu.crushedpixel.replaymod.holders;
|
||||
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Data;
|
||||
import net.minecraft.client.Minecraft;
|
||||
import net.minecraft.entity.Entity;
|
||||
import org.apache.commons.lang3.builder.HashCodeBuilder;
|
||||
|
||||
@Data
|
||||
@AllArgsConstructor
|
||||
public class Position {
|
||||
|
||||
private double x, y, z;
|
||||
@@ -14,103 +17,17 @@ public class Position {
|
||||
}
|
||||
|
||||
public Position(Entity e) {
|
||||
this.x = e.posX;
|
||||
this.y = e.posY;
|
||||
this.z = e.posZ;
|
||||
this.pitch = e.rotationPitch;
|
||||
this.yaw = e.rotationYaw;
|
||||
}
|
||||
|
||||
public Position(double x, double y, double z, float pitch, float yaw, float roll) {
|
||||
this.x = x;
|
||||
this.y = y;
|
||||
this.z = z;
|
||||
this.pitch = pitch;
|
||||
this.yaw = yaw;
|
||||
this.roll = roll;
|
||||
this(e.posX, e.posY, e.posZ, e.rotationPitch, e.rotationYaw);
|
||||
}
|
||||
|
||||
public Position(double x, double y, double z, float pitch, float yaw) {
|
||||
this.x = x;
|
||||
this.y = y;
|
||||
this.z = z;
|
||||
this.pitch = pitch;
|
||||
this.yaw = yaw;
|
||||
this(x, y, z, pitch, yaw, 0);
|
||||
}
|
||||
|
||||
public double getX() {
|
||||
return x;
|
||||
}
|
||||
|
||||
public void setX(double x) {
|
||||
this.x = x;
|
||||
}
|
||||
|
||||
public double getY() {
|
||||
return y;
|
||||
}
|
||||
|
||||
public void setY(double y) {
|
||||
this.y = y;
|
||||
}
|
||||
|
||||
public double getZ() {
|
||||
return z;
|
||||
}
|
||||
|
||||
public void setZ(double z) {
|
||||
this.z = z;
|
||||
}
|
||||
|
||||
public float getPitch() {
|
||||
return pitch;
|
||||
}
|
||||
|
||||
public void setPitch(float pitch) {
|
||||
this.pitch = pitch;
|
||||
}
|
||||
|
||||
public float getYaw() {
|
||||
return yaw;
|
||||
}
|
||||
|
||||
public void setYaw(float yaw) {
|
||||
this.yaw = yaw;
|
||||
}
|
||||
|
||||
public float getRoll() { return roll; }
|
||||
|
||||
public void setRoll(float roll) { this.roll = roll; }
|
||||
|
||||
public double distanceSquared(double x, double y, double z) {
|
||||
double dx = this.x - x;
|
||||
double dy = this.y - y;
|
||||
double dz = this.z - z;
|
||||
return dx * dx + dy * dy + dz * dz;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return "X=" + x + ", Y=" + y + ", Z=" + z + ", Yaw=" + yaw + ", Pitch=" + pitch + ", Roll="+roll;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean equals(Object o2) {
|
||||
if(o2 == null) return false;
|
||||
if(!(o2 instanceof Position)) return false;
|
||||
Position pos2 = (Position)o2;
|
||||
return hashCode() == pos2.hashCode();
|
||||
}
|
||||
|
||||
@Override
|
||||
public int hashCode() {
|
||||
return new HashCodeBuilder(17, 37)
|
||||
.append(x)
|
||||
.append(y)
|
||||
.append(z)
|
||||
.append(pitch)
|
||||
.append(yaw)
|
||||
.append(roll)
|
||||
.toHashCode();
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user