emilyploszaj / emi

A featureful and accessible item and recipe viewer
MIT License
220 stars 46 forks source link

Registry adapters do not work with dynamic registries #527

Closed Abbie5 closed 2 days ago

Abbie5 commented 2 months ago

Using this code: (BiomeEmiStack is my own class)

    @Override
    public void initialize(EmiInitRegistry registry) {
        Registry<Biome> biomeRegistry = Minecraft.getInstance().level.registryAccess().registryOrThrow(Registries.BIOME);

        registry.addRegistryAdapter(EmiRegistryAdapter.simple(Biome.class, biomeRegistry, BiomeEmiStack::of));
    }

Produces this error upon joining a world:

[20:10:00] [Thread-12/ERROR] (EMI) [EMI] java.lang.NullPointerException: Cannot invoke "net.minecraft.core.Registry.getTag(net.minecraft.tags.TagKey)" because "registry" is null
    at dev.emi.emi.EmiUtil.values(EmiUtil.java:63)
    at dev.emi.emi.registry.EmiTags.reloadTags(EmiTags.java:249)
    at dev.emi.emi.registry.EmiTags.reload(EmiTags.java:243)
    at dev.emi.emi.runtime.EmiReloadManager$ReloadWorker.run(EmiReloadManager.java:171)
    at java.base

Full log: latest.log

Versions used:

emilyploszaj commented 2 months ago

Should be resolved in the latest release

Abbie5 commented 1 month ago

still occurs on 1.1.6+1.19.2

emilyploszaj commented 2 weeks ago

Can you upload a log? I thought I fixed this and marked it as fixed in 1.1.7 but I don't think I actually did

Abbie5 commented 2 weeks ago

tested with EMI 1.1.7+1.19.2, still occurs. log attached latest.log

emilyploszaj commented 2 days ago

I found out why it was difficult to debug this, it was working on all versions except 1.19.2 specifically, should be resolved in 1.1.10