Skip to content

Commit

Permalink
Initial release
Browse files Browse the repository at this point in the history
  • Loading branch information
sirolf2009 committed Apr 13, 2013
1 parent afb1a15 commit 4765f7f
Show file tree
Hide file tree
Showing 147 changed files with 9,181 additions and 0 deletions.
47 changes: 47 additions & 0 deletions common/com/sirolf2009/necroapi/BodyPart.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
package com.sirolf2009.necroapi;

import net.minecraft.client.model.ModelBase;
import net.minecraft.client.model.ModelRenderer;

public class BodyPart extends ModelRenderer {

/**
* The base constructor for body parts, call this if you are creating arms
* or heads
*/
public BodyPart(NecroEntityBase base, ModelBase par1ModelBase, int par2, int par3) {
super(par1ModelBase, par2, par3);
entity = base;
name = base.mobName;
textureHeight = base.textureHeight;
textureWidth = base.textureWidth;
}

public String name;
public NecroEntityBase entity;

/** call this if you are creating legs */
public BodyPart(NecroEntityBase base, float torsoPos[], ModelBase par1ModelBase, int par2, int par3) {
this(base, par1ModelBase, par2, par3);
this.torsoPos = new float[3];
this.torsoPos = torsoPos;
}

public float torsoPos[];

/** call this if you are creating torsos */
public BodyPart(NecroEntityBase base, float armLeftPos[], float armRightPos[], float headPos[], ModelBase par1ModelBase, int par2, int par3) {
this(base, par1ModelBase, par2, par3);
this.armLeftPos = new float[3];
this.armLeftPos = armLeftPos;
this.armRightPos = new float[3];
this.armRightPos = armRightPos;
this.headPos = new float[3];
this.headPos = headPos;
}

public float armLeftPos[];
public float armRightPos[];
public float headPos[];

}
8 changes: 8 additions & 0 deletions common/com/sirolf2009/necroapi/ISaddleAble.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
package com.sirolf2009.necroapi;

public interface ISaddleAble {

public String getSaddleTex();

public int riderHeight();
}
6 changes: 6 additions & 0 deletions common/com/sirolf2009/necroapi/ISkull.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
package com.sirolf2009.necroapi;

public interface ISkull {

public String getSkullTexture();
}
199 changes: 199 additions & 0 deletions common/com/sirolf2009/necroapi/NecroEntityBase.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,199 @@
package com.sirolf2009.necroapi;

import net.minecraft.entity.Entity;
import net.minecraft.item.Item;
import net.minecraft.item.ItemStack;

import com.sirolf2009.necromancy.client.model.ModelMinion;

