Add "none" to BlockRotationFreedom

This commit is contained in:
DBotThePony 2024-01-03 15:11:39 +07:00
parent 565819c3e3
commit 0ab411fd90
Signed by: DBot
GPG Key ID: DCC23B5715498507

View File

@ -57,7 +57,9 @@ enum class BlockRotationFreedom(vararg values: BlockRotation) {
BlockRotation.SOUTH_DOWN,
BlockRotation.WEST_DOWN,
BlockRotation.EAST_DOWN,
);
),
NONE(BlockRotation.NORTH);
val possibleValues: Collection<BlockRotation> get() = property.possibleValues
val property: EnumProperty<BlockRotation> = EnumProperty.create("facing", BlockRotation::class.java, *values)
@ -66,14 +68,14 @@ enum class BlockRotationFreedom(vararg values: BlockRotation) {
private val twoDirection = EnumMap<Direction, EnumMap<Direction, BlockRotation>>(Direction::class.java)
init {
for (direction in Direction.values()) {
for (direction in Direction.entries) {
oneDirection[direction] = possibleValues.firstOrNull { it.front == direction }
?: possibleValues.first()
val second = EnumMap<Direction, BlockRotation>(Direction::class.java)
twoDirection[direction] = second
for (direction2 in Direction.values()) {
for (direction2 in Direction.entries) {
second[direction2] = possibleValues.firstOrNull { it.front == direction && it.top == direction2 }
?: possibleValues.firstOrNull { it.front == direction }
?: possibleValues.first()