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

    • GenElectrovise
      What is the method to left click?

      By GenElectrovise · Posted just now

      There's probably something PlayerEntity (as a movement controller?) I'd start with searching my workspace for something along the lines of KeystrokeHandler or PlayerMovementController
    • Luis_ST
      [1.16.5] GameOverlay

      By Luis_ST · Posted just now

      I just want to render a overlay (i have creat a spyglass likt that from 1.17) and now i want to render the Overlay this is the code of the event i used: @SubscribeEvent(priority = EventPriority.HIGHEST) public static void RenderSpyglassOverlay(RenderGameOverlayEvent event) { PlayerEntity player = Minecraft.getInstance().player; int posX = event.getWindow().getScaledWidth() / 2; int posY = event.getWindow().getScaledHeight() / 2; if (player.getActiveItemStack().getItem() == CaveItems.SPYGLASS.get()) { RenderSystem.disableDepthTest(); RenderSystem.depthMask(false); RenderSystem.color4f(1.0F, 1.0F, 1.0F, 1.0F); RenderSystem.disableAlphaTest(); Minecraft.getInstance().getTextureManager().bindTexture(new ResourceLocation("cave:textures/misc/spyglass_scope.png")); Minecraft.getInstance().ingameGUI.blit(event.getMatrixStack(), posX - 128, posY - 128, 0, 0, posX * 2, posY * 2, 256, 256); RenderSystem.depthMask(true); RenderSystem.enableDepthTest(); RenderSystem.enableAlphaTest(); RenderSystem.color4f(1.0F, 1.0F, 1.0F, 1.0F); } } but the overlay looks like this: https://drive.google.com/file/d/15llZaiIqNWK7WRqcihIJY7oaAszkFKnn/view?usp=sharing so my question: 1 .how to render the game overlay translucent 2. how to set the outside of the overlay to black
    • GenElectrovise
      Server doesnt start

      By GenElectrovise · Posted 5 minutes ago

      Never heard of an error like this but what's your version.
    • Potatoe
      Minecraft server

      By Potatoe · Posted 48 minutes ago

      ok
    • diesieben07
      Minecraft server

      By diesieben07 · Posted 52 minutes ago

      This is a Forum for Forge, I would suggest you seek help elsewhere for Vanilla Minecraft.
  • Topics

    • Gubipe
      5
      What is the method to left click?

      By Gubipe
      Started 13 hours ago

    • Luis_ST
      0
      [1.16.5] GameOverlay

      By Luis_ST
      Started Just now

    • BinAufGoogle
      3
      Server doesnt start

      By BinAufGoogle
      Started 18 hours ago

    • Potatoe
      4
      Minecraft server

      By Potatoe
      Started Sunday at 10:13 AM

    • Luis_ST
      4
      [1.16.5] Player Field of View

      By Luis_ST
      Started 1 hour ago

  • Who's Online (See full list)

    • Beethoven92
    • zOnlyKroks
    • GenElectrovise
    • Luis_ST
    • diesieben07
    • squidlex
    • RealMrMateo
    • Funyaah
    • loordgek
    • Novârch
    • Leronus
  • 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