diff options
author | My-Name-Is-Jeff <37018278+My-Name-Is-Jeff@users.noreply.github.com> | 2021-05-16 22:35:20 -0400 |
---|---|---|
committer | My-Name-Is-Jeff <37018278+My-Name-Is-Jeff@users.noreply.github.com> | 2021-05-16 22:35:20 -0400 |
commit | 851306a7795b2b7e22bc937e618709f45cc1246d (patch) | |
tree | 3ef39af66404a0081d8e254d821115a582b2d6b6 | |
parent | 46516176501ec74df4700e9e6bf6df4d907fe5b9 (diff) | |
download | SkytilsMod-851306a7795b2b7e22bc937e618709f45cc1246d.tar.gz SkytilsMod-851306a7795b2b7e22bc937e618709f45cc1246d.tar.bz2 SkytilsMod-851306a7795b2b7e22bc937e618709f45cc1246d.zip |
Apply glint to skulls in inventories
3 files changed, 42 insertions, 4 deletions
diff --git a/src/main/java/skytils/skytilsmod/mixins/MixinTileEntityItemStackRenderer.java b/src/main/java/skytils/skytilsmod/mixins/MixinTileEntityItemStackRenderer.java new file mode 100644 index 00000000..2e6673d5 --- /dev/null +++ b/src/main/java/skytils/skytilsmod/mixins/MixinTileEntityItemStackRenderer.java @@ -0,0 +1,41 @@ +/* + * Skytils - Hypixel Skyblock Quality of Life Mod + * Copyright (C) 2021 Skytils + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU Affero General Public License as published + * by the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program 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 Affero General Public License for more details. + * + * You should have received a copy of the GNU Affero General Public License + * along with this program. If not, see <https://www.gnu.org/licenses/>. + */ + +package skytils.skytilsmod.mixins; + +import net.minecraft.client.renderer.tileentity.TileEntityItemStackRenderer; +import net.minecraft.item.ItemStack; +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; +import skytils.skytilsmod.Skytils; +import skytils.skytilsmod.utils.Utils; + +import static skytils.skytilsmod.Skytils.mc; + +@Mixin(TileEntityItemStackRenderer.class) +public abstract class MixinTileEntityItemStackRenderer { + @Inject(method = "renderByItem", at = @At(value = "INVOKE", target = "Lnet/minecraft/client/renderer/tileentity/TileEntitySkullRenderer;renderSkull(FFFLnet/minecraft/util/EnumFacing;FILcom/mojang/authlib/GameProfile;I)V")) + private void fixGlintForSkulls(ItemStack itemStack, CallbackInfo ci) { + if (Utils.inSkyblock && Skytils.config.enchantGlintFix && itemStack.hasEffect()) { + Utils.lastRenderedSkullStack = itemStack; + Utils.lastRenderedSkullEntity = mc.thePlayer; + } + } +} diff --git a/src/main/java/skytils/skytilsmod/mixins/MixinTileEntitySkullRenderer.java b/src/main/java/skytils/skytilsmod/mixins/MixinTileEntitySkullRenderer.java index 87e32ad7..644026bf 100644 --- a/src/main/java/skytils/skytilsmod/mixins/MixinTileEntitySkullRenderer.java +++ b/src/main/java/skytils/skytilsmod/mixins/MixinTileEntitySkullRenderer.java @@ -58,14 +58,10 @@ public abstract class MixinTileEntitySkullRenderer extends TileEntitySpecialRend if (Utils.lastRenderedSkullStack != null && Utils.lastRenderedSkullEntity != null) { ModelBase model = type == 2 || type == 3 ? this.humanoidHead : this.skeletonHead; String itemId = ItemUtil.getSkyBlockItemID(Utils.lastRenderedSkullStack); - GlStateManager.pushMatrix(); - GlStateManager.pushAttrib(); if (GlintCustomizer.glintColors.containsKey(itemId)) { CustomColor color = GlintCustomizer.glintColors.get(itemId); renderGlint(Utils.lastRenderedSkullEntity, model, rotation, color); } else renderGlint(Utils.lastRenderedSkullEntity, model, rotation,null); - GlStateManager.popAttrib(); - GlStateManager.popMatrix(); Utils.lastRenderedSkullStack = null; Utils.lastRenderedSkullEntity = null; } diff --git a/src/main/resources/mixins.skytils.json b/src/main/resources/mixins.skytils.json index b020c4e1..94f99c4e 100644 --- a/src/main/resources/mixins.skytils.json +++ b/src/main/resources/mixins.skytils.json @@ -43,6 +43,7 @@ "MixinSoundManager", "MixinSplashProgress", "MixinTileEntityChestRenderer", + "MixinTileEntityItemStackRenderer", "MixinTileEntitySkullRenderer", "MixinUtil", "MixinWorld" |