Jump to content
View in the app

A better way to browse. Learn more.

Forge Forums

A full-screen app on your home screen with push notifications, badges and more.

To install this app on iOS and iPadOS
  1. Tap the Share icon in Safari
  2. Scroll the menu and tap Add to Home Screen.
  3. Tap Add in the top-right corner.
To install this app on Android
  1. Tap the 3-dot menu (⋮) in the top-right corner of the browser.
  2. Tap Add to Home screen or Install app.
  3. Confirm by tapping Install.

Featured Replies

Posted

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?

  • Author

I know that. As I said, when they are wearing more stuff they get more effects... which is in the code that I posted...

Why bother?

  • Author

Pardon my ignorance, I just realized where I have been going wrong. Sorry about that.

Why bother?

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...

Important Information

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

Configure browser push notifications

Chrome (Android)
  1. Tap the lock icon next to the address bar.
  2. Tap Permissions → Notifications.
  3. Adjust your preference.
Chrome (Desktop)
  1. Click the padlock icon in the address bar.
  2. Select Site settings.
  3. Find Notifications and adjust your preference.