Jump to content
  • Home
  • Files
  • Docs
Topics
  • All Content

  • This Topic
  • This Forum

  • Advanced Search
  • Existing user? Sign In  

    Sign In



    • Not recommended on shared computers


    • Forgot your password?

  • Sign Up
  • All Activity
  • Home
  • Mod Developer Central
  • Modder Support
  • Event That Fired When the Player Pickups An Arrow From Ground?
Currently Supported: 1.16.X (Latest) and 1.15.X (LTS)
Sign in to follow this  
Followers 1
JanneSoon

Event That Fired When the Player Pickups An Arrow From Ground?

By JanneSoon, July 25, 2018 in Modder Support

  • Reply to this topic
  • Start new topic

Recommended Posts

JanneSoon    1

JanneSoon

JanneSoon    1

  • Tree Puncher
  • JanneSoon
  • Members
  • 1
  • 21 posts
Posted July 25, 2018 (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 July 25, 2018 by JanneSoon
  • Quote

Share this post


Link to post
Share on other sites

m00nl1ght    2

m00nl1ght

m00nl1ght    2

  • Tree Puncher
  • m00nl1ght
  • Members
  • 2
  • 22 posts
Posted July 25, 2018

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

 

  • Quote

Share this post


Link to post
Share on other sites

JanneSoon    1

JanneSoon

JanneSoon    1

  • Tree Puncher
  • JanneSoon
  • Members
  • 1
  • 21 posts
Posted July 25, 2018
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?

  • Quote

Share this post


Link to post
Share on other sites

m00nl1ght    2

m00nl1ght

m00nl1ght    2

  • Tree Puncher
  • m00nl1ght
  • Members
  • 2
  • 22 posts
Posted July 25, 2018

You could create a pull request on Forge's github if you really need this hook/event. Here you can find information about pull requests.

  • Quote

Share this post


Link to post
Share on other sites

jabelar    593

jabelar

jabelar    593

  • Reality Controller
  • jabelar
  • Members
  • 593
  • 3266 posts
Posted July 25, 2018
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.

  • Quote

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

Share this post


Link to post
Share on other sites

Cadiboo    365

Cadiboo

Cadiboo    365

  • Reality Controller
  • Cadiboo
  • Members
  • 365
  • 3624 posts
Posted August 9, 2018
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?

  • Quote

About Me

Spoiler

My Discord - Cadiboo#8887

My Website - Cadiboo.github.io

My Mods - Cadiboo.github.io/projects

My Tutorials - Cadiboo.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)

Share this post


Link to post
Share on other sites

Animefan8888    741

Animefan8888

Animefan8888    741

  • Reality Controller
  • Animefan8888
  • Forge Modder
  • 741
  • 6157 posts
Posted August 9, 2018
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.

  • Quote

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.

Share this post


Link to post
Share on other sites

Cadiboo    365

Cadiboo

Cadiboo    365

  • Reality Controller
  • Cadiboo
  • Members
  • 365
  • 3624 posts
Posted August 9, 2018
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?

  • Quote

About Me

Spoiler

My Discord - Cadiboo#8887

My Website - Cadiboo.github.io

My Mods - Cadiboo.github.io/projects

My Tutorials - Cadiboo.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)

Share this post


Link to post
Share on other sites

Animefan8888    741

Animefan8888

Animefan8888    741

  • Reality Controller
  • Animefan8888
  • Forge Modder
  • 741
  • 6157 posts
Posted August 9, 2018
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.

  • Quote

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.

Share this post


Link to post
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.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  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.

    • Insert image from URL
×
  • Desktop
  • Tablet
  • Phone
