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
  • [1.15.2] Summon Fireball on Item Use
Currently Supported: 1.16.X (Latest) and 1.15.X (LTS)
Sign in to follow this  
Followers 0
jaxbymc42

[1.15.2] Summon Fireball on Item Use

By jaxbymc42, April 12, 2020 in Modder Support

  • Reply to this topic
  • Start new topic

Recommended Posts

jaxbymc42    0

jaxbymc42

jaxbymc42    0

  • Tree Puncher
  • jaxbymc42
  • Members
  • 0
  • 14 posts
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

Share this post


Link to post
Share on other sites

Animefan8888    741

Animefan8888

Animefan8888    741

  • Reality Controller
  • Animefan8888
  • Forge Modder
  • 741
  • 6157 posts
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.

Share this post


Link to post
Share on other sites

jaxbymc42    0

jaxbymc42

jaxbymc42    0

  • Tree Puncher
  • jaxbymc42
  • Members
  • 0
  • 14 posts
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

Share this post


Link to post
Share on other sites

Animefan8888    741

Animefan8888

Animefan8888    741

  • Reality Controller
  • Animefan8888
  • Forge Modder
  • 741
  • 6157 posts
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.

Share this post


Link to post
Share on other sites

jaxbymc42    0

jaxbymc42

jaxbymc42    0

  • Tree Puncher
  • jaxbymc42
  • Members
  • 0
  • 14 posts
Posted April 12, 2020

I apologize for my stupidity

  • Quote

Share this post


Link to post
Share on other sites

jaxbymc42    0

jaxbymc42

jaxbymc42    0

  • Tree Puncher
  • jaxbymc42
  • Members
  • 0
  • 14 posts
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

Share this post


Link to post
Share on other sites

Animefan8888    741

Animefan8888

Animefan8888    741

  • Reality Controller
  • Animefan8888
  • Forge Modder
  • 741
  • 6157 posts
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.

Share this post


Link to post
Share on other sites

jaxbymc42    0

jaxbymc42

jaxbymc42    0

  • Tree Puncher
  • jaxbymc42
  • Members
  • 0
  • 14 posts
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

Share this post


Link to post
Share on other sites

Animefan8888    741

Animefan8888

Animefan8888    741

  • Reality Controller
  • Animefan8888
  • Forge Modder
  • 741
  • 6157 posts
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.

Share this post


Link to post
Share on other sites

jaxbymc42    0

jaxbymc42

jaxbymc42    0

  • Tree Puncher
  • jaxbymc42
  • Members
  • 0
  • 14 posts
Posted April 12, 2020 (edited)

This is resolved

Edited April 12, 2020 by jaxbymc42
  • Quote

Share this post


Link to post
Share on other sites

TeENypeEnY69420    0

TeENypeEnY69420

TeENypeEnY69420    0

  • Tree Puncher
  • TeENypeEnY69420
  • Members
  • 0
  • 2 posts
Posted May 5, 2020

I am trying to do the exact same thing as you what was your code in the end?

  • Quote

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 0
Go To Topic Listing



  • Recently Browsing

    No registered users viewing this page.

  • Posts

    • DrakenXI
      [1.16.4] setBlockState with out send update event.

      By DrakenXI · Posted 6 minutes ago

      Simple : Poor understanding.  
    • Veo
      Unable to start LAN server detection: Can't assign requested address [Server][Modded][1.16.4]

      By Veo · Posted 7 minutes ago

      okay so after a bit of research I found out that I need to either ask my provider to enable a public IPv4 or I have to pay extra.
    • Badnews4u
      My forge server won't load all the mods

      By Badnews4u · Posted 15 minutes ago

      https://gist.github.com/Hazardmaster77/be641ede968a62d7359932406cd03f5a Here is the debug. The modlist is at the bottom. I am aware that I used an exported forge modpack file as mod. Idk why I thought that would work. I'm still having trouble figuring out this process though. Basically what I want is simply to have my server world loaded with a biomes o' plenty world seed and to be capable of harboring mod items and entities. 
    • Titan7272
      1.16.4 "Missing Forge!" Crash on start up

      By Titan7272 · Posted 29 minutes ago

      That worked, thank you. 
    • diesieben07
      [1.16] Custom Sign won't render

      By diesieben07 · Posted 35 minutes ago

      probably better just to ask in the modder support channels - your chances of getting a quick response are better. I am not the only person who can help If I'm online on discord and see it, I'll reply - otherwise someone else will.
  • Topics

    • DrakenXI
      4
      [1.16.4] setBlockState with out send update event.

      By DrakenXI
      Started 22 hours ago

    • Veo
      4
      Unable to start LAN server detection: Can't assign requested address [Server][Modded][1.16.4]

      By Veo
      Started Yesterday at 06:39 PM

    • Badnews4u
      2
      My forge server won't load all the mods

      By Badnews4u
      Started 17 hours ago

    • Titan7272
      8
      1.16.4 "Missing Forge!" Crash on start up

      By Titan7272
      Started Wednesday at 07:10 PM

    • kiou.23
      17
      [1.16] Custom Sign won't render

      By kiou.23
      Started 15 hours ago

  • Who's Online (See full list)

    • diesieben07
    • FlashHUN
    • binary_404
    • Abdymazhit
    • kh319
    • EdekaKuchen
    • Badnews4u
    • DrakenXI
    • Asleep365
    • Greenshark3D
    • Levi visser
    • Pl00py_R
    • st4s1k
    • DieserChris
  • All Activity
  • Home
  • Mod Developer Central
  • Modder Support
  • [1.15.2] Summon Fireball on Item Use
  • Theme

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