Skip to content

Commit

Permalink
Disable custom illusioner texture when illusioner is disabled
Browse files Browse the repository at this point in the history
  • Loading branch information
Faboslav committed Jan 19, 2025
1 parent 90ab6e4 commit 007c5f0
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
import net.minecraft.client.render.entity.model.IllagerEntityModel;
import net.minecraft.client.util.math.MatrixStack;
import net.minecraft.entity.mob.IllusionerEntity;
import net.minecraft.util.Identifier;
import org.spongepowered.asm.mixin.Mixin;
import org.spongepowered.asm.mixin.injection.At;
import org.spongepowered.asm.mixin.injection.Inject;
Expand All @@ -20,6 +21,8 @@
@Mixin({IllusionerEntityRenderer.class})
public abstract class IllusionerEntityRendererMixin extends IllagerEntityRenderer<IllusionerEntity>
{
private final Identifier FRIENDSANDFOES_TEXTURE = FriendsAndFoes.makeID("textures/entity/illager/illusioner.png");

protected IllusionerEntityRendererMixin(
EntityRendererFactory.Context ctx,
IllagerEntityModel<IllusionerEntity> model,
Expand Down Expand Up @@ -61,4 +64,18 @@ protected void friendsandfoes_isVisible(
callbackInfo.setReturnValue(super.isVisible(illusioner));
}
}

@Inject(
at = @At("HEAD"),
method = "getTexture(Lnet/minecraft/entity/mob/IllusionerEntity;)Lnet/minecraft/util/Identifier;",
cancellable = true
)
protected void friendsandfoes_getTexture(
IllusionerEntity illusionerEntity,
CallbackInfoReturnable<Identifier> cir
) {
if (FriendsAndFoes.getConfig().enableIllusioner) {
cir.setReturnValue(FRIENDSANDFOES_TEXTURE);
}
}
}

0 comments on commit 007c5f0

Please sign in to comment.