Skip to content
This repository has been archived by the owner on Dec 31, 2021. It is now read-only.

Add an immutable item api #25

Open
1 of 12 tasks
Techcable opened this issue Jun 20, 2016 · 1 comment
Open
1 of 12 tasks

Add an immutable item api #25

Techcable opened this issue Jun 20, 2016 · 1 comment
Assignees

Comments

@Techcable
Copy link
Member

Techcable commented Jun 20, 2016

An immutable item API is necessary for us to replace bukkit's item api.
We should use inheritance, so items inherit from an abstract 'Item' class, avoiding the ItemMeta disaster.
With builders and withers, its an easy one-liner to construct them, even though they are immutable:

Item.builder(server, Materials.TACO)
        .tasty(true)
        .addEnchantment(EnchantmentTypes.SUPER_YUMMY, Integer.MAX_VALUE)
        .build()
  • AbstractItem (actually called 'Item')
  • nbt values/ItemMeta
    • Banner
    • Book
    • EnchantedBook
      • This is to represent the fact that the enchantments in enchanted books are not 'normal' enchants, they are 'stored' enchants
    • FireworkEffect
    • Firework
    • LeatherArmor
    • MapItem
    • PotionMeta
    • SkullMeta
    • SpawnerMeta
    • SpawnEggMeta
  • data value abstractions
    • TODO
@Techcable Techcable self-assigned this Jun 20, 2016
@Techcable Techcable added this to the Bukkit feature parity milestone Jun 20, 2016
Techcable added a commit that referenced this issue Jun 20, 2016
Tons of useful utility methods to make withering/building new itemstacks easy.
Also add enchantments.

In the future item _metadata_ may be mutable if we decide to.
@phase
Copy link
Member

phase commented Jun 20, 2016

Why is the server needed in the builder? I know plugin an just call Fountain.getServer, but why not do that in the constructor of the builder? What other server is possible?

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

No branches or pull requests

2 participants