Jump to content

(Solved)Restrict container slot to a specific item? Shift-right click crash help


Recommended Posts

Posted

I have a tile entity/container for a block and I want to be able to restrict what can go in its inventory slot to a specific item in my mod, but for the life of me I cannot figure out how. I also have it so that shift clicking crashes the game (not supposed to happen xD) and I can see that I need to have something like

public boolean mergeItemStack(itemStack, start, end, backwards)

But I don't know exactly where to put it and what it does.

Here is my tile entity class

 

  Reveal hidden contents

 

and the container class

 

  Reveal hidden contents

 

Posted

I figured it out and fixed the shift right click crash

I use

  Reveal hidden contents

 

But I don't entirely understand it and I still cannot restrict ONLY allowing a specific item into the slot

Posted

NINJA EDIT

I figured it all out. The solution is to create a custom slot (non vanilla slot) and specify it in the class to only allow said items

example

 

  Reveal hidden contents

 

the slot inside container class

 

  Reveal hidden contents

 

  • Thanks 1
  • 6 months later...

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.