use of org.valkyrienskies.mod.common.ships.entity_interaction.EntityCollisionInjector.IntermediateMovementVariableStorage in project Valkyrien-Warfare-Revamped by ValkyrienWarfare.
the class EntityMoveInjectionMethods method handleMove.
public static IntermediateMovementVariableStorage handleMove(MoverType type, double dx, double dy, double dz, Entity this_) {
if (this_ instanceof EntityPlayer && ((EntityPlayer) this_).isSpectator()) {
return null;
}
double movDistSq = (dx * dx) + (dy * dy) + (dz * dz);
if (movDistSq > 10000) {
// Assume this_ will take us to Ship coordinates
double newX = this_.posX + dx;
double newY = this_.posY + dy;
double newZ = this_.posZ + dz;
BlockPos newPosInBlock = new BlockPos(newX, newY, newZ);
Optional<PhysicsObject> physicsObject = ValkyrienUtils.getPhysoManagingBlock(this_.world, newPosInBlock);
if (!physicsObject.isPresent()) {
return null;
}
Vector3d endPos = new Vector3d(newX, newY, newZ);
physicsObject.get().getShipTransformationManager().getCurrentTickTransform().transformPosition(endPos, TransformType.GLOBAL_TO_SUBSPACE);
dx = endPos.x - this_.posX;
dy = endPos.y - this_.posY;
dz = endPos.z - this_.posZ;
}
IntermediateMovementVariableStorage alteredMovement = EntityCollisionInjector.alterEntityMovement(this_, type, dx, dy, dz);
return alteredMovement;
}
Aggregations