add some abstraction layers to block entities

This commit is contained in:
Bixilon 2021-04-17 14:00:11 +02:00
parent 7edf846d5d
commit 369ae366a6
No known key found for this signature in database
GPG Key ID: 5CAD791931B09AC4
15 changed files with 76 additions and 24 deletions

View File

@ -13,6 +13,8 @@
package de.bixilon.minosoft.data.entities.block package de.bixilon.minosoft.data.entities.block
import de.bixilon.minosoft.data.entities.block.container.*
import de.bixilon.minosoft.data.entities.block.container.storage.*
import de.bixilon.minosoft.data.mappings.ResourceLocation import de.bixilon.minosoft.data.mappings.ResourceLocation
import de.bixilon.minosoft.protocol.network.connection.PlayConnection import de.bixilon.minosoft.protocol.network.connection.PlayConnection

View File

@ -11,12 +11,13 @@
* 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.entities.block package de.bixilon.minosoft.data.entities.block.container
import de.bixilon.minosoft.data.entities.block.BlockEntityFactory
import de.bixilon.minosoft.data.mappings.ResourceLocation import de.bixilon.minosoft.data.mappings.ResourceLocation
import de.bixilon.minosoft.protocol.network.connection.PlayConnection import de.bixilon.minosoft.protocol.network.connection.PlayConnection
class BlastFurnaceBlockEntity(connection: PlayConnection) : BlockEntity(connection) { class BlastFurnaceBlockEntity(connection: PlayConnection) : ContainerBlockEntity(connection) {
companion object : BlockEntityFactory<BlastFurnaceBlockEntity> { companion object : BlockEntityFactory<BlastFurnaceBlockEntity> {
override val RESOURCE_LOCATION: ResourceLocation = ResourceLocation("minecraft:blast_furnace") override val RESOURCE_LOCATION: ResourceLocation = ResourceLocation("minecraft:blast_furnace")

View File

@ -11,12 +11,13 @@
* 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.entities.block package de.bixilon.minosoft.data.entities.block.container
import de.bixilon.minosoft.data.entities.block.BlockEntityFactory
import de.bixilon.minosoft.data.mappings.ResourceLocation import de.bixilon.minosoft.data.mappings.ResourceLocation
import de.bixilon.minosoft.protocol.network.connection.PlayConnection import de.bixilon.minosoft.protocol.network.connection.PlayConnection
class BrewingStandBlockEntity(connection: PlayConnection) : BlockEntity(connection) { class BrewingStandBlockEntity(connection: PlayConnection) : ContainerBlockEntity(connection) {
companion object : BlockEntityFactory<BrewingStandBlockEntity> { companion object : BlockEntityFactory<BrewingStandBlockEntity> {
override val RESOURCE_LOCATION: ResourceLocation = ResourceLocation("minecraft:brewing_stand") override val RESOURCE_LOCATION: ResourceLocation = ResourceLocation("minecraft:brewing_stand")

View File

@ -0,0 +1,19 @@
/*
* Minosoft
* Copyright (C) 2021 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.entities.block.container
import de.bixilon.minosoft.data.entities.block.BlockEntity
import de.bixilon.minosoft.protocol.network.connection.PlayConnection
abstract class ContainerBlockEntity(connection: PlayConnection) : BlockEntity(connection)

View File

@ -11,12 +11,13 @@
* 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.entities.block package de.bixilon.minosoft.data.entities.block.container
import de.bixilon.minosoft.data.entities.block.BlockEntityFactory
import de.bixilon.minosoft.data.mappings.ResourceLocation import de.bixilon.minosoft.data.mappings.ResourceLocation
import de.bixilon.minosoft.protocol.network.connection.PlayConnection import de.bixilon.minosoft.protocol.network.connection.PlayConnection
class DispenserBlockEntity(connection: PlayConnection) : BlockEntity(connection) { class DispenserBlockEntity(connection: PlayConnection) : ContainerBlockEntity(connection) {
companion object : BlockEntityFactory<DispenserBlockEntity> { companion object : BlockEntityFactory<DispenserBlockEntity> {
override val RESOURCE_LOCATION: ResourceLocation = ResourceLocation("minecraft:dispenser") override val RESOURCE_LOCATION: ResourceLocation = ResourceLocation("minecraft:dispenser")

View File

@ -11,12 +11,13 @@
* 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.entities.block package de.bixilon.minosoft.data.entities.block.container
import de.bixilon.minosoft.data.entities.block.BlockEntityFactory
import de.bixilon.minosoft.data.mappings.ResourceLocation import de.bixilon.minosoft.data.mappings.ResourceLocation
import de.bixilon.minosoft.protocol.network.connection.PlayConnection import de.bixilon.minosoft.protocol.network.connection.PlayConnection
class DropperBlockEntity(connection: PlayConnection) : BlockEntity(connection) { class DropperBlockEntity(connection: PlayConnection) : ContainerBlockEntity(connection) {
companion object : BlockEntityFactory<DropperBlockEntity> { companion object : BlockEntityFactory<DropperBlockEntity> {
override val RESOURCE_LOCATION: ResourceLocation = ResourceLocation("minecraft:dropper") override val RESOURCE_LOCATION: ResourceLocation = ResourceLocation("minecraft:dropper")

View File

@ -11,12 +11,13 @@
* 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.entities.block package de.bixilon.minosoft.data.entities.block.container
import de.bixilon.minosoft.data.entities.block.BlockEntityFactory
import de.bixilon.minosoft.data.mappings.ResourceLocation import de.bixilon.minosoft.data.mappings.ResourceLocation
import de.bixilon.minosoft.protocol.network.connection.PlayConnection import de.bixilon.minosoft.protocol.network.connection.PlayConnection
class FurnaceBlockEntity(connection: PlayConnection) : BlockEntity(connection) { class FurnaceBlockEntity(connection: PlayConnection) : ContainerBlockEntity(connection) {
companion object : BlockEntityFactory<FurnaceBlockEntity> { companion object : BlockEntityFactory<FurnaceBlockEntity> {
override val RESOURCE_LOCATION: ResourceLocation = ResourceLocation("minecraft:furnace") override val RESOURCE_LOCATION: ResourceLocation = ResourceLocation("minecraft:furnace")

View File

@ -11,12 +11,13 @@
* 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.entities.block package de.bixilon.minosoft.data.entities.block.container
import de.bixilon.minosoft.data.entities.block.BlockEntityFactory
import de.bixilon.minosoft.data.mappings.ResourceLocation import de.bixilon.minosoft.data.mappings.ResourceLocation
import de.bixilon.minosoft.protocol.network.connection.PlayConnection import de.bixilon.minosoft.protocol.network.connection.PlayConnection
class HopperBlockEntity(connection: PlayConnection) : BlockEntity(connection) { class HopperBlockEntity(connection: PlayConnection) : ContainerBlockEntity(connection) {
companion object : BlockEntityFactory<HopperBlockEntity> { companion object : BlockEntityFactory<HopperBlockEntity> {

View File

@ -11,12 +11,13 @@
* 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.entities.block package de.bixilon.minosoft.data.entities.block.container
import de.bixilon.minosoft.data.entities.block.BlockEntityFactory
import de.bixilon.minosoft.data.mappings.ResourceLocation import de.bixilon.minosoft.data.mappings.ResourceLocation
import de.bixilon.minosoft.protocol.network.connection.PlayConnection import de.bixilon.minosoft.protocol.network.connection.PlayConnection
class SmokerBlockEntity(connection: PlayConnection) : BlockEntity(connection) { class SmokerBlockEntity(connection: PlayConnection) : ContainerBlockEntity(connection) {
companion object : BlockEntityFactory<SmokerBlockEntity> { companion object : BlockEntityFactory<SmokerBlockEntity> {
override val RESOURCE_LOCATION: ResourceLocation = ResourceLocation("minecraft:smoker") override val RESOURCE_LOCATION: ResourceLocation = ResourceLocation("minecraft:smoker")

View File

@ -11,12 +11,13 @@
* 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.entities.block package de.bixilon.minosoft.data.entities.block.container.storage
import de.bixilon.minosoft.data.entities.block.BlockEntityFactory
import de.bixilon.minosoft.data.mappings.ResourceLocation import de.bixilon.minosoft.data.mappings.ResourceLocation
import de.bixilon.minosoft.protocol.network.connection.PlayConnection import de.bixilon.minosoft.protocol.network.connection.PlayConnection
class BarrelBlockEntity(connection: PlayConnection) : BlockEntity(connection) { class BarrelBlockEntity(connection: PlayConnection) : StorageBlockEntity(connection) {
companion object : BlockEntityFactory<BarrelBlockEntity> { companion object : BlockEntityFactory<BarrelBlockEntity> {
override val RESOURCE_LOCATION: ResourceLocation = ResourceLocation("minecraft:barrel") override val RESOURCE_LOCATION: ResourceLocation = ResourceLocation("minecraft:barrel")

View File

@ -11,12 +11,13 @@
* 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.entities.block package de.bixilon.minosoft.data.entities.block.container.storage
import de.bixilon.minosoft.data.entities.block.BlockEntityFactory
import de.bixilon.minosoft.data.mappings.ResourceLocation import de.bixilon.minosoft.data.mappings.ResourceLocation
import de.bixilon.minosoft.protocol.network.connection.PlayConnection import de.bixilon.minosoft.protocol.network.connection.PlayConnection
class ChestBlockEntity(connection: PlayConnection) : BlockEntity(connection) { class ChestBlockEntity(connection: PlayConnection) : StorageBlockEntity(connection) {
companion object : BlockEntityFactory<ChestBlockEntity> { companion object : BlockEntityFactory<ChestBlockEntity> {
override val RESOURCE_LOCATION: ResourceLocation = ResourceLocation("minecraft:chest") override val RESOURCE_LOCATION: ResourceLocation = ResourceLocation("minecraft:chest")

View File

@ -11,12 +11,13 @@
* 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.entities.block package de.bixilon.minosoft.data.entities.block.container.storage
import de.bixilon.minosoft.data.entities.block.BlockEntityFactory
import de.bixilon.minosoft.data.mappings.ResourceLocation import de.bixilon.minosoft.data.mappings.ResourceLocation
import de.bixilon.minosoft.protocol.network.connection.PlayConnection import de.bixilon.minosoft.protocol.network.connection.PlayConnection
class EnderChestBlockEntity(connection: PlayConnection) : BlockEntity(connection) { class EnderChestBlockEntity(connection: PlayConnection) : StorageBlockEntity(connection) {
companion object : BlockEntityFactory<EnderChestBlockEntity> { companion object : BlockEntityFactory<EnderChestBlockEntity> {
override val RESOURCE_LOCATION: ResourceLocation = ResourceLocation("minecraft:ender_chest") override val RESOURCE_LOCATION: ResourceLocation = ResourceLocation("minecraft:ender_chest")

View File

@ -11,12 +11,13 @@
* 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.entities.block package de.bixilon.minosoft.data.entities.block.container.storage
import de.bixilon.minosoft.data.entities.block.BlockEntityFactory
import de.bixilon.minosoft.data.mappings.ResourceLocation import de.bixilon.minosoft.data.mappings.ResourceLocation
import de.bixilon.minosoft.protocol.network.connection.PlayConnection import de.bixilon.minosoft.protocol.network.connection.PlayConnection
class ShulkerBoxBlockEntity(connection: PlayConnection) : BlockEntity(connection) { class ShulkerBoxBlockEntity(connection: PlayConnection) : StorageBlockEntity(connection) {
companion object : BlockEntityFactory<ShulkerBoxBlockEntity> { companion object : BlockEntityFactory<ShulkerBoxBlockEntity> {
override val RESOURCE_LOCATION: ResourceLocation = ResourceLocation("minecraft:shulker_box") override val RESOURCE_LOCATION: ResourceLocation = ResourceLocation("minecraft:shulker_box")

View File

@ -0,0 +1,19 @@
/*
* Minosoft
* Copyright (C) 2021 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.entities.block.container.storage
import de.bixilon.minosoft.data.entities.block.container.ContainerBlockEntity
import de.bixilon.minosoft.protocol.network.connection.PlayConnection
abstract class StorageBlockEntity(connection: PlayConnection) : ContainerBlockEntity(connection)

View File

@ -11,12 +11,13 @@
* 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.entities.block package de.bixilon.minosoft.data.entities.block.container.storage
import de.bixilon.minosoft.data.entities.block.BlockEntityFactory
import de.bixilon.minosoft.data.mappings.ResourceLocation import de.bixilon.minosoft.data.mappings.ResourceLocation
import de.bixilon.minosoft.protocol.network.connection.PlayConnection import de.bixilon.minosoft.protocol.network.connection.PlayConnection
class TrappedChestBlockEntity(connection: PlayConnection) : BlockEntity(connection) { class TrappedChestBlockEntity(connection: PlayConnection) : StorageBlockEntity(connection) {
companion object : BlockEntityFactory<TrappedChestBlockEntity> { companion object : BlockEntityFactory<TrappedChestBlockEntity> {
override val RESOURCE_LOCATION: ResourceLocation = ResourceLocation("minecraft:trapped_chest") override val RESOURCE_LOCATION: ResourceLocation = ResourceLocation("minecraft:trapped_chest")