Skip to content

Commit

Permalink
refactor: Replace RenderLivingEntityTransformer with a Mixin
Browse files Browse the repository at this point in the history
  • Loading branch information
My-Name-Is-Jeff committed Feb 11, 2025
1 parent 88e2a2e commit 4afb44d
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 74 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,8 @@

import com.llamalad7.mixinextras.injector.wrapoperation.Operation;
import com.llamalad7.mixinextras.injector.wrapoperation.WrapOperation;
import com.llamalad7.mixinextras.sugar.Local;
import com.llamalad7.mixinextras.sugar.ref.LocalRef;
import gg.skytils.skytilsmod.mixins.hooks.renderer.RendererLivingEntityHookKt;
import net.minecraft.client.renderer.entity.Render;
import net.minecraft.client.renderer.entity.RenderManager;
Expand All @@ -29,6 +31,7 @@
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.ModifyVariable;
import org.spongepowered.asm.mixin.injection.callback.CallbackInfoReturnable;

@Mixin(RendererLivingEntity.class)
Expand All @@ -37,6 +40,11 @@ protected MixinRendererLivingEntity(RenderManager renderManager) {
super(renderManager);
}

@ModifyVariable(method = "renderName*", at = @At(value = "STORE", ordinal = 0))
private String replaceEntityName(String name, @Local(argsOnly = true) T entity) {
return RendererLivingEntityHookKt.replaceEntityName(entity, name);
}

@Inject(method = "getColorMultiplier", at = @At("HEAD"), cancellable = true)
private void setColorMultiplier(T entity, float lightBrightness, float partialTickTime, CallbackInfoReturnable<Integer> cir) {
RendererLivingEntityHookKt.setColorMultiplier(entity, lightBrightness, partialTickTime, cir);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,6 @@ class SkytilsTransformer : BaseClassTransformer() {
try {
addColoredNamesCheck()
injectSplashProgressTransformer()
changeRenderedName()
injectNullCheck()
commitArson()
injectScoreboardScoreRemover()
Expand Down

This file was deleted.

0 comments on commit 4afb44d

Please sign in to comment.