Jump to content

Giving a standard block an inventory?


ianc1215

Recommended Posts

I have a concept for a mod I am working on. To put it in a nutshell the mod would use a cauldron which the player would throw the items into. However unlike mods like Thaumcraft where the items are converted into essentia I would leave the items as items once thrown in. I'm thinking I would need to store 10 or so items inside the cauldron (maybe more). I wouldn't need any GUI of any kind, just a way to store the items so the cauldron retains the contents while rebooting the server or other events.

 

I took a look at the various container classes that are used for chests and such. I thought that sounded like the right idea but I thought rather than possibly running around in circles I should ask for advice.

 

I was going use the "onEntityCollidedWithBlock" (I think it's spelled right) method as the way to get the item thrown in the cauldron but that is as far as the idea got.

 

Any ideas?

“Most good programmers do programming not because they expect to get paid or get adulation by the public, but because it is fun to program.” - Linus Torvalds

Link to comment
Share on other sites

Depends, do you mean your own cauldron block or the Vanilla one? Making your own would be the easiest way to accomplish this. Your block would have a TileEntity that stored an ItemStack[] which would be your inventory, then in your block, you would perform the appropriate checks in onEntityCollidedWithBlock, then add the EntityItem's item stack to the TE's inventory and kill the EntityItem.

Don't make mods if you don't know Java.

Check out my website: http://shadowfacts.net

Developer of many mods

Link to comment
Share on other sites

Simply:

 

You can't use the vanilla cauldron.  It does not have a TE and you need a TE to store items.

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

I should have mentioned in my post. I would be creating a new cauldron that is based on the vanilla cauldron. But to clarify I would not be trying to use the vanilla one. My idea was something like the thaumcraft cauldron. Basically somehow take a vanilla cauldron and "transform" it into a mod specific cauldron.

 

I am guessing that by doing so I open up my options greatly?

“Most good programmers do programming not because they expect to get paid or get adulation by the public, but because it is fun to program.” - Linus Torvalds

Link to comment
Share on other sites

So what would be the best way to implement an inventory to the cauldron? Would l use one of base classes like InventoryBasic?

 

All I need to do is add / remove items and know what items have been added since they will affect the recipes.

“Most good programmers do programming not because they expect to get paid or get adulation by the public, but because it is fun to program.” - Linus Torvalds

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.

×
×
  • Create New...

Important Information

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