Ultimate Car Mod

Ultimate Car Mod

13M Downloads

SlotPainter's implementation may cause NPE when other mods invoke mayPickup in MouseButtonPressed.Pre Event

lcy0x1 opened this issue ยท 1 comments

commented

In the following lines:

public boolean mayPickup(Player player) {
setPainterID(index);
if (player.level().isClientSide) {
Minecraft.getInstance().setScreen(null);
}
return false;
}

Here you invoke Minecraft.getInstance().setScreen(null); in mayPickup. This means, if some other mods invoke SlotPainter::mayPickup in ScreenEvent.MouseButtonPressed.Pre, Minecraft.getInstance().screen will be null, and will crash when MouseHandler line 92 this.minecraft.screen.mouseClicked(d0, d1, i); is called (which is where you would normally expect mayPickup to be called).

commented

I have fixed the conflict in my part by moving allowModification (which invokes mayPickup) calls after item instanceof check, but please fix this issue. Otherwise other mods will have conflicts as well.