Jump to content

Recommended Posts

Posted (edited)

Hello everyone. I'm stuck at somewhere in modding. I need to customize the arrow drop (getting the arrow back from the ground you shot). All i want is; the EntityArrow on the ground gives Broken Arrow(my mod item) by a chance instead of Arrow item from vanilla. Isn't it possible to do?

I looked into LivingDropsEvent, EntityItemPickupEvent and ItemPickupEvent but i couldn't find a way to do it. These events fired only when the player pickups an arrow as an item(dropped item) from the ground. Help me please :(

Thank you.

I'm currently on 1.12.2

Edited by JanneSoon
Posted
3 minutes ago, m00nl1ght said:

Unfortunately, there is no such event. The arrow is added to the players inventory directly in EntityArrow#onCollideWithPlayer.

 

:( There's no way to do that i wish so?

Posted
6 hours ago, JanneSoon said:

:( There's no way to do that i wish so?

You can still do it but would require doing something a bit intrusive. For example, one approach is to replace all EntityArrow with your own version that extends EntityArrow and overrides the collision method.

 

Another approach would be to set the public pickupStatus field in every EntityArrow to EntityArrow.PickupStatus.DISALLOWED and then handle the entity update event and process the collision yourself.

Check out my tutorials here: http://jabelarminecraft.blogspot.com/

  • 2 weeks later...
Posted
On 7/26/2018 at 1:12 AM, jabelar said:

You can still do it but would require doing something a bit intrusive. For example, one approach is to replace all EntityArrow with your own version that extends EntityArrow and overrides the collision method.

 

Another approach would be to set the public pickupStatus field in every EntityArrow to EntityArrow.PickupStatus.DISALLOWED and then handle the entity update event and process the collision yourself.

Could you also use reflection to replace that bit of code that handles pickups in EntityArrow with your code?

About Me

Spoiler

My Discord - Cadiboo#8887

My WebsiteCadiboo.github.io

My ModsCadiboo.github.io/projects

My TutorialsCadiboo.github.io/tutorials

Versions below 1.14.4 are no longer supported on this forum. Use the latest version to receive support.

When asking support remember to include all relevant log files (logs are found in .minecraft/logs/), code if applicable and screenshots if possible.

Only download mods from trusted sites like CurseForge (minecraft.curseforge.com). A list of bad sites can be found here, with more information available at stopmodreposts.org

Edit your own signature at www.minecraftforge.net/forum/settings/signature/ (Make sure to check its compatibility with the Dark Theme)

Posted
7 minutes ago, Cadiboo said:

Could you also use reflection to replace that bit of code that handles pickups in EntityArrow with your code?

No, reflection allows you to access code that would otherwise be inaccessible, it doesn't allow you to modify a method.

VANILLA MINECRAFT CLASSES ARE THE BEST RESOURCES WHEN MODDING

I will be posting 1.15.2 modding tutorials on this channel. If you want to be notified of it do the normal YouTube stuff like subscribing, ect.

Forge and vanilla BlockState generator.

Posted
Just now, Animefan8888 said:

No, reflection allows you to access code that would otherwise be inaccessible, it doesn't allow you to modify a method.

I meant ASM, isn’t ASM an advanced form of reflection?

About Me

Spoiler

My Discord - Cadiboo#8887

My WebsiteCadiboo.github.io

My ModsCadiboo.github.io/projects

My TutorialsCadiboo.github.io/tutorials

Versions below 1.14.4 are no longer supported on this forum. Use the latest version to receive support.

When asking support remember to include all relevant log files (logs are found in .minecraft/logs/), code if applicable and screenshots if possible.

Only download mods from trusted sites like CurseForge (minecraft.curseforge.com). A list of bad sites can be found here, with more information available at stopmodreposts.org

Edit your own signature at www.minecraftforge.net/forum/settings/signature/ (Make sure to check its compatibility with the Dark Theme)

Posted
Just now, Cadiboo said:

I meant ASM, isn’t ASM an advanced form of reflection?

No they are completely different, and ASM is a terrible thing that is not recommended on this forum.

VANILLA MINECRAFT CLASSES ARE THE BEST RESOURCES WHEN MODDING

I will be posting 1.15.2 modding tutorials on this channel. If you want to be notified of it do the normal YouTube stuff like subscribing, ect.

Forge and vanilla BlockState generator.

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.