Jump to content

Recommended Posts

Posted

The container slot for the armor of a horse only accepts items which are defined in the horse's class. (func_146085_a in 1.7.2).

You could create a new entity class and make it extend EntityHorse and override that one function.

 

They should've created a new item class called ItemHorseArmor and let the armorslot check if the item the player tries to enter into it is an instance of ItemHorseArmor.

It saves some unnecessary checks in both entityhorse and containerhorseinventory.

Posted

The container slot for the armor of a horse only accepts items which are defined in the horse's class. (func_146085_a in 1.7.2).

You could create a new entity class and make it extend EntityHorse and override that one function.

 

They should've created a new item class called ItemHorseArmor and let the armorslot check if the item the player tries to enter into it is an instance of ItemHorseArmor.

It saves some unnecessary checks in both entityhorse and containerhorseinventory.

 

I've included a hook in my coremod. I will do a PR however when I get time (by the way, it's a PITA to recode the horse armor stuff for horses, EVERYTHING is hardcoded in there).

For anyone who's interested:

 

Item class:

https://github.com/SanAndreasP/SAPManagerPack/blob/master/java/de/sanandrew/core/manpack/util/ItemHorseArmor.java

Transformer:

https://github.com/SanAndreasP/SAPManagerPack/blob/master/java/de/sanandrew/core/manpack/transformer/TransformHorseArmor.java

Don't ask for support per PM! They'll get ignored! | If a post helped you, click the "Thank You" button at the top right corner of said post! |

mah twitter

This thread makes me sad because people just post copy-paste-ready code when it's obvious that the OP has little to no programming experience. This is not how learning works.

Posted

They should've created a new item class called ItemHorseArmor and let the armorslot check if the item the player tries to enter into it is an instance of ItemHorseArmor.

 

Agreed.

 

it's a PITA to recode the horse armor stuff for horses, EVERYTHING is hardcoded in there

 

If we forge it, then maybe we can fix that.

 

Also: If something is currently kludged in vanilla code, then it is prone to being "fixed" in a future Minecraft update.

 

I need to learn about transformers. They look like fun.

The debugger is a powerful and necessary tool in any IDE, so learn how to use it. You'll be able to tell us more and get better help here if you investigate your runtime problems in the debugger before posting.

  • 3 months later...
Posted

With 1.8 released (and Microsoft's acquisition likely to end all development that gamers would ever care about), can we see where vanilla horse armor coding will land? Knowing what we're stuck with, can someone more knowledgeable than I now do the "pull request"?

 

In the mean time, for fun and as a Java exercise, I am going to attempt to subclass EntityHorse in a way that separates all horse armor from it. If I have my way, then my mod horses will wear armor defined in a subclass of ItemArmor. Horse-armor will simply become another piece following helm, chest, leg & boots. In other words, while a helmet goes on a humanoid head, horse-armor goes on a whole horse. I hope I can bring together both vanilla and mod armors  :o

 

Please let me know ASAP if progress has been made in this area so I don't reinvent too many wheels!

 

The debugger is a powerful and necessary tool in any IDE, so learn how to use it. You'll be able to tell us more and get better help here if you investigate your runtime problems in the debugger before posting.

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.