Uploaded image for project: 'Spigot'
  1. Spigot
  2. SPIGOT-4724

Map Material and InventoryType against each other

XMLWordPrintable

    • Icon: New Feature New Feature
    • Resolution: Unresolved
    • Icon: Minor Minor
    • None
    • None
    • This server is running CraftBukkit version git-Spigot-1a3504a-a46fdbc (MC: 1.13.2) (Implementing API version 1.13.2-R0.1-SNAPSHOT)
    • Yes

      This is rather a convenience method, but I thought that a bidirectional mapping of Material and InventoryType could make some code easier. Also, this would allow for easily getting all materials that will open an Inventory when clicked on, which is helpful because manually adding all these Materials is a pain with all the different colors of shulker boxes.

      I.e. create a method

      Material#getOpenedInventoryType()

      to get the opened InventoryType, e.g.

      Material.ANVIL.getOpenedInventoryType() == InventoryType.ANVIL

      as well as InventoryType#getMaterialToOpen() which does the same in the other direction.

       

      One should probably note in the Javadoc that calling both methods might not return the initial input, e.g.:

      Material.TRAPPED_CHEST.getOpenedInventoryType().getMaterialToOpen() == Material.CHEST

      because there is no dedicated InventoryType for trapped chests.

            Unassigned Unassigned
            Photon Photon
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

              Created:
              Updated: