Jump to content

Custom Entity with IExtendedEntityProperties and an Inventory Question


KnightDemon

Recommended Posts

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.

Link to comment
Share on other sites

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.

Link to comment
Share on other sites

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.

Link to comment
Share on other sites

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.

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.