jaxbymc42 Posted April 12, 2020 Share Posted April 12, 2020 I have a custom wand that I would like to summon a fireball entity and shoot it like a Ghast on right click using ActionResultType onItemUse and then remove one durability from the item. I have created a class and put together what I thought would work for this situation but I am currently lost on it. Any help is appreciated and I feel bad for asking anything. Thank you! Here is the item class: https://pastebin.com/0h9XLTYi Quote Link to comment Share on other sites More sharing options...
Animefan8888 Posted April 12, 2020 Share Posted April 12, 2020 (edited) 1 hour ago, jaxbymc42 said: but I am currently lost on it. Generally it helps if you give more information. What is it doing vs what you want it to do? The first thing I notice is you are using Item::onItemUse. Item::onItemUse is called when the player right clicks on a Block. Check out this video. It talks about the basic Item methods. You want Item::onItemRightClick Edited April 12, 2020 by Animefan8888 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...
jaxbymc42 Posted April 12, 2020 Author Share Posted April 12, 2020 I want this item to shoot a fireball in the direction I am looking whenever I right click with the item, removing one durability on each use. Currently, right clicking does absolutely nothing. (Is this enough info? (I'm sorry!)) Quote Link to comment Share on other sites More sharing options...
Animefan8888 Posted April 12, 2020 Share Posted April 12, 2020 9 minutes ago, jaxbymc42 said: (Is this enough info? (I'm sorry!)) Did you read my entire post. I told you what was immediately wrong. 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...
jaxbymc42 Posted April 12, 2020 Author Share Posted April 12, 2020 I apologize for my stupidity Quote Link to comment Share on other sites More sharing options...
jaxbymc42 Posted April 12, 2020 Author Share Posted April 12, 2020 Okay, so I have changed a bunch of code and now the fireball shoots but only in one general direction (it varies a little bit on the direction every time I throw it). The fireballs fly into the +X and +Z plane. I don't understand raytracing very well as I haven't worked with it much up until this point. https://pastebin.com/Xt9M3Rkd Quote Link to comment Share on other sites More sharing options...
Animefan8888 Posted April 12, 2020 Share Posted April 12, 2020 2 minutes ago, jaxbymc42 said: I don't understand raytracing very well You don't need to understand ray tracing to do what you want to do. If you want a code example check out the GhastEntity::FireballAttackGoal::tick on lines 194-203 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...
jaxbymc42 Posted April 12, 2020 Author Share Posted April 12, 2020 (edited) I took your advice and now the item is working... kind of. The only issue now is that it won't shoot in the y-range (up or down). It only shoots straight out no matter how high or low I look. Basically, I used the code from GhastEntity like you had mentioned and targetted the PlayerEntity instead of the livingentity variable but with negative values so the fireball shot away from the player. https://pastebin.com/Q9RwgBNf Edited April 12, 2020 by jaxbymc42 Quote Link to comment Share on other sites More sharing options...
Animefan8888 Posted April 12, 2020 Share Posted April 12, 2020 1 hour ago, jaxbymc42 said: I took your advice and now the item is working... kind of. The only issue now is that it won't shoot in the y-range (up or down). It only shoots straight out no matter how high or low I look. Basically, I used the code from GhastEntity like you had mentioned and targetted the PlayerEntity instead of the livingentity variable but with negative values so the fireball shot away from the player. https://pastebin.com/Q9RwgBNf This will always be -0.5 right? Quote double d3 = playerIn.getPosYHeight(0.5D) - (0.5D + playerIn.getPosYHeight(0.5D)); Sounds like you need to read the code to understand what it's doing instead of blindly copy-pasting it. 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...
jaxbymc42 Posted April 12, 2020 Author Share Posted April 12, 2020 (edited) This is resolved Edited April 12, 2020 by jaxbymc42 Quote Link to comment Share on other sites More sharing options...
TeENypeEnY69420 Posted May 5, 2020 Share Posted May 5, 2020 I am trying to do the exact same thing as you what was your code in the end? Quote 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.