Jump to content
  • Home
  • Files
  • Docs
  • Merch
Topics
  • All Content

  • This Topic
  • This Forum

  • Advanced Search
  • Existing user? Sign In  

    Sign In



    • Not recommended on shared computers


    • Forgot your password?

  • Sign Up
  • All Activity
  • Home
  • Mod Developer Central
  • Modder Support
  • 1.11 Implementing an inventory for entities/tileentities.
1.13 Update Notes for Mod Creators
Sign in to follow this  
Followers 0
Viesis

1.11 Implementing an inventory for entities/tileentities.

By Viesis, November 28, 2016 in Modder Support

  • Reply to this topic
  • Start new topic

Recommended Posts

Viesis    1

Viesis

Viesis    1

  • Tree Puncher
  • Viesis
  • Members
  • 1
  • 44 posts
Posted November 28, 2016

Hello, in 1.10, I made use of IInventory to handle my inventory needs, but with 1.11, some of the ItemStackHelper methods I was using seems to not like my approach of implementing my inventory.  I have seen the minecraft chest make use of :

NonNullList<ItemStack> = NonNullList.<ItemStack>func_191197_a(27, ItemStack.field_190927_a)

 

(different than what I have been using:

ItemStack[] inventory = new ItemStack[27])

 

so I decided to search around of the forums.  That only lead to more confusion, as I saw some posts stating IInventory is not supposed to be used anymore, and a capabilities system should be used now (I think it was IStorage??)? 

 

So all of that being said, I am wondering if anyone has a link, guide, video, or example of how to properly implement and inventory to entities/tileentities?  Any information would be greatly appreciated. I have been stewing on this for over a week now, and nothing seems to really make sense.  Thanks!

  • Quote

Share this post


Link to post
Share on other sites

Draco18s    2096

Draco18s

Draco18s    2096

  • Reality Controller
  • Draco18s
  • Members
  • 2096
  • 14029 posts
Posted November 28, 2016

Use IItemHandler fields and getCapabilities

  • Quote

Share this post


Link to post
Share on other sites

larsgerrits    510

larsgerrits

larsgerrits    510

  • Reality Controller
  • larsgerrits
  • Members
  • 510
  • 3455 posts
Posted November 28, 2016
http://mcforge.readthedocs.io/en/latest/datastorage/capabilities/
  • Quote

Share this post


Link to post
Share on other sites

Viesis    1

Viesis

Viesis    1

  • Tree Puncher
  • Viesis
  • Members
  • 1
  • 44 posts
Posted December 5, 2016

I think I may have a basic inventory working now, but how would I get a particular item in a particular slot?  I use to be able to do the getItemInSlot(X) when I could use IInventory. Any help would be great.  Thank you again. :)

  • Quote

Share this post


Link to post
Share on other sites

Viesis    1

Viesis

Viesis    1

  • Tree Puncher
  • Viesis
  • Members
  • 1
  • 44 posts
Posted December 5, 2016

Oh nvm.  That is where IItemHandler comes in.  hahaha  Thanks all!

  • Quote

Share this post


Link to post
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.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  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.

  • Insert image from URL
×
  • Desktop
  • Tablet
  • Phone
Sign in to follow this  
Followers 0
Go To Topic Listing



  • Recently Browsing

    No registered users viewing this page.

  • Posts

    • diesieben07
      Memory Heap Thingy!

      By diesieben07 · Posted 2 minutes ago

      That's not what this thread is about... Make your own thread and post logs.
    • gudie73
      Memory Heap Thingy!

      By gudie73 · Posted 20 minutes ago

      It gets stuck on that part and doesn’t change
    • gudie73
      Memory Heap Thingy!

      By gudie73 · Posted 21 minutes ago

      Wym  
    • RaphGamingz
      ScreenGui does nothing

      By RaphGamingz · Posted 1 hour ago

      any errors?
    • RaphGamingz
      Game crashing when the block is activated

      By RaphGamingz · Posted 1 hour ago

      then you    your not assigning a value to the tileEntity try in the constructor tileEntity = world.getTileEntity(pos);
  • Topics

    • Mizinov
      7
      Memory Heap Thingy!

      By Mizinov
      Started August 24

    • Jaffaaaaa
      2
      ScreenGui does nothing

      By Jaffaaaaa
      Started Wednesday at 07:03 PM

    • jun2040
      5
      Game crashing when the block is activated

      By jun2040
      Started 17 hours ago

    • Merthew
      5
      [1.12.2] Multiple Structure Generation

      By Merthew
      Started November 7, 2018

    • Professional Derp
      16
      Server frequently crashes

      By Professional Derp
      Started 10 hours ago

  • Who's Online (See full list)

    • Krevik
    • diesieben07
    • GttiqwT
    • ZigTheHedge
    • ewew
    • jun2040
    • gudie73
  • All Activity
  • Home
  • Mod Developer Central
  • Modder Support
  • 1.11 Implementing an inventory for entities/tileentities.
  • Theme
  • Contact Us
  • Discord

Copyright © 2019 ForgeDevelopment LLC · Ads by Curse Powered by Invision Community