|
| 1 | +package roadhog360.simpleskinbackport.mixins.late.botania; |
| 2 | + |
| 3 | +import net.minecraft.client.model.ModelSkeletonHead; |
| 4 | +import net.minecraft.client.renderer.tileentity.TileEntitySkullRenderer; |
| 5 | +import net.minecraft.entity.Entity; |
| 6 | +import net.minecraft.util.ResourceLocation; |
| 7 | +import org.spongepowered.asm.mixin.Mixin; |
| 8 | +import org.spongepowered.asm.mixin.injection.At; |
| 9 | +import org.spongepowered.asm.mixin.injection.Redirect; |
| 10 | +import roadhog360.simpleskinbackport.core.DefaultPlayerSkin; |
| 11 | +import vazkii.botania.client.model.ModelSkullOverride; |
| 12 | +import vazkii.botania.client.render.tile.RenderTileSkullOverride; |
| 13 | + |
| 14 | +@Mixin(RenderTileSkullOverride.class) |
| 15 | +public class MixinRenderTileSkullOverride extends TileEntitySkullRenderer { |
| 16 | + |
| 17 | + private ModelSkeletonHead skull = new ModelSkeletonHead(0, 0, 64, 64); |
| 18 | + //The new one isn't needed |
| 19 | + |
| 20 | + /** |
| 21 | + * 64x64 model needs new Steve textures |
| 22 | + */ |
| 23 | + @Redirect(method = "render", at = @At(value = "FIELD", target = "Lnet/minecraft/client/entity/AbstractClientPlayer;locationStevePng:Lnet/minecraft/util/ResourceLocation;")) |
| 24 | + private ResourceLocation fixDefaultTexture() { |
| 25 | + return DefaultPlayerSkin.STEVE.getResource(); |
| 26 | + } |
| 27 | + |
| 28 | + /** |
| 29 | + * Botania's model override isn't necessary; it's easier to provide the vanilla one to set the 64x64 textures. |
| 30 | + * We need the 64x64 texture head since Gaia Guardians copy the player's texture, which uses 64x64 textures. |
| 31 | + */ |
| 32 | + @Redirect(method = "render", at = @At(value = "INVOKE", target = "Lvazkii/botania/client/model/ModelSkullOverride;render(Lnet/minecraft/entity/Entity;FFFFFF)V")) |
| 33 | + private void changeModel(ModelSkullOverride instance, Entity par1Entity, float par2, float par3, float par4, float par5, float par6, float par7) { |
| 34 | + skull.render(par1Entity, par2, par3, par4, par5, par6, par7); |
| 35 | + } |
| 36 | +} |
0 commit comments