Psionicolor

Psionicolor

57.9k Downloads

Crash on removing new CAD from output slot.

Dunkmania101 opened this issue ยท 11 comments

commented

Hello! I'll now commence the redundant ritual of stating what the title already says: My game crashed when trying to create a CAD in the assembler. I hadn't made anything from this mod yet, but the log made it seem that it was involved:

---- Minecraft Crash Report ----
// Hey, that tickles! Hehehe!

Time: 9/12/21, 6:53 PM
Description: mouseReleased event handler

java.lang.ClassCastException: class net.minecraft.item.AirItem cannot be cast to class vazkii.psi.api.cad.ICAD (net.minecraft.item.AirItem and vazkii.psi.api.cad.ICAD are in unnamed module of loader cpw.mods.modlauncher.TransformingClassLoader @521f2a23)
	at com.rcx.psionicolor.Psionicolor$ColorizerEvents.onCadTake(Psionicolor.java:66) ~[psionicolor:1.16.5-1.0.0] {re:classloading}
	at net.minecraftforge.eventbus.ASMEventHandler_493_ColorizerEvents_onCadTake_CADTakeEvent.invoke(.dynamic) ~[?:?] {}
	at net.minecraftforge.eventbus.ASMEventHandler.invoke(ASMEventHandler.java:85) ~[eventbus-4.0.0.jar:?] {}
	at net.minecraftforge.eventbus.EventBus.post(EventBus.java:302) ~[eventbus-4.0.0.jar:?] {}
	at net.minecraftforge.eventbus.EventBus.post(EventBus.java:283) ~[eventbus-4.0.0.jar:?] {}
	at vazkii.psi.common.block.tile.container.slot.SlotCADOutput.func_82869_a(SlotCADOutput.java:50) ~[psi:1.16-95] {re:classloading}
	at org.astemir.forestcraft.event.InventoryEvent.onInventoryClick(InventoryEvent.java:38) ~[forestcraft:1.59] {re:classloading,pl:runtimedistcleaner:A}
	at net.minecraftforge.eventbus.ASMEventHandler_416_InventoryEvent_onInventoryClick_MouseReleasedEvent.invoke(.dynamic) ~[?:?] {}
	at net.minecraftforge.eventbus.ASMEventHandler.invoke(ASMEventHandler.java:85) ~[eventbus-4.0.0.jar:?] {}
	at net.minecraftforge.eventbus.EventBus.post(EventBus.java:302) ~[eventbus-4.0.0.jar:?] {}
	at net.minecraftforge.eventbus.EventBus.post(EventBus.java:283) ~[eventbus-4.0.0.jar:?] {}
	at net.minecraftforge.client.ForgeHooksClient.onGuiMouseReleasedPre(ForgeHooksClient.java:633) ~[forge:?] {re:classloading,re:mixin}
	at net.minecraft.client.MouseHelper.func_198027_a(MouseHelper.java:92) ~[?:?] {re:mixin,pl:runtimedistcleaner:A,re:classloading,pl:mixin:APP:randompatches.mixins.json:client.keybindings.MouseHelperMixin,pl:mixin:APP:ftbchunks-common.mixins.json:MouseHandlerMixin,pl:mixin:A,pl:runtimedistcleaner:A}
	at net.minecraft.client.gui.screen.Screen.func_231153_a_(Screen.java:427) ~[?:?] {re:mixin,pl:accesstransformer:B,pl:runtimedistcleaner:A,re:computing_frames,pl:accesstransformer:B,pl:runtimedistcleaner:A,re:classloading,pl:accesstransformer:B,pl:mixin:APP:bettergamemenu.mixins.json:ScreenMixin,pl:mixin:APP:kubejs-common.mixins.json:ScreenMixin,pl:mixin:APP:quark.mixins.json:client.ScreenMixin,pl:mixin:A,pl:runtimedistcleaner:A}
	at net.minecraft.client.MouseHelper.func_198023_a(MouseHelper.java:91) ~[?:?] {re:mixin,pl:runtimedistcleaner:A,re:classloading,pl:mixin:APP:randompatches.mixins.json:client.keybindings.MouseHelperMixin,pl:mixin:APP:ftbchunks-common.mixins.json:MouseHandlerMixin,pl:mixin:A,pl:runtimedistcleaner:A}
	at net.minecraft.client.MouseHelper.func_228030_c_(MouseHelper.java:181) ~[?:?] {re:mixin,pl:runtimedistcleaner:A,re:classloading,pl:mixin:APP:randompatches.mixins.json:client.keybindings.MouseHelperMixin,pl:mixin:APP:ftbchunks-common.mixins.json:MouseHandlerMixin,pl:mixin:A,pl:runtimedistcleaner:A}
	at net.minecraft.util.concurrent.ThreadTaskExecutor.execute(SourceFile:94) ~[?:?] {re:mixin,pl:accesstransformer:B,re:computing_frames,pl:accesstransformer:B,re:classloading,pl:accesstransformer:B}
	at net.minecraft.client.MouseHelper.func_228028_b_(MouseHelper.java:180) ~[?:?] {re:mixin,pl:runtimedistcleaner:A,re:classloading,pl:mixin:APP:randompatches.mixins.json:client.keybindings.MouseHelperMixin,pl:mixin:APP:ftbchunks-common.mixins.json:MouseHandlerMixin,pl:mixin:A,pl:runtimedistcleaner:A}
	at org.lwjgl.glfw.GLFWMouseButtonCallback$Container.invoke(GLFWMouseButtonCallback.java:81) ~[lwjgl-glfw-3.2.2.jar:build 10] {}
	at bre2el.fpsreducer.handler.glfw.InputEventHandler$MouseButtonEventHandler.invoke(InputEventHandler.java:133) ~[fpsreducer:1.23-mc1.16.5] {re:classloading}
	at org.lwjgl.glfw.GLFWMouseButtonCallbackI.callback(GLFWMouseButtonCallbackI.java:36) ~[lwjgl-glfw-3.2.2.jar:build 10] {}
	at org.lwjgl.system.JNI.invokeV(Native Method) ~[lwjgl-3.2.2.jar:build 10] {}
	at org.lwjgl.glfw.GLFW.glfwPollEvents(GLFW.java:3101) ~[lwjgl-glfw-3.2.2.jar:build 10] {}
	at com.mojang.blaze3d.systems.RenderSystem.flipFrame(SourceFile:102) ~[?:?] {re:mixin,re:classloading,pl:mixin:APP:fpsreducer.mixins.json:RenderSystemMixin,pl:mixin:A}
	at net.minecraft.client.MainWindow.func_227802_e_(MainWindow.java:305) ~[?:?] {re:mixin,pl:runtimedistcleaner:A,re:classloading,pl:mixin:APP:kubejs-common.mixins.json:MainWindowMixin,pl:mixin:A,pl:runtimedistcleaner:A}
	at net.minecraft.client.Minecraft.func_195542_b(Minecraft.java:996) ~[?:?] {re:mixin,pl:accesstransformer:B,pl:runtimedistcleaner:A,re:classloading,pl:accesstransformer:B,pl:mixin:APP:randompatches.mixins.json:client.MinecraftMixin,pl:mixin:APP:flywheel.mixins.json:ShaderCloseMixin,pl:mixin:APP:betterendforge.mixins.json:MinecraftMixin,pl:mixin:APP:fallingleaves.mixins.json:MinecraftClientMixin,pl:mixin:APP:notenoughcrashes.mixins.json:client.MixinMinecraftClient,pl:mixin:APP:mixins.betterthirdperson.json:MinecraftMixin,pl:mixin:APP:kubejs-common.mixins.json:MinecraftMixin,pl:mixin:APP:abnormals_core.mixins.json:client.MinecraftMixin,pl:mixin:APP:immersiveengineering.mixins.json:accessors.client.MinecraftAccess,pl:mixin:APP:charm.mixins.json:accessor.MinecraftAccessor,pl:mixin:APP:assets/botania/botania.mixins.json:AccessorMinecraft,pl:mixin:APP:assets/mining_dimension/mining_dimension.mixins.json:MinecraftMixin,pl:mixin:APP:create.mixins.json:WindowResizeMixin,pl:mixin:A,pl:runtimedistcleaner:A}
	at net.minecraft.client.Minecraft.func_99999_d(Minecraft.java:607) ~[?:?] {re:mixin,pl:accesstransformer:B,pl:runtimedistcleaner:A,re:classloading,pl:accesstransformer:B,pl:mixin:APP:randompatches.mixins.json:client.MinecraftMixin,pl:mixin:APP:flywheel.mixins.json:ShaderCloseMixin,pl:mixin:APP:betterendforge.mixins.json:MinecraftMixin,pl:mixin:APP:fallingleaves.mixins.json:MinecraftClientMixin,pl:mixin:APP:notenoughcrashes.mixins.json:client.MixinMinecraftClient,pl:mixin:APP:mixins.betterthirdperson.json:MinecraftMixin,pl:mixin:APP:kubejs-common.mixins.json:MinecraftMixin,pl:mixin:APP:abnormals_core.mixins.json:client.MinecraftMixin,pl:mixin:APP:immersiveengineering.mixins.json:accessors.client.MinecraftAccess,pl:mixin:APP:charm.mixins.json:accessor.MinecraftAccessor,pl:mixin:APP:assets/botania/botania.mixins.json:AccessorMinecraft,pl:mixin:APP:assets/mining_dimension/mining_dimension.mixins.json:MinecraftMixin,pl:mixin:APP:create.mixins.json:WindowResizeMixin,pl:mixin:A,pl:runtimedistcleaner:A}
	at net.minecraft.client.main.Main.main(Main.java:184) ~[minecraft-1.16.5-client.jar:?] {re:classloading,re:mixin,pl:runtimedistcleaner:A,pl:mixin:A,pl:runtimedistcleaner:A}
	at jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[?:?] {re:classloading}
	at jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) ~[?:?] {re:classloading}
	at jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) ~[?:?] {re:classloading}
	at java.lang.reflect.Method.invoke(Method.java:566) ~[?:?] {}
	at net.minecraftforge.fml.loading.FMLClientLaunchProvider.lambda$launchService$0(FMLClientLaunchProvider.java:51) ~[forge-1.16.5-36.2.4-launcher.jar:36.2] {}
	at cpw.mods.modlauncher.LaunchServiceHandlerDecorator.launch(LaunchServiceHandlerDecorator.java:37) [modlauncher-8.0.9.jar:?] {re:classloading}
	at cpw.mods.modlauncher.LaunchServiceHandler.launch(LaunchServiceHandler.java:54) [modlauncher-8.0.9.jar:?] {re:classloading}
	at cpw.mods.modlauncher.LaunchServiceHandler.launch(LaunchServiceHandler.java:72) [modlauncher-8.0.9.jar:?] {re:classloading}
	at cpw.mods.modlauncher.Launcher.run(Launcher.java:82) [modlauncher-8.0.9.jar:?] {re:classloading}
	at cpw.mods.modlauncher.Launcher.main(Launcher.java:66) [modlauncher-8.0.9.jar:?] {re:classloading}
	at jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[?:?] {re:classloading}
	at jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) ~[?:?] {re:classloading}
	at jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) ~[?:?] {re:classloading}
	at java.lang.reflect.Method.invoke(Method.java:566) ~[?:?] {}
	at io.github.zekerzhayard.forgewrapper.installer.Main.main(Main.java:52) [ForgeWrapper-1.5.1.jar:1.5.1] {re:classloading}
	at jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[?:?] {re:classloading}
	at jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) ~[?:?] {re:classloading}
	at jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) ~[?:?] {re:classloading}
	at java.lang.reflect.Method.invoke(Method.java:566) ~[?:?] {}
	at org.multimc.onesix.OneSixLauncher.launchWithMainClass(OneSixLauncher.java:210) [NewLaunch.jar:?] {re:classloading}
	at org.multimc.onesix.OneSixLauncher.launch(OneSixLauncher.java:245) [NewLaunch.jar:?] {re:classloading}
	at org.multimc.EntryPoint.listen(EntryPoint.java:143) [NewLaunch.jar:?] {re:classloading}
	at org.multimc.EntryPoint.main(EntryPoint.java:34) [NewLaunch.jar:?] {re:classloading}


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

-- Affected screen --
Details:
	Screen name: vazkii.psi.client.gui.GuiCADAssembler
Stacktrace:
	at net.minecraft.client.gui.screen.Screen.func_231153_a_(Screen.java:427) ~[?:?] {re:mixin,pl:accesstransformer:B,pl:runtimedistcleaner:A,re:computing_frames,pl:accesstransformer:B,pl:runtimedistcleaner:A,re:classloading,pl:accesstransformer:B,pl:mixin:APP:bettergamemenu.mixins.json:ScreenMixin,pl:mixin:APP:kubejs-common.mixins.json:ScreenMixin,pl:mixin:APP:quark.mixins.json:client.ScreenMixin,pl:mixin:A,pl:runtimedistcleaner:A}
	at net.minecraft.client.MouseHelper.func_198023_a(MouseHelper.java:91) ~[?:?] {re:mixin,pl:runtimedistcleaner:A,re:classloading,pl:mixin:APP:randompatches.mixins.json:client.keybindings.MouseHelperMixin,pl:mixin:APP:ftbchunks-common.mixins.json:MouseHandlerMixin,pl:mixin:A,pl:runtimedistcleaner:A}
	at net.minecraft.client.MouseHelper.func_228030_c_(MouseHelper.java:181) ~[?:?] {re:mixin,pl:runtimedistcleaner:A,re:classloading,pl:mixin:APP:randompatches.mixins.json:client.keybindings.MouseHelperMixin,pl:mixin:APP:ftbchunks-common.mixins.json:MouseHandlerMixin,pl:mixin:A,pl:runtimedistcleaner:A}
	at net.minecraft.util.concurrent.ThreadTaskExecutor.execute(SourceFile:94) ~[?:?] {re:mixin,pl:accesstransformer:B,re:computing_frames,pl:accesstransformer:B,re:classloading,pl:accesstransformer:B}
	at net.minecraft.client.MouseHelper.func_228028_b_(MouseHelper.java:180) ~[?:?] {re:mixin,pl:runtimedistcleaner:A,re:classloading,pl:mixin:APP:randompatches.mixins.json:client.keybindings.MouseHelperMixin,pl:mixin:APP:ftbchunks-common.mixins.json:MouseHandlerMixin,pl:mixin:A,pl:runtimedistcleaner:A}
	at org.lwjgl.glfw.GLFWMouseButtonCallback$Container.invoke(GLFWMouseButtonCallback.java:81) ~[lwjgl-glfw-3.2.2.jar:build 10] {}
	at bre2el.fpsreducer.handler.glfw.InputEventHandler$MouseButtonEventHandler.invoke(InputEventHandler.java:133) ~[fpsreducer:1.23-mc1.16.5] {re:classloading}
	at org.lwjgl.glfw.GLFWMouseButtonCallbackI.callback(GLFWMouseButtonCallbackI.java:36) ~[lwjgl-glfw-3.2.2.jar:build 10] {}
	at org.lwjgl.system.JNI.invokeV(Native Method) ~[lwjgl-3.2.2.jar:build 10] {}


I suppose this isn't something you couldn't figure out easily enough yourself from the log, but it looks like the issue is at line 66 of Psionicolor.java and involves trying to cast Minecraft's Air item to an interface that defines a CAD.

Here's my attempt at fixing it:

@SubscribeEvent
public void onCadTake(CADTakeEvent event) {
    Item cadItem = event.getCad().getItem();
    if (cadItem instanceof ICAD) {
        ItemStack dyeStack = ((ICAD) cadItem).getComponentInSlot(event.getCad(), EnumCADComponent.DYE);
        if (dyeStack.getItem() instanceof IPlayerboundColorizer) {
 	    dyeStack.getOrCreateTag().putUniqueId(IPlayerboundColorizer.OWNING_PLAYER, PlayerEntity.getUUID(event.getPlayer().getGameProfile()));
 	    ItemCAD.setComponent(event.getCad(), dyeStack);
        }
    }
}	

Versions:
Minecraft: 1.16.5
Forge: 36.2.4
Psionicolor: 1.0.0

I've disabled it in my pack for now, but I intend to re-enable it once this is fixed.
Apart from that, I like the ideas in this mod. I haven't played with PSI much in the past, but I think I understand enough to appreciate this. I'm imagining little status indicators in the hotbar or on the armor! (assuming it can be colorized, I've forgotten) Thanks!

commented

Strange, I'm not sure how psi gets away with casting it without checking first if this can happen but it's easy to fix so whatever.

commented

Fixing bugs is especially fun when you don't understand why you have to :)

I'll close this now, since the commit has been made. Thanks!

commented

It's been a month since the fix was committed, is it refusing to build?

commented

I wanted to add a different style of conjured block before releasing the next update and I kinda got stuck at the final step of making that.

commented

One idea is to append the letter a to the current version number with just the fix. That way, the mod would still be usable but wouldn't really have a new version number. I've done that a few times in the past for really tiny fixes, especially between Fabric and Forge versions of the same mod. That could be a bit annoying to do though if you've already mostly implemented the conjured block thing but not fully, since you'd need to remove that first. That could be circumvented by cloning the commit with the fix somewhere temporarily, just for building.

commented

oh. so is this still pending? we had this crash on my server last weekend for my modpack. my friend really wanted this in and he's been tinkering with psi a lot, so he was very heart broken when we added this and then he became powerless cause he kept crashing. :( the other friends who code were saying something about "casting air" etc, like this big displays. and it was due to taking a CAD out of a machine or looking at it in a chest and some other stuff.

commented

welp, I had just removed the mod from my pack cause it made psi unusable for some. :V

commented

Oh, sorry, were you actually asking me if it was still pending? I had initially assumed you were just saying you'd remembered this issue with a rhetorical question. Either way, yes it's still broken and the issue your friends described seems identical to what I found.

commented

Sorry for not doing anything with this, I've been working on other projects, I'll probably release a new version with the fix this week.

commented

Well I just released version 1.0.1 with the fix, sorry about the delay.

commented

oh nice. saved by the bell. I'll put it back in then. xD