Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Loonium with data-driven structure loot #4639

Merged

Conversation

TheRealWormbo
Copy link
Collaborator

@TheRealWormbo TheRealWormbo commented May 10, 2024

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
Copy link
Collaborator Author

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

@TheRealWormbo TheRealWormbo force-pushed the 1.20-loonium-structures branch 2 times, most recently from 8813fdc to 272d340 Compare May 18, 2024 17:27
@TheRealWormbo TheRealWormbo marked this pull request as draft May 20, 2024 19:13
@TheRealWormbo TheRealWormbo force-pushed the 1.20-loonium-structures branch 4 times, most recently from 0819447 to 2fed3ca Compare May 24, 2024 21:55
@TheRealWormbo TheRealWormbo marked this pull request as ready for review May 26, 2024 10:43
@TheRealWormbo TheRealWormbo force-pushed the 1.20-loonium-structures branch 2 times, most recently from 7344086 to a088bac Compare June 19, 2024 22:46
@TheRealWormbo TheRealWormbo force-pushed the 1.20-loonium-structures branch 2 times, most recently from ca9e6a4 to 1c516fd Compare July 4, 2024 18:55
@artemisSystem
Copy link
Member

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.

TheRealWormbo and others added 24 commits October 5, 2024 17:00
Loonium figures out which structures(s) it was placed in and uses a corresponding list of loot tables with the id `botania:loonium/<structure_namespace>/<structure_path>`. If the flower is placed in overlapping pieces of multiple structures with configured loot tables, it randomly chooses one of the tables whenever it spawns a mob.
The Loonium drop capability is now attached to all mob entities, in preparation of customizable mob pools. Default equipment slot drops are turned off.

TODO: Define loot tables for relevant vanilla structures.
TODO: Define structure configuration data (JSON, likely separate registry) for the spawnable mob pool and whether the flower must be placed within a structure piece or anywhere within the structure's overall bounding box, maybe even the amount of mana per spawned mob.
TODO: Move default configuration to a default structure configuration entry.
(can't be detected reliably)
- tweak ancient table selection city weights
- fix reference to elder guardian drops loot table
- remove type specification on Loonium loot tables, as it caused validation warnings
(includes a generic reloadable config data manager, which currently only covers Loonium configurations)
(covers e.g. the skeleton from a spider jockey or the bonus chicken for some baby zombies)
(such as skeletons from a spider jockey or chickens from a zombie jockey, provided they are in the spawned mobs list)
- move inner config classes to own files
- add builders where appropriate
- simplify optional field definitions in codecs where possible, and remove constructors with Optional arguments
Equipment tables are not vanilla yet, so they currently use the "selector" loot table type and are applied manually by the Loonium.
Nested loot table definitions also currently need to be loot table references, since embedded tables as pool entries are not supported by vanilla yet either.
- mobs are spawned on a unique team, which means even Loonium-spawned zoglins don't attack other Loonium-spawned mobs
- new challenge advancement "King" requires killing each of the currently 22 different mobs the Loonium spawns in different structures
- var -> explicit type, unless it's obvious from a constructor call
- extracted API interface for ConfigDataManager
- replace "drop nothing" flag in LooniumComponent with "override drop"; mobs will drop whatever is defined as "to drop" when that flag is set
- don't bother creating specialized map types for detected structures
- adjust variable names in renderHUD code
- replaced some manually validated attribute CODECs with corresponding predefined ExtraCodecs variants
- allow configured mana cost for a structure to be zero
- add default translation for botania:loonium_offhand_equipment tag
@artemisSystem artemisSystem force-pushed the 1.20-loonium-structures branch from 39cc716 to 92cba74 Compare October 6, 2024 09:38
@artemisSystem
Copy link
Member

I think we're good to go...

@artemisSystem artemisSystem merged commit 5f4be49 into VazkiiMods:1.20.x Oct 6, 2024
1 check passed
@artemisSystem
Copy link
Member

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

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

Successfully merging this pull request may close these issues.

2 participants