Posted July 25, 20187 yr 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, 20187 yr by JanneSoon
July 25, 20187 yr Unfortunately, there is no such event. The arrow is added to the players inventory directly in EntityArrow#onCollideWithPlayer.
July 25, 20187 yr Author 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?
July 25, 20187 yr 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.
July 25, 20187 yr 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/
August 9, 20187 yr 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 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)
August 9, 20187 yr 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.
August 9, 20187 yr 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 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)
August 9, 20187 yr 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.