Sign in to follow this  
Followers 1
Go To Topic Listing



  • Recently Browsing

    No registered users viewing this page.

  • Posts

    • gtf7dvygiduivtd
      I have a crash message with error code: 0

      By gtf7dvygiduivtd · Posted 5 minutes ago

      it only happens in 1.15+   logs.txt
    • IchBinEinToast
      Task :runClient FAILED | FAILURE: Build failed with an exception.

      By IchBinEinToast · Posted 35 minutes ago

      Oh I solved it  Thank you @diesieben07
    • domi0908
      fix hitbox red baby mobs version forge

      By domi0908 · Posted 36 minutes ago

      fix bug 
    • Tavi007
      Need help with modifying some vanilla rendering [1.16.4]

      By Tavi007 · Posted 40 minutes ago

      Hello! I'm modifying the damage calculation by subscribing to LivingHurtEvent and scaling the damage value. This works fine, but now I also want to change the rendering a bit. My current LivingHurtEvent looks like this (I removed some unnecessary stuff) @SubscribeEvent public static void elementifyLivingHurtEvent(LivingHurtEvent event) { // compute new damage value .... // heals the target, if damage is lower than 0. This can happen with my modification if(damageAmount <= 0) { target.heal(-damageAmount); event.setCanceled(true); //does this even do something? damageAmount = 0; } event.setAmount(damageAmount); }   1. I want to change the red texture (an OverlayTexture?) to a green one, if the targets is healed. But I don't really know, where I should start with this task. I couldn't even find the code, that applies the red texture. So which Event do I need to hook in, so I can change this texture? Is it RenderLivingEvent? I also would like to read the vanilla code. I'm assuming, that the red overlayTexture is applied as long as hurttime>0, and that I might need to work around this with capabilities. 2. I also would like to reduce the screen shake (or at least disable it, when no damage has been dealt). Here I got the same question as 1. As you can see, I'm not really experienced with all the render stuff. It's my first time working with it.   3. Not really a question about rendering, but I didn't want to create a new thread for a single problem. I would also like to prevent the hurt-sound from firing, if no damage has been dealt and instead play another sound. Again I have no idea, where I would have to start looking in the vanilla code or which event I should use.   So yeah, I'm quite clueless and I hope you can help me out. Here is my repository, if you need more informations: https://github.com/Tavi007/ElementalCombat
    • Ottercorn
      Unable to install forge 1.16.5

      By Ottercorn · Posted 1 hour ago

      I have problems too. I'm not the brightes crayon in the box when it comes to technical things, so please be patient and nice ;) I downoaded installer from website and extarced it. It looks like that:   https://ibb.co/pZw4QJb   Inside it looks like that:   https://ibb.co/p3CHw1J   Installer folder look like this, but none of it works, i dont have installed on my computer anything that could open it   https://ibb.co/SffK0HR   Pretty Please! Help! I want nice things in minecraft, especially OTTERS :)   Thank You!
  • Topics

    • gtf7dvygiduivtd
      0
      I have a crash message with error code: 0

      By gtf7dvygiduivtd
      Started Just now

    • IchBinEinToast
      5
      Task :runClient FAILED | FAILURE: Build failed with an exception.

      By IchBinEinToast
      Started 2 hours ago

    • domi0908
      1
      fix hitbox red baby mobs version forge

      By domi0908
      Started 21 hours ago

    • Tavi007
      0
      Need help with modifying some vanilla rendering [1.16.4]

      By Tavi007
      Started 35 minutes ago

    • Tyrone117
      2
      Unable to install forge 1.16.5

      By Tyrone117
      Started 9 hours ago

  • Who's Online (See full list)

    • Tavi007
    • diesieben07
    • Choonster
    • gtf7dvygiduivtd
    • Leronus
    • Ottercorn
    • sixze
    • vemerion
    • loordgek
    • MegaTigerpaw
    • JoB76205
  • All Activity
  • Home
  • Mod Developer Central
  • Modder Support
  • Event That Fired When the Player Pickups An Arrow From Ground?
  • Theme

Copyright © 2019 ForgeDevelopment LLC · Ads by Longitude Ads LLC Powered by Invision Community