Use newer Java features in places where it makes sense and more (#1009)

This commit is contained in:
altrisi authored and GitHub committed 2021-08-03 07:32:40 -03:00
1 parent 28cb136c6b
commit 7fb5e47da5
34 files changed
+338 -399

No files matched your search

@@ -92,33 +92,11 @@ public class ExplosionLogHelper
}
public static class EntityChangedStatusWithCount
public static record EntityChangedStatusWithCount(Vec3d pos, EntityType type, Vec3d accel)
{
public final Vec3d pos;
public final EntityType type;
public final Vec3d accel;
public EntityChangedStatusWithCount(Entity e, Vec3d accel)
{
this.pos = e.getPos();
this.type = e.getType();
this.accel = accel;
}
@Override
public boolean equals(Object obj)
{
if (obj instanceof EntityChangedStatusWithCount other)
{
return other.pos.equals(pos) && other.accel.equals(accel) && other.type.equals(type);
}
return super.equals(obj);
}
@Override
public int hashCode()
{
return pos.hashCode()+ type.hashCode()+accel.hashCode();
this(e.getPos(), e.getType(), accel);
}
}
}