aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorNopoTheGamer <40329022+NopoTheGamer@users.noreply.github.com>2023-01-18 09:30:28 +1100
committerGitHub <noreply@github.com>2023-01-17 23:30:28 +0100
commit1f4d6925020a26d0662c3fe90672f5d4c831682d (patch)
tree68cb2df2d7d7e61adc36a059d3efbf33c0f895a5 /src
parent937e84822e298e3edbee4bb24775eb04f2770c4a (diff)
downloadNotEnoughUpdates-1f4d6925020a26d0662c3fe90672f5d4c831682d.tar.gz
NotEnoughUpdates-1f4d6925020a26d0662c3fe90672f5d4c831682d.tar.bz2
NotEnoughUpdates-1f4d6925020a26d0662c3fe90672f5d4c831682d.zip
Fix npe spam when rendering a player model in a recipe (#557)
Diffstat (limited to 'src')
-rw-r--r--src/main/java/io/github/moulberry/notenoughupdates/mixins/MixinLayerDeadmau5Head.java38
-rw-r--r--src/main/resources/mixins.notenoughupdates.json1
2 files changed, 39 insertions, 0 deletions
diff --git a/src/main/java/io/github/moulberry/notenoughupdates/mixins/MixinLayerDeadmau5Head.java b/src/main/java/io/github/moulberry/notenoughupdates/mixins/MixinLayerDeadmau5Head.java
new file mode 100644
index 00000000..14ae9c74
--- /dev/null
+++ b/src/main/java/io/github/moulberry/notenoughupdates/mixins/MixinLayerDeadmau5Head.java
@@ -0,0 +1,38 @@
+/*
+ * Copyright (C) 2023 NotEnoughUpdates contributors
+ *
+ * This file is part of NotEnoughUpdates.
+ *
+ * NotEnoughUpdates is free software: you can redistribute it
+ * and/or modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation, either
+ * version 3 of the License, or (at your option) any later version.
+ *
+ * NotEnoughUpdates is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with NotEnoughUpdates. If not, see <https://www.gnu.org/licenses/>.
+ */
+
+package io.github.moulberry.notenoughupdates.mixins;
+
+import io.github.moulberry.notenoughupdates.miscfeatures.entityviewer.GUIClientPlayer;
+import net.minecraft.client.entity.AbstractClientPlayer;
+import net.minecraft.client.renderer.entity.layers.LayerDeadmau5Head;
+import org.spongepowered.asm.mixin.Mixin;
+import org.spongepowered.asm.mixin.injection.At;
+import org.spongepowered.asm.mixin.injection.Inject;
+import org.spongepowered.asm.mixin.injection.callback.CallbackInfo;
+
+@Mixin(LayerDeadmau5Head.class)
+public class MixinLayerDeadmau5Head {
+
+ @Inject(method = "doRenderLayer(Lnet/minecraft/client/entity/AbstractClientPlayer;FFFFFFF)V", at = @At("HEAD"), cancellable = true)
+ public void doRenderLayer(
+ AbstractClientPlayer entitylivingbaseIn, float f, float g, float partialTicks, float h, float i, float j, float scale, CallbackInfo ci) {
+ if (entitylivingbaseIn instanceof GUIClientPlayer) ci.cancel();
+ }
+}
diff --git a/src/main/resources/mixins.notenoughupdates.json b/src/main/resources/mixins.notenoughupdates.json
index dbce787c..8877aed8 100644
--- a/src/main/resources/mixins.notenoughupdates.json
+++ b/src/main/resources/mixins.notenoughupdates.json
@@ -56,6 +56,7 @@
"MixinEntityChargedCreeper",
"MixinGuiEditSign",
"MixinGuiTextField",
+ "MixinLayerDeadmau5Head",
"MixinThreadDownloadImageData",
"MixinThreadDownloadImageDataThread"
]