/**
* The base class for all the necro mobs
*
* @author sirolf2009
* @license Lesser GNU Public License v3 (http://www.gnu.org/licenses/lgpl.html)
*/
public abstract class NecroEntityBase {

public NecroEntityBase(String mobName) {
this.mobName = mobName;
hasHead = true;
hasTorso = true;
hasArms = true;
hasLegs = true;
textureWidth = 64;
textureHeight = 32;
try {
Class.forName("com.sirolf2009.necromancy.Necromancy");
organs = Item.itemsList[organID + 256];
isNecromancyInstalled = true;
initRecipes();
} catch (ClassNotFoundException e) {
System.err.println(mobName + " could not be registered, the necromancy mod is not installed");
isNecromancyInstalled = false;
}
}

/** Define your recipes here */
public void initRecipes() {
}

/**
* Use this method to initialize all the ModelRenderers for your mobs head
*
* @param model
* - the model
*/
public BodyPart[] initHead(ModelMinion model) {
return null;
}

/**
* Use this method to initialize all the ModelRenderers for your mobs torso
*
* @param model
* - the model
*/
public BodyPart[] initTorso(ModelMinion model) {
return null;
}

/**
* Use this method to initialize all the ModelRenderers for your mobs legs
*
* @param model
* - the model
*/
public BodyPart[] initLegs(ModelMinion model) {
return null;
}

/**
* Use this method to initialize all the ModelRenderers for your mobs left
* arm
*
* @param model
* - the model
*/
public BodyPart[] initArmLeft(ModelMinion model) {
return null;
}

/**
* The method used to initialize the parts and store them in variables
*
* @param model
* = the model
* @return this
*/
public NecroEntityBase updateParts(ModelMinion model) {
head = initHead(model);
torso = initTorso(model);
armLeft = initArmLeft(model);
armRight = initArmRight(model);
legs = initLegs(model);
return this;
}

/**
* Use this method to initialize all the ModelRenderers for your mobs right
* arm
*
* @param model
* - the model
*/
public BodyPart[] initArmRight(ModelMinion model) {
return null;
}

/**
* Use this method to set the rotation for every bodypart
*
* @param entity
* - the entity
* @param part
* - the current parts being animated
* @param location
* - the location of the parts (head/torso/armLeft/armRight/legs)
*/
public void setRotationAngles(float par1, float par2, float par3, float par4, float par5, float par6, Entity entity, BodyPart[] part, String location) {
}

/**
* Called before rendering
*
* @param entity
* - the entity
* @param part
* - the current parts being rendered
* @param location
* - the location of the parts (head/torso/armLeft/armRight/legs)
* @param model
* - the model
*/
public void preRender(Entity entity, BodyPart[] parts, String location, ModelMinion model) {
}

/**
* Called after rendering
*
* @param entity
* - the entity
* @param part
* - the current parts being rendered
* @param location
* - the location of the parts (head/torso/armLeft/armRight/legs)
* @param model
* - the model
*/
public void postRender(Entity entity, BodyPart[] parts, String location, ModelMinion model) {
}

/** The name for your mob */
public String mobName;
/** The location of the mobs texture file */
public String texture;
/** The item assigned to your mobs head */
public ItemStack headItem;
/** The item assigned to your mobs torso */
public ItemStack torsoItem;
/** The item assigned to your mobs arms */
public ItemStack armItem;
/** The item assigned to your mobs legs */
public ItemStack legItem;
/** The recipe assigned to your mobs head */
public Object[] headRecipe;
/** The recipe assigned to your mobs torso */
public Object[] torsoRecipe;
/** The recipe assigned to your mobs arms */
public Object[] armRecipe;
/** The recipe assigned to your mobs legs */
public Object[] legRecipe;
/** set to false if your mob doesn't have a head */
public boolean hasHead;
/** set to false if your mob doesn't have a torso */
public boolean hasTorso;
/** set to false if your mob doesn't have arms */
public boolean hasArms;
/** set to false if your mob doesn't have legs */
public boolean hasLegs;
/** The item ID for organs */
public static int organID;
/** The organs item (Brains, Heart, Muscle, Lungs, Skin) */
public Item organs;
/** The textures width */
public int textureWidth;
/** The textures height */
public int textureHeight;
/** i'm sure you can figure this one out... */
protected boolean isNecromancyInstalled;
/** Your entities head */
public BodyPart[] head;
/** Your entities torso */
public BodyPart[] torso;
/** Your entities armLeft */
public BodyPart[] armLeft;
/** Your entities armRight */
public BodyPart[] armRight;
/** Your entities legs */
public BodyPart[] legs;
}
99 changes: 99 additions & 0 deletions common/com/sirolf2009/necroapi/NecroEntityBiped.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,99 @@
package com.sirolf2009.necroapi;

import net.minecraft.entity.Entity;
import net.minecraft.util.MathHelper;

import com.sirolf2009.necromancy.client.model.ModelMinion;

