Posted June 5, 201510 yr Hello everyone, Im trying to make armor which will work only if player.someBoolean == true that means that if the boolean is == false then player cannot place armor in his armor slot. I was looking in ItemArmor.class but i cant find some method which is placing the armor in slot. Thx for any help I'm beginner in java and in minecraft modding. Please be specific. Any code examples are appreciated. Sorry for my english i'm from Czech republic. Please hit that thank you button if i helped
June 5, 201510 yr You can't do that without replacing whole inventory. I was wrong. :C 1.7.10 is no longer supported by forge, you are on your own.
June 5, 201510 yr Author Well thats unfortunate I'm beginner in java and in minecraft modding. Please be specific. Any code examples are appreciated. Sorry for my english i'm from Czech republic. Please hit that thank you button if i helped
June 5, 201510 yr Author So i have my armor class like this : package fewmorethings.items.armor; import net.minecraft.client.renderer.texture.IIconRegister; import net.minecraft.entity.Entity; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.item.Item; 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; import fewmorethings.Main; import fewmorethings.items.ArmoryHandler; public class EmeraldArmor extends ItemArmor { private static Item bootsEmerald; private String [] armorTypes = new String [] {"EmeraldHelmet", "EmeraldChestplate", "EmeraldLeggings", "EmeraldBoots"}; public EmeraldArmor(ArmorMaterial armorMaterial, int renderIndex, int armorType){ super(armorMaterial, renderIndex, armorType); this.setCreativeTab(Main.fmtab); } @Override public String getArmorTexture(ItemStack stack, Entity entity,int slot, String layer){ if(stack.getItem().equals(ArmoryHandler.EmeraldHelmet)|| stack.getItem().equals(ArmoryHandler.EmeraldChestplate)|| stack.getItem().equals(ArmoryHandler.EmeraldBoots)){ return "fmt:textures/armor/EmeraldArmor1.png"; } if(stack.getItem().equals(ArmoryHandler.EmeraldLeggings)){ return "fmt:textures/armor/EmeraldArmor2.png"; } else return null; } @Override public void registerIcons(IIconRegister reg){ if(this == ArmoryHandler.EmeraldHelmet) this.itemIcon = reg.registerIcon("fmt:EmeraldHelmet"); if(this == ArmoryHandler.EmeraldChestplate) this.itemIcon = reg.registerIcon("fmt:EmeraldChestplate"); if(this == ArmoryHandler.EmeraldLeggings) this.itemIcon = reg.registerIcon("fmt:EmeraldLeggings"); if(this == ArmoryHandler.EmeraldBoots) this.itemIcon = reg.registerIcon("fmt:EmeraldBoots"); } @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){ ItemStack helmet = player.getCurrentArmor(3); ItemStack plate = player.getCurrentArmor(2); ItemStack leggings = player.getCurrentArmor(1); ItemStack boots = player.getCurrentArmor(0); if(helmet.getItem() == ArmoryHandler.EmeraldHelmet && plate.getItem() == ArmoryHandler.EmeraldChestplate && leggings.getItem() == ArmoryHandler.EmeraldLeggings && boots.getItem() == ArmoryHandler.EmeraldBoots){ player.addPotionEffect( new PotionEffect(Potion.resistance.getId(), 10, 60)); } } } } and init armor : public static Item EmeraldHelmet = new EmeraldArmor(ArmorEmerald, 5, 0).setUnlocalizedName("EmeraldHelmet"); public static Item EmeraldChestplate = new EmeraldArmor(ArmorEmerald, 5, 1).setUnlocalizedName("EmeraldChestplate"); public static Item EmeraldLeggings = new EmeraldArmor(ArmorEmerald, 5, 2).setUnlocalizedName("EmeraldLeggings"); public static Item EmeraldBoots = new EmeraldArmor(ArmorEmerald, 5, 3).setUnlocalizedName("EmeraldBoots"); I'm beginner in java and in minecraft modding. Please be specific. Any code examples are appreciated. Sorry for my english i'm from Czech republic. Please hit that thank you button if i helped
June 5, 201510 yr Author lol sorry i didnt say the main thing but never mind i figured it out thank you I'm beginner in java and in minecraft modding. Please be specific. Any code examples are appreciated. Sorry for my english i'm from Czech republic. Please hit that thank you button if i helped
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.