mirror of
https://gitlab.bixilon.de/bixilon/minosoft.git
synced 2025-09-19 12:25:12 -04:00
blocks: set cave_air
and void_air
to null too
This commit is contained in:
parent
be8319d962
commit
39d952a6d5
@ -125,7 +125,9 @@ data class BlockState(
|
||||
val outlineShape = data["outline_shape"]?.asShape() ?: VoxelShape.EMPTY
|
||||
|
||||
|
||||
val lightProperties = if (outlineShape == VoxelShape.FULL) {
|
||||
val lightProperties = if (outlineShape == VoxelShape.EMPTY) {
|
||||
TransparentProperty
|
||||
} else if (outlineShape == VoxelShape.FULL) {
|
||||
if (data["is_opaque"]?.toBoolean() != false) SolidProperty else TransparentProperty
|
||||
} else {
|
||||
DirectedProperty.of(outlineShape)
|
||||
|
@ -49,6 +49,7 @@ import de.bixilon.minosoft.data.registries.blocks.types.water.SeagrassBlock
|
||||
import de.bixilon.minosoft.data.registries.factory.clazz.DefaultClassFactory
|
||||
|
||||
object DefaultBlockFactories : DefaultClassFactory<BlockFactory<*>>(
|
||||
AirBlock,
|
||||
FluidBlock,
|
||||
DoorBlock,
|
||||
LeverBlock,
|
||||
|
@ -0,0 +1,29 @@
|
||||
/*
|
||||
* Minosoft
|
||||
* Copyright (C) 2020-2022 Moritz Zwerger
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
*
|
||||
* This software is not affiliated with Mojang AB, the original developer of Minecraft.
|
||||
*/
|
||||
|
||||
package de.bixilon.minosoft.data.registries.blocks.types
|
||||
|
||||
import de.bixilon.minosoft.data.registries.ResourceLocation
|
||||
import de.bixilon.minosoft.data.registries.blocks.BlockFactory
|
||||
import de.bixilon.minosoft.data.registries.registries.Registries
|
||||
|
||||
@Deprecated("Air is always null!")
|
||||
open class AirBlock(resourceLocation: ResourceLocation, registries: Registries, data: Map<String, Any>) : Block(resourceLocation, registries, data) {
|
||||
|
||||
companion object : BlockFactory<AirBlock> {
|
||||
|
||||
override fun build(resourceLocation: ResourceLocation, registries: Registries, data: Map<String, Any>): AirBlock {
|
||||
return AirBlock(resourceLocation, registries, data)
|
||||
}
|
||||
}
|
||||
}
|
@ -17,6 +17,7 @@ import de.bixilon.kutil.exception.Broken
|
||||
import de.bixilon.kutil.json.JsonObject
|
||||
import de.bixilon.minosoft.data.registries.ResourceLocation
|
||||
import de.bixilon.minosoft.data.registries.blocks.BlockState
|
||||
import de.bixilon.minosoft.data.registries.blocks.types.AirBlock
|
||||
import de.bixilon.minosoft.data.registries.registries.Registries
|
||||
import de.bixilon.minosoft.protocol.protocol.ProtocolDefinition
|
||||
import it.unimi.dsi.fastutil.ints.Int2ObjectOpenHashMap
|
||||
@ -72,7 +73,11 @@ class BlockStateRegistry(var flattened: Boolean) : AbstractRegistry<BlockState?>
|
||||
if (id == ProtocolDefinition.AIR_BLOCK_ID) {
|
||||
return null
|
||||
}
|
||||
return forceGet(id)
|
||||
val state = forceGet(id) ?: return null
|
||||
if (state.block is AirBlock) {
|
||||
return null
|
||||
}
|
||||
return state
|
||||
}
|
||||
|
||||
override fun getId(value: BlockState?): Int {
|
||||
|
Loading…
x
Reference in New Issue
Block a user