Search in sources :

Example 1 with BitSetVSAccess

use of me.jellysquid.mods.lithium.mixin.shapes.side_shape_cache.BitSetVSAccess 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);
    }
}
Also used : CroppedVoxelSet(net.minecraft.util.shape.CroppedVoxelSet) CroppedVoxelSetAccess(me.jellysquid.mods.lithium.mixin.shapes.side_shape_cache.CroppedVoxelSetAccess) VoxelSetAccess(me.jellysquid.mods.lithium.mixin.shapes.side_shape_cache.VoxelSetAccess) BitSetVSAccess(me.jellysquid.mods.lithium.mixin.shapes.side_shape_cache.BitSetVSAccess) CroppedVoxelSetAccess(me.jellysquid.mods.lithium.mixin.shapes.side_shape_cache.CroppedVoxelSetAccess) BitSetVoxelSet(net.minecraft.util.shape.BitSetVoxelSet)

Example 2 with BitSetVSAccess

use of me.jellysquid.mods.lithium.mixin.shapes.side_shape_cache.BitSetVSAccess 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);
    }
}
Also used : CroppedVoxelSet(net.minecraft.util.shape.CroppedVoxelSet) CroppedVoxelSetAccess(me.jellysquid.mods.lithium.mixin.shapes.side_shape_cache.CroppedVoxelSetAccess) VoxelSetAccess(me.jellysquid.mods.lithium.mixin.shapes.side_shape_cache.VoxelSetAccess) BitSetVSAccess(me.jellysquid.mods.lithium.mixin.shapes.side_shape_cache.BitSetVSAccess) CroppedVoxelSetAccess(me.jellysquid.mods.lithium.mixin.shapes.side_shape_cache.CroppedVoxelSetAccess) BitSetVoxelSet(net.minecraft.util.shape.BitSetVoxelSet)

Aggregations

BitSetVSAccess (me.jellysquid.mods.lithium.mixin.shapes.side_shape_cache.BitSetVSAccess)2 CroppedVoxelSetAccess (me.jellysquid.mods.lithium.mixin.shapes.side_shape_cache.CroppedVoxelSetAccess)2 VoxelSetAccess (me.jellysquid.mods.lithium.mixin.shapes.side_shape_cache.VoxelSetAccess)2 BitSetVoxelSet (net.minecraft.util.shape.BitSetVoxelSet)2 CroppedVoxelSet (net.minecraft.util.shape.CroppedVoxelSet)2