Open Lanse505 opened 1 week ago
I can actually see this being useful in my mod's case soon too, I can't see this PR being too difficult at all, I'll sketch up a draft PR when I get home
While we're adding this to these events, might as well also add RegistryAccess
to RegisterBrewingRecipesEvent
too (would be nice for me, as I have a mod that needs to be installed on both client and server and would like to add data-pack potion recipes)
@Lanse505 PR for it done, should be merged in a couple days if no other additions or changes are needed
Created an issue per @sciwhiz12 's recommendation/request.
Feature Suggestion: Provide
RegistryAccess
forVillagerTradesEvent
andWandererTradesEvent
Currently, neither the VillagerTradesEvent nor the WandererTradesEvent has access to a
RegistryAccess
instance. This limitation affects mods that rely onDatapackRegistry
values to create specificItemStack
objects. According to the documentation, both events are triggered during reload by the TagsUpdatedEvent. However, neither event inherits fromTagsUpdatedEvent
nor receives a reference toRegistryAccess
, making it impossible to access data from datapack registries.Example Use Case
In my current mod, I have a "Drone/Princess/Queen"-variant item that contains all the species information and attributes as part of a
Genome
object (stored as a DataComponent), which is generated from theIAllele
representing the species. Since IAllele is aDatapackRegistry
object, I am unable to access theIAllele
from theDatapackRegistry
using its correspondingResourceKey<IAllele>
.Proposed Solution
While it is possible to access the server instance through
ServerLifecycleHooks
, a more elegant solution would be to pass down theRegistryAccess
provided by theTagsUpdatedEvent
at some point in the event chain. This would make it easier to have access to datapack registries and allow mod developers to utilizeDatapackRegistry
values more effectively.