From 2fec0f1df72ca9fc6bb17e70ac9edbf0ca71b8ba Mon Sep 17 00:00:00 2001 From: Moritz Zwerger Date: Fri, 9 Aug 2024 12:33:09 +0200 Subject: [PATCH] add dirt, planks --- .../blocks/factory/BlockFactories.kt | 30 ++++++++-------- .../blocks/types/building/dirt/Dirt.kt | 36 +++++++++++++++++++ .../registries/blocks/types/wood/Acacia.kt | 12 ++++++- .../registries/blocks/types/wood/Azalea.kt | 11 +++++- .../registries/blocks/types/wood/Bamboo.kt | 11 +++++- .../blocks/types/wood/BambooMosaic.kt | 11 +++++- .../registries/blocks/types/wood/Birch.kt | 11 +++++- .../registries/blocks/types/wood/Cherry.kt | 11 +++++- .../registries/blocks/types/wood/Crimson.kt | 11 +++++- .../registries/blocks/types/wood/DarkOak.kt | 11 +++++- .../blocks/types/wood/FloweringAzalea.kt | 11 +++++- .../registries/blocks/types/wood/Jungle.kt | 11 +++++- .../registries/blocks/types/wood/Mangrove.kt | 11 +++++- .../data/registries/blocks/types/wood/Oak.kt | 11 +++++- .../blocks/types/wood/PlanksBlock.kt | 36 +++++++++++++++++++ .../registries/blocks/types/wood/Spruce.kt | 11 +++++- .../registries/blocks/types/wood/Warped.kt | 11 +++++- 17 files changed, 229 insertions(+), 28 deletions(-) create mode 100644 src/main/java/de/bixilon/minosoft/data/registries/blocks/types/building/dirt/Dirt.kt create mode 100644 src/main/java/de/bixilon/minosoft/data/registries/blocks/types/wood/PlanksBlock.kt diff --git a/src/main/java/de/bixilon/minosoft/data/registries/blocks/factory/BlockFactories.kt b/src/main/java/de/bixilon/minosoft/data/registries/blocks/factory/BlockFactories.kt index 8ef9c9517..07ffadeec 100644 --- a/src/main/java/de/bixilon/minosoft/data/registries/blocks/factory/BlockFactories.kt +++ b/src/main/java/de/bixilon/minosoft/data/registries/blocks/factory/BlockFactories.kt @@ -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>( CutCopper.Block, CutCopper.Slab, WaxedCutCopper.Block, WaxedCutCopper.Slab, + Dirt, GrassBlock, WaterFluidBlock, BubbleColumnBlock, LavaFluidBlock, @@ -125,20 +127,20 @@ object BlockFactories : DefaultFactory>( 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, diff --git a/src/main/java/de/bixilon/minosoft/data/registries/blocks/types/building/dirt/Dirt.kt b/src/main/java/de/bixilon/minosoft/data/registries/blocks/types/building/dirt/Dirt.kt new file mode 100644 index 000000000..de7b8cf3a --- /dev/null +++ b/src/main/java/de/bixilon/minosoft/data/registries/blocks/types/building/dirt/Dirt.kt @@ -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 . + * + * 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 { + override val item: Item = this::item.inject(identifier) + override val hardness get() = 0.5f + + companion object : BlockFactory { + override val identifier = minecraft("dirt") + + override fun build(registries: Registries, settings: BlockSettings) = Dirt(settings = settings) + } +} diff --git a/src/main/java/de/bixilon/minosoft/data/registries/blocks/types/wood/Acacia.kt b/src/main/java/de/bixilon/minosoft/data/registries/blocks/types/wood/Acacia.kt index c45089d2d..1ce6ec27d 100644 --- a/src/main/java/de/bixilon/minosoft/data/registries/blocks/types/wood/Acacia.kt +++ b/src/main/java/de/bixilon/minosoft/data/registries/blocks/types/wood/Acacia.kt @@ -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 { + override val identifier = minecraft("acacia_planks") + + override fun build(registries: Registries, settings: BlockSettings) = Planks(settings = settings) + } + } } diff --git a/src/main/java/de/bixilon/minosoft/data/registries/blocks/types/wood/Azalea.kt b/src/main/java/de/bixilon/minosoft/data/registries/blocks/types/wood/Azalea.kt index f9632fc77..69662e11e 100644 --- a/src/main/java/de/bixilon/minosoft/data/registries/blocks/types/wood/Azalea.kt +++ b/src/main/java/de/bixilon/minosoft/data/registries/blocks/types/wood/Azalea.kt @@ -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 { + override val identifier = minecraft("azalea_planks") + + override fun build(registries: Registries, settings: BlockSettings) = Planks(settings = settings) + } + } } diff --git a/src/main/java/de/bixilon/minosoft/data/registries/blocks/types/wood/Bamboo.kt b/src/main/java/de/bixilon/minosoft/data/registries/blocks/types/wood/Bamboo.kt index c91480344..d68cf5924 100644 --- a/src/main/java/de/bixilon/minosoft/data/registries/blocks/types/wood/Bamboo.kt +++ b/src/main/java/de/bixilon/minosoft/data/registries/blocks/types/wood/Bamboo.kt @@ -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 { + override val identifier = minecraft("bamboo_planks") // TODO: do the exist? + + override fun build(registries: Registries, settings: BlockSettings) = Planks(settings = settings) + } + } } diff --git a/src/main/java/de/bixilon/minosoft/data/registries/blocks/types/wood/BambooMosaic.kt b/src/main/java/de/bixilon/minosoft/data/registries/blocks/types/wood/BambooMosaic.kt index af49d28aa..c31b1d9e1 100644 --- a/src/main/java/de/bixilon/minosoft/data/registries/blocks/types/wood/BambooMosaic.kt +++ b/src/main/java/de/bixilon/minosoft/data/registries/blocks/types/wood/BambooMosaic.kt @@ -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 { + override val identifier = minecraft("bamboo_mosaic_planks") + + override fun build(registries: Registries, settings: BlockSettings) = Planks(settings = settings) + } + } } diff --git a/src/main/java/de/bixilon/minosoft/data/registries/blocks/types/wood/Birch.kt b/src/main/java/de/bixilon/minosoft/data/registries/blocks/types/wood/Birch.kt index 4e22eca81..82909af25 100644 --- a/src/main/java/de/bixilon/minosoft/data/registries/blocks/types/wood/Birch.kt +++ b/src/main/java/de/bixilon/minosoft/data/registries/blocks/types/wood/Birch.kt @@ -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 { + override val identifier = minecraft("birch_planks") + + override fun build(registries: Registries, settings: BlockSettings) = Planks(settings = settings) + } + } } diff --git a/src/main/java/de/bixilon/minosoft/data/registries/blocks/types/wood/Cherry.kt b/src/main/java/de/bixilon/minosoft/data/registries/blocks/types/wood/Cherry.kt index 72e6a0d67..fcc73c484 100644 --- a/src/main/java/de/bixilon/minosoft/data/registries/blocks/types/wood/Cherry.kt +++ b/src/main/java/de/bixilon/minosoft/data/registries/blocks/types/wood/Cherry.kt @@ -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 { + override val identifier = minecraft("cherry_planks") + + override fun build(registries: Registries, settings: BlockSettings) = Planks(settings = settings) + } + } } diff --git a/src/main/java/de/bixilon/minosoft/data/registries/blocks/types/wood/Crimson.kt b/src/main/java/de/bixilon/minosoft/data/registries/blocks/types/wood/Crimson.kt index eea708a2a..5173c322a 100644 --- a/src/main/java/de/bixilon/minosoft/data/registries/blocks/types/wood/Crimson.kt +++ b/src/main/java/de/bixilon/minosoft/data/registries/blocks/types/wood/Crimson.kt @@ -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 { + override val identifier = minecraft("crimson_planks") + + override fun build(registries: Registries, settings: BlockSettings) = Planks(settings = settings) + } + } } diff --git a/src/main/java/de/bixilon/minosoft/data/registries/blocks/types/wood/DarkOak.kt b/src/main/java/de/bixilon/minosoft/data/registries/blocks/types/wood/DarkOak.kt index ed4d2eb3d..e319ca8a8 100644 --- a/src/main/java/de/bixilon/minosoft/data/registries/blocks/types/wood/DarkOak.kt +++ b/src/main/java/de/bixilon/minosoft/data/registries/blocks/types/wood/DarkOak.kt @@ -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 { + override val identifier = minecraft("dark_oak_planks") + + override fun build(registries: Registries, settings: BlockSettings) = Planks(settings = settings) + } + } } diff --git a/src/main/java/de/bixilon/minosoft/data/registries/blocks/types/wood/FloweringAzalea.kt b/src/main/java/de/bixilon/minosoft/data/registries/blocks/types/wood/FloweringAzalea.kt index 297b559f6..5c9137a80 100644 --- a/src/main/java/de/bixilon/minosoft/data/registries/blocks/types/wood/FloweringAzalea.kt +++ b/src/main/java/de/bixilon/minosoft/data/registries/blocks/types/wood/FloweringAzalea.kt @@ -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 { + override val identifier = minecraft("flowering_azalea_planks") + + override fun build(registries: Registries, settings: BlockSettings) = Planks(settings = settings) + } + } } diff --git a/src/main/java/de/bixilon/minosoft/data/registries/blocks/types/wood/Jungle.kt b/src/main/java/de/bixilon/minosoft/data/registries/blocks/types/wood/Jungle.kt index 4a776a9a2..711185562 100644 --- a/src/main/java/de/bixilon/minosoft/data/registries/blocks/types/wood/Jungle.kt +++ b/src/main/java/de/bixilon/minosoft/data/registries/blocks/types/wood/Jungle.kt @@ -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 { + override val identifier = minecraft("jungle_planks") + + override fun build(registries: Registries, settings: BlockSettings) = Planks(settings = settings) + } + } } diff --git a/src/main/java/de/bixilon/minosoft/data/registries/blocks/types/wood/Mangrove.kt b/src/main/java/de/bixilon/minosoft/data/registries/blocks/types/wood/Mangrove.kt index 7f3e0a64f..7ea633699 100644 --- a/src/main/java/de/bixilon/minosoft/data/registries/blocks/types/wood/Mangrove.kt +++ b/src/main/java/de/bixilon/minosoft/data/registries/blocks/types/wood/Mangrove.kt @@ -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 { + override val identifier = minecraft("mangrove_planks") + + override fun build(registries: Registries, settings: BlockSettings) = Planks(settings = settings) + } + } } diff --git a/src/main/java/de/bixilon/minosoft/data/registries/blocks/types/wood/Oak.kt b/src/main/java/de/bixilon/minosoft/data/registries/blocks/types/wood/Oak.kt index 15fce5599..e02c86fd1 100644 --- a/src/main/java/de/bixilon/minosoft/data/registries/blocks/types/wood/Oak.kt +++ b/src/main/java/de/bixilon/minosoft/data/registries/blocks/types/wood/Oak.kt @@ -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 { + override val identifier = minecraft("oak_planks") // was this planks before? + + override fun build(registries: Registries, settings: BlockSettings) = Planks(settings = settings) + } + } } diff --git a/src/main/java/de/bixilon/minosoft/data/registries/blocks/types/wood/PlanksBlock.kt b/src/main/java/de/bixilon/minosoft/data/registries/blocks/types/wood/PlanksBlock.kt new file mode 100644 index 000000000..e68355c9b --- /dev/null +++ b/src/main/java/de/bixilon/minosoft/data/registries/blocks/types/wood/PlanksBlock.kt @@ -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 . + * + * 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 { + 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) + } +} diff --git a/src/main/java/de/bixilon/minosoft/data/registries/blocks/types/wood/Spruce.kt b/src/main/java/de/bixilon/minosoft/data/registries/blocks/types/wood/Spruce.kt index 255733e2c..427302b46 100644 --- a/src/main/java/de/bixilon/minosoft/data/registries/blocks/types/wood/Spruce.kt +++ b/src/main/java/de/bixilon/minosoft/data/registries/blocks/types/wood/Spruce.kt @@ -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 { + override val identifier = minecraft("spruce_planks") + + override fun build(registries: Registries, settings: BlockSettings) = Planks(settings = settings) + } + } } diff --git a/src/main/java/de/bixilon/minosoft/data/registries/blocks/types/wood/Warped.kt b/src/main/java/de/bixilon/minosoft/data/registries/blocks/types/wood/Warped.kt index 881a9c5d5..68b0843dd 100644 --- a/src/main/java/de/bixilon/minosoft/data/registries/blocks/types/wood/Warped.kt +++ b/src/main/java/de/bixilon/minosoft/data/registries/blocks/types/wood/Warped.kt @@ -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 { + override val identifier = minecraft("warped_planks") + + override fun build(registries: Registries, settings: BlockSettings) = Planks(settings = settings) + } + } }