Jump to content

Recommended Posts

Posted

I have a simple question, I'm making a custom chest for a mod, I want to know, what should I implement or take into account to make pipes from any mod be able to interact with my chest with no conflicts.

 

Thanks a lot.

Posted
6 minutes ago, diesieben07 said:

Expose IItemHandler as a capability and you should be good to go.

Thanks you.

 

Do I also need ISidedInventory or that's only in the case I want to only allow certain things coming from X side or been taken from X side?

Posted

I am already extending TileEntityLockableLoot that class extends TileEntityLockable that implements ILockableContainer that extends IInventory

 

What would be a better alternative to have the basics of what a chest should have.

 

 

Posted
On 2/21/2018 at 7:45 PM, diesieben07 said:

The basics of what a chest should have can be implemented by creating an ItemStackHandler instance and exposing it through getCapability.

Thanks, I think I get the idea.

 

Just one thing I'm not sure now. I still have to implement both IItemHandler and also ICapabilityProvider on my TileEntity right?

Posted
19 minutes ago, diesieben07 said:

No. TileEntity already implements ICapabilityProvider. IItemHandler will be implemented by ItemStackHandler (or you can make your own implementation) and then exposed through getCapability. You do not implement the inventory functionality on the TileEntity itself.

Ohh ok. Perfect.

Now one question. I had "Slots" on my Container for the TE and this container took IInventory in order to add the slots when using

 

public ContainerCardBox(InventoryPlayer invPlayer, IInventory inventory, EntityPlayer playerIn) {
.....
this.addSlotToContainer(new SlotCardBoxCards(inventory, m, 8 + m * 36, 18));

 

Now I don't have IInventory anymore, as that was my TE implementing IInventory, thing that I'm not supposed to do anymore.

 

How do I go around this? Because Slot needs an IInventory.

Posted

Change Slot to SlotItemHandler.

  • Like 1

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.

Posted
2 hours ago, Draco18s said:

Change Slot to SlotItemHandler.

Thanks you so much. Yes doing some Google I found out that existed.

I'm heading in the right direction and I believe I have everything sorted out.

 

Just some minor problems here and there, like noticing that the method that handles inserting items into my TE doesn't care about checking on my Slot class if Item is Valid for Slot. I would think that's something they would do by default but apparently not, unless I'm missing something.

I also need to implement some stuff that I'm not 100% sure how yet, but I will let you guys know once I get there.

 

Thanks once again for the great help and patience always provided.

Posted

If you want your slots to be discriminatory, you need to write your own subclass.

eg:

https://github.com/Draco18s/ReasonableRealism/blob/master/src/main/java/com/draco18s/ores/inventory/SlotDust.java

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.

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.