diff --git a/src/main/java/de/bixilon/minosoft/data/entities/block/container/storage/ShulkerBoxBlockEntity.kt b/src/main/java/de/bixilon/minosoft/data/entities/block/container/storage/ShulkerBoxBlockEntity.kt index 1c6d99649..f26d60ddc 100644 --- a/src/main/java/de/bixilon/minosoft/data/entities/block/container/storage/ShulkerBoxBlockEntity.kt +++ b/src/main/java/de/bixilon/minosoft/data/entities/block/container/storage/ShulkerBoxBlockEntity.kt @@ -17,7 +17,6 @@ import de.bixilon.kotlinglm.vec3.Vec3i import de.bixilon.minosoft.data.colors.DyeColors import de.bixilon.minosoft.data.entities.block.BlockEntityFactory import de.bixilon.minosoft.data.registries.blocks.state.BlockState -import de.bixilon.minosoft.data.registries.identified.AliasedIdentified import de.bixilon.minosoft.data.registries.identified.Namespaces.minecraft import de.bixilon.minosoft.data.registries.identified.ResourceLocation import de.bixilon.minosoft.gui.rendering.RenderContext @@ -25,7 +24,6 @@ import de.bixilon.minosoft.gui.rendering.chunk.entities.BlockEntityRenderer import de.bixilon.minosoft.gui.rendering.chunk.entities.renderer.storage.shulker.ShulkerBoxRenderer import de.bixilon.minosoft.gui.rendering.skeletal.baked.BakedSkeletalModel import de.bixilon.minosoft.protocol.network.connection.play.PlayConnection -import de.bixilon.minosoft.util.KUtil.toResourceLocationList class ShulkerBoxBlockEntity(connection: PlayConnection) : StorageBlockEntity(connection) { @@ -37,6 +35,7 @@ class ShulkerBoxBlockEntity(connection: PlayConnection) : StorageBlockEntity(con // colored val color = DyeColors[prefix.removeSuffix("_")] model = context.models.skeletal[ShulkerBoxRenderer.NAME_COLOR[color.ordinal]] + // TODO: light gray -> silver (<1.13) } else { model = context.models.skeletal[ShulkerBoxRenderer.NAME] } @@ -44,15 +43,8 @@ class ShulkerBoxBlockEntity(connection: PlayConnection) : StorageBlockEntity(con return ShulkerBoxRenderer(this, context, blockState, blockPosition, model, light) } - companion object : BlockEntityFactory, AliasedIdentified { + companion object : BlockEntityFactory { override val identifier: ResourceLocation = minecraft("shulker_box") - override val identifiers: Set = setOf( - "minecraft:white_shulker_box", "minecraft:orange_shulker_box", "minecraft:magenta_shulker_box", "minecraft:light_blue_shulker_box", - "minecraft:yellow_shulker_box", "minecraft:lime_shulker_box", "minecraft:pink_shulker_box", "minecraft:gray_shulker_box", - "minecraft:silver_shulker_box", "minecraft:cyan_shulker_box", "minecraft:purple_shulker_box", "minecraft:blue_shulker_box", - "minecraft:brown_shulker_box", "minecraft:green_shulker_box", "minecraft:red_shulker_box", "minecraft:black_shulker_box", - ).toResourceLocationList() - override fun build(connection: PlayConnection): ShulkerBoxBlockEntity { return ShulkerBoxBlockEntity(connection) 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 7700c382a..1ebafcfd8 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 @@ -27,6 +27,9 @@ import de.bixilon.minosoft.data.registries.blocks.types.building.plants.FernBloc import de.bixilon.minosoft.data.registries.blocks.types.building.snow.SnowBlock import de.bixilon.minosoft.data.registries.blocks.types.building.snow.SnowLayerBlock import de.bixilon.minosoft.data.registries.blocks.types.climbing.ScaffoldingBlock +import de.bixilon.minosoft.data.registries.blocks.types.entity.storage.EnderChestBlock +import de.bixilon.minosoft.data.registries.blocks.types.entity.storage.ShulkerBoxBlock +import de.bixilon.minosoft.data.registries.blocks.types.entity.storage.WoodenChestBlock import de.bixilon.minosoft.data.registries.blocks.types.fluid.LavaFluidBlock import de.bixilon.minosoft.data.registries.blocks.types.fluid.water.BubbleColumnBlock import de.bixilon.minosoft.data.registries.blocks.types.fluid.water.WaterFluidBlock @@ -78,6 +81,10 @@ object BlockFactories : DefaultFactory>( SnowBlock, SnowLayerBlock, FernBlock.DeadBush, FernBlock.Grass, FernBlock.Fern, DoublePlant.Sunflower, DoublePlant.Lilac, DoublePlant.TallGrass, DoublePlant.LargeFern, DoublePlant.RoseBush, DoublePlant.Peony, DoublePlant.UpperBlock, + + + 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, ) { fun build(name: ResourceLocation, registries: Registries, settings: BlockSettings): Block? { diff --git a/src/main/java/de/bixilon/minosoft/data/registries/blocks/factory/PixLyzerBlockFactories.kt b/src/main/java/de/bixilon/minosoft/data/registries/blocks/factory/PixLyzerBlockFactories.kt index 256185d55..13893804a 100644 --- a/src/main/java/de/bixilon/minosoft/data/registries/blocks/factory/PixLyzerBlockFactories.kt +++ b/src/main/java/de/bixilon/minosoft/data/registries/blocks/factory/PixLyzerBlockFactories.kt @@ -17,17 +17,6 @@ import de.bixilon.minosoft.data.registries.blocks.types.pixlyzer.* import de.bixilon.minosoft.data.registries.blocks.types.pixlyzer.button.StoneButtonBlock import de.bixilon.minosoft.data.registries.blocks.types.pixlyzer.button.WoodenButtonBlock import de.bixilon.minosoft.data.registries.blocks.types.pixlyzer.entity.* -import de.bixilon.minosoft.data.registries.blocks.types.pixlyzer.entity.container.DispenserBlock -import de.bixilon.minosoft.data.registries.blocks.types.pixlyzer.entity.container.DropperBlock -import de.bixilon.minosoft.data.registries.blocks.types.pixlyzer.entity.container.HopperBlock -import de.bixilon.minosoft.data.registries.blocks.types.pixlyzer.entity.container.SmokerBlock -import de.bixilon.minosoft.data.registries.blocks.types.pixlyzer.entity.container.processing.BlastFurnaceBlock -import de.bixilon.minosoft.data.registries.blocks.types.pixlyzer.entity.container.processing.BrewingStandBlock -import de.bixilon.minosoft.data.registries.blocks.types.pixlyzer.entity.container.processing.FurnaceBlock -import de.bixilon.minosoft.data.registries.blocks.types.pixlyzer.entity.container.storage.BarrelBlock -import de.bixilon.minosoft.data.registries.blocks.types.pixlyzer.entity.container.storage.ChestBlock -import de.bixilon.minosoft.data.registries.blocks.types.pixlyzer.entity.container.storage.EnderChestBlock -import de.bixilon.minosoft.data.registries.blocks.types.pixlyzer.entity.container.storage.TrappedChestBlock import de.bixilon.minosoft.data.registries.blocks.types.pixlyzer.entity.end.EndGatewayBlock import de.bixilon.minosoft.data.registries.blocks.types.pixlyzer.entity.end.EndPortalBlock import de.bixilon.minosoft.data.registries.blocks.types.pixlyzer.entity.redstone.CommandBlock @@ -57,8 +46,6 @@ object PixLyzerBlockFactories : DefaultClassFactory>( ComparatorBlock, CampfireBlock, TorchBlock, - BrewingStandBlock, - EnderChestBlock, NetherPortalBlock, RedstoneTorchBlock, KelpBlock, @@ -70,33 +57,21 @@ object PixLyzerBlockFactories : DefaultClassFactory>( CropBlock, CraftingTableBlock, - FurnaceBlock, - ChestBlock, - TrappedChestBlock, - EnderChestBlock, - DispenserBlock, - DropperBlock, WallSignBlock, StandingSignBlock, MobSpawnerBlock, PistonBlock, - BrewingStandBlock, EnchantingTableBlock, EndPortalBlock, BeaconBlock, SkullBlock, DaylightDetectorBlock, - HopperBlock, BannerBlock, StructureBlock, EndGatewayBlock, CommandBlock, - ShulkerBoxBlock, BedBlock, ConduitBlock, - BarrelBlock, - SmokerBlock, - BlastFurnaceBlock, LecternBlock, BellBlock, JigsawBlock, diff --git a/src/main/java/de/bixilon/minosoft/data/registries/blocks/types/entity/storage/ChestBlock.kt b/src/main/java/de/bixilon/minosoft/data/registries/blocks/types/entity/storage/ChestBlock.kt new file mode 100644 index 000000000..379a68d91 --- /dev/null +++ b/src/main/java/de/bixilon/minosoft/data/registries/blocks/types/entity/storage/ChestBlock.kt @@ -0,0 +1,35 @@ +/* + * Minosoft + * Copyright (C) 2020-2023 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.entity.storage + +import de.bixilon.kotlinglm.vec3.Vec3i +import de.bixilon.minosoft.data.entities.block.BlockEntity +import de.bixilon.minosoft.data.entities.block.container.storage.StorageBlockEntity +import de.bixilon.minosoft.data.registries.blocks.shapes.collision.context.CollisionContext +import de.bixilon.minosoft.data.registries.blocks.state.BlockState +import de.bixilon.minosoft.data.registries.blocks.types.properties.shape.collision.CollidableBlock +import de.bixilon.minosoft.data.registries.blocks.types.properties.shape.outline.OutlinedBlock +import de.bixilon.minosoft.data.registries.shapes.voxel.VoxelShape +import de.bixilon.minosoft.data.world.positions.BlockPosition +import de.bixilon.minosoft.protocol.network.connection.play.PlayConnection + +interface ChestBlock : StorageBlock, OutlinedBlock, CollidableBlock { + + override fun getOutlineShape(connection: PlayConnection, position: BlockPosition, state: BlockState) = SINGLE + override fun getCollisionShape(connection: PlayConnection, context: CollisionContext, position: Vec3i, state: BlockState, blockEntity: BlockEntity?) = getOutlineShape(connection, position, state) + + companion object { + val SINGLE = VoxelShape(0.0625, 0.0, 0.0625, 0.9375, 0.875, 0.9375) + } +} diff --git a/src/main/java/de/bixilon/minosoft/data/registries/blocks/types/entity/storage/DoubleChestBlock.kt b/src/main/java/de/bixilon/minosoft/data/registries/blocks/types/entity/storage/DoubleChestBlock.kt new file mode 100644 index 000000000..d8095ebfc --- /dev/null +++ b/src/main/java/de/bixilon/minosoft/data/registries/blocks/types/entity/storage/DoubleChestBlock.kt @@ -0,0 +1,52 @@ +/* + * Minosoft + * Copyright (C) 2020-2023 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.entity.storage + +import de.bixilon.minosoft.data.direction.DirectionUtil.rotateY +import de.bixilon.minosoft.data.direction.Directions +import de.bixilon.minosoft.data.entities.block.container.storage.StorageBlockEntity +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.state.BlockState +import de.bixilon.minosoft.data.registries.blocks.state.PropertyBlockState +import de.bixilon.minosoft.data.registries.shapes.voxel.VoxelShape +import de.bixilon.minosoft.data.world.positions.BlockPosition +import de.bixilon.minosoft.protocol.network.connection.play.PlayConnection + +interface DoubleChestBlock : ChestBlock { + + override fun getOutlineShape(connection: PlayConnection, position: BlockPosition, state: BlockState): VoxelShape { + if (state !is PropertyBlockState) return super.getOutlineShape(connection, position, state) + val type = state.properties[BlockProperties.CHEST_TYPE] ?: return ChestBlock.SINGLE + if (type == ChestTypes.SINGLE) return ChestBlock.SINGLE + var facing = state[BlockProperties.FACING] // TODO: HORIZONTAL_FACING + + if (type == ChestTypes.LEFT) { + facing = facing.rotateY(1) + } + // TODO: verify + // TODO: legacy: check if neighbour block is chest + + return SHAPES[facing.ordinal - Directions.SIDE_OFFSET] + } + + companion object { + val SHAPES = arrayOf( + VoxelShape(0.0625, 0.0, 0.0, 0.9375, 0.875, 0.9375), + VoxelShape(0.0625, 0.0, 0.0625, 0.9375, 0.875, 1.0), + VoxelShape(0.0, 0.0, 0.0625, 0.9375, 0.875, 0.9375), + VoxelShape(0.0625, 0.0, 0.0625, 1.0, 0.875, 0.9375), + ) + } +} diff --git a/src/main/java/de/bixilon/minosoft/data/registries/blocks/types/entity/storage/EnderChestBlock.kt b/src/main/java/de/bixilon/minosoft/data/registries/blocks/types/entity/storage/EnderChestBlock.kt new file mode 100644 index 000000000..c20844443 --- /dev/null +++ b/src/main/java/de/bixilon/minosoft/data/registries/blocks/types/entity/storage/EnderChestBlock.kt @@ -0,0 +1,35 @@ +/* + * Minosoft + * Copyright (C) 2020-2023 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.entity.storage + +import de.bixilon.minosoft.data.entities.block.container.storage.EnderChestBlockEntity +import de.bixilon.minosoft.data.registries.blocks.entites.BlockEntityType +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.identified.Namespaces.minecraft +import de.bixilon.minosoft.data.registries.identified.ResourceLocation +import de.bixilon.minosoft.data.registries.item.items.tool.pickaxe.PickaxeRequirement +import de.bixilon.minosoft.data.registries.registries.Registries + +open class EnderChestBlock(identifier: ResourceLocation = this.identifier, settings: BlockSettings) : Block(identifier, settings), ChestBlock, PickaxeRequirement { + override val blockEntity: BlockEntityType = this::blockEntity.inject(this) + override val hardness: Float get() = 22.5f + + companion object : BlockFactory { + override val identifier = minecraft("ender_chest") + + override fun build(registries: Registries, settings: BlockSettings) = EnderChestBlock(settings = settings) + } +} diff --git a/src/main/java/de/bixilon/minosoft/data/registries/blocks/types/entity/storage/ShulkerBoxBlock.kt b/src/main/java/de/bixilon/minosoft/data/registries/blocks/types/entity/storage/ShulkerBoxBlock.kt new file mode 100644 index 000000000..3282d4133 --- /dev/null +++ b/src/main/java/de/bixilon/minosoft/data/registries/blocks/types/entity/storage/ShulkerBoxBlock.kt @@ -0,0 +1,201 @@ +/* + * Minosoft + * Copyright (C) 2020-2023 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.entity.storage + +import de.bixilon.minosoft.data.colors.DyeColors +import de.bixilon.minosoft.data.entities.block.container.storage.ShulkerBoxBlockEntity +import de.bixilon.minosoft.data.registries.blocks.entites.BlockEntityType +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.DyedBlock +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 ShulkerBoxBlock(identifier: ResourceLocation, settings: BlockSettings) : Block(identifier, settings), StorageBlock, FullOpaqueBlock, BlockWithItem { + override val blockEntity: BlockEntityType = this::blockEntity.inject(this) + override val item: Item = this::item.inject(identifier) + override val hardness: Float get() = 2.0f + + + companion object : BlockFactory { + override val identifier = minecraft("shulker_box") + + override fun build(registries: Registries, settings: BlockSettings) = ShulkerBoxBlock(identifier, settings = settings) + } + + open class White(identifier: ResourceLocation = Companion.identifier, settings: BlockSettings) : ShulkerBoxBlock(identifier, settings), DyedBlock { + override val color: DyeColors get() = DyeColors.WHITE + + companion object : BlockFactory { + override val identifier = minecraft("white_shulker_box") + + override fun build(registries: Registries, settings: BlockSettings) = White(settings = settings) + } + } + + open class Orange(identifier: ResourceLocation = Companion.identifier, settings: BlockSettings) : ShulkerBoxBlock(identifier, settings), DyedBlock { + override val color: DyeColors get() = DyeColors.ORANGE + + companion object : BlockFactory { + override val identifier = minecraft("orange_shulker_box") + + override fun build(registries: Registries, settings: BlockSettings) = Orange(settings = settings) + } + } + + open class Magenta(identifier: ResourceLocation = Companion.identifier, settings: BlockSettings) : ShulkerBoxBlock(identifier, settings), DyedBlock { + override val color: DyeColors get() = DyeColors.MAGENTA + + companion object : BlockFactory { + override val identifier = minecraft("magenta_shulker_box") + + override fun build(registries: Registries, settings: BlockSettings) = Magenta(settings = settings) + } + } + + open class LightBlue(identifier: ResourceLocation = Companion.identifier, settings: BlockSettings) : ShulkerBoxBlock(identifier, settings), DyedBlock { + override val color: DyeColors get() = DyeColors.LIGHT_BLUE + + companion object : BlockFactory { + override val identifier = minecraft("light_blue_shulker_box") + + override fun build(registries: Registries, settings: BlockSettings) = LightBlue(settings = settings) + } + } + + open class Yellow(identifier: ResourceLocation = Companion.identifier, settings: BlockSettings) : ShulkerBoxBlock(identifier, settings), DyedBlock { + override val color: DyeColors get() = DyeColors.YELLOW + + companion object : BlockFactory { + override val identifier = minecraft("yellow_shulker_box") + + override fun build(registries: Registries, settings: BlockSettings) = Yellow(settings = settings) + } + } + + open class Lime(identifier: ResourceLocation = Companion.identifier, settings: BlockSettings) : ShulkerBoxBlock(identifier, settings), DyedBlock { + override val color: DyeColors get() = DyeColors.LIME + + companion object : BlockFactory { + override val identifier = minecraft("lime_shulker_box") + + override fun build(registries: Registries, settings: BlockSettings) = Lime(settings = settings) + } + } + + open class Pink(identifier: ResourceLocation = Companion.identifier, settings: BlockSettings) : ShulkerBoxBlock(identifier, settings), DyedBlock { + override val color: DyeColors get() = DyeColors.PINK + + companion object : BlockFactory { + override val identifier = minecraft("pink_shulker_box") + + override fun build(registries: Registries, settings: BlockSettings) = Pink(settings = settings) + } + } + + open class Gray(identifier: ResourceLocation = Companion.identifier, settings: BlockSettings) : ShulkerBoxBlock(identifier, settings), DyedBlock { + override val color: DyeColors get() = DyeColors.GRAY + + companion object : BlockFactory { + override val identifier = minecraft("gray_shulker_box") + + override fun build(registries: Registries, settings: BlockSettings) = Gray(settings = settings) + } + } + + open class LightGray(identifier: ResourceLocation = Companion.identifier, settings: BlockSettings) : ShulkerBoxBlock(identifier, settings), DyedBlock { + override val color: DyeColors get() = DyeColors.LIGHT_GRAY + + companion object : BlockFactory { + override val identifier = minecraft("light_gray_shulker_box") + + override fun build(registries: Registries, settings: BlockSettings) = LightGray(settings = settings) + } + } + + open class Cyan(identifier: ResourceLocation = Companion.identifier, settings: BlockSettings) : ShulkerBoxBlock(identifier, settings), DyedBlock { + override val color: DyeColors get() = DyeColors.CYAN + + companion object : BlockFactory { + override val identifier = minecraft("cyan_shulker_box") + + override fun build(registries: Registries, settings: BlockSettings) = Cyan(settings = settings) + } + } + + open class Purple(identifier: ResourceLocation = Companion.identifier, settings: BlockSettings) : ShulkerBoxBlock(identifier, settings), DyedBlock { + override val color: DyeColors get() = DyeColors.PURPLE + + companion object : BlockFactory { + override val identifier = minecraft("purple_shulker_box") + + override fun build(registries: Registries, settings: BlockSettings) = Purple(settings = settings) + } + } + + open class Blue(identifier: ResourceLocation = Companion.identifier, settings: BlockSettings) : ShulkerBoxBlock(identifier, settings), DyedBlock { + override val color: DyeColors get() = DyeColors.BLUE + + companion object : BlockFactory { + override val identifier = minecraft("blue_shulker_box") + + override fun build(registries: Registries, settings: BlockSettings) = Blue(settings = settings) + } + } + + open class Brown(identifier: ResourceLocation = Companion.identifier, settings: BlockSettings) : ShulkerBoxBlock(identifier, settings), DyedBlock { + override val color: DyeColors get() = DyeColors.BROWN + + companion object : BlockFactory { + override val identifier = minecraft("brown_shulker_box") + + override fun build(registries: Registries, settings: BlockSettings) = Brown(settings = settings) + } + } + + open class Green(identifier: ResourceLocation = Companion.identifier, settings: BlockSettings) : ShulkerBoxBlock(identifier, settings), DyedBlock { + override val color: DyeColors get() = DyeColors.GREEN + + companion object : BlockFactory { + override val identifier = minecraft("green_shulker_box") + + override fun build(registries: Registries, settings: BlockSettings) = Green(settings = settings) + } + } + + open class Red(identifier: ResourceLocation = Companion.identifier, settings: BlockSettings) : ShulkerBoxBlock(identifier, settings), DyedBlock { + override val color: DyeColors get() = DyeColors.RED + + companion object : BlockFactory { + override val identifier = minecraft("red_shulker_box") + + override fun build(registries: Registries, settings: BlockSettings) = Red(settings = settings) + } + } + + open class Black(identifier: ResourceLocation = Companion.identifier, settings: BlockSettings) : ShulkerBoxBlock(identifier, settings), DyedBlock { + override val color: DyeColors get() = DyeColors.BLACK + + companion object : BlockFactory { + override val identifier = minecraft("black_shulker_box") + + override fun build(registries: Registries, settings: BlockSettings) = Black(settings = settings) + } + } +} diff --git a/src/main/java/de/bixilon/minosoft/data/registries/blocks/types/pixlyzer/entity/container/storage/ChestBlock.kt b/src/main/java/de/bixilon/minosoft/data/registries/blocks/types/entity/storage/StorageBlock.kt similarity index 68% rename from src/main/java/de/bixilon/minosoft/data/registries/blocks/types/pixlyzer/entity/container/storage/ChestBlock.kt rename to src/main/java/de/bixilon/minosoft/data/registries/blocks/types/entity/storage/StorageBlock.kt index e83e8c220..347d67524 100644 --- a/src/main/java/de/bixilon/minosoft/data/registries/blocks/types/pixlyzer/entity/container/storage/ChestBlock.kt +++ b/src/main/java/de/bixilon/minosoft/data/registries/blocks/types/entity/storage/StorageBlock.kt @@ -11,23 +11,21 @@ * This software is not affiliated with Mojang AB, the original developer of Minecraft. */ -package de.bixilon.minosoft.data.registries.blocks.types.pixlyzer.entity.container.storage +package de.bixilon.minosoft.data.registries.blocks.types.entity.storage import de.bixilon.kutil.cast.CastUtil.unsafeCast import de.bixilon.minosoft.camera.target.targets.BlockTarget import de.bixilon.minosoft.config.DebugOptions import de.bixilon.minosoft.data.container.stack.ItemStack import de.bixilon.minosoft.data.entities.block.container.storage.ChestBlockEntity +import de.bixilon.minosoft.data.entities.block.container.storage.StorageBlockEntity import de.bixilon.minosoft.data.entities.entities.player.Hands -import de.bixilon.minosoft.data.registries.blocks.factory.PixLyzerBlockFactory +import de.bixilon.minosoft.data.registries.blocks.types.entity.BlockWithEntity import de.bixilon.minosoft.data.registries.blocks.types.properties.InteractBlockHandler -import de.bixilon.minosoft.data.registries.identified.ResourceLocation -import de.bixilon.minosoft.data.registries.registries.Registries import de.bixilon.minosoft.input.interaction.InteractionResults import de.bixilon.minosoft.protocol.network.connection.play.PlayConnection -open class ChestBlock(resourceLocation: ResourceLocation, registries: Registries, data: Map) : StorageBlock(resourceLocation, registries, data), InteractBlockHandler { - +interface StorageBlock : BlockWithEntity, InteractBlockHandler { override fun interact(connection: PlayConnection, target: BlockTarget, hand: Hands, stack: ItemStack?): InteractionResults { if (!DebugOptions.FORCE_CHEST_ANIMATION) return super.interact(connection, target, hand, stack) @@ -36,12 +34,4 @@ open class ChestBlock(resourceLocation: ResourceLocation, entity.setBlockActionData(0, if (entity.viewing > 0) 0 else 1) return InteractionResults.SUCCESS } - - - companion object : PixLyzerBlockFactory> { - override fun build(resourceLocation: ResourceLocation, registries: Registries, data: Map): ChestBlock { - return ChestBlock(resourceLocation, registries, data) - } - } } - diff --git a/src/main/java/de/bixilon/minosoft/data/registries/blocks/types/entity/storage/WoodenChestBlock.kt b/src/main/java/de/bixilon/minosoft/data/registries/blocks/types/entity/storage/WoodenChestBlock.kt new file mode 100644 index 000000000..2857ace1b --- /dev/null +++ b/src/main/java/de/bixilon/minosoft/data/registries/blocks/types/entity/storage/WoodenChestBlock.kt @@ -0,0 +1,53 @@ +/* + * Minosoft + * Copyright (C) 2020-2023 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.entity.storage + +import de.bixilon.minosoft.data.entities.block.container.storage.ChestBlockEntity +import de.bixilon.minosoft.data.entities.block.container.storage.TrappedChestBlockEntity +import de.bixilon.minosoft.data.registries.blocks.entites.BlockEntityType +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.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.axe.AxeRequirement +import de.bixilon.minosoft.data.registries.registries.Registries + +abstract class WoodenChestBlock(identifier: ResourceLocation, settings: BlockSettings) : Block(identifier, settings), BlockWithItem, AxeRequirement, DoubleChestBlock { + override val hardness: Float get() = 2.5f + override val item: Item = this::item.inject(identifier) + + + open class Chest(identifier: ResourceLocation = this.identifier, settings: BlockSettings) : WoodenChestBlock(identifier, settings) { + override val blockEntity: BlockEntityType = this::blockEntity.inject(this) + + companion object : BlockFactory { + override val identifier = minecraft("chest") + + override fun build(registries: Registries, settings: BlockSettings) = Chest(settings = settings) + } + } + + open class TrappedChest(identifier: ResourceLocation = this.identifier, settings: BlockSettings) : WoodenChestBlock(identifier, settings) { + override val blockEntity: BlockEntityType = this::blockEntity.inject(this) + + companion object : BlockFactory { + override val identifier = minecraft("trapped_chest") + + override fun build(registries: Registries, settings: BlockSettings) = TrappedChest(settings = settings) + } + } +} diff --git a/src/main/java/de/bixilon/minosoft/data/registries/blocks/types/pixlyzer/entity/PixLyzerBlockWithEntity.kt b/src/main/java/de/bixilon/minosoft/data/registries/blocks/types/pixlyzer/entity/PixLyzerBlockWithEntity.kt index bccabbd57..6120cab37 100644 --- a/src/main/java/de/bixilon/minosoft/data/registries/blocks/types/pixlyzer/entity/PixLyzerBlockWithEntity.kt +++ b/src/main/java/de/bixilon/minosoft/data/registries/blocks/types/pixlyzer/entity/PixLyzerBlockWithEntity.kt @@ -14,18 +14,13 @@ package de.bixilon.minosoft.data.registries.blocks.types.pixlyzer.entity import de.bixilon.kutil.cast.CastUtil.unsafeNull -import de.bixilon.minosoft.camera.target.targets.BlockTarget -import de.bixilon.minosoft.data.container.stack.ItemStack import de.bixilon.minosoft.data.entities.block.BlockEntity -import de.bixilon.minosoft.data.entities.entities.player.Hands import de.bixilon.minosoft.data.registries.blocks.entites.BlockEntityType import de.bixilon.minosoft.data.registries.blocks.types.entity.BlockWithEntity import de.bixilon.minosoft.data.registries.blocks.types.pixlyzer.PixLyzerBlock import de.bixilon.minosoft.data.registries.identified.ResourceLocation import de.bixilon.minosoft.data.registries.registries.Registries import de.bixilon.minosoft.data.registries.registries.registry.RegistryItem -import de.bixilon.minosoft.input.interaction.InteractionResults -import de.bixilon.minosoft.protocol.network.connection.play.PlayConnection import kotlin.reflect.jvm.javaField abstract class PixLyzerBlockWithEntity(resourceLocation: ResourceLocation, registries: Registries, data: Map) : PixLyzerBlock(resourceLocation, registries, data), BlockWithEntity { @@ -35,8 +30,6 @@ abstract class PixLyzerBlockWithEntity(resourceLocation: Resour FACTORY_FIELD.inject(this) } - override fun interact(connection: PlayConnection, target: BlockTarget, hand: Hands, stack: ItemStack?) = InteractionResults.SUCCESS - private companion object { val FACTORY_FIELD = PixLyzerBlockWithEntity<*>::blockEntity.javaField!! } diff --git a/src/main/java/de/bixilon/minosoft/data/registries/blocks/types/pixlyzer/entity/ShulkerBoxBlock.kt b/src/main/java/de/bixilon/minosoft/data/registries/blocks/types/pixlyzer/entity/ShulkerBoxBlock.kt deleted file mode 100644 index efa4fec22..000000000 --- a/src/main/java/de/bixilon/minosoft/data/registries/blocks/types/pixlyzer/entity/ShulkerBoxBlock.kt +++ /dev/null @@ -1,29 +0,0 @@ -/* - * Minosoft - * Copyright (C) 2020-2023 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.pixlyzer.entity - -import de.bixilon.minosoft.data.entities.block.container.storage.ShulkerBoxBlockEntity -import de.bixilon.minosoft.data.registries.blocks.factory.PixLyzerBlockFactory -import de.bixilon.minosoft.data.registries.identified.ResourceLocation -import de.bixilon.minosoft.data.registries.registries.Registries - -open class ShulkerBoxBlock(resourceLocation: ResourceLocation, registries: Registries, data: Map) : PixLyzerBlockWithEntity(resourceLocation, registries, data) { - - companion object : PixLyzerBlockFactory { - override fun build(resourceLocation: ResourceLocation, registries: Registries, data: Map): ShulkerBoxBlock { - return ShulkerBoxBlock(resourceLocation, registries, data) - } - } -} - diff --git a/src/main/java/de/bixilon/minosoft/data/registries/blocks/types/pixlyzer/entity/container/ContainerBlock.kt b/src/main/java/de/bixilon/minosoft/data/registries/blocks/types/pixlyzer/entity/container/ContainerBlock.kt deleted file mode 100644 index 651b8565b..000000000 --- a/src/main/java/de/bixilon/minosoft/data/registries/blocks/types/pixlyzer/entity/container/ContainerBlock.kt +++ /dev/null @@ -1,21 +0,0 @@ -/* - * Minosoft - * Copyright (C) 2020-2023 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.pixlyzer.entity.container - -import de.bixilon.minosoft.data.entities.block.container.ContainerBlockEntity -import de.bixilon.minosoft.data.registries.blocks.types.pixlyzer.entity.PixLyzerBlockWithEntity -import de.bixilon.minosoft.data.registries.identified.ResourceLocation -import de.bixilon.minosoft.data.registries.registries.Registries - -abstract class ContainerBlock(resourceLocation: ResourceLocation, registries: Registries, data: Map) : PixLyzerBlockWithEntity(resourceLocation, registries, data) diff --git a/src/main/java/de/bixilon/minosoft/data/registries/blocks/types/pixlyzer/entity/container/DispenserBlock.kt b/src/main/java/de/bixilon/minosoft/data/registries/blocks/types/pixlyzer/entity/container/DispenserBlock.kt deleted file mode 100644 index 04bf293ed..000000000 --- a/src/main/java/de/bixilon/minosoft/data/registries/blocks/types/pixlyzer/entity/container/DispenserBlock.kt +++ /dev/null @@ -1,29 +0,0 @@ -/* - * Minosoft - * Copyright (C) 2020-2023 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.pixlyzer.entity.container - -import de.bixilon.minosoft.data.entities.block.container.processing.DispenserBlockEntity -import de.bixilon.minosoft.data.registries.blocks.factory.PixLyzerBlockFactory -import de.bixilon.minosoft.data.registries.identified.ResourceLocation -import de.bixilon.minosoft.data.registries.registries.Registries - -open class DispenserBlock(resourceLocation: ResourceLocation, registries: Registries, data: Map) : ContainerBlock(resourceLocation, registries, data) { - - companion object : PixLyzerBlockFactory { - override fun build(resourceLocation: ResourceLocation, registries: Registries, data: Map): DispenserBlock { - return DispenserBlock(resourceLocation, registries, data) - } - } -} - diff --git a/src/main/java/de/bixilon/minosoft/data/registries/blocks/types/pixlyzer/entity/container/DropperBlock.kt b/src/main/java/de/bixilon/minosoft/data/registries/blocks/types/pixlyzer/entity/container/DropperBlock.kt deleted file mode 100644 index 12e18c2f3..000000000 --- a/src/main/java/de/bixilon/minosoft/data/registries/blocks/types/pixlyzer/entity/container/DropperBlock.kt +++ /dev/null @@ -1,29 +0,0 @@ -/* - * Minosoft - * Copyright (C) 2020-2023 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.pixlyzer.entity.container - -import de.bixilon.minosoft.data.entities.block.container.processing.DropperBlockEntity -import de.bixilon.minosoft.data.registries.blocks.factory.PixLyzerBlockFactory -import de.bixilon.minosoft.data.registries.identified.ResourceLocation -import de.bixilon.minosoft.data.registries.registries.Registries - -open class DropperBlock(resourceLocation: ResourceLocation, registries: Registries, data: Map) : ContainerBlock(resourceLocation, registries, data) { - - companion object : PixLyzerBlockFactory { - override fun build(resourceLocation: ResourceLocation, registries: Registries, data: Map): DropperBlock { - return DropperBlock(resourceLocation, registries, data) - } - } -} - diff --git a/src/main/java/de/bixilon/minosoft/data/registries/blocks/types/pixlyzer/entity/container/HopperBlock.kt b/src/main/java/de/bixilon/minosoft/data/registries/blocks/types/pixlyzer/entity/container/HopperBlock.kt deleted file mode 100644 index a2e2151f8..000000000 --- a/src/main/java/de/bixilon/minosoft/data/registries/blocks/types/pixlyzer/entity/container/HopperBlock.kt +++ /dev/null @@ -1,30 +0,0 @@ -/* - * Minosoft - * Copyright (C) 2020-2023 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.pixlyzer.entity.container - -import de.bixilon.minosoft.data.entities.block.container.processing.HopperBlockEntity -import de.bixilon.minosoft.data.registries.blocks.factory.PixLyzerBlockFactory -import de.bixilon.minosoft.data.registries.identified.ResourceLocation -import de.bixilon.minosoft.data.registries.registries.Registries - -open class HopperBlock(resourceLocation: ResourceLocation, registries: Registries, data: Map) : ContainerBlock(resourceLocation, registries, data) { - - companion object : PixLyzerBlockFactory { - - override fun build(resourceLocation: ResourceLocation, registries: Registries, data: Map): HopperBlock { - return HopperBlock(resourceLocation, registries, data) - } - } -} - diff --git a/src/main/java/de/bixilon/minosoft/data/registries/blocks/types/pixlyzer/entity/container/SmokerBlock.kt b/src/main/java/de/bixilon/minosoft/data/registries/blocks/types/pixlyzer/entity/container/SmokerBlock.kt deleted file mode 100644 index 209cd555e..000000000 --- a/src/main/java/de/bixilon/minosoft/data/registries/blocks/types/pixlyzer/entity/container/SmokerBlock.kt +++ /dev/null @@ -1,29 +0,0 @@ -/* - * Minosoft - * Copyright (C) 2020-2023 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.pixlyzer.entity.container - -import de.bixilon.minosoft.data.entities.block.container.processing.SmokerBlockEntity -import de.bixilon.minosoft.data.registries.blocks.factory.PixLyzerBlockFactory -import de.bixilon.minosoft.data.registries.identified.ResourceLocation -import de.bixilon.minosoft.data.registries.registries.Registries - -open class SmokerBlock(resourceLocation: ResourceLocation, registries: Registries, data: Map) : ContainerBlock(resourceLocation, registries, data) { - - companion object : PixLyzerBlockFactory { - override fun build(resourceLocation: ResourceLocation, registries: Registries, data: Map): SmokerBlock { - return SmokerBlock(resourceLocation, registries, data) - } - } -} - diff --git a/src/main/java/de/bixilon/minosoft/data/registries/blocks/types/pixlyzer/entity/container/processing/BlastFurnaceBlock.kt b/src/main/java/de/bixilon/minosoft/data/registries/blocks/types/pixlyzer/entity/container/processing/BlastFurnaceBlock.kt deleted file mode 100644 index 3d1d0422f..000000000 --- a/src/main/java/de/bixilon/minosoft/data/registries/blocks/types/pixlyzer/entity/container/processing/BlastFurnaceBlock.kt +++ /dev/null @@ -1,29 +0,0 @@ -/* - * Minosoft - * Copyright (C) 2020-2023 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.pixlyzer.entity.container.processing - -import de.bixilon.minosoft.data.entities.block.container.processing.BlastFurnaceBlockEntity -import de.bixilon.minosoft.data.registries.blocks.factory.PixLyzerBlockFactory -import de.bixilon.minosoft.data.registries.identified.ResourceLocation -import de.bixilon.minosoft.data.registries.registries.Registries - -open class BlastFurnaceBlock(resourceLocation: ResourceLocation, registries: Registries, data: Map) : ProcessingBlock(resourceLocation, registries, data) { - - companion object : PixLyzerBlockFactory { - override fun build(resourceLocation: ResourceLocation, registries: Registries, data: Map): BlastFurnaceBlock { - return BlastFurnaceBlock(resourceLocation, registries, data) - } - } -} - diff --git a/src/main/java/de/bixilon/minosoft/data/registries/blocks/types/pixlyzer/entity/container/processing/BrewingStandBlock.kt b/src/main/java/de/bixilon/minosoft/data/registries/blocks/types/pixlyzer/entity/container/processing/BrewingStandBlock.kt deleted file mode 100644 index b8d5aed93..000000000 --- a/src/main/java/de/bixilon/minosoft/data/registries/blocks/types/pixlyzer/entity/container/processing/BrewingStandBlock.kt +++ /dev/null @@ -1,52 +0,0 @@ -/* - * Minosoft - * Copyright (C) 2020-2023 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.pixlyzer.entity.container.processing - -import de.bixilon.kotlinglm.vec3.Vec3d -import de.bixilon.minosoft.data.entities.block.container.processing.BrewingStandBlockEntity -import de.bixilon.minosoft.data.registries.blocks.factory.PixLyzerBlockFactory -import de.bixilon.minosoft.data.registries.blocks.state.BlockState -import de.bixilon.minosoft.data.registries.blocks.types.properties.rendering.RandomDisplayTickable -import de.bixilon.minosoft.data.registries.identified.ResourceLocation -import de.bixilon.minosoft.data.registries.registries.Registries -import de.bixilon.minosoft.data.world.positions.BlockPosition -import de.bixilon.minosoft.gui.rendering.particle.types.render.texture.simple.fire.SmokeParticle -import de.bixilon.minosoft.gui.rendering.util.VecUtil.horizontal -import de.bixilon.minosoft.gui.rendering.util.VecUtil.toVec3d -import de.bixilon.minosoft.gui.rendering.util.vec.vec3.Vec3dUtil.EMPTY -import de.bixilon.minosoft.protocol.network.connection.play.PlayConnection -import java.util.* - -open class BrewingStandBlock(resourceLocation: ResourceLocation, registries: Registries, data: Map) : ProcessingBlock(resourceLocation, registries, data), RandomDisplayTickable { - private val smokeParticle = registries.particleType[SmokeParticle] - - override fun randomDisplayTick(connection: PlayConnection, state: BlockState, position: BlockPosition, random: Random) { - smokeParticle?.let { - connection.world += SmokeParticle( - connection, - position.toVec3d + Vec3d(0.4, 0.7, 0.4) + Vec3d.horizontal({ random.nextDouble() * 0.2 }, random.nextDouble() * 0.3), - Vec3d.EMPTY, - it.default(), - ) - } - } - - companion object : PixLyzerBlockFactory { - - override fun build(resourceLocation: ResourceLocation, registries: Registries, data: Map): BrewingStandBlock { - return BrewingStandBlock(resourceLocation, registries, data) - } - } -} - diff --git a/src/main/java/de/bixilon/minosoft/data/registries/blocks/types/pixlyzer/entity/container/processing/FurnaceBlock.kt b/src/main/java/de/bixilon/minosoft/data/registries/blocks/types/pixlyzer/entity/container/processing/FurnaceBlock.kt deleted file mode 100644 index 9b6e38e17..000000000 --- a/src/main/java/de/bixilon/minosoft/data/registries/blocks/types/pixlyzer/entity/container/processing/FurnaceBlock.kt +++ /dev/null @@ -1,29 +0,0 @@ -/* - * Minosoft - * Copyright (C) 2020-2023 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.pixlyzer.entity.container.processing - -import de.bixilon.minosoft.data.entities.block.container.processing.FurnaceBlockEntity -import de.bixilon.minosoft.data.registries.blocks.factory.PixLyzerBlockFactory -import de.bixilon.minosoft.data.registries.identified.ResourceLocation -import de.bixilon.minosoft.data.registries.registries.Registries - -open class FurnaceBlock(resourceLocation: ResourceLocation, registries: Registries, data: Map) : ProcessingBlock(resourceLocation, registries, data) { - - companion object : PixLyzerBlockFactory { - override fun build(resourceLocation: ResourceLocation, registries: Registries, data: Map): FurnaceBlock { - return FurnaceBlock(resourceLocation, registries, data) - } - } -} - diff --git a/src/main/java/de/bixilon/minosoft/data/registries/blocks/types/pixlyzer/entity/container/processing/ProcessingBlock.kt b/src/main/java/de/bixilon/minosoft/data/registries/blocks/types/pixlyzer/entity/container/processing/ProcessingBlock.kt deleted file mode 100644 index 25be200bc..000000000 --- a/src/main/java/de/bixilon/minosoft/data/registries/blocks/types/pixlyzer/entity/container/processing/ProcessingBlock.kt +++ /dev/null @@ -1,21 +0,0 @@ -/* - * Minosoft - * Copyright (C) 2020-2023 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.pixlyzer.entity.container.processing - -import de.bixilon.minosoft.data.entities.block.container.processing.ProcessingBlockEntity -import de.bixilon.minosoft.data.registries.blocks.types.pixlyzer.entity.container.ContainerBlock -import de.bixilon.minosoft.data.registries.identified.ResourceLocation -import de.bixilon.minosoft.data.registries.registries.Registries - -abstract class ProcessingBlock(resourceLocation: ResourceLocation, registries: Registries, data: Map) : ContainerBlock(resourceLocation, registries, data) diff --git a/src/main/java/de/bixilon/minosoft/data/registries/blocks/types/pixlyzer/entity/container/storage/BarrelBlock.kt b/src/main/java/de/bixilon/minosoft/data/registries/blocks/types/pixlyzer/entity/container/storage/BarrelBlock.kt deleted file mode 100644 index bdc733643..000000000 --- a/src/main/java/de/bixilon/minosoft/data/registries/blocks/types/pixlyzer/entity/container/storage/BarrelBlock.kt +++ /dev/null @@ -1,29 +0,0 @@ -/* - * Minosoft - * Copyright (C) 2020-2023 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.pixlyzer.entity.container.storage - -import de.bixilon.minosoft.data.entities.block.container.storage.BarrelBlockEntity -import de.bixilon.minosoft.data.registries.blocks.factory.PixLyzerBlockFactory -import de.bixilon.minosoft.data.registries.identified.ResourceLocation -import de.bixilon.minosoft.data.registries.registries.Registries - -class BarrelBlock(resourceLocation: ResourceLocation, registries: Registries, data: Map) : StorageBlock(resourceLocation, registries, data) { - - companion object : PixLyzerBlockFactory { - override fun build(resourceLocation: ResourceLocation, registries: Registries, data: Map): BarrelBlock { - return BarrelBlock(resourceLocation, registries, data) - } - } -} - diff --git a/src/main/java/de/bixilon/minosoft/data/registries/blocks/types/pixlyzer/entity/container/storage/EnderChestBlock.kt b/src/main/java/de/bixilon/minosoft/data/registries/blocks/types/pixlyzer/entity/container/storage/EnderChestBlock.kt deleted file mode 100644 index d4c145424..000000000 --- a/src/main/java/de/bixilon/minosoft/data/registries/blocks/types/pixlyzer/entity/container/storage/EnderChestBlock.kt +++ /dev/null @@ -1,59 +0,0 @@ -/* - * Minosoft - * Copyright (C) 2020-2023 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.pixlyzer.entity.container.storage - -import de.bixilon.kotlinglm.vec3.Vec3d -import de.bixilon.minosoft.data.entities.block.container.storage.EnderChestBlockEntity -import de.bixilon.minosoft.data.registries.blocks.factory.PixLyzerBlockFactory -import de.bixilon.minosoft.data.registries.blocks.state.BlockState -import de.bixilon.minosoft.data.registries.blocks.types.properties.rendering.RandomDisplayTickable -import de.bixilon.minosoft.data.registries.identified.ResourceLocation -import de.bixilon.minosoft.data.registries.registries.Registries -import de.bixilon.minosoft.data.world.positions.BlockPosition -import de.bixilon.minosoft.gui.rendering.particle.types.render.texture.simple.PortalParticle -import de.bixilon.minosoft.gui.rendering.util.VecUtil.toVec3d -import de.bixilon.minosoft.protocol.network.connection.play.PlayConnection -import java.util.* - -open class EnderChestBlock(resourceLocation: ResourceLocation, registries: Registries, data: Map) : StorageBlock(resourceLocation, registries, data), RandomDisplayTickable { - private val portalParticle = registries.particleType[PortalParticle] - - - override fun randomDisplayTick(connection: PlayConnection, state: BlockState, position: BlockPosition, random: Random) { - portalParticle ?: return - for (i in 0 until 3) { - val xFactor = random.nextInt(2) * 2 - 1 - val zFactor = random.nextInt(2) * 2 - 1 - val position = position.toVec3d + Vec3d( - 0.5 + 0.25 * xFactor, - random.nextDouble(), - 0.5 + 0.25 * zFactor, - ) - val velocity = Vec3d( - random.nextDouble() * xFactor, - (random.nextDouble() - 0.5) * 0.125, - random.nextDouble() * zFactor, - ) - - connection.world += PortalParticle(connection, position, velocity, portalParticle.default()) - } - } - - companion object : PixLyzerBlockFactory { - - override fun build(resourceLocation: ResourceLocation, registries: Registries, data: Map): EnderChestBlock { - return EnderChestBlock(resourceLocation, registries, data) - } - } -} diff --git a/src/main/java/de/bixilon/minosoft/data/registries/blocks/types/pixlyzer/entity/container/storage/StorageBlock.kt b/src/main/java/de/bixilon/minosoft/data/registries/blocks/types/pixlyzer/entity/container/storage/StorageBlock.kt deleted file mode 100644 index c2bcd2841..000000000 --- a/src/main/java/de/bixilon/minosoft/data/registries/blocks/types/pixlyzer/entity/container/storage/StorageBlock.kt +++ /dev/null @@ -1,21 +0,0 @@ -/* - * Minosoft - * Copyright (C) 2020-2023 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.pixlyzer.entity.container.storage - -import de.bixilon.minosoft.data.entities.block.container.storage.StorageBlockEntity -import de.bixilon.minosoft.data.registries.blocks.types.pixlyzer.entity.container.ContainerBlock -import de.bixilon.minosoft.data.registries.identified.ResourceLocation -import de.bixilon.minosoft.data.registries.registries.Registries - -abstract class StorageBlock(resourceLocation: ResourceLocation, registries: Registries, data: Map) : ContainerBlock(resourceLocation, registries, data) diff --git a/src/main/java/de/bixilon/minosoft/data/registries/blocks/types/pixlyzer/entity/container/storage/TrappedChestBlock.kt b/src/main/java/de/bixilon/minosoft/data/registries/blocks/types/pixlyzer/entity/container/storage/TrappedChestBlock.kt deleted file mode 100644 index a83a29d95..000000000 --- a/src/main/java/de/bixilon/minosoft/data/registries/blocks/types/pixlyzer/entity/container/storage/TrappedChestBlock.kt +++ /dev/null @@ -1,29 +0,0 @@ -/* - * Minosoft - * Copyright (C) 2020-2023 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.pixlyzer.entity.container.storage - -import de.bixilon.minosoft.data.entities.block.container.storage.TrappedChestBlockEntity -import de.bixilon.minosoft.data.registries.blocks.factory.PixLyzerBlockFactory -import de.bixilon.minosoft.data.registries.identified.ResourceLocation -import de.bixilon.minosoft.data.registries.registries.Registries - -open class TrappedChestBlock(resourceLocation: ResourceLocation, registries: Registries, data: Map) : ChestBlock(resourceLocation, registries, data) { - - companion object : PixLyzerBlockFactory { - override fun build(resourceLocation: ResourceLocation, registries: Registries, data: Map): TrappedChestBlock { - return TrappedChestBlock(resourceLocation, registries, data) - } - } -} -