mirror of
https://gitlab.bixilon.de/bixilon/minosoft.git
synced 2025-09-13 01:16:46 -04:00
fix chest renderer in <1.13
This commit is contained in:
parent
076d63e075
commit
b3a34c0cf0
@ -312,7 +312,7 @@ class SolidSectionMesherTest {
|
|||||||
assertEquals(queue.blocks.size, 7)
|
assertEquals(queue.blocks.size, 7)
|
||||||
}
|
}
|
||||||
// TODO: test sign block entity rendering
|
// TODO: test sign block entity rendering
|
||||||
// TODO: test skylight (w/ heightmap), fast bedrock, camera offset
|
// TODO: test skylight (w/ heightmap), fast bedrock, camera offset, block random offset
|
||||||
|
|
||||||
class TestQueue {
|
class TestQueue {
|
||||||
val blocks: MutableSet<RenderedBlock> = mutableSetOf()
|
val blocks: MutableSet<RenderedBlock> = mutableSetOf()
|
||||||
|
@ -18,6 +18,8 @@ import de.bixilon.minosoft.data.entities.block.BlockEntityFactory
|
|||||||
import de.bixilon.minosoft.data.registries.blocks.properties.BlockProperties
|
import de.bixilon.minosoft.data.registries.blocks.properties.BlockProperties
|
||||||
import de.bixilon.minosoft.data.registries.blocks.properties.ChestTypes
|
import de.bixilon.minosoft.data.registries.blocks.properties.ChestTypes
|
||||||
import de.bixilon.minosoft.data.registries.blocks.state.BlockState
|
import de.bixilon.minosoft.data.registries.blocks.state.BlockState
|
||||||
|
import de.bixilon.minosoft.data.registries.blocks.state.PropertyBlockState
|
||||||
|
import de.bixilon.minosoft.data.registries.blocks.types.entity.storage.WoodenChestBlock
|
||||||
import de.bixilon.minosoft.data.registries.identified.Namespaces.minecraft
|
import de.bixilon.minosoft.data.registries.identified.Namespaces.minecraft
|
||||||
import de.bixilon.minosoft.data.registries.identified.ResourceLocation
|
import de.bixilon.minosoft.data.registries.identified.ResourceLocation
|
||||||
import de.bixilon.minosoft.gui.rendering.RenderContext
|
import de.bixilon.minosoft.gui.rendering.RenderContext
|
||||||
@ -31,8 +33,10 @@ open class ChestBlockEntity(connection: PlayConnection) : StorageBlockEntity(con
|
|||||||
override var renderer: ChestRenderer? = null
|
override var renderer: ChestRenderer? = null
|
||||||
|
|
||||||
override fun createRenderer(context: RenderContext, state: BlockState, position: Vec3i, light: Int): ChestRenderer? {
|
override fun createRenderer(context: RenderContext, state: BlockState, position: Vec3i, light: Int): ChestRenderer? {
|
||||||
val type: ChestTypes = state[BlockProperties.CHEST_TYPE]
|
if (state.block !is WoodenChestBlock<*>) return null
|
||||||
if (type == ChestTypes.SINGLE) {
|
if (state !is PropertyBlockState) return null
|
||||||
|
val type = state.properties[BlockProperties.CHEST_TYPE]
|
||||||
|
if (type == ChestTypes.SINGLE || type == null) { // TODO: type null: check neighbour blocks (<1.13)
|
||||||
return SingleChestRenderer(this, context, state, position, context.models.skeletal[getSingleModel()] ?: return null, light)
|
return SingleChestRenderer(this, context, state, position, context.models.skeletal[getSingleModel()] ?: return null, light)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -85,7 +85,7 @@ open class PropertyBlockState(
|
|||||||
}
|
}
|
||||||
|
|
||||||
override fun <T> get(property: BlockProperty<T>): T {
|
override fun <T> get(property: BlockProperty<T>): T {
|
||||||
val value = this.properties[property] ?: throw IllegalArgumentException("$this has not property $property")
|
val value = this.properties[property] ?: throw IllegalArgumentException("$this has no property $property")
|
||||||
return value.unsafeCast()
|
return value.unsafeCast()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user