Posted August 15, 20169 yr Hello there, I'm in the process of updating a mod to a newer forge, and whilst looking over the code I've wrote (A friend helped with some of it), I've noticed that I have a weird thing going on. I have a custom entity and I have given it an Inventory inside it's build class. My friend created an extended entities properties file to help accommodate an inventory, the weird thing is that he also created a separate Inventory file. My question is, would it be simpler to have the inventory be in the build class of the custom entity or have it separate in it's own file? I ask as in the build class the entity would extend from EntityLivingBase and therefore inherit the functions for changing items in the inventory etc. and would auto-update the render too (i think? different problem, another time). Any experienced guidance on this would be appreciated.
August 15, 20169 yr A bit of design walk through: We have few things to cover: Entity IEEP or Capability IInventory or IItemHandler Before you can even start: 1. What version are you on? * 1.7.10 will not get any further support. * 1.8.x should be immidiately updated to 1.9+, preferably 1.10+. 2. Will the inventory in question be ONLY EVER assigned to one type of entity, or maybe it can also be assigned to other entities (like zombies or whatever)? 1.7.10 is no longer supported by forge, you are on your own.
August 15, 20169 yr Author I've already got it set up and working, I really only wanted professional opinion on whether a separate inventory file would be more beneficial over an entity with an implemented inventory. 1. working on 1.8.9, I'll take your advice and update to an even newer forge version then. 2. The inventory will only be assigned to the custom entity, there will be many of that entity spawned but only that type.
August 15, 20169 yr 1. 1.8.9 is the last version featuring IEEP. Update to new Capabilities: http://mcforge.readthedocs.io/en/latest/datastorage/capabilities/ Some examples: https://github.com/MinecraftForge/MinecraftForge/tree/1.9/src/test/java/net/minecraftforge/test And google open source mods 2. As of introduction of Capabilities (read 1st link)- it is HIGHLY recommended to dump all usage of vanilla interfaces and use IItemHandler (or other forge tools). Said that - if you want to do it professionally (like good modder would) - you want to expose implementation of your inventory via said capability system. So yeah - separate class exposed by capability assigned to Entity. This way you use full power of Forge inter-mod compatibility/design. 1.7.10 is no longer supported by forge, you are on your own.
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.