Skip to content
This repository has been archived by the owner on Mar 10, 2021. It is now read-only.

Commit

Permalink
Aww yis. Proper endermen heads!
Browse files Browse the repository at this point in the history
  • Loading branch information
bonii-xx committed Aug 1, 2014
1 parent ee6448b commit 9850d33
Show file tree
Hide file tree
Showing 4 changed files with 96 additions and 2 deletions.
Expand Up @@ -39,6 +39,9 @@
// todo: Unknown blocks get incorrect mining level. (just check if they're higher than the places where i added additional harvest levels and add the proper ammount to match up with the old mining level)
// todo: add hardcoded ExtraTic mining levels

// todo: add batman-hat (enderman-head without jaw and eyes)
// todo: add enderman-jaw helmet as a very rare enderman drop :D

@Mod(modid= Reference.MOD_ID, name= Reference.MOD_NAME, version="${version}",
dependencies = "required-after:" + Reference.TCON_MOD_ID + ";after:*")
public class IguanaTweaksTConstruct {
Expand Down
Expand Up @@ -3,6 +3,7 @@
import com.mojang.authlib.minecraft.MinecraftProfileTexture;
import net.minecraft.client.Minecraft;
import net.minecraft.client.entity.AbstractClientPlayer;
import net.minecraft.client.model.ModelBase;
import net.minecraft.client.model.ModelSkeletonHead;
import net.minecraft.client.renderer.tileentity.TileEntityRendererDispatcher;
import net.minecraft.client.renderer.tileentity.TileEntitySkullRenderer;
Expand All @@ -22,12 +23,20 @@ public class IguanaTileEntitySkullRenderer extends TileEntitySpecialRenderer {
private ModelSkeletonHead modelSkull = new ModelSkeletonHead(0,0,64,32); // standard skull model
private ModelSkeletonHead modelZombie = new ModelSkeletonHead(0,0,64,64); // zombie skull model

private ModelHeadwear modelEnderManJaw = new ModelHeadwear(0,16,64,32);

private ModelEnderManHead modelEnderManHead = new ModelEnderManHead();

private ResourceLocation[] textures = new ResourceLocation[] {
new ResourceLocation("textures/entity/enderman/enderman.png"),
new ResourceLocation("textures/entity/zombie_pigman.png"),
new ResourceLocation("textures/entity/blaze.png")
new ResourceLocation("textures/entity/blaze.png"),
// modsupport: Thermal Expansion
new ResourceLocation("thermalfoundation","textures/entity/Blizz.png")
};

private ResourceLocation enderManEyes = new ResourceLocation("textures/entity/enderman/enderman_eyes.png");

public IguanaTileEntitySkullRenderer()
{
this.func_147497_a(TileEntityRendererDispatcher.instance);
Expand All @@ -47,15 +56,22 @@ public void renderTileEntityAt(TileEntity entity, double x, double y, double z,

public void renderSkull(float x, float y, float z, float r, int sidePlacement, int meta)
{
ModelSkeletonHead model = modelSkull;
ModelBase model = modelSkull;

// chose model
if(meta == 0)
model = modelEnderManHead;
if(meta == 1)
model = modelZombie;

// chose texture
this.bindTexture(textures[meta]);


// debug
//model = new ModelSkeletonHead(0,16,64,32);
//this.bindTexture(new ResourceLocation("textures/entity/enderman/enderman_eyes.png"));

// begin rendering
GL11.glPushMatrix();
GL11.glDisable(GL11.GL_CULL_FACE);
Expand Down Expand Up @@ -95,6 +111,14 @@ public void renderSkull(float x, float y, float z, float r, int sidePlacement, i

model.render(null, 0.0f, 0.0f, 0.0f, r, 0.0f, f4);

// also render endermanstuff!
if(meta == 0)
{
//modelEnderManJaw.render(null, 0.0f, 0.0f, 0.0f, r, 0.0f, f4);
this.bindTexture(enderManEyes);
model.render(null, 0.0f, 0.0f, 0.0f, r, 0.0f, f4);
}

GL11.glPopMatrix();
}
}
@@ -0,0 +1,49 @@
package iguanaman.iguanatweakstconstruct.mobheads.renderers;

import net.minecraft.client.model.ModelBase;
import net.minecraft.client.model.ModelRenderer;
import net.minecraft.client.model.ModelSkeletonHead;
import net.minecraft.entity.Entity;

public class ModelEnderManHead extends ModelBase {

public ModelRenderer endermanHead;
public ModelRenderer endermanJaw;

public ModelEnderManHead()
{
this.textureWidth = 64;
this.textureHeight = 32;
this.endermanHead = new ModelRenderer(this, 0, 0);
this.endermanHead.addBox(-4.0F, -10.0F, -4.0F, 8, 8, 8, 0.0F);
this.endermanHead.setRotationPoint(0.0F, 0.0F, 0.0F);
this.endermanJaw = new ModelRenderer(this, 0, 16);
this.endermanJaw.addBox(-4.0F, -8.0F, -4.0F, 8, 8, 8, 0.3F);
this.endermanJaw.setRotationPoint(0.0F, 0.0F, 0.0F);
}

/**
* Sets the models various rotation angles then renders the model.
*/
public void render(Entity p_78088_1_, float p_78088_2_, float p_78088_3_, float p_78088_4_, float p_78088_5_, float p_78088_6_, float p_78088_7_)
{
this.setRotationAngles(p_78088_2_, p_78088_3_, p_78088_4_, p_78088_5_, p_78088_6_, p_78088_7_, p_78088_1_);
this.endermanHead.render(p_78088_7_);
this.endermanJaw.render(p_78088_7_);
}

/**
* Sets the model's various rotation angles. For bipeds, par1 and par2 are used for animating the movement of arms
* and legs, where par1 represents the time(so that arms and legs swing back and forth) and par2 represents how
* "far" arms and legs can swing at most.
*/
public void setRotationAngles(float p_78087_1_, float p_78087_2_, float p_78087_3_, float p_78087_4_, float p_78087_5_, float p_78087_6_, Entity p_78087_7_)
{
super.setRotationAngles(p_78087_1_, p_78087_2_, p_78087_3_, p_78087_4_, p_78087_5_, p_78087_6_, p_78087_7_);
this.endermanHead.rotateAngleY = p_78087_4_ / (180F / (float)Math.PI);
this.endermanHead.rotateAngleX = p_78087_5_ / (180F / (float)Math.PI);

this.endermanJaw.rotateAngleX = this.endermanHead.rotateAngleX;
this.endermanJaw.rotateAngleY = this.endermanHead.rotateAngleY;
}
}
@@ -0,0 +1,18 @@
package iguanaman.iguanatweakstconstruct.mobheads.renderers;

import net.minecraft.client.model.ModelBase;
import net.minecraft.client.model.ModelRenderer;
import net.minecraft.client.model.ModelSkeletonHead;
import net.minecraft.entity.Entity;

public class ModelHeadwear extends ModelSkeletonHead
{
public ModelHeadwear(int offsetX, int offsetY, int width, int height)
{
this.textureWidth = width;
this.textureHeight = height;
this.skeletonHead = new ModelRenderer(this, offsetX, offsetY);
this.skeletonHead.addBox(-4.0F, -8.0F, -4.0F, 8, 8, 8, 0.4F);
this.skeletonHead.setRotationPoint(0.0F, 0.0F, 0.0F);
}
}

0 comments on commit 9850d33

Please sign in to comment.