Uploaded image for project: 'Minecraft API'
  1. Minecraft API
  2. MCAPI-83

Support for custom treasure loot

    XMLWordPrintable

    Details

      Description

      Proposed Addition:
      Developers should be able to add custom items and blocks to dungeon, stronghold, village, mineshaft, and temple treasure chests.

      Additionally, they should be able to add their own chest-containing structure types to the list of treasure types, or get a random item from the list for a certain type.

      Specific Features:

      • A method such as addItemToLoot(String structureType, Item item (or Block block), int rarity, int minstack, int maxstack)
        • structureType is the structure to add the loot to, such as "DUNGEON", "STRONGHOLD", "BLACKSMITH", "MINESHAFT", "JUNGLE_TEMPLE", "DESERT_PYRAMID", or "ALL".
          • Although an Enum would work fine for vanilla loot options only, the ability to add custom structure types may work better with strings, as it could ignore any structure type that doesn't exist without crashing.
        • item (or block) is, obviously, the item or block to add to the list of loot
        • rarity is how common the item or block should be
        • minstack is the smallest stack size to appear in any given chest, usually 1
        • maxstack is the largest stack size to appear in any given chest
      • A method such as getRandomLoot(String structureType), which returns an ItemStack from the list for the given structure (stacksize 0 and itemID 0 if the structure type does not exist)
      • A method such as addLootType(String structureType), which adds a new loot option to the list that addItemToLoot and getRandomLoot read from

      Justification and Use Case:
      The ability to allow custom items to be placed in structures gives extra depth to any mod that uses it, and provides extra motivation to go dungeon hunting / mineshaft searching / stronghold raiding. Why should you be stuck with redstone dust and gunpowder and saddles when you could also add portal guns or lightning staffs?

      The other two options allow simpler creation of custom treasure for generated structures in the world. It can be done internally by adding a lot of extra code, and indeed many mods already do this, but having an official function in the API for it would smooth things over and stop unnecessary repetition when multiple mods in one client or server do it.

      Challenges Faced:
      None discovered at this time. The popular Minecraft Forge API has similar hooks to addItemToLoot and getRandomLoot for dungeon chests.

        Attachments

          Activity

            People

            • Assignee:
              Unassigned
              Reporter:
              qwertygiy J H
            • Votes:
              1 Vote for this issue
              Watchers:
              2 Start watching this issue

              Dates

              • Created:
                Updated: