Skip to content

Instantly share code, notes, and snippets.

@JayZX535
Last active October 8, 2017 06:15
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save JayZX535/dc4d3a545174c4987b4e86393b97c082 to your computer and use it in GitHub Desktop.
Save JayZX535/dc4d3a545174c4987b4e86393b97c082 to your computer and use it in GitHub Desktop.
package com.wildcraft.wildcraft.render.entity.wolf;
import com.wildcraft.wildcraft.entity.canine.EntityWildCraftWolf;
import com.wildcraft.wildcraft.model.entity.ModelWildCraftWolf;
import net.minecraft.client.renderer.GlStateManager;
import net.minecraft.client.renderer.entity.Render;
import net.minecraft.client.renderer.entity.RenderLiving;
import net.minecraft.client.renderer.entity.RenderManager;
import net.minecraft.client.renderer.entity.layers.LayerWolfCollar;
import net.minecraft.util.ResourceLocation;
import net.minecraftforge.fml.client.registry.IRenderFactory;
import net.minecraftforge.fml.relauncher.Side;
import net.minecraftforge.fml.relauncher.SideOnly;
@SideOnly(Side.CLIENT)
public class RenderWildCraftWolf extends RenderLiving<EntityWildCraftWolf>
{
public static final Factory FACTORY = new Factory();
private static final ResourceLocation WOLF_BLACK = new ResourceLocation("wildcraft:textures/entity/wolf/blackbase.png");
private static final ResourceLocation WOLF_WHITE = new ResourceLocation("wildcraft:textures/entity/wolf/white.png");
private static final ResourceLocation WOLF_LIVER1 = new ResourceLocation("wildcraft:textures/entity/wolf/liverbase1.png");
private static final ResourceLocation WOLF_BLUE1 = new ResourceLocation("wildcraft:textures/entity/wolf/bluebase1.png");
private static final ResourceLocation WOLF_ISABELLA1 = new ResourceLocation("wildcraft:textures/entity/wolf/isabellabase1.png");
public RenderWildCraftWolf(RenderManager p_i47187_1_)
{
super(p_i47187_1_, new ModelWildCraftWolf(), 0.5F);
this.addLayer(new RenderWCWolfS(this));
this.addLayer(new RenderWCWolfCollar(this));
}
/**
* Defines what float the third param in setRotationAngles of ModelBase is
*/
protected float handleRotationFloat(EntityWildCraftWolf livingBase, float partialTicks)
{
return livingBase.getTailRotation();
}
/**
* Renders the desired {@code T} type Entity.
*/
public void doRender(EntityWildCraftWolf entity, double x, double y, double z, float entityYaw, float partialTicks)
{
if (entity.isWolfWet())
{
float f = entity.getBrightness(partialTicks) * entity.getShadingWhileWet(partialTicks);
GlStateManager.color(f, f, f);
}
super.doRender(entity, x, y, z, entityYaw, partialTicks);
}
/**
* Returns the location of an entity's texture. Doesn't seem to be called unless you call Render.bindEntityTexture.
*/
protected ResourceLocation getEntityTexture(EntityWildCraftWolf entity)
{
if (entity.getGenetics() != null)
{
if (entity.getGenetics().substring(20, 22).equals("00"))
{
return WOLF_WHITE;
}
else
{
if (entity.getGenetics().substring(2, 4).equals("00"))
{
if (entity.getGenetics().substring(4, 6).equals("00"))
{
return WOLF_ISABELLA1;
}
else
{
return WOLF_LIVER1;
}
}
else
{
if (entity.getGenetics().substring(4, 6).equals("00"))
{
return WOLF_BLUE1;
}
else
{
return WOLF_BLACK;
}
}
}
}
else
{
return WOLF_BLACK;
}
}
public static class Factory<T extends EntityWildCraftWolf>
implements IRenderFactory<T>
{
public Render<? super T> createRenderFor(RenderManager manager)
{
return new RenderWildCraftWolf(manager);
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment