Jump to content

[1.10.2] Detect armor worn


Egietje

Recommended Posts

Hello, I want to know how to check if a player has a full armor set worn, how would I do that because now I have this:

@Override
public void onArmorTick(World world, EntityPlayer player, ItemStack itemStack) {
	if(player.inventory.armorItemInSlot(103) != null && player.inventory.armorItemInSlot(103) == new ItemStack(KokkieItems.BOOM_HELMET)) {
		if(player.inventory.armorItemInSlot(102) != null && player.inventory.armorItemInSlot(102) == new ItemStack(KokkieItems.BOOM_CHESTPLATE)) {
			if(player.inventory.armorItemInSlot(101) != null && player.inventory.armorItemInSlot(101) == new ItemStack(KokkieItems.BOOM_LEGGINGS)) {
				if(player.inventory.armorItemInSlot(100) != null && player.inventory.armorItemInSlot(100) == new ItemStack(KokkieItems.BOOM_BOOTS)) {
				}
			}
		}
	}
}

But that crashes the game

Link to comment
Share on other sites

Thats it, but it doesn't detect it, I have this:

@Override
public void onArmorTick(World world, EntityPlayer player, ItemStack itemStack) {
	if(player.getItemStackFromSlot(EntityEquipmentSlot.HEAD) != null && player.getItemStackFromSlot(EntityEquipmentSlot.HEAD) == new ItemStack(KokkieItems.BOOM_HELMET)) {
		if(player.getItemStackFromSlot(EntityEquipmentSlot.CHEST) != null && player.getItemStackFromSlot(EntityEquipmentSlot.CHEST) == new ItemStack(KokkieItems.BOOM_CHESTPLATE)) {
			if(player.getItemStackFromSlot(EntityEquipmentSlot.LEGS) != null && player.getItemStackFromSlot(EntityEquipmentSlot.LEGS) == new ItemStack(KokkieItems.BOOM_LEGGINGS)) {
				if(player.getItemStackFromSlot(EntityEquipmentSlot.FEET) != null && player.getItemStackFromSlot(EntityEquipmentSlot.FEET) == new ItemStack(KokkieItems.BOOM_BOOTS)) {
					System.out.println("Works");
				}
			}
		}
	}
}

Link to comment
Share on other sites

That's not how you compare ItemStacks.

Apparently I'm a complete and utter jerk and come to this forum just like to make fun of people, be confrontational, and make your personal life miserable.  If you think this is the case, JUST REPORT ME.  Otherwise you're just going to get reported when you reply to my posts and point it out, because odds are, I was trying to be nice.

 

Exception: If you do not understand Java, I WILL NOT HELP YOU and your thread will get locked.

 

DO NOT PM ME WITH PROBLEMS. No help will be given.

Link to comment
Share on other sites

Guest
This topic is now closed to further replies.

Announcements



×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use.