Posted March 16, 20169 yr 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.
March 16, 20169 yr 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. http://i.imgur.com/NdrFdld.png[/img]
March 16, 20169 yr Author Ah, alright. What I meant by 'time until they disappear' was that they should disappear when they hit a block, or after a certain time in the air. Since these are 'magic' weapons, you wouldn't be able to collect the projectile ball anyway.
March 17, 20169 yr Author Well... I've gotten some work done, but there are a few problems: - The projectiles are invisible - The projectiles don't seem to move at all The whole mod's code is here: https://github.com/blahblahbal/Blah-s-Minecraft-Mod The projectile code is in item, projectile, and render.
March 17, 20169 yr 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); http://i.imgur.com/NdrFdld.png[/img]
March 18, 20169 yr Author Oh wow, I'm dumb. Lol. Can't believe I forgot to register it... lol. Thanks to everyone who helped!
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.