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

Given a ItemStack from player.getItemStackFromSlot(EntityEquipmentSlot.FEET); or any slot

how to test for a given color, or print the color

 

thanks!

35 minutes ago, ciroreed said:

Given a ItemStack from player.getItemStackFromSlot(EntityEquipmentSlot.FEET); or any slot

how to test for a given color, or print the color

 

thanks!

You could check if the item is an instance of IDyeableArmorItem, and if so, use IDyeableArmorItem.getColor().

  • Author

do you know how color codes work? I have blue boots and it has a nbt tag display.color = 3949738. Boots are blue. How do i get that in runtime? is there any class or enum or dyes.getColorFromCode(3949738) // blue

  • Author

My use case is the following. In order to use an item I have to check that the player is wearing a (dyed) blue leather armor

 

ok, this can be closed. Just to share it:

 

@Override
	public ActionResult<ItemStack> onItemRightClick(World world, EntityPlayer player, EnumHand hand){
		if(world.isRemote) return super.onItemRightClick(world, player, hand);

		ItemStack itemStackBoots = player.getItemStackFromSlot(EntityEquipmentSlot.FEET);
		if(itemStackBoots.isEmpty()) return super.onItemRightClick(world, player, hand);

		int colorValue = itemStackBoots.getTagCompound().getCompoundTag("display").getInteger("color");

		for (EnumDyeColor color : EnumDyeColor.values()) {
			if(colorValue == color.getColorValue()) {
				out.println(color.getName());
			}
		}

		return super.onItemRightClick(world, player, hand);
	}

 

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.