Package codechicken.microblock.util
Record Class MaskedCuboid
java.lang.Object
java.lang.Record
codechicken.microblock.util.MaskedCuboid
A cuboid and side mask pair.
Cuboids should be treated as immutable and not modified.
Masks are, if bit set, side is important.
MaskedCuboids should be created with of(Cuboid6, int) to receive automatic interning and caching.
Making sure these are interned is important, as these are stored inside caches as keys, and may be long-lived. Ensuring that
duplicates aren't saved is important to keep memory usage down. Ideally we should cache sets of cuboids as well, but that's a later issue.
Created by covers1624 on 20/10/22.
-
Constructor Summary
ConstructorsConstructorDescriptionMaskedCuboid(codechicken.lib.vec.Cuboid6 box, int sideMask) Creates an instance of aMaskedCuboidrecord class. -
Method Summary
Modifier and TypeMethodDescriptioncodechicken.lib.vec.Cuboid6box()Returns the value of theboxrecord component.final booleanIndicates whether some other object is "equal to" this one.final inthashCode()Returns a hash code value for this object.static MaskedCuboidintern(MaskedCuboid cuboid) static MaskedCuboidof(codechicken.lib.vec.Cuboid6 box, int sideMask) intsideMask()Returns the value of thesideMaskrecord component.final StringtoString()Returns a string representation of this record class.
-
Constructor Details
-
MaskedCuboid
public MaskedCuboid(codechicken.lib.vec.Cuboid6 box, int sideMask) Creates an instance of aMaskedCuboidrecord class.- Parameters:
box- the value for theboxrecord componentsideMask- the value for thesideMaskrecord component
-
-
Method Details
-
intern
-
of
-
toString
Returns a string representation of this record class. The representation contains the name of the class, followed by the name and value of each of the record components. -
hashCode
public final int hashCode()Returns a hash code value for this object. The value is derived from the hash code of each of the record components. -
equals
Indicates whether some other object is "equal to" this one. The objects are equal if the other object is of the same class and if all the record components are equal. Reference components are compared withObjects::equals(Object,Object); primitive components are compared with '=='. -
box
public codechicken.lib.vec.Cuboid6 box()Returns the value of theboxrecord component.- Returns:
- the value of the
boxrecord component
-
sideMask
public int sideMask()Returns the value of thesideMaskrecord component.- Returns:
- the value of the
sideMaskrecord component
-