mirror of
https://gitlab.bixilon.de/bixilon/minosoft.git
synced 2025-09-18 03:44:54 -04:00
remove pixlyzer storage block entity, integrate chest blocks
This commit is contained in:
parent
1498a69e33
commit
cc31e405d1
@ -17,7 +17,6 @@ import de.bixilon.kotlinglm.vec3.Vec3i
|
|||||||
import de.bixilon.minosoft.data.colors.DyeColors
|
import de.bixilon.minosoft.data.colors.DyeColors
|
||||||
import de.bixilon.minosoft.data.entities.block.BlockEntityFactory
|
import de.bixilon.minosoft.data.entities.block.BlockEntityFactory
|
||||||
import de.bixilon.minosoft.data.registries.blocks.state.BlockState
|
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.Namespaces.minecraft
|
||||||
import de.bixilon.minosoft.data.registries.identified.ResourceLocation
|
import de.bixilon.minosoft.data.registries.identified.ResourceLocation
|
||||||
import de.bixilon.minosoft.gui.rendering.RenderContext
|
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.chunk.entities.renderer.storage.shulker.ShulkerBoxRenderer
|
||||||
import de.bixilon.minosoft.gui.rendering.skeletal.baked.BakedSkeletalModel
|
import de.bixilon.minosoft.gui.rendering.skeletal.baked.BakedSkeletalModel
|
||||||
import de.bixilon.minosoft.protocol.network.connection.play.PlayConnection
|
import de.bixilon.minosoft.protocol.network.connection.play.PlayConnection
|
||||||
import de.bixilon.minosoft.util.KUtil.toResourceLocationList
|
|
||||||
|
|
||||||
class ShulkerBoxBlockEntity(connection: PlayConnection) : StorageBlockEntity(connection) {
|
class ShulkerBoxBlockEntity(connection: PlayConnection) : StorageBlockEntity(connection) {
|
||||||
|
|
||||||
@ -37,6 +35,7 @@ class ShulkerBoxBlockEntity(connection: PlayConnection) : StorageBlockEntity(con
|
|||||||
// colored
|
// colored
|
||||||
val color = DyeColors[prefix.removeSuffix("_")]
|
val color = DyeColors[prefix.removeSuffix("_")]
|
||||||
model = context.models.skeletal[ShulkerBoxRenderer.NAME_COLOR[color.ordinal]]
|
model = context.models.skeletal[ShulkerBoxRenderer.NAME_COLOR[color.ordinal]]
|
||||||
|
// TODO: light gray -> silver (<1.13)
|
||||||
} else {
|
} else {
|
||||||
model = context.models.skeletal[ShulkerBoxRenderer.NAME]
|
model = context.models.skeletal[ShulkerBoxRenderer.NAME]
|
||||||
}
|
}
|
||||||
@ -44,15 +43,8 @@ class ShulkerBoxBlockEntity(connection: PlayConnection) : StorageBlockEntity(con
|
|||||||
return ShulkerBoxRenderer(this, context, blockState, blockPosition, model, light)
|
return ShulkerBoxRenderer(this, context, blockState, blockPosition, model, light)
|
||||||
}
|
}
|
||||||
|
|
||||||
companion object : BlockEntityFactory<ShulkerBoxBlockEntity>, AliasedIdentified {
|
companion object : BlockEntityFactory<ShulkerBoxBlockEntity> {
|
||||||
override val identifier: ResourceLocation = minecraft("shulker_box")
|
override val identifier: ResourceLocation = minecraft("shulker_box")
|
||||||
override val identifiers: Set<ResourceLocation> = 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 {
|
override fun build(connection: PlayConnection): ShulkerBoxBlockEntity {
|
||||||
return ShulkerBoxBlockEntity(connection)
|
return ShulkerBoxBlockEntity(connection)
|
||||||
|
@ -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.SnowBlock
|
||||||
import de.bixilon.minosoft.data.registries.blocks.types.building.snow.SnowLayerBlock
|
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.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.LavaFluidBlock
|
||||||
import de.bixilon.minosoft.data.registries.blocks.types.fluid.water.BubbleColumnBlock
|
import de.bixilon.minosoft.data.registries.blocks.types.fluid.water.BubbleColumnBlock
|
||||||
import de.bixilon.minosoft.data.registries.blocks.types.fluid.water.WaterFluidBlock
|
import de.bixilon.minosoft.data.registries.blocks.types.fluid.water.WaterFluidBlock
|
||||||
@ -78,6 +81,10 @@ object BlockFactories : DefaultFactory<BlockFactory<*>>(
|
|||||||
SnowBlock, SnowLayerBlock,
|
SnowBlock, SnowLayerBlock,
|
||||||
FernBlock.DeadBush, FernBlock.Grass, FernBlock.Fern,
|
FernBlock.DeadBush, FernBlock.Grass, FernBlock.Fern,
|
||||||
DoublePlant.Sunflower, DoublePlant.Lilac, DoublePlant.TallGrass, DoublePlant.LargeFern, DoublePlant.RoseBush, DoublePlant.Peony, DoublePlant.UpperBlock,
|
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? {
|
fun build(name: ResourceLocation, registries: Registries, settings: BlockSettings): Block? {
|
||||||
|
@ -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.StoneButtonBlock
|
||||||
import de.bixilon.minosoft.data.registries.blocks.types.pixlyzer.button.WoodenButtonBlock
|
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.*
|
||||||
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.EndGatewayBlock
|
||||||
import de.bixilon.minosoft.data.registries.blocks.types.pixlyzer.entity.end.EndPortalBlock
|
import de.bixilon.minosoft.data.registries.blocks.types.pixlyzer.entity.end.EndPortalBlock
|
||||||
import de.bixilon.minosoft.data.registries.blocks.types.pixlyzer.entity.redstone.CommandBlock
|
import de.bixilon.minosoft.data.registries.blocks.types.pixlyzer.entity.redstone.CommandBlock
|
||||||
@ -57,8 +46,6 @@ object PixLyzerBlockFactories : DefaultClassFactory<PixLyzerBlockFactory<*>>(
|
|||||||
ComparatorBlock,
|
ComparatorBlock,
|
||||||
CampfireBlock,
|
CampfireBlock,
|
||||||
TorchBlock,
|
TorchBlock,
|
||||||
BrewingStandBlock,
|
|
||||||
EnderChestBlock,
|
|
||||||
NetherPortalBlock,
|
NetherPortalBlock,
|
||||||
RedstoneTorchBlock,
|
RedstoneTorchBlock,
|
||||||
KelpBlock,
|
KelpBlock,
|
||||||
@ -70,33 +57,21 @@ object PixLyzerBlockFactories : DefaultClassFactory<PixLyzerBlockFactory<*>>(
|
|||||||
CropBlock,
|
CropBlock,
|
||||||
CraftingTableBlock,
|
CraftingTableBlock,
|
||||||
|
|
||||||
FurnaceBlock,
|
|
||||||
ChestBlock,
|
|
||||||
TrappedChestBlock,
|
|
||||||
EnderChestBlock,
|
|
||||||
DispenserBlock,
|
|
||||||
DropperBlock,
|
|
||||||
WallSignBlock,
|
WallSignBlock,
|
||||||
StandingSignBlock,
|
StandingSignBlock,
|
||||||
MobSpawnerBlock,
|
MobSpawnerBlock,
|
||||||
PistonBlock,
|
PistonBlock,
|
||||||
BrewingStandBlock,
|
|
||||||
EnchantingTableBlock,
|
EnchantingTableBlock,
|
||||||
EndPortalBlock,
|
EndPortalBlock,
|
||||||
BeaconBlock,
|
BeaconBlock,
|
||||||
SkullBlock,
|
SkullBlock,
|
||||||
DaylightDetectorBlock,
|
DaylightDetectorBlock,
|
||||||
HopperBlock,
|
|
||||||
BannerBlock,
|
BannerBlock,
|
||||||
StructureBlock,
|
StructureBlock,
|
||||||
EndGatewayBlock,
|
EndGatewayBlock,
|
||||||
CommandBlock,
|
CommandBlock,
|
||||||
ShulkerBoxBlock,
|
|
||||||
BedBlock,
|
BedBlock,
|
||||||
ConduitBlock,
|
ConduitBlock,
|
||||||
BarrelBlock,
|
|
||||||
SmokerBlock,
|
|
||||||
BlastFurnaceBlock,
|
|
||||||
LecternBlock,
|
LecternBlock,
|
||||||
BellBlock,
|
BellBlock,
|
||||||
JigsawBlock,
|
JigsawBlock,
|
||||||
|
@ -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 <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.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<T : StorageBlockEntity> : StorageBlock<T>, 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)
|
||||||
|
}
|
||||||
|
}
|
@ -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 <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.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<T : StorageBlockEntity> : ChestBlock<T> {
|
||||||
|
|
||||||
|
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),
|
||||||
|
)
|
||||||
|
}
|
||||||
|
}
|
@ -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 <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.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<EnderChestBlockEntity>, PickaxeRequirement {
|
||||||
|
override val blockEntity: BlockEntityType<EnderChestBlockEntity> = this::blockEntity.inject(this)
|
||||||
|
override val hardness: Float get() = 22.5f
|
||||||
|
|
||||||
|
companion object : BlockFactory<EnderChestBlock> {
|
||||||
|
override val identifier = minecraft("ender_chest")
|
||||||
|
|
||||||
|
override fun build(registries: Registries, settings: BlockSettings) = EnderChestBlock(settings = settings)
|
||||||
|
}
|
||||||
|
}
|
@ -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 <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.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<ShulkerBoxBlockEntity>, FullOpaqueBlock, BlockWithItem<Item> {
|
||||||
|
override val blockEntity: BlockEntityType<ShulkerBoxBlockEntity> = this::blockEntity.inject(this)
|
||||||
|
override val item: Item = this::item.inject(identifier)
|
||||||
|
override val hardness: Float get() = 2.0f
|
||||||
|
|
||||||
|
|
||||||
|
companion object : BlockFactory<ShulkerBoxBlock> {
|
||||||
|
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<White> {
|
||||||
|
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<Orange> {
|
||||||
|
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<Magenta> {
|
||||||
|
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<LightBlue> {
|
||||||
|
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<Yellow> {
|
||||||
|
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<Lime> {
|
||||||
|
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<Pink> {
|
||||||
|
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<Gray> {
|
||||||
|
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<LightGray> {
|
||||||
|
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<Cyan> {
|
||||||
|
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<Purple> {
|
||||||
|
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<Blue> {
|
||||||
|
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<Brown> {
|
||||||
|
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<Green> {
|
||||||
|
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<Red> {
|
||||||
|
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<Black> {
|
||||||
|
override val identifier = minecraft("black_shulker_box")
|
||||||
|
|
||||||
|
override fun build(registries: Registries, settings: BlockSettings) = Black(settings = settings)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
@ -11,23 +11,21 @@
|
|||||||
* This software is not affiliated with Mojang AB, the original developer of Minecraft.
|
* 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.kutil.cast.CastUtil.unsafeCast
|
||||||
import de.bixilon.minosoft.camera.target.targets.BlockTarget
|
import de.bixilon.minosoft.camera.target.targets.BlockTarget
|
||||||
import de.bixilon.minosoft.config.DebugOptions
|
import de.bixilon.minosoft.config.DebugOptions
|
||||||
import de.bixilon.minosoft.data.container.stack.ItemStack
|
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.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.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.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.input.interaction.InteractionResults
|
||||||
import de.bixilon.minosoft.protocol.network.connection.play.PlayConnection
|
import de.bixilon.minosoft.protocol.network.connection.play.PlayConnection
|
||||||
|
|
||||||
open class ChestBlock<T : ChestBlockEntity>(resourceLocation: ResourceLocation, registries: Registries, data: Map<String, Any>) : StorageBlock<T>(resourceLocation, registries, data), InteractBlockHandler {
|
interface StorageBlock<T : StorageBlockEntity> : BlockWithEntity<T>, InteractBlockHandler {
|
||||||
|
|
||||||
|
|
||||||
override fun interact(connection: PlayConnection, target: BlockTarget, hand: Hands, stack: ItemStack?): InteractionResults {
|
override fun interact(connection: PlayConnection, target: BlockTarget, hand: Hands, stack: ItemStack?): InteractionResults {
|
||||||
if (!DebugOptions.FORCE_CHEST_ANIMATION) return super.interact(connection, target, hand, stack)
|
if (!DebugOptions.FORCE_CHEST_ANIMATION) return super.interact(connection, target, hand, stack)
|
||||||
@ -36,12 +34,4 @@ open class ChestBlock<T : ChestBlockEntity>(resourceLocation: ResourceLocation,
|
|||||||
entity.setBlockActionData(0, if (entity.viewing > 0) 0 else 1)
|
entity.setBlockActionData(0, if (entity.viewing > 0) 0 else 1)
|
||||||
return InteractionResults.SUCCESS
|
return InteractionResults.SUCCESS
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
companion object : PixLyzerBlockFactory<ChestBlock<ChestBlockEntity>> {
|
|
||||||
override fun build(resourceLocation: ResourceLocation, registries: Registries, data: Map<String, Any>): ChestBlock<ChestBlockEntity> {
|
|
||||||
return ChestBlock(resourceLocation, registries, data)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
@ -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 <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.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<T : ChestBlockEntity>(identifier: ResourceLocation, settings: BlockSettings) : Block(identifier, settings), BlockWithItem<Item>, AxeRequirement, DoubleChestBlock<T> {
|
||||||
|
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<ChestBlockEntity>(identifier, settings) {
|
||||||
|
override val blockEntity: BlockEntityType<ChestBlockEntity> = this::blockEntity.inject(this)
|
||||||
|
|
||||||
|
companion object : BlockFactory<Chest> {
|
||||||
|
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<TrappedChestBlockEntity>(identifier, settings) {
|
||||||
|
override val blockEntity: BlockEntityType<TrappedChestBlockEntity> = this::blockEntity.inject(this)
|
||||||
|
|
||||||
|
companion object : BlockFactory<TrappedChest> {
|
||||||
|
override val identifier = minecraft("trapped_chest")
|
||||||
|
|
||||||
|
override fun build(registries: Registries, settings: BlockSettings) = TrappedChest(settings = settings)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
@ -14,18 +14,13 @@
|
|||||||
package de.bixilon.minosoft.data.registries.blocks.types.pixlyzer.entity
|
package de.bixilon.minosoft.data.registries.blocks.types.pixlyzer.entity
|
||||||
|
|
||||||
import de.bixilon.kutil.cast.CastUtil.unsafeNull
|
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.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.entites.BlockEntityType
|
||||||
import de.bixilon.minosoft.data.registries.blocks.types.entity.BlockWithEntity
|
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.blocks.types.pixlyzer.PixLyzerBlock
|
||||||
import de.bixilon.minosoft.data.registries.identified.ResourceLocation
|
import de.bixilon.minosoft.data.registries.identified.ResourceLocation
|
||||||
import de.bixilon.minosoft.data.registries.registries.Registries
|
import de.bixilon.minosoft.data.registries.registries.Registries
|
||||||
import de.bixilon.minosoft.data.registries.registries.registry.RegistryItem
|
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
|
import kotlin.reflect.jvm.javaField
|
||||||
|
|
||||||
abstract class PixLyzerBlockWithEntity<T : BlockEntity>(resourceLocation: ResourceLocation, registries: Registries, data: Map<String, Any>) : PixLyzerBlock(resourceLocation, registries, data), BlockWithEntity<BlockEntity> {
|
abstract class PixLyzerBlockWithEntity<T : BlockEntity>(resourceLocation: ResourceLocation, registries: Registries, data: Map<String, Any>) : PixLyzerBlock(resourceLocation, registries, data), BlockWithEntity<BlockEntity> {
|
||||||
@ -35,8 +30,6 @@ abstract class PixLyzerBlockWithEntity<T : BlockEntity>(resourceLocation: Resour
|
|||||||
FACTORY_FIELD.inject<RegistryItem>(this)
|
FACTORY_FIELD.inject<RegistryItem>(this)
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun interact(connection: PlayConnection, target: BlockTarget, hand: Hands, stack: ItemStack?) = InteractionResults.SUCCESS
|
|
||||||
|
|
||||||
private companion object {
|
private companion object {
|
||||||
val FACTORY_FIELD = PixLyzerBlockWithEntity<*>::blockEntity.javaField!!
|
val FACTORY_FIELD = PixLyzerBlockWithEntity<*>::blockEntity.javaField!!
|
||||||
}
|
}
|
||||||
|
@ -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 <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.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<String, Any>) : PixLyzerBlockWithEntity<ShulkerBoxBlockEntity>(resourceLocation, registries, data) {
|
|
||||||
|
|
||||||
companion object : PixLyzerBlockFactory<ShulkerBoxBlock> {
|
|
||||||
override fun build(resourceLocation: ResourceLocation, registries: Registries, data: Map<String, Any>): ShulkerBoxBlock {
|
|
||||||
return ShulkerBoxBlock(resourceLocation, registries, data)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
@ -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 <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.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<T : ContainerBlockEntity>(resourceLocation: ResourceLocation, registries: Registries, data: Map<String, Any>) : PixLyzerBlockWithEntity<T>(resourceLocation, registries, data)
|
|
@ -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 <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.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<String, Any>) : ContainerBlock<DispenserBlockEntity>(resourceLocation, registries, data) {
|
|
||||||
|
|
||||||
companion object : PixLyzerBlockFactory<DispenserBlock> {
|
|
||||||
override fun build(resourceLocation: ResourceLocation, registries: Registries, data: Map<String, Any>): DispenserBlock {
|
|
||||||
return DispenserBlock(resourceLocation, registries, data)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
@ -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 <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.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<String, Any>) : ContainerBlock<DropperBlockEntity>(resourceLocation, registries, data) {
|
|
||||||
|
|
||||||
companion object : PixLyzerBlockFactory<DropperBlock> {
|
|
||||||
override fun build(resourceLocation: ResourceLocation, registries: Registries, data: Map<String, Any>): DropperBlock {
|
|
||||||
return DropperBlock(resourceLocation, registries, data)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
@ -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 <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.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<String, Any>) : ContainerBlock<HopperBlockEntity>(resourceLocation, registries, data) {
|
|
||||||
|
|
||||||
companion object : PixLyzerBlockFactory<HopperBlock> {
|
|
||||||
|
|
||||||
override fun build(resourceLocation: ResourceLocation, registries: Registries, data: Map<String, Any>): HopperBlock {
|
|
||||||
return HopperBlock(resourceLocation, registries, data)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
@ -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 <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.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<String, Any>) : ContainerBlock<SmokerBlockEntity>(resourceLocation, registries, data) {
|
|
||||||
|
|
||||||
companion object : PixLyzerBlockFactory<SmokerBlock> {
|
|
||||||
override fun build(resourceLocation: ResourceLocation, registries: Registries, data: Map<String, Any>): SmokerBlock {
|
|
||||||
return SmokerBlock(resourceLocation, registries, data)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
@ -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 <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.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<String, Any>) : ProcessingBlock<BlastFurnaceBlockEntity>(resourceLocation, registries, data) {
|
|
||||||
|
|
||||||
companion object : PixLyzerBlockFactory<BlastFurnaceBlock> {
|
|
||||||
override fun build(resourceLocation: ResourceLocation, registries: Registries, data: Map<String, Any>): BlastFurnaceBlock {
|
|
||||||
return BlastFurnaceBlock(resourceLocation, registries, data)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
@ -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 <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.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<String, Any>) : ProcessingBlock<BrewingStandBlockEntity>(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<BrewingStandBlock> {
|
|
||||||
|
|
||||||
override fun build(resourceLocation: ResourceLocation, registries: Registries, data: Map<String, Any>): BrewingStandBlock {
|
|
||||||
return BrewingStandBlock(resourceLocation, registries, data)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
@ -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 <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.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<String, Any>) : ProcessingBlock<FurnaceBlockEntity>(resourceLocation, registries, data) {
|
|
||||||
|
|
||||||
companion object : PixLyzerBlockFactory<FurnaceBlock> {
|
|
||||||
override fun build(resourceLocation: ResourceLocation, registries: Registries, data: Map<String, Any>): FurnaceBlock {
|
|
||||||
return FurnaceBlock(resourceLocation, registries, data)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
@ -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 <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.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<T : ProcessingBlockEntity>(resourceLocation: ResourceLocation, registries: Registries, data: Map<String, Any>) : ContainerBlock<T>(resourceLocation, registries, data)
|
|
@ -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 <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.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<String, Any>) : StorageBlock<BarrelBlockEntity>(resourceLocation, registries, data) {
|
|
||||||
|
|
||||||
companion object : PixLyzerBlockFactory<BarrelBlock> {
|
|
||||||
override fun build(resourceLocation: ResourceLocation, registries: Registries, data: Map<String, Any>): BarrelBlock {
|
|
||||||
return BarrelBlock(resourceLocation, registries, data)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
@ -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 <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.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<String, Any>) : StorageBlock<EnderChestBlockEntity>(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<EnderChestBlock> {
|
|
||||||
|
|
||||||
override fun build(resourceLocation: ResourceLocation, registries: Registries, data: Map<String, Any>): EnderChestBlock {
|
|
||||||
return EnderChestBlock(resourceLocation, registries, data)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
@ -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 <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.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<T : StorageBlockEntity>(resourceLocation: ResourceLocation, registries: Registries, data: Map<String, Any>) : ContainerBlock<T>(resourceLocation, registries, data)
|
|
@ -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 <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.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<String, Any>) : ChestBlock<TrappedChestBlockEntity>(resourceLocation, registries, data) {
|
|
||||||
|
|
||||||
companion object : PixLyzerBlockFactory<TrappedChestBlock> {
|
|
||||||
override fun build(resourceLocation: ResourceLocation, registries: Registries, data: Map<String, Any>): TrappedChestBlock {
|
|
||||||
return TrappedChestBlock(resourceLocation, registries, data)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
Loading…
x
Reference in New Issue
Block a user