add add block entities

This commit is contained in:
Bixilon 2021-04-17 13:50:12 +02:00
parent 805c535c9b
commit 7edf846d5d
No known key found for this signature in database
GPG Key ID: 5CAD791931B09AC4
29 changed files with 738 additions and 23 deletions

View File

@ -0,0 +1,28 @@
/*
* 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
import de.bixilon.minosoft.data.mappings.ResourceLocation
import de.bixilon.minosoft.protocol.network.connection.PlayConnection
class BannerBlockEntity(connection: PlayConnection) : BlockEntity(connection) {
companion object : BlockEntityFactory<BannerBlockEntity> {
override val RESOURCE_LOCATION: ResourceLocation = ResourceLocation("minecraft:banner")
override fun build(connection: PlayConnection): BannerBlockEntity {
return BannerBlockEntity(connection)
}
}
}

View File

@ -0,0 +1,28 @@
/*
* 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
import de.bixilon.minosoft.data.mappings.ResourceLocation
import de.bixilon.minosoft.protocol.network.connection.PlayConnection
class BarrelBlockEntity(connection: PlayConnection) : BlockEntity(connection) {
companion object : BlockEntityFactory<BarrelBlockEntity> {
override val RESOURCE_LOCATION: ResourceLocation = ResourceLocation("minecraft:barrel")
override fun build(connection: PlayConnection): BarrelBlockEntity {
return BarrelBlockEntity(connection)
}
}
}

View File

@ -0,0 +1,33 @@
/*
* 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
import de.bixilon.minosoft.data.mappings.ResourceLocation
import de.bixilon.minosoft.protocol.network.connection.PlayConnection
import de.bixilon.minosoft.util.nbt.tag.CompoundTag
class BeaconBlockEntity(connection: PlayConnection) : BlockEntity(connection) {
override fun updateNBT(nbt: CompoundTag) {
// ToDO: {Secondary: -1, Paper.Range: -1.0D, Primary: -1, x: -90, y: 4, Levels: 0, z: 212, id: "minecraft:beacon"}
}
companion object : BlockEntityFactory<BeaconBlockEntity> {
override val RESOURCE_LOCATION: ResourceLocation = ResourceLocation("minecraft:beacon")
override fun build(connection: PlayConnection): BeaconBlockEntity {
return BeaconBlockEntity(connection)
}
}
}

View File

@ -0,0 +1,28 @@
/*
* 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
import de.bixilon.minosoft.data.mappings.ResourceLocation
import de.bixilon.minosoft.protocol.network.connection.PlayConnection
class BeehiveBlockEntity(connection: PlayConnection) : BlockEntity(connection) {
companion object : BlockEntityFactory<BeehiveBlockEntity> {
override val RESOURCE_LOCATION: ResourceLocation = ResourceLocation("minecraft:beehive")
override fun build(connection: PlayConnection): BeehiveBlockEntity {
return BeehiveBlockEntity(connection)
}
}
}

View File

@ -0,0 +1,28 @@
/*
* 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
import de.bixilon.minosoft.data.mappings.ResourceLocation
import de.bixilon.minosoft.protocol.network.connection.PlayConnection
class BellBlockEntity(connection: PlayConnection) : BlockEntity(connection) {
companion object : BlockEntityFactory<BellBlockEntity> {
override val RESOURCE_LOCATION: ResourceLocation = ResourceLocation("minecraft:bell")
override fun build(connection: PlayConnection): BellBlockEntity {
return BellBlockEntity(connection)
}
}
}

View File

@ -15,20 +15,14 @@ package de.bixilon.minosoft.data.entities.block
import de.bixilon.minosoft.data.mappings.ResourceLocation
import de.bixilon.minosoft.protocol.network.connection.PlayConnection
import de.bixilon.minosoft.util.nbt.tag.CompoundTag
class BlastBlockEntity(connection: PlayConnection) : BlockEntity(connection) {
class BlastFurnaceBlockEntity(connection: PlayConnection) : BlockEntity(connection) {
override fun updateNBT(nbt: CompoundTag) {
}
companion object : BlockEntityFactory<BlastBlockEntity> {
companion object : BlockEntityFactory<BlastFurnaceBlockEntity> {
override val RESOURCE_LOCATION: ResourceLocation = ResourceLocation("minecraft:blast_furnace")
override fun build(connection: PlayConnection): BlastBlockEntity {
return BlastBlockEntity(connection)
override fun build(connection: PlayConnection): BlastFurnaceBlockEntity {
return BlastFurnaceBlockEntity(connection)
}
}
}

View File

@ -20,5 +20,5 @@ abstract class BlockEntity(
val connection: PlayConnection,
) {
abstract fun updateNBT(nbt: CompoundTag)
open fun updateNBT(nbt: CompoundTag) {}
}

View File

@ -0,0 +1,28 @@
/*
* 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
import de.bixilon.minosoft.data.mappings.ResourceLocation
import de.bixilon.minosoft.protocol.network.connection.PlayConnection
class BrewingStandBlockEntity(connection: PlayConnection) : BlockEntity(connection) {
companion object : BlockEntityFactory<BrewingStandBlockEntity> {
override val RESOURCE_LOCATION: ResourceLocation = ResourceLocation("minecraft:brewing_stand")
override fun build(connection: PlayConnection): BrewingStandBlockEntity {
return BrewingStandBlockEntity(connection)
}
}
}

View File

@ -0,0 +1,28 @@
/*
* 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
import de.bixilon.minosoft.data.mappings.ResourceLocation
import de.bixilon.minosoft.protocol.network.connection.PlayConnection
class ChestBlockEntity(connection: PlayConnection) : BlockEntity(connection) {
companion object : BlockEntityFactory<ChestBlockEntity> {
override val RESOURCE_LOCATION: ResourceLocation = ResourceLocation("minecraft:chest")
override fun build(connection: PlayConnection): ChestBlockEntity {
return ChestBlockEntity(connection)
}
}
}

View File

@ -0,0 +1,28 @@
/*
* 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
import de.bixilon.minosoft.data.mappings.ResourceLocation
import de.bixilon.minosoft.protocol.network.connection.PlayConnection
class CommandBlockBlockEntity(connection: PlayConnection) : BlockEntity(connection) {
companion object : BlockEntityFactory<CommandBlockBlockEntity> {
override val RESOURCE_LOCATION: ResourceLocation = ResourceLocation("minecraft:command_block")
override fun build(connection: PlayConnection): CommandBlockBlockEntity {
return CommandBlockBlockEntity(connection)
}
}
}

View File

@ -0,0 +1,28 @@
/*
* 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
import de.bixilon.minosoft.data.mappings.ResourceLocation
import de.bixilon.minosoft.protocol.network.connection.PlayConnection
class ComparatorBlockEntity(connection: PlayConnection) : BlockEntity(connection) {
companion object : BlockEntityFactory<ComparatorBlockEntity> {
override val RESOURCE_LOCATION: ResourceLocation = ResourceLocation("minecraft:comparator")
override fun build(connection: PlayConnection): ComparatorBlockEntity {
return ComparatorBlockEntity(connection)
}
}
}

View File

@ -0,0 +1,28 @@
/*
* 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
import de.bixilon.minosoft.data.mappings.ResourceLocation
import de.bixilon.minosoft.protocol.network.connection.PlayConnection
class ConduitBlockEntity(connection: PlayConnection) : BlockEntity(connection) {
companion object : BlockEntityFactory<ConduitBlockEntity> {
override val RESOURCE_LOCATION: ResourceLocation = ResourceLocation("minecraft:conduit")
override fun build(connection: PlayConnection): ConduitBlockEntity {
return ConduitBlockEntity(connection)
}
}
}

View File

@ -0,0 +1,28 @@
/*
* 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
import de.bixilon.minosoft.data.mappings.ResourceLocation
import de.bixilon.minosoft.protocol.network.connection.PlayConnection
class DaylightDetectorBlockEntity(connection: PlayConnection) : BlockEntity(connection) {
companion object : BlockEntityFactory<DaylightDetectorBlockEntity> {
override val RESOURCE_LOCATION: ResourceLocation = ResourceLocation("minecraft:daylight_detector")
override fun build(connection: PlayConnection): DaylightDetectorBlockEntity {
return DaylightDetectorBlockEntity(connection)
}
}
}

View File

@ -25,9 +25,33 @@ object DefaultBlockEntityMetaDataFactory {
BedBlockEntity,
HopperBlockEntity,
SignBlockEntity,
BlastBlockEntity,
BlastFurnaceBlockEntity,
FurnaceBlockEntity,
CampfireBlockEntity,
JigsawBlockEntity,
LecternBlockEntity,
BellBlockEntity,
SmokerBlockEntity,
ConduitBlockEntity,
BarrelBlockEntity,
ShulkerBoxBlockEntity,
StructureBlockBlockEntity,
CommandBlockBlockEntity,
ComparatorBlockEntity,
BannerBlockEntity,
DaylightDetectorBlockEntity,
BeaconBlockEntity,
SkullBlockEntity,
EnchantingTableBlockEntity,
BrewingStandBlockEntity,
MobSpawnerBlockEntity,
DispenserBlockEntity,
DropperBlockEntity,
EnderChestBlockEntity,
JukeboxBlockEntity,
ChestBlockEntity,
TrappedChestBlockEntity,
BeehiveBlockEntity,
)
val ret: MutableMap<ResourceLocation, BlockEntityFactory<out BlockEntity>> = mutableMapOf()

View File

@ -0,0 +1,28 @@
/*
* 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
import de.bixilon.minosoft.data.mappings.ResourceLocation
import de.bixilon.minosoft.protocol.network.connection.PlayConnection
class DispenserBlockEntity(connection: PlayConnection) : BlockEntity(connection) {
companion object : BlockEntityFactory<DispenserBlockEntity> {
override val RESOURCE_LOCATION: ResourceLocation = ResourceLocation("minecraft:dispenser")
override fun build(connection: PlayConnection): DispenserBlockEntity {
return DispenserBlockEntity(connection)
}
}
}

View File

@ -0,0 +1,28 @@
/*
* 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
import de.bixilon.minosoft.data.mappings.ResourceLocation
import de.bixilon.minosoft.protocol.network.connection.PlayConnection
class DropperBlockEntity(connection: PlayConnection) : BlockEntity(connection) {
companion object : BlockEntityFactory<DropperBlockEntity> {
override val RESOURCE_LOCATION: ResourceLocation = ResourceLocation("minecraft:dropper")
override fun build(connection: PlayConnection): DropperBlockEntity {
return DropperBlockEntity(connection)
}
}
}

View File

@ -0,0 +1,28 @@
/*
* 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
import de.bixilon.minosoft.data.mappings.ResourceLocation
import de.bixilon.minosoft.protocol.network.connection.PlayConnection
class EnchantingTableBlockEntity(connection: PlayConnection) : BlockEntity(connection) {
companion object : BlockEntityFactory<EnchantingTableBlockEntity> {
override val RESOURCE_LOCATION: ResourceLocation = ResourceLocation("minecraft:enchanting_table")
override fun build(connection: PlayConnection): EnchantingTableBlockEntity {
return EnchantingTableBlockEntity(connection)
}
}
}

View File

@ -0,0 +1,28 @@
/*
* 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
import de.bixilon.minosoft.data.mappings.ResourceLocation
import de.bixilon.minosoft.protocol.network.connection.PlayConnection
class EnderChestBlockEntity(connection: PlayConnection) : BlockEntity(connection) {
companion object : BlockEntityFactory<EnderChestBlockEntity> {
override val RESOURCE_LOCATION: ResourceLocation = ResourceLocation("minecraft:ender_chest")
override fun build(connection: PlayConnection): EnderChestBlockEntity {
return EnderChestBlockEntity(connection)
}
}
}

View File

@ -15,15 +15,9 @@ package de.bixilon.minosoft.data.entities.block
import de.bixilon.minosoft.data.mappings.ResourceLocation
import de.bixilon.minosoft.protocol.network.connection.PlayConnection
import de.bixilon.minosoft.util.nbt.tag.CompoundTag
class FurnaceBlockEntity(connection: PlayConnection) : BlockEntity(connection) {
override fun updateNBT(nbt: CompoundTag) {
}
companion object : BlockEntityFactory<FurnaceBlockEntity> {
override val RESOURCE_LOCATION: ResourceLocation = ResourceLocation("minecraft:furnace")

View File

@ -15,15 +15,10 @@ package de.bixilon.minosoft.data.entities.block
import de.bixilon.minosoft.data.mappings.ResourceLocation
import de.bixilon.minosoft.protocol.network.connection.PlayConnection
import de.bixilon.minosoft.util.nbt.tag.CompoundTag
class HopperBlockEntity(connection: PlayConnection) : BlockEntity(connection) {
override fun updateNBT(nbt: CompoundTag) {
}
companion object : BlockEntityFactory<HopperBlockEntity> {
override val RESOURCE_LOCATION: ResourceLocation = ResourceLocation("minecraft:hopper")

View File

@ -0,0 +1,48 @@
/*
* 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
import de.bixilon.minosoft.data.mappings.ResourceLocation
import de.bixilon.minosoft.protocol.network.connection.PlayConnection
import de.bixilon.minosoft.util.nbt.tag.CompoundTag
class JigsawBlockEntity(connection: PlayConnection) : BlockEntity(connection) {
var joint: String = "rollable"
private set
var name: ResourceLocation = ResourceLocation("minecraft:empty")
private set
var pool: ResourceLocation = ResourceLocation("minecraft:empty")
private set
var finalState: ResourceLocation = ResourceLocation("minecraft:empty")
private set
var target: ResourceLocation = ResourceLocation("minecraft:empty")
private set
override fun updateNBT(nbt: CompoundTag) {
nbt.getStringTag("joint")?.value?.let { joint = it }
nbt.getStringTag("name")?.value?.let { name = ResourceLocation.getPathResourceLocation(it) }
nbt.getStringTag("pool")?.value?.let { pool = ResourceLocation.getPathResourceLocation(it) }
nbt.getStringTag("finalState")?.value?.let { finalState = ResourceLocation.getPathResourceLocation(it) }
nbt.getStringTag("target")?.value?.let { target = ResourceLocation.getPathResourceLocation(it) }
}
companion object : BlockEntityFactory<JigsawBlockEntity> {
override val RESOURCE_LOCATION: ResourceLocation = ResourceLocation("minecraft:jigsaw")
override fun build(connection: PlayConnection): JigsawBlockEntity {
return JigsawBlockEntity(connection)
}
}
}

View File

@ -0,0 +1,28 @@
/*
* 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
import de.bixilon.minosoft.data.mappings.ResourceLocation
import de.bixilon.minosoft.protocol.network.connection.PlayConnection
class JukeboxBlockEntity(connection: PlayConnection) : BlockEntity(connection) {
companion object : BlockEntityFactory<JukeboxBlockEntity> {
override val RESOURCE_LOCATION: ResourceLocation = ResourceLocation("minecraft:jukebox")
override fun build(connection: PlayConnection): JukeboxBlockEntity {
return JukeboxBlockEntity(connection)
}
}
}

View File

@ -0,0 +1,28 @@
/*
* 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
import de.bixilon.minosoft.data.mappings.ResourceLocation
import de.bixilon.minosoft.protocol.network.connection.PlayConnection
class LecternBlockEntity(connection: PlayConnection) : BlockEntity(connection) {
companion object : BlockEntityFactory<LecternBlockEntity> {
override val RESOURCE_LOCATION: ResourceLocation = ResourceLocation("minecraft:lectern")
override fun build(connection: PlayConnection): LecternBlockEntity {
return LecternBlockEntity(connection)
}
}
}

View File

@ -0,0 +1,34 @@
/*
* 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
import de.bixilon.minosoft.data.mappings.ResourceLocation
import de.bixilon.minosoft.protocol.network.connection.PlayConnection
import de.bixilon.minosoft.util.nbt.tag.CompoundTag
class MobSpawnerBlockEntity(connection: PlayConnection) : BlockEntity(connection) {
override fun updateNBT(nbt: CompoundTag) {
// ToDo: {MaxNearbyEntities: 6s, RequiredPlayerRange: 16s, SpawnCount: 4s, x: -80, y: 4, SpawnData: {id: "minecraft:zombie"}, z: 212, id: "minecraft:mob_spawner", MaxSpawnDelay: 800s, SpawnRange: 4s, Delay: 0s, MinSpawnDelay: 200s}
}
companion object : BlockEntityFactory<MobSpawnerBlockEntity> {
override val RESOURCE_LOCATION: ResourceLocation = ResourceLocation("minecraft:mob_spawner")
override fun build(connection: PlayConnection): MobSpawnerBlockEntity {
return MobSpawnerBlockEntity(connection)
}
}
}

View File

@ -0,0 +1,28 @@
/*
* 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
import de.bixilon.minosoft.data.mappings.ResourceLocation
import de.bixilon.minosoft.protocol.network.connection.PlayConnection
class ShulkerBoxBlockEntity(connection: PlayConnection) : BlockEntity(connection) {
companion object : BlockEntityFactory<ShulkerBoxBlockEntity> {
override val RESOURCE_LOCATION: ResourceLocation = ResourceLocation("minecraft:shulker_box")
override fun build(connection: PlayConnection): ShulkerBoxBlockEntity {
return ShulkerBoxBlockEntity(connection)
}
}
}

View File

@ -0,0 +1,28 @@
/*
* 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
import de.bixilon.minosoft.data.mappings.ResourceLocation
import de.bixilon.minosoft.protocol.network.connection.PlayConnection
class SkullBlockEntity(connection: PlayConnection) : BlockEntity(connection) {
companion object : BlockEntityFactory<SkullBlockEntity> {
override val RESOURCE_LOCATION: ResourceLocation = ResourceLocation("minecraft:skull")
override fun build(connection: PlayConnection): SkullBlockEntity {
return SkullBlockEntity(connection)
}
}
}

View File

@ -0,0 +1,28 @@
/*
* 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
import de.bixilon.minosoft.data.mappings.ResourceLocation
import de.bixilon.minosoft.protocol.network.connection.PlayConnection
class SmokerBlockEntity(connection: PlayConnection) : BlockEntity(connection) {
companion object : BlockEntityFactory<SmokerBlockEntity> {
override val RESOURCE_LOCATION: ResourceLocation = ResourceLocation("minecraft:smoker")
override fun build(connection: PlayConnection): SmokerBlockEntity {
return SmokerBlockEntity(connection)
}
}
}

View File

@ -0,0 +1,33 @@
/*
* 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
import de.bixilon.minosoft.data.mappings.ResourceLocation
import de.bixilon.minosoft.protocol.network.connection.PlayConnection
import de.bixilon.minosoft.util.nbt.tag.CompoundTag
class StructureBlockBlockEntity(connection: PlayConnection) : BlockEntity(connection) {
override fun updateNBT(nbt: CompoundTag) {
// ToDo: {mirror: "NONE", metadata: "asd", ignoreEntities: 1b, powered: 0b, seed: 0l, author: "Bixilon", rotation: "NONE", posX: 0, mode: "DATA", posY: 1, sizeX: 0, integrity: 1.0F, posZ: 0, showair: 0b, x: -102, name: "", y: 4, z: 212, id: "minecraft:structure_block", sizeY: 0, sizeZ: 0, showboundingbox: 1b}
}
companion object : BlockEntityFactory<StructureBlockBlockEntity> {
override val RESOURCE_LOCATION: ResourceLocation = ResourceLocation("minecraft:structure_block")
override fun build(connection: PlayConnection): StructureBlockBlockEntity {
return StructureBlockBlockEntity(connection)
}
}
}

View File

@ -0,0 +1,28 @@
/*
* 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
import de.bixilon.minosoft.data.mappings.ResourceLocation
import de.bixilon.minosoft.protocol.network.connection.PlayConnection
class TrappedChestBlockEntity(connection: PlayConnection) : BlockEntity(connection) {
companion object : BlockEntityFactory<TrappedChestBlockEntity> {
override val RESOURCE_LOCATION: ResourceLocation = ResourceLocation("minecraft:trapped_chest")
override fun build(connection: PlayConnection): TrappedChestBlockEntity {
return TrappedChestBlockEntity(connection)
}
}
}