aboutsummaryrefslogtreecommitdiff
path: root/src/main/java/moe/nea/firmament/mixins/custommodels/GlobalModelOverridePatch.java
diff options
context:
space:
mode:
authorLinnea Gräf <nea@nea.moe>2024-05-11 03:28:05 +0200
committerLinnea Gräf <nea@nea.moe>2024-05-14 18:45:59 +0200
commit7682534f6fd139b75f24c79b76098fe05f0fa0fe (patch)
tree34d94c8fd7b531da128ff0130bf463393e2560e0 /src/main/java/moe/nea/firmament/mixins/custommodels/GlobalModelOverridePatch.java
parent53dc0c3b0a758ce2afff2637a5a5f22aa1733c56 (diff)
downloadFirmament-7682534f6fd139b75f24c79b76098fe05f0fa0fe.tar.gz
Firmament-7682534f6fd139b75f24c79b76098fe05f0fa0fe.tar.bz2
Firmament-7682534f6fd139b75f24c79b76098fe05f0fa0fe.zip
Add custom global textures
Diffstat (limited to 'src/main/java/moe/nea/firmament/mixins/custommodels/GlobalModelOverridePatch.java')
-rw-r--r--src/main/java/moe/nea/firmament/mixins/custommodels/GlobalModelOverridePatch.java34
1 files changed, 34 insertions, 0 deletions
diff --git a/src/main/java/moe/nea/firmament/mixins/custommodels/GlobalModelOverridePatch.java b/src/main/java/moe/nea/firmament/mixins/custommodels/GlobalModelOverridePatch.java
new file mode 100644
index 0000000..ec1d09c
--- /dev/null
+++ b/src/main/java/moe/nea/firmament/mixins/custommodels/GlobalModelOverridePatch.java
@@ -0,0 +1,34 @@
+/*
+ * SPDX-FileCopyrightText: 2024 Linnea Gräf <nea@nea.moe>
+ *
+ * SPDX-License-Identifier: GPL-3.0-or-later
+ */
+
+package moe.nea.firmament.mixins.custommodels;
+
+import moe.nea.firmament.features.texturepack.CustomGlobalTextures;
+import net.minecraft.client.render.item.ItemModels;
+import net.minecraft.client.render.item.ItemRenderer;
+import net.minecraft.client.render.model.BakedModel;
+import net.minecraft.entity.LivingEntity;
+import net.minecraft.item.ItemStack;
+import net.minecraft.world.World;
+import org.spongepowered.asm.mixin.Mixin;
+import org.spongepowered.asm.mixin.Shadow;
+import org.spongepowered.asm.mixin.injection.At;
+import org.spongepowered.asm.mixin.injection.Inject;
+import org.spongepowered.asm.mixin.injection.callback.CallbackInfoReturnable;
+
+@Mixin(ItemRenderer.class)
+public abstract class GlobalModelOverridePatch {
+
+ @Shadow
+ public abstract ItemModels getModels();
+
+ @Inject(method = "getModel", at = @At("HEAD"), cancellable = true)
+ private void overrideGlobalModel(
+ ItemStack stack, World world, LivingEntity entity,
+ int seed, CallbackInfoReturnable<BakedModel> cir) {
+ CustomGlobalTextures.replaceGlobalModel(this.getModels(), stack, cir);
+ }
+}