Jump to content

[1.8.9] Custom projectiles?


Recommended Posts

Is it possible to create custom projectiles, like the arrow, except they are not affected by gravity (or at least not affected as much as arrows are)? I also would like to change their expiration time (the time before they disappear) so I can create projectiles that wouldn't travel forever.


This is all for a gem staff 'magic' weapon thing I'm planning; they'll shoot balls of 'energy' or something.

Link to comment
Share on other sites

Yes. Extend EntityThrowable and override #getGravityVelocity to return 0.01F or some such - I don't recommend negating gravity entirely, however, or going much below that threshold unless you plan to limit the flight time in some way; otherwise your projectiles can travel forever.


As for the time on the ground, you could spawn it as an EntityItem with a custom lifespan, or do the much more difficult but cooler effect of figuring out how to place your projectile in an immobile state at the point of impact and render it correctly on that side of the block hit, in which case you have complete control over when the projectile entity despawns.

Link to comment
Share on other sites

Where do you register your projectile entity? It should be done during pre-init:

// increment the index for each entity you register
int modEntityIndex = 0;

// last 3 parameters are tracking range, tracking frequency, and whether to send tracking updates or not
// check the vanilla EntityList (I think) to find a similar entity class and use the same values
// in this case, throwable entities all use '64, 10, true' so I recommend you do the same
EntityRegistry.registerModEntity(YourEntityClass.class, "Your Entity", ++modEntityIndex, this, 64, 10, true);

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.

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.


  • Create New...

Important Information

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