Skip to content

Instantly share code, notes, and snippets.

@triphion
Created October 1, 2017 11:35
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 triphion/d155c181a0864e1d38e64a9bcd554f2a to your computer and use it in GitHub Desktop.
Save triphion/d155c181a0864e1d38e64a9bcd554f2a to your computer and use it in GitHub Desktop.
package com.triphion.ancient.client.model;
import net.minecraft.client.model.ModelBase;
import net.minecraft.client.model.ModelRenderer;
import net.minecraft.entity.Entity;
import org.lwjgl.opengl.GL11;
/**
* ModelTheFrost - Undefined
* Created using Tabula 4.1.1
*/
public class ModelTheFrost extends ModelBase {
public ModelRenderer body;
public ModelRenderer nose;
public ModelTheFrost() {
this.textureWidth = 64;
this.textureHeight = 32;
this.body = new ModelRenderer(this, 0, 0);
this.body.setRotationPoint(-8.0F, -3.1F, -8.0F);
this.body.addBox(0.0F, 0.0F, 0.0F, 1, 1, 1, 0.0F);
this.nose = new ModelRenderer(this, 0, 0);
this.nose.setRotationPoint(-2.2F, 2.0F, -9.4F);
this.nose.addBox(0.0F, 0.0F, 0.0F, 1, 1, 1, 0.0F);
}
@Override
public void render(Entity entity, float f, float f1, float f2, float f3, float f4, float f5) {
GL11.glPushMatrix();
GL11.glTranslatef(this.body.offsetX, this.body.offsetY, this.body.offsetZ);
GL11.glTranslatef(this.body.rotationPointX * f5, this.body.rotationPointY * f5, this.body.rotationPointZ * f5);
GL11.glScaled(16.0D, 27.1D, 16.0D);
GL11.glTranslatef(-this.body.offsetX, -this.body.offsetY, -this.body.offsetZ);
GL11.glTranslatef(-this.body.rotationPointX * f5, -this.body.rotationPointY * f5, -this.body.rotationPointZ * f5);
this.body.render(f5);
GL11.glPopMatrix();
GL11.glPushMatrix();
GL11.glTranslatef(this.nose.offsetX, this.nose.offsetY, this.nose.offsetZ);
GL11.glTranslatef(this.nose.rotationPointX * f5, this.nose.rotationPointY * f5, this.nose.rotationPointZ * f5);
GL11.glScaled(5.0D, 2.3D, 1.5D);
GL11.glTranslatef(-this.nose.offsetX, -this.nose.offsetY, -this.nose.offsetZ);
GL11.glTranslatef(-this.nose.rotationPointX * f5, -this.nose.rotationPointY * f5, -this.nose.rotationPointZ * f5);
this.nose.render(f5);
GL11.glPopMatrix();
}
/**
* This is a helper function from Tabula to set the rotation of model parts
*/
public void setRotateAngle(ModelRenderer modelRenderer, float x, float y, float z) {
modelRenderer.rotateAngleX = x;
modelRenderer.rotateAngleY = y;
modelRenderer.rotateAngleZ = z;
}
}
package com.triphion.ancient.client.entity;
import com.triphion.ancient.Reference;
import com.triphion.ancient.client.model.ModelTheFrost;
import com.triphion.ancient.entity.EntityTheFrost;
import net.minecraft.client.model.ModelBase;
import net.minecraft.client.renderer.entity.RenderLiving;
import net.minecraft.client.renderer.entity.RenderManager;
import net.minecraft.entity.Entity;
import net.minecraft.util.ResourceLocation;
import net.minecraftforge.fml.relauncher.Side;
import net.minecraftforge.fml.relauncher.SideOnly;
@SideOnly(Side.CLIENT)
public class RenderTheFrost extends RenderLiving<EntityTheFrost>
{
private static final ResourceLocation THE_FROSS = new ResourceLocation(Reference.MODID +":textures/entity/thefross/thefross1.png");
public RenderTheFrost(RenderManager rendermanagerIn) {
super(rendermanagerIn, new ModelTheFrost(), 0.5F);
}
/**
* Returns the location of an entity's texture. Doesn't seem to be called unless you call Render.bindEntityTexture.
*/
@Override
protected ResourceLocation getEntityTexture(EntityTheFrost entity) {
return THE_FROSS;
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment