The Meaning of Life, the Universe, and Everything.
Join Date:
11/17/2016
Posts:
363
Location:
USA (sadly)
Minecraft:
FavouriteDragon
Member Details
So, I'm trying to make my custom entity act like a fireball, so I used some ghast and entityfireball code. However, everytime I right click, instead of the entity spawning in front of me and then going where I was looking, it spawns somewhere randomly within a couple blocks, and then goes in a random direction at a random speed.
2. Instead of these mental calculations just set the entity's position to the player's and its acceleration to the player's look vector multiplied by a multiplier.
Why are you using 0.5F in your player.getLook() method? Otherwise your projectile looks alright. As I already said try running the impact code server side only. Make sure to kill the entity on both sides.
The Meaning of Life, the Universe, and Everything.
Join Date:
11/17/2016
Posts:
363
Location:
USA (sadly)
Minecraft:
FavouriteDragon
Member Details
Resolved! Just copied and pasted entityfireball's code (I extended entity fireball, and copied its code, and removed the public abstract void onImpact or whatever, for people wanting to know).
So, I'm trying to make my custom entity act like a fireball, so I used some ghast and entityfireball code. However, everytime I right click, instead of the entity spawning in front of me and then going where I was looking, it spawns somewhere randomly within a couple blocks, and then goes in a random direction at a random speed.
Code:
Image Removed
~ Everybody's FavouriteDragon
1. Show your entity code
2. Instead of these mental calculations just set the entity's position to the player's and its acceleration to the player's look vector multiplied by a multiplier.
Oh! Sorry for not showing the entity code :P. But thanks! Code:
Image Removed
~ Everybody's FavouriteDragon
Oh yeah and I want the entity to spawn about .5 of a block in front of me, as the entity explodes when it hits something.
Image Removed
~ Everybody's FavouriteDragon
AFAIK the fireball doesn't impact the shooter. If it does, however, then it's not really hard to code that in.
So have you tried what I told you?
Yeah I tried what you told me. i'm pretty sure Vec3d was already the player's look vector, but :P.
Anyway, it kinda works now. It spawns where I right click. However, depending on where I look after I spawn it, it changes direction.
Image Removed
~ Everybody's FavouriteDragon
You didn't do what I told you. This is the code I was thinking about.
Ooohhh. Thanks!
Do you use eclipse? Because for some reason, IntelliJ using 1.11.2 forge is different than eclipse using 1.11.2 forge. It's really weird.
Image Removed
~ Everybody's FavouriteDragon
Ok, for some reason, my entity explodes and dissapears about 70% of the time when I fire it. When it's not touching me. Code;
Other than that, my swordbeam finally works (ish)!
Image Removed
~ Everybody's FavouriteDragon
You mean it explodes the player instantly when used?
You might want to make sure the code is ran only on the server side. Don't forget that you have to kill the entity on both sides.
No, it doesn't explode the player. (It did but I modified the code). It explodes about 2 blocks away from me after I right click.
Image Removed
~ Everybody's FavouriteDragon
I can't really say without your new code.
Oh xD! Sorry.
SwordBeam:
Spawn code:
Image Removed
~ Everybody's FavouriteDragon
Why are you using 0.5F in your player.getLook() method? Otherwise your projectile looks alright. As I already said try running the impact code server side only. Make sure to kill the entity on both sides.
Sorry I didn't communicate properly. The problem is that it explodes and dies 2 blocks from the player after you right click.
Edit: it's .5 blocks away. And the sword beam doesn't move very fast.
Image Removed
~ Everybody's FavouriteDragon
Help please!
Image Removed
~ Everybody's FavouriteDragon
Anyone? Please?
Image Removed
~ Everybody's FavouriteDragon
Resolved! Just copied and pasted entityfireball's code (I extended entity fireball, and copied its code, and removed the public abstract void onImpact or whatever, for people wanting to know).
Image Removed
~ Everybody's FavouriteDragon