mirror of
https://gitlab.bixilon.de/bixilon/minosoft.git
synced 2025-09-17 11:24:56 -04:00
wip: blocks with force waterloggeed properties (e.g. kelp
)
This commit is contained in:
parent
c00dbb101b
commit
9e3d3a409f
@ -128,6 +128,7 @@ open class Block(
|
|||||||
"NetherPortalBlock" to { resourceLocation, registries, data -> NetherPortalBlock(resourceLocation, registries, data) },
|
"NetherPortalBlock" to { resourceLocation, registries, data -> NetherPortalBlock(resourceLocation, registries, data) },
|
||||||
"RedstoneTorchBlock" to { resourceLocation, registries, data -> RedstoneTorchBlock(resourceLocation, registries, data) },
|
"RedstoneTorchBlock" to { resourceLocation, registries, data -> RedstoneTorchBlock(resourceLocation, registries, data) },
|
||||||
"HoneyBlock" to { resourceLocation, registries, data -> HoneyBlock(resourceLocation, registries, data) },
|
"HoneyBlock" to { resourceLocation, registries, data -> HoneyBlock(resourceLocation, registries, data) },
|
||||||
|
"KelpBlock" to { resourceLocation, registries, data -> KelpBlock(resourceLocation, registries, data) },
|
||||||
)
|
)
|
||||||
|
|
||||||
override fun deserialize(registries: Registries?, resourceLocation: ResourceLocation, data: JsonObject): Block {
|
override fun deserialize(registries: Registries?, resourceLocation: ResourceLocation, data: JsonObject): Block {
|
||||||
|
@ -0,0 +1,20 @@
|
|||||||
|
/*
|
||||||
|
* Minosoft
|
||||||
|
* Copyright (C) 2021 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
|
||||||
|
|
||||||
|
interface FluidFillable {
|
||||||
|
val fluid: ResourceLocation
|
||||||
|
}
|
@ -0,0 +1,23 @@
|
|||||||
|
/*
|
||||||
|
* Minosoft
|
||||||
|
* Copyright (C) 2021 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 com.google.gson.JsonObject
|
||||||
|
import de.bixilon.minosoft.data.registries.ResourceLocation
|
||||||
|
import de.bixilon.minosoft.data.registries.fluid.DefaultFluids
|
||||||
|
import de.bixilon.minosoft.data.registries.versions.Registries
|
||||||
|
|
||||||
|
open class KelpBlock(resourceLocation: ResourceLocation, registries: Registries, data: JsonObject) : Block(resourceLocation, registries, data), FluidFillable {
|
||||||
|
override val fluid: ResourceLocation = DefaultFluids.WATER
|
||||||
|
}
|
@ -20,6 +20,8 @@ import de.bixilon.minosoft.data.registries.ResourceLocation
|
|||||||
import de.bixilon.minosoft.data.registries.blocks.BlockState
|
import de.bixilon.minosoft.data.registries.blocks.BlockState
|
||||||
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.types.FluidBlock
|
import de.bixilon.minosoft.data.registries.blocks.types.FluidBlock
|
||||||
|
import de.bixilon.minosoft.data.registries.blocks.types.FluidFillable
|
||||||
|
import de.bixilon.minosoft.data.registries.fluid.DefaultFluids
|
||||||
import de.bixilon.minosoft.data.registries.versions.Registries
|
import de.bixilon.minosoft.data.registries.versions.Registries
|
||||||
import de.bixilon.minosoft.data.world.Chunk
|
import de.bixilon.minosoft.data.world.Chunk
|
||||||
import de.bixilon.minosoft.data.world.ChunkSection
|
import de.bixilon.minosoft.data.world.ChunkSection
|
||||||
@ -106,7 +108,7 @@ class WorldRenderer(
|
|||||||
offset = blockPosition.getWorldOffset(blockState.block),
|
offset = blockPosition.getWorldOffset(blockState.block),
|
||||||
)
|
)
|
||||||
|
|
||||||
if (blockState.properties[BlockProperties.WATERLOGGED] == true) {
|
if (blockState.properties[BlockProperties.WATERLOGGED] == true || (blockState.block is FluidFillable && blockState.block.fluid == DefaultFluids.WATER)) {
|
||||||
waterBlock?.fluidRenderer?.render(context.copy(blockState = waterBlock.defaultState))
|
waterBlock?.fluidRenderer?.render(context.copy(blockState = waterBlock.defaultState))
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user