Jump to content

How to make fireworks go off when I right click a block


Mtshaw113

Recommended Posts

EDIT: Ok I found the OnBlockActivated method, so thats the first thing. Now, which method do I call to spawn the fireworks? I believe I can handle it from there

 

For anyone thats wondering, I am making a mod for my girlfriend, she also plays Minecraft. Thought it'd be a fun project. I want the block to basically activate a "celebration" of fireworks, about a radius of 5 blocks away from the block on right clicked.

Link to comment
Share on other sites

Fireworks are entity, so just spawn them

*Note, not accurate code, but somewhat close

The onBlockActivated method should give a world reference (ex. par1World). I woulkd start by building the entity data first, then spawning it.

 

onBlockActivated(par1World, x , y , z , other stuff){

EntityFirework ent = new EntityFirework(insert some stuff here);

ent.(set values like position, speed, yaw, pitch, color, effect, tick age, etc.)

//NOTE: This is very important to stop dummy entities

if(!par1World.isRemote){

par1World.spawnEntity(ent);

}

 

Pm me if you need help. ;)

"you seem to be THE best modder I've seen imo."

~spynathan

 

ლ(́◉◞౪◟◉‵ლ

Link to comment
Share on other sites

More accurately would be

FireworkEntity ent = new FireworkEntity(par1World);

ent.setLocationAndAngles(stuff);

//write firework specific variables here

par1World.spawnEntityInWorld(ent);

 

Pm if you need help

"you seem to be THE best modder I've seen imo."

~spynathan

 

ლ(́◉◞౪◟◉‵ლ

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.