Jump to content

[1.15.2] Opening a different container with the same itemstack


NindyBun

Recommended Posts

I have two gui's/containers one with 8 slots and the other with 15. My tool opens the former container whenever you press a keybind, but I want to open the latter using the same tool. Essentially, if I pressed a certain keybind, the 15 slot container supersedes the original 8 slot container, therefor my tool it's container gains 7 more slots while retaining whatever's in it's previous inventory.  

Is there a way to go about this?

 

https://github.com/NindyBun/TestMod

Link to comment
Share on other sites

I believe you could do this by simply detecting whatever key is being pressed when it goes to access the container. It used to be called a KeyInputEvent, but I'm unsure if it changed for 1.15. I'd imagine it would also benefit you to do this with a Forge event, and then just have the item call your GUI whenever either keybind is activated and the item is in hand. 

Follow these rules when talking to me, and we'll get along fine.

1).I know Java fairly well. I don't know as much about modding. They are not the same, don't compare them.

2). I consider myself to always be learning. I make mistakes, you make mistakes. Who doesn't?

3). Insult me, and I will leave the thread. I have a real life, I don't have time to throw petty insults in a Minecraft Modding forum.

 

ModMCdl - Co-Founder and Director of Design for Artemis Game Studios

Link to comment
Share on other sites

Oy vey.

This will always return true. As will this and this.

Use orElseThrow here, that's why it exists.

You know what Capabilities are and yet, you did this.

Your tool is effective on nothing.

This is an unchecked cast. Other mods may have items with an inventories too. This code will crash the server if you hold one of their inventory-capable items and use your keybind.

Apparently I'm a complete and utter jerk and come to this forum just like to make fun of people, be confrontational, and make your personal life miserable.  If you think this is the case, JUST REPORT ME.  Otherwise you're just going to get reported when you reply to my posts and point it out, because odds are, I was trying to be nice.

 

Exception: If you do not understand Java, I WILL NOT HELP YOU and your thread will get locked.

 

DO NOT PM ME WITH PROBLEMS. No help will be given.

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.