| 1 | package net.minecraft.client.renderer.entity.layers;
|
| 2 |
|
| 3 | import net.minecraft.client.model.ModelSheep1;
|
| 4 | import net.minecraft.client.renderer.GlStateManager;
|
| 5 | import net.minecraft.client.renderer.entity.RenderSheep;
|
| 6 | import net.minecraft.entity.passive.EntitySheep;
|
| 7 | import net.minecraft.item.EnumDyeColor;
|
| 8 | import net.minecraft.util.ResourceLocation;
|
| 9 |
|
| 10 | public class LayerSheepWool implements LayerRenderer<EntitySheep>
|
| 11 | {
|
| 12 | private static final ResourceLocation TEXTURE = new ResourceLocation("textures/entity/sheep/sheep_fur.png");
|
| 13 | private final RenderSheep sheepRenderer;
|
| 14 | private final ModelSheep1 sheepModel = new ModelSheep1();
|
| 15 |
|
| 16 | public LayerSheepWool(RenderSheep sheepRendererIn)
|
| 17 | {
|
| 18 | this.sheepRenderer = sheepRendererIn;
|
| 19 | }
|
| 20 |
|
| 21 | public void doRenderLayer(EntitySheep entitylivingbaseIn, float p_177141_2_, float p_177141_3_, float partialTicks, float p_177141_5_, float p_177141_6_, float p_177141_7_, float scale)
|
| 22 | {
|
| 23 | if (!entitylivingbaseIn.getSheared() && !entitylivingbaseIn.isInvisible())
|
| 24 | {
|
| 25 | this.sheepRenderer.bindTexture(TEXTURE);
|
| 26 |
|
| 27 | if (entitylivingbaseIn.hasCustomName() && "jeb_".equals(entitylivingbaseIn.getCustomNameTag()))
|
| 28 | {
|
| 29 | int i1 = 25;
|
| 30 | int i = entitylivingbaseIn.ticksExisted / 25 + entitylivingbaseIn.getEntityId();
|
| 31 | int j = EnumDyeColor.values().length;
|
| 32 | int k = i % j;
|
| 33 | int l = (i + 1) % j;
|
| 34 | float f = ((float)(entitylivingbaseIn.ticksExisted % 25) + partialTicks) / 25.0F;
|
| 35 | float[] afloat1 = EntitySheep.getDyeRgb(EnumDyeColor.byMetadata(k));
|
| 36 | float[] afloat2 = EntitySheep.getDyeRgb(EnumDyeColor.byMetadata(l));
|
| 37 | GlStateManager.color(afloat1[0] * (1.0F - f) + afloat2[0] * f, afloat1[1] * (1.0F - f) + afloat2[1] * f, afloat1[2] * (1.0F - f) + afloat2[2] * f);
|
| 38 | }
|
| 39 | else
|
| 40 | {
|
| 41 | float[] afloat = EntitySheep.getDyeRgb(entitylivingbaseIn.getFleeceColor());
|
| 42 | GlStateManager.color(afloat[0], afloat[1], afloat[2]);
|
| 43 | }
|
| 44 |
|
| 45 | this.sheepModel.setModelAttributes(this.sheepRenderer.getMainModel());
|
| 46 | this.sheepModel.setLivingAnimations(entitylivingbaseIn, p_177141_2_, p_177141_3_, partialTicks);
|
| 47 | this.sheepModel.render(entitylivingbaseIn, p_177141_2_, p_177141_3_, p_177141_5_, p_177141_6_, p_177141_7_, scale);
|
| 48 | }
|
| 49 | }
|
| 50 |
|
| 51 | public boolean shouldCombineTextures()
|
| 52 | {
|
| 53 | return true;
|
| 54 | }
|
| 55 | }
|
| 56 |
|