That's one heck of a commit you've got there...

I may have got a bit behind with version control. A lot behind, in fact. Maybe I'll go back and split this sometime - then again, I probably won't. But hey, at least it's here!
This commit is contained in:
Electroblob77
2019-08-18 00:04:18 +01:00
parent 2680d02304
commit f37812be3e
1564 changed files with 47652 additions and 12984 deletions
@@ -0,0 +1,48 @@
package electroblob.wizardry.spell;
import electroblob.wizardry.util.SpellModifiers;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.item.EnumAction;
import net.minecraft.util.EnumHand;
import net.minecraft.util.math.Vec3d;
import net.minecraft.world.World;
public class Evade extends Spell {
private static final String EVADE_VELOCITY = "evade_velocity";
private static final float UPWARD_VELOCITY = 0.25f;
public Evade(){
super("evade", EnumAction.NONE, false);
addProperties(EVADE_VELOCITY);
}
@Override
public boolean requiresPacket(){
return false;
}
@Override
public boolean cast(World world, EntityPlayer caster, EnumHand hand, int ticksInUse, SpellModifiers modifiers){
Vec3d look = caster.getLookVec();
// We want a horizontal only vector
look = look.subtract(0, look.y, 0).normalize();
Vec3d evadeDirection;
if(caster.moveStrafing == 0){
// If the caster isn't strafing, pick a random direction
evadeDirection = look.rotateYaw(world.rand.nextBoolean() ? (float)Math.PI/2f : (float)-Math.PI/2f);
}else{
// Otherwise, evade always moves whichever direction the caster was already strafing
evadeDirection = look.rotateYaw(Math.signum(caster.moveStrafing) * (float)Math.PI/2f);
}
evadeDirection = evadeDirection.scale(getProperty(EVADE_VELOCITY).floatValue() * modifiers.get(SpellModifiers.POTENCY));
caster.addVelocity(evadeDirection.x, UPWARD_VELOCITY, evadeDirection.z);
return true;
}
}