Jump to content

How would I make it so when you right click a sword shoots lightning


ClarmonkGaming

Recommended Posts

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

Link to comment
Share on other sites

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.

Link to comment
Share on other sites

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

Link to comment
Share on other sites

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.

Link to comment
Share on other sites

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

Link to comment
Share on other sites

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.

Link to comment
Share on other sites

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

Link to comment
Share on other sites

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.

Link to comment
Share on other sites

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;

Link to comment
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.
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...

×   Pasted as rich text.   Restore formatting

  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.

Announcements



×
×
  • Create New...

Important Information

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