implement netherrack, soul sand and soul soil

Now flying through the nether should be a lot faster
This commit is contained in:
Moritz Zwerger 2024-02-29 23:43:46 +01:00
parent 80ab673cfd
commit 40b22db83a
No known key found for this signature in database
GPG Key ID: 5CAD791931B09AC4
7 changed files with 157 additions and 6 deletions

View File

@ -1,6 +1,6 @@
/*
* Minosoft
* Copyright (C) 2020-2023 Moritz Zwerger
* Copyright (C) 2020-2024 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.
*
@ -28,6 +28,7 @@ import de.bixilon.minosoft.data.registries.blocks.types.fluid.FluidBlock
import de.bixilon.minosoft.data.registries.blocks.types.fluid.water.BubbleColumnBlock
import de.bixilon.minosoft.data.registries.blocks.types.pixlyzer.PixLyzerBlock
import de.bixilon.minosoft.data.registries.blocks.types.pixlyzer.snow.PowderSnowBlock
import de.bixilon.minosoft.data.registries.blocks.types.properties.hardness.UnbreakableBlock
import de.bixilon.minosoft.data.registries.blocks.types.properties.item.BlockWithItem
import de.bixilon.minosoft.data.registries.blocks.types.properties.offset.OffsetBlock
import de.bixilon.minosoft.data.registries.blocks.types.properties.shape.collision.CollidableBlock
@ -100,7 +101,7 @@ object VerifyIntegratedBlockRegistry {
}
private fun compareHardness(pixlyzer: Block, integrated: Block, errors: StringBuilder) {
if (pixlyzer.hardness == integrated.hardness) {
if (pixlyzer.hardness == integrated.hardness || (pixlyzer.hardness < 0.0f && integrated is UnbreakableBlock)) {
return
}

View File

@ -1,6 +1,6 @@
/*
* Minosoft
* Copyright (C) 2020-2023 Moritz Zwerger
* Copyright (C) 2020-2024 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.
*
@ -26,6 +26,9 @@ import de.bixilon.minosoft.data.registries.blocks.types.building.dirt.GrassBlock
import de.bixilon.minosoft.data.registries.blocks.types.building.door.DoorBlock
import de.bixilon.minosoft.data.registries.blocks.types.building.end.EndStoneBrick
import de.bixilon.minosoft.data.registries.blocks.types.building.end.Purpur
import de.bixilon.minosoft.data.registries.blocks.types.building.nether.Netherrack
import de.bixilon.minosoft.data.registries.blocks.types.building.nether.SoulSand
import de.bixilon.minosoft.data.registries.blocks.types.building.nether.SoulSoil
import de.bixilon.minosoft.data.registries.blocks.types.building.plants.DoublePlant
import de.bixilon.minosoft.data.registries.blocks.types.building.plants.FernBlock
import de.bixilon.minosoft.data.registries.blocks.types.building.prismarine.DarkPrismarine
@ -55,6 +58,7 @@ import de.bixilon.minosoft.data.registries.registries.Registries
object BlockFactories : DefaultFactory<BlockFactory<*>>(
AirBlock.Air, AirBlock.VoidAir, AirBlock.CaveAir,
Bedrock,
StoneBlock.Block, StoneBlock.Slab,
SmoothStone.Block, SmoothStone.Slab,
@ -143,6 +147,8 @@ object BlockFactories : DefaultFactory<BlockFactory<*>>(
WoodenChestBlock.Chest, WoodenChestBlock.TrappedChest, EnderChestBlock,
ShulkerBoxBlock, ShulkerBoxBlock.White, ShulkerBoxBlock.Orange, ShulkerBoxBlock.Magenta, ShulkerBoxBlock.LightBlue, ShulkerBoxBlock.Yellow, ShulkerBoxBlock.Lime, ShulkerBoxBlock.Pink, ShulkerBoxBlock.Gray, ShulkerBoxBlock.LightGray, ShulkerBoxBlock.Cyan, ShulkerBoxBlock.Purple, ShulkerBoxBlock.Blue, ShulkerBoxBlock.Brown, ShulkerBoxBlock.Green, ShulkerBoxBlock.Green, ShulkerBoxBlock.Red, ShulkerBoxBlock.Black,
Netherrack, SoulSand, SoulSoil,
) {
fun build(name: ResourceLocation, registries: Registries, settings: BlockSettings): Block? {

View File

@ -0,0 +1,31 @@
/*
* Minosoft
* Copyright (C) 2020-2024 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.building.nether
import de.bixilon.minosoft.data.registries.blocks.factory.BlockFactory
import de.bixilon.minosoft.data.registries.blocks.settings.BlockSettings
import de.bixilon.minosoft.data.registries.blocks.types.building.RockBlock
import de.bixilon.minosoft.data.registries.identified.Namespaces.minecraft
import de.bixilon.minosoft.data.registries.identified.ResourceLocation
import de.bixilon.minosoft.data.registries.registries.Registries
open class Netherrack(identifier: ResourceLocation = Companion.identifier, settings: BlockSettings) : RockBlock(identifier, settings) {
override val hardness get() = 0.4f
companion object : BlockFactory<Netherrack> {
override val identifier = minecraft("netherrack")
override fun build(registries: Registries, settings: BlockSettings) = Netherrack(settings = settings)
}
}

View File

@ -0,0 +1,42 @@
/*
* Minosoft
* Copyright (C) 2020-2024 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.building.nether
import de.bixilon.minosoft.data.registries.blocks.factory.BlockFactory
import de.bixilon.minosoft.data.registries.blocks.settings.BlockSettings
import de.bixilon.minosoft.data.registries.blocks.types.Block
import de.bixilon.minosoft.data.registries.blocks.types.properties.item.BlockWithItem
import de.bixilon.minosoft.data.registries.blocks.types.properties.physics.VelocityBlock
import de.bixilon.minosoft.data.registries.blocks.types.properties.shape.special.FullOpaqueBlock
import de.bixilon.minosoft.data.registries.identified.Namespaces.minecraft
import de.bixilon.minosoft.data.registries.identified.ResourceLocation
import de.bixilon.minosoft.data.registries.item.items.Item
import de.bixilon.minosoft.data.registries.item.items.tool.shovel.ShovelRequirement
import de.bixilon.minosoft.data.registries.registries.Registries
import de.bixilon.minosoft.data.registries.shapes.voxel.VoxelShape
open class SoulSand(identifier: ResourceLocation = Companion.identifier, settings: BlockSettings) : Block(identifier, settings), ShovelRequirement, FullOpaqueBlock, BlockWithItem<Item>, VelocityBlock {
override val item: Item = this::item.inject(identifier)
override val hardness get() = 0.5f
override val velocity get() = 0.4f
override val collisionShape get() = COLLISION_SHAPE
companion object : BlockFactory<SoulSand> {
override val identifier = minecraft("soul_sand")
private val COLLISION_SHAPE = VoxelShape(0.0, 0.0, 0.0, 1.0, 0.875, 1.0)
override fun build(registries: Registries, settings: BlockSettings) = SoulSand(settings = settings)
}
}

View File

@ -0,0 +1,36 @@
/*
* Minosoft
* Copyright (C) 2020-2024 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.building.nether
import de.bixilon.minosoft.data.registries.blocks.factory.BlockFactory
import de.bixilon.minosoft.data.registries.blocks.settings.BlockSettings
import de.bixilon.minosoft.data.registries.blocks.types.Block
import de.bixilon.minosoft.data.registries.blocks.types.properties.item.BlockWithItem
import de.bixilon.minosoft.data.registries.blocks.types.properties.shape.special.FullOpaqueBlock
import de.bixilon.minosoft.data.registries.identified.Namespaces.minecraft
import de.bixilon.minosoft.data.registries.identified.ResourceLocation
import de.bixilon.minosoft.data.registries.item.items.Item
import de.bixilon.minosoft.data.registries.item.items.tool.shovel.ShovelRequirement
import de.bixilon.minosoft.data.registries.registries.Registries
open class SoulSoil(identifier: ResourceLocation = Companion.identifier, settings: BlockSettings) : Block(identifier, settings), ShovelRequirement, FullOpaqueBlock, BlockWithItem<Item> {
override val item: Item = this::item.inject(identifier)
override val hardness get() = 0.5f
companion object : BlockFactory<SoulSoil> {
override val identifier = minecraft("soul_soil")
override fun build(registries: Registries, settings: BlockSettings) = SoulSoil(settings = settings)
}
}

View File

@ -0,0 +1,35 @@
/*
* Minosoft
* Copyright (C) 2020-2024 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.building.stone
import de.bixilon.minosoft.data.registries.blocks.factory.BlockFactory
import de.bixilon.minosoft.data.registries.blocks.settings.BlockSettings
import de.bixilon.minosoft.data.registries.blocks.types.Block
import de.bixilon.minosoft.data.registries.blocks.types.properties.hardness.UnbreakableBlock
import de.bixilon.minosoft.data.registries.blocks.types.properties.item.BlockWithItem
import de.bixilon.minosoft.data.registries.blocks.types.properties.shape.special.FullOpaqueBlock
import de.bixilon.minosoft.data.registries.identified.Namespaces.minecraft
import de.bixilon.minosoft.data.registries.identified.ResourceLocation
import de.bixilon.minosoft.data.registries.item.items.Item
import de.bixilon.minosoft.data.registries.registries.Registries
open class Bedrock(identifier: ResourceLocation = Companion.identifier, settings: BlockSettings) : Block(identifier, settings), FullOpaqueBlock, BlockWithItem<Item>, UnbreakableBlock {
override val item: Item = this::item.inject(identifier)
companion object : BlockFactory<Bedrock> {
override val identifier = minecraft("bedrock")
override fun build(registries: Registries, settings: BlockSettings) = Bedrock(settings = settings)
}
}

View File

@ -1,6 +1,6 @@
/*
* Minosoft
* Copyright (C) 2020-2023 Moritz Zwerger
* Copyright (C) 2020-2024 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.
*
@ -26,8 +26,8 @@ import de.bixilon.minosoft.data.direction.Directions.Companion.O_NORTH
import de.bixilon.minosoft.data.direction.Directions.Companion.O_SOUTH
import de.bixilon.minosoft.data.direction.Directions.Companion.O_UP
import de.bixilon.minosoft.data.direction.Directions.Companion.O_WEST
import de.bixilon.minosoft.data.registries.blocks.MinecraftBlocks
import de.bixilon.minosoft.data.registries.blocks.state.BlockState
import de.bixilon.minosoft.data.registries.blocks.types.building.stone.Bedrock
import de.bixilon.minosoft.data.registries.blocks.types.fluid.FluidBlock
import de.bixilon.minosoft.data.registries.blocks.types.properties.offset.OffsetBlock
import de.bixilon.minosoft.data.world.chunk.ChunkSection
@ -46,7 +46,7 @@ class SolidSectionMesher(
val context: RenderContext,
) {
private val profile = context.connection.profiles.block.rendering
private val bedrock = context.connection.registries.block[MinecraftBlocks.BEDROCK]?.states?.default
private val bedrock = context.connection.registries.block[Bedrock]?.states?.default
private val tints = context.tints
private var fastBedrock = false