/**
* The base class for all the biped necro mobs
*
* @author sirolf2009
* @license Lesser GNU Public License v3 (http://www.gnu.org/licenses/lgpl.html)
*/
public abstract class NecroEntityBiped extends NecroEntityBase {

public NecroEntityBiped(String mobName) {
super(mobName);
this.mobName = mobName;
}

@Override
public BodyPart[] initHead(ModelMinion model) {
BodyPart head = new BodyPart(this, model, 0, 0);
head.addBox(-4, -4, -4, 8, 8, 8, 0.0F);
head.setTextureSize(textureWidth, textureHeight);
BodyPart headWear = new BodyPart(this, model, 32, 0);
headWear.addBox(-4, -4, -4, 8, 8, 8, 0.5F);
headWear.setTextureSize(textureWidth, textureHeight);
return new BodyPart[] { head, headWear };
}

@Override
public BodyPart[] initTorso(ModelMinion model) {
float[] headPos = { 4.0F, -4.0F, 2.0F };
float[] armLeftPos = { -4F, 0.0F, 2.0F };
float[] armRightPos = { 8F, 0.0F, 2.0F };
BodyPart torso = new BodyPart(this, armLeftPos, armRightPos, headPos, model, 16, 16);
torso.addBox(0.0F, 0.0F, 0.0F, 8, 12, 4, 0.0F);
torso.setTextureSize(textureWidth, textureHeight);
return new BodyPart[] { torso };
}

@Override
public BodyPart[] initArmLeft(ModelMinion model) {
BodyPart armLeft = new BodyPart(this, model, 40, 16);
armLeft.addBox(0.0F, 0.0F, -2.0F, 4, 12, 4, 0.0F);
armLeft.setTextureSize(textureWidth, textureHeight);
armLeft.mirror = true;
return new BodyPart[] { armLeft };
}

@Override
public BodyPart[] initArmRight(ModelMinion model) {
BodyPart armRight = new BodyPart(this, model, 40, 16);
armRight.addBox(0.0F, 0.0F, -2.0F, 4, 12, 4, 0.0F);
armRight.setTextureSize(textureWidth, textureHeight);
return new BodyPart[] { armRight };
}

@Override
public BodyPart[] initLegs(ModelMinion model) {
float[] torsoPos = { -4F, -2F, -2F };
BodyPart legLeft = new BodyPart(this, torsoPos, model, 0, 16);
legLeft.addBox(-4.0F, -2.0F, -2.0F, 4, 12, 4, 0.0F);
legLeft.setRotationPoint(0.0F, 12.0F, 0.0F);
BodyPart legRight = new BodyPart(this, torsoPos, model, 0, 16);
legRight.addBox(0.0F, -2.0F, -2.0F, 4, 12, 4, 0.0F);
legRight.setRotationPoint(0.0F, 12.0F, 0.0F);
legLeft.setTextureSize(textureWidth, textureHeight);
legRight.setTextureSize(textureWidth, textureHeight);
legLeft.mirror = true;
return new BodyPart[] { legLeft, legRight };
}

@Override
public void setRotationAngles(float par1, float par2, float par3, float par4, float par5, float par6, Entity par7Entity, BodyPart[] bodypart, String string) {
if (string.equals("head")) {
bodypart[0].rotateAngleY = par4 / (180F / (float) Math.PI);
bodypart[0].rotateAngleX = par5 / (180F / (float) Math.PI);
bodypart[1].rotateAngleY = par4 / (180F / (float) Math.PI);
bodypart[1].rotateAngleX = par5 / (180F / (float) Math.PI);
}
if (string.equals("armLeft")) {
bodypart[0].rotateAngleX = MathHelper.cos(par1 * 0.6662F) * 2.0F * par2 * 0.5F;
bodypart[0].rotateAngleZ = 0.0F;
}
if (string.equals("armRight")) {
bodypart[0].rotateAngleX = MathHelper.cos(par1 * 0.6662F + (float) Math.PI) * 2.0F * par2 * 0.5F;
bodypart[0].rotateAngleZ = 0.0F;
}
if (string.equals("legs")) {
bodypart[0].rotateAngleX = MathHelper.cos(par1 * 0.6662F) * 1.4F * par2;
bodypart[1].rotateAngleX = MathHelper.cos(par1 * 0.6662F + (float) Math.PI) * 1.4F * par2;
bodypart[0].rotateAngleY = 0.0F;
bodypart[1].rotateAngleY = 0.0F;
}
}

}
Loading

0 comments on commit 4765f7f

Please sign in to comment.