Jump to content

Adding a chest like item


saxon564

Recommended Posts

what i want is something kind of like the backpack mod, you right click holding an item and it brings up an inventory for that item, i also want to limit the inventory to just seeds, with the size of a small chest. if someone can at least show the basic code with place holders for vaiables that would be great.

Link to comment
Share on other sites

you'll find *everything* you need in net.minecraft.inventory.ContainerChest ...

 

(this would also be your sample code with place holders you'll have to exchange for your own settings ...)

running minecraft on Mac OS X - Sierra --- creating code since 1986 ... --- मेरा दिल भारतवासी है!

width=289 height=100http://www.arno-saxena.de/pictures/chococraft/banner_signature.png[/img]

Link to comment
Share on other sites

Simply make your item backpack open the backpack chest gui using onItemRightClick method.

 

I've not looked into how chest work so I couldn't help you but thats what i would do if i was making a backpack :)

Link to comment
Share on other sites

But is that able to be turned into an item instead of a block?

 

behind the gui is the container with the player inventory and your special inventory (chest, backpack, saddlebags, whatever). The container doesn't know if it's been opened by an item or a block (or even a mob). The item/block/mob has to open the container GUI when triggered (right-click, shift-click, whatever). The GUI will load the container, the container will load the inventories and the inventories will load and store the contained items by means of the readFromNBT and writeToNBT methods ...

running minecraft on Mac OS X - Sierra --- creating code since 1986 ... --- मेरा दिल भारतवासी है!

width=289 height=100http://www.arno-saxena.de/pictures/chococraft/banner_signature.png[/img]

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.

Announcements



×
×
  • Create New...

Important Information

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