Jump to content

Foivos

Members
  • Posts

    3
  • Joined

  • Last visited

Converted

  • Gender
    Undisclosed
  • Personal Text
    I am new!

Foivos's Achievements

Tree Puncher

Tree Puncher (2/8)

2

Reputation

  1. 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.
  2. I think I figured it out. You don't need to change anything from the defaults except for the following: change the TileEntity.getInventoryStackLimit to return 1, or any value you want. Then in your Container class (ContainerTiny in the tutorial) add the following function: Basically, this function was called from Container, which did not care about the value of tileEntity.getInventoryStackSize() at all. I made it so when you shift right click the container will be filled as much as possible. You can change that in the code above pretty easily. Hope that helps
  3. 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
×
×
  • Create New...

Important Information

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