aboutsummaryrefslogtreecommitdiff
path: root/src/main/java/moe/nea/firmament/mixins/CustomModelEventPatch.java
diff options
context:
space:
mode:
Diffstat (limited to 'src/main/java/moe/nea/firmament/mixins/CustomModelEventPatch.java')
-rw-r--r--src/main/java/moe/nea/firmament/mixins/CustomModelEventPatch.java11
1 files changed, 9 insertions, 2 deletions
diff --git a/src/main/java/moe/nea/firmament/mixins/CustomModelEventPatch.java b/src/main/java/moe/nea/firmament/mixins/CustomModelEventPatch.java
index e7207f4..e0a7544 100644
--- a/src/main/java/moe/nea/firmament/mixins/CustomModelEventPatch.java
+++ b/src/main/java/moe/nea/firmament/mixins/CustomModelEventPatch.java
@@ -3,9 +3,11 @@
package moe.nea.firmament.mixins;
import moe.nea.firmament.events.CustomItemModelEvent;
+import moe.nea.firmament.features.texturepack.CustomGlobalTextures;
import net.minecraft.client.render.item.ItemModels;
import net.minecraft.client.render.model.BakedModel;
import net.minecraft.client.render.model.BakedModelManager;
+import net.minecraft.item.Item;
import net.minecraft.item.ItemStack;
import net.minecraft.util.Identifier;
import org.spongepowered.asm.mixin.Final;
@@ -22,8 +24,13 @@ public class CustomModelEventPatch {
@Inject(method = "getModel(Lnet/minecraft/item/ItemStack;)Lnet/minecraft/client/render/model/BakedModel;", at = @At("HEAD"), cancellable = true)
public void onGetModel(ItemStack stack, CallbackInfoReturnable<BakedModel> cir) {
- var model = CustomItemModelEvent.getModel(stack, (ItemModels) (Object) this);
- if (model != null)
+ var $this = (ItemModels) (Object) this;
+ var model = CustomItemModelEvent.getModel(stack, $this);
+ if (model == null) {
+ model = CustomGlobalTextures.replaceGlobalModel($this, stack);
+ }
+ if (model != null) {
cir.setReturnValue(model);
+ }
}
}