Posted April 12, 20205 yr 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
April 12, 20205 yr 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, 20205 yr by Animefan8888 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.
April 12, 20205 yr Author 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!))
April 12, 20205 yr 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. 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.
April 12, 20205 yr Author 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
April 12, 20205 yr 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 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.
April 12, 20205 yr Author 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, 20205 yr by jaxbymc42
April 12, 20205 yr 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. 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.