Jump to content
View in the app

A better way to browse. Learn more.

Forge Forums

A full-screen app on your home screen with push notifications, badges and more.

To install this app on iOS and iPadOS
  1. Tap the Share icon in Safari
  2. Scroll the menu and tap Add to Home Screen.
  3. Tap Add in the top-right corner.
To install this app on Android
  1. Tap the 3-dot menu (⋮) in the top-right corner of the browser.
  2. Tap Add to Home screen or Install app.
  3. Confirm by tapping Install.

Featured Replies

Posted

Hello, I am interested in item handling, much like it is done by buildcraft and redpower. I am relatively new to modding, so here is what I know:

Blocks that are inventories typically are of the BlockContainer type

BlockContainers can have TileEntities tied to them, that can be used to run code for the block

They can also be tied to an IInventory, which handles the inventory of the block

 

 

What I want to find out:

What happens when someone 'pushes' an item into an inventory (e.g. pneumatic tube has an item land in it)

How do pneumatic tubes check whether or not inventories can accept items?

 

I expected to find functions sort of like 'void putItemInSide(ItemStack, int)' and 'bool canFitItemInSide(ItemStack, int), but no such luck

  • Author

Hello, I figured part of it out.

 

After looking at the source code of buildcraft (it is public!) I was able to find out the two following facts:

1) There exists a class net.minecraftforge.common.ISidedInventory, which should be extended by any inventories that are to have different sides.

2) There is no easy way to find whether or not an item can fit in an inventory. The way buildcraft does it, and I hope redpower does the same thing too, is it iterates in all Slots in an inventory, and if their contents are null, figures that it can put in some items, else it calls the finction ItemStack.isItemEqual(ItemStack) to determine whether or not it can place some or all of the stack in that slot. The reason why that is important is because if you wish to make an inventory only accept certain items the you can change the default value of your stacks from null to a custom ItemStack class that will 'equal' all items that you want to put in. This can be used to fix an issue that I have been running into with some buildcraft related mods, which allow you to push some items in slots where they don't belong, e.g. you can put an item in the bucket slots of a Hobbyist's Steam Engine (Railcraft) via pneumatic tubes (meybe bc tubes too, unsure).

 

I am making a mod that will interact a lot with inventories, so please post ANY information you have on the matter, it can't hurt.

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...

Important Information

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

Configure browser push notifications

Chrome (Android)
  1. Tap the lock icon next to the address bar.
  2. Tap Permissions → Notifications.
  3. Adjust your preference.
Chrome (Desktop)
  1. Click the padlock icon in the address bar.
  2. Select Site settings.
  3. Find Notifications and adjust your preference.