BloodMagic/src/main/java/wayoftime/bloodmagic/demonaura/PosXY.java
WayofTime 9fa68e86ae Attempt to fix 1.16.3 branch's issues on the repository
Added the original 'wayoftime' folder back, so see if that fixed the multiple folder issue.
2020-10-29 15:50:03 -04:00

76 lines
No EOL
1.1 KiB
Java

package wayoftime.bloodmagic.demonaura;
import org.apache.commons.lang3.builder.ToStringBuilder;
public class PosXY implements Comparable<PosXY>
{
public int x;
public int y;
public PosXY()
{
}
public PosXY(int x, int y)
{
this.x = x;
this.y = y;
}
@Override
public int compareTo(PosXY c)
{
return this.y == c.y ? this.x - c.x : this.y - c.y;
}
public float getDistanceSquared(int x, int z)
{
float f = this.x - x;
float f2 = this.y - z;
return f * f + f2 * f2;
}
public float getDistanceSquaredToChunkCoordinates(PosXY c)
{
return getDistanceSquared(c.x, c.y);
}
public void setX(int x)
{
this.x = x;
}
public void setY(int y)
{
this.y = y;
}
@Override
public String toString()
{
return new ToStringBuilder(this).append("x", x).append("y", y).toString();
}
@Override
public boolean equals(Object o)
{
if (this == o)
return true;
if (!(o instanceof PosXY))
return false;
PosXY posXY = (PosXY) o;
if (x != posXY.x)
return false;
return y == posXY.y;
}
@Override
public int hashCode()
{
int result = x;
result = 31 * result + y;
return result;
}
}