Jump to content

Recommended Posts

Posted

I am working on a mod in which my current challenge is to interrupt a player removing a certain item from a chest. The item I would be interrupting is an original item, and the chest itself is also custom. These portion are complete and work properly. My guess is that I may be trying to hook an item interaction event or container/inventory interaction event. Can someone point me in the right direction? After sifting through the base code and GitHub refernces, I am still scratching my head on where to start with this one... If it helps, the classes that I have already overridden for my custom chest are the BlockChest and TileEntityChest classes. I don't believe any of the code I already have will serve to help answer the question, but let me know if I need to post any! Thanks!

I'll need help, and I'll give help. Just ask, you know I will!

Posted

O.K., I follow you so far, but TileEntityChest, BlockChest, and IInventory all seem to reference 'slots' only via an int[] with an ItemStack. What file/class am I missing that impliments a Slot class? Or am I going rogue on this one and writing entirely new methods to handle the ItemStacks; one that we are referring to as a "slot?"

I'll need help, and I'll give help. Just ask, you know I will!

Posted

Alright, hopefully this is the last question I need to get the ball rolling, but I found this in EntityPlayer:

 

public Container openContainer;

 

and this line in TileEntityChest:

 

if (entityplayer.openContainer instanceof ContainerChest)

 

I have no problems locating the Slot class here and the methods are indeed clear, but I can't seem to find any references or connections to the actual Container class through the chest itself... Surely it has to be referenced somewhere else... I'm beginning to think perhaps this is out of my scope or that I'm overlooking an obvious connection. You've been very helpful already, here's to once more!

I'll need help, and I'll give help. Just ask, you know I will!

Posted

Yes, and I am ready to do that, for sure. But there are no fields, methods, or the like for me to replace; at least that I can find. So I guess clarifying the question is how does the BlockChest/TileEntityChest/IInventory chain implement the Container class? I can write a new one, but how will my custom chest know to use it instead of the base class? For complete clarity I will share my classes so far...

 

overridden BlockChest

 

  Reveal hidden contents

 

 

Overridden TileEntityChest

 

  Reveal hidden contents

 

 

Thanks again, your expertise truly is appreciated. (/BTC tip?)  ;)

I'll need help, and I'll give help. Just ask, you know I will!

Posted

So the container is accessed through the GUI... That's the missing link; and the very thing I was trying to avoid. Java and coding concepts, I'm fine with; learning an API is the hard part! You can consider this one solved and yourself helpful; I don't care what everyone else says!  ;D

I'll need help, and I'll give help. Just ask, you know I will!

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.