skyfir3 Posted February 3, 2016 Posted February 3, 2016 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 Reveal hidden contents @Override public void onArmorTick(World world, EntityPlayer player, ItemStack itemStack) { if (player.isInvisible()) { } } Quote
DasKaktus Posted February 3, 2016 Posted February 3, 2016 Make a custom armor renderer and just not render it Quote Not all things in the world are red, there are round objects too!
skyfir3 Posted February 3, 2016 Author Posted February 3, 2016 Can you give me an example of the basics? I also have an update on the Helmet.class Reveal hidden contents @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()) { } } Quote
DasKaktus Posted February 3, 2016 Posted February 3, 2016 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. Quote Not all things in the world are red, there are round objects too!
skyfir3 Posted February 3, 2016 Author Posted February 3, 2016 The armor is now invisible, but it is invisible even when i'm not invisible Reveal hidden contents @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 Reveal hidden contents if(player.isInvisible()) { getArmorModel(player, boots, 0); } But it looks like it runs through the getArmorModel even without this Quote
YoungErtu Posted February 3, 2016 Posted February 3, 2016 On 2/3/2016 at 11:22 PM, skyfir3 said: The armor is now invisible, but it is invisible even when i'm not invisible Reveal hidden contents @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 Reveal hidden contents 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 } } Quote "My Crew is World Wide." 「ヤング • エルトウ」
DasKaktus Posted February 3, 2016 Posted February 3, 2016 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 Quote Not all things in the world are red, there are round objects too!
skyfir3 Posted February 3, 2016 Author Posted February 3, 2016 Thank you so much! The solution was right in front of meh, but i put the if(player.isInvisible()) the wrong place. Reveal hidden contents @Override @SideOnly(Side.CLIENT) public ModelBiped getArmorModel(EntityLivingBase entityLiving, ItemStack itemStack, int armorSlot) { if(entityLiving.isInvisible()) { return new InvisibleArmorRender(); } else { return null; } } Quote
Recommended Posts
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.