Skip to content

Commit

Permalink
Fix mixin method srg name
Browse files Browse the repository at this point in the history
  • Loading branch information
HowardZHY committed Dec 19, 2023
1 parent a9abbd5 commit eb82a97
Showing 1 changed file with 27 additions and 8 deletions.
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
package mist475.mcpatcherforge.mixins.optifine;

import com.llamalad7.mixinextras.injector.WrapWithCondition;
import com.prupe.mcpatcher.cit.CITUtils;
import net.minecraft.entity.EntityLivingBase;
import net.minecraft.item.ItemStack;
Expand All @@ -15,22 +14,42 @@
@Mixin(targets = {"ItemRendererOF", "net.minecraft.src.ItemRendererOF", "net.optifine.ItemRendererOF"})
public class MixinItemRendererOF {

@Redirect(
method = "func_78443_a(Lnet/minecraft/entity/EntityLivingBase;Lnet/minecraft/item/ItemStack;I)V",
at = @At(
value = "INVOKE",
target = "Lnet/minecraft/entity/EntityLivingBase;func_70620_b(Lnet/minecraft/item/ItemStack;I)Lnet/minecraft/util/IIcon;"
)
)
private IIcon modifyRenderItem(EntityLivingBase elb, ItemStack item, int renderPass, EntityLivingBase entity, ItemStack item2, int renderPass1) {
return CITUtils.getIcon(entity.getItemIcon(item2, renderPass1), item2, renderPass1);
}

@Redirect(
method = "renderItem(Lnet/minecraft/entity/EntityLivingBase;Lnet/minecraft/item/ItemStack;I)V",
at = @At(
value = "INVOKE",
target = "Lnet/minecraft/entity/EntityLivingBase;getItemIcon(Lnet/minecraft/item/ItemStack;I)Lnet/minecraft/util/IIcon;"
),
remap = false)
private IIcon modifyRenderItem(EntityLivingBase instance, ItemStack item, int renderPass, EntityLivingBase entity, ItemStack item2, int renderPass1) {
target = "Lnet/minecraft/entity/EntityLivingBase;getItemIcon(Lnet/minecraft/item/ItemStack;I)Lnet/minecraft/util/IIcon;" //func_70620_b
)
)
private IIcon modifyRenderItemDev(EntityLivingBase elb, ItemStack item, int renderPass, EntityLivingBase entity, ItemStack item2, int renderPass1) {
return CITUtils.getIcon(entity.getItemIcon(item2, renderPass1), item2, renderPass1);
}

@Redirect(
method = "renderItem(Lnet/minecraft/entity/EntityLivingBase;Lnet/minecraft/item/ItemStack;ILnet/minecraftforge/client/IItemRenderer$ItemRenderType;)V",
at = @At(value = "INVOKE", target = "Lnet/minecraft/item/ItemStack;hasEffect()Z"),
remap = false)
method = "func_78443_a(Lnet/minecraft/entity/EntityLivingBase;Lnet/minecraft/item/ItemStack;I)V",
at = @At(value = "INVOKE", target = "Lnet/minecraft/item/ItemStack;func_77962_s()Z")
)
private boolean modifyRenderItemGlint(ItemStack item, EntityLivingBase entity, ItemStack itemStack, int renderPass) {
return !CITUtils.renderEnchantmentHeld(item, renderPass) && item.hasEffect(renderPass);
}

@Redirect(
method = "renderItem(Lnet/minecraft/entity/EntityLivingBase;Lnet/minecraft/item/ItemStack;I)V",
at = @At(value = "INVOKE", target = "Lnet/minecraft/item/ItemStack;hasEffect()Z") //func_77962_s
)
private boolean modifyRenderItemGlintDev(ItemStack item, EntityLivingBase entity, ItemStack itemStack, int renderPass) {
return !CITUtils.renderEnchantmentHeld(item, renderPass) && item.hasEffect(renderPass);
}

}

0 comments on commit eb82a97

Please sign in to comment.