Glowstone armor now glows
This commit is contained in:
parent
00b666a779
commit
869660d8bf
2 changed files with 65 additions and 0 deletions
|
@ -17,6 +17,10 @@ import org.lwjgl.opengl.GL11;
|
|||
public class ModelCustomArmor extends ModelBiped
|
||||
{
|
||||
public static ModelCustomArmor INSTANCE = new ModelCustomArmor();
|
||||
|
||||
public static GlowArmor GLOW_BIG = new GlowArmor(1.0F);
|
||||
public static GlowArmor GLOW_SMALL = new GlowArmor(0.5F);
|
||||
|
||||
public static Minecraft mc = Minecraft.getMinecraft();
|
||||
|
||||
public ArmorModel modelType;
|
||||
|
@ -42,6 +46,8 @@ public class ModelCustomArmor extends ModelBiped
|
|||
if(entity instanceof EntityLivingBase)
|
||||
{
|
||||
isSneak = ((EntityLivingBase)entity).isSneaking();
|
||||
isRiding = ((EntityLivingBase)entity).isRiding();
|
||||
isChild = ((EntityLivingBase)entity).isChild();
|
||||
}
|
||||
|
||||
if(modelType.armorSlot == 0)
|
||||
|
@ -173,4 +179,44 @@ public class ModelCustomArmor extends ModelBiped
|
|||
resource = r;
|
||||
}
|
||||
}
|
||||
|
||||
public static ModelBiped getGlow(int index)
|
||||
{
|
||||
ModelBiped biped = index != 2 ? GLOW_BIG : GLOW_SMALL;
|
||||
|
||||
biped.bipedHead.showModel = index == 0;
|
||||
biped.bipedHeadwear.showModel = index == 0;
|
||||
biped.bipedBody.showModel = index == 1 || index == 2;
|
||||
biped.bipedRightArm.showModel = index == 1;
|
||||
biped.bipedLeftArm.showModel = index == 1;
|
||||
biped.bipedRightLeg.showModel = index == 2 || index == 3;
|
||||
biped.bipedLeftLeg.showModel = index == 2 || index == 3;
|
||||
|
||||
return biped;
|
||||
}
|
||||
|
||||
public static class GlowArmor extends ModelBiped
|
||||
{
|
||||
public GlowArmor(float size)
|
||||
{
|
||||
super(size);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void render(Entity entity, float par2, float par3, float par4, float par5, float par6, float par7)
|
||||
{
|
||||
if(entity instanceof EntityLivingBase)
|
||||
{
|
||||
isSneak = ((EntityLivingBase)entity).isSneaking();
|
||||
isRiding = ((EntityLivingBase)entity).isRiding();
|
||||
isChild = ((EntityLivingBase)entity).isChild();
|
||||
}
|
||||
|
||||
setRotationAngles(par2, par3, par4, par5, par6, par7, entity);
|
||||
|
||||
MekanismRenderer.glowOn();
|
||||
super.render(entity, par2, par3, par4, par5, par6, par7);
|
||||
MekanismRenderer.glowOff();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -2,13 +2,19 @@ package mekanism.tools.item;
|
|||
|
||||
import java.util.List;
|
||||
|
||||
import mekanism.client.render.ModelCustomArmor;
|
||||
import mekanism.common.Mekanism;
|
||||
import mekanism.tools.common.MekanismTools;
|
||||
import net.minecraft.client.model.ModelBiped;
|
||||
import net.minecraft.client.renderer.texture.IconRegister;
|
||||
import net.minecraft.entity.Entity;
|
||||
import net.minecraft.entity.EntityLivingBase;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.item.EnumArmorMaterial;
|
||||
import net.minecraft.item.ItemArmor;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
import cpw.mods.fml.relauncher.SideOnly;
|
||||
|
||||
public class ItemMekanismArmor extends ItemArmor
|
||||
{
|
||||
|
@ -35,4 +41,17 @@ public class ItemMekanismArmor extends ItemArmor
|
|||
{
|
||||
return "mekanism:armor/" + getArmorMaterial().name().toLowerCase() + "_" + layer + ".png";
|
||||
}
|
||||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public ModelBiped getArmorModel(EntityLivingBase entityLiving, ItemStack itemStack, int armorSlot)
|
||||
{
|
||||
if(itemStack.itemID == MekanismTools.GlowstoneHelmet.itemID || itemStack.itemID == MekanismTools.GlowstoneChestplate.itemID ||
|
||||
itemStack.itemID == MekanismTools.GlowstoneLeggings.itemID || itemStack.itemID == MekanismTools.GlowstoneBoots.itemID)
|
||||
{
|
||||
return ModelCustomArmor.getGlow(armorSlot);
|
||||
}
|
||||
|
||||
return super.getArmorModel(entityLiving, itemStack, armorSlot);
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue