add dirt, planks

This commit is contained in:
Moritz Zwerger 2024-08-09 12:33:09 +02:00
parent 716cdf6cf2
commit 2fec0f1df7
No known key found for this signature in database
GPG Key ID: 5CAD791931B09AC4
17 changed files with 229 additions and 28 deletions

View File

@ -22,6 +22,7 @@ import de.bixilon.minosoft.data.registries.blocks.types.bee.HoneyBlock
import de.bixilon.minosoft.data.registries.blocks.types.building.WoolBlock
import de.bixilon.minosoft.data.registries.blocks.types.building.brick.*
import de.bixilon.minosoft.data.registries.blocks.types.building.copper.*
import de.bixilon.minosoft.data.registries.blocks.types.building.dirt.Dirt
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
@ -109,6 +110,7 @@ object BlockFactories : DefaultFactory<BlockFactory<*>>(
CutCopper.Block, CutCopper.Slab,
WaxedCutCopper.Block, WaxedCutCopper.Slab,
Dirt,
GrassBlock,
WaterFluidBlock, BubbleColumnBlock, LavaFluidBlock,
@ -125,20 +127,20 @@ object BlockFactories : DefaultFactory<BlockFactory<*>>(
DoorBlock.IronDoor,
Oak.Leaves, Oak.Door, Oak.Slab,
Spruce.Leaves, Spruce.Door, Spruce.Slab,
Birch.Leaves, Birch.Door, Birch.Slab,
Jungle.Leaves, Jungle.Door, Jungle.Slab,
Acacia.Leaves, Acacia.Door, Acacia.Slab,
DarkOak.Leaves, DarkOak.Door, DarkOak.Slab,
Mangrove.Leaves, Mangrove.Door, Mangrove.Slab,
Cherry.Leaves, Cherry.Door, Cherry.Slab,
Azalea.Leaves, Azalea.Door, Azalea.Slab,
FloweringAzalea.Leaves, FloweringAzalea.Door, FloweringAzalea.Slab,
Bamboo.Leaves, Bamboo.Door, Bamboo.Slab,
BambooMosaic.Leaves, BambooMosaic.Door, BambooMosaic.Slab,
Crimson.Leaves, Crimson.Door, Crimson.Slab,
Warped.Leaves, Warped.Door, Warped.Slab,
Oak.Leaves, Oak.Door, Oak.Slab, Oak.Planks,
Spruce.Leaves, Spruce.Door, Spruce.Slab, Spruce.Planks,
Birch.Leaves, Birch.Door, Birch.Slab, Birch.Planks,
Jungle.Leaves, Jungle.Door, Jungle.Slab, Jungle.Planks,
Acacia.Leaves, Acacia.Door, Acacia.Slab, Acacia.Planks,
DarkOak.Leaves, DarkOak.Door, DarkOak.Slab, DarkOak.Planks,
Mangrove.Leaves, Mangrove.Door, Mangrove.Slab, Mangrove.Planks,
Cherry.Leaves, Cherry.Door, Cherry.Slab, Cherry.Planks,
Azalea.Leaves, Azalea.Door, Azalea.Slab, Azalea.Planks,
FloweringAzalea.Leaves, FloweringAzalea.Door, FloweringAzalea.Slab, FloweringAzalea.Planks,
Bamboo.Leaves, Bamboo.Door, Bamboo.Slab, Bamboo.Planks,
BambooMosaic.Leaves, BambooMosaic.Door, BambooMosaic.Slab, BambooMosaic.Slab,
Crimson.Leaves, Crimson.Door, Crimson.Slab, Crimson.Slab,
Warped.Leaves, Warped.Door, Warped.Slab, Warped.Slab,
SnowBlock, SnowLayerBlock,
FernBlock.DeadBush, FernBlock.Grass, FernBlock.ShortGrass, FernBlock.Fern,

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.dirt
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 Dirt(identifier: ResourceLocation = Companion.identifier, settings: BlockSettings) : Block(identifier, settings), FullOpaqueBlock, ShovelRequirement, BlockWithItem<Item> {
override val item: Item = this::item.inject(identifier)
override val hardness get() = 0.5f
companion object : BlockFactory<Dirt> {
override val identifier = minecraft("dirt")
override fun build(registries: Registries, settings: BlockSettings) = Dirt(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.
*
@ -17,6 +17,7 @@ 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.SlabBlock
import de.bixilon.minosoft.data.registries.blocks.types.building.door.DoorBlock
import de.bixilon.minosoft.data.registries.blocks.types.wood.Oak.Slab
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
@ -49,4 +50,13 @@ interface Acacia {
override fun build(registries: Registries, settings: BlockSettings) = Slab(settings = settings)
}
}
class Planks(identifier: ResourceLocation = this.identifier, settings: BlockSettings) : PlanksBlock(identifier, settings), Acacia {
companion object : BlockFactory<Planks> {
override val identifier = minecraft("acacia_planks")
override fun build(registries: Registries, settings: BlockSettings) = Planks(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.
*
@ -49,4 +49,13 @@ interface Azalea {
override fun build(registries: Registries, settings: BlockSettings) = Slab(settings = settings)
}
}
class Planks(identifier: ResourceLocation = this.identifier, settings: BlockSettings) : PlanksBlock(identifier, settings), Azalea {
companion object : BlockFactory<Planks> {
override val identifier = minecraft("azalea_planks")
override fun build(registries: Registries, settings: BlockSettings) = Planks(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.
*
@ -49,4 +49,13 @@ interface Bamboo {
override fun build(registries: Registries, settings: BlockSettings) = Slab(settings = settings)
}
}
class Planks(identifier: ResourceLocation = this.identifier, settings: BlockSettings) : PlanksBlock(identifier, settings), Bamboo {
companion object : BlockFactory<Planks> {
override val identifier = minecraft("bamboo_planks") // TODO: do the exist?
override fun build(registries: Registries, settings: BlockSettings) = Planks(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.
*
@ -49,4 +49,13 @@ interface BambooMosaic {
override fun build(registries: Registries, settings: BlockSettings) = Slab(settings = settings)
}
}
class Planks(identifier: ResourceLocation = this.identifier, settings: BlockSettings) : PlanksBlock(identifier, settings), BambooMosaic {
companion object : BlockFactory<Planks> {
override val identifier = minecraft("bamboo_mosaic_planks")
override fun build(registries: Registries, settings: BlockSettings) = Planks(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.
*
@ -54,4 +54,13 @@ interface Birch {
override fun build(registries: Registries, settings: BlockSettings) = Slab(settings = settings)
}
}
class Planks(identifier: ResourceLocation = this.identifier, settings: BlockSettings) : PlanksBlock(identifier, settings), Birch {
companion object : BlockFactory<Planks> {
override val identifier = minecraft("birch_planks")
override fun build(registries: Registries, settings: BlockSettings) = Planks(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.
*
@ -49,4 +49,13 @@ interface Cherry {
override fun build(registries: Registries, settings: BlockSettings) = Slab(settings = settings)
}
}
class Planks(identifier: ResourceLocation = this.identifier, settings: BlockSettings) : PlanksBlock(identifier, settings), Cherry {
companion object : BlockFactory<Planks> {
override val identifier = minecraft("cherry_planks")
override fun build(registries: Registries, settings: BlockSettings) = Planks(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.
*
@ -49,4 +49,13 @@ interface Crimson {
override fun build(registries: Registries, settings: BlockSettings) = Slab(settings = settings)
}
}
class Planks(identifier: ResourceLocation = this.identifier, settings: BlockSettings) : PlanksBlock(identifier, settings), Crimson {
companion object : BlockFactory<Planks> {
override val identifier = minecraft("crimson_planks")
override fun build(registries: Registries, settings: BlockSettings) = Planks(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.
*
@ -49,4 +49,13 @@ interface DarkOak {
override fun build(registries: Registries, settings: BlockSettings) = Slab(settings = settings)
}
}
class Planks(identifier: ResourceLocation = this.identifier, settings: BlockSettings) : PlanksBlock(identifier, settings), DarkOak {
companion object : BlockFactory<Planks> {
override val identifier = minecraft("dark_oak_planks")
override fun build(registries: Registries, settings: BlockSettings) = Planks(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.
*
@ -49,4 +49,13 @@ interface FloweringAzalea {
override fun build(registries: Registries, settings: BlockSettings) = Slab(settings = settings)
}
}
class Planks(identifier: ResourceLocation = this.identifier, settings: BlockSettings) : PlanksBlock(identifier, settings), FloweringAzalea {
companion object : BlockFactory<Planks> {
override val identifier = minecraft("flowering_azalea_planks")
override fun build(registries: Registries, settings: BlockSettings) = Planks(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.
*
@ -49,4 +49,13 @@ interface Jungle {
override fun build(registries: Registries, settings: BlockSettings) = Slab(settings = settings)
}
}
class Planks(identifier: ResourceLocation = this.identifier, settings: BlockSettings) : PlanksBlock(identifier, settings), Jungle {
companion object : BlockFactory<Planks> {
override val identifier = minecraft("jungle_planks")
override fun build(registries: Registries, settings: BlockSettings) = Planks(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.
*
@ -49,4 +49,13 @@ interface Mangrove {
override fun build(registries: Registries, settings: BlockSettings) = Slab(settings = settings)
}
}
class Planks(identifier: ResourceLocation = this.identifier, settings: BlockSettings) : PlanksBlock(identifier, settings), Mangrove {
companion object : BlockFactory<Planks> {
override val identifier = minecraft("mangrove_planks")
override fun build(registries: Registries, settings: BlockSettings) = Planks(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.
*
@ -51,4 +51,13 @@ interface Oak {
override fun build(registries: Registries, settings: BlockSettings) = Slab(settings = settings)
}
}
class Planks(identifier: ResourceLocation = this.identifier, settings: BlockSettings) : PlanksBlock(identifier, settings), Oak {
companion object : BlockFactory<Planks> {
override val identifier = minecraft("oak_planks") // was this planks before?
override fun build(registries: Registries, settings: BlockSettings) = Planks(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.wood
import de.bixilon.minosoft.data.registries.blocks.settings.BlockSettings
import de.bixilon.minosoft.data.registries.blocks.state.BlockState
import de.bixilon.minosoft.data.registries.blocks.state.builder.BlockStateBuilder
import de.bixilon.minosoft.data.registries.blocks.state.builder.BlockStateSettings
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.ResourceLocation
import de.bixilon.minosoft.data.registries.item.items.Item
import de.bixilon.minosoft.data.registries.item.items.tool.axe.AxeRequirement
import de.bixilon.minosoft.protocol.versions.Version
abstract class PlanksBlock(identifier: ResourceLocation, settings: BlockSettings) : Block(identifier, settings), FullOpaqueBlock, BlockStateBuilder, AxeRequirement, BlockWithItem<Item> {
override val hardness get() = 2.0f
override val item: Item = this::item.inject(identifier)
override fun buildState(version: Version, settings: BlockStateSettings): BlockState {
return BlockState(this, 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.
*
@ -54,4 +54,13 @@ interface Spruce {
override fun build(registries: Registries, settings: BlockSettings) = Slab(settings = settings)
}
}
class Planks(identifier: ResourceLocation = this.identifier, settings: BlockSettings) : PlanksBlock(identifier, settings), Spruce {
companion object : BlockFactory<Planks> {
override val identifier = minecraft("spruce_planks")
override fun build(registries: Registries, settings: BlockSettings) = Planks(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.
*
@ -49,4 +49,13 @@ interface Warped {
override fun build(registries: Registries, settings: BlockSettings) = Slab(settings = settings)
}
}
class Planks(identifier: ResourceLocation = this.identifier, settings: BlockSettings) : PlanksBlock(identifier, settings), Warped {
companion object : BlockFactory<Planks> {
override val identifier = minecraft("warped_planks")
override fun build(registries: Registries, settings: BlockSettings) = Planks(settings = settings)
}
}
}