Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use named items for tools #33

Open
Peter200lx opened this issue Nov 3, 2013 · 2 comments
Open

Use named items for tools #33

Peter200lx opened this issue Nov 3, 2013 · 2 comments

Comments

@Peter200lx
Copy link
Owner

Minecraft has support for named items.

http://minecraft.gamepedia.com/Anvil#Renaming

This can be used to make ToolBelt only listen to specific items instead of all ____ (bone, golden shovel, etc)

Also the items can have descriptions, handy for giving usage instructions.

Originally suggested by Jadedwolf

@Peter200lx
Copy link
Owner Author

Also worth investigating, this might mean that the paint tool can now listen to a specific paint name instead of an action bar slot.

@Jadedwolf
Copy link

Here is an example I use to use the lore data of an item for a specific event. So only if the item has that lore will the event fire.

    @EventHandler
    public void onShoot(EntityShootBowEvent e) {
        ArrayList loreData = new ArrayList();
        loreData.add("Feel the Wither Within as you pull!");
        Player player = (Player) e.getEntity();
        if (e.getEntity() == null) {
            return;
        }
        if ((e.getBow().getItemMeta().hasLore())
                && (e.getBow().getItemMeta().getLore().equals(loreData))) {
            Player p = (Player) e.getEntity();
            e.setCancelled(true);
            ((WitherSkull) p.launchProjectile(WitherSkull.class)).setVelocity(e.getProjectile().getVelocity());
            p.removePotionEffect(PotionEffectType.WITHER);
            p.getWorld().playEffect(p.getLocation(), Effect.MOBSPAWNER_FLAMES, 5);
        }
    }

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants