mirror of
https://gitlab.bixilon.de/bixilon/minosoft.git
synced 2025-09-18 11:54:59 -04:00
move villager data to own package
This commit is contained in:
parent
e0ebfadc67
commit
0ea79cb80b
@ -37,8 +37,8 @@ import de.bixilon.minosoft.data.entities.entities.monster.*
|
|||||||
import de.bixilon.minosoft.data.entities.entities.monster.piglin.Piglin
|
import de.bixilon.minosoft.data.entities.entities.monster.piglin.Piglin
|
||||||
import de.bixilon.minosoft.data.entities.entities.monster.piglin.PiglinBrute
|
import de.bixilon.minosoft.data.entities.entities.monster.piglin.PiglinBrute
|
||||||
import de.bixilon.minosoft.data.entities.entities.monster.raid.*
|
import de.bixilon.minosoft.data.entities.entities.monster.raid.*
|
||||||
import de.bixilon.minosoft.data.entities.entities.npc.Villager
|
import de.bixilon.minosoft.data.entities.entities.npc.villager.Villager
|
||||||
import de.bixilon.minosoft.data.entities.entities.npc.WanderingTrader
|
import de.bixilon.minosoft.data.entities.entities.npc.villager.WanderingTrader
|
||||||
import de.bixilon.minosoft.data.entities.entities.player.PlayerEntity
|
import de.bixilon.minosoft.data.entities.entities.player.PlayerEntity
|
||||||
import de.bixilon.minosoft.data.entities.entities.projectile.*
|
import de.bixilon.minosoft.data.entities.entities.projectile.*
|
||||||
import de.bixilon.minosoft.data.entities.entities.vehicle.*
|
import de.bixilon.minosoft.data.entities.entities.vehicle.*
|
||||||
|
@ -15,6 +15,10 @@ package de.bixilon.minosoft.data.entities;
|
|||||||
|
|
||||||
import de.bixilon.minosoft.data.Directions;
|
import de.bixilon.minosoft.data.Directions;
|
||||||
import de.bixilon.minosoft.data.entities.entities.animal.Axolotl;
|
import de.bixilon.minosoft.data.entities.entities.animal.Axolotl;
|
||||||
|
import de.bixilon.minosoft.data.entities.entities.npc.villager.data.VillagerData;
|
||||||
|
import de.bixilon.minosoft.data.entities.entities.npc.villager.data.VillagerLevels;
|
||||||
|
import de.bixilon.minosoft.data.entities.entities.npc.villager.data.VillagerProfessions;
|
||||||
|
import de.bixilon.minosoft.data.entities.entities.npc.villager.data.VillagerTypes;
|
||||||
import de.bixilon.minosoft.data.entities.entities.vehicle.Boat;
|
import de.bixilon.minosoft.data.entities.entities.vehicle.Boat;
|
||||||
import de.bixilon.minosoft.data.mappings.ResourceLocation;
|
import de.bixilon.minosoft.data.mappings.ResourceLocation;
|
||||||
import de.bixilon.minosoft.data.mappings.particle.Particle;
|
import de.bixilon.minosoft.data.mappings.particle.Particle;
|
||||||
@ -190,7 +194,7 @@ public enum EntityMetaDataFields {
|
|||||||
|
|
||||||
ABSTRACT_VILLAGER_UNHAPPY_TIMER(0),
|
ABSTRACT_VILLAGER_UNHAPPY_TIMER(0),
|
||||||
|
|
||||||
VILLAGER_VILLAGER_DATA(new VillagerData(VillagerData.VillagerTypes.PLAINS, VillagerData.VillagerProfessions.NONE, VillagerData.VillagerLevels.APPRENTICE)),
|
VILLAGER_VILLAGER_DATA(new VillagerData(VillagerTypes.PLAINS, VillagerProfessions.NONE, VillagerLevels.APPRENTICE)),
|
||||||
|
|
||||||
IRON_GOLEM_FLAGS((byte) 0),
|
IRON_GOLEM_FLAGS((byte) 0),
|
||||||
|
|
||||||
@ -235,7 +239,7 @@ public enum EntityMetaDataFields {
|
|||||||
ZOGLIN_IS_BABY(false),
|
ZOGLIN_IS_BABY(false),
|
||||||
|
|
||||||
ZOMBIE_VILLAGER_IS_CONVERTING(false),
|
ZOMBIE_VILLAGER_IS_CONVERTING(false),
|
||||||
ZOMBIE_VILLAGER_DATA(new VillagerData(VillagerData.VillagerTypes.PLAINS, VillagerData.VillagerProfessions.NONE, VillagerData.VillagerLevels.APPRENTICE)),
|
ZOMBIE_VILLAGER_DATA(new VillagerData(VillagerTypes.PLAINS, VillagerProfessions.NONE, VillagerLevels.APPRENTICE)),
|
||||||
|
|
||||||
ENDERMAN_CARRIED_BLOCK,
|
ENDERMAN_CARRIED_BLOCK,
|
||||||
ENDERMAN_IS_SCREAMING(false),
|
ENDERMAN_IS_SCREAMING(false),
|
||||||
|
@ -1,89 +0,0 @@
|
|||||||
/*
|
|
||||||
* Minosoft
|
|
||||||
* Copyright (C) 2020 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
|
|
||||||
|
|
||||||
import de.bixilon.minosoft.data.VersionValueMap
|
|
||||||
import de.bixilon.minosoft.protocol.protocol.ProtocolVersions.*
|
|
||||||
|
|
||||||
data class VillagerData(val type: VillagerTypes, val profession: VillagerProfessions, val level: VillagerLevels) {
|
|
||||||
constructor(type: Int, profession: Int, level: Int, versionId: Int) : this(VillagerTypes.values()[type], VillagerProfessions.byId(profession, versionId)!!, VillagerLevels.values()[level])
|
|
||||||
|
|
||||||
enum class VillagerProfessions(val values: Map<Int, Int>) {
|
|
||||||
NONE(mapOf(V_18W50A to 0)),
|
|
||||||
ARMORER(mapOf(V_18W50A to 1)),
|
|
||||||
BUTCHER(mapOf(LOWEST_VERSION_SUPPORTED to 4, V_18W50A to 2)),
|
|
||||||
CARTOGRAPHER(mapOf(V_18W50A to 3)),
|
|
||||||
CLERIC(mapOf(V_18W50A to 4)),
|
|
||||||
FARMER(mapOf(LOWEST_VERSION_SUPPORTED to 0, V_18W50A to 5)),
|
|
||||||
FISHERMAN(mapOf(V_18W50A to 6)),
|
|
||||||
FLETCHER(mapOf(V_18W50A to 7)),
|
|
||||||
LEATHER_WORKER(mapOf(V_18W50A to 8)),
|
|
||||||
LIBRARIAN(mapOf(LOWEST_VERSION_SUPPORTED to 1, V_18W50A to 9)),
|
|
||||||
MASON(mapOf(V_18W50A to 10)),
|
|
||||||
NITWIT(mapOf(LOWEST_VERSION_SUPPORTED to 5, V_18W50A to 11)),
|
|
||||||
SHEPHERD(mapOf(V_18W50A to 12)),
|
|
||||||
TOOL_SMITH(mapOf(V_18W50A to 13)),
|
|
||||||
WEAPON_SMITH(mapOf(V_18W50A to 14)),
|
|
||||||
PRIEST(mapOf(LOWEST_VERSION_SUPPORTED to 2, V_18W50A to -1)),
|
|
||||||
BLACKSMITH(mapOf(LOWEST_VERSION_SUPPORTED to 3, V_18W50A to -1)),
|
|
||||||
HUSK(mapOf(V_1_10_PRE1 to 5, V_1_11 to -100)), // ToDo
|
|
||||||
ZOMBIE(mapOf(V_1_10_PRE1 to -1, V_1_11 to -100));
|
|
||||||
|
|
||||||
// used earlier (ZombieVillagerMeta)
|
|
||||||
private val valueMap = VersionValueMap(values)
|
|
||||||
|
|
||||||
|
|
||||||
fun getId(versionId: Int): Int {
|
|
||||||
return valueMap[versionId]
|
|
||||||
}
|
|
||||||
|
|
||||||
companion object {
|
|
||||||
@JvmStatic
|
|
||||||
fun byId(id: Int, versionId: Int): VillagerProfessions? {
|
|
||||||
for (profession in values()) {
|
|
||||||
if (profession.getId(versionId) == id) {
|
|
||||||
return profession
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return null
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
enum class VillagerTypes {
|
|
||||||
DESSERT, JUNGLE, PLAINS, SAVANNA, SNOW, SWAMP, TAIGA;
|
|
||||||
|
|
||||||
companion object {
|
|
||||||
private val VILLAGER_TYPES: Array<VillagerTypes> = values()
|
|
||||||
|
|
||||||
@JvmStatic
|
|
||||||
fun byId(id: Int): VillagerTypes {
|
|
||||||
return VILLAGER_TYPES[id]
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
enum class VillagerLevels {
|
|
||||||
NOVICE, APPRENTICE, JOURNEYMAN, EXPERT, MASTER;
|
|
||||||
|
|
||||||
companion object {
|
|
||||||
private val VILLAGER_LEVELS: Array<VillagerLevels> = values()
|
|
||||||
|
|
||||||
@JvmStatic
|
|
||||||
fun byId(id: Int): VillagerLevels {
|
|
||||||
return VILLAGER_LEVELS[id]
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
@ -15,8 +15,8 @@ package de.bixilon.minosoft.data.entities.entities.monster;
|
|||||||
|
|
||||||
import de.bixilon.minosoft.data.entities.EntityMetaDataFields;
|
import de.bixilon.minosoft.data.entities.EntityMetaDataFields;
|
||||||
import de.bixilon.minosoft.data.entities.EntityRotation;
|
import de.bixilon.minosoft.data.entities.EntityRotation;
|
||||||
import de.bixilon.minosoft.data.entities.VillagerData;
|
|
||||||
import de.bixilon.minosoft.data.entities.entities.EntityMetaDataFunction;
|
import de.bixilon.minosoft.data.entities.entities.EntityMetaDataFunction;
|
||||||
|
import de.bixilon.minosoft.data.entities.entities.npc.villager.data.VillagerData;
|
||||||
import de.bixilon.minosoft.protocol.network.Connection;
|
import de.bixilon.minosoft.protocol.network.Connection;
|
||||||
import glm_.vec3.Vec3;
|
import glm_.vec3.Vec3;
|
||||||
|
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
/*
|
/*
|
||||||
* Minosoft
|
* Minosoft
|
||||||
* Copyright (C) 2020 Moritz Zwerger
|
* 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 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.
|
||||||
*
|
*
|
||||||
@ -11,7 +11,7 @@
|
|||||||
* 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.entities.npc;
|
package de.bixilon.minosoft.data.entities.entities.npc.villager;
|
||||||
|
|
||||||
import de.bixilon.minosoft.data.entities.EntityMetaDataFields;
|
import de.bixilon.minosoft.data.entities.EntityMetaDataFields;
|
||||||
import de.bixilon.minosoft.data.entities.EntityRotation;
|
import de.bixilon.minosoft.data.entities.EntityRotation;
|
@ -1,6 +1,6 @@
|
|||||||
/*
|
/*
|
||||||
* Minosoft
|
* Minosoft
|
||||||
* Copyright (C) 2020 Moritz Zwerger
|
* 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 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.
|
||||||
*
|
*
|
||||||
@ -11,12 +11,12 @@
|
|||||||
* 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.entities.npc;
|
package de.bixilon.minosoft.data.entities.entities.npc.villager;
|
||||||
|
|
||||||
import de.bixilon.minosoft.data.entities.EntityMetaDataFields;
|
import de.bixilon.minosoft.data.entities.EntityMetaDataFields;
|
||||||
import de.bixilon.minosoft.data.entities.EntityRotation;
|
import de.bixilon.minosoft.data.entities.EntityRotation;
|
||||||
import de.bixilon.minosoft.data.entities.VillagerData;
|
|
||||||
import de.bixilon.minosoft.data.entities.entities.EntityMetaDataFunction;
|
import de.bixilon.minosoft.data.entities.entities.EntityMetaDataFunction;
|
||||||
|
import de.bixilon.minosoft.data.entities.entities.npc.villager.data.VillagerData;
|
||||||
import de.bixilon.minosoft.protocol.network.Connection;
|
import de.bixilon.minosoft.protocol.network.Connection;
|
||||||
import glm_.vec3.Vec3;
|
import glm_.vec3.Vec3;
|
||||||
|
|
@ -1,6 +1,6 @@
|
|||||||
/*
|
/*
|
||||||
* Minosoft
|
* Minosoft
|
||||||
* Copyright (C) 2020 Moritz Zwerger
|
* 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 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.
|
||||||
*
|
*
|
||||||
@ -11,7 +11,7 @@
|
|||||||
* 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.entities.npc;
|
package de.bixilon.minosoft.data.entities.entities.npc.villager;
|
||||||
|
|
||||||
import de.bixilon.minosoft.data.entities.EntityRotation;
|
import de.bixilon.minosoft.data.entities.EntityRotation;
|
||||||
import de.bixilon.minosoft.protocol.network.Connection;
|
import de.bixilon.minosoft.protocol.network.Connection;
|
@ -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.entities.npc.villager.data
|
||||||
|
|
||||||
|
data class VillagerData(
|
||||||
|
val type: VillagerTypes,
|
||||||
|
val profession: VillagerProfessions,
|
||||||
|
val level: VillagerLevels,
|
||||||
|
)
|
@ -0,0 +1,31 @@
|
|||||||
|
/*
|
||||||
|
* 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.entities.npc.villager.data
|
||||||
|
|
||||||
|
import de.bixilon.minosoft.util.KUtil
|
||||||
|
import de.bixilon.minosoft.util.enum.ValuesEnum
|
||||||
|
|
||||||
|
enum class VillagerLevels {
|
||||||
|
NOVICE,
|
||||||
|
APPRENTICE,
|
||||||
|
JOURNEYMAN,
|
||||||
|
EXPERT,
|
||||||
|
MASTER,
|
||||||
|
;
|
||||||
|
|
||||||
|
companion object : ValuesEnum<VillagerLevels> {
|
||||||
|
override val VALUES = values()
|
||||||
|
override val NAME_MAP = KUtil.getEnumValues(VALUES)
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,65 @@
|
|||||||
|
/*
|
||||||
|
* 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.entities.npc.villager.data
|
||||||
|
|
||||||
|
import de.bixilon.minosoft.data.VersionValueMap
|
||||||
|
import de.bixilon.minosoft.protocol.protocol.ProtocolVersions
|
||||||
|
import de.bixilon.minosoft.util.KUtil
|
||||||
|
import de.bixilon.minosoft.util.enum.ValuesEnum
|
||||||
|
|
||||||
|
enum class VillagerProfessions(val values: Map<Int, Int>) {
|
||||||
|
NONE(mapOf(ProtocolVersions.V_18W50A to 0)),
|
||||||
|
ARMORER(mapOf(ProtocolVersions.V_18W50A to 1)),
|
||||||
|
BUTCHER(mapOf(ProtocolVersions.LOWEST_VERSION_SUPPORTED to 4, ProtocolVersions.V_18W50A to 2)),
|
||||||
|
CARTOGRAPHER(mapOf(ProtocolVersions.V_18W50A to 3)),
|
||||||
|
CLERIC(mapOf(ProtocolVersions.V_18W50A to 4)),
|
||||||
|
FARMER(mapOf(ProtocolVersions.LOWEST_VERSION_SUPPORTED to 0, ProtocolVersions.V_18W50A to 5)),
|
||||||
|
FISHERMAN(mapOf(ProtocolVersions.V_18W50A to 6)),
|
||||||
|
FLETCHER(mapOf(ProtocolVersions.V_18W50A to 7)),
|
||||||
|
LEATHER_WORKER(mapOf(ProtocolVersions.V_18W50A to 8)),
|
||||||
|
LIBRARIAN(mapOf(ProtocolVersions.LOWEST_VERSION_SUPPORTED to 1, ProtocolVersions.V_18W50A to 9)),
|
||||||
|
MASON(mapOf(ProtocolVersions.V_18W50A to 10)),
|
||||||
|
NITWIT(mapOf(ProtocolVersions.LOWEST_VERSION_SUPPORTED to 5, ProtocolVersions.V_18W50A to 11)),
|
||||||
|
SHEPHERD(mapOf(ProtocolVersions.V_18W50A to 12)),
|
||||||
|
TOOL_SMITH(mapOf(ProtocolVersions.V_18W50A to 13)),
|
||||||
|
WEAPON_SMITH(mapOf(ProtocolVersions.V_18W50A to 14)),
|
||||||
|
PRIEST(mapOf(ProtocolVersions.LOWEST_VERSION_SUPPORTED to 2, ProtocolVersions.V_18W50A to -1)),
|
||||||
|
BLACKSMITH(mapOf(ProtocolVersions.LOWEST_VERSION_SUPPORTED to 3, ProtocolVersions.V_18W50A to -1)),
|
||||||
|
HUSK(mapOf(ProtocolVersions.V_1_10_PRE1 to 5, ProtocolVersions.V_1_11 to -100)), // ToDo
|
||||||
|
ZOMBIE(mapOf(ProtocolVersions.V_1_10_PRE1 to -1, ProtocolVersions.V_1_11 to -100));
|
||||||
|
|
||||||
|
// used earlier (ZombieVillagerMeta)
|
||||||
|
private val valueMap = VersionValueMap(values)
|
||||||
|
|
||||||
|
|
||||||
|
fun getId(versionId: Int): Int {
|
||||||
|
return valueMap[versionId]
|
||||||
|
}
|
||||||
|
|
||||||
|
companion object : ValuesEnum<VillagerProfessions> {
|
||||||
|
override val VALUES = values()
|
||||||
|
override val NAME_MAP = KUtil.getEnumValues(VALUES)
|
||||||
|
|
||||||
|
@JvmStatic
|
||||||
|
fun byId(id: Int, versionId: Int): VillagerProfessions? {
|
||||||
|
for (profession in values()) {
|
||||||
|
if (profession.getId(versionId) == id) {
|
||||||
|
return profession
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return null
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
@ -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.entities.npc.villager.data
|
||||||
|
|
||||||
|
import de.bixilon.minosoft.util.KUtil
|
||||||
|
import de.bixilon.minosoft.util.enum.ValuesEnum
|
||||||
|
|
||||||
|
enum class VillagerTypes {
|
||||||
|
DESSERT,
|
||||||
|
JUNGLE,
|
||||||
|
PLAINS,
|
||||||
|
SAVANNA,
|
||||||
|
SNOW,
|
||||||
|
SWAMP,
|
||||||
|
TAIGA,
|
||||||
|
;
|
||||||
|
|
||||||
|
companion object : ValuesEnum<VillagerTypes> {
|
||||||
|
override val VALUES = values()
|
||||||
|
override val NAME_MAP = KUtil.getEnumValues(VALUES)
|
||||||
|
}
|
||||||
|
}
|
@ -17,7 +17,10 @@ import de.bixilon.minosoft.data.Directions
|
|||||||
import de.bixilon.minosoft.data.entities.EntityMetaDataFields
|
import de.bixilon.minosoft.data.entities.EntityMetaDataFields
|
||||||
import de.bixilon.minosoft.data.entities.EntityRotation
|
import de.bixilon.minosoft.data.entities.EntityRotation
|
||||||
import de.bixilon.minosoft.data.entities.Poses
|
import de.bixilon.minosoft.data.entities.Poses
|
||||||
import de.bixilon.minosoft.data.entities.VillagerData
|
import de.bixilon.minosoft.data.entities.entities.npc.villager.data.VillagerData
|
||||||
|
import de.bixilon.minosoft.data.entities.entities.npc.villager.data.VillagerLevels
|
||||||
|
import de.bixilon.minosoft.data.entities.entities.npc.villager.data.VillagerProfessions
|
||||||
|
import de.bixilon.minosoft.data.entities.entities.npc.villager.data.VillagerTypes
|
||||||
import de.bixilon.minosoft.data.inventory.ItemStack
|
import de.bixilon.minosoft.data.inventory.ItemStack
|
||||||
import de.bixilon.minosoft.data.mappings.blocks.BlockState
|
import de.bixilon.minosoft.data.mappings.blocks.BlockState
|
||||||
import de.bixilon.minosoft.data.mappings.particle.data.ParticleData
|
import de.bixilon.minosoft.data.mappings.particle.data.ParticleData
|
||||||
@ -80,7 +83,7 @@ class EntityMetaData(
|
|||||||
EntityMetaDataDataTypes.POSE -> buffer.readPose()
|
EntityMetaDataDataTypes.POSE -> buffer.readPose()
|
||||||
EntityMetaDataDataTypes.BLOCK_ID -> buffer.connection.mapping.getBlockState(buffer.readVarInt()) // ToDo
|
EntityMetaDataDataTypes.BLOCK_ID -> buffer.connection.mapping.getBlockState(buffer.readVarInt()) // ToDo
|
||||||
EntityMetaDataDataTypes.OPT_VAR_INT -> buffer.readVarInt() - 1
|
EntityMetaDataDataTypes.OPT_VAR_INT -> buffer.readVarInt() - 1
|
||||||
EntityMetaDataDataTypes.VILLAGER_DATA -> VillagerData(VillagerData.VillagerTypes.byId(buffer.readVarInt()), VillagerData.VillagerProfessions.byId(buffer.readVarInt(), buffer.versionId)!!, VillagerData.VillagerLevels.byId(buffer.readVarInt()))
|
EntityMetaDataDataTypes.VILLAGER_DATA -> VillagerData(VillagerTypes.VALUES[buffer.readVarInt()], VillagerProfessions.byId(buffer.readVarInt(), buffer.versionId)!!, VillagerLevels.VALUES[buffer.readVarInt()])
|
||||||
EntityMetaDataDataTypes.OPT_BLOCK_ID -> {
|
EntityMetaDataDataTypes.OPT_BLOCK_ID -> {
|
||||||
val blockId = buffer.readVarInt()
|
val blockId = buffer.readVarInt()
|
||||||
if (blockId == ProtocolDefinition.NULL_BLOCK_ID) {
|
if (blockId == ProtocolDefinition.NULL_BLOCK_ID) {
|
||||||
|
@ -14,7 +14,7 @@
|
|||||||
package de.bixilon.minosoft.protocol.packets.clientbound.play;
|
package de.bixilon.minosoft.protocol.packets.clientbound.play;
|
||||||
|
|
||||||
import de.bixilon.minosoft.data.Trade;
|
import de.bixilon.minosoft.data.Trade;
|
||||||
import de.bixilon.minosoft.data.entities.VillagerData;
|
import de.bixilon.minosoft.data.entities.entities.npc.villager.data.VillagerLevels;
|
||||||
import de.bixilon.minosoft.data.inventory.ItemStack;
|
import de.bixilon.minosoft.data.inventory.ItemStack;
|
||||||
import de.bixilon.minosoft.protocol.packets.ClientboundPacket;
|
import de.bixilon.minosoft.protocol.packets.ClientboundPacket;
|
||||||
import de.bixilon.minosoft.protocol.protocol.InByteBuffer;
|
import de.bixilon.minosoft.protocol.protocol.InByteBuffer;
|
||||||
@ -26,7 +26,7 @@ import static de.bixilon.minosoft.protocol.protocol.ProtocolVersions.V_1_14_4_PR
|
|||||||
public class PacketTradeList extends ClientboundPacket {
|
public class PacketTradeList extends ClientboundPacket {
|
||||||
int windowId;
|
int windowId;
|
||||||
Trade[] trades;
|
Trade[] trades;
|
||||||
VillagerData.VillagerLevels level;
|
VillagerLevels level;
|
||||||
int experience;
|
int experience;
|
||||||
boolean isRegularVillager;
|
boolean isRegularVillager;
|
||||||
boolean canRestock;
|
boolean canRestock;
|
||||||
@ -54,7 +54,7 @@ public class PacketTradeList extends ClientboundPacket {
|
|||||||
}
|
}
|
||||||
this.trades[i] = new Trade(input1, input2, enabled, usages, maxUsages, xp, specialPrice, priceMultiplier, demand);
|
this.trades[i] = new Trade(input1, input2, enabled, usages, maxUsages, xp, specialPrice, priceMultiplier, demand);
|
||||||
}
|
}
|
||||||
this.level = VillagerData.VillagerLevels.byId(buffer.readVarInt());
|
this.level = VillagerLevels.Companion.getVALUES()[buffer.readVarInt()];
|
||||||
this.experience = buffer.readVarInt();
|
this.experience = buffer.readVarInt();
|
||||||
this.isRegularVillager = buffer.readBoolean();
|
this.isRegularVillager = buffer.readBoolean();
|
||||||
if (buffer.getVersionId() >= V_1_14_3_PRE1) {
|
if (buffer.getVersionId() >= V_1_14_3_PRE1) {
|
||||||
@ -76,7 +76,7 @@ public class PacketTradeList extends ClientboundPacket {
|
|||||||
return this.trades;
|
return this.trades;
|
||||||
}
|
}
|
||||||
|
|
||||||
public VillagerData.VillagerLevels getLevel() {
|
public VillagerLevels getLevel() {
|
||||||
return this.level;
|
return this.level;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user