Dungeon loot api?

Discussion in 'Plugin Development' started by raum, Jan 30, 2016.

Thread Status:
Not open for further replies.
  1. Offline

    raum

    Is there any way to access and/or change the dungeon loot tables? That is, the automatic chests that load in spawner dungeons, or nether forts - I can't seem to locate much information on it, and with such vague search terms (dungeon, loot, chest :p) not much is coming up. (Well, a ton is coming up - just nothing relevant)

    I see there are a lot of plugins to make new dungeons, and new loot tables and such, but these don't seem to access the actual 'in game' list - they call something else completely and never refer back to the vanilla tables at all.

    Glancing through the java docs, I found nothing even sort of helpful for this case - I had assumed there'd be some sort of info found in the ChunkGenerator class somewhere, as the dungeons are created when the chunk is, but I'm either missing it, or it's not there.

    While being able to CHANGE the loot list would be great, that's not 100% needed - I'm mostly interested in just accessing it.

    Thanks!
     
  2. Offline

    darthteddy1

    Pretty sure that is not editable. What you COULD do, is make a random loot table when opening any chest, that is on top of Mossy Cobblestone (and or near a spawner)
     
    raum likes this.
  3. Offline

    Lightspeed

    If you can override permissions checks(Big permission plugins) I'm sure you can someone override chest spawns?

    I would love to know how to override permission checks or really anything(Thats not simple like well permission checks).
     
  4. @raum
    Not possible, unless you want to edit final fields in NMS world generators. You can listen for ChunkPopulateEvent, and get the tile entities within that chunk. If the tile entity is a chest, clear its inventory and fill it with your own items.
     
    raum likes this.
  5. Offline

    raum

    Thanks for the responses. No way of checking the list of loot in the table either?

    * The purpose for this is mostly experimental, but I wanted a way to pull up the actual list of items and weights (if that comes into it) to reproduce into a chest whenever I wanted and have it have "real" loot in it, as if the game spawned it, rather than a fabrication that was remade.
     
    Last edited: Jan 31, 2016
  6. @raum
    Download this repository:
    https://github.com/Bukkit/mc-dev

    and find the world generator classes. For example, WorldGenDungeons.java. The field "a" is the loot table for the chests. You can check StructurePieceTreasure.java to if you don't know what the parameters are.

    This should give you a good idea of how the loot table works. I've written a custom loot table system for naturally generated chests, you can message me if you're interested.
     
    Lightspeed likes this.
Thread Status:
Not open for further replies.

Share This Page