mirror of
https://github.com/MineLittlePony/MineLittlePony.git
synced 2024-11-25 22:07:59 +01:00
SkullRenderer uses a Redirect now.
This commit is contained in:
parent
1d40648e47
commit
01ea749732
1 changed files with 11 additions and 12 deletions
|
@ -2,9 +2,7 @@ package com.voxelmodpack.hdskins.mixin;
|
|||
|
||||
import org.spongepowered.asm.mixin.Mixin;
|
||||
import org.spongepowered.asm.mixin.injection.At;
|
||||
import org.spongepowered.asm.mixin.injection.At.Shift;
|
||||
import org.spongepowered.asm.mixin.injection.Inject;
|
||||
import org.spongepowered.asm.mixin.injection.callback.CallbackInfo;
|
||||
import org.spongepowered.asm.mixin.injection.Redirect;
|
||||
|
||||
import com.google.common.base.Optional;
|
||||
import com.mojang.authlib.GameProfile;
|
||||
|
@ -20,19 +18,20 @@ import net.minecraft.util.ResourceLocation;
|
|||
@Mixin(TileEntitySkullRenderer.class)
|
||||
public abstract class MixinSkullRenderer extends TileEntitySpecialRenderer<TileEntitySkull> {
|
||||
|
||||
@Inject(method = "renderSkull",
|
||||
at = @At(
|
||||
value = "INVOKE",
|
||||
target = "Lnet/minecraft/client/renderer/tileentity/TileEntitySkullRenderer;bindTexture(Lnet/minecraft/util/ResourceLocation;)V",
|
||||
ordinal = 4,
|
||||
shift = Shift.AFTER) )
|
||||
private void onBindTexture(float x, float y, float z, EnumFacing facing, float rotation, int meta, GameProfile profile, int p_180543_8_,
|
||||
CallbackInfo ci) {
|
||||
@Redirect(method = "renderSkull", at = @At(
|
||||
value = "INVOKE",
|
||||
target = "Lnet/minecraft/client/renderer/tileentity/TileEntitySkullRenderer;bindTexture(Lnet/minecraft/util/ResourceLocation;)V",
|
||||
ordinal = 4))
|
||||
private void onBindTexture(TileEntitySkullRenderer tesr, ResourceLocation rl, float x, float y, float z, EnumFacing facing, float rotation, int meta,
|
||||
GameProfile profile, int p_180543_8_) {
|
||||
if (profile != null) {
|
||||
Optional<ResourceLocation> skin = HDSkinManager.INSTANCE.getSkinLocation(profile, Type.SKIN, true);
|
||||
if (skin.isPresent())
|
||||
// rebind
|
||||
bindTexture(skin.get());
|
||||
}
|
||||
else
|
||||
bindTexture(rl);
|
||||
} else
|
||||
bindTexture(rl);
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue