Jump to content

Item Handler Class Cast exception - 1.15 [SOLVED]


Turtledove

Recommended Posts

I've got a custom player inventory set up and good to go, I'm setting up a multi-tabbed survival inventory but am having trouble hiding certain slots depending on the tab currently clicked. So there are 3 tabs: one of them is the default survival, one of them has the crafting slots, and the other has slots for player armor, as well as slots that reference my itemhandler. Currently, if player is in tab 0, I draw the normal 3x9 player inventory slots and don't draw the crafting, custom, or armor slots, and also mask them when the mouse is interacted with. Then when they press tabs 1 or 2, the others are drawn.

 

I've recreated the default player inventory perfectly, but when my mouse click method is called on slots that reference my custom item handler using windowClick, not the default player inventory slots, there's a class cast exception with the item handler. What are my options here?

 

EDIT: Make sure you implement the correct classes when creating your slots for your registered item handlers, and override the correct methods. 

Edited by Turtledove
Link to comment
Share on other sites

So as it turns out I wasn't actually using my itemhandler capability, I'd been calling the vanilla one, which was why it was acting weird, another silly mistake.

 

But now that I am using it, calling windowClick causes a class cast exception with my ItemHandler. Huh.

Edited by Turtledove
Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Announcements



×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use.