Jump to content

Potion effects and armour


jordsta95

Recommended Posts

Hey there, I was wondering what I am doing wrong. I have tried both:

public void onArmorTick(World world, EntityPlayer player, ItemStack itemStack) {
	if(player.getCurrentArmor(3) != null && player.getCurrentArmor(2) != null && player.getCurrentArmor(1) != null){
		ItemStack helmet = player.getCurrentArmor(3);
		ItemStack plate = player.getCurrentArmor(2);
		ItemStack legs = player.getCurrentArmor(1);
		if(helmet.getItem() == itemRegist.bedrockHelmet && plate.getItem() == itemRegist.bedrockChest && legs.getItem() == itemRegist.bedrockLegs){
			player.addPotionEffect(new PotionEffect(Potion.moveSlowdown.getId(), 5, 2));
			player.addPotionEffect(new PotionEffect(Potion.resistance.getId(), 5, 1));
		}
		else if(helmet.getItem() == itemRegist.bedrockHelmet && plate.getItem() == itemRegist.bedrockChest){
			player.addPotionEffect(new PotionEffect(Potion.moveSlowdown.getId(), 5, 1));
			player.addPotionEffect(new PotionEffect(Potion.resistance.getId(), 5, 0));
		}
		else if(helmet.getItem() == itemRegist.bedrockHelmet){
			player.addPotionEffect(new PotionEffect(Potion.moveSlowdown.getId(), 5, 0));
		}

	}

and:

public void onArmorTick(World world, EntityPlayer player, ItemStack itemStack) {
	if(player.getCurrentArmor(3) != null && player.getCurrentArmor(2) != null && player.getCurrentArmor(1) != null){
		ItemStack helmet = player.getCurrentArmor(3);
		ItemStack plate = player.getCurrentArmor(2);
		ItemStack legs = player.getCurrentArmor(1);
		if(helmet.getItem() == itemRegist.bedrockHelmet){
			player.addPotionEffect(new PotionEffect(Potion.moveSlowdown.getId(), 5, 0));
		}
		else if(helmet.getItem() == itemRegist.bedrockHelmet && plate.getItem() == itemRegist.bedrockChest){
			player.addPotionEffect(new PotionEffect(Potion.moveSlowdown.getId(), 5, 1));
			player.addPotionEffect(new PotionEffect(Potion.resistance.getId(), 5, 0));
		}

		else if(helmet.getItem() == itemRegist.bedrockHelmet && plate.getItem() == itemRegist.bedrockChest && legs.getItem() == itemRegist.bedrockLegs){
			player.addPotionEffect(new PotionEffect(Potion.moveSlowdown.getId(), 5, 2));
			player.addPotionEffect(new PotionEffect(Potion.resistance.getId(), 5, 1));
		}

	}


}

And neither do what I am looking for.

I want it so when a player is wearing one piece of armour (that isn't boots) they get slowness one (and yes, I left out the ors for when there are less 2 or 1 items being worn, I just wanted to test), when they wear 2 they get slowness 2 and resistance 1, and when they wear all 3 they gets slowness 3 resistance 2.

With the first code it only works on the helmet being worn - giving slowness 1

With the second code it only works when everything is worn - giving slowness 3, resistance 2.

 

 

I never really messed with customizing armour and potion effects, any pointers on how to achieve this goal?

Why bother?

Link to comment
Share on other sites

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.

Guest
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Announcements



×
×
  • Create New...

Important Information

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