mega12345mega / NBT-Editor

Edit items, blocks, and entities in-game.
MIT License
46 stars 14 forks source link

Crash on space-press in inventory #5

Closed sudofox closed 2 years ago

sudofox commented 2 years ago

Video attached

I pressed space while hovering over an inventory item.

---- Minecraft Crash Report ----
// You should try our sister game, Minceraft!

Time: 1/23/22, 10:56 PM
Description: keyPressed event handler

java.lang.NullPointerException: Cannot invoke "com.luneruniverse.minecraft.mod.nbteditor.util.ItemReference.getItem()" because "ref" is null
    at Not Enough Crashes deobfuscated stack trace.(1.17.1+build.63)
    at com.luneruniverse.minecraft.mod.nbteditor.screens.NBTEditorScreen.<init>(NBTEditorScreen.java:488)
    at com.luneruniverse.minecraft.mod.nbteditor.mixin.InventoryScreen.keyPressed(InventoryScreen.java:65)
    at net.minecraft.client.gui.screen.ingame.CreativeInventoryScreen.handler$dcm004$keyPressed(CreativeInventoryScreen:3063)
    at net.minecraft.client.gui.screen.ingame.CreativeInventoryScreen.keyPressed(CreativeInventoryScreen)
    at net.minecraft.client.Keyboard.method_1454(Keyboard:374)
    at net.minecraft.client.gui.screen.Screen.wrapScreenError(Screen:490)
    at net.minecraft.client.Keyboard.onKey(Keyboard:370)
    at net.minecraft.client.Keyboard.method_22678(Keyboard:462)
    at net.minecraft.util.thread.ThreadExecutor.execute(ThreadExecutor:101)
    at net.minecraft.client.Keyboard.method_22676(Keyboard:462)
    at org.lwjgl.glfw.GLFWKeyCallbackI.callback(GLFWKeyCallbackI.java:37)
    at org.lwjgl.system.JNI.invokeV(Native Method)
    at org.lwjgl.glfw.GLFW.glfwPollEvents(GLFW.java:3101)
    at com.mojang.blaze3d.systems.RenderSystem.flipFrame(RenderSystem:172)
    at net.minecraft.client.util.Window.swapBuffers(Window:310)
    at net.minecraft.client.MinecraftClient.render(MinecraftClient:1137)
    at net.minecraft.client.MinecraftClient.run(MinecraftClient:728)
    at fudge.notenoughcrashes.mixinhandlers.InGameCatcher.handleClientCrash(InGameCatcher.java:37)
    at net.minecraft.client.MinecraftClient.modify$ddf000$atTheEndOfFirstCatchBeforePrintingCrashReport(MinecraftClient:24108)
    at net.minecraft.client.MinecraftClient.run(MinecraftClient:750)
    at net.minecraft.client.main.Main.main(Main:217)
    at jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:77)
    at jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
    at java.lang.reflect.Method.invoke(Method.java:568)
    at net.fabricmc.loader.impl.game.minecraft.MinecraftGameProvider.launch(MinecraftGameProvider.java:608)
    at net.fabricmc.loader.impl.launch.knot.Knot.launch(Knot.java:77)
    at net.fabricmc.loader.impl.launch.knot.KnotClient.main(KnotClient.java:23)
    at jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:77)
    at jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
    at java.lang.reflect.Method.invoke(Method.java:568)
    at org.multimc.onesix.OneSixLauncher.launchWithMainClass(OneSixLauncher.java:210)
    at org.multimc.onesix.OneSixLauncher.launch(OneSixLauncher.java:245)
    at org.multimc.EntryPoint.listen(EntryPoint.java:143)
    at org.multimc.EntryPoint.main(EntryPoint.java:34)

A detailed walkthrough of the error, its code path and all known details is as follows:
---------------------------------------------------------------------------------------

-- Head --
Thread: Render thread
Stacktrace:
    at com.luneruniverse.minecraft.mod.nbteditor.screens.NBTEditorScreen.<init>(NBTEditorScreen.java:488)
    at com.luneruniverse.minecraft.mod.nbteditor.mixin.InventoryScreen.keyPressed(InventoryScreen.java:65)
    at net.minecraft.class_481.handler$dcm004$keyPressed(class_481.java:3063)
    at net.minecraft.class_481.method_25404(class_481.java)
    at net.minecraft.class_309.method_1454(class_309.java:374)

-- Affected screen --
Details:
    Screen name: net.minecraft.class_481
Stacktrace:
    at Not Enough Crashes deobfuscated stack trace.(1.17.1+build.63)
    at java.lang.Thread.getStackTrace(Thread.java:1610)
    at net.minecraft.util.crash.CrashReportSection.trimStackTraceEnd(CrashReportSection:521)
    at net.minecraft.util.crash.CrashReport.addElement(CrashReport:198)
    at net.minecraft.world.World.addDetailsToCrashReport(World:845)
    at net.minecraft.client.world.ClientWorld.addDetailsToCrashReport(ClientWorld:370)
    at net.minecraft.client.MinecraftClient.addDetailsToCrashReport(MinecraftClient:2399)
    at net.minecraft.client.MinecraftClient.run(MinecraftClient:747)
    at fudge.notenoughcrashes.mixinhandlers.InGameCatcher.handleClientCrash(InGameCatcher.java:37)
    at net.minecraft.client.MinecraftClient.modify$ddf000$atTheEndOfFirstCatchBeforePrintingCrashReport(MinecraftClient:24108)
    at net.minecraft.client.MinecraftClient.run(MinecraftClient:750)
    at net.minecraft.client.main.Main.main(Main:217)
    at jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:77)
    at jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
    at java.lang.reflect.Method.invoke(Method.java:568)
    at net.fabricmc.loader.impl.game.minecraft.MinecraftGameProvider.launch(MinecraftGameProvider.java:608)
    at net.fabricmc.loader.impl.launch.knot.Knot.launch(Knot.java:77)
    at net.fabricmc.loader.impl.launch.knot.KnotClient.main(KnotClient.java:23)
    at jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:77)
    at jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
    at java.lang.reflect.Method.invoke(Method.java:568)
    at org.multimc.onesix.OneSixLauncher.launchWithMainClass(OneSixLauncher.java:210)
    at org.multimc.onesix.OneSixLauncher.launch(OneSixLauncher.java:245)
    at org.multimc.EntryPoint.listen(EntryPoint.java:143)
    at org.multimc.EntryPoint.main(EntryPoint.java:34)

https://user-images.githubusercontent.com/3847441/150720152-81581c6a-7ef3-404b-bc46-359edaf97136.mp4

sudofox commented 2 years ago

Also noticed some weirdness with these buttons (looks normal until the window is maximized, then they sorta split apart into two buttons with the text in the middle) Screenshot from 2022-01-24 12-04-54

mega12345mega commented 2 years ago

It looks like the slot indexes are messed up in the creative inventory when you're not on the tab where you can view your entire inventory. Can you confirm that it works in the chest tab? The button render glitch appears to be caused by a low gui scale / big screen. Since the buttons are stretched to the width of half the screen, it starts repeating the texture after it overflows the size of the texture. Both of these issues should be a pretty easy fix.

sudofox commented 2 years ago

Sure thing, I'll take a look into that after work and update the issue. Thanks for being so responsive and stuff dude!

sudofox commented 2 years ago

Yes, it seems to work in normal inventories.

mega12345mega commented 2 years ago

Ok, should all be fixed in the latest update (v1.4.0). Thanks for the issue report!