CoolLord22 / OtherDrops1.13

OtherDrops branch for the latest Minecraft version!
GNU General Public License v3.0
0 stars 5 forks source link

Support for ItemFlags #45

Open ImBas opened 4 months ago

ImBas commented 4 months ago

Hi there,

As mentioned on the Discord, it would be amazing to see support for ItemFlags added to OtherDrops (reference: https://hub.spigotmc.org/javadocs/bukkit/org/bukkit/inventory/ItemFlag.html)

For example, this would allow to create an item like the one below, and hide the unbreaking X enchant: ITEM@!UNBREAKING#10@!~&aItem name;&7Item lore;

Possible idea to implement this while respecting the current format could be to have it after enchants, like: ITEM@!UNBREAKING#10!HIDE_ENCHANTS#true!HIDE_ATTRIBUTES#true@!~&aItem name;&7Item lore; (or 1 for true 0 for false, just an idea though)

Thanks!

EDIT: If anyone stumbles upon this post, it's now possible to do it like below:

    # Example with hide enchant and hide attributes flags, showing usage with enchantments and custom name/lore
    drop: diamond_sword@hide_enchants;HIDE_ATTRIBUTES;unbreaking#2!sharpness#3!~name?;lore?;testing attribute in lore;hide_enchants
CoolLord22 commented 4 months ago

TODO: Look into adding item flag specification for tools as well, to allow restriction for items with item flags on interaction/use triggers

CoolLord22 commented 1 month ago

Rather than adding itemflag specification into tools, consider using new OD ItemStack type See 58728e2b5c49092a9fd298e268d3b13f18334bfa

If you get the tool w/ the flags desired in-game and use /od saveitem speedsword you can then reference it within OD!

See example in OD below

    ANY_BLOCK:
      - trigger: RIGHT_CLICK
        tool: OD_ITEM@speedsword
        message: "&aSuccessfully clicked with your tool!"

See serialized ItemStack below


speedsword:
  ==: org.bukkit.inventory.ItemStack
  v: 3218
  type: DIAMOND_SWORD
  meta:
    ==: ItemMeta
    meta-type: UNSPECIFIC
    display-name: '["",{"text":"Test Name","italic":false}]'
    lore:
    - '["",{"text":"Giving Lore","italic":false}]'
    attribute-modifiers:
      GENERIC_MOVEMENT_SPEED:
      - ==: org.bukkit.attribute.AttributeModifier
        amount: 1.0
        name: '1728939246870'
        slot: HAND
        uuid: fffe180e-0000-9bc6-0002-84a2fffec874
        operation: 0