Jump to content
View in the app

A better way to browse. Learn more.

Forge Forums

A full-screen app on your home screen with push notifications, badges and more.

To install this app on iOS and iPadOS
  1. Tap the Share icon in Safari
  2. Scroll the menu and tap Add to Home Screen.
  3. Tap Add in the top-right corner.
To install this app on Android
  1. Tap the 3-dot menu (⋮) in the top-right corner of the browser.
  2. Tap Add to Home screen or Install app.
  3. Confirm by tapping Install.

Featured Replies

Posted

How would I make it so when you right click a sword shoots lightning  what i mean by this is how would i make a sword shoot lightning straight ahead of the player. if someone would not mind showing me the code that would be great.

 

 

 

                          Sincerely,

          ClarmonkGaming

You would need a new entity to handle the lightning.  The native lightning entity arcs down from the sky.

Apparently I'm a complete and utter jerk and come to this forum just like to make fun of people, be confrontational, and make your personal life miserable.  If you think this is the case, JUST REPORT ME.  Otherwise you're just going to get reported when you reply to my posts and point it out, because odds are, I was trying to be nice.

 

Exception: If you do not understand Java, I WILL NOT HELP YOU and your thread will get locked.

 

DO NOT PM ME WITH PROBLEMS. No help will be given.

  • Author

What if I wanted it to make it shoot a fireball like a fire charge how would i do that.  p.s thank you for helping me !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!

 

 

 

                                                    Sincerely,

                                                    ClarmonkGaming

Open EntityGhast and copy-paste.

Apparently I'm a complete and utter jerk and come to this forum just like to make fun of people, be confrontational, and make your personal life miserable.  If you think this is the case, JUST REPORT ME.  Otherwise you're just going to get reported when you reply to my posts and point it out, because odds are, I was trying to be nice.

 

Exception: If you do not understand Java, I WILL NOT HELP YOU and your thread will get locked.

 

DO NOT PM ME WITH PROBLEMS. No help will be given.

Yeah, Draco is right, EntityGhast is a great example of a fireball, and for that matter, how the fireball  is "fired". Lightning is a little bit harder. You could use create your own custom tile entity based on the EntityLightningBolt class, and creating the tile entity much like a ghast fireball is, except with onItemRightClick() firing the bolt at the targeted entity.

The difference between stupidity and genius is that genius has its limits. - Albert Einstein

You could use create your own custom tile entity based on the EntityLightningBolt class, and creating the tile entity much like a ghast fireball is, except with onItemRightClick() firing the bolt at the targeted entity.

 

Regular entity, not tile entity.

Apparently I'm a complete and utter jerk and come to this forum just like to make fun of people, be confrontational, and make your personal life miserable.  If you think this is the case, JUST REPORT ME.  Otherwise you're just going to get reported when you reply to my posts and point it out, because odds are, I was trying to be nice.

 

Exception: If you do not understand Java, I WILL NOT HELP YOU and your thread will get locked.

 

DO NOT PM ME WITH PROBLEMS. No help will be given.

  • Author

this is the only part of the code i found with a reference to fireball

 

 

public boolean attackEntityFrom(DamageSource par1DamageSource, float par2)

    {

        if (this.isEntityInvulnerable())

        {

            return false;

        }

        else if ("fireball".equals(par1DamageSource.getDamageType()) && par1DamageSource.getEntity() instanceof EntityPlayer)

        {

            super.attackEntityFrom(par1DamageSource, 1000.0F);

            ((EntityPlayer)par1DamageSource.getEntity()).triggerAchievement(AchievementList.ghast);

            return true;

        }

        else

        {

            return super.attackEntityFrom(par1DamageSource, par2);

        }

    }

 

but how would i make the fireball shoot out of the  sword thanks you for helping me

 

Sincerley

ClarmonkGaming

So you missed this section, line 155

 

                if (this.attackCounter == 20)
                {
                    this.worldObj.playAuxSFXAtEntity((EntityPlayer)null, 1008, (int)this.posX, (int)this.posY, (int)this.posZ, 0);
                    EntityLargeFireball entitylargefireball = new EntityLargeFireball(this.worldObj, this, d5, d6, d7);
                    entitylargefireball.field_92057_e = this.explosionStrength;
                    double d8 = 4.0D;
                    Vec3 vec3 = this.getLook(1.0F);
                    entitylargefireball.posX = this.posX + vec3.xCoord * d8;
                    entitylargefireball.posY = this.posY + (double)(this.height / 2.0F) + 0.5D;
                    entitylargefireball.posZ = this.posZ + vec3.zCoord * d8;
                    this.worldObj.spawnEntityInWorld(entitylargefireball);
                    this.attackCounter = -40;
                }

 

Nice searching there, chummer.

Apparently I'm a complete and utter jerk and come to this forum just like to make fun of people, be confrontational, and make your personal life miserable.  If you think this is the case, JUST REPORT ME.  Otherwise you're just going to get reported when you reply to my posts and point it out, because odds are, I was trying to be nice.

 

Exception: If you do not understand Java, I WILL NOT HELP YOU and your thread will get locked.

 

DO NOT PM ME WITH PROBLEMS. No help will be given.

  • Author

so i would do

 

onItemRightClick() this.worldObj.playAuxSFXAtEntity((EntityPlayer)null, 1008, (int)this.posX, (int)this.posY, (int)this.posZ, 0);

                    EntityLargeFireball entitylargefireball = new EntityLargeFireball(this.worldObj, this, d5, d6, d7);

                    entitylargefireball.field_92057_e = this.explosionStrength;

                    double d8 = 4.0D;

                    Vec3 vec3 = this.getLook(1.0F);

                    entitylargefireball.posX = this.posX + vec3.xCoord * d8;

                    entitylargefireball.posY = this.posY + (double)(this.height / 2.0F) + 0.5D;

                    entitylargefireball.posZ = this.posZ + vec3.zCoord * d8;

                    this.worldObj.spawnEntityInWorld(entitylargefireball);

                    this.attackCounter = -40;

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.

Guest
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
Reply to this topic...

Important Information

By using this site, you agree to our Terms of Use.

Configure browser push notifications

Chrome (Android)
  1. Tap the lock icon next to the address bar.
  2. Tap Permissions → Notifications.
  3. Adjust your preference.
Chrome (Desktop)
  1. Click the padlock icon in the address bar.
  2. Select Site settings.
  3. Find Notifications and adjust your preference.