diff options
author | Linnea Gräf <nea@nea.moe> | 2025-01-21 13:17:01 +0100 |
---|---|---|
committer | Linnea Gräf <nea@nea.moe> | 2025-01-21 13:17:01 +0100 |
commit | 36cf26be6d783d56ecff22af753def8e6ee5aa62 (patch) | |
tree | a5f9046e8ab882bc01d2cbea9b974fa7aa233d2c /src/texturePacks/java | |
parent | 2a3a4c07f5db951169adfc5626e8cf28c0812cf6 (diff) | |
download | Firmament-36cf26be6d783d56ecff22af753def8e6ee5aa62.tar.gz Firmament-36cf26be6d783d56ecff22af753def8e6ee5aa62.tar.bz2 Firmament-36cf26be6d783d56ecff22af753def8e6ee5aa62.zip |
Diffstat (limited to 'src/texturePacks/java')
4 files changed, 14 insertions, 17 deletions
diff --git a/src/texturePacks/java/moe/nea/firmament/features/texturepack/CustomSkyBlockTextures.kt b/src/texturePacks/java/moe/nea/firmament/features/texturepack/CustomSkyBlockTextures.kt index e9437ef..bef52d2 100644 --- a/src/texturePacks/java/moe/nea/firmament/features/texturepack/CustomSkyBlockTextures.kt +++ b/src/texturePacks/java/moe/nea/firmament/features/texturepack/CustomSkyBlockTextures.kt @@ -76,7 +76,7 @@ object CustomSkyBlockTextures : FirmamentFeature { fun onCustomModelId(it: CustomItemModelEvent) { if (!TConfig.enabled) return val id = it.itemStack.skyBlockId ?: return - it.overrideIfExists(Identifier.of("firmskyblock", id.identifier.path)) + it.overrideIfEmpty(Identifier.of("firmskyblock", id.identifier.path)) } private val skullTextureCache = diff --git a/src/texturePacks/java/moe/nea/firmament/features/texturepack/predicates/ItemPredicate.kt b/src/texturePacks/java/moe/nea/firmament/features/texturepack/predicates/ItemPredicate.kt index 3cb80c7..4833dc0 100644 --- a/src/texturePacks/java/moe/nea/firmament/features/texturepack/predicates/ItemPredicate.kt +++ b/src/texturePacks/java/moe/nea/firmament/features/texturepack/predicates/ItemPredicate.kt @@ -17,7 +17,7 @@ class ItemPredicate( val item: Item ) : FirmamentModelPredicate { override fun test(stack: ItemStack): Boolean { - return stack.item == item + return stack.isOf(item) } object Parser : FirmamentModelPredicateParser { diff --git a/src/texturePacks/java/moe/nea/firmament/mixins/custommodels/ReplaceItemModelPatch.java b/src/texturePacks/java/moe/nea/firmament/mixins/custommodels/ReplaceItemModelPatch.java index a71ad92..97abd1f 100644 --- a/src/texturePacks/java/moe/nea/firmament/mixins/custommodels/ReplaceItemModelPatch.java +++ b/src/texturePacks/java/moe/nea/firmament/mixins/custommodels/ReplaceItemModelPatch.java @@ -4,42 +4,40 @@ package moe.nea.firmament.mixins.custommodels; import com.llamalad7.mixinextras.injector.wrapoperation.Operation; import com.llamalad7.mixinextras.injector.wrapoperation.WrapOperation; import moe.nea.firmament.events.CustomItemModelEvent; +import moe.nea.firmament.util.mc.IntrospectableItemModelManager; import net.minecraft.client.item.ItemModelManager; import net.minecraft.client.render.item.model.ItemModel; import net.minecraft.client.render.item.model.MissingItemModel; -import net.minecraft.client.render.model.BakedModelManager; import net.minecraft.component.ComponentType; import net.minecraft.item.ItemStack; import net.minecraft.util.Identifier; +import org.jetbrains.annotations.NotNull; import org.spongepowered.asm.mixin.Final; import org.spongepowered.asm.mixin.Mixin; import org.spongepowered.asm.mixin.Shadow; -import org.spongepowered.asm.mixin.Unique; import org.spongepowered.asm.mixin.injection.At; -import org.spongepowered.asm.mixin.injection.Inject; -import org.spongepowered.asm.mixin.injection.callback.CallbackInfo; import java.util.function.Function; @Mixin(ItemModelManager.class) -public class ReplaceItemModelPatch { +public class ReplaceItemModelPatch implements IntrospectableItemModelManager { @Shadow @Final private Function<Identifier, ItemModel> modelGetter; - @Unique - private boolean hasModel(Identifier identifier) { - return !(modelGetter.apply(identifier) instanceof MissingItemModel); - } - @WrapOperation( method = "update(Lnet/minecraft/client/render/item/ItemRenderState;Lnet/minecraft/item/ItemStack;Lnet/minecraft/item/ModelTransformationMode;Lnet/minecraft/world/World;Lnet/minecraft/entity/LivingEntity;I)V", at = @At(value = "INVOKE", target = "Lnet/minecraft/item/ItemStack;get(Lnet/minecraft/component/ComponentType;)Ljava/lang/Object;")) private Object replaceItemModelByIdentifier(ItemStack instance, ComponentType componentType, Operation<Object> original) { - var override = CustomItemModelEvent.getModelIdentifier(instance); - if (override != null && hasModel(override)) { + var override = CustomItemModelEvent.getModelIdentifier(instance, this); + if (override != null && hasModel_firmament(override)) { return override; } return original.call(instance, componentType); } + + @Override + public boolean hasModel_firmament(@NotNull Identifier identifier) { + return !(modelGetter.apply(identifier) instanceof MissingItemModel); + } } diff --git a/src/texturePacks/java/moe/nea/firmament/mixins/custommodels/SupplyFakeModelPatch.java b/src/texturePacks/java/moe/nea/firmament/mixins/custommodels/SupplyFakeModelPatch.java index 3b5fbd0..b22920c 100644 --- a/src/texturePacks/java/moe/nea/firmament/mixins/custommodels/SupplyFakeModelPatch.java +++ b/src/texturePacks/java/moe/nea/firmament/mixins/custommodels/SupplyFakeModelPatch.java @@ -48,9 +48,8 @@ public class SupplyFakeModelPatch { Map<Identifier, ItemAsset> newModels = new HashMap<>(oldModels.contents()); var resources = resourceManager.findResources( "models/item", - id -> id.getNamespace().equals("firmskyblock") - && id.getPath().endsWith(".json") - && !id.getPath().substring("models/item/".length()).contains("/")); + id -> (id.getNamespace().equals("firmskyblock") || id.getNamespace().equals("cittofirmgenerated")) + && id.getPath().endsWith(".json")); for (Map.Entry<Identifier, Resource> model : resources.entrySet()) { var resource = model.getValue(); var itemModelId = model.getKey().withPath(it -> it.substring("models/item/".length(), it.length() - ".json".length())); |