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

I got plugin that uses lore how can I get lore from item using mod?

  • Author

Ok. What I can do with this info?
No examples. Really. Help me.

  • Author

I understand how to create my own NBT file, but how to use exist one?

  • Author

How to get it?
 

public int someCheck(EntityPlayer player, String lorePar) {
		ItemStack item = new ItemStack(Item.swordDiamond, 1);
		ItemStack itemInHand = player.inventory.getCurrentItem();
		List<String> lore = itemInHand.// <--------- ;
		if(item.equals(itemInHand) && lore!=null && lore.contains(lorePar)){
			return 1;
		}
		return 0;
	}

 

Edited by YAULTMA

  • Author

Please tell me how to get List<String> from Item, I can't understand how to move through NBT tree

What about this?
 

ItemStack itemInHand = player.inventory.getCurrentItem();
		NBTTagList nbt = itemInHand.getTagCompound().getCompoundTag("display").getTagList("Lore");
		if (nbt != null){
			ArrayList<String> lore = new ArrayList<String>();
			lore.add("a");
			for(int i = 0; i < nbt.tagCount(); i++){
				lore.add(nbt.tagAt(i).toString());
			}
			if(item.equals(itemInHand) && lore!=null && lore.contains(lorePar)){
				return 1;
			}
        }

 

Edited by YAULTMA

  • Author

Like this?

public int someCheck(EntityPlayer player, String lorePar, Item item) {
		ItemStack itemInHand = player.inventory.getCurrentItem();
		NBTTagList nbt = itemInHand.getTagCompound().getCompoundTag("display").getCompoundTag("Lore").getTagList("TAG_STRING");
		if (nbt != null){
			ArrayList<String> lore = new ArrayList<String>();
			for(int i = 0; i < nbt.tagCount(); i++){
				lore.add(nbt.tagAt(i).getName());
			}
			if(item.equals(itemInHand) && lore!=null && lore.contains(lorePar)){
				return 1;
			}
		}
		return 0;
	}

 

  • Guest locked this topic
Guest
This topic is now closed to further replies.

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.