mirror of
https://github.com/KAMKEEL/CustomNPC-Plus.git
synced 2026-11-20 16:59:43 +00:00
Small Set Speed Fix
This commit is contained in:
1 parent
182f7d8c9c
commit
992066d19b
1 file changed
+11
@@ -2352,7 +2352,18 @@ public abstract class EntityEnergyProjectile extends EntityEnergyAbility {
|
||||
}
|
||||
|
||||
public void setSpeed(float speed) {
|
||||
float oldSpeed = homingData.getSpeed();
|
||||
homingData.setSpeed(speed);
|
||||
// Rescale current motion vector to match new speed
|
||||
if (addedToChunk && !worldObj.isRemote) {
|
||||
double len = Math.sqrt(motionX * motionX + motionY * motionY + motionZ * motionZ);
|
||||
if (len > 0) {
|
||||
double scale = speed / len;
|
||||
motionX *= scale;
|
||||
motionY *= scale;
|
||||
motionZ *= scale;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public AnchorPoint getAnchorPoint() {
|
||||
|
||||
Reference in new issue
Block a user