add 1.21 entities and block states

Fixes the loading of those versions

Hacky added, but deprecated. todo
This commit is contained in:
Moritz Zwerger 2023-11-18 15:31:39 +01:00
parent 7094aa70d9
commit 8c428d8383
No known key found for this signature in database
GPG Key ID: 5CAD791931B09AC4
9 changed files with 105 additions and 0 deletions

View File

@ -0,0 +1,33 @@
/*
* 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.entities.entities
import de.bixilon.kotlinglm.vec3.Vec3d
import de.bixilon.minosoft.data.entities.EntityRotation
import de.bixilon.minosoft.data.entities.data.EntityData
import de.bixilon.minosoft.data.registries.entities.EntityFactory
import de.bixilon.minosoft.data.registries.entities.EntityType
import de.bixilon.minosoft.data.registries.identified.Namespaces.minecraft
import de.bixilon.minosoft.protocol.network.connection.play.PlayConnection
@Deprecated("TODO")
class Breeze(connection: PlayConnection, entityType: EntityType, data: EntityData, position: Vec3d, rotation: EntityRotation) : Entity(connection, entityType, data, position, rotation) {
companion object : EntityFactory<Breeze> {
override val identifier = minecraft("breeze")
override fun build(connection: PlayConnection, entityType: EntityType, data: EntityData, position: Vec3d, rotation: EntityRotation): Breeze {
return Breeze(connection, entityType, data, position, rotation)
}
}
}

View File

@ -0,0 +1,33 @@
/*
* 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.entities.entities
import de.bixilon.kotlinglm.vec3.Vec3d
import de.bixilon.minosoft.data.entities.EntityRotation
import de.bixilon.minosoft.data.entities.data.EntityData
import de.bixilon.minosoft.data.registries.entities.EntityFactory
import de.bixilon.minosoft.data.registries.entities.EntityType
import de.bixilon.minosoft.data.registries.identified.Namespaces.minecraft
import de.bixilon.minosoft.protocol.network.connection.play.PlayConnection
@Deprecated("TODO")
class WindCharge(connection: PlayConnection, entityType: EntityType, data: EntityData, position: Vec3d, rotation: EntityRotation) : Entity(connection, entityType, data, position, rotation) {
companion object : EntityFactory<WindCharge> {
override val identifier = minecraft("wind_charge")
override fun build(connection: PlayConnection, entityType: EntityType, data: EntityData, position: Vec3d, rotation: EntityRotation): WindCharge {
return WindCharge(connection, entityType, data, position, rotation)
}
}
}

View File

@ -22,6 +22,7 @@ import de.bixilon.minosoft.data.registries.identified.Namespaces.minecraft
import de.bixilon.minosoft.data.registries.identified.ResourceLocation
import de.bixilon.minosoft.protocol.network.connection.play.PlayConnection
@Deprecated("TODO")
class BlockDisplayEntity(connection: PlayConnection, entityType: EntityType, data: EntityData, position: Vec3d, rotation: EntityRotation) : DisplayEntity(connection, entityType, data, position, rotation) {
companion object : EntityFactory<BlockDisplayEntity> {

View File

@ -20,6 +20,7 @@ import de.bixilon.minosoft.data.entities.entities.Entity
import de.bixilon.minosoft.data.registries.entities.EntityType
import de.bixilon.minosoft.protocol.network.connection.play.PlayConnection
@Deprecated("TODO")
abstract class DisplayEntity(connection: PlayConnection, entityType: EntityType, data: EntityData, position: Vec3d, rotation: EntityRotation) : Entity(connection, entityType, data, position, rotation) {
private companion object {

View File

@ -22,6 +22,7 @@ import de.bixilon.minosoft.data.registries.identified.Namespaces.minecraft
import de.bixilon.minosoft.data.registries.identified.ResourceLocation
import de.bixilon.minosoft.protocol.network.connection.play.PlayConnection
@Deprecated("TODO")
class ItemDisplayEntity(connection: PlayConnection, entityType: EntityType, data: EntityData, position: Vec3d, rotation: EntityRotation) : DisplayEntity(connection, entityType, data, position, rotation) {
companion object : EntityFactory<ItemDisplayEntity> {

View File

@ -22,6 +22,7 @@ import de.bixilon.minosoft.data.registries.identified.Namespaces.minecraft
import de.bixilon.minosoft.data.registries.identified.ResourceLocation
import de.bixilon.minosoft.protocol.network.connection.play.PlayConnection
@Deprecated("TODO")
class TextDisplayEntity(connection: PlayConnection, entityType: EntityType, data: EntityData, position: Vec3d, rotation: EntityRotation) : DisplayEntity(connection, entityType, data, position, rotation) {
companion object : EntityFactory<TextDisplayEntity> {

View File

@ -147,6 +147,8 @@ object BlockProperties {
val CRACKED = BooleanProperty("cracked").register()
val CRAFTING = BooleanProperty("crafting").register()
val TRIAL_SPAWNER_STATE = EnumProperty("trial_spawner_state", TrialSpawnerStates).register()
@Deprecated("should not exist")
fun <T : BlockProperty<*>> T.register(): T {

View File

@ -0,0 +1,32 @@
/*
* 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.properties
import de.bixilon.kutil.enums.EnumUtil
import de.bixilon.kutil.enums.ValuesEnum
enum class TrialSpawnerStates {
ACTIVE,
COOLDOWN,
EJECTING_REWARD,
INACTIVE,
WAITING_FOR_PLAYERS,
WAITING_FOR_REWARD_EJECTION,
;
companion object : ValuesEnum<TrialSpawnerStates> {
override val VALUES: Array<TrialSpawnerStates> = values()
override val NAME_MAP: Map<String, TrialSpawnerStates> = EnumUtil.getEnumValues(VALUES)
}
}

View File

@ -182,6 +182,7 @@ object DefaultEntityFactories : DefaultFactory<EntityFactory<*>>(
InteractionEntity,
Sniffer,
Breeze, WindCharge,
) {
fun buildEntity(factory: EntityFactory<out Entity>, connection: PlayConnection, position: Vec3d, rotation: EntityRotation, data: EntityData?, uuid: UUID?, versionId: Int): Entity? {