mirror of
https://github.com/Sollace/Unicopia.git
synced 2024-11-23 21:38:00 +01:00
Fix teleporting
This commit is contained in:
parent
3b6ad3d094
commit
9d108eb608
3 changed files with 15 additions and 16 deletions
|
@ -179,7 +179,7 @@ public class UnicornTeleportAbility implements Ability<Pos> {
|
|||
destination.z() + offset.getZ()
|
||||
);
|
||||
|
||||
participant.setPosition(dest);
|
||||
participant.requestTeleport(dest.x, dest.y, dest.z);
|
||||
if (participant.getWorld().getBlockCollisions(participant, participant.getBoundingBox()).iterator().hasNext()) {
|
||||
dest = destination.vec();
|
||||
participant.requestTeleport(dest.x, participant.getY(), dest.z);
|
||||
|
|
|
@ -89,13 +89,22 @@ public class DisplacementSpell extends AbstractSpell implements HomingSpell, Pro
|
|||
Vec3d sourcePos = originator.getOriginVector();
|
||||
Vec3d sourceVel = originator.asEntity().getVelocity();
|
||||
|
||||
teleport(originator, target, sourcePos, sourceVel);
|
||||
teleport(originator, originator.asEntity(), destinationPos, destinationVel);
|
||||
Entity targetVehicle = teleport(originator, target, sourcePos, sourceVel);
|
||||
Entity sourceVehicle = teleport(originator, originator.asEntity(), destinationPos, destinationVel);
|
||||
|
||||
if (targetVehicle != null) {
|
||||
originator.asEntity().startRiding(targetVehicle);
|
||||
}
|
||||
if (sourceVehicle != null) {
|
||||
target.startRiding(sourceVehicle);
|
||||
}
|
||||
|
||||
originator.subtractEnergyCost(destinationPos.distanceTo(sourcePos) / 20F);
|
||||
}
|
||||
|
||||
private void teleport(Caster<?> source, Entity entity, Vec3d pos, Vec3d vel) {
|
||||
entity.setPosition(pos);
|
||||
private Entity teleport(Caster<?> source, Entity entity, Vec3d pos, Vec3d vel) {
|
||||
Entity oldVehicle = entity.getVehicle();
|
||||
entity.requestTeleportAndDismount(pos.x, pos.y, pos.z);
|
||||
entity.setVelocity(vel);
|
||||
entity.setGlowing(false);
|
||||
entity.playSound(USounds.SPELL_DISPLACEMENT_TELEPORT, 1, 1);
|
||||
|
@ -104,6 +113,7 @@ public class DisplacementSpell extends AbstractSpell implements HomingSpell, Pro
|
|||
if (damage > 0) {
|
||||
entity.damage(source.damageOf(UDamageTypes.EXHAUSTION, source), damage);
|
||||
}
|
||||
return oldVehicle;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
@ -277,14 +277,3 @@ public class MindSwapSpell extends MimicSpell implements ProjectileDelegate.Enti
|
|||
return clone;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
|
Loading…
Reference in a new issue