JanneSoon Posted July 25, 2018 Share 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 Link to comment Share on other sites More sharing options...
m00nl1ght Posted July 25, 2018 Share Posted July 25, 2018 Unfortunately, there is no such event. The arrow is added to the players inventory directly in EntityArrow#onCollideWithPlayer. Quote Link to comment Share on other sites More sharing options...
JanneSoon Posted July 25, 2018 Author Share 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 Link to comment Share on other sites More sharing options...
m00nl1ght Posted July 25, 2018 Share 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 Link to comment Share on other sites More sharing options...
jabelar Posted July 25, 2018 Share 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/ Link to comment Share on other sites More sharing options...
Cadiboo Posted August 9, 2018 Share 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) Link to comment Share on other sites More sharing options...
Animefan8888 Posted August 9, 2018 Share 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. Link to comment Share on other sites More sharing options...
Cadiboo Posted August 9, 2018 Share 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) Link to comment Share on other sites More sharing options...
Animefan8888 Posted August 9, 2018 Share 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. Link to comment Share on other sites More sharing options...
Recommended Posts
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.