mirror of
https://gitlab.bixilon.de/bixilon/minosoft.git
synced 2025-09-18 11:54:59 -04:00
fix wrong entity type fixer
This commit is contained in:
parent
c8150e5fb5
commit
b388253a49
@ -1,6 +1,6 @@
|
||||
/*
|
||||
* Minosoft
|
||||
* Copyright (C) 2020-2023 Moritz Zwerger
|
||||
* Copyright (C) 2020-2024 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.
|
||||
*
|
||||
@ -55,6 +55,7 @@ import de.bixilon.minosoft.data.registries.shapes.ShapeRegistry
|
||||
import de.bixilon.minosoft.data.registries.sound.SoundGroup
|
||||
import de.bixilon.minosoft.data.registries.statistics.Statistic
|
||||
import de.bixilon.minosoft.datafixer.enumeration.EntityDataTypesFixer
|
||||
import de.bixilon.minosoft.datafixer.rls.EntityTypeFixer
|
||||
import de.bixilon.minosoft.datafixer.rls.RegistryFixer.fixRegistry
|
||||
import de.bixilon.minosoft.protocol.packets.c2s.play.entity.EntityActionC2SP
|
||||
import de.bixilon.minosoft.protocol.packets.s2c.play.title.TitleS2CF
|
||||
@ -117,7 +118,7 @@ class Registries(
|
||||
val blockState = BlockStateRegistry(false)
|
||||
|
||||
val entityDataIndexMap: MutableMap<EntityDataField, Int> = mutableMapOf()
|
||||
val entityType: Registry<EntityType> = register("entity_type", Registry(codec = EntityType))
|
||||
val entityType: Registry<EntityType> = register("entity_type", Registry(codec = EntityType, fixer = EntityTypeFixer))
|
||||
val entityObjectType: Registry<EntityObjectType> = register("entity_object_type", Registry(codec = EntityObjectType))
|
||||
val damageType: Registry<DamageType> = register("damage_type", Registry(codec = DamageType))
|
||||
|
||||
|
@ -1,6 +1,6 @@
|
||||
/*
|
||||
* Minosoft
|
||||
* Copyright (C) 2020-2023 Moritz Zwerger
|
||||
* Copyright (C) 2020-2024 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.
|
||||
*
|
||||
@ -23,6 +23,7 @@ import de.bixilon.minosoft.data.registries.identified.ResourceLocation
|
||||
import de.bixilon.minosoft.data.registries.integrated.IntegratedRegistry
|
||||
import de.bixilon.minosoft.data.registries.registries.Registries
|
||||
import de.bixilon.minosoft.data.registries.registries.registry.codec.IdentifierCodec
|
||||
import de.bixilon.minosoft.datafixer.rls.ResourceLocationFixer
|
||||
import de.bixilon.minosoft.protocol.versions.Version
|
||||
import de.bixilon.minosoft.util.KUtil.toResourceLocation
|
||||
import it.unimi.dsi.fastutil.ints.Int2ObjectOpenHashMap
|
||||
@ -34,6 +35,7 @@ open class Registry<T : RegistryItem>(
|
||||
val integrated: IntegratedRegistry<T>? = null,
|
||||
val metaType: MetaTypes = MetaTypes.NONE,
|
||||
var flattened: Boolean = false,
|
||||
private val fixer: ResourceLocationFixer? = null,
|
||||
) : AbstractRegistry<T> {
|
||||
protected val idValueMap: Int2ObjectOpenHashMap<T> = Int2ObjectOpenHashMap()
|
||||
protected val valueIdMap: Object2IntOpenHashMap<T> = Object2IntOpenHashMap()
|
||||
@ -60,7 +62,8 @@ open class Registry<T : RegistryItem>(
|
||||
}
|
||||
|
||||
open operator fun get(resourceLocation: ResourceLocation): T? {
|
||||
return resourceLocationMap[resourceLocation] ?: parent?.get(resourceLocation)
|
||||
val fixed = fixer?.fix(resourceLocation) ?: resourceLocation
|
||||
return resourceLocationMap[fixed] ?: parent?.get(fixed)
|
||||
}
|
||||
|
||||
open operator fun set(any: Any, value: T) {
|
||||
@ -129,7 +132,7 @@ open class Registry<T : RegistryItem>(
|
||||
}
|
||||
|
||||
override fun add(identifier: ResourceLocation, id: Int?, data: JsonObject, version: Version, registries: Registries?): T? {
|
||||
val item = deserialize(identifier, data, version, registries) ?: return null
|
||||
val item = deserialize(fixer?.fix(identifier) ?: identifier, data, version, registries) ?: return null
|
||||
|
||||
add(identifier, id, item)
|
||||
|
||||
|
@ -1,6 +1,6 @@
|
||||
/*
|
||||
* Minosoft
|
||||
* Copyright (C) 2020-2023 Moritz Zwerger
|
||||
* Copyright (C) 2020-2024 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.
|
||||
*
|
||||
@ -19,6 +19,7 @@ import de.bixilon.minosoft.datafixer.rls.*
|
||||
object DataFixer {
|
||||
val fixer = listOf(
|
||||
EntityDataTypesFixer,
|
||||
EntityTypeFixer,
|
||||
|
||||
BlockEntityFixer,
|
||||
EntityAttributeFixer,
|
||||
|
@ -1,3 +1,3 @@
|
||||
{
|
||||
"zombie_pigman": "zombified_pigman"
|
||||
"zombie_pigman": "zombified_piglin"
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user