Port to 1.21

This commit is contained in:
Linnea Gräf
2024-07-05 22:17:02 +02:00
parent 5ee4b8d925
commit 3d792dbef7
31 changed files with 126 additions and 119 deletions

View File

@@ -9,7 +9,6 @@ package moe.nea.firmament.features.texturepack
import com.mojang.authlib.minecraft.MinecraftProfileTexture
import com.mojang.authlib.properties.Property
import net.fabricmc.fabric.api.entity.event.v1.EntityElytraEvents.Custom
import org.spongepowered.asm.mixin.injection.callback.CallbackInfoReturnable
import net.minecraft.block.SkullBlock
import net.minecraft.client.MinecraftClient
@@ -62,10 +61,13 @@ object CustomSkyBlockTextures : FirmamentFeature {
.endsWith(".json")
}
for (identifier in resources.keys) {
val modelId = ModelIdentifier("firmskyblock",
identifier.path.substring("models/item/".length,
identifier.path.length - ".json".length),
"inventory")
val modelId = ModelIdentifier.ofInventoryVariant(
Identifier.of(
"firmskyblock",
identifier.path.substring(
"models/item/".length,
identifier.path.length - ".json".length),
))
event.addModel(modelId)
}
}
@@ -74,7 +76,7 @@ object CustomSkyBlockTextures : FirmamentFeature {
fun onCustomModelId(it: CustomItemModelEvent) {
if (!TConfig.enabled) return
val id = it.itemStack.skyBlockId ?: return
it.overrideModel = ModelIdentifier("firmskyblock", id.identifier.path, "inventory")
it.overrideModel = ModelIdentifier.ofInventoryVariant(Identifier.of("firmskyblock", id.identifier.path))
}
private val skullTextureCache = mutableMapOf<IdentityCharacteristics<ProfileComponent>, Any>()
@@ -92,7 +94,7 @@ object CustomSkyBlockTextures : FirmamentFeature {
fun getSkullTexture(profile: ProfileComponent): Identifier? {
val id = getSkullId(profile.properties["textures"].firstOrNull() ?: return null) ?: return null
return Identifier("firmskyblock", "textures/placedskull/$id.png")
return Identifier.of("firmskyblock", "textures/placedskull/$id.png")
}
fun modifySkullTexture(