Posted February 3, 20169 yr So im working on a mod where a full set of the same type of armor should become invisible when the player is invisible. Im only interested in how i make the armor invisible Helmet.class @Override public void onArmorTick(World world, EntityPlayer player, ItemStack itemStack) { if (player.isInvisible()) { } }
February 3, 20169 yr Make a custom armor renderer and just not render it Not all things in the world are red, there are round objects too!
February 3, 20169 yr Author Can you give me an example of the basics? I also have an update on the Helmet.class @Override public void onArmorTick(World world, EntityPlayer player, ItemStack armor) { ItemStack boots = player.getCurrentArmor(0); ItemStack legs = player.getCurrentArmor(1); ItemStack chest = player.getCurrentArmor(2); ItemStack helmet = player.getCurrentArmor(3); int duration = 15; if(boots != null && legs != null && chest != null && helmet != null) { if(boots.getItem() == ManagerItem.scout_boots && legs.getItem() == ManagerItem.scout_leggings && chest.getItem() == ManagerItem.scout_chestplate && helmet.getItem() == ManagerItem.scout_helmet) { player.addPotionEffect(new PotionEffect(Potion.invisibility.id, duration++, 1)); } } if(player.isInvisible()) { } }
February 3, 20169 yr A real simple solution is this: @Override @SideOnly(Side.CLIENT) public ModelBiped getArmorModel(EntityLivingBase entityLiving, ItemStack itemStack, int armorSlot) { return new InvisibleArmorRender(); } public class InvisibleArmorRender extends ModelBiped{ public InvisibleArmorRender(){ super(); } public void render(Entity par1Entity, float par2, float par3, float par4, float par5, float par6, float par7){ } } Put that in your armor class. Not all things in the world are red, there are round objects too!
February 3, 20169 yr Author The armor is now invisible, but it is invisible even when i'm not invisible @Override public void onArmorTick(World world, EntityPlayer player, ItemStack armor) { ItemStack boots = player.getCurrentArmor(0); ItemStack legs = player.getCurrentArmor(1); ItemStack chest = player.getCurrentArmor(2); ItemStack helmet = player.getCurrentArmor(3); int duration = 15; if(boots != null && legs != null && chest != null && helmet != null) { if(boots.getItem() == ManagerItem.scout_boots && legs.getItem() == ManagerItem.scout_leggings && chest.getItem() == ManagerItem.scout_chestplate && helmet.getItem() == ManagerItem.scout_helmet) { if(player.isInvisible()) { getArmorModel(player, boots, 0); } } } } @Override @SideOnly(Side.CLIENT) public ModelBiped getArmorModel(EntityLivingBase entityLiving, ItemStack itemStack, int armorSlot) { return new InvisibleArmorRender(); } public class InvisibleArmorRender extends ModelBiped{ public InvisibleArmorRender(){ super(); } public void render(Entity par1Entity, float par2, float par3, float par4, float par5, float par6, float par7){ } } I need to make it so it only runs through the getModelArmor when i'm invisible, but i thought that this would do the trick if(player.isInvisible()) { getArmorModel(player, boots, 0); } But it looks like it runs through the getArmorModel even without this
February 3, 20169 yr The armor is now invisible, but it is invisible even when i'm not invisible @Override public void onArmorTick(World world, EntityPlayer player, ItemStack armor) { ItemStack boots = player.getCurrentArmor(0); ItemStack legs = player.getCurrentArmor(1); ItemStack chest = player.getCurrentArmor(2); ItemStack helmet = player.getCurrentArmor(3); int duration = 15; if(boots != null && legs != null && chest != null && helmet != null) { if(boots.getItem() == ManagerItem.scout_boots && legs.getItem() == ManagerItem.scout_leggings && chest.getItem() == ManagerItem.scout_chestplate && helmet.getItem() == ManagerItem.scout_helmet) { if(player.isInvisible()) { getArmorModel(player, boots, 0); } } } } @Override @SideOnly(Side.CLIENT) public ModelBiped getArmorModel(EntityLivingBase entityLiving, ItemStack itemStack, int armorSlot) { return new InvisibleArmorRender(); } public class InvisibleArmorRender extends ModelBiped{ public InvisibleArmorRender(){ super(); } public void render(Entity par1Entity, float par2, float par3, float par4, float par5, float par6, float par7){ } } I need to make it so it only runs through the getModelArmor when i'm invisible, but i thought that this would do the trick if(player.isInvisible()) { getArmorModel(player, boots, 0); } But it looks like it runs through the getArmorModel even without this try to add an if-statement at: @Override @SideOnly(Side.CLIENT) public ModelBiped getArmorModel(EntityLivingBase entityLiving, ItemStack itemStack, int armorSlot) { return new InvisibleArmorRender(); } do something like this: public ModelBiped getArmorModel(EntityLivingBase entityLiving, ItemStack itemStack, int armorSlot) { if(player.isInvisible){ return new InvisibleArmorRender(); } else { return //and here the normal renderer } } "My Crew is World Wide." 「ヤング • エルトウ」
February 3, 20169 yr yeah, the getArmorModel is always called. its an override. You must check in this if the player is invisible, if the the player is not, then just return. public ModelBiped getArmorModel(EntityLivingBase entityLiving, ItemStack itemStack, int armorSlot) { return new InvisibleArmorRender(); } So maybe you vill have to set an boolean in onArmorTick Not all things in the world are red, there are round objects too!
February 3, 20169 yr Author Thank you so much! The solution was right in front of meh, but i put the if(player.isInvisible()) the wrong place. @Override @SideOnly(Side.CLIENT) public ModelBiped getArmorModel(EntityLivingBase entityLiving, ItemStack itemStack, int armorSlot) { if(entityLiving.isInvisible()) { return new InvisibleArmorRender(); } else { return null; } }
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.