Just Enough Resources (JER)

Just Enough Resources (JER)

163M Downloads

[1.19.2] Failed loading villager cartographer registered at cartographer

HalcyonSeas73 opened this issue ยท 1 comments

commented

JER version: 1.2.0.188
JEI version: 11.4.0.286
Forge: 43.1.53
Minecraft: 1.19.2

[snip]

[08:02:20] [Render thread/INFO] [me.je.co.lo.PluginCaller/]: Registering categories: minecraft:jeresources ...
[08:02:20] [Render thread/WARN] [jeresources/]: Failed loading villager cartographer registered at cartographer
[08:02:20] [Render thread/WARN] [jeresources/]: Exception caught when registering villager
java.lang.NullPointerException: Cannot read field "f_19853_" because "p_219708_" is null
	at net.minecraft.world.entity.npc.VillagerTrades$TreasureMapForEmeralds.m_213663_(VillagerTrades.java:877) ~[client-1.19.2-20220805.130853-srg.jar%23208!/:?] {re:classloading}
	at jeresources.collection.TradeList.addMerchantRecipe(TradeList.java:58) ~[JustEnoughResources-1.19.2-1.2.0.188.jar%23169!/:1.2.0.188] {re:classloading}
	at jeresources.collection.TradeList.addITradeList(TradeList.java:69) ~[JustEnoughResources-1.19.2-1.2.0.188.jar%23169!/:1.2.0.188] {re:classloading}
	at jeresources.entry.AbstractVillagerEntry.addITradeLists(AbstractVillagerEntry.java:30) ~[JustEnoughResources-1.19.2-1.2.0.188.jar%23169!/:1.2.0.188] {re:classloading}
	at jeresources.entry.AbstractVillagerEntry.<init>(AbstractVillagerEntry.java:23) ~[JustEnoughResources-1.19.2-1.2.0.188.jar%23169!/:1.2.0.188] {re:classloading}
	at jeresources.entry.VillagerEntry.<init>(VillagerEntry.java:19) ~[JustEnoughResources-1.19.2-1.2.0.188.jar%23169!/:1.2.0.188] {re:classloading}
	at jeresources.util.VillagersHelper.initRegistry(VillagersHelper.java:23) ~[JustEnoughResources-1.19.2-1.2.0.188.jar%23169!/:1.2.0.188] {re:classloading}
	at jeresources.compatibility.Compatibility.init(Compatibility.java:33) ~[JustEnoughResources-1.19.2-1.2.0.188.jar%23169!/:1.2.0.188] {re:classloading}
	at jeresources.proxy.CommonProxy.initCompatibility(CommonProxy.java:14) ~[JustEnoughResources-1.19.2-1.2.0.188.jar%23169!/:1.2.0.188] {re:classloading}
	at jeresources.jei.JEIConfig.registerCategories(JEIConfig.java:98) ~[JustEnoughResources-1.19.2-1.2.0.188.jar%23169!/:1.2.0.188] {re:classloading}
	at mezz.jei.common.load.PluginLoader.lambda$createRecipeCategories$3(PluginLoader.java:137) ~[jei-1.19.2-forge-11.4.0.286.jar%23167!/:11.4.0.286] {re:classloading}
	at mezz.jei.common.load.PluginCaller.callOnPlugins(PluginCaller.java:25) ~[jei-1.19.2-forge-11.4.0.286.jar%23167!/:11.4.0.286] {re:classloading}
	at mezz.jei.common.load.PluginLoader.createRecipeCategories(PluginLoader.java:137) ~[jei-1.19.2-forge-11.4.0.286.jar%23167!/:11.4.0.286] {re:classloading}
	at mezz.jei.common.load.PluginLoader.createRecipeManager(PluginLoader.java:164) ~[jei-1.19.2-forge-11.4.0.286.jar%23167!/:11.4.0.286] {re:classloading}
	at mezz.jei.common.startup.JeiStarter.start(JeiStarter.java:88) ~[jei-1.19.2-forge-11.4.0.286.jar%23167!/:11.4.0.286] {re:classloading}
	at mezz.jei.forge.startup.ClientLifecycleHandler.startJei(ClientLifecycleHandler.java:90) ~[jei-1.19.2-forge-11.4.0.286.jar%23167!/:11.4.0.286] {re:classloading}
	at mezz.jei.forge.startup.StartEventObserver.transitionState(StartEventObserver.java:137) ~[jei-1.19.2-forge-11.4.0.286.jar%23167!/:11.4.0.286] {re:classloading}
	at mezz.jei.forge.startup.StartEventObserver.onEvent(StartEventObserver.java:100) ~[jei-1.19.2-forge-11.4.0.286.jar%23167!/:11.4.0.286] {re:classloading}
	at net.minecraftforge.eventbus.EventBus.doCastFilter(EventBus.java:260) ~[eventbus-6.0.3.jar%23106!/:?] {}
	at net.minecraftforge.eventbus.EventBus.lambda$addListener$11(EventBus.java:252) ~[eventbus-6.0.3.jar%23106!/:?] {}
	at net.minecraftforge.eventbus.EventBus.post(EventBus.java:315) ~[eventbus-6.0.3.jar%23106!/:?] {}
	at net.minecraftforge.eventbus.EventBus.post(EventBus.java:296) ~[eventbus-6.0.3.jar%23106!/:?] {}
	at net.minecraft.client.multiplayer.ClientPacketListener.m_5859_(ClientPacketListener.java:1321) ~[client-1.19.2-20220805.130853-srg.jar%23208!/:?] {re:mixin,pl:accesstransformer:B,pl:runtimedistcleaner:A,re:classloading,pl:accesstransformer:B,pl:mixin:A,pl:runtimedistcleaner:A}
	at net.minecraft.network.protocol.game.ClientboundUpdateTagsPacket.m_5797_(ClientboundUpdateTagsPacket.java:35) ~[client-1.19.2-20220805.130853-srg.jar%23208!/:?] {re:classloading}
	at net.minecraft.network.protocol.game.ClientboundUpdateTagsPacket.m_5797_(ClientboundUpdateTagsPacket.java:11) ~[client-1.19.2-20220805.130853-srg.jar%23208!/:?] {re:classloading}
	at net.minecraft.network.protocol.PacketUtils.m_131356_(PacketUtils.java:22) ~[client-1.19.2-20220805.130853-srg.jar%23208!/:?] {re:classloading}
	at net.minecraft.util.thread.BlockableEventLoop.m_6367_(BlockableEventLoop.java:157) ~[client-1.19.2-20220805.130853-srg.jar%23208!/:?] {re:mixin,pl:accesstransformer:B,re:computing_frames,pl:accesstransformer:B,re:classloading,pl:accesstransformer:B}
	at net.minecraft.util.thread.ReentrantBlockableEventLoop.m_6367_(ReentrantBlockableEventLoop.java:23) ~[client-1.19.2-20220805.130853-srg.jar%23208!/:?] {re:mixin,re:computing_frames,re:classloading}
	at net.minecraft.util.thread.BlockableEventLoop.m_7245_(BlockableEventLoop.java:131) ~[client-1.19.2-20220805.130853-srg.jar%23208!/:?] {re:mixin,pl:accesstransformer:B,re:computing_frames,pl:accesstransformer:B,re:classloading,pl:accesstransformer:B}
	at net.minecraft.util.thread.BlockableEventLoop.m_18699_(BlockableEventLoop.java:116) ~[client-1.19.2-20220805.130853-srg.jar%23208!/:?] {re:mixin,pl:accesstransformer:B,re:computing_frames,pl:accesstransformer:B,re:classloading,pl:accesstransformer:B}
	at net.minecraft.client.Minecraft.m_91383_(Minecraft.java:1072) ~[client-1.19.2-20220805.130853-srg.jar%23208!/:?] {re:mixin,pl:accesstransformer:B,pl:runtimedistcleaner:A,re:classloading,pl:accesstransformer:B,pl:mixin:APP:bookshelf.common.mixins.json:client.AccessorMinecraft,pl:mixin:APP:balm.mixins.json:MinecraftMixin,pl:mixin:APP:mixins.ipnext.json:MixinMinecraftClient,pl:mixin:A,pl:runtimedistcleaner:A}
	at net.minecraft.client.Minecraft.m_91374_(Minecraft.java:700) ~[client-1.19.2-20220805.130853-srg.jar%23208!/:?] {re:mixin,pl:accesstransformer:B,pl:runtimedistcleaner:A,re:classloading,pl:accesstransformer:B,pl:mixin:APP:bookshelf.common.mixins.json:client.AccessorMinecraft,pl:mixin:APP:balm.mixins.json:MinecraftMixin,pl:mixin:APP:mixins.ipnext.json:MixinMinecraftClient,pl:mixin:A,pl:runtimedistcleaner:A}
	at net.minecraft.client.main.Main.m_239872_(Main.java:212) ~[client-1.19.2-20220805.130853-srg.jar%23208!/:?] {re:classloading,pl:runtimedistcleaner:A}
	at net.minecraft.client.main.Main.main(Main.java:51) ~[client-1.19.2-20220805.130853-srg.jar%23208!/:?] {re:classloading,pl:runtimedistcleaner:A}
	at jdk.internal.reflect.DirectMethodHandleAccessor.invoke(Unknown Source) ~[?:?] {}
	at java.lang.reflect.Method.invoke(Unknown Source) ~[?:?] {}
	at net.minecraftforge.fml.loading.targets.CommonClientLaunchHandler.lambda$launchService$0(CommonClientLaunchHandler.java:27) ~[fmlloader-1.19.2-43.1.53.jar%23122!/:?] {}
	at cpw.mods.modlauncher.LaunchServiceHandlerDecorator.launch(LaunchServiceHandlerDecorator.java:30) [modlauncher-10.0.8.jar%23109!/:?] {}
	at cpw.mods.modlauncher.LaunchServiceHandler.launch(LaunchServiceHandler.java:53) [modlauncher-10.0.8.jar%23109!/:?] {}
	at cpw.mods.modlauncher.LaunchServiceHandler.launch(LaunchServiceHandler.java:71) [modlauncher-10.0.8.jar%23109!/:?] {}
	at cpw.mods.modlauncher.Launcher.run(Launcher.java:106) [modlauncher-10.0.8.jar%23109!/:?] {}
	at cpw.mods.modlauncher.Launcher.main(Launcher.java:77) [modlauncher-10.0.8.jar%23109!/:?] {}
	at cpw.mods.modlauncher.BootstrapLaunchConsumer.accept(BootstrapLaunchConsumer.java:26) [modlauncher-10.0.8.jar%23109!/:?] {}
	at cpw.mods.modlauncher.BootstrapLaunchConsumer.accept(BootstrapLaunchConsumer.java:23) [modlauncher-10.0.8.jar%23109!/:?] {}
	at cpw.mods.bootstraplauncher.BootstrapLauncher.main(BootstrapLauncher.java:141) [bootstraplauncher-1.1.2.jar:?] {}
	at jdk.internal.reflect.DirectMethodHandleAccessor.invoke(Unknown Source) ~[?:?] {}
	at java.lang.reflect.Method.invoke(Unknown Source) ~[?:?] {}
	at io.github.zekerzhayard.forgewrapper.installer.Main.main(Main.java:57) [ForgeWrapper-mmc3.jar:mmc3] {}
	at jdk.internal.reflect.DirectMethodHandleAccessor.invoke(Unknown Source) ~[?:?] {}
	at java.lang.reflect.Method.invoke(Unknown Source) ~[?:?] {}
	at org.multimc.onesix.OneSixLauncher.launchWithMainClass(OneSixLauncher.java:214) [NewLaunch.jar:?] {}
	at org.multimc.onesix.OneSixLauncher.launch(OneSixLauncher.java:249) [NewLaunch.jar:?] {}
	at org.multimc.EntryPoint.listen(EntryPoint.java:143) [NewLaunch.jar:?] {}
	at org.multimc.EntryPoint.main(EntryPoint.java:34) [NewLaunch.jar:?] {}
[08:02:20] [Render thread/INFO] [me.je.co.lo.PluginCaller/]: Registering categories: minecraft:jeresources took 351.1 ms

[/snip]

commented

I fixed these null errors with these two changes:

AbstractVillagerEntry:

    protected boolean reCreate; // new

    public AbstractVillagerEntry(Int2ObjectMap<VillagerTrades.ItemListing[]> itemListings) {
        this.tradeList = new LinkedList<>();
        getVillagerEntity(); // new
        reCreate = true; // new
        addITradeLists(itemListings);
    }

VillagerEntry:

    @Override
    public Villager getVillagerEntity() {
        if (this.entity == null || reCreate) { // changed
            /*
             * level must be a client level here.
             * Passing in a ServerLevel can allow villagers to load all kinds of things,
             * like in the `VillagerTrades.TreasureMapForEmeralds` which loads chunks!
             */
            this.entity = EntityType.VILLAGER.create(CompatBase.getLevel());
            assert this.entity != null;
            this.entity.setVillagerData(this.entity.getVillagerData().setProfession(this.profession));
            reCreate = false; // new
        }
        return this.entity;
    }

The reCreate is required because otherwise the villagers will be missing their textures

Before:
image

After:
image