use of net.minecraft.util.shape.CroppedVoxelSet in project roadrunner by MaxNeedsSnacks.
the class VoxelSetHash method hashCode.
@Override
public int hashCode(VoxelSet o) {
VoxelSetAccess generalAccess = (VoxelSetAccess) o;
int result = generalAccess.getXSize();
result = 31 * result + generalAccess.getYSize();
result = 31 * result + generalAccess.getZSize();
if (o instanceof CroppedVoxelSet) {
CroppedVoxelSetAccess access = access((CroppedVoxelSet) o);
result = 31 * result + access.getXMin();
result = 31 * result + access.getYMin();
result = 31 * result + access.getZMin();
result = 31 * result + access.getXMax();
result = 31 * result + access.getYMax();
result = 31 * result + access.getZMax();
result = 31 * result + hashCode(access.getParent());
return result;
} else if (o instanceof BitSetVoxelSet) {
BitSetVSAccess access = access((BitSetVoxelSet) o);
result = 31 * result + access.getXMin();
result = 31 * result + access.getYMin();
result = 31 * result + access.getZMin();
result = 31 * result + access.getXMax();
result = 31 * result + access.getYMax();
result = 31 * result + access.getZMax();
result = 31 * result + Objects.hashCode(access.getStorage());
return result;
} else {
return 31 * result + Objects.hashCode(o);
}
}
use of net.minecraft.util.shape.CroppedVoxelSet in project roadrunner by MaxNeedsSnacks.
the class VoxelSetHash method equals.
@Override
public boolean equals(VoxelSet a, VoxelSet b) {
if (a == b) {
return true;
} else if (a == null || b == null) {
return false;
} else if (a.getClass() != b.getClass()) {
return false;
}
VoxelSetAccess genAccessA = (VoxelSetAccess) a;
VoxelSetAccess genAccessB = (VoxelSetAccess) b;
if (genAccessA.getXSize() != genAccessB.getXSize() || genAccessA.getYSize() != genAccessB.getYSize() || genAccessA.getZSize() != genAccessB.getZSize()) {
return false;
}
if (a instanceof CroppedVoxelSet) {
CroppedVoxelSetAccess accessA = access((CroppedVoxelSet) a);
CroppedVoxelSetAccess accessB = access((CroppedVoxelSet) b);
return accessA.getXMax() == accessB.getXMax() && accessA.getYMax() == accessB.getYMax() && accessA.getZMax() == accessB.getZMax() && accessA.getXMin() == accessB.getXMin() && accessA.getYMin() == accessB.getYMin() && accessA.getZMin() == accessB.getZMin() && equals(accessA.getParent(), accessB.getParent());
} else if (a instanceof BitSetVoxelSet) {
BitSetVSAccess accessA = access((BitSetVoxelSet) a);
BitSetVSAccess accessB = access((BitSetVoxelSet) b);
return accessA.getXMax() == accessB.getXMax() && accessA.getYMax() == accessB.getYMax() && accessA.getZMax() == accessB.getZMax() && accessA.getXMin() == accessB.getXMin() && accessA.getYMin() == accessB.getYMin() && accessA.getZMin() == accessB.getZMin() && accessA.getStorage().equals(accessB.getStorage());
} else {
return a.equals(b);
}
}
Aggregations