Botania icon indicating copy to clipboard operation
Botania copied to clipboard

Loonium with data-driven structure loot

Open TheRealWormbo opened this issue 1 year ago • 1 comments

Implementation for structure detection and structure-specific loot tables and mob spawning pools, customizable via data packs.

  • structure-specific loot tables are identified by the structure ID (e.g. for minecraft:pillager_outpost the custom Loonium loot table is located at data/botania/loot_tables/loonium/minecraft/pillager_outpost.json), with a default loot table corresponding to dungeon loot (located at data/botania/loot_tables/loonium/default.json)
    • default loot tables are created with Datagen
    • loot tables usually just reference original chest or entity loot tables related to each structure, so Loonium loot can be modified separately from the loot found in those structures
  • structure-specific Loonium configurations are identified the same way (e.g. for minecraft:pillager_outpost the custom configuration is located at data/minecraft/config/loonium/pillager_outpost.json) with a default configuration (located at data/botania/config/loonium/default.json) acting as fallback
    • default configurations are created via Datagen
    • configurations can reference a parent configuration and only override individual aspects of the referenced configuration
    • configurations consist of mana cost to spawn a mob, how many mobs of spawnable types are allowed around the flower, whether the Loonium must be placed in the overall bounding box or an individual piece of the structure, the weighted list of mobs to spawn, a list of potion effects to apply to spawned mobs, and a list of attribute modifiers to apply to the mobs
      • attribute and effect lists can be overridden for individual mobs
      • custom NBT data can be defined for individual mobs (used to make a Creeper spawn charged)
      • equipment loot tables can be specified for each spawnable mob (this will be a vanilla feature in later Minecraft versions, although the implementation here is slightly tweaked from what Trial Chambers use)
  • expanded wand HUD to indicate whether a Loonium generates structure-specific loot
  • added lexicon mention of the structure-specific behavior
  • fixed the mob location selection logic to prevent mobs from immediately starting to suffocate
  • added a new challenge advancement for killing every mob type in the structure configurations added with this change
  • mobs spawned by the Loonium are put onto a unique team so they don't just start attacking each other (because there are zoglins in some of the mob spawn pools; Heisei Dream may need a future upgrade to support overriding teams allegiances)

TheRealWormbo avatar May 10 '24 19:05 TheRealWormbo

Supersedes #4313, but is only loosely based on that PR.

TheRealWormbo avatar May 10 '24 19:05 TheRealWormbo

Writing this comment as i'm going through the review:

for minecraft:pillager_outpost the custom configuration is located at data/minecraft/config/loonium/pillager_outpost.json

Why not data/botania/config/loonium/minecraft/pillager_outpost.json? The current location doesn't actually specify botania anywhere (only botania thing is the loonium folder), which maybe doesn't matter that much, but seems off to me at least. Changing it to my suggestion would also make it more consistent with the loot table locations.

Actually, what if we made the loot table specifiable in the config? Then, if you're just referencing something, you can point to it directly without creating a new loot table file, and if you want to make something custom, you can reference any custom loot table. Then the config becomes the only "magic" resource location, instead of having two. Thoughts?

(this will be a vanilla feature in later Minecraft versions, although the implementation here is slightly tweaked from what Trial Chambers use)

What's different? Will/should our implementation change to match more closely with vanilla in 1.21? Or will we be able to reuse vanilla code?

whether the Loonium must be placed in the overall bounding box or an individual piece of the structure

Realizing on a second read that this means any individual piece of a structure, right? Vs the cuboid bounding box that encompasses the whole structure. But the way i first interpreted this made me think: Is it possible to detect which structure piece you're in? I guess it would depend on the structure type, i don't know too much about structures, but there's at least jigsaw placement with pieces. Are there other, non-jigsaw ways to make a structure? Anyway, different configs for individual structure pieces would be cool to have, though maybe that could be an additional change later.

artemisSystem avatar Aug 04 '24 18:08 artemisSystem

Not sure if it's mentioned in-thread, but i had an idea to make a loot table entry type that takes another as input and makes it output a single item, so we don't need to hardcode that functionality. But in 1.20.1, loot tables are still manually serialized and i don't think there's a registry for loot table entry types. There is a registry for them in 1.21 though, so we can make that change then.

artemisSystem avatar Oct 05 '24 09:10 artemisSystem

I think we're good to go...

artemisSystem avatar Oct 06 '24 15:10 artemisSystem

Again, thanks a bunch for this, i think this turned out really cool

artemisSystem avatar Oct 06 '24 15:10 artemisSystem