Jump to content

[Solved] Creating a wearable item


Melonslise
 Share

Recommended Posts

I'm creating a custom armor that works differently to normal armor. I tried creating a custom armor class by copying some methods I thought were important from ItemArmor. Namely these are dispenseStack, getEquipmentSlot, onItemRightClick, getItemAttributeModifiers and a few others. However I can't even equip the armor in game. So what do I need to do to create a wearable item?

The armor should only reduce certain types of damage when it has charge. Is it best to use damage events for this?

Thanks.

Edited by Melonslise
Link to comment
Share on other sites

1 hour ago, diesieben07 said:

Override Item#isValidArmor and Item#getEquipmentSlot. However note that you can probably achieve this with ItemArmor already by implementing ISpecialArmor.

Using isValidArmor worked, but I noticed a few issues.

1. I can't shift-click or right-click the armor to equip it for some reason. I copied the onItemRightClicked method from ItemArmor so not sure what's wrong there. And I have no idea where to look for the shift-click code.

2. I couldn't find getEquipmentSlot in Item. It seems the getEquipmentSlot method in ItemArmor is used only for the renderer.

3. How would I specify a renderer for the custom armor I made? I'm guessing by overriding getArmorModel?

Thanks.

Edited by Melonslise
Link to comment
Share on other sites

2 minutes ago, Melonslise said:

I couldn't find getEquipmentSlot in Item. It seems the getEquipmentSlot method in ItemArmor is used only for the renderer.

Update Forge.

 

2 minutes ago, Melonslise said:

I can't shift-click or right-click the armor to equip it for some reason. I copied the onItemRightClicked method from ItemArmor so not sure what's wrong there. And I have no idea where to look for the shift-click code.

Armor can be equipped using right-click, not shift-right-click.

  • Like 1
Link to comment
Share on other sites

8 minutes ago, diesieben07 said:

Update Forge.

 

Armor can be equipped using right-click, not shift-right-click.

1. I'm using the latest version of 1.12.2 forge. I got it like yesterday.

2. I meant that armor can be equipped by either right-clicking during gameplay or shift-left-clicking when in inventory.

 

EDIT: Nevermind, for some reason I had forge 14.21 installed. Must've misclicked.

Edited by Melonslise
Link to comment
Share on other sites

6 minutes ago, Melonslise said:

I meant that armor can be equipped by either right-clicking during gameplay or shift-left-clicking when in inventory.

Item#getEquipmentSlot must be overridden for shift-clicking to work.

 

14 minutes ago, Melonslise said:

How would I specify a renderer for the custom armor I made? I'm guessing by overriding getArmorModel?

Yes.

  • Like 1
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
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.

 Share



×
×
  • Create New...

Important Information

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