protected void forceEntity(Entity target, double multiplier, int magnitude) { magnitude = (int)(magnitude * multiplier); Vector forceVector = mage.getLocation().getDirection(); forceVector.normalize(); forceVector.multiply(magnitude); SafetyUtils.setVelocity(target, forceVector); }
private boolean modifyPostSpawn(MageController controller, Entity entity) { if (entity == null || entity.getType() != type) return false; if (hasMoved && location != null && !location.equals(entity.getLocation())) { entity.teleport(location); } if (hasVelocity && velocity != null) { SafetyUtils.setVelocity(entity, velocity); } return true; }
@Override public SpellResult step(CastContext context) { SpellResult result = super.step(context); if (entity == null) { return SpellResult.CAST; } // Note that in testing it somehow doesn't seem to matter if we adjust the location here // I really have no idea why, but it seems to work OK if we adjust it on spawn. Location target = adjustLocation(actionContext.getTargetLocation()); if (doVelocity) { Vector velocity = this.velocity.clone().multiply(distanceTravelledThisTick); if (velocityOffset != null) { velocity = velocity.add(velocityOffset); } SafetyUtils.setVelocity(entity, velocity); } if (doTeleport) { if (orient) { target.setDirection(velocity); } entity.teleport(target); } return result; }
SafetyUtils.setVelocity(entity, scaledForce);
Vector velocity = item.getVelocity(); velocity.setY(velocity.getY() * 5); SafetyUtils.setVelocity(item, velocity);
speed = startSpeed; if (liftoffThrust > 0) { SafetyUtils.setVelocity(getMount(context), new Vector(0, liftoffThrust, 0));
SafetyUtils.setVelocity(mountedEntity, velocity);
SafetyUtils.setVelocity(grenade, aim.multiply(velocity));
SafetyUtils.setVelocity(grenade, aim); grenade.setYield(size); grenade.setFuseTicks(fuse);
Vector velocity = item.getVelocity(); velocity.setY(velocity.getY() * 5); SafetyUtils.setVelocity(item, velocity);
CompatibilityUtils.damage(damageable, crashDamage, mounted); SafetyUtils.setVelocity(entity, velocity); speed = Math.max(0, speed - crashBraking); if (mount instanceof Damageable && crashEntityVehicleDamage > 0) {
SafetyUtils.setVelocity(entity, velocity); if (safetyLength > 0) { mage.registerEvent(SpellEventType.PLAYER_DAMAGE, this);
SafetyUtils.setVelocity(getMount(context), velocity.multiply(speed));
falling.getLocation().subtract(center).toVector(); direction = direction.normalize().multiply(fallingBlockSpeed); SafetyUtils.setVelocity(falling, direction);
SafetyUtils.setVelocity(droppedItem, velocity);
SafetyUtils.setVelocity(block, direction);
SafetyUtils.setVelocity(armorStand, velocity); } else { SafetyUtils.setVelocity(mountEntity, velocity); SafetyUtils.setVelocity(player, velocity);
falling.setDropItem(false); SafetyUtils.setVelocity(falling, direction); if (maxDamage > 0 && fallDamage > 0) { CompatibilityUtils.setFallingBlockDamage(falling, fallDamage, maxDamage);
falling.setDropItem(false); if (fallingBlockVelocity != null) { SafetyUtils.setVelocity(falling, fallingBlockVelocity);
SafetyUtils.setVelocity(target, forceVector);