Jump to content

Recommended Posts

Posted

Is there something like an ArrowCollideWithBlockEvent?

I searched a lot, and only found events whenever the Player starts or Stop using the block, but noone indicating a hit on a block with an arrow

Posted

On WorldTickEvent get the list of all arrows in the world. For each arrow, create a new NBT tag compound, call the arrow's write entity to NBT method, then check if the byte tag inGround in your NBT compound equals 1. If it is, do whatever you want. Warning: your code will run always when the arrow is in the ground.

Maker of the Craft++ mod.

Posted

What are you trying to do when it impacts a block?  Might be easier to tackle from that direction.

Long time Bukkit & Forge Programmer

Happy to try and help

Posted

Im doing a minigame where you can use diamond blocks as walls, so when they get hit they downgrade to iron and then vanish after another hit (I dont want to use a customblock even if I could just override the collide method there and have it done)

Posted

Gotcha.

 

Something like was suggested might work.  I did something like that in the past.

 

Its been awhile since I did this, but I think there is an arrow loose or spawn event.  I'll look around tonight for my mod that uses it.  Anytime that happens, I add the arrow to a list where i'm tracking the age of the arrow once it is in the ground.

 

I iterate through the list each tick and advance the time if it meets my criteria.  After a short time, I make it go poof.

 

I created this for some NPC's I made that shot a lot of arrows.  They lag from the 1000's of arrows hanging around too long was ugly.

Long time Bukkit & Forge Programmer

Happy to try and help

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.