Jump to content

Custom bone item


sheik_mustafa

Recommended Posts

Hey guys, been working on a simple mod with my son and I am bit stuck trying to create a custom bone item "Bloody Bone".  I started just creating a new item of that name but realized it didn't have all the base behaviors of a bone.  I looked around for an bone class that derives from the Item type but couldn't find one.  I did find the ItemFood class which seems to have the methods in them for allowing a wolf to eat it but I'm still confused why I can't find a class for the bone item.

 

I did find the registry for the bone item in the item.class but I would think there would need to be some more code somewhere to define the behaviors and such.

 

Sorry if I am missing something basic here I am pretty new to this.  Any help would be greatly appreciated.

Link to comment
Share on other sites

I believe that a "Bone" item is simply an instance of Item which is given the parameters to make it look like a bone, so there isn't any logic for bone, rather logic that uses the bone item.

 

itemRegistry.addObject(352, "bone", (new Item()).setUnlocalizedName("bone").setFull3D().setCreativeTab(CreativeTabs.tabMisc).setTextureName("bone"));

I require Java, both the coffee and the code :)

Link to comment
Share on other sites

If you want it to be eaten by wolves I think you have to extend ItemFood then pass 3 parameters to the super: heal amount (an int), saturation (a float), and wolf food (a boolean). the "wolf food" boolean is what you want. But on the other hand, if extend ItemFood player will also be able to eat it (Eeww. Bloody bones for dinner?). So it's your call.

Link to comment
Share on other sites

Belpois, thanks I see you what you mean. I see the code in the EntityWolf class in the interact method.  That method on the ItemFood class made me think that wolf tame behavior was implemented using that.

 

Awesome_Spider, ya I think I will try and keep the behavior similar to the vanilla bone item.  I am thinking I will need to inherit from EntityWolf and then override the interact method.  Just started learning java so need to go play around with it some.

 

Thanks for the quick replies!

 

 

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.