package com.awex;
import com.awex.tabs.MaterialTab;
import cpw.mods.fml.common.Mod;
import cpw.mods.fml.common.Mod.EventHandler;
import cpw.mods.fml.common.SidedProxy;
import cpw.mods.fml.common.event.FMLInitializationEvent;
import cpw.mods.fml.common.event.FMLPostInitializationEvent;
import cpw.mods.fml.common.event.FMLPreInitializationEvent;
import com.awex.proxy.CommonProxy;
import net.minecraft.item.Item;
import net.minecraft.item.ItemArmor;
import net.minecraftforge.common.util.EnumHelper;
@Mod(modid = Main.MODID, version = Main.VERSION)
public class Main {
public static final String MODID = "awex";
public static final String VERSION = "1.0.1";
public static final MaterialTab creativeTabMaterial = new MaterialTab();
/**
* ==============
* Tools Sections
* ==============
*/
public static final Item.ToolMaterial AluminiumToolMaterial = EnumHelper.addToolMaterial("aluminiumToolMaterial", 2, 512, 5.0F, 1.0F, 14);
public static final Item.ToolMaterial TinToolMaterial = EnumHelper.addToolMaterial("tinToolMaterial", 2, 768, 5.0F, 1.4F, 19);
public static final Item.ToolMaterial CopperToolMaterial = EnumHelper.addToolMaterial("copperToolMaterial", 2, 1024, 6.0F, 1.8F, 19);
public static final Item.ToolMaterial LimoniteToolMaterial = EnumHelper.addToolMaterial("limoniteToolMaterial", 2, 1280, 6.0F, 2.2F, 19);
public static final Item.ToolMaterial BronzeToolMaterial = EnumHelper.addToolMaterial("bronzeToolMaterial", 3, 1536, 7.0F, 2.6F, 17);
public static final Item.ToolMaterial TungstenToolMaterial = EnumHelper.addToolMaterial("tungstenToolMaterial", 3, 1792, 8.0F, 3.0F, 22);
public static final Item.ToolMaterial MagnesiumToolMaterial = EnumHelper.addToolMaterial("magnesiumToolMaterial", 3, 2048, 9.0F, 3.4F, 22);
public static final Item.ToolMaterial SteelToolMaterial = EnumHelper.addToolMaterial("steelToolMaterial", 3, 2304, 10.0F, 3.8F, 15);
public static final Item.ToolMaterial TitaniumToolMaterial = EnumHelper.addToolMaterial("titaniumToolMaterial", 4, 2560, 11.0F, 4.2F, 20);
public static final Item.ToolMaterial PlatinumToolMaterial = EnumHelper.addToolMaterial("platinumToolMaterial", 4, 3072, 12.0F, 4.6F, 22);
public static final Item.ToolMaterial NthmetalToolMaterial = EnumHelper.addToolMaterial("nthmetalToolMaterial", 5, 4096, 14.0F, 5.0F, 40);
public static ItemArmor.ArmorMaterial HJArmor = EnumHelper.addArmorMaterial("HJArmor", 42, new int[] {5, 10, 8, 4}, 5);
/**
* ==============
* Proxy
* ==============
*/
@SidedProxy(clientSide="com.awex.proxy.ClientProxy", serverSide="com.awex.proxy.ServerProxy")
public static CommonProxy proxy;
/**
* ==============
* Initialization
* ==============
*/
@EventHandler
public void preInit(FMLPreInitializationEvent e)
{
proxy.preInit(e);
}
@EventHandler
public void init(FMLInitializationEvent e)
{
proxy.init(e);
}
@EventHandler
public void postInit(FMLPostInitializationEvent e)
{
proxy.postInit(e);
}
/**
* ==============
* End :)
* ==============
*/
}
Main Class ^
package com.awex.proxy;
import com.awex.heros.HalJordanModel;
import cpw.mods.fml.common.event.FMLInitializationEvent;
import cpw.mods.fml.common.event.FMLPostInitializationEvent;
import cpw.mods.fml.common.event.FMLPreInitializationEvent;
import net.minecraft.client.model.ModelBiped;
public class ClientProxy extends CommonProxy {
private static final ModelBiped bipedBase = new ModelBiped(0.2F);
private static final HalJordanModel haljordan = new HalJordanModel(0.2F);
@Override
public void preInit(FMLPreInitializationEvent e) {
super.preInit(e);
}
@Override
public void init(FMLInitializationEvent e) {
super.init(e);
}
@Override
public void postInit(FMLPostInitializationEvent e) {
super.postInit(e);
}
public static ModelBiped getArmorModel(int id)
{
switch (id)
{
case 0: return bipedBase;
case 1: return haljordan;
default: break;
}
return bipedBase; //default, if whenever you should have passed on a wrong id } }
}
}
ClientProxy ^
package com.awex.heros;
import net.minecraft.client.model.ModelBiped;
import net.minecraft.client.model.ModelRenderer;
import net.minecraft.entity.Entity;
public class HalJordanModel extends ModelBiped {
public ModelRenderer LeftArm;
public ModelRenderer RightLeg;
public ModelRenderer Head;
public ModelRenderer Torso;
public ModelRenderer RightArm;
public ModelRenderer LeftLeg;
public HalJordanModel(float scale){
super(scale, 0, 64, 64);
this.textureWidth = 64;
this.textureHeight = 64;
this.RightLeg = new ModelRenderer(this, 0, 16);
this.RightLeg.mirror = true;
this.RightLeg.setRotationPoint(1.9F, 12.0F, 0.0F);
this.RightLeg.addBox(-2.0F, 0.0F, -2.0F, 4, 12, 4, 0.0F);
this.RightArm = new ModelRenderer(this, 40, 16);
this.RightArm.mirror = true;
this.RightArm.setRotationPoint(5.0F, 2.0F, 0.0F);
this.RightArm.addBox(-1.0F, -2.0F, -2.0F, 4, 12, 4, 0.0F);
this.LeftArm = new ModelRenderer(this, 40, 16);
this.LeftArm.setRotationPoint(-5.0F, 2.0F, 0.0F);
this.LeftArm.addBox(-3.0F, -2.0F, -2.0F, 4, 12, 4, 0.0F);
this.LeftLeg = new ModelRenderer(this, 0, 16);
this.LeftLeg.setRotationPoint(-1.9F, 12.0F, 0.0F);
this.LeftLeg.addBox(-2.0F, 0.0F, -2.0F, 4, 12, 4, 0.0F);
this.Head = new ModelRenderer(this, 0, 0);
this.Head.setRotationPoint(0.0F, 0.0F, 0.0F);
this.Head.addBox(-4.0F, -8.0F, -4.0F, 8, 8, 8, 0.0F);
this.Torso = new ModelRenderer(this, 16, 16);
this.Torso.setRotationPoint(0.0F, 0.0F, 0.0F);
this.Torso.addBox(-4.0F, 0.0F, -2.0F, 8, 12, 4, 0.0F);
bipedHeadwear.addChild(Head);
bipedHead.addChild(Head);
bipedBody.addChild(Torso);
bipedLeftArm.addChild(LeftArm);
bipedRightArm.addChild(RightArm);
bipedLeftLeg.addChild(LeftLeg);
bipedRightLeg.addChild(RightLeg);
}
@Override
public void render(Entity entity, float f, float f1, float f2, float f3, float f4, float f5) {
this.RightLeg.render(f5);
this.RightArm.render(f5);
this.LeftArm.render(f5);
this.LeftLeg.render(f5);
this.Head.render(f5);
this.Torso.render(f5);
}
/**
* 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;
}
}
Model File ^
package com.awex.heros;
import com.awex.Main;
import com.awex.handlers.ArmorHandler;
import com.awex.proxy.ClientProxy;
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
import net.minecraft.client.model.ModelBiped;
import net.minecraft.entity.Entity;
import net.minecraft.entity.EntityLivingBase;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.item.EnumAction;
import net.minecraft.item.ItemArmor;
import net.minecraft.item.ItemStack;
import net.minecraft.potion.Potion;
import net.minecraft.potion.PotionEffect;
import net.minecraft.world.World;
public class HalJordan extends ItemArmor{
public String textureName;
public HalJordan(String unlocalizedName, ArmorMaterial material, String textureName, int type) {
super(material, 0, type);
this.textureName = textureName;
this.setUnlocalizedName(unlocalizedName);
this.setTextureName(Main.MODID + ":" + unlocalizedName);
}
@Override
public String getArmorTexture(ItemStack stack, Entity entity, int slot, String layer) {
if (stack.getItem().equals(ArmorHandler.hjHelmet) || stack.getItem().equals(ArmorHandler.hjPlate)
|| stack.getItem().equals(ArmorHandler.hjBoots)) {
return Main.MODID + ":textures/items/armor/HJ.png";
}
if (stack.getItem().equals(ArmorHandler.hjLeggings)) {
return Main.MODID + ":textures/items/armor/HJ.png";
} else
return null;
}
@Override
@SideOnly(Side.CLIENT)
public ModelBiped getArmorModel(EntityLivingBase entityLiving, ItemStack itemStack, int armorSlot) {
ModelBiped armorModel = new ModelBiped();
if (itemStack != null) {
if (itemStack.getItem() instanceof HalJordan) {
int type = ((ItemArmor) itemStack.getItem()).armorType;
if (type == 1 || type == 3) {
armorModel = ClientProxy.getArmorModel(1);
} else {
armorModel = ClientProxy.getArmorModel(1);
}
}
if (armorModel != null) {
armorModel.bipedHead.showModel = armorSlot == 0;
armorModel.bipedHeadwear.showModel = armorSlot == 0;
armorModel.bipedBody.showModel = armorSlot == 1 || armorSlot == 2;
armorModel.bipedRightArm.showModel = armorSlot == 1;
armorModel.bipedLeftArm.showModel = armorSlot == 1;
armorModel.bipedRightLeg.showModel = armorSlot == 2 || armorSlot == 3;
armorModel.bipedLeftLeg.showModel = armorSlot == 2 || armorSlot == 3;
armorModel.isSneak = entityLiving.isSneaking();
armorModel.isRiding = entityLiving.isRiding();
armorModel.isChild = entityLiving.isChild();
armorModel.heldItemRight = ((EntityPlayer) entityLiving).getCurrentArmor(0) != null ? 1 : 0; // for
armorModel.heldItemRight = ((EntityPlayer) entityLiving).getCurrentEquippedItem() != null ? 1 : 0; // for
armorModel.aimedBow = false;
if ((entityLiving instanceof EntityPlayer)) {
if (((EntityPlayer) entityLiving).getItemInUseDuration() > 0) {
EnumAction enumaction = ((EntityPlayer) entityLiving).getCurrentEquippedItem()
.getItemUseAction();
if (enumaction == EnumAction.block) {
armorModel.heldItemRight = 3;
} else if (enumaction == EnumAction.bow) {
armorModel.aimedBow = true;
}
}
}
return armorModel;
}
}
return null;
}
@Override
public void onArmorTick(World world, EntityPlayer player, ItemStack itemStack) {
if (player.getCurrentArmor(3) != null && player.getCurrentArmor(2) != null
&& player.getCurrentArmor(1) != null && player.getCurrentArmor(0) != null) {
if (player.getCurrentArmor(3).getItem().equals(ArmorHandler.hjHelmet)
&& player.getCurrentArmor(2).getItem().equals(ArmorHandler.hjPlate)
&& player.getCurrentArmor(1).getItem().equals(ArmorHandler.hjLeggings)
&& player.getCurrentArmor(0).getItem().equals(ArmorHandler.hjBoots)) {
player.addPotionEffect(new PotionEffect(Potion.moveSpeed.id, 10, 0));
player.fallDistance = 0.0f;
}
}
}
}
ItemArmor Class ^
http://imgur.com/szxFV7P
Located at assets.awex.textures.items.armor
Every time I launch and put this armor on it loads very oddly. If I sneak I can see a snippet of the armor, but that's about it. It also doesn't move with